@inkeep/open-knowledge 0.63.5 → 0.63.6-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/README.md +1 -1
  2. package/dist/THIRD_PARTY_NOTICES.md +1 -0
  3. package/dist/{acp-harness-probe-DWsC0HGJ.mjs → acp-harness-probe-WJAVtQtT.mjs} +2 -2
  4. package/dist/assets/skills/discovery/SKILL.md +12 -3
  5. package/dist/assets/skills/packs/codebase-wiki/references/generate-and-refresh.md +2 -2
  6. package/dist/assets/skills/packs/knowledge-base/research/SKILL.md +1 -1
  7. package/dist/assets/skills/packs/okf/SKILL.md +1 -1
  8. package/dist/assets/skills/packs/software-lifecycle/frame-a-proposal/SKILL.md +1 -1
  9. package/dist/assets/skills/packs/software-lifecycle/record-a-decision/SKILL.md +2 -2
  10. package/dist/assets/skills/packs/software-lifecycle/write-a-postmortem/SKILL.md +1 -1
  11. package/dist/assets/skills/packs/software-lifecycle/write-a-spec/SKILL.md +1 -1
  12. package/dist/assets/skills/project/SKILL.md +3 -3
  13. package/dist/assets/skills/project/references/folder-model.md +1 -1
  14. package/dist/assets/skills/project/references/linking.md +1 -1
  15. package/dist/assets/skills/project/references/media-and-assets.md +4 -4
  16. package/dist/assets/skills/project/references/onboard-existing-repo.md +5 -5
  17. package/dist/assets/skills/project/references/preview.md +1 -0
  18. package/dist/cli.d.mts +1 -7
  19. package/dist/cli.mjs +64 -62
  20. package/dist/config-schema.json +21 -1
  21. package/dist/config.project-local.schema.json +21 -1
  22. package/dist/config.project.schema.json +1 -1
  23. package/dist/config.user.schema.json +1 -1
  24. package/dist/constants-U70amxg2.mjs +2 -0
  25. package/dist/fs-traced-C5oeVBiQ.mjs +12 -0
  26. package/dist/fs-traced-DiZ_Z58g.mjs +1 -0
  27. package/dist/{git-handle-CIYTlUEZ.mjs → git-handle-3QlrPfzF.mjs} +2 -2
  28. package/dist/git-handle-ACPhpYTy.mjs +1 -0
  29. package/dist/index.d.mts +44 -29
  30. package/dist/index.mjs +175 -175
  31. package/dist/{init-wSrUXJrK.mjs → init-BvbrMy_c.mjs} +34 -34
  32. package/dist/init-OJUm6IDN.mjs +1 -0
  33. package/dist/{launch-json-removal-BCt9s9EZ.mjs → launch-json-removal-CIW-KVUE.mjs} +2 -2
  34. package/dist/loader-DEY1Nexh.mjs +1 -0
  35. package/dist/{loader-Bqkd1CSo.mjs → loader-Do24QJxR.mjs} +2 -2
  36. package/dist/md-manager-CTy1swXK.mjs +2 -0
  37. package/dist/{open-browser-C8W8YLUr.mjs → open-browser-BBXmgdSf.mjs} +2 -2
  38. package/dist/parse-worker.mjs +1 -1
  39. package/dist/{preview-CGdqYnsr.mjs → preview-BTKp_jbq.mjs} +2 -2
  40. package/dist/preview-DtqUEi9W.mjs +1 -0
  41. package/dist/public/assets/{ActivityModeContent-Dlz3nUxL.js → ActivityModeContent-CDwLnkur.js} +1 -1
  42. package/dist/public/assets/{AddPropertiesButton-BScpbmzY.js → AddPropertiesButton-CW8Aw1Ow.js} +1 -1
  43. package/dist/public/assets/{AgentDiffPane-Dp3u8-nG.js → AgentDiffPane-BVLzLkmN.js} +1 -1
  44. package/dist/public/assets/{AgentThreadClientBinder-C8R8R3h3.js → AgentThreadClientBinder-ZfgVB5_1.js} +1 -1
  45. package/dist/public/assets/{AppMenubar-D59NBp8t.js → AppMenubar-MkvVs-8F.js} +1 -1
  46. package/dist/public/assets/{BugReportHistory-DKu7HFRe.js → BugReportHistory-DihyFd3f.js} +1 -1
  47. package/dist/public/assets/{BugReportHistoryDialog-2wmafCBx.js → BugReportHistoryDialog-CSNrPEOi.js} +1 -1
  48. package/dist/public/assets/CodeMirrorPropInput-wxzi2HMF.js +3 -0
  49. package/dist/public/assets/ConsentDialogBody-DQ8IUXhF.js +2 -0
  50. package/dist/public/assets/{DiffView-DBOYN8TZ.js → DiffView-CkGEuSZT.js} +1 -1
  51. package/dist/public/assets/DocumentContext-Cvt0LP7f.js +38 -0
  52. package/dist/public/assets/{EditorModeToggle-B0rhdFw5.js → EditorModeToggle-kh954H7n.js} +1 -1
  53. package/dist/public/assets/EnableSyncConfirmDialog-CGe9_A_T.js +1 -0
  54. package/dist/public/assets/{ExcalidrawDocEditor-B8NQMhlH.js → ExcalidrawDocEditor-C-k0Gw0x.js} +3 -3
  55. package/dist/public/assets/FeedbackForm-BCVkEKZo.js +1 -0
  56. package/dist/public/assets/{GraphPanel-Btq1iKfX.js → GraphPanel-DHmyVvBK.js} +2 -2
  57. package/dist/public/assets/{ImportSkillDialog-uPL67KK-.js → ImportSkillDialog-swD86t8y.js} +1 -1
  58. package/dist/public/assets/{LintConfigEditor-DVFLPN2D.js → LintConfigEditor-Ddn-00az.js} +1 -1
  59. package/dist/public/assets/ManagedArtifactProperties-DUdzf0GY.js +1 -0
  60. package/dist/public/assets/ManagedArtifactProperties-ZyBEN-kK.js +1 -0
  61. package/dist/public/assets/McpConsentDialogBody-cAAI8kXS.js +1 -0
  62. package/dist/public/assets/{MermaidDocEditor-DWTkFC8-.js → MermaidDocEditor-jpK-jOqW.js} +1 -1
  63. package/dist/public/assets/{PropertyDisplayRow-EWSJVCPR.js → PropertyDisplayRow-DSUHH0dm.js} +2 -2
  64. package/dist/public/assets/{RegisteredAgentIcon-D_jDwJpu.js → RegisteredAgentIcon-Fkz5hv6G.js} +1 -1
  65. package/dist/public/assets/{ReportBugDialogBody-DRmJP5h-.js → ReportBugDialogBody-C1oy3fl2.js} +1 -1
  66. package/dist/public/assets/RowDisclosure-fCAaAHdQ.js +1 -0
  67. package/dist/public/assets/{SchemaConfigEditor-gJWWTfoS.js → SchemaConfigEditor-DKNjtQfc.js} +1 -1
  68. package/dist/public/assets/SessionsHost-vghNnZ3V.js +2 -0
  69. package/dist/public/assets/SettingsDialogBody-CUefNgT3.js +12 -0
  70. package/dist/public/assets/{ShareBranchSwitchDialog-BFGS4dAX.js → ShareBranchSwitchDialog-BPCd6Quz.js} +1 -1
  71. package/dist/public/assets/{ShareReceiveDialog-BnbIWRP7.js → ShareReceiveDialog-CoAGSmZ4.js} +1 -1
  72. package/dist/public/assets/{ShareReceiveMissDialog-C5IqBasi.js → ShareReceiveMissDialog-8Y26RmsH.js} +1 -1
  73. package/dist/public/assets/{SkillCostValue-V0AVu3q8.js → SkillCostValue-DgVDZJg4.js} +1 -1
  74. package/dist/public/assets/{SkillEditBanner-BHGO-py7.js → SkillEditBanner-lLVIBnoB.js} +1 -1
  75. package/dist/public/assets/{SkillInstallMenu-tVLtrElJ.js → SkillInstallMenu-qZYVaUQ-.js} +1 -1
  76. package/dist/public/assets/{SkillOriginInline-LFPeXtob.js → SkillOriginInline-TGIhdkZT.js} +1 -1
  77. package/dist/public/assets/{SkillToolbarControls-BbX1X_qw.js → SkillToolbarControls-Da999GtJ.js} +1 -1
  78. package/dist/public/assets/{SlidesToolbarControls-BWTKaM60.js → SlidesToolbarControls-CaS6tQ5s.js} +1 -1
  79. package/dist/public/assets/SourceEditor-CuLYTbyc.js +1 -0
  80. package/dist/public/assets/{TerminalPanel-C7XsW2ni.js → TerminalPanel-B9EgBHqz.js} +4 -4
  81. package/dist/public/assets/{TerminalWindowApp-Cc4os4_H.js → TerminalWindowApp-aKaZBicV.js} +1 -1
  82. package/dist/public/assets/{TextDocEditor-BpCGpD12.js → TextDocEditor-CUal8EWS.js} +1 -1
  83. package/dist/public/assets/ThreadView-dEdvtl4x.js +14 -0
  84. package/dist/public/assets/{TimelineDiffPane-CuKeqvR1.js → TimelineDiffPane-CS51BRRU.js} +1 -1
  85. package/dist/public/assets/{agent-diff-store-CUV_Wz27.js → agent-diff-store-DBEnYw8y.js} +1 -1
  86. package/dist/public/assets/auth-state-cache-BSNH7pxf.js +11 -0
  87. package/dist/public/assets/{bug-report-send-manager-Cla-OHd1.js → bug-report-send-manager-Buxf0r5c.js} +1 -1
  88. package/dist/public/assets/{calendar-C_32W35y.js → calendar-Dl_OvZ6j.js} +1 -1
  89. package/dist/public/assets/client-version-DQocZOxE.js +1 -0
  90. package/dist/public/assets/{comment-chips-ipbj1Q84.js → comment-chips-DKGNPHft.js} +1 -1
  91. package/dist/public/assets/config-provider-BkCITdUN.js +5 -0
  92. package/dist/public/assets/{dist-SCAXxKci.js → dist-Cu8jzM5J.js} +1 -1
  93. package/dist/public/assets/{dist-Ce8QgKUj2.js → dist-DSS3ixln2.js} +185 -185
  94. package/dist/public/assets/{dist-1N70TEoy2.js → dist-O5qpSCnc2.js} +1 -1
  95. package/dist/public/assets/{doc-paths-CHSXVibs.js → doc-paths-oMq41Y7d.js} +1 -1
  96. package/dist/public/assets/{documents-events-xbEOOZ0r.js → documents-events-DCcMe0wm.js} +1 -1
  97. package/dist/public/assets/field-5c9smYxo.js +1 -0
  98. package/dist/public/assets/{file-tree-adapter-DQf7roV9.js → file-tree-adapter-X5fV07Z_.js} +1 -1
  99. package/dist/public/assets/{file-tree-utils-BFfeEP1j.js → file-tree-utils-DL6Pvgvd.js} +1 -1
  100. package/dist/public/assets/{folder-config-api-CU0L7tKK.js → folder-config-api-Ca2OxXT-.js} +1 -1
  101. package/dist/public/assets/globals-Br_tCgC1.css +1 -0
  102. package/dist/public/assets/i18n-BWhLHunP.js +1 -0
  103. package/dist/public/assets/index-Cu-vLBis.js +2196 -0
  104. package/dist/public/assets/{input-group-BG4x9Co0.js → input-group-BScOj_fR.js} +1 -1
  105. package/dist/public/assets/{lint-config-client-DRimdQdD.js → lint-config-client-CumTSl-t.js} +1 -1
  106. package/dist/public/assets/markdownlint-rule-browser-BYdFk19L.js +1 -0
  107. package/dist/public/assets/messages-B2hUo_Xd.js +1 -0
  108. package/dist/public/assets/messages-BQ-C7DO5.js +1 -0
  109. package/dist/public/assets/messages-BVii8gJ-.js +1 -0
  110. package/dist/public/assets/messages-Bty_PjtX.js +1 -0
  111. package/dist/public/assets/messages-CLyVrekl.js +1 -0
  112. package/dist/public/assets/messages-COIWQ-j4.js +1 -0
  113. package/dist/public/assets/messages-CU1qUVuk.js +1 -0
  114. package/dist/public/assets/messages-CUPuto82.js +1 -0
  115. package/dist/public/assets/messages-D0de9xXn.js +1 -0
  116. package/dist/public/assets/messages-DgoaqCkp.js +1 -0
  117. package/dist/public/assets/messages-aUA-LBBS.js +1 -0
  118. package/dist/public/assets/messages-zKbHKiGQ.js +1 -0
  119. package/dist/public/assets/ok-XpAzrb6Z.js +1 -0
  120. package/dist/public/assets/page-list-cache-NegxJAbd.js +1 -0
  121. package/dist/public/assets/{pending-receive-nav-store-uWCtyHYI.js → pending-receive-nav-store-BDfVJPhG.js} +1 -1
  122. package/dist/public/assets/popover-CA_JdlWS.js +1 -0
  123. package/dist/public/assets/progress-BeVvrxJn.js +9 -0
  124. package/dist/public/assets/project-paths-C-SkuTbI.js +1 -0
  125. package/dist/public/assets/{prop-types-h2mOVWO9.js → prop-types-nOgQFiCi.js} +1 -1
  126. package/dist/public/assets/{receive-store-BA-7J_9S.js → receive-store-D9Px8yTN.js} +1 -1
  127. package/dist/public/assets/rotate-ccw-Dh7y6tzD.js +1 -0
  128. package/dist/public/assets/{selection-context-B5FUPLvJ.js → selection-context-OMBgzLme.js} +1 -1
  129. package/dist/public/assets/{skill-scope-S38ho6V2.js → skill-scope-DWsJ838z.js} +1 -1
  130. package/dist/public/assets/{skills-api-MlE0X9DC.js → skills-api-BLXzXEC-.js} +1 -1
  131. package/dist/public/assets/{src-DtQx0-N1.js → src-BhVr0kka.js} +1 -1
  132. package/dist/public/assets/{tag-pill-input-BNvy_T1P.js → tag-pill-input-DwIQ-TmP.js} +1 -1
  133. package/dist/public/assets/{target-navigation-intent-C74Rtw7A.js → target-navigation-intent-CJUCqJBv.js} +1 -1
  134. package/dist/public/assets/{telemetry-impl-DKudPu9V.js → telemetry-impl-CS8q68dm.js} +1 -1
  135. package/dist/public/assets/{telemetry-startup-wvejDKve.js → telemetry-startup-DxikYwVQ.js} +1 -1
  136. package/dist/public/assets/{download-Bdmlj4Jo.js → terminal-CFd7qrv_.js} +1 -1
  137. package/dist/public/assets/{terminal-cli-display-BOx5rFUv.js → terminal-cli-display-C-s_gqLX.js} +1 -1
  138. package/dist/public/assets/terminal-command-events-ponJwwNv.js +1 -0
  139. package/dist/public/assets/{terminal-launch-events-CLgfK16W.js → terminal-launch-events-vGjuKPQL.js} +1 -1
  140. package/dist/public/assets/{terminal-telemetry-akEbrUKt.js → terminal-telemetry-B16z13Uq.js} +1 -1
  141. package/dist/public/assets/thread-client-o-xHAmeK.js +1 -0
  142. package/dist/public/assets/{typing-burst-detector-BfvtamrV.js → typing-burst-detector-B3y1Rq0N.js} +3 -3
  143. package/dist/public/assets/{uninstall-SAQXZG17.js → uninstall-BAaKe1f7.js} +1 -1
  144. package/dist/public/assets/use-activity-panel-CgE_sMHl.js +1 -0
  145. package/dist/public/assets/{use-apply-config-color-theme-NEQhq5zu.js → use-apply-config-color-theme-BEWFuTWv.js} +1 -1
  146. package/dist/public/assets/{use-collab-url-CA0gBqow.js → use-collab-url-CwkAA1lj.js} +1 -1
  147. package/dist/public/assets/{use-live-xterm-theme-8QZwbrNw.js → use-live-xterm-theme-C2sLeh-e.js} +1 -1
  148. package/dist/public/assets/{use-open-skill-DbMNgFC4.js → use-open-skill-UxwOkgOg.js} +1 -1
  149. package/dist/public/assets/{use-settings-route-juHfAFnp.js → use-settings-route-DOVNFDSn.js} +1 -1
  150. package/dist/public/assets/{use-skill-origin-B20eK786.js → use-skill-origin-Cyn5juIp.js} +1 -1
  151. package/dist/public/assets/{use-skills-CFe_Pfyl.js → use-skills-szHEgJLb.js} +1 -1
  152. package/dist/public/assets/{use-terminal-enabled-B6G42XNq.js → use-terminal-enabled-RWpxHojI.js} +1 -1
  153. package/dist/public/assets/use-timeline-entry-diff-CiMOs2tM.js +6 -0
  154. package/dist/public/assets/{use-workspace-Cq3LTz0y.js → use-workspace-DriKk3ci.js} +1 -1
  155. package/dist/public/index.html +81 -80
  156. package/dist/public/uninstall.html +7 -7
  157. package/dist/{repair-launch-json-DSDbWrfw.mjs → repair-launch-json-CHHqMadD.mjs} +2 -2
  158. package/dist/{repair-mcp-configs-Ia8AySAh.mjs → repair-mcp-configs-EXM9zl9Q.mjs} +2 -2
  159. package/dist/{repair-skills-B7T9ybuC.mjs → repair-skills-CM72fFBm.mjs} +2 -2
  160. package/dist/repair-skills-COLAZSGU.mjs +1 -0
  161. package/dist/{resolve-project-root-BF1NyEri.mjs → resolve-project-root-FELgKP-i.mjs} +4 -4
  162. package/dist/schemas/v0/config.project-local.schema.json +21 -1
  163. package/dist/schemas/v0/config.project.schema.json +1 -1
  164. package/dist/schemas/v0/config.user.schema.json +1 -1
  165. package/dist/server-lock-CKYMJfzI.mjs +1 -0
  166. package/dist/{server-lock-C0j1Yr_I.mjs → server-lock-DW446_ti.mjs} +2 -2
  167. package/dist/{skill-teardown-B9-HO2ID.mjs → skill-teardown-TN6Eh0tj.mjs} +2 -2
  168. package/dist/{sleep-D4NlDISj.mjs → sleep-DyLEGHvt.mjs} +26 -25
  169. package/dist/src-B9KXB9Ap.mjs +1 -0
  170. package/dist/src-BBvMpF-z.mjs +1 -0
  171. package/dist/src-BJwPz37r.mjs +20 -0
  172. package/dist/{src-Bt6_UxL9.mjs → src-Cjs2mjwW.mjs} +120 -120
  173. package/dist/src-DKRPWoiG.mjs +2039 -0
  174. package/dist/start-BpLu52x0.mjs +1 -0
  175. package/dist/{start-Be-1kSvv.mjs → start-DUjsSsyo.mjs} +3 -3
  176. package/package.json +4 -4
  177. package/dist/constants-B-n_YWgP.mjs +0 -2
  178. package/dist/fs-traced-Cbn6E9Vr.mjs +0 -1
  179. package/dist/fs-traced-Dm4NQ6S5.mjs +0 -12
  180. package/dist/git-handle-B0iwHPX9.mjs +0 -1
  181. package/dist/init-BTa8cPq4.mjs +0 -1
  182. package/dist/loader-DemlsGk6.mjs +0 -1
  183. package/dist/md-manager-N3eB5SRj.mjs +0 -2
  184. package/dist/preview-BGDZ2F6V.mjs +0 -1
  185. package/dist/public/assets/CodeMirrorPropInput-D97N2Z43.js +0 -3
  186. package/dist/public/assets/ConsentDialogBody-BrU01-jw.js +0 -2
  187. package/dist/public/assets/DocumentContext-DLZBeoOd.js +0 -38
  188. package/dist/public/assets/EnableSyncConfirmDialog-Cit0Slhm.js +0 -1
  189. package/dist/public/assets/FeedbackForm-CTxes5S9.js +0 -1
  190. package/dist/public/assets/ManagedArtifactProperties-BA4A4hoD.js +0 -1
  191. package/dist/public/assets/ManagedArtifactProperties-wz-anoGk.js +0 -1
  192. package/dist/public/assets/McpConsentDialogBody-BhVT9dPx.js +0 -1
  193. package/dist/public/assets/SessionsHost-h8_7B9cX.js +0 -2
  194. package/dist/public/assets/SettingsDialogBody-D3VCcRPW.js +0 -12
  195. package/dist/public/assets/SourceEditor-Bb42LBh0.js +0 -1
  196. package/dist/public/assets/ThreadView-D4ifWiSA.js +0 -14
  197. package/dist/public/assets/auth-state-cache-DXmRaSS7.js +0 -11
  198. package/dist/public/assets/client-version-C-LRLMDd.js +0 -1
  199. package/dist/public/assets/config-provider-CjNHraCK.js +0 -5
  200. package/dist/public/assets/field-CtUgODi9.js +0 -1
  201. package/dist/public/assets/globals-DExKtDoE.css +0 -1
  202. package/dist/public/assets/i18n-Yuv17jl2.js +0 -1
  203. package/dist/public/assets/index-BztAm1Wv.js +0 -2196
  204. package/dist/public/assets/markdownlint-rule-browser-CZYawfE0.js +0 -1
  205. package/dist/public/assets/messages-B4vyk0Oe.js +0 -1
  206. package/dist/public/assets/messages-Bry-igYF.js +0 -1
  207. package/dist/public/assets/messages-C-vHgGCq.js +0 -1
  208. package/dist/public/assets/messages-CyOd2E4x.js +0 -1
  209. package/dist/public/assets/messages-Czl8K-VD.js +0 -1
  210. package/dist/public/assets/messages-D6n-Lvbi.js +0 -1
  211. package/dist/public/assets/messages-DFdt_O5T.js +0 -1
  212. package/dist/public/assets/messages-DXYzwWT9.js +0 -1
  213. package/dist/public/assets/messages-DYELQ0Z6.js +0 -1
  214. package/dist/public/assets/messages-DcU5DDUm.js +0 -1
  215. package/dist/public/assets/messages-DmlpLtXS.js +0 -1
  216. package/dist/public/assets/messages-HxBLjyRy.js +0 -1
  217. package/dist/public/assets/ok-D3euoYhD.js +0 -1
  218. package/dist/public/assets/page-list-cache-hdVNMZkU.js +0 -1
  219. package/dist/public/assets/popover-DAe-_3rj.js +0 -1
  220. package/dist/public/assets/progress-Dc1sTPpY.js +0 -9
  221. package/dist/public/assets/project-paths-DFtdLgxL.js +0 -1
  222. package/dist/public/assets/separator-BmK42_9U.js +0 -1
  223. package/dist/public/assets/terminal-CmHqE3At.js +0 -1
  224. package/dist/public/assets/terminal-command-events-CaYhHIDg.js +0 -1
  225. package/dist/public/assets/thread-client-Ox08BqB2.js +0 -1
  226. package/dist/public/assets/use-activity-panel-epy1woDH.js +0 -1
  227. package/dist/public/assets/use-timeline-entry-diff-BYai8_il.js +0 -6
  228. package/dist/repair-skills-D33RJQek.mjs +0 -1
  229. package/dist/server-lock-CJBewXA-.mjs +0 -1
  230. package/dist/src-C7IJWx9K.mjs +0 -20
  231. package/dist/src-DQyTLMJF.mjs +0 -1
  232. package/dist/src-DVSl6r9t.mjs +0 -1
  233. package/dist/src-bhsVUHJJ.mjs +0 -2038
  234. package/dist/start-CCbf73n-.mjs +0 -1
  235. /package/dist/public/assets/{ConfigSharingInfoTooltip-vG0lwpqt.js → ConfigSharingInfoTooltip-N4ECgZTE.js} +0 -0
  236. /package/dist/public/assets/{SkillModeBanner-Cfij5biF.js → SkillModeBanner-PA3mUtQ4.js} +0 -0
  237. /package/dist/public/assets/{agent-presence-3JajMNAq.js → agent-presence-C_iH_p3q.js} +0 -0
  238. /package/dist/public/assets/{app-menubar-gate-q1nJIutw.js → app-menubar-gate-CDiv0-ec.js} +0 -0
  239. /package/dist/public/assets/{auth-prompt-store-vAFATIFt.js → auth-prompt-store-BXeyTyYx.js} +0 -0
  240. /package/dist/public/assets/{copilot-DMpTxujg.js → copilot-BvcrBiQu.js} +0 -0
  241. /package/dist/public/assets/{cursor-2VSK5BUh.js → cursor-Dy0g2caC.js} +0 -0
  242. /package/dist/public/assets/{dist-D8CXqbDc2.js → dist-BFkXO51e2.js} +0 -0
  243. /package/dist/public/assets/{form-BZhYIbqM.js → form-DWhbcQ6z.js} +0 -0
  244. /package/dist/public/assets/{format-CyaLi0or.js → format-CWkG0foI.js} +0 -0
  245. /package/dist/public/assets/{globals-KTXx85LN.js → globals-DWxOaSHQ.js} +0 -0
  246. /package/dist/public/assets/{panel-DNPki55m.js → panel-Do94xfkL.js} +0 -0
  247. /package/dist/public/assets/{platform-labels-CTgi7sF6.js → platform-labels-CwDqSSkR.js} +0 -0
  248. /package/dist/public/assets/{skeleton-BZIHOzZH.js → skeleton-DIxLroLR.js} +0 -0
  249. /package/dist/public/assets/{sortable.esm-DK-jMveF.js → sortable.esm-DVUoPZjJ.js} +0 -0
  250. /package/dist/public/assets/{square-pen-BlKNuUz7.js → square-pen-Blyr7NAu.js} +0 -0
  251. /package/dist/public/assets/{text-viewer-languages-D1G0H8jz.js → text-viewer-languages-BtwF8E4F.js} +0 -0
  252. /package/dist/public/assets/{textarea-BoMa_3jF.js → textarea-BtqZ3yY1.js} +0 -0
  253. /package/dist/public/assets/{timeline-diff-store-ym5Oz1UF.js → timeline-diff-store-BaXPeva3.js} +0 -0
  254. /package/dist/public/assets/{tool-list-format-CC-FRU0G.js → tool-list-format-HdFmW82S.js} +0 -0
  255. /package/dist/public/assets/{use-installed-clis-t29XGX_x.js → use-installed-clis-vg6izNL9.js} +0 -0
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t}from"./dist-Nvb76hAm.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{t as r}from"./button-CA0dewJJ.js";import{t as i}from"./dist-BIGNzOeF2.js";import{i as a,r as o,t as s}from"./popover-DAe-_3rj.js";var c=n(),l=e();function u(e){let n=(0,c.c)(14),{title:i,testId:u,children:d}=e,f;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,l.jsx)(t,{id:`aS77on`}),n[0]=f):f=n[0];let p;n[1]===u?p=n[2]:(p=(0,l.jsx)(a,{asChild:!0,children:(0,l.jsx)(r,{type:`button`,variant:`link-muted`,size:`sm`,className:`absolute end-3 top-2 px-1 text-1sm font-normal underline decoration-dotted decoration-muted-foreground/50 underline-offset-4 hover:decoration-foreground`,"data-testid":u,children:f})}),n[1]=u,n[2]=p);let m;n[3]===i?m=n[4]:(m=(0,l.jsx)(`span`,{className:`font-mono text-2xs text-muted-foreground uppercase tracking-wide`,children:i}),n[3]=i,n[4]=m);let h;n[5]!==d||n[6]!==m?(h=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 text-xs leading-normal`,children:[m,d]}),n[5]=d,n[6]=m,n[7]=h):h=n[7];let g;n[8]!==h||n[9]!==i?(g=(0,l.jsx)(o,{align:`end`,"aria-label":i,className:`max-h-(--radix-popover-content-available-height) w-96 max-w-(--radix-popover-content-available-width) overflow-y-auto p-3 subtle-scrollbar`,children:h}),n[8]=h,n[9]=i,n[10]=g):g=n[10];let _;return n[11]!==p||n[12]!==g?(_=(0,l.jsxs)(s,{children:[p,g]}),n[11]=p,n[12]=g,n[13]=_):_=n[13],_}function d(){let e=null,t=null,n=new Set,r=!1,a=null;function o(){for(let e of n)e()}function s(){e!==null&&(e=null,o())}return{install({bridge:n}){if(n)return r?a??void 0:(r=!0,t=n,a=n.mcpWiring.onShow(t=>{e=t,o()}),n.mcpWiring.signalReady(),()=>{a?.(),a=null,r=!1,t=null,s()})},getSnapshot(){return e},subscribe(e){return n.add(e),()=>{n.delete(e)}},async confirm(e){let n=t;if(!n)return{ok:!1,error:i._({id:`bEp7UY`})};try{let t=await n.mcpWiring.confirm(e);return t.ok&&s(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:i._({id:`29VNqC`})}}},async skip(){let e=t;if(!e)return{ok:!1,error:i._({id:`bEp7UY`})};try{let t=await e.mcpWiring.skip();return t.ok&&s(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:i._({id:`29VNqC`})}}},dismiss(){s()}}}var f=d();function p(e){return f.install(e)}function m(e){let t=(0,c.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,l.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,l.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,l.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,l.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,l.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,l.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,l.jsx)(`defs`,{children:(0,l.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,l.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,l.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,l.jsx)(`feOffset`,{dy:`2.85714`}),(0,l.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,l.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,l.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,l.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,l.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,l.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}export{u as i,p as n,f as r,m as t};
@@ -1 +0,0 @@
1
- import{As as e,Bo as t,D as n,Ds as r,Es as i,Fo as a,Ho as o,Io as s,Ko as c,Lo as l,Ps as u,Uo as d,Ur as f,Zi as p,jo as m,qo as h,zo as g}from"./dist-Ce8QgKUj2.js";import{r as _}from"./doc-paths-CHSXVibs.js";import{o as v,r as y}from"./file-tree-utils-BFfeEP1j.js";function b(e){return e.scope===`project`?c(x(e)):d(e.scope,e.name,e.hostQualifier)}function x(e){return e.canonicalPath??e.path}function S(e,t){return e.scope===`project`?`${x(e).replace(/\/SKILL\.mdx?$/i,``)}/${c(t)}`:o(e.scope,e.name,t,e.hostQualifier)}function C(e){let t=l(e);return t?.kind===`skill`?t.name:null}function w(e){let t=e.trim();return{normalizedTarget:t.replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\/+$/g,``),expectsFolder:/\/+$/.test(t)}}function T(e){return _(e).replace(/\/+$/g,``)}function E(e){let t=new Set;for(let n of e)for(let e of y(n))t.add(e);return t}function D(e,t){if(!t)return;let n=p(e);if(n)return t.get(n)}function O(e,t){if(!t||e.includes(`/`))return;let n=p(e);if(n)return t.get(n)}function k(e,t){return t?`${e}${t}`:(e.split(`/`).pop()??``).lastIndexOf(`.`)>0?e:`${e}.md`}function A(e,t){if(!v(e)||g(e)||t.pages.has(e))return null;let n=k(e,t.docExt);return{kind:`asset`,target:n,assetPath:n,mediaKind:u(n.slice(n.lastIndexOf(`.`)+1))}}function j(n,o){if(m(n)){let e=s(n);if(e?.kind===`skill`&&e.scope===`project`){let n=t(e.name);return{kind:`doc`,target:n,docName:n}}let r=a(n);if(r){let e=h(r.folder,r.name);return{kind:`doc`,target:e,docName:e}}return{kind:`doc`,target:n,docName:n}}if(C(n))return{kind:`doc`,target:n,docName:n};let c=g(n);if(c){let e=h(c.folder,c.name);return{kind:`doc`,target:e,docName:e}}let{normalizedTarget:l,expectsFolder:u}=w(n);if(!l)return{kind:`missing`,target:l};if(!u&&(e(l)||r(l)||i(l)))return{kind:`doc`,target:l,docName:l};let d=T(n);if(!u&&o.pages.has(l))return{kind:`doc`,target:l,docName:l};if(!u&&d!==l&&o.pages.has(d))return{kind:`doc`,target:d,docName:d};if(!u){let e=D(d,o.pagesBySlug);if(e)return{kind:`doc`,target:e,docName:e}}let f=`${d}/index`;if(o.pages.has(f))return{kind:`folder-index`,target:d,folderPath:d,docName:f,noteKind:`canonical-index`};let p=d.split(`/`).pop(),_=p?`${d}/${p}`:null;if(_&&o.pages.has(_))return{kind:`folder-index`,target:d,folderPath:d,docName:_,noteKind:`legacy-folder-note`};if(!u){let e=O(d,o.pagesByBasename);if(e)return{kind:`doc`,target:e,docName:e}}if((o.folderPaths??E(o.pages)).has(d))return{kind:`folder`,target:d,folderPath:d};if(!u){let e=A(l,o);if(e)return e}return{kind:`missing`,target:d||l}}function M(e){return e.kind===`folder-index`?{kind:`folder`,target:e.folderPath,folderPath:e.folderPath}:e}function N(e,t,r=n){return typeof t!=`number`||!f(t,r)?null:{kind:`large-file`,target:e,docName:e,size:t,limit:r}}function P(e,t,r=n){return e.kind!==`doc`&&e.kind!==`folder-index`?e:N(e.docName,t.get(e.docName)?.size,r)??e}function F(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return e.docName;case`missing`:return e.target;case`asset`:case`skill-file`:case`skills`:case`skill-preview`:case`folder`:return null}}var I=null,L=new Set;function R(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function z(e,t){return e===null?!1:e===t?!0:R(e.pages,t.pages)&&R(e.folderPaths,t.folderPaths)&&R(e.assetPaths??new Set,t.assetPaths??new Set)&&R(e.filePaths??new Set,t.filePaths??new Set)&&B(e.pageIcons,t.pageIcons)}function B(e,t){if(e===t)return!0;let n=e?.size??0;if(n!==(t?.size??0))return!1;if(n===0)return!0;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function V(e){let t=new Map;for(let[n,r]of e){let e=r.icon;typeof e==`string`&&e.trim()!==``&&t.set(n,e)}return t}function H(){return I}function U(e){if(!z(I,e)){I=e;for(let t of Array.from(L))try{t(e)}catch(e){console.error(`[page-list-cache] subscriber threw:`,e)}}}function W(e){if(L.add(e),I!==null)try{e(I)}catch(e){console.error(`[page-list-cache] subscriber threw on replay:`,e)}return()=>{L.delete(e)}}export{E as a,N as c,P as d,C as f,W as i,A as l,b as m,H as n,F as o,S as p,U as r,M as s,V as t,j as u};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{t}from"./compiler-runtime-BfE3aGVn.js";import{t as n}from"./utils-CPqDy6Hr.js";import{a as r,i,o as a,r as o,t as s}from"./dist-SCAXxKci.js";var c=t(),l=e();function u(e){let t=(0,c.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let i;return t[2]===n?i=t[3]:(i=(0,l.jsx)(r,{"data-slot":`popover`,...n}),t[2]=n,t[3]=i),i}function d(e){let t=(0,c.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,l.jsx)(a,{"data-slot":`popover-trigger`,...n}),t[2]=n,t[3]=r),r}function f(e){let t=(0,c.c)(12),r,a,s,u;t[0]===e?(r=t[1],a=t[2],s=t[3],u=t[4]):({className:r,align:s,sideOffset:u,...a}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=s,t[4]=u);let d=s===void 0?`center`:s,f=u===void 0?4:u,p;t[5]===r?p=t[6]:(p=n(`z-50 w-72 rounded-lg border bg-popover p-4 text-popover-foreground shadow-md outline-hidden origin-(--radix-popover-content-transform-origin) duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,r),t[5]=r,t[6]=p);let m;return t[7]!==d||t[8]!==a||t[9]!==f||t[10]!==p?(m=(0,l.jsx)(i,{children:(0,l.jsx)(o,{"data-slot":`popover-content`,align:d,sideOffset:f,className:p,...a})}),t[7]=d,t[8]=a,t[9]=f,t[10]=p,t[11]=m):m=t[11],m}function p(e){let t=(0,c.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,l.jsx)(s,{"data-slot":`popover-anchor`,...n}),t[2]=n,t[3]=r),r}export{d as i,p as n,f as r,u as t};
@@ -1,9 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,P as r,R as i}from"./DocumentContext-DLZBeoOd.js";import{t as a}from"./react-f2sANaYj.js";import{r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./utils-CPqDy6Hr.js";import{r as l,t as u}from"./button-CA0dewJJ.js";import{c as d,l as f}from"./dist-DsLZcVyZ.js";import{C as p,H as m,L as h,S as g,W as _,f as v,g as ee,h as y,l as te,m as b,p as x,u as S}from"./CodeMirrorPropInput-D97N2Z43.js";import{t as C}from"./separator-BmK42_9U.js";import{Ba as w,Ga as T,Pa as E,Ra as D,Wa as O,_a as k,aa as A,ia as j,ma as M,oa as N,pt as ne,ra as P,za as F}from"./dist-Ce8QgKUj2.js";import{t as I}from"./dist-BIGNzOeF2.js";import{t as L}from"./workspace-paths-CD0W1etA.js";import{t as re}from"./createLucideIcon-CAkY8Blx.js";import{t as R}from"./x-wQUDJS55.js";var z=e(a(),1),B=t(),V=`Progress`,H=100,[U,ie]=d(V),[W,G]=U(V),K=z.forwardRef((e,t)=>{let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=Y,...o}=e;(i||i===0)&&!oe(i)&&console.error(ce(`${i}`,`Progress`));let s=oe(i)?i:H;r!==null&&!se(r,s)&&console.error(le(`${r}`,`Progress`));let c=se(r,s)?r:null,l=ae(c)?a(c,s):void 0;return(0,B.jsx)(W,{scope:n,value:c,max:s,children:(0,B.jsx)(f.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":ae(c)?c:void 0,"aria-valuetext":l,role:`progressbar`,"data-state":X(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});K.displayName=V;var q=`ProgressIndicator`,J=z.forwardRef((e,t)=>{let{__scopeProgress:n,...r}=e,i=G(q,n);return(0,B.jsx)(f.div,{"data-state":X(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});J.displayName=q;function Y(e,t){return`${Math.round(e/t*100)}%`}function X(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}function ae(e){return typeof e==`number`}function oe(e){return ae(e)&&!isNaN(e)&&e>0}function se(e,t){return ae(e)&&!isNaN(e)&&e<=t&&e>=0}function ce(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${H}\`.`}function le(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
2
- - a positive number
3
- - less than the value passed to \`max\` (or ${H} if no \`max\` prop is set)
4
- - \`null\` or \`undefined\` if the progress is indeterminate.
5
-
6
- Defaulting to \`null\`.`}var ue=K,de=J,fe=re(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),Z=s(),pe=l(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function me(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=c(pe({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,B.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function he(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=c(`relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,B.jsx)(C,{"data-slot":`button-group-separator`,orientation:a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var ge=`ok-ask-ai-draft-v2`,_e={doc:null,dismissed:!1};function ve(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var ye=null,be=new Set;function xe(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function Se(){let e=ve();if(!e)return _e;try{let t=e.getItem(ge);if(!t)return _e;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?_e:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),_e}}function Ce(){return ye===null&&(ye=Se()),ye}function we(e){let t=ve();if(t)try{e&&!xe(e)?t.setItem(ge,JSON.stringify(e)):t.removeItem(ge)}catch{}}function Te(){for(let e of be)e()}function Ee(){return Ce()}function De(e){let t=e&&!xe(e)?e:null;ye={...Ce(),doc:t},we(t),Te()}function Oe(){De(null)}var ke=P;function Ae(e){let t=g(e).kind;return t===`folder`||t===`asset`?t:`page`}function je(e){let t=(0,Z.c)(14),{items:n,query:i,selectedIndex:a,onSelect:s,loading:c,error:l,hasMore:u}=e,d=c===void 0?!1:c,f=l===void 0?!1:l,p=u===void 0?!1:u,{_:m}=o(),h=(0,z.useId)(),g=(0,z.useRef)(null),_,v;t[0]===a?(_=t[1],v=t[2]):(_=()=>{(g.current?.querySelectorAll(`[role="option"]`))?.item(a)?.scrollIntoView({block:`nearest`})},v=[a],t[0]=a,t[1]=_,t[2]=v),(0,z.useEffect)(_,v);let ee=a>=0&&a<n.length?n[a]:null,y;return t[3]!==m||t[4]!==f||t[5]!==p||t[6]!==n||t[7]!==h||t[8]!==d||t[9]!==s||t[10]!==i||t[11]!==a||t[12]!==ee?(y=(0,B.jsx)(`div`,{ref:g,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:d?(0,B.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:m({id:`3m2GBo`})}):f?(0,B.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:m({id:`weP6me`})}):n.length===0?(0,B.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:i.trim()===``?m({id:`0E9DR6`}):m({id:`yQyglE`})}):(0,B.jsxs)(`div`,{role:`listbox`,id:h,"aria-label":m({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar`,children:[(0,B.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:ee?ee.title:``}),n.map((e,t)=>{let n=t===a,i=Ae(e.path),o=i===`folder`,c=o?`${e.path}/`:e.path;return(0,B.jsxs)(`button`,{id:`${h}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":i,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),s(e)},children:[(0,B.jsx)(r,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,B.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,B.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:m({id:`kNqMMd`})}):null]}),(0,B.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:c})]})]},e.docName)}),p?(0,B.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:m({id:`F1T9y_`})}):null]})}),t[3]=m,t[4]=f,t[5]=p,t[6]=n,t[7]=h,t[8]=d,t[9]=s,t[10]=i,t[11]=a,t[12]=ee,t[13]=y):y=t[13],y}function Me(e){let t=(0,Z.c)(12),{items:n,query:r,selectedIndex:i,onSelect:a,commandsKnown:s}=e,{_:c}=o(),l=(0,z.useId)(),u=(0,z.useRef)(null),d,f;t[0]===i?(d=t[1],f=t[2]):(d=()=>{(u.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},f=[i],t[0]=i,t[1]=d,t[2]=f),(0,z.useEffect)(d,f);let p=i>=0&&i<n.length?n[i]:null,m;return t[3]!==c||t[4]!==s||t[5]!==n||t[6]!==l||t[7]!==a||t[8]!==r||t[9]!==i||t[10]!==p?(m=(0,B.jsx)(`div`,{ref:u,"data-testid":`composer-slash-menu`,className:`w-[42rem] max-w-[min(42rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:n.length===0?(0,B.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:s?r.trim()===``?c({id:`QohqVL`}):c({id:`odYWGJ`}):c({id:`9OPs7U`})}):(0,B.jsxs)(`div`,{role:`listbox`,id:l,"aria-label":c({id:`67Dpmh`}),tabIndex:-1,className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar`,children:[(0,B.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:p?`/${p.name}`:``}),n.map((e,t)=>{let n=t===i;return(0,B.jsxs)(`button`,{id:`${l}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-testid":`composer-slash-option-${e.name}`,className:`flex w-full items-baseline gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,B.jsxs)(`span`,{className:`shrink-0 font-mono text-sm font-medium`,children:[`/`,e.name]}),(0,B.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-xs text-muted-foreground`,children:e.description})]},e.name)})]})}),t[3]=c,t[4]=s,t[5]=n,t[6]=l,t[7]=a,t[8]=r,t[9]=i,t[10]=p,t[11]=m):m=t[11],m}var Ne=new T(`composerSlashSuggestion`),Pe=k.create({name:`composerCommand`,group:`inline`,inline:!0,atom:!0,selectable:!1,addAttributes(){return{name:{default:``},description:{default:``},hint:{default:``}}},parseHTML(){return[{tag:`span[data-composer-command]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.name??``);return[`span`,E(t,{"data-composer-command":n,class:`composer-slash-token composer-slash-token-known`}),`/${n}`]},renderText({node:e}){return`/${e.attrs.name}`}}),Fe=new T(`composerSlashToken`),Ie=`composerSlashCommand`;function Le(e){return e.storage[Ie]}function Re(e){return Le(e)?.commands??null}function ze(e,t){let n=Le(e);return n===void 0||n.commands===t?!1:(n.commands=t,!0)}function Be(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=[],i=[],a=[];for(let t of e){let e=t.name.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)?i.push(t):t.description.toLowerCase().includes(n)&&a.push(t)}return[...r,...i,...a]}function Ve(e){let t=/^\/(\S+)/.exec(e);return t===null?null:{name:t[1]??``,length:t[0].length}}function He(e,t){let n=Ve(e);if(n===null||t===null)return null;let r=t.find(e=>e.name===n.name);return r===void 0?{kind:`unknown`,name:n.name,agentHasCommands:t.length>0}:{kind:`known`,name:r.name,description:r.description}}function Ue(e){return We(e.state.doc.firstChild)}function We(e){let t=e?.firstChild??null;return t?.isText?t.text??``:``}function Ge(e,t){let n=e.firstChild,r=n?.firstChild??null;if(r!==null&&r.type.name===`composerCommand`){if(!Je(e))return w.empty;let t=String(r.attrs.hint??``),i=String(r.attrs.description??``),a=t===``?i===``?``:`— ${i}`:t;return a===``?w.empty:w.create(e,[Ke(1+(n?.content.size??0),a,String(r.attrs.name))])}if(t===null)return w.empty;let i=Ve(We(e.firstChild));if(i===null)return w.empty;let a=t.find(e=>e.name===i.name),o=[F.inline(1,1+i.length,{class:a===void 0?`composer-slash-token composer-slash-token-unknown`:`composer-slash-token composer-slash-token-known`})];if(a!==void 0&&qe(e,i.length)){let t=a.input?.hint!=null&&a.input.hint!==``?a.input.hint:`— ${a.description}`;(a.description!==``||a.input?.hint)&&o.push(Ke(1+(e.firstChild?.firstChild?.nodeSize??0),t,a.name))}return w.create(e,o)}function Ke(e,t,n){return F.widget(e,()=>{let e=document.createElement(`span`);return e.className=`composer-slash-ghost`,e.setAttribute(`aria-hidden`,`true`),e.textContent=t,e},{side:1,key:`slash-ghost:${n}`})}function qe(e,t){if(e.childCount!==1)return!1;let n=e.firstChild;if(n===null||n.childCount!==1)return!1;let r=n.firstChild;if(r===null||!r.isText)return!1;let i=r.text??``;return i.length<=t+1&&(i.length===t||i.endsWith(` `))}function Je(e){if(e.childCount!==1)return!1;let t=e.firstChild;if(t===null)return!1;if(t.childCount===1)return!0;if(t.childCount!==2)return!1;let n=t.child(1);return n.isText&&/^\s*$/.test(n.text??``)}var Ye=M.create({name:Ie,addOptions(){return{commands:null}},addStorage(){return{commands:this.options.commands}},addProseMirrorPlugins(){let e=this.storage,t=()=>e.commands??null;return[new O({key:Fe,state:{init:(e,n)=>Ge(n.doc,t()),apply:e=>Ge(e.doc,t())},props:{decorations(e){return this.getState(e)}}}),p({editor:this.editor,pluginKey:Ne,char:`/`,startOfLine:!0,allow:({range:e})=>e.from===1,items:({query:e})=>{let n=t();return n===null||n.length===0?[]:Be(n,e)},command:({editor:e,range:t,props:n})=>{let r=e.state.doc.firstChild?.firstChild??null,i=r?.isText?Ve(r.text??``)?.length??0:0;try{e.chain().focus().deleteRange({from:t.from,to:Math.max(t.to,1+i)}).insertContent([{type:`composerCommand`,attrs:{name:n.name,description:n.description,hint:n.input?.hint??``}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-slash-command] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{o=e.editor.view,y(o,(e.items??[]).length)},l=e=>({items:e.items??[],query:e.query??``,selectedIndex:r,onSelect:s,commandsKnown:t()!==null}),u=()=>{!e||!n||e.updateProps(l(n))};return{onBeforeStart(t){n=t,r=0,c(t);let o=x(()=>n,`composer-slash`);i.popup=o.popup,a=o.doPosition,e=new m(Me,{props:l(t),editor:t.editor}),o.popup.appendChild(e.element),i.stopAutoUpdate=o.startAutoUpdate(),o.reveal()},onStart(e){n=e,r=0,c(e),u()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),c(e),u(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,u(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,u(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){b(i),a=null,e?.destroy(),e=null,n=null,r=0,o!==null&&(v(o),o=null)}}}})]}}),Xe=8,Ze=new T(`composerMentionSuggestion`);function Qe(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:L(e.docName)}var $e=k.create({name:`doc`,topNode:!0,content:`paragraph+`}),et=k.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),tt=k.create({name:`text`,group:`inline`}),nt=k.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),rt=M.create({name:`composerHistory`,addProseMirrorPlugins(){return[j(),D({"Mod-z":N,"Mod-y":A,"Shift-Mod-z":A})]}}),it=k.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``},mentionKind:{default:`file`}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,E(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:r})=>{let a=String(e.attrs.path??``),o=String(e.attrs.label||e.attrs.path),s=document.createElement(`span`);s.className=`composer-mention-chip group/mention`,s.setAttribute(`data-composer-mention`,a),s.title=o;let c=document.createElement(`button`);c.type=`button`,c.className=`composer-mention-icon`,c.setAttribute(`aria-label`,I._({id:`Xzy0s0`,values:{fullLabel:o}}));let l=document.createElement(`span`);l.className=`composer-mention-glyph composer-mention-glyph-icon`,l.setAttribute(`aria-hidden`,`true`),l.innerHTML=n(a),c.appendChild(l);let u=document.createElement(`span`);u.className=`composer-mention-glyph composer-mention-glyph-x`,u.setAttribute(`aria-hidden`,`true`),u.innerHTML=i(R),c.appendChild(u),c.addEventListener(`mousedown`,e=>e.preventDefault()),c.addEventListener(`click`,n=>{n.preventDefault();let i=typeof r==`function`?r():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),s.appendChild(c);let d=document.createElement(`span`);return d.className=`composer-mention-label`,d.textContent=o,s.appendChild(d),{dom:s}}},addProseMirrorPlugins(){return[st(this.editor)]}});function at(e){return[$e,et,tt,nt,rt,it,Pe,...e?.slashCommands===void 0?[]:[Ye.configure({commands:e.slashCommands})],...e?.placeholder?[ke.configure({placeholder:e.placeholder,showOnlyWhenEditable:!1})]:[]]}function ot(e=()=>te({includeFolders:!0})){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return S(t,a).map(e=>({docName:e.docName,title:e.title,path:Qe(e),kind:e.kind===`folder`?`folder`:`file`})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function st(e){let t=ot();return p({editor:e,pluginKey:Ze,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title,mentionKind:n.kind}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=null,c=e=>{n?.command(e)},l=e=>{s=e.editor.view,y(s,(e.items??[]).length)},u=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:c,loading:!i&&!a,error:a,hasMore:n.length>=Xe}},d=()=>{!e||!n||e.updateProps(u(n))};return{onBeforeStart(t){n=t,r=0,l(t);let s=x(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new m(je,{props:u(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(e),d(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(e),d(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,d(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,d(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){b(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,s!==null&&(v(s),s=null),t.reset()}}}})}function Q(e){let t=[],n=[],r=new Set,i=[];return e.state.doc.forEach(e=>{let a=``;e.forEach(e=>{if(e.type.name===`composerMention`){let i=String(e.attrs.path??``);if(i!==``&&(a+=`@${i}`,!r.has(i))){r.add(i),t.push(i);let a=String(e.attrs.label??``),o=e.attrs.mentionKind===`folder`?`folder`:`file`;n.push({kind:o,path:i,name:a===``?i:a})}}else e.type.name===`composerCommand`?a+=`/${String(e.attrs.name??``)}`:e.isText?a+=e.text??``:e.type.name===`hardBreak`&&(a+=`
7
- `)}),i.push(a)}),{instruction:i.join(`
8
- `).trim(),mentions:t,attachments:n}}function ct(e){let{instruction:t,mentions:n}=Q(e);return t===``&&n.length===0}function lt(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function ut(e){return e.split(`
9
- `).map(e=>({type:`paragraph`,content:e===``?[]:[{type:`text`,text:e}]}))}function dt(e){let t=(0,Z.c)(55),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:s,onSubmit:l,onEscape:u,className:d,placeholder:f,initialDoc:p,disabled:m,testId:g,slashCommands:v}=e,y=m===void 0?!1:m,{_:te}=o(),[b,x]=(0,z.useState)(null),S=(0,z.useRef)(i),C=(0,z.useRef)(a),w=(0,z.useRef)(s),T=(0,z.useRef)(l),E=(0,z.useRef)(u),D;t[0]!==a||t[1]!==i||t[2]!==u||t[3]!==s||t[4]!==l?(D=()=>{S.current=i,C.current=a,w.current=s,T.current=l,E.current=u},t[0]=a,t[1]=i,t[2]=u,t[3]=s,t[4]=l,t[5]=D):D=t[5],(0,z.useEffect)(D);let O;t[6]!==f||t[7]!==v?(O=at({placeholder:f,slashCommands:v}),t[6]=f,t[7]=v,t[8]=O):O=t[8];let k=p??void 0,A=!y,j;t[9]===g?j=t[10]:(j=g===void 0?{}:{"data-testid":g},t[9]=g,t[10]=j);let M;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(M=c(`composer-prosemirror py-1 outline-none`),t[11]=M):M=t[11];let N;t[12]!==r||t[13]!==j?(N={role:`textbox`,"aria-label":r,"aria-multiline":`true`,...j,class:M},t[12]=r,t[13]=j,t[14]=N):N=t[14];let ne;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(e,t)=>t.key===`Escape`?Ze.getState(e.state)?.active||Ne.getState(e.state)?.active?!1:E.current===void 0?(e.dom.blur(),!0):(E.current(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?(Ze.getState(e.state)?.active||Ne.getState(e.state)?.active)&&ee(e)?!1:(T.current(),!0):!1,t[15]=ne):ne=t[15];let P;t[16]===N?P=t[17]:(P={attributes:N,handleKeyDown:ne},t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{let{editor:t}=e;S.current(ct(t)),C.current?.(t.getJSON()),w.current?.(Q(t).mentions),x(He(Ue(t),Re(t)))},t[18]=F):F=t[18];let I;t[19]!==P||t[20]!==O||t[21]!==k||t[22]!==A?(I={extensions:O,content:k,immediatelyRender:!0,editable:A,editorProps:P,onUpdate:F},t[19]=P,t[20]=O,t[21]=k,t[22]=A,t[23]=I):I=t[23];let L=_(I),re,R;t[24]!==r||t[25]!==L||t[26]!==f?(re=()=>{if(!L||L.isDestroyed)return;let e=L.extensionManager.extensions.find(ft);e&&(e.options.placeholder=f??``);let t=L.editorView;t&&(t.dom.setAttribute(`aria-label`,r??``),t.dispatch(L.state.tr.setMeta(`addToHistory`,!1)))},R=[L,f,r],t[24]=r,t[25]=L,t[26]=f,t[27]=re,t[28]=R):(re=t[27],R=t[28]),(0,z.useEffect)(re,R);let V,H;t[29]!==y||t[30]!==L?(V=()=>{if(!L||L.isDestroyed)return;let e=!y;L.isEditable!==e&&L.setEditable(e,!1);let t=L.editorView;t&&(y?t.dom.setAttribute(`aria-disabled`,`true`):t.dom.removeAttribute(`aria-disabled`))},H=[L,y],t[29]=y,t[30]=L,t[31]=V,t[32]=H):(V=t[31],H=t[32]),(0,z.useEffect)(V,H);let U,ie;t[33]!==L||t[34]!==v?(U=()=>{if(!(!L||L.isDestroyed)){if(ze(L,v??null)){let e=L.editorView;e&&e.dispatch(L.state.tr.setMeta(`addToHistory`,!1))}x(He(Ue(L),Re(L)))}},ie=[L,v],t[33]=L,t[34]=v,t[35]=U,t[36]=ie):(U=t[35],ie=t[36]),(0,z.useEffect)(U,ie);let W;t[37]!==L||t[38]!==p?(W=()=>{L&&(ct(L)&&lt(p)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),Oe()),S.current(ct(L)),w.current?.(Q(L).mentions))},t[37]=L,t[38]=p,t[39]=W):W=t[39];let G;t[40]===L?G=t[41]:(G=[L],t[40]=L,t[41]=G),(0,z.useEffect)(W,G);let K,q;t[42]===L?(K=t[43],q=t[44]):(K=()=>({focus:()=>L?.commands.focus(),focusEnd:()=>L?.commands.focus(`end`),blur:()=>L?.commands.blur(),clear:()=>L?.commands.clearContent(!0),setText:e=>{L&&(L.commands.setContent(e),C.current?.(L.getJSON()),w.current?.(Q(L).mentions),x(He(Ue(L),Re(L))))},appendText:e=>{!L||e===``||(ct(L)?L.commands.setContent(ut(e)):L.commands.insertContentAt(L.state.doc.content.size,[{type:`paragraph`,content:[]},...ut(e)]),S.current(ct(L)),C.current?.(L.getJSON()),w.current?.(Q(L).mentions),x(He(Ue(L),Re(L))))},getContent:()=>L?Q(L):{instruction:``,mentions:[],attachments:[]},openMentionPicker:()=>{L&&L.chain().focus().insertContent(`@`).run()}}),q=[L],t[42]=L,t[43]=K,t[44]=q),(0,z.useImperativeHandle)(n,K,q);let J;t[45]!==d||t[46]!==L?(J=(0,B.jsx)(h,{editor:L,className:d}),t[45]=d,t[46]=L,t[47]=J):J=t[47];let Y;t[48]!==te||t[49]!==v||t[50]!==b?(Y=v===void 0?null:(0,B.jsx)(`p`,{className:c(`truncate px-2.5 text-xs text-muted-foreground`,b?.kind===`unknown`&&`pb-1`),"aria-live":`polite`,"aria-atomic":`true`,"data-testid":`composer-slash-hint`,children:b?.kind===`unknown`?b.agentHasCommands?te({id:`mBK8zm`,values:{0:b.name}}):te({id:`Q9AxTM`}):null}),t[48]=te,t[49]=v,t[50]=b,t[51]=Y):Y=t[51];let X;return t[52]!==J||t[53]!==Y?(X=(0,B.jsxs)(B.Fragment,{children:[J,Y]}),t[52]=J,t[53]=Y,t[54]=X):X=t[54],X}function ft(e){return e.name===`placeholder`}var pt=`button, a[href], [role="menuitem"], [role="button"], input, textarea, select, [contenteditable="true"]`;function mt(e,t){if(!(e.target instanceof HTMLElement)||!(e.currentTarget instanceof HTMLElement)||!e.currentTarget.contains(e.target)||e.target.closest(pt))return;e.preventDefault();let n=t.current;n!==null&&(n.focusEnd===void 0?n.focus():n.focusEnd())}function ht(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function gt(e){let t=(0,Z.c)(21),{path:n,onRemove:i}=e,{_:a}=o(),s,c;t[0]!==a||t[1]!==n?(s=ht(n),c=a({id:`hnq8fP`,values:{label:s}}),t[0]=a,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l=c,d=`composer-context-chip-file-${n}`,f;t[4]===i?f=t[5]:(f=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),i())},t[4]=i,t[5]=f);let p;t[6]===n?p=t[7]:(p=(0,B.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,B.jsx)(r,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(R,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=m):m=t[8];let h;t[9]!==i||t[10]!==l||t[11]!==f||t[12]!==p?(h=(0,B.jsxs)(u,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l,onClick:i,onKeyDown:f,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[p,m]}),t[9]=i,t[10]=l,t[11]=f,t[12]=p,t[13]=h):h=t[13];let g;t[14]===s?g=t[15]:(g=(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),t[14]=s,t[15]=g);let _;return t[16]!==n||t[17]!==d||t[18]!==h||t[19]!==g?(_=(0,B.jsxs)(`span`,{"data-testid":d,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[h,g]}),t[16]=n,t[17]=d,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function _t(e){let t=(0,Z.c)(13),{files:n,onRemoveFile:r,className:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n===void 0?[]:n,t[0]=n,t[1]=o);let s=o;if(s.length===0&&z.Children.toArray(a).length===0)return null;let l;t[2]===i?l=t[3]:(l=c(`flex flex-wrap items-center gap-1`,i),t[2]=i,t[3]=l);let u;if(t[4]!==s||t[5]!==r){let e;t[7]===r?e=t[8]:(e=e=>(0,B.jsx)(gt,{path:e,onRemove:()=>r?.(e)},e),t[7]=r,t[8]=e),u=s.map(e),t[4]=s,t[5]=r,t[6]=u}else u=t[6];let d;return t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,B.jsxs)(`div`,{className:l,"data-testid":`composer-context-chips`,children:[u,a]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function $(e,t){let n=e[t];return typeof n==`string`&&n!==``?n:null}function vt(e){if(typeof e!=`object`||!e)return null;let t=e,n=$(t,`tool`)??$(t,`name`),r=t;if(typeof t.arguments==`object`&&t.arguments!==null)r=t.arguments;else if(typeof t.arguments==`string`)try{let e=JSON.parse(t.arguments);typeof e==`object`&&e&&(r=e)}catch{}return{tool:n,args:r}}var yt=`ok-acp-follow-file-v1`;function bt(){try{return localStorage.getItem(yt)!==`0`}catch{return!0}}function xt(e){try{localStorage.setItem(yt,e?`1`:`0`)}catch{}}function St(e){return e===``||e.startsWith(`/`)||e.startsWith(`\\`)||e.split(`/`).some(e=>e===``||e.startsWith(`.`))?null:e}function Ct(e,t){let n=t.pathSeparator,r=e=>n===`\\`?e.replaceAll(`\\`,`/`):e,i=r(t.contentDir).replace(/\/$/,``),a=r(e);if(!a.startsWith(`${i}/`))return null;let o=a.slice(i.length+1),s=/\.(md|mdx)$/.exec(o);return s===null?null:St(o.slice(0,-s[0].length))}var wt=new Set(ne);function Tt(e,t,n){let r=vt(e);if(r===null)return null;let{tool:i,args:a}=r;if(i===`delete`||i===null&&/\bdelete\b/i.test(t))return null;let o=typeof a.document==`object`&&a.document!==null?a.document:null,s=null;if(Array.isArray(a.documents))for(let e=a.documents.length-1;e>=0;e--){let t=a.documents[e];if(typeof t==`object`&&t){s=t;break}}let c=(o===null?null:$(o,`path`))??(s===null?null:$(s,`path`))??$(a,`to`);if(c!==null)return St(c.replace(/\.(md|mdx)$/,``));let l=$(a,`docName`);return l===null||!(i!==null&&wt.has(i))&&!(n===`edit`||n===`move`)?null:St(l.replace(/\.(md|mdx)$/,``))}function Et(e,t){if(e.toolKind===`delete`)return null;let n=Tt(e.rawInput,e.title,e.toolKind);if(n!==null)return n;if(t===null||e.toolKind!==`edit`&&e.toolKind!==`move`)return null;for(let n=e.locations.length-1;n>=0;n--){let r=e.locations[n];if(r===void 0)continue;let i=Ct(r.path,t);if(i!==null)return i}return null}var Dt={lastFollowed:null,yielded:!1,reArmed:!1};function Ot(e,t,n){if(e===null||n.lastFollowed===e)return{navigateTo:null,state:n};if(n.lastFollowed!==null&&t!==null&&t!==n.lastFollowed&&t!==e&&!n.reArmed)return{navigateTo:null,state:{...n,yielded:!0}};if(n.yielded&&!n.reArmed)return{navigateTo:null,state:n};let r={lastFollowed:e,yielded:!1,reArmed:!1};return t===e?{navigateTo:null,state:r}:{navigateTo:e,state:r}}function kt(e,t){let n=null;for(let r of e){if(r.kind!==`tool_call`)continue;let e=Et(r,t);e!==null&&(n=e)}return n}function At(e){let t=(0,Z.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,value:o,max:i,indeterminateFillPercent:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=typeof i==`number`&&i>0?i:100,l=typeof o==`number`&&o>=0&&o<=s?o/s*100:r??0,u=Math.min(100,Math.max(0,l)),d;t[6]===n?d=t[7]:(d=c(`relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted`,n),t[6]=n,t[7]=d);let f=`translateX(-${100-u}%)`,p;t[8]===f?p=t[9]:(p=(0,B.jsx)(de,{"data-slot":`progress-indicator`,className:`size-full flex-1 bg-primary transition-all motion-reduce:transition-none`,style:{transform:f}}),t[8]=f,t[9]=p);let m;return t[10]!==i||t[11]!==a||t[12]!==d||t[13]!==p||t[14]!==o?(m=(0,B.jsx)(ue,{"data-slot":`progress`,value:o,max:i,className:d,...a,children:p}),t[10]=i,t[11]=a,t[12]=d,t[13]=p,t[14]=o,t[15]=m):m=t[15],m}export{De as _,kt as a,fe as b,xt as c,_t as d,mt as f,Ee as g,Oe as h,Ct as i,$ as l,ke as m,Dt as n,bt as o,dt as p,Ot as r,St as s,At as t,vt as u,me as v,he as y};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-BUgB2tll.js";import{n as t,r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{t as i}from"./utils-CPqDy6Hr.js";import{t as a}from"./label-Bbz2bT-a.js";import{n as o,t as s}from"./radio-group-BsZGGl8l.js";import{t as c}from"./dist-BIGNzOeF2.js";import{t as l}from"./external-link-DGqXfQJy.js";import{t as u}from"./ConfigSharingInfoTooltip-vG0lwpqt.js";var d=r(),f=e(),p=`https://openknowledge.ai/docs/reference/what-open-knowledge-writes`,m=`local-only`,h=`flex items-start gap-2 rounded-md border p-3 text-sm font-normal transition-colors cursor-pointer`;function g(e){let r=(0,d.c)(48),{value:c,onValueChange:l,disabled:m,idPrefix:g,testIdPrefix:y}=e,b=m===void 0?!1:m,{_:x}=n(),S=`${g}-sharing-shared`,C=`${g}-sharing-local-only`,w=`${g}-sharing-label`,T;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,f.jsx)(t,{id:`wtcxiD`}),r[0]=T):T=r[0];let E;r[1]===w?E=r[2]:(E=(0,f.jsx)(`span`,{id:w,className:`text-sm font-medium`,children:T}),r[1]=w,r[2]=E);let D;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,f.jsx)(u,{}),r[3]=D):D=r[3];let O;r[4]===x?O=r[5]:(O=x({id:`rCDe1d`}),r[4]=x,r[5]=O);let k=`${y}-docs-link`,A;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,f.jsx)(t,{id:`zwWKhA`}),r[6]=A):A=r[6];let j;r[7]!==O||r[8]!==k?(j=(0,f.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,onClick:v,onAuxClick:_,"aria-label":O,className:`ms-auto text-1sm font-normal text-muted-foreground underline decoration-dotted decoration-muted-foreground/50 underline-offset-4 transition-colors hover:text-foreground hover:decoration-foreground`,"data-testid":k,children:A}),r[7]=O,r[8]=k,r[9]=j):j=r[9];let M;r[10]!==E||r[11]!==j?(M=(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[E,D,j]}),r[10]=E,r[11]=j,r[12]=M):M=r[12];let N;r[13]===l?N=r[14]:(N=e=>l(e),r[13]=l,r[14]=N);let P=c===`local-only`?`border-primary bg-primary/5`:`border-border hover:bg-muted/40`,F;r[15]===P?F=r[16]:(F=i(h,P),r[15]=P,r[16]=F);let I=`${y}-local-only`,L;r[17]!==C||r[18]!==I?(L=(0,f.jsx)(o,{id:C,value:`local-only`,"data-testid":I,className:`mt-0.5`}),r[17]=C,r[18]=I,r[19]=L):L=r[19];let R;r[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,f.jsx)(`span`,{className:`block font-medium`,children:(0,f.jsx)(t,{id:`QjzFZj`})}),r[20]=R):R=r[20];let z;r[21]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,f.jsxs)(`span`,{children:[R,(0,f.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,f.jsx)(t,{id:`un-K1H`})})]}),r[21]=z):z=r[21];let B;r[22]!==C||r[23]!==F||r[24]!==L?(B=(0,f.jsxs)(a,{htmlFor:C,className:F,children:[L,z]}),r[22]=C,r[23]=F,r[24]=L,r[25]=B):B=r[25];let V=c===`shared`?`border-primary bg-primary/5`:`border-border hover:bg-muted/40`,H;r[26]===V?H=r[27]:(H=i(h,V),r[26]=V,r[27]=H);let U=`${y}-shared`,W;r[28]!==S||r[29]!==U?(W=(0,f.jsx)(o,{id:S,value:`shared`,"data-testid":U,className:`mt-0.5`}),r[28]=S,r[29]=U,r[30]=W):W=r[30];let G;r[31]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,f.jsx)(`span`,{className:`block font-medium`,children:(0,f.jsx)(t,{id:`0Gd0NU`})}),r[31]=G):G=r[31];let K;r[32]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,f.jsxs)(`span`,{children:[G,(0,f.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,f.jsx)(t,{id:`dJw2_7`})})]}),r[32]=K):K=r[32];let q;r[33]!==S||r[34]!==H||r[35]!==W?(q=(0,f.jsxs)(a,{htmlFor:S,className:H,children:[W,K]}),r[33]=S,r[34]=H,r[35]=W,r[36]=q):q=r[36];let J;r[37]!==b||r[38]!==w||r[39]!==N||r[40]!==B||r[41]!==q||r[42]!==c?(J=(0,f.jsxs)(s,{value:c,onValueChange:N,disabled:b,className:`grid-cols-2 gap-3`,"aria-labelledby":w,children:[B,q]}),r[37]=b,r[38]=w,r[39]=N,r[40]=B,r[41]=q,r[42]=c,r[43]=J):J=r[43];let Y;return r[44]!==J||r[45]!==M||r[46]!==y?(Y=(0,f.jsxs)(`div`,{className:`flex flex-col space-y-2`,"data-testid":y,children:[M,J]}),r[44]=J,r[45]=M,r[46]=y,r[47]=Y):Y=r[47],Y}function _(e){return l(e,p)}function v(e){return l(e,p)}function y(){let e=null,t=null,n=new Set,r=!1,i=null;function a(){for(let e of n)e()}function o(){e!==null&&(e=null,a())}return{install({bridge:n}){if(n&&n.onboarding)return r?i??void 0:(r=!0,t=n,i=n.onboarding.onShow(t=>{e=t,a()}),n.onboarding.signalReady(),()=>{i?.(),i=null,r=!1,t=null,o()})},getSnapshot(){return e},subscribe(e){return n.add(e),()=>{n.delete(e)}},async confirm(e){let n=t;if(!n)return{ok:!1,error:c._({id:`bEp7UY`})};try{let t=await n.onboarding.confirm(e);return t.ok&&o(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:c._({id:`29VNqC`})}}},async cancel(){let e=t;if(!e)return{ok:!1,error:c._({id:`bEp7UY`})};try{let t=await e.onboarding.cancel();return t.ok&&o(),t}catch(e){return{ok:!1,error:e instanceof Error?e.message:c._({id:`29VNqC`})}}},dismiss(){o()}}}var b=y();function x(e){return b.install(e)}function S(e,t){let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``)||(e.startsWith(`/`)?`/`:``),r=n(e),i=n(t);if(r===i)return`.`;let a=r.endsWith(`/`)?r:`${r}/`;return i.startsWith(a)?i.slice(a.length):null}function C(e){if(e===``||e===`.`)return!0;if(e.startsWith(`/`)||/^[A-Za-z]:/.test(e))return!1;let t=e.replace(/\\/g,`/`).split(`/`),n=0;for(let e of t)if(!(e===``||e===`.`))if(e===`..`){if(--n,n<0)return!1}else n+=1;return!0}export{m as a,x as i,S as n,g as o,b as r,C as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{t as i}from"./utils-CPqDy6Hr.js";import{l as a}from"./dist-DsLZcVyZ.js";import{t as o}from"./createLucideIcon-CAkY8Blx.js";var s=e(n(),1),c=t(),l=`Separator`,u=`horizontal`,d=[`horizontal`,`vertical`],f=s.forwardRef((e,t)=>{let{decorative:n,orientation:r=u,...i}=e,o=p(r)?r:u,s=n?{role:`none`}:{"aria-orientation":o===`vertical`?o:void 0,role:`separator`};return(0,c.jsx)(a.div,{"data-orientation":o,...s,...i,ref:t})});f.displayName=l;function p(e){return d.includes(e)}var m=f,h=o(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),g=r();function _(e){let t=(0,g.c)(12),n,r,a,o;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4]):({className:n,orientation:a,decorative:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o);let s=a===void 0?`horizontal`:a,l=o===void 0?!0:o,u;t[5]===n?u=t[6]:(u=i(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=u);let d;return t[7]!==l||t[8]!==s||t[9]!==r||t[10]!==u?(d=(0,c.jsx)(m,{"data-slot":`separator`,decorative:l,orientation:s,className:u,...r}),t[7]=l,t[8]=s,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}export{h as n,_ as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-CAkY8Blx.js";var t=e(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]);export{t};
@@ -1 +0,0 @@
1
- var e={"install-slidev":`npm install -g @slidev/cli @slidev/theme-default`};function t(t){return Object.hasOwn(e,t)?e[t]:void 0}var n=`open-knowledge:terminal-command`;function r(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(n,{detail:e}))}function i(e,r=typeof window>`u`?new EventTarget:window){let i=n=>{let{detail:r}=n;typeof r==`string`&&t(r)!==void 0&&e(r)};return r.addEventListener(n,i),()=>r.removeEventListener(n,i)}export{i as n,t as r,r as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{n as r}from"./dist-CuH7ikCn.js";import{t as i}from"./dist-BIGNzOeF2.js";var a=n(),o=9e4,s=e(t(),1),c=`ok-acp-agent-settings-v1`;function l(e){return`${e.source}:${e.id}`}function u(){try{let e=localStorage.getItem(c);if(e===null)return{};let t=JSON.parse(e);return typeof t==`object`&&t?t:{}}catch{return{}}}function d(e){try{localStorage.setItem(c,JSON.stringify(e))}catch(e){console.warn(`[acp-settings] could not persist agent settings`,e)}}function f(e,t,n){let r=u(),i=r[e]??{};r[e]={...i,config:{...i.config,[t]:n}},d(r)}function p(e){let t=u()[e]?.config;if(typeof t!=`object`||!t)return;let n={};for(let[e,r]of Object.entries(t))(typeof r==`string`||typeof r==`boolean`)&&(n[e]=r);return Object.keys(n).length>0?n:void 0}function m(e,t){if(t===``)return;let n=u();n[e]={...n[e]??{},modeId:t},d(n)}function h(e){let t=u()[e]?.modeId;return typeof t==`string`&&t!==``?t:void 0}var g=64e3;function _(e){if(typeof e!=`object`||!e)return null;let t=e;return t.type===`text`&&typeof t.text==`string`?t.text:null}function v(e){return e!==null&&(e.reason===`connect`||e.reason===`session-setup`||e.reason===`auth-required`)}var y=class{items=[];plan=[];turnActive=!1;tokenUsage=null;terminals={};toolCallIndex=new Map;permissionIndex=new Map;permissionByToolCall=new Map;permissionsByToolCall={};messageIndex=new Map;runtimeConsentIndex=new Map;piBridgeIndex=new Map;lastConsentIndex=null;appliedCount=0;dirty=!1;snapshot={items:[],plan:[],turnActive:!1,tokenUsage:null,terminals:{},permissionsByToolCall:{}};sync(e){e.length<this.appliedCount&&this.reset();for(let t=this.appliedCount;t<e.length;t++)this.applyEvent(e[t]);return this.appliedCount=e.length,this.dirty&&=(this.snapshot={items:[...this.items],plan:this.plan,turnActive:this.turnActive,tokenUsage:this.tokenUsage,terminals:{...this.terminals},permissionsByToolCall:{...this.permissionsByToolCall}},!1),this.snapshot}reset(){this.items=[],this.plan=[],this.turnActive=!1,this.tokenUsage=null,this.terminals={},this.toolCallIndex=new Map,this.permissionIndex=new Map,this.permissionByToolCall=new Map,this.permissionsByToolCall={},this.messageIndex=new Map,this.runtimeConsentIndex=new Map,this.piBridgeIndex=new Map,this.lastConsentIndex=null,this.appliedCount=0,this.dirty=!0}applyEvent(e){switch(this.dirty=!0,e.kind){case`user_message`:{let t={kind:`message`,role:`user`,text:e.content,messageId:`user-${this.items.length}`};e.attachments!==void 0&&e.attachments.length>0&&(t.attachments=e.attachments),this.items.push(t),this.messageIndex.clear();break}case`turn_started`:this.turnActive=!0;break;case`turn_ended`:this.turnActive=!1,this.messageIndex.clear();break;case`status`:if(e.status===`exited`&&(this.turnActive=!1),this.lastConsentIndex!==null){let t=this.items[this.lastConsentIndex];t?.kind===`runtime_consent`&&t.install===`running`&&(e.status===`spawning`||e.status===`ready`||e.status===`running`?this.items[this.lastConsentIndex]={...t,install:`done`}:(e.status===`error`||e.status===`exited`)&&(this.items[this.lastConsentIndex]={...t,install:`failed`}))}if(e.status===`ready`)for(let e=0;e<this.items.length;e+=1){let t=this.items[e];t?.kind===`notice`&&t.superseded!==!0&&v(t.failure)&&(this.items[e]={...t,superseded:!0})}if((e.status===`error`||e.status===`auth_required`)&&(e.failure!==void 0||(e.detail??``)!==``)){let t={kind:`notice`,text:e.detail??``,tone:e.status===`error`?`error`:`info`,failure:e.failure??null,attempts:1},n=this.items[this.items.length-1];n?.kind===`notice`&&n.superseded!==!0&&C(n,t)?this.items[this.items.length-1]={...n,attempts:n.attempts+1}:this.items.push(t)}break;case`permission_request`:{let t=e.toolCall.toolCallId??null,n={kind:`permission`,requestId:e.requestId,title:e.toolCall.title??i._({id:`Ya3PlJ`}),toolKind:e.toolCall.kind??`other`,options:e.options,resolved:null,toolCallId:t,mergedIntoToolCall:t!==null&&this.toolCallIndex.has(t)};this.permissionIndex.set(e.requestId,this.items.length),t!==null&&(this.permissionByToolCall.set(t,this.items.length),this.permissionsByToolCall[t]=n),this.items.push(n);break}case`permission_resolved`:{let t=this.permissionIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`permission`)break;let r={...n,resolved:{optionId:e.optionId,auto:e.auto}};this.items[t]=r,r.toolCallId!==null&&(this.permissionsByToolCall[r.toolCallId]=r);break}case`runtime_consent_request`:this.runtimeConsentIndex.set(e.requestId,this.items.length),this.lastConsentIndex=this.items.length,this.items.push({kind:`runtime_consent`,requestId:e.requestId,runtime:e.runtime,displayName:e.displayName,provides:e.provides,version:e.version,approxSizeMB:e.approxSizeMB,sourceHost:e.sourceHost,agentName:e.agentName,reason:e.reason??`missing`,resolved:null,install:null,progress:null});break;case`runtime_consent_resolved`:{let t=this.runtimeConsentIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`runtime_consent`)break;this.items[t]={...n,resolved:e.decision,install:e.decision===`granted`?`running`:null};break}case`pi_bridge_consent_request`:this.piBridgeIndex.set(e.requestId,this.items.length),this.items.push({kind:`pi_bridge`,row:`prompted`,prompt:{requestId:e.requestId,agentName:e.agentName,cwd:e.cwd,otherExtensions:e.otherExtensions??[]},bridgePath:e.bridgePath,decision:null,outcome:null});break;case`pi_bridge_consent_resolved`:{let t=this.piBridgeIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`pi_bridge`)break;this.items[t]={...n,decision:e.decision};break}case`pi_bridge_status`:{let t={state:e.state,detail:e.detail??null},n=e.requestId===void 0?void 0:this.piBridgeIndex.get(e.requestId),r=n===void 0?void 0:this.items[n];if(n!==void 0&&r?.kind===`pi_bridge`){this.items[n]={...r,outcome:t};break}this.items.push({kind:`pi_bridge`,row:`notice`,prompt:null,bridgePath:e.bridgePath,decision:null,outcome:t});break}case`runtime_install_progress`:{if(this.lastConsentIndex===null)break;let t=this.items[this.lastConsentIndex];if(t===void 0||t.kind!==`runtime_consent`)break;this.items[this.lastConsentIndex]={...t,progress:{receivedBytes:e.receivedBytes??0,totalBytes:e.totalBytes??null}};break}case`terminal_created`:this.terminals[e.terminalId]={terminalId:e.terminalId,command:e.command,args:e.args,output:``,truncated:!1,exit:null};break;case`terminal_output`:{let t=this.terminals[e.terminalId];if(t===void 0)break;let n=t.output+e.chunk,r=t.truncated;n.length>g&&(n=n.slice(-g),r=!0),this.terminals[e.terminalId]={...t,output:n,truncated:r};break}case`terminal_exit`:{let t=this.terminals[e.terminalId];if(t===void 0)break;this.terminals[e.terminalId]={...t,exit:{exitCode:e.exitCode,signal:e.signal}};break}case`session_update`:this.applyUpdate(e.update);break;default:break}}mergePermissionInto(e){let t=this.permissionByToolCall.get(e);if(t===void 0)return;let n=this.items[t];if(n===void 0||n.kind!==`permission`||n.mergedIntoToolCall)return;let r={...n,mergedIntoToolCall:!0};this.items[t]=r,this.permissionsByToolCall[e]=r}pushMessageChunk(e,t,n){let r=`${e}:${t}`,i=this.messageIndex.get(r);if(i!==void 0&&i===this.items.length-1){let e=this.items[i];this.items[i]={...e,text:e.text+n};return}this.messageIndex.set(r,this.items.length),this.items.push({kind:`message`,role:e,text:n,messageId:t})}applyUpdate(e){switch(e.sessionUpdate){case`agent_message_chunk`:{let t=_(e.content);t!==null&&this.pushMessageChunk(`agent`,x(e),t);break}case`agent_thought_chunk`:{let t=_(e.content);t!==null&&this.pushMessageChunk(`thought`,x(e),t);break}case`user_message_chunk`:{let t=_(e.content);t!==null&&this.pushMessageChunk(`user`,x(e),t);break}case`tool_call`:{let t={kind:`tool_call`,toolCallId:e.toolCallId,title:e.title??i._({id:`EvIJVD`}),toolKind:e.kind??`other`,status:e.status??`pending`,diffs:[],terminalIds:[],content:[],locations:S(e.locations),rawInput:e.rawInput};w(t,e.content),this.toolCallIndex.set(e.toolCallId,this.items.length),this.items.push(t),this.mergePermissionInto(e.toolCallId);break}case`tool_call_update`:{let t=this.toolCallIndex.get(e.toolCallId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`tool_call`)break;let r={...n,diffs:[...n.diffs],terminalIds:[...n.terminalIds],content:[...n.content]};e.status&&(r.status=e.status),e.title&&(r.title=e.title),e.locations&&(r.locations=S(e.locations));let i=e.rawInput;i!==void 0&&(r.rawInput=i),w(r,e.content),this.items[t]=r;break}case`plan`:{let t=e.entries;Array.isArray(t)&&(this.plan=t.map(e=>e).filter(e=>typeof e.content==`string`).map(e=>({content:e.content,priority:typeof e.priority==`string`?e.priority:void 0,status:typeof e.status==`string`?e.status:void 0})));break}case`usage_update`:{let t=e;this.tokenUsage={used:typeof t.used==`number`?t.used:void 0,size:typeof t.size==`number`?t.size:void 0};break}default:{let t=e.usage;t!==void 0&&(this.tokenUsage={used:t.used,size:t.size});break}}}};function b(e){let t=e.resolved;if(t===null)return null;if(t.optionId===null)return t.auto?{kind:`dismissed`}:{kind:`denied`,auto:!1,optionName:null};let n=e.options.find(e=>e.optionId===t.optionId);if(n===void 0)return{kind:`dismissed`};let r=n.kind.startsWith(`reject`),i=n.kind.startsWith(`allow`);return!r&&!i?{kind:`dismissed`}:{kind:r?`denied`:`approved`,auto:t.auto,optionName:n.name}}function x(e){let t=e.messageId;return typeof t==`string`?t:`default`}function S(e){return Array.isArray(e)?e.map(e=>e).filter(e=>typeof e.path==`string`).map(e=>({path:e.path,line:typeof e.line==`number`?e.line:void 0})):[]}function C(e,t){return!(e.tone!==t.tone||e.text!==t.text||e.failure===null!=(t.failure===null)||e.failure!==null&&t.failure!==null&&(e.failure.reason!==t.failure.reason||(e.failure.agentMessage??``)!==(t.failure.agentMessage??``)||(e.failure.machineDetail??``)!==(t.failure.machineDetail??``)))}function w(e,t){if(Array.isArray(t))for(let n of t){let t=n;if(t.type===`diff`&&typeof t.path==`string`&&typeof t.newText==`string`)e.diffs.push({path:t.path,oldText:typeof t.oldText==`string`?t.oldText:null,newText:t.newText});else if(t.type===`terminal`&&typeof t.terminalId==`string`)e.terminalIds.includes(t.terminalId)||e.terminalIds.push(t.terminalId);else if(t.type===`content`){let n=_(t.content);n!==null&&e.content.push(n)}else{let n=_(t);n!==null&&e.content.push(n)}}}var T=500,E=15e3,D=3e4,O=o,k=o,A=18e4,j=8e3,M=1e4,N=class extends Error{code;constructor(e,t){super(t),this.name=`ThreadResumeError`,this.code=e}},P=class extends Error{constructor(){super(`agent-thread channel is not connected`),this.name=`ThreadChannelUnavailableError`}},F=class{url=null;ws=null;reconnectDelay=T;reconnectTimer=null;threads=new Map;listeners=new Set;pendingCreates=new Map;pendingResumes=new Map;pendingRetries=new Map;pendingAuths=new Map;pendingQueueEdits=new Map;openedArchived=new Set;reqCounter=0;status=`idle`;version=0;setUrl(e){e!==this.url&&(this.url=e,this.teardownSocket(),e===null?this.setStatus(`idle`):this.connect())}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));threadsSnapshot=[];threadsSnapshotVersion=-1;getThreads=()=>(this.threadsSnapshotVersion!==this.version&&(this.threadsSnapshot=[...this.threads.values()].map(e=>e.info).sort((e,t)=>e.createdAt-t.createdAt),this.threadsSnapshotVersion=this.version),this.threadsSnapshot);openTabsSnapshot=[];openTabsSnapshotVersion=-1;getOpenTabs=()=>(this.openTabsSnapshotVersion!==this.version&&(this.openTabsSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived!==!0||this.openedArchived.has(e.threadId)).sort((e,t)=>e.createdAt-t.createdAt),this.openTabsSnapshotVersion=this.version),this.openTabsSnapshot);archivedSnapshot=[];archivedSnapshotVersion=-1;getArchivedThreads=()=>(this.archivedSnapshotVersion!==this.version&&(this.archivedSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived===!0).sort((e,t)=>t.lastActivityAt-e.lastActivityAt),this.archivedSnapshotVersion=this.version),this.archivedSnapshot);getThread=e=>this.threads.get(e)??null;modelBuilders=new Map;getThreadModel=e=>{let t=this.threads.get(e);if(t===void 0)return null;let n=this.modelBuilders.get(e);return n===void 0&&(n=new y,this.modelBuilders.set(e,n)),n.sync(t.events)};getConnectionStatus=()=>this.status;async createThread(e){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let t=`create-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingCreates.delete(t),n(Error(`thread creation timed out`))},D);this.pendingCreates.set(t,{resolve:e,reject:n,timer:r})}),r=l(e.agent),i=p(r),a=h(r),o=i!==void 0||a!==void 0?{...i===void 0?{}:{config:i},...a===void 0?{}:{modeId:a}}:void 0;return this.send({op:`create`,reqId:t,...e,...o===void 0?{}:{settings:o}}),n}prompt(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`prompt`,threadId:e,reqId:`prompt-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}steer(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`steer`,threadId:e,reqId:`steer-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}editQueued(e,t,n){let r=n.trim();if(r===``)return Promise.resolve();this.reqCounter+=1;let i=`queue-edit-${this.reqCounter}`,a=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingQueueEdits.delete(i),e()},M);this.pendingQueueEdits.set(i,{resolve:e,reject:t,timer:n})});return this.send({op:`queue_edit`,threadId:e,id:t,content:r,reqId:i}),a}holdQueued(e,t,n){this.send({op:`queue_hold`,threadId:e,id:t,held:n})}removeQueued(e,t){this.send({op:`queue_remove`,threadId:e,id:t})}respondPermission(e,t,n){this.send({op:`permission_response`,threadId:e,requestId:t,outcome:n})}respondRuntimeConsent(e,t,n){this.send({op:`runtime_consent_response`,threadId:e,requestId:t,outcome:n})}respondPiBridgeConsent(e,t,n){this.send({op:`pi_bridge_consent_response`,threadId:e,requestId:t,outcome:n})}cancel(e){this.send({op:`cancel`,threadId:e})}setMode(e,t){this.send({op:`set_mode`,threadId:e,modeId:t})}renameThread(e,t){let n=t.trim();n!==``&&this.send({op:`rename`,threadId:e,title:n})}setConfigOption(e,t,n){this.send({op:`set_config_option`,threadId:e,configId:t,value:n})}closeThread(e){let t=this.threads.get(e);if(t?.info.archived===!0){this.send({op:`unsubscribe`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.set(e,{info:t.info,events:[],lastSeq:-1}),this.bump();return}this.send({op:`close`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}openArchivedThread(e){let t=this.threads.get(e);t===void 0||t.info.archived!==!0||this.openedArchived.has(e)||(this.openedArchived.add(e),this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1}),this.bump())}deleteThread(e){this.send({op:`delete`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}async resumeThread(e,t,n){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let r=`resume-${this.reqCounter}`,i=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingResumes.delete(r),t(new N(`timeout`,`resume timed out`))},O);this.pendingResumes.set(r,{resolve:e,reject:t,timer:n})});return this.send({op:`resume`,threadId:e,reqId:r,prompt:t,...n!==void 0&&n.length>0?{attachments:n}:{}}),i}async retryThread(e){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let t=`retry-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingRetries.delete(t),n(Error(`retry timed out`))},k);this.pendingRetries.set(t,{resolve:e,reject:n,timer:r})});return this.send({op:`retry`,threadId:e,reqId:t}),n}async authenticateThread(e,t){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let n=`authenticate-${this.reqCounter}`,r=new Promise((e,t)=>{let r=setTimeout(()=>{this.pendingAuths.delete(n),t(Error(`sign-in timed out`))},A);this.pendingAuths.set(n,{resolve:e,reject:t,timer:r})});return this.send({op:`authenticate`,threadId:e,reqId:n,methodId:t}),r}connectNow(){this.url===null||this.ws!==null||(this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectDelay=T,this.connect())}waitForOpen(e){return this.ws!==null&&this.ws.readyState===WebSocket.OPEN?Promise.resolve():new Promise((t,n)=>{let r=e=>{clearTimeout(a),i(),e?t():n(new P)},i=this.subscribe(()=>{this.ws!==null&&this.ws.readyState===WebSocket.OPEN&&r(!0)}),a=setTimeout(()=>r(!1),e)})}connect(){if(this.url===null)return;this.setStatus(`connecting`);let e;try{e=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{if(this.ws===e){this.reconnectDelay=T,this.setStatus(`open`),this.send({op:`list`});for(let[e,t]of this.threads)t.info.archived===!0&&!this.openedArchived.has(e)||this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1})}},e.onmessage=t=>{if(this.ws!==e||typeof t.data!=`string`)return;let n;try{n=JSON.parse(t.data)}catch{return}this.handleFrame(n)},e.onclose=()=>{this.ws===e&&(this.ws=null,this.setStatus(`closed`),this.scheduleReconnect())},e.onerror=()=>{}}teardownSocket(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);for(let e of this.pendingCreates.values())clearTimeout(e.timer),e.reject(new P);this.pendingCreates.clear();for(let e of this.pendingResumes.values())clearTimeout(e.timer),e.reject(new P);this.pendingResumes.clear();for(let e of this.pendingRetries.values())clearTimeout(e.timer),e.reject(new P);this.pendingRetries.clear();for(let e of this.pendingAuths.values())clearTimeout(e.timer),e.reject(new P);this.pendingAuths.clear();for(let e of this.pendingQueueEdits.values())clearTimeout(e.timer),e.resolve();this.pendingQueueEdits.clear();let e=this.ws;if(this.ws=null,e!==null)try{e.close()}catch{}}scheduleReconnect(){if(this.url===null||this.reconnectTimer!==null)return;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,E),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}send(e){let t=this.ws;if(!(t===null||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify(e))}catch{}}handleFrame(e){switch(e.op){case`created`:{let t=this.pendingCreates.get(e.reqId);t!==void 0&&(this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`threads`:{let t=new Set;for(let n of e.threads){t.add(n.threadId);let e=this.threads.has(n.threadId);this.upsertInfo(n),!e&&n.archived!==!0&&this.send({op:`subscribe`,threadId:n.threadId,sinceSeq:0})}let n=!1;for(let e of Array.from(this.threads.keys()))t.has(e)||(this.threads.delete(e),this.modelBuilders.delete(e),this.openedArchived.delete(e),n=!0);n&&this.bump();return}case`resumed`:{let t=this.pendingResumes.get(e.reqId);t!==void 0&&(this.pendingResumes.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`retried`:{let t=this.pendingRetries.get(e.reqId);t!==void 0&&(this.pendingRetries.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`authenticated`:{let t=this.pendingAuths.get(e.reqId);t!==void 0&&(this.pendingAuths.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`subscribed`:this.upsertInfo(e.info);return;case`queue_edited`:{let t=this.pendingQueueEdits.get(e.reqId);t!==void 0&&(this.pendingQueueEdits.delete(e.reqId),clearTimeout(t.timer),t.resolve());return}case`info`:this.upsertInfo(e.info);return;case`event`:this.appendEvents(e.threadId,e.seq,[e.event]);return;case`events`:this.appendEvents(e.threadId,e.fromSeq,e.events);return;case`error`:if(e.reqId!==void 0){let t=this.pendingCreates.get(e.reqId);if(t!==void 0){this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.reject(Error(e.message));return}let n=this.pendingResumes.get(e.reqId);if(n!==void 0){this.pendingResumes.delete(e.reqId),clearTimeout(n.timer),n.reject(new N(e.code,e.message));return}let a=this.pendingRetries.get(e.reqId);if(a!==void 0){this.pendingRetries.delete(e.reqId),clearTimeout(a.timer),a.reject(Error(e.message));return}let o=this.pendingAuths.get(e.reqId);if(o!==void 0){this.pendingAuths.delete(e.reqId),clearTimeout(o.timer),o.reject(Error(e.message));return}let s=this.pendingQueueEdits.get(e.reqId);if(s!==void 0){this.pendingQueueEdits.delete(e.reqId),clearTimeout(s.timer),s.reject(Error(e.message));return}if(e.reqId.startsWith(`prompt-`)||e.reqId.startsWith(`steer-`)){r.error(i._({id:`XNBGZw`,values:{0:e.message}}));return}}console.warn(`[agent-threads] server error frame:`,e.code,e.message);return;default:return}}appendEvents(e,t,n){let r=this.threads.get(e);if(r===void 0||n.length===0)return;let i=Math.max(r.lastSeq+1-t,0);if(i>=n.length)return;let a=i===0?n:n.slice(i),o=r.info;for(let e of a)o=I(o,e);this.threads.set(e,{info:o,events:[...r.events,...a],lastSeq:t+n.length-1}),this.bump()}upsertInfo(e){let t=this.threads.get(e.threadId);t===void 0?this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1}):e.archived===!0&&t.info.archived!==!0?(this.openedArchived.delete(e.threadId),this.modelBuilders.delete(e.threadId),this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1})):this.threads.set(e.threadId,{...t,info:e}),this.bump()}setStatus(e){this.status!==e&&(this.status=e,this.bump())}bump(){this.version+=1;for(let e of this.listeners)e()}};function I(e,t){switch(t.kind){case`status`:return{...e,status:t.status,lastActivityAt:t.ts};case`title_changed`:return{...e,title:t.title,lastActivityAt:t.ts};default:return{...e,lastActivityAt:t.ts}}}var L=new F;function R(){return L}function z(){return(0,s.useSyncExternalStore)(L.subscribe,L.getOpenTabs,L.getOpenTabs)}function B(){return(0,s.useSyncExternalStore)(L.subscribe,L.getArchivedThreads,L.getArchivedThreads)}function V(e){let t=(0,a.c)(2),n;t[0]===e?n=t[1]:(n=()=>L.getThread(e),t[0]=e,t[1]=n);let r=n;return(0,s.useSyncExternalStore)(L.subscribe,r,r)}function H(e){let t=(0,a.c)(2),n;t[0]===e?n=t[1]:(n=()=>L.getThreadModel(e),t[0]=e,t[1]=n);let r=n;return(0,s.useSyncExternalStore)(L.subscribe,r,r)}function U(){return(0,s.useSyncExternalStore)(L.subscribe,L.getConnectionStatus,L.getConnectionStatus)}function W(e){if(e===null)return null;try{let t=new URL(e);return t.pathname=`/collab/thread`,t.search=``,t.toString()}catch{return null}}export{V as a,B as c,l as d,f,W as i,z as l,N as n,U as o,m as p,R as r,H as s,P as t,b as u};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{i as t}from"./DocumentContext-DLZBeoOd.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{et as i}from"./CodeMirrorPropInput-D97N2Z43.js";import{Ct as a,i as o,r as s}from"./dist-Ce8QgKUj2.js";import{v as c}from"./documents-events-xbEOOZ0r.js";import{n as l}from"./agent-presence-3JajMNAq.js";import{t as u}from"./lru-string-cache-CEQLtS-9.js";var d=r(),f=e(n(),1),p=500,m=64;async function h(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new i(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=a.safeParse(r);throw e.success?Error(e.data.title):new i(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let o=s.safeParse(r);if(!o.success)throw new i(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:o.error,status:n.status});return o.data}async function g(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&keptCount=${n}`,s=await fetch(r),c;try{c=await s.json()}catch(e){throw new i(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:s.status})}if(!s.ok){let e=a.safeParse(c);throw e.success?Error(e.data.title):new i(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:s.status})}let l=o.safeParse(c);if(!l.success)throw new i(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:l.error,status:s.status});let{diff:u,before:d,after:f,properties:p}=l.data;return{diff:u,before:d,after:f,properties:p}}function _(e){let n=(0,d.c)(23),{systemProvider:r}=t(),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(`idle`),[l,_]=(0,f.useState)(null),b;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new u(m),n[0]=b):b=n[0];let x=(0,f.useRef)(b),S=(0,f.useRef)(0),C;n[1]===r?C=n[2]:(C=e=>{let t=S.current+=1;s(`loading`),_(null),h(e).then(n=>{if(S.current!==t)return;let i=y(r,e);a({...n,writingDocs:i}),s(`ready`)}).catch(e=>{S.current===t&&(_(e instanceof Error?e.message:String(e)),s(`error`))})},n[1]=r,n[2]=C);let w=C,T;n[3]!==e||n[4]!==w?(T=()=>{if(!e){S.current+=1,a(null),s(`idle`),_(null),x.current.clear();return}x.current.clear(),w(e);let t=null,n=c(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,w(e)},p))});return()=>{t&&clearTimeout(t),n()}},n[3]=e,n[4]=w,n[5]=T):T=n[5];let E;n[6]===e?E=n[7]:(E=[e],n[6]=e,n[7]=E),(0,f.useEffect)(T,E);let D,O;n[8]!==e||n[9]!==r?(D=()=>{if(!e||!r)return;let t=()=>{if(!r.awareness)return;let t=y(r,e);a(e=>!e||v(e.writingDocs,t)?e:{...e,writingDocs:t})},n=r.awareness;if(!n||typeof n.on!=`function`){t();return}n.on(`update`,t),t();let i=setInterval(t,1e3);return()=>{clearInterval(i),typeof n.off==`function`&&n.off(`update`,t)}},O=[e,r],n[8]=e,n[9]=r,n[10]=D,n[11]=O):(D=n[10],O=n[11]),(0,f.useEffect)(D,O);let k;n[12]===e?k=n[13]:(k=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=x.current.get(r);if(i!==void 0)return i;let{diff:a}=await g(e,t,n);return x.current.set(r,a),a},n[12]=e,n[13]=k);let A=k,j;n[14]!==e||n[15]!==w?(j=()=>{e&&w(e)},n[14]=e,n[15]=w,n[16]=j):j=n[16];let M=j,N;return n[17]!==i||n[18]!==l||n[19]!==A||n[20]!==M||n[21]!==o?(N={data:i,status:o,error:l,reload:M,fetchBurstDiff:A},n[17]=i,n[18]=l,n[19]=A,n[20]=M,n[21]=o,n[22]=N):N=n[22],N}function v(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function y(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!l(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}export{_ as n,g as t};
@@ -1,6 +0,0 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{g as r,i,sr as a}from"./DocumentContext-DLZBeoOd.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./react-dom-DPxgxlDT.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{i as d}from"./local-menu-action-bus-BuSRFm5g.js";import{L as f,W as p,q as m}from"./CodeMirrorPropInput-D97N2Z43.js";import{$a as h,Ba as g,Da as _,Ga as v,Go as y,K as b,Oo as x,Wa as S,Ya as ee,Za as te,cr as ne,eo as C,ma as re,to as ie,za as w}from"./dist-Ce8QgKUj2.js";import{i as ae,l as oe,m as T,n as se,t as ce}from"./PropertyDisplayRow-EWSJVCPR.js";import{t as le}from"./minus-HJRULrSt.js";import{t as ue}from"./libesm-B7m5uxaw.js";var E=u(),D=n(),O=200;function de(e){let t=(0,E.c)(27),{delta:n,open:r,onOpenChange:i}=e;if(n.unparseable!==null){let e;return t[0]===n.unparseable?e=t[1]:(e=(0,D.jsx)(ge,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,c,l,u,d,f,p,m;if(t[2]!==n.changes||t[3]!==i||t[4]!==r){let e=n.changes.slice(0,50);o=n.changes.length-e.length,a=se,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,D.jsx)(s,{id:`l_UFPv`}),t[14]=c):c=t[14],l=n.changes.length,u=`property-diff-block`,d=`border-b border-border py-3`,f=r,p=i,m=e.map(fe),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else a=t[5],o=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h;t[15]===o?h=t[16]:(h=o>0&&(0,D.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,D.jsx)(s,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=h);let g;return t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,D.jsxs)(a,{title:c,count:l,testId:u,className:d,open:f,onOpenChange:p,children:[m,h]}),t[17]=a,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function fe(e){return(0,D.jsx)(pe,{change:e},`${e.kind}-${e.key}`)}function pe(e){let t=(0,E.c)(22),{change:n}=e,{_:r}=c(),i=oe[x(n.kind===`removed`?n.before:n.after)],o;t[0]!==r||t[1]!==n.kind?(o=n.kind===`added`?{KindIcon:d,kindLabel:r({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:le,kindLabel:r({id:`eps54V`})}:{KindIcon:a,kindLabel:r({id:`cNsIJf`})},t[0]=r,t[1]=n.kind,t[2]=o):o=t[2];let{KindIcon:s,kindLabel:l}=o,u;t[3]===s?u=t[4]:(u=(0,D.jsx)(s,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=s,t[4]=u);let f;t[5]===l?f=t[6]:(f=(0,D.jsx)(`span`,{className:`sr-only`,children:l}),t[5]=l,t[6]=f);let p;t[7]!==u||t[8]!==f?(p=(0,D.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[u,f]}),t[7]=u,t[8]=f,t[9]=p):p=t[9];let m;t[10]===i?m=t[11]:(m=(0,D.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=i,t[11]=m);let h;t[12]===n?h=t[13]:(h=(0,D.jsx)(me,{change:n}),t[12]=n,t[13]=h);let g;t[14]!==n.key||t[15]!==m||t[16]!==h?(g=(0,D.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,D.jsx)(ce,{icon:m,label:n.key,dataKey:n.key,children:h})}),t[14]=n.key,t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==n.key||t[19]!==p||t[20]!==g?(_=(0,D.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[p,g]}),t[18]=n.key,t[19]=p,t[20]=g,t[21]=_):_=t[21],_}function me(e){let t=(0,E.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,D.jsx)(k,{value:n.after,keyName:n.key}),t[0]=n.after,t[1]=n.key,t[2]=e):e=t[2],e}if(n.kind===`removed`){let e;return t[3]!==n.before||t[4]!==n.key?(e=(0,D.jsx)(k,{value:n.before,keyName:n.key,removed:!0}),t[3]=n.before,t[4]=n.key,t[5]=e):e=t[5],e}let r=T(n.before)||T(n.after)?`flex flex-col gap-1`:`flex flex-wrap items-center gap-1.5`,i;t[6]!==n.before||t[7]!==n.key?(i=(0,D.jsx)(k,{value:n.before,keyName:n.key,removed:!0}),t[6]=n.before,t[7]=n.key,t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`→`}),t[9]=a):a=t[9];let o;t[10]!==n.after||t[11]!==n.key?(o=(0,D.jsx)(k,{value:n.after,keyName:n.key}),t[10]=n.after,t[11]=n.key,t[12]=o):o=t[12];let s;return t[13]!==r||t[14]!==i||t[15]!==o?(s=(0,D.jsxs)(`div`,{className:r,"data-testid":`property-diff-change-pair`,children:[i,a,o]}),t[13]=r,t[14]=i,t[15]=o,t[16]=s):s=t[16],s}function k(e){let t=(0,E.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(T(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,D.jsx)(ae,{keyName:r,value:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o;return t[3]!==e||t[4]!==i?(o=(0,D.jsx)(`div`,{className:e,children:i}),t[3]=e,t[4]=i,t[5]=o):o=t[5],o}let o,s,c,l;if(t[6]!==a||t[7]!==n){let e=Array.isArray(n)?n.filter(he).join(`, `):String(n),r=e.length>O;o=a?`px-1 text-sm break-words text-muted-foreground line-through`:`px-1 text-sm break-words`,s=r?e:void 0,c=`property-diff-value`,l=r?`${e.slice(0,O)}…`:e,t[6]=a,t[7]=n,t[8]=o,t[9]=s,t[10]=c,t[11]=l}else o=t[8],s=t[9],c=t[10],l=t[11];let u;return t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,D.jsx)(`span`,{className:o,title:s,"data-testid":c,children:l}),t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function he(e){return typeof e==`string`}function ge(e){let t=(0,E.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,D.jsx)(s,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,D.jsx)(s,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,D.jsx)(A,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,D.jsx)(s,{id:`NawEr2`}),t[4]=o):o=t[4];let c;t[5]===n.after?c=t[6]:(c=(0,D.jsx)(A,{label:o,text:n.after}),t[5]=n.after,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,D.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,D.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,c]})]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function A(e){let t=(0,E.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,D.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a=r===``?`—`:r,o;t[2]===a?o=t[3]:(o=(0,D.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-2 py-1.5 font-mono text-xs whitespace-pre-wrap`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,D.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var j=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),M=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),N=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=M();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),_e=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=j(),r=M(),i=N(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ve=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=j();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=_e(),r=N();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),P=e(o(),1),ye=e(l(),1),F=ve();function I(){}I.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(be(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function be(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var xe=new I;function Se(e,t,n){return xe.diff(e,t,n)}var L=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,R=/\S/,z=new I;z.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!R.test(e)&&!R.test(t)},z.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&L.test(t[n])&&L.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function Ce(e,t,n){return z.diff(e,t,n)}var B=new I;B.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
2
- `));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var we=new I;we.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Te=new I;Te.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function V(e){"@babel/helpers - typeof";return V=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V(e)}var Ee=Object.prototype.toString,H=new I;H.useLongestToken=!0,H.tokenize=B.tokenize,H.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(U(e,null,null,i),i,` `)},H.equals=function(e,t){return I.prototype.equals.call(H,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function U(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(Ee.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=U(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),V(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=U(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var W=new I;W.tokenize=function(e){return e.slice()},W.join=W.removeEmpty=function(e){return e};function G(e,t){let n=t.content.findDiffStart(e.content);if(n===null)return!1;let{a:r,b:i}=t.content.findDiffEnd(e.content),a=n-Math.min(r,i);return a>0&&(e.resolve(n-a).depth<t.resolve(r+a).depth?n-=a:(r+=a,i+=a)),new h(n,i,t.slice(n,r))}function De(e){if(!e.steps.length)return;let t=new C(e.docs[0]),n=e.steps.slice();for(;n.length;){let e=n.shift();for(;n.length&&e.merge(n[0]);){let r=n.shift();e=e instanceof h&&r instanceof h?G(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function K(e){let t=new C(e);return t.removeMark(0,e.nodeSize-2),t.doc}function Oe(e,t){let n=t.split(`/`);for(n.shift();n.length;){if(typeof e!=`object`)throw Error();let t=n.shift();e=e[t]}return e}function q(e){return JSON.parse(JSON.stringify(e))}var ke=class{fromDoc;toDoc;complexSteps;wordDiffs;simplifyDiff;schema;tr;currentJSON;finalJSON;ops;constructor(e,t,n={}){let r={complexSteps:!0,wordDiffs:!1,simplifyDiff:!0,...n};this.fromDoc=e,this.toDoc=t,this.complexSteps=r.complexSteps,this.wordDiffs=r.wordDiffs,this.simplifyDiff=r.simplifyDiff,this.schema=e.type.schema,this.tr=new C(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=K(this.fromDoc).toJSON(),this.finalJSON=K(this.toDoc).toJSON(),this.ops=(0,F.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,F.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=De(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=q(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,F.applyPatch)(r,[t]);try{n=this.schema.nodeFromJSON(r),n.check()}catch{if(n=null,this.ops.length>0)t=this.ops.shift(),e.push(t);else throw Error(`No valid diff possible applying ${t.path}`)}}this.complexSteps&&e.length===1&&(i.includes(`attrs`)||i.includes(`type`))?(this.addSetNodeMarkup(),e=[]):e.length===1&&t.op===`replace`&&i[i.length-1]===`text`?(this.addReplaceTextSteps(t,r),e=[]):this.addReplaceStep(n,r)&&(e=[])}}addSetNodeMarkup(){let e=this.schema.nodeFromJSON(this.currentJSON),t=this.schema.nodeFromJSON(this.finalJSON),n=t.content.findDiffStart(e.content),r=e.nodeAt(n),i=t.nodeAt(n);if(n!=null){let e=r.type===i.type?null:i.type;try{this.tr.setNodeMarkup(n,e,i.attrs,i.marks)}catch(t){if(e&&t.message.includes(`Invalid content`))this.tr.replaceWith(n,n+r.nodeSize,i);else throw t}return this.currentJSON=K(this.tr.doc).toJSON(),this.ops=(0,F.createPatch)(this.currentJSON,this.finalJSON),!0}return!1}recreateChangeMarkSteps(){this.toDoc.descendants((e,t)=>{if(!e.isInline)return!0;this.tr.doc.nodesBetween(t,t+e.nodeSize,(n,r)=>{if(!n.isInline)return!0;let i=Math.max(t,r),a=Math.min(t+e.nodeSize,r+n.nodeSize);n.marks.forEach(t=>{t.isInSet(e.marks)||this.tr.removeMark(i,a,t)}),e.marks.forEach(e=>{e.isInSet(n.marks)||this.tr.addMark(i,a,e)})})})}addReplaceStep(e,t){let n=G(this.schema.nodeFromJSON(this.currentJSON),e);if(!n)return!1;if(!this.tr.maybeStep(n).failed)return this.currentJSON=t,!0;throw Error(`No valid step found.`)}addReplaceTextSteps(e,t){let n={...e,value:`xx`},r={...e,value:`yy`},i=q(this.currentJSON),a=q(this.currentJSON);(0,F.applyPatch)(i,[n]),(0,F.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=Oe(this.currentJSON,e.path),u=this.wordDiffs?Ce(l,c):Se(l,c),d=o.content.findDiffStart(s.content),f=o.resolve(d+1).marks();for(;u.length;){let e=u.shift();if(e.added){let t=this.schema.nodeFromJSON({type:`text`,text:e.value}).mark(f);if(u.length&&u[0].removed){let e=u.shift();this.tr.replaceWith(d,d+e.value.length,t)}else this.tr.insert(d,t);d+=e.value.length}else if(e.removed)if(u.length&&u[0].added){let t=u.shift(),n=this.schema.nodeFromJSON({type:`text`,text:t.value}).mark(f);this.tr.replaceWith(d,d+e.value.length,n),d+=t.value.length}else this.tr.delete(d,d+e.value.length);else d+=e.value.length}this.currentJSON=t}};function Ae(e,t,n={}){return new ke(e,t,n).init()}var je=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function J(e){let t=[];return e.forEach((e,n)=>{if(je.has(e.type.name)){let r=n+1,i=0;e.forEach(e=>{let n=r+i;t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`}),i+=e.nodeSize})}else t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`})}),t}function Me(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a].key===t[n].key?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].key===t[s].key?(a.push({type:`same`,b:t[s]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,a:e[o]}),o++):(a.push({type:`ins`,b:t[s]}),s++);for(;o<n;)a.push({type:`del`,a:e[o++]});for(;s<r;)a.push({type:`ins`,b:t[s++]});return a}function Ne(e,t){let n=Me(J(e),J(t)),r=[],i=0;for(let e of n)e.type===`same`?i=e.b.to:e.type===`ins`?(r.push({fromA:0,toA:0,fromB:e.b.from,toB:e.b.to}),i=e.b.to):r.push({fromA:e.a.from,toA:e.a.to,fromB:i,toB:i});return r}var Pe=400;function Y(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function Fe(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof ee?`add`:t instanceof te?`remove`:null;if(a===null)return;let o=t,s=e.mapping.slice(i+1),c=s.map(o.from,-1),l=s.map(o.to,1);if(l<=c||n.some(e=>e.fromB<=c&&l<=e.toB))return;let u=e.mapping.slice(0,i).invert(),d=u.map(o.from),f=u.map(o.to);f<=d||r.push({fromA:d,toA:f,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function Ie(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=Y(r,n,e),a=Y(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=Ae(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=Ne(i,o),l=s?Fe(s,c):[];return c.length+l.length>Pe?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var Le=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function Re(e){return e.changes.length+2*e.markChanges.length}function X(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function ze(e){if(e.childCount===0)return!1;let t=!0;return e.forEach(e=>{e.type.name!==`listItem`&&e.type.name!==`taskItem`&&(t=!1)}),t}function Z(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=n?`ok-diff-del ok-diff-del-block`:`ok-diff-del`,r.setAttribute(`data-diff-deleted`,``);let i=e.serializeFragment(t);if(n&&ze(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function Be(e,t,n,r,i){let a=ie.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=X(n.content);o.push(w.widget(e.fromB,()=>Z(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(w.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(w.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=X(n.content);o.push(w.widget(e.fromB,()=>Z(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return g.create(e,o)}var Ve=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),Q=r.filter(e=>!Ve.has(e.name)).map(e=>e.name===`jsxComponent`?b:e),He=_(Q);function Ue(e,t){return Ie(e,t,He,m())}var We=re.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:g.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new S({key:new v(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function Ge(e){let t=(0,E.c)(31),{diff:n}=e,r,i,a,o;if(t[0]!==n.afterDoc||t[1]!==n.beforeDoc||t[2]!==n.changes||t[3]!==n.markChanges){let e=Be(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,He);o=p,a=!1,r=Q,i=We.configure({decorations:e}),t[0]=n.afterDoc,t[1]=n.beforeDoc,t[2]=n.changes,t[3]=n.markChanges,t[4]=r,t[5]=i,t[6]=a,t[7]=o}else r=t[4],i=t[5],a=t[6],o=t[7];let s;t[8]!==r||t[9]!==i?(s=[...r,i],t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;t[11]===n.afterDoc?c=t[12]:(c=n.afterDoc.toJSON(),t[11]=n.afterDoc,t[12]=c);let l;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(l={attributes:{class:`pt-4`}},t[13]=l):l=t[13];let u;t[14]!==a||t[15]!==s||t[16]!==c?(u={editable:a,extensions:s,content:c,editorProps:l},t[14]=a,t[15]=s,t[16]=c,t[17]=u):u=t[17];let d;t[18]===n?d=t[19]:(d=[n],t[18]=n,t[19]=d);let m=o(u,d),[h]=(0,P.useState)(Ke),g=(0,P.useRef)(null),_,v;t[20]===h?(_=t[21],v=t[22]):(_=()=>{let e=g.current;if(e)return e.appendChild(h),()=>{h.parentNode===e&&e.removeChild(h)}},v=[h],t[20]=h,t[21]=_,t[22]=v),(0,P.useLayoutEffect)(_,v);let y;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,D.jsx)(`div`,{className:`tiptap-editor`,children:(0,D.jsx)(`div`,{ref:g,style:{display:`contents`}})}),t[23]=y):y=t[23];let b;t[24]===m?b=t[25]:(b=(0,D.jsx)(f,{editor:m,className:`tiptap-editor-portal-content`}),t[24]=m,t[25]=b);let x;t[26]!==h||t[27]!==b?(x=(0,ye.createPortal)(b,h),t[26]=h,t[27]=b,t[28]=x):x=t[28];let S;return t[29]===x?S=t[30]:(S=(0,D.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[y,x]}),t[29]=x,t[30]=S),S}function Ke(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var qe=`[data-property-change]`;function Je(e){let t=0,n=!1;for(let r of e.split(`
3
- `)){let e=r.startsWith(`+`)&&!r.startsWith(`+++`)||r.startsWith(`-`)&&!r.startsWith(`---`);e&&!n&&(t+=1),n=e}return t}function Ye(e){let t=Array.from(e.querySelectorAll(`.diff-code-insert, .diff-code-delete`)),n=[],r=null;for(let e of t){let t=e.closest(`tr`);t&&((r===null||t.previousElementSibling!==r)&&n.push(e),r=t)}return n}function $(e){let t=0,n=0;for(let r of e.split(`
4
- `))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function Xe(e,t){return`${e}\u0000${t}`}function Ze(e,t,n){let r=y(e).body,i=y(t).body;return r===i?``:ue(n,r,i,``,``,{context:Math.max(r.split(`
5
- `).length,i.split(`
6
- `).length)})}function Qe(e,t,n,r,a){let o=(0,E.c)(10),s=r===void 0?`vs-live`:r,c=a===void 0?null:a,{activeProvider:l}=i(),u;o[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`idle`,diff:null},o[0]=u):u=o[0];let[d,f]=(0,P.useState)(u),p=(0,P.useRef)(l),m;o[1]===l?m=o[2]:(m=()=>{p.current=l},o[1]=l,o[2]=m),(0,P.useEffect)(m);let h,g;return o[3]!==n||o[4]!==t||o[5]!==s||o[6]!==c||o[7]!==e?(h=()=>{if(!e){f({status:`idle`,diff:null});return}let r=e,i=!1;f({status:`loading`,diff:null});let a=async function(e){let r=Xe(t,e),i=n.get(r);if(i!==void 0)return i;let a=await fetch(`/api/history/${e}?docName=${encodeURIComponent(t)}`);if(!a.ok)return console.error(`[timeline-diff] history fetch returned non-ok response`,{sha:e,docName:t,status:a.status}),null;let o=(await a.json()).content??``;return n.set(r,o),o};return(async function(){try{let e=await a(r);if(i)return;if(e===null){f({status:`error`,diff:null});return}let n,o;if(s===`vs-parent`){let t=c?await a(c):``;if(i)return;if(t===null){f({status:`error`,diff:null});return}n=t,o=e}else n=e,o=p.current?.document.getText(`source`).toString()??``;let l=y(n).body,u=y(o).body,d=Ze(n,o,t),m=ne(n,o);if(i)return;let{additions:h,deletions:g}=$(d);f({status:`ready`,diff:d,additions:h,deletions:g,before:l,after:u,properties:m})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,mode:s,err:e}),f({status:`error`,diff:null}))}})(),()=>{i=!0}},g=[e,t,n,s,c],o[3]=n,o[4]=t,o[5]=s,o[6]=c,o[7]=e,o[8]=h,o[9]=g):(h=o[8],g=o[9]),(0,P.useEffect)(h,g),d}export{Je as a,Le as c,Ye as i,Re as l,Qe as n,Ge as o,qe as r,Ue as s,$ as t,de as u};
@@ -1 +0,0 @@
1
- import{t as e}from"./repair-skills-B7T9ybuC.mjs";export{e as repairSkills};
@@ -1 +0,0 @@
1
- import{i as e,o as t,s as n}from"./server-lock-C0j1Yr_I.mjs";export{e as markServerLockDraining,t as releaseServerLock,n as updateServerLockPort};
@@ -1,20 +0,0 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-D4NlDISj.mjs";import{Ac as i,Co as a,Fc as o,Ic as s,jc as c,lt as l,ut as u}from"./src-Bt6_UxL9.mjs";import{Ri as d,ct as f,di as p,kn as m,lt as h,ot as g,st as ee}from"./src-bhsVUHJJ.mjs";import{D as _,F as v,I as y,k as b}from"./fs-traced-Dm4NQ6S5.mjs";import{C as x,S,_ as C,f as w,r as T}from"./server-lock-C0j1Yr_I.mjs";import{t as E}from"./yazl-DejPO9b3.mjs";import{h as D,m as te,x as ne}from"./resolve-project-root-BF1NyEri.mjs";import{c as O}from"./colors-DSyAT9Cz.mjs";import{a as k,i as re}from"./acp-harness-probe-DWsC0HGJ.mjs";import{D as ie,E as A,S as ae,T as j,_ as oe,b as se,o as ce}from"./init-wSrUXJrK.mjs";import{n as le}from"./constants-B-n_YWgP.mjs";import{t as M}from"./is-object-Bw0-z8qH.mjs";import"./loader-Bqkd1CSo.mjs";import"./skill-teardown-B9-HO2ID.mjs";import"./preview-CGdqYnsr.mjs";import{execSync as ue,spawnSync as de}from"node:child_process";import{basename as N,dirname as P,join as F,relative as fe,resolve as I,sep as pe}from"node:path";import{cpSync as me,createWriteStream as he,existsSync as L,lstatSync as ge,mkdirSync as R,mkdtempSync as _e,readFileSync as z,readdirSync as B,readlinkSync as ve,rmSync as ye,statSync as be,writeFileSync as V}from"node:fs";import{arch as xe,freemem as Se,homedir as H,hostname as Ce,platform as we,release as Te,tmpdir as Ee,totalmem as De,type as Oe,uptime as ke}from"node:os";import"node:fs/promises";import{createHash as Ae}from"node:crypto";var je=n();const Me=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ne(e,t,n=m){if(e!==void 0&&!Me.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Pe=null;function Fe(e){Pe=e}function Ie(){return Pe??process.cwd()}function U(){return F(H(),`.ok`,`bug-reports`)}function Le(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=U(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Re(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?Ae(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function ze(){let e={timestamp:new Date().toISOString(),platform:we(),osType:Oe(),osRelease:Te(),hostname:`[redacted]`,uptime:ke(),freeMem:Se(),totalMem:De(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ue(`sw_vers -productVersion 2>/dev/null`,d({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}const Be=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function Ve(e){let t=N(e);return Be.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function He(e,t){return Ke(e,t).files}const Ue=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function We(e,t=k){let n=F(e,`${t}.ShipIt`);return L(n)?Ue.map(e=>F(n,e)).filter(e=>L(e)):[]}function Ge(e){if(!L(e))return[];try{let t=new Map;for(let n of B(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-o.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>F(e,t))}catch{return[]}}function Ke(e,t){if(!L(t))return{files:[],excludedByProjectSlug:0};let n=B(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(Ve),i=[],a=r.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!Ve(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function qe(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,l].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Je(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ye(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=c(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{Ye({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Xe(t){let{redact:n,outputPath:r,logger:a}=t,o=t.userLogsDir??F(H(),`.ok`,`logs`),c=t.projectDir?Re(t.projectDir,a):null;R(P(r),{recursive:!0}),a?.info({projectSlug:c},`gathering diagnostic data`);let l=ze();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:d}=Ke(c,o),{files:f}=t.projectDir?qe(t.projectDir):{files:[]},{files:p}=t.projectDir?Je(t.projectDir):{files:[]},m=t.shipItLogFiles??[];a?.info({logFileCount:u.length,logFilesExcludedByProjectSlug:d,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length},`files collected`);let h=[],g=[],{ZipFile:ee}=await import(`./yazl-BwMlCqRQ.mjs`).then(t=>e(t.default,1)),_=new ee;W({zipfile:_,files:[...u,...m],prefix:`logs`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:f,prefix:`lockdir`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:p,prefix:`local-logs`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:t.bugReportLedgerFiles??[],prefix:s,redact:n,bundleFiles:g,redactions:h,logger:a});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;_.addBuffer(t,n),g.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ye({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:g,redactions:h});let v=JSON.stringify(l,null,2);_.addBuffer(Buffer.from(v,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let y={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:c,files:g,redactions:h,sysinfo:l};_.addBuffer(Buffer.from(JSON.stringify(y,null,2),`utf8`),`MANIFEST.json`);let b=h.reduce((e,t)=>e+t.lineCount,0),x=new Set(m.map(e=>`logs/${N(e)}`)),S=g.filter(e=>x.has(e)),C=new Set((t.bugReportLedgerFiles??[]).map(e=>`${s}/${N(e)}`)),w=g.filter(e=>C.has(e)),T=c?g.filter(e=>e.startsWith(`logs/`)&&!Ve(e)&&!x.has(e)):[],E=[`# Bug Report Bundle`,``,`Generated: ${y.generatedAt}`,`Project: ${c??`(unscoped)`}`,`Discipline version: ${y.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...T.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...T.map(e=>`- ${e}`),``]:[],...S.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...S.map(e=>`- ${e}`),``]:[],...w.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...w.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${i.join(`, `)}`,b>0?`${b} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
2
- `);_.addBuffer(Buffer.from(E,`utf8`),`README.md`),_.end();let D=he(r);return _.outputStream.pipe(D),await new Promise((e,t)=>{D.on(`close`,e),D.on(`error`,t)}),a?.info({bundlePath:r,fileCount:g.length,redactionCount:b},`bundle written`),{zipPath:r,summary:{projectSlug:c,files:g,redactions:h,redactedLineCount:b,generatedAt:y.generatedAt}}}var Ze=e(E(),1),G=e(O(),1);function Qe(e){return y({absPath:b(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function $e({home:e=H(),env:n=process.env}={}){let i=Qe(e),{override:o,preferenceList:s}=_(n),{locale:c,source:l}=a({override:o,storedPreference:i,supportedLocales:r,preferenceList:s,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:s}}function et(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function tt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return et(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!tt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=K(i,t);return n}function nt(e,t){let n=z(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
- `),i=n.split(`
4
- `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=K(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}V(e,r?`${a.join(`
5
- `)}\n`:a.join(`
6
- `))}function rt(e,t){let n=z(e,`utf-8`);if(n.trim().length!==0)try{let r=K(JSON.parse(n),t),i=n.endsWith(`
7
- `)?`
8
- `:``;V(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=et(n,t.contentDir);r!==n&&V(e,r)}}function it(e,t){let n=z(e,`utf-8`),r=et(n,t.contentDir);r!==n&&V(e,r)}function at(e){try{return B(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>F(e,t.name))}catch{return[]}}const ot=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function st(e){return/\.log\.\d+$/.test(e)}function ct(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||st(e)}function lt(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of at(F(e.stagingDir,n)))ct(r)?nt(r,t):r.endsWith(`.json`)?rt(r,t):it(r,t);for(let n of at(F(e.stagingDir,`state`))){let e=N(n);n.endsWith(`.jsonl`)?nt(n,t):ot.has(e)?rt(n,t):it(n,t)}}const ut=[`.ok`,`local`,`telemetry`],dt=[`.ok`,`local`,`logs`],ft=[`.ok`,`local`,`loss-capture`],pt=`spans-current.jsonl`,mt=`spans-prev.jsonl`,ht=`server-current.jsonl`,gt=`server-prev.jsonl`,_t=`loss-current.jsonl`,vt=`loss-prev.jsonl`;function yt(e){return F(e,...ut,pt)}function bt(e){return F(e,...ut,mt)}function xt(e){return F(e,...dt,ht)}function St(e){return F(e,...dt,gt)}function Ct(e){return F(e,...ft,_t)}function wt(e){return F(e,...ft,vt)}const Tt=1e3;async function Et(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Tt)});return t.ok?await t.text():null}catch{return null}}async function Dt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Tt)});return t.ok?await t.text():null}catch{return null}}async function Ot(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Tt)});return t.ok?await t.text():null}catch{return null}}function kt(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(`
9
- `)}\n`:null}catch{return null}}function At(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=de(`git`,[`-C`,t,`log`,`--oneline`,`-50`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function jt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=de(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Mt(){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 Nt(){return{nodeVersion:process.version,platform:we(),arch:xe()}}function Pt(){return process.env.OTEL_SDK_DISABLED===`false`}function q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ft(e){if(!L(e))return{};let t;try{t=(0,je.parse)(z(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(!q(t))return{};let n=t.telemetry;if(!q(n))return{};let r=n.localSink;return q(r)?r:{}}function It(e){return typeof e==`boolean`?e:void 0}function Lt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function J(e){if(q(e))return Lt(e.maxBytes)}function Rt(e){let t=Ft(b(`project`,e)),n=Ft(b(`project-local`,e));return{enabled:It(n.enabled)??It(t.enabled)??!0,spansMaxBytes:J(n.spans)??J(t.spans)??52428800,logsMaxBytes:J(n.logs)??J(t.logs)??26214400}}function zt(e){return Ae(`sha256`).update(e).digest(`hex`)}function Bt(e){let t=z(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Vt(e){let t=z(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function Y(e,t){if(!L(e))return!1;try{return R(P(t),{recursive:!0}),me(e,t),!0}catch{return!1}}function Ht(e){let t=[],n=e=>{let r=B(e,{withFileTypes:!0});for(let i of r){let r=F(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Ut=new Set([`.jsonl`]);function Wt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Ut.has(e.slice(t))}const Gt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`]);function Kt(e){if(st(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Gt.has(e.slice(t))}function qt(e){let t=[];for(let n of Ht(e)){let r=Jt(e,n);if(!Kt(r))continue;let{redacted:i,patterns:a,lineCount:o}=c(z(n,`utf-8`));a.length!==0&&(V(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Jt(e,t){return fe(e,t).split(pe).join(`/`)}async function Yt(e){let t=I(e.contentDir),n=I(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Et,a=r.fetchAgentEffects??Dt,o=r.fetchWatcherRecent??Ot,c=r.readShadowHead??At,d=r.readCheckpointRefs??jt,f=r.now??(()=>new Date),p=r.okVersion??(()=>le),m=r.readDesktopEnv??Mt,h=r.readLanguage??$e,g=r.readRuntime??Nt,ee=r.isOtlpPushEnabled??Pt,_=_e(F(Ee(),`ok-bundle-`));try{R(F(_,`telemetry`),{recursive:!0}),R(F(_,`logs`),{recursive:!0}),R(F(_,`state`),{recursive:!0}),Y(yt(n),F(_,`telemetry`,pt)),Y(bt(n),F(_,`telemetry`,mt)),Y(xt(n),F(_,`logs`,ht)),Y(St(n),F(_,`logs`,gt));for(let t of e.userLogFiles??[])Y(t,F(_,`logs`,N(t)));for(let t of e.userStateFiles??[])Y(t,F(_,s,N(t)));let v=F(n,`.ok`,`local`),y=F(v,`server.lock`),b=`not-running`,x=`no server.lock`,S=null;if(L(y)){Y(y,F(_,`state`,`server.lock`));try{let e=z(y,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?S=t.port:x=`lock present but no port`}catch{x=`lock present but unparseable`}}if(S!==null){let e=await i(S);e===null?x=`agent-presence endpoint at :${S} unreachable`:(V(F(_,`state`,`agent-presence.json`),e),b=`running`,x=``);let t=await a(S);t!==null&&V(F(_,`state`,`agent-effects.json`),t);let n=await o(S);if(n!==null){let e=kt(n);e!==null&&V(F(_,`state`,`watcher-recent.jsonl`),e)}}let C=c(t);C!==null&&V(F(_,`state`,`shadow-head.txt`),C);let w=d(t);w!==null&&V(F(_,`state`,`checkpoint-refs.txt`),w),Y(Ct(n),F(_,`state`,_t)),Y(wt(n),F(_,`state`,vt)),Y(F(v,`last-spawn-error.log`),F(_,`state`,`last-spawn-error.log`)),Y(F(v,u),F(_,`state`,u)),Y(F(v,l),F(_,`state`,l));let T=g(),E=m(),D=h(),te={ok:{version:p(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:E,language:D}};V(F(_,`state`,`runtime.json`),`${JSON.stringify(te,null,2)}\n`);let ne=b===`running`?`running
10
- `:`not-running (${x})\n`;if(V(F(_,`state`,`server-status.txt`),ne),e.processDir&&L(e.processDir)){let t=F(_,`process`);R(t,{recursive:!0}),me(e.processDir,t,{recursive:!0})}let O=e.redact===!0;O&&lt({stagingDir:_,contentDir:t}),e.note&&V(F(_,`note.txt`),e.note);let k=null;e.scrubSecrets===!0&&(k=qt(_));for(let t of e.extraFiles??[])Y(t.sourcePath,F(_,`extra`,t.zipName??N(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let re=Rt(n),ie=Ht(_),A=[],ae=0,j=0;for(let e of ie){let t=Jt(_,e),n=be(e).size,r=Wt(t)?Bt(e):0;A.push({path:t,bytes:n,lines:r}),ae+=n,t.startsWith(`telemetry/`)&&Wt(t)&&(j+=Vt(e))}let oe={applied:O};k!==null&&(oe.secretScrub=k);let se={schemaVersion:2,createdAt:f().toISOString(),ok:{version:p(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:E,language:D},contentDir:{pathSha256:zt(t),absolutePath:O?`<CONTENT_DIR>`:t},telemetry:{localSink:re,otlpPushEnabled:ee()},redaction:oe,serverStatus:b,files:A};V(F(_,`manifest.json`),`${JSON.stringify(se,null,2)}\n`);let ce=ie.some(e=>{try{return z(e,`utf-8`).includes(t)}catch{return!1}}),le={totalBytes:ae,fileCount:A.length,docNameCount:j,contentDirVisible:ce,redacted:O},M=!1;return{stagingDir:_,manifest:se,summary:le,cleanup:()=>{M||(M=!0,ye(_,{recursive:!0,force:!0}))}}}catch(e){throw ye(_,{recursive:!0,force:!0}),e}}async function Xt(e){let{collected:t,outputPath:n}=e,r=P(n);if(!L(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Ze.ZipFile,a=Ht(t.stagingDir);for(let e of a){let n=Jt(t.stagingDir,e);i.addFile(e,n)}i.end();let o=he(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 Zt(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let t=(0,je.parse)(z(n,`utf-8`)),r=M(t)?t.content:void 0,i=M(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return I(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 I(e)}async function Qt(e,t,n,r){let i=Re(t,e.logger),a=await Yt({contentDir:Zt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...He(i,e.userLogsDir??F(H(),`.ok`,`logs`)),...We(e.cachesDir??F(H(),`Library`,`Caches`))],userStateFiles:Ge(e.bugReportsDir??U()),deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{R(P(e.outputPath),{recursive:!0}),await Xt({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function $t(e){let{projectDir:t}=e,n=e.readDesktopEnv??Mt,r=e.readLanguage??$e;if(e.level===`full`&&t!==void 0)return Qt(e,t,n,r);let{zipPath:i,summary:a}=await Xe({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:We(e.cachesDir??F(H(),`Library`,`Caches`)),bugReportLedgerFiles:Ge(e.bugReportsDir??U()),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}function en(e,t){if(!L(e))return{status:`missing`,lockPath:e};let n;try{n=JSON.parse(z(e,`utf-8`))}catch{return{status:`corrupt`,lockPath:e}}if(!n||typeof n!=`object`||!x(n.pid))return{status:`corrupt`,lockPath:e};let r=n;if(!(t.isAlive??S)(r.pid))return{status:`dead-pid`,lockPath:e,lock:r};if(typeof r.machineId==`string`)return r.machineId===(t.machineId??C())?{status:`alive`,lockPath:e,lock:r}:{status:`foreign-host`,lockPath:e,lock:r};let i=t.host??Ce();return r.hostname===i?{status:`alive`,lockPath:e,lock:r}:{status:`foreign-host`,lockPath:e,lock:r}}function X(e,t,n={}){return en(w(e,t),n)}function Z(e,t={}){return en(F(e,`ui.lock`),t)}function tn(e){return e.replace(/:\d+$/,``)}function nn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:tn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:tn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:tn(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const rn=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function an(e){return F(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const on={existsSync:e=>L(e),readFileSync:(e,t)=>z(e,t),lstatSync:e=>ge(e),readlinkSync:e=>ve(e)};function sn(e,t=on){let n=an(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function cn(e){let t=e.replace(rn,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function ln(e,t,n=on){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function un(e){return te(e)||D(e)||ae(e)}const dn=10*1024*1024;function fn(e,t,n,r){let i=ce(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!un(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);if(e.format===`file`){ye(a,{force:!0});let e=re(t,n);return{kind:`removed`,trust:e.action,...e.error===void 0?{}:{trustError:e.error}}}return e.format===`toml`?hn(a,o):e.format===`yaml`?mn(a,e.topLevelKey,o):pn(a,e.topLevelKey,e.serverMapSubKey,o)}function pn(e,t,n,r){let i;try{i=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>dn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=ie(i,oe(t,n,r));return o?(v(e,a,{mode:j(e)}),{kind:`removed`}):{kind:`not-present`}}function mn(e,t,n){let r;try{r=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>dn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,je.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=A(a);a.trim()===``||a.endsWith(`
11
- `)?c.endsWith(`
12
- `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
13
- `).replace(/\n/g,`\r
14
- `));let u=`${i?``:``}${c}`;return u!==r&&v(e,u,{mode:j(e)}),{kind:`removed`}}function hn(e,t){let n=se();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=A(a),s=a.trim()===``||a.endsWith(`
15
- `),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
16
- `)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
17
- `).replace(/\n/g,`\r
18
- `));let u=`${i?``:``}${l}`;return u!==r&&v(e,u,{mode:j(e)}),{kind:`removed`}}function gn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function _n(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function vn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&T(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:ee(n),command:n,isDesktop:gn(n)}}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const yn=new Set([`running`,`desktop`,`foreign`]);function bn(e){switch(e){case`running`:return G.default.green(e);case`desktop`:return G.default.blue(e);case`foreign`:return G.default.cyan(e);case`stale`:return G.default.yellow(e)}}function xn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Sn(e){return`${xn(e.server.usage)} | ${xn(e.ui?.usage??null)}`}function Cn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function wn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,Cn(e),Sn(e),Q(e),String(e.server.pid),_n(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=bn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=G.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
19
- `)}async function Tn(e={}){let t=e.discover??g,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??f,a=e.resolveUsage??h,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=vn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(wn(e.all?s:s.filter(e=>yn.has(Q(e)))))}function En(){return new ne(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Tn({all:t.all===!0||e===`all`,json:t.json===!0})})}function Dn(e,t,n={}){let r=n.isAlive??S,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function On(e){let t=e.inspect??(t=>t===`ui`?Z(e.lockDir):X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=Dn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function kn(e,t=S){let n=await g(),r=null;for(let i of n){let n=X(i,`server`),a=Z(i);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function An(e){let t=On({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function jn(e){return new ne(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=On({lockDir:p(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await Tn({});return}if(n===`all`){let e=await g();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=Z(n);!$(e,S)&&!$(r,S)||(An(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await kn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}An(t);return}An(p(I(Ie(),n)))})}export{U as _,rn as a,Ne as b,sn as c,Z as d,X as f,Le as g,Xt as h,fn as i,cn as l,Yt as m,jn as n,ln as o,$t as p,En as r,an as s,On as t,nn as u,Ie as v,Fe as y};
20
- //# sourceMappingURL=src-C7IJWx9K.mjs.map
@@ -1 +0,0 @@
1
- import{Ds as e,J as t,Js as n,Ks as r,Os as i,Pc as a,W as o,ic as s,ws as c,x as l,y as u}from"./src-Bt6_UxL9.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Aa as _,Ai as v,An as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ca as D,Ci as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Fr as q,Ft as J,G as Y,Gi as X,Gn as Z,Gr as Q,Gt as $,H as ee,Hi as te,Hn as ne,Hr as re,Ht as ie,I as ae,Ii as oe,In as se,Ir as ce,It as le,J as ue,Ji as de,Jn as fe,Jr as pe,Jt as me,K as he,Ki as ge,Kn as _e,Kr as ve,Kt as ye,L as be,Li as xe,Ln as Se,Lr as Ce,Lt as we,M as Te,Ma as Ee,Mi as De,Mn as Oe,Mt as ke,N as Ae,Ni as je,Nn as Me,Nr as Ne,Nt as Pe,O as Fe,Oa as Ie,Oi as Le,On as Re,Ot as ze,P as Be,Pi as Ve,Pn as He,Pr as Ue,Pt as We,Q as Ge,Qi as Ke,Qn as qe,Qr as Je,Qt as Ye,R as Xe,Ri as Ze,Rn as Qe,Rr as $e,Rt as et,S as tt,Sa as nt,Si as rt,Sn as it,Sr as at,St as ot,T as st,Ta as ct,Ti as lt,Tn as ut,Tr as dt,Tt as ft,U as pt,Ui as mt,Un as ht,Ur as gt,Ut as _t,V as vt,Vi as yt,Vn as bt,Vr as xt,Vt as St,W as Ct,Wi as wt,Wn as Tt,Wr as Et,Wt as Dt,X as Ot,Xi as kt,Xn as At,Xr as jt,Xt as Mt,Y as Nt,Yi as Pt,Yn as Ft,Yr as It,Yt as Lt,Z as Rt,Zi as zt,Zn as Bt,Zr as Vt,Zt as Ht,_ as Ut,_a as Wt,_i as Gt,_n as Kt,_r as qt,a as Jt,aa as Yt,ai as Xt,an as Zt,ar as Qt,at as $t,b as en,ba as tn,bi as nn,bn as rn,br as an,bt as on,c as sn,ca as cn,ci as ln,cn as un,cr as dn,ct as fn,d as pn,da as mn,di as hn,dn as gn,dr as _n,dt as vn,ea as yn,ei as bn,en as xn,er as Sn,et as Cn,f as wn,fa as Tn,fi as En,fn as Dn,fr as On,ft as kn,g as An,ga as jn,gi as Mn,gn as Nn,gr as Pn,h as Fn,ha as In,hi as Ln,hn as Rn,hr as zn,i as Bn,ia as Vn,ii as Hn,in as Un,ir as Wn,it as Gn,j as Kn,ja as qn,ji as Jn,jn as Yn,jt as Xn,k as Zn,ka as Qn,ki as $n,kn as er,kt as tr,l as nr,la as rr,li as ir,ln as ar,lr as or,lt as sr,m as cr,ma as lr,mi as ur,mn as dr,mr as fr,n as pr,na as mr,ni as hr,nn as gr,nr as _r,nt as vr,o as yr,oa as br,oi as xr,on as Sr,or as Cr,ot as wr,p as Tr,pa as Er,pi as Dr,pn as Or,pr as kr,q as Ar,qi as jr,qn as Mr,qr as Nr,qt as Pr,r as Fr,ra as Ir,ri as Lr,rn as Rr,rr as zr,rt as Br,s as Vr,sa as Hr,si as Ur,sn as Wr,sr as Gr,st as Kr,t as qr,ta as Jr,ti as Yr,tn as Xr,tr as Zr,tt as Qr,u as $r,ua as ei,ui as ti,un as ni,ur as ri,ut as ii,v as ai,va as oi,vi as si,vn as ci,vr as li,w as ui,wa as di,wi as fi,wn as pi,wr as mi,wt as hi,x as gi,xa as _i,xn as vi,xr as yi,xt as bi,y as xi,ya as Si,yi as Ci,yn as wi,yr as Ti,yt as Ei,z as Di,zi as Oi,zn as ki,zr as Ai,zt as ji}from"./src-bhsVUHJJ.mjs";import{C as Mi,E as Ni,T as Pi,_ as Fi,b as Ii,c as Li,d as Ri,g as zi,i as Bi,l as Vi,m as Hi,n as Ui,p as Wi,s as Gi,t as Ki,u as qi,v as Ji,w as Yi,x as Xi,y as Zi}from"./fs-traced-Dm4NQ6S5.mjs";import{a as Qi,d as $i,f as ea,i as ta,l as na,n as ra,r as ia,t as aa,u as oa}from"./logger-Dq-cRhcP.mjs";import{C as sa,S as ca,_ as la,a as ua,b as da,c as fa,d as pa,f as ma,g as ha,h as ga,i as _a,l as va,m as ya,n as ba,o as xa,p as Sa,r as Ca,s as wa,t as Ta,u as Ea,x as Da}from"./server-lock-C0j1Yr_I.mjs";export{D as AGENT_ID_MAX_LEN,di as AGENT_ID_RE,Oi as AGENT_WRITE_ORIGIN,_ as AcpPermissionStore,N as AcpRegistry,lt as AcpThreadManager,O as AgentFocusBroadcaster,rt as AgentPresenceBroadcaster,S as AgentSessionCapacityError,yt as AgentSessionManager,on as AutoStartDisabledError,Ln as BUNDLE_IDS,Mn as BUNDLE_SCOPE,Gt as BUNDLE_SKILL_NAME,Bt as BacklinkIndex,zt as CC1Broadcaster,n as CC1_CONTRACT_VERSION,Wr as CONFIG_FILENAME,Z as CONFLICT_MARKER_RE,q as CURSOR_BUNDLE_PATHS_BY_PLATFORM,xi as ConfigSchema,Ir as DEFAULT_CHECKPOINT_RETENTION,m as DEFAULT_EMBEDDINGS_DIMENSIONS,T as DEFAULT_PACK_ID,Ct as DocumentDurabilityState,bn as EMBEDDINGS_API_KEY_ENV,qr as EPHEMERAL_PROJECT_DIR_PREFIX,wi as ExposureConsentError,Ie as FEATURED_AGENT_IDS,Vn as FILE_SYSTEM_WRITER,Ft as FILE_WATCHER_ORIGIN,Nr as FileEmbeddingsBackend,gr as GIT_PREFLIGHT_FAIL_SPAN_NAME,Yt as GIT_UPSTREAM_WRITER,qn as GitDirAccessError,v as GitNotAvailableError,Jn as GitTooOldError,bi as HOCUSPOCUS_AUTH_REJECTION_REASONS,ot as HocuspocusAuthRejection,j as HocuspocusAuthTokenSchema,Rn as HomeProjectRootError,xt as INSTALLED_AGENTS_SCHEMES,vn as JSON_SCHEMA_DIALECT_2020_12,r as LINEAGE_EPOCH_KEY,vt as LIVE_DERIVED_INDEX_DEBOUNCE_MS,St as LOG_MD_TEMPLATE,b as MANAGED_RENAME_ORIGIN,B as MAX_ACP_THREADS,te as MAX_AGENT_SESSIONS,Le as MCP_CONNECTION_ID_HEADER,c as MCP_SERVER_NAME,mt as MIN_EVICTABLE_IDLE_MS,De as MIN_GIT_VERSION,Y as MISSING_OK_CONFIG_MESSAGE,Ee as MalformedGitPointerError,Br as McpLogger,he as MissingOkConfigError,X as OBSERVER_SYNC_ORIGIN,un as OK_OKIGNORE_TEMPLATE,si as ONBOARDING_BUNDLE_IDS,e as ORPHAN_MODES,a as PROTOCOL_VERSION,aa as PinoLogger,va as ProcessLockCollisionError,pn as ProjectGitInitError,Xn as ROLLBACK_ORIGIN,ar as ROOT_GITIGNORE_TEMPLATE,da as RUNTIME_VERSION,br as SERVICE_WRITER,kr as SKILL_INSTALL_EVENTS_FILE_REL,o as SKILL_STATE_TARGETS,ie as STARTER_FOLDERS,_t as STARTER_FOLDER_FRONTMATTER_FILENAME,Dt as STARTER_PACKS,$ as STARTER_PACK_IDS,ye as STARTER_TEMPLATES,Fe as STATE_MANIFEST_FILENAME,Da as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,Ye as SeedPrerequisiteError,h as SeedRootDirError,Ta as ServerLockCollisionError,pr as SingleFileNotAFileError,Fr as SingleFileNotFoundError,Bn as SingleFileNotMarkdownError,Zn as StateManifestError,At as TagIndex,Ci as USER_GLOBAL_BUNDLE_IDS,ke as __getShowAllWalkStatsForTesting,Pe as __resetShowAllWalkStatsForTesting,Ea as acquireProcessLock,ba as acquireServerLock,wt as applyAgentMarkdownWrite,ht as applyExternalChange,ji as applySeed,g as assertCompatibleStateManifest,je as assertGitAvailable,Yn as assertNeverDiskEvent,Nn as assertNotHomeProjectRoot,fi as attachAcpThreadSocket,Ei as attachIdleShutdown,en as bootServer,p as buildAndOpenSkill,ni as buildConfigYmlContent,Ge as buildExecResult,rn as buildIngressPolicy,P as buildOkMcpStdioCommand,En as buildSkillZip,Pr as buildStarterFolderFrontmatterYaml,Hr as buildWipTree,nn as bundleSkillMdPath,pe as canonicalProjectKey,Kt as canonicalizeForCompare,Oe as classifyEvents,Ki as classifyFsPath,It as clearAllEmbeddingsKeys,hr as clearContributors,me as coercePackId,u as colorFromSeed,cn as commitUpstreamImport,rr as commitWip,ei as commitWipFromTree,Ve as compareSemver,an as composeEffectiveLinterConfig,yi as composeFrontmatterSchemasConfig,_e as containsConflictMarkers,Me as contentHash,Lr as contributorCount,be as countShadowObjects,Xe as countStaleAgentWipRefs,Di as countWipRefs,We as createApiExtension,tr as createAssetServeMiddleware,ue as createCollaborationHost,Ne as createContentFilter,Ue as createContentFilterAsync,jt as createEmbeddingsSecretStore,Jt as createEphemeralProjectDir,Tt as createExternalChangeHandler,cr as createFileLogger,ee as createLiveDerivedIndexExtension,Ot as createMcpHttpHandler,re as createOsProbe,ae as createPersistenceExtension,st as createServer,Be as createServerObserverExtension,de as createStreamingErrorWriter,ra as createTestLogger,Vt as describeStoredEmbeddingsKey,ai as detectClaudeDesktopPresence,G as detectGit,Kn as detectProjectShape,Sn as detectUserSkillHosts,wr as discoverLockDirs,mi as discoverMarkdownlintConfig,Rr as emitPreflightFailureSpan,d as encodeDocName,Cn as encodeFolderRoute,Qr as encodeSkillRoute,wn as ensureProjectGit,gn as ensureProjectSkillGitignore,Pt as errorResponse,He as evictStaleTrackerEntries,J as extractHeadings,Kr as extractOkBinaryPath,qe as extractWikiLinksFromMarkdown,oe as fallbackPaths,Tr as findEnclosingGitRoot,er as findEnclosingProjectRoot,dt as findNativeMarkdownlintFile,Fn as flushFileLogger,hi as formatAuthRejectionWire,Hn as formatContributors,Xt as formatContributorsFrom,we as formatPackRationale,mn as gcCheckpointRefs,Gn as getCurrentMcpLogger,vi as getIngressContext,ir as getLocalDir,An as getLogFilePath,ia as getLogger,Ut as getLogsDir,la as getMachineId,Zi as getMeter,oi as getMetrics,Ii as getTracer,Si as handleCollabSocketError,ce as handleSpawnCursor,it as hasForwardingHeaders,x as hasGcLogLatch,l as iconFromClientName,tn as incrementCollabSocketFilteredError,_i as incrementServerObserverFire,Dn as initContent,Tn as initShadowRepo,Xi as initTelemetry,tt as initToleranceTelemetryWriter,kn as installJsonSchemaDialect,ii as installPrettyZodErrors,ta as installTestLoggers,Zr as installUserSkill,Re as isAllowedApiOrigin,V as isAllowedWorkspaceHostHeader,Ke as isConfigDoc,ft as isHocuspocusAuthRejectionReason,ci as isHomeDir,k as isHostAdmitted,Lt as isKnownPackId,f as isLinkIndexExcludedDoc,F as isLoopbackAddress,yn as isManagedArtifactDoc,pi as isOriginAdmitted,i as isOrphanMode,ge as isPairedWriteOrigin,Ce as isPathWithinDir,ut as isPeerAdmitted,ca as isProcessAlive,y as isProjectRoot,Jr as isReservedForUserTree,K as isSelfWrite,mr as isSystemDoc,E as isToleranceTelemetryEnabled,sa as isValidLockPid,se as lastKnownHash,Er as listRescueCheckpoints,Mt as listStarterPacks,Qn as loadCustomAgents,W as loadPrincipal,Ca as lockAdvertisesUi,pa as lockBaseUrl,ma as lockFilePath,Qi as loggerFactory,Pn as loginShapedUserinfoUser,na as logsCurrentPath,oa as logsPreviousPath,Je as makeLazyEmbeddingsKeyStore,_a as markServerLockDraining,Ar as mountMcpAndApi,Ui as normalizeFsPath,qt as originGitHubHost,Or as packageVersionMajorMinor,U as parseAuthRejectionWire,xe as parseGitVersion,L as parseHocuspocusAuthToken,Nt as parseKeepaliveConnectionId,Se as pathToDocName,et as planSeed,yr as prepareSingleFileOpen,fn as processCommand,sr as processUsage,Wn as readAllTargets,Qt as readBundleDecision,H as readOwnNativeRules,Sa as readProcessLock,ya as readProcessLockDetailed,pt as readProjectHeadState,ve as readProjectLocalSemanticConfig,ua as readServerLock,Cr as readServerPackageVersion,Gr as readSkillInstallStateSnapshot,Te as readStateManifest,dn as readTargetRecordedAt,or as readTargetVersion,Mr as reconcile,xr as recordContributor,fr as recordSkillInstallEvent,zn as redactShareSubprocessStderr,Rt as registerAllTools,Qe as registerWrite,ga as releaseProcessLock,xa as releaseServerLock,ki as removeLastKnownHash,zr as reportSkillInstall,nt as resetMetrics,_r as resolveBuiltinSkillHosts,t as resolveBundleEnabled,Dr as resolveBundledSkillDir,ti as resolveContentDir,$e as resolveCursorBinaryDefault,Ai as resolveCursorSpawnInvocation,at as resolveEffectiveLinterConfig,Yr as resolveEmbeddingsCredential,M as resolveGitHubAccountFromUrl,hn as resolveLockDir,A as resolveNativeConfigForDoc,I as resolveNativeMarkdownlintConfig,Ht as resolvePack,nr as resolvePackageVersion,On as resolveSkillInstallReportSettings,vr as resolveUiInfo,Ur as restoreContributors,gi as restoreLifecycleFromConflictsJson,Et as rewriteMarkdownLinksForDocumentRename,Q as rewriteWikiLinksForDocumentRename,Un as runAuthReposSubprocess,Zt as runAuthStatusSubprocess,xn as runCloneSubprocess,Sr as runDeviceFlowSubprocess,$t as runWithMcpLogger,gt as safeContentPath,le as safeSubdir,lr as safetyCheckpoint,li as sameGitHubLogin,$n as sanitizeClientName,In as saveInMemoryCheckpoint,jn as saveVersion,ze as seedBasenameIndex,Vr as seedEphemeralProjectDir,sn as serializeError,Mi as setActiveSpanAttributes,jr as setupServerObservers,Wt as shadowGit,Yi as shutdownTelemetry,$i as spansCurrentPath,ea as spansPreviousPath,w as spawnDetached,fe as splitMarkdownBlocks,C as startWatcher,kt as streamingProblemEvent,ln as swapContributors,ui as teardownToleranceTelemetryWriter,ct as toBroadcasterKey,Bi as tracedAppendFileSync,Gi as tracedLinkSync,Li as tracedMkdir,Vi as tracedMkdirSync,qi as tracedRename,Ri as tracedRenameSync,Wi as tracedRmSync,Hi as tracedRmdirSync,zi as tracedUnlinkSync,Fi as tracedWriteFile,Ji as tracedWriteFileSync,R as trustSystemCertificates,$r as untrackTrackedProjectSkillProjection,bt as updateLastKnownHash,ha as updateProcessLockPort,wa as updateServerLockPort,z as validateAgentId,Xr as validateCloneInputs,ur as validateSkillZip,fa as waitForServerLockDrain,Ze as withHiddenWindowsConsole,Pi as withSpan,Ni as withSpanSync,ri as writeBundleDecision,Ti as writeMarkdownlintRule,dr as writeRootGitignoreForNewRepo,Ae as writeStateManifest,_n as writeTargetVersion,ne as writeTracker};
@@ -1 +0,0 @@
1
- import"./src-Bt6_UxL9.mjs";import"./resolve-project-root-BF1NyEri.mjs";import"./src-C7IJWx9K.mjs";import"./acp-harness-probe-DWsC0HGJ.mjs";import"./init-wSrUXJrK.mjs";import{n as e}from"./loader-Bqkd1CSo.mjs";import"./skill-teardown-B9-HO2ID.mjs";import"./preview-CGdqYnsr.mjs";import"./mcp-migrate-event-9DFnNzHa.mjs";export{e as loadConfig};