@inkeep/open-knowledge 0.46.0-beta.4 → 0.46.0-beta.5

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 (112) hide show
  1. package/dist/{acp-harness-probe-BQ3_wze1.mjs → acp-harness-probe-z0k-zB9k.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/cli.mjs +16 -16
  5. package/dist/constants-tslCao45.mjs +2 -0
  6. package/dist/{git-handle-BnrTPYj_.mjs → git-handle-CK_JXuyw.mjs} +2 -2
  7. package/dist/git-handle-DyS9-xsk.mjs +1 -0
  8. package/dist/index.mjs +1 -1
  9. package/dist/{init-D0wKKFay.mjs → init-B0r5j8e-.mjs} +4 -4
  10. package/dist/init-CZkiXXqU.mjs +1 -0
  11. package/dist/{launch-json-removal-CmpnCINi.mjs → launch-json-removal-DuEviY27.mjs} +2 -2
  12. package/dist/{loader-Sk1Z2HXI.mjs → loader-17-u4oG7.mjs} +2 -2
  13. package/dist/loader-BUBYD2vK.mjs +1 -0
  14. package/dist/md-manager-BWTSpVXC.mjs +2 -0
  15. package/dist/{open-browser-DZWA0mkS.mjs → open-browser-BHXl6F9O.mjs} +2 -2
  16. package/dist/parse-worker.mjs +1 -1
  17. package/dist/preview-B82KOKlR.mjs +1 -0
  18. package/dist/{preview-B4nElYVr.mjs → preview-D9rdyPNb.mjs} +2 -2
  19. package/dist/public/assets/{ActivityModeContent-DKkJMuA9.js → ActivityModeContent-BquAhT5x.js} +1 -1
  20. package/dist/public/assets/{AgentDiffPane-DkzTKjWa.js → AgentDiffPane-6bk9bV9U.js} +1 -1
  21. package/dist/public/assets/{AgentThreadClientBinder-BqONUtGD.js → AgentThreadClientBinder-u3ZVSSHE.js} +1 -1
  22. package/dist/public/assets/{CodeMirrorPropInput-CyIlgGaP.js → CodeMirrorPropInput-DOcEkWLX.js} +2 -2
  23. package/dist/public/assets/{DocumentContext-QeD0oigI.js → DocumentContext-uE-Jpe8-.js} +10 -10
  24. package/dist/public/assets/{EditorModeToggle-12SdK7ya.js → EditorModeToggle-DBmNyzRU.js} +1 -1
  25. package/dist/public/assets/{EnableSyncConfirmDialog-GUnrwfa0.js → EnableSyncConfirmDialog-Dufpw3Xm.js} +1 -1
  26. package/dist/public/assets/FeedbackForm-BieBWPdz.js +1 -0
  27. package/dist/public/assets/{GraphPanel-DE5iijrO.js → GraphPanel-DZMLD8ni.js} +2 -2
  28. package/dist/public/assets/{LintConfigEditor-BNN0UkHw.js → LintConfigEditor-k9WOKYkq.js} +1 -1
  29. package/dist/public/assets/{ManagedArtifactProperties-Bab8809-.js → ManagedArtifactProperties-DJqeSv57.js} +1 -1
  30. package/dist/public/assets/{McpConsentDialogBody-xnaSaj_X.js → McpConsentDialogBody-CHmK7aXE.js} +1 -1
  31. package/dist/public/assets/{MermaidDocEditor-Bw26glK9.js → MermaidDocEditor-CGsfhioE.js} +1 -1
  32. package/dist/public/assets/PropertyPanel-D_XAZl4d.js +2 -0
  33. package/dist/public/assets/{ReportBugDialogBody-SYqc1dep.js → ReportBugDialogBody-CdEV6nCR.js} +1 -1
  34. package/dist/public/assets/{SchemaConfigEditor-RgV92dU4.js → SchemaConfigEditor-BFx4ZhVm.js} +1 -1
  35. package/dist/public/assets/{SettingsDialogBody-Bhk4NQJN.js → SettingsDialogBody-Chz13SZG.js} +3 -3
  36. package/dist/public/assets/{ShareBranchSwitchDialog-BXjj8rUu.js → ShareBranchSwitchDialog-jGb4KF7T.js} +1 -1
  37. package/dist/public/assets/{ShareReceiveDialog-CXqdzDYu.js → ShareReceiveDialog-C7_nVZOF.js} +1 -1
  38. package/dist/public/assets/{ShareReceiveMissDialog-BaHsueef.js → ShareReceiveMissDialog-Dv1nzqQa.js} +1 -1
  39. package/dist/public/assets/{SkillEditorActions-CDWxVAy1.js → SkillEditorActions-2WrfNbQp.js} +1 -1
  40. package/dist/public/assets/{SourceEditor-CZhPtXfy.js → SourceEditor-CmpVF187.js} +1 -1
  41. package/dist/public/assets/{TerminalPanel-DiVhC52x.js → TerminalPanel-BHN2VN4r.js} +1 -1
  42. package/dist/public/assets/{TerminalSessionsHost-8wTgxl0R.js → TerminalSessionsHost-Yz2cECTk.js} +2 -2
  43. package/dist/public/assets/{TerminalWindowApp-CQunMofw.js → TerminalWindowApp-CntBjoWb.js} +1 -1
  44. package/dist/public/assets/{ThreadView-BI4embLm.js → ThreadView-loAOfVAD.js} +1 -1
  45. package/dist/public/assets/{TimelineDiffPane-Dd-khPXZ.js → TimelineDiffPane-C5gRZMQN.js} +1 -1
  46. package/dist/public/assets/{agent-diff-store-CcwDxQK9.js → agent-diff-store-BvRAZqCN.js} +1 -1
  47. package/dist/public/assets/{agent-visibility-mwTztYpe.js → agent-visibility-DJ6Bc0aU.js} +1 -1
  48. package/dist/public/assets/{auth-state-cache-Bkm-5pQl.js → auth-state-cache-CEu3ZBI_.js} +1 -1
  49. package/dist/public/assets/{client-version-g_nEG2h2.js → client-version-MIkctMik.js} +1 -1
  50. package/dist/public/assets/{comment-chips--aitTdum.js → comment-chips-BYH7v5tl.js} +1 -1
  51. package/dist/public/assets/{config-provider-CedEU5Ch.js → config-provider-B9kQH9zn.js} +2 -2
  52. package/dist/public/assets/{dist-Cv2LF2DL.js → dist-DJbbCXtB.js} +183 -177
  53. package/dist/public/assets/{doc-hash-unBeSU8C.js → doc-hash-BbU2eA08.js} +1 -1
  54. package/dist/public/assets/{documents-events-DJXnk07Z.js → documents-events-C-mYs64z.js} +1 -1
  55. package/dist/public/assets/{file-tree-adapter-C9l0Uy9t.js → file-tree-adapter-c4ru9pmD.js} +1 -1
  56. package/dist/public/assets/{file-tree-utils-Cy6smqXE.js → file-tree-utils-Lc0SvgnU.js} +1 -1
  57. package/dist/public/assets/{index-BnCzVIZM.js → index-CSZTqzu0.js} +11 -11
  58. package/dist/public/assets/{lint-config-client-SBOLqEAH.js → lint-config-client-DJg7YDu3.js} +1 -1
  59. package/dist/public/assets/{markdownlint-rule-browser-u-niNZkQ.js → markdownlint-rule-browser-6yvn3dt6.js} +1 -1
  60. package/dist/public/assets/{navigation-targets-CRrgSRY3.js → navigation-targets-DwSgIIy0.js} +1 -1
  61. package/dist/public/assets/{open-managed-artifact-tab-DKpdEiZk.js → open-managed-artifact-tab-Dpz9X1m_.js} +1 -1
  62. package/dist/public/assets/{pending-receive-nav-store-EO01lM9G.js → pending-receive-nav-store-t5K6mYGs.js} +1 -1
  63. package/dist/public/assets/{prop-types-DDnDOUmp.js → prop-types-65NJPmd-.js} +1 -1
  64. package/dist/public/assets/{receive-store-CCj5OCl8.js → receive-store-C8NL_Ow-.js} +1 -1
  65. package/dist/public/assets/{selection-context-CsoqdVq1.js → selection-context-BNYOSYyM.js} +1 -1
  66. package/dist/public/assets/{skill-actions-4cV_4pjw.js → skill-actions-ByBHG3Gh.js} +1 -1
  67. package/dist/public/assets/{skills-api-141pFhWO.js → skills-api-DWPhWBud.js} +1 -1
  68. package/dist/public/assets/{src-0hFiTIuh.js → src-U1RHfo7d.js} +1 -1
  69. package/dist/public/assets/{tag-pill-input-C4VKdytg.js → tag-pill-input-BHj4spSb.js} +1 -1
  70. package/dist/public/assets/{target-navigation-intent-BzJodEAL.js → target-navigation-intent-B5jnqgZ_.js} +1 -1
  71. package/dist/public/assets/{terminal-launch-events-Bz4DL9DZ.js → terminal-launch-events-CtZeptxC.js} +1 -1
  72. package/dist/public/assets/{terminal-telemetry-CXqhqIkk.js → terminal-telemetry-CvNM4wYv.js} +1 -1
  73. package/dist/public/assets/typing-burst-detector-CZREoy8B.js +8 -0
  74. package/dist/public/assets/{uninstall-9ZXPO59t.js → uninstall-CA1cQCnA.js} +1 -1
  75. package/dist/public/assets/{use-activity-panel-BBGq_DFB.js → use-activity-panel-DWxDopZd.js} +1 -1
  76. package/dist/public/assets/{use-apply-config-color-theme-zM7Oux5u.js → use-apply-config-color-theme-DSCn9I0W.js} +1 -1
  77. package/dist/public/assets/{use-collab-url-81TC8Fvz.js → use-collab-url-CE02D4PJ.js} +1 -1
  78. package/dist/public/assets/{use-live-xterm-theme-DeW6SO6V.js → use-live-xterm-theme-B2MdP4nP.js} +1 -1
  79. package/dist/public/assets/{use-settings-route-KYTTaHV0.js → use-settings-route-BX1P2p9-.js} +1 -1
  80. package/dist/public/assets/{use-terminal-enabled-qjUlZ0f0.js → use-terminal-enabled-BlXFMDFQ.js} +1 -1
  81. package/dist/public/assets/{use-timeline-entry-diff-svkep662.js → use-timeline-entry-diff-BI1BVnmy.js} +1 -1
  82. package/dist/public/assets/{use-workspace-CNU53RmX.js → use-workspace-DcPrrukl.js} +1 -1
  83. package/dist/public/assets/{workspace-paths-DGKkpMQ9.js → workspace-paths-CU85-ZRd.js} +1 -1
  84. package/dist/public/index.html +36 -36
  85. package/dist/public/uninstall.html +2 -2
  86. package/dist/{repair-launch-json-B-4hsfw8.mjs → repair-launch-json-DuW7FPUd.mjs} +2 -2
  87. package/dist/{repair-mcp-configs--yGPDCBl.mjs → repair-mcp-configs-BQGk6jEy.mjs} +2 -2
  88. package/dist/{repair-skills-CH8FwF78.mjs → repair-skills-BHY_AeM4.mjs} +2 -2
  89. package/dist/repair-skills-CUT1NbJx.mjs +1 -0
  90. package/dist/server-lock-CG809RrD.mjs +1 -0
  91. package/dist/{server-lock-D6rSSnhg.mjs → server-lock-D7crxuP7.mjs} +2 -2
  92. package/dist/{src-CwNOE4ri.mjs → src-D4iCDwsy.mjs} +1 -1
  93. package/dist/{src-y0VSl78g.mjs → src-Dgr9qydu.mjs} +4 -4
  94. package/dist/{src-2StQCkyf.mjs → src-DmtkLnli.mjs} +26 -20
  95. package/dist/src-T1lGYBC1.mjs +3275 -0
  96. package/dist/{start-D-Yu2Dgc.mjs → start-BCUq2L4a.mjs} +3 -3
  97. package/dist/start-p5gJUJY6.mjs +1 -0
  98. package/dist/{write-project-skill-W6wm8WGO.mjs → write-project-skill-BzhJIXSv.mjs} +3 -3
  99. package/package.json +4 -4
  100. package/dist/constants-7P_R76Oj.mjs +0 -2
  101. package/dist/git-handle-CHFcUjId.mjs +0 -1
  102. package/dist/init-C9mmgvW-.mjs +0 -1
  103. package/dist/loader-D297fMOD.mjs +0 -1
  104. package/dist/md-manager-B9dAVpPF.mjs +0 -2
  105. package/dist/preview-DacomZcF.mjs +0 -1
  106. package/dist/public/assets/FeedbackForm-B34f3kZF.js +0 -1
  107. package/dist/public/assets/PropertyPanel-ANMzlUf0.js +0 -2
  108. package/dist/public/assets/typing-burst-detector-DuRvcTVz.js +0 -8
  109. package/dist/repair-skills-C40390Fl.mjs +0 -1
  110. package/dist/server-lock-RCr-Pegf.mjs +0 -1
  111. package/dist/src-DV_Dbu6a.mjs +0 -3275
  112. package/dist/start-Bc5XMp-q.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./createLucideIcon-DAkhoPjT.js";import{Un as i}from"./dist-Cv2LF2DL.js";var a=r(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),o=r(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),s=r(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),c=[`global`,`project`];function l(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}var u=`open-knowledge-pack-`;function d(e){return e.startsWith(u)?e.slice(20):e}function f(){let{_:e}=n();return{project:e({id:`e0NrBM`}),global:e({id:`2GT3Hf`})}}function p(){let{_:e}=n();return{project:e({id:`HyvSqq`}),global:e({id:`C7XjNB`})}}var m=e(t(),1);function h(){let[e]=(0,m.useState)(g);return e}function g(){return i()!=null}function _(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}var v=/\.(md|mdx)$/i;function y(e){return v.test(e)?e:`${e}.md`}export{d as a,p as c,a as d,c as i,s as l,_ as n,l as o,h as r,f as s,y as t,o as u};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./createLucideIcon-DAkhoPjT.js";import{Wn as i}from"./dist-DJbbCXtB.js";var a=r(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),o=r(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),s=r(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),c=[`global`,`project`];function l(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}var u=`open-knowledge-pack-`;function d(e){return e.startsWith(u)?e.slice(20):e}function f(){let{_:e}=n();return{project:e({id:`e0NrBM`}),global:e({id:`2GT3Hf`})}}function p(){let{_:e}=n();return{project:e({id:`HyvSqq`}),global:e({id:`C7XjNB`})}}var m=e(t(),1);function h(){let[e]=(0,m.useState)(g);return e}function g(){return i()!=null}function _(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}var v=/\.(md|mdx)$/i;function y(e){return v.test(e)?e:`${e}.md`}export{d as a,p as c,a as d,c as i,s as l,_ as n,l as o,h as r,f as s,y as t,o as u};
@@ -58,7 +58,7 @@
58
58
  -->
59
59
  <script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let ct = null; try { const c = localStorage.getItem('ok-color-theme-v1'); if (c && ['dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized', 'custom'].includes(c)) ct = c; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } let customCss = null; if (ct === 'custom') { try { const raw = localStorage.getItem('ok-custom-theme-v1'); if (raw) { const o = JSON.parse(raw); if (o?.css) { customCss = o.css; dark = !!o.dark; } } } catch {} if (!customCss) ct = null; } else if (ct) { dark = !['catppuccin-latte'].includes(ct); } if (dark) document.documentElement.classList.add('dark'); if (ct) document.documentElement.setAttribute('data-color-theme', ct); if (customCss) { const s = document.createElement('style'); s.id = 'ok-custom-theme'; s.textContent = customCss; document.head.appendChild(s); } if (window.okDesktop) { document.documentElement.classList.add('electron-mode'); document.documentElement.classList.add(`electron-platform-${window.okDesktop.platform}`); } })();</script>
60
60
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
61
- <script type="module" crossorigin src="./assets/index-BnCzVIZM.js"></script>
61
+ <script type="module" crossorigin src="./assets/index-CSZTqzu0.js"></script>
62
62
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
63
63
  <link rel="modulepreload" crossorigin href="./assets/dist-BCZq3DKc.js">
64
64
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
@@ -79,14 +79,14 @@
79
79
  <link rel="modulepreload" crossorigin href="./assets/trace-api-DHyWZzIa.js">
80
80
  <link rel="modulepreload" crossorigin href="./assets/lib-Iu39CNZE.js">
81
81
  <link rel="modulepreload" crossorigin href="./assets/markdownit-YwcN3EvW.js">
82
- <link rel="modulepreload" crossorigin href="./assets/dist-Cv2LF2DL.js">
82
+ <link rel="modulepreload" crossorigin href="./assets/dist-DJbbCXtB.js">
83
83
  <link rel="modulepreload" crossorigin href="./assets/dist-PQ5KMVDh.js">
84
84
  <link rel="modulepreload" crossorigin href="./assets/compiler-runtime-BfE3aGVn.js">
85
85
  <link rel="modulepreload" crossorigin href="./assets/jsx-runtime-BUgB2tll.js">
86
- <link rel="modulepreload" crossorigin href="./assets/client-version-g_nEG2h2.js">
87
- <link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-zM7Oux5u.js">
86
+ <link rel="modulepreload" crossorigin href="./assets/client-version-MIkctMik.js">
87
+ <link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-DSCn9I0W.js">
88
88
  <link rel="modulepreload" crossorigin href="./assets/config-context-D3FvmHZm.js">
89
- <link rel="modulepreload" crossorigin href="./assets/config-provider-CedEU5Ch.js">
89
+ <link rel="modulepreload" crossorigin href="./assets/config-provider-B9kQH9zn.js">
90
90
  <link rel="modulepreload" crossorigin href="./assets/dist-Nvb76hAm.js">
91
91
  <link rel="modulepreload" crossorigin href="./assets/bundle-mjs-SHeFpKGC.js">
92
92
  <link rel="modulepreload" crossorigin href="./assets/createLucideIcon-DAkhoPjT.js">
@@ -124,20 +124,20 @@
124
124
  <link rel="modulepreload" crossorigin href="./assets/folder-open-wLd69QUc.js">
125
125
  <link rel="modulepreload" crossorigin href="./assets/trash-2-DE3a7L75.js">
126
126
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-Bcc1P5yx.js">
127
- <link rel="modulepreload" crossorigin href="./assets/file-tree-utils-Cy6smqXE.js">
128
- <link rel="modulepreload" crossorigin href="./assets/doc-hash-unBeSU8C.js">
129
- <link rel="modulepreload" crossorigin href="./assets/navigation-targets-CRrgSRY3.js">
127
+ <link rel="modulepreload" crossorigin href="./assets/file-tree-utils-Lc0SvgnU.js">
128
+ <link rel="modulepreload" crossorigin href="./assets/doc-hash-BbU2eA08.js">
129
+ <link rel="modulepreload" crossorigin href="./assets/navigation-targets-DwSgIIy0.js">
130
130
  <link rel="modulepreload" crossorigin href="./assets/external-link-Ct0_ujyY.js">
131
131
  <link rel="modulepreload" crossorigin href="./assets/documents-fetch-Db-Ikele.js">
132
- <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-CyIlgGaP.js">
132
+ <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-DOcEkWLX.js">
133
133
  <link rel="modulepreload" crossorigin href="./assets/git-branch-CMJAiYLz.js">
134
134
  <link rel="modulepreload" crossorigin href="./assets/copy-9EDFYcyR.js">
135
135
  <link rel="modulepreload" crossorigin href="./assets/CopyButton-1Q6Wnnjb.js">
136
- <link rel="modulepreload" crossorigin href="./assets/documents-events-DJXnk07Z.js">
136
+ <link rel="modulepreload" crossorigin href="./assets/documents-events-C-mYs64z.js">
137
137
  <link rel="modulepreload" crossorigin href="./assets/parse-api-error-BtEL2kxi.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/startup-marks-CyxDWRgR.js">
139
- <link rel="modulepreload" crossorigin href="./assets/prop-types-DDnDOUmp.js">
140
- <link rel="modulepreload" crossorigin href="./assets/workspace-paths-DGKkpMQ9.js">
139
+ <link rel="modulepreload" crossorigin href="./assets/prop-types-65NJPmd-.js">
140
+ <link rel="modulepreload" crossorigin href="./assets/workspace-paths-CU85-ZRd.js">
141
141
  <link rel="modulepreload" crossorigin href="./assets/eye-CASw1HTi.js">
142
142
  <link rel="modulepreload" crossorigin href="./assets/hash-DNKDqZ18.js">
143
143
  <link rel="modulepreload" crossorigin href="./assets/info-yKMseklR.js">
@@ -148,19 +148,19 @@
148
148
  <link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-DDA1ck2Y.js">
149
149
  <link rel="modulepreload" crossorigin href="./assets/badge-DXHoKHez.js">
150
150
  <link rel="modulepreload" crossorigin href="./assets/input-D4OPkja2.js">
151
- <link rel="modulepreload" crossorigin href="./assets/use-collab-url-81TC8Fvz.js">
152
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-QeD0oigI.js">
151
+ <link rel="modulepreload" crossorigin href="./assets/use-collab-url-CE02D4PJ.js">
152
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-uE-Jpe8-.js">
153
153
  <link rel="modulepreload" crossorigin href="./assets/dist-DlSSwTCj.js">
154
154
  <link rel="modulepreload" crossorigin href="./assets/dist-DmIoqGC0.js">
155
155
  <link rel="modulepreload" crossorigin href="./assets/format-4tjAvLkN.js">
156
156
  <link rel="modulepreload" crossorigin href="./assets/braces-DwnwFx_V.js">
157
- <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-DKpdEiZk.js">
158
- <link rel="modulepreload" crossorigin href="./assets/comment-chips--aitTdum.js">
157
+ <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-Dpz9X1m_.js">
158
+ <link rel="modulepreload" crossorigin href="./assets/comment-chips-BYH7v5tl.js">
159
159
  <link rel="modulepreload" crossorigin href="./assets/textarea-bScbzsdX.js">
160
- <link rel="modulepreload" crossorigin href="./assets/lint-config-client-SBOLqEAH.js">
161
- <link rel="modulepreload" crossorigin href="./assets/selection-context-CsoqdVq1.js">
162
- <link rel="modulepreload" crossorigin href="./assets/PropertyPanel-ANMzlUf0.js">
163
- <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-GUnrwfa0.js">
160
+ <link rel="modulepreload" crossorigin href="./assets/lint-config-client-DJg7YDu3.js">
161
+ <link rel="modulepreload" crossorigin href="./assets/selection-context-BNYOSYyM.js">
162
+ <link rel="modulepreload" crossorigin href="./assets/PropertyPanel-D_XAZl4d.js">
163
+ <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-Dufpw3Xm.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/arrow-up-right-obRIg3Sv.js">
165
165
  <link rel="modulepreload" crossorigin href="./assets/cursor-BDHSyD-9.js">
166
166
  <link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-CyQDojW_.js">
@@ -168,40 +168,40 @@
168
168
  <link rel="modulepreload" crossorigin href="./assets/chevron-left-BQ6OM94c.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-DClG_qgN.js">
170
170
  <link rel="modulepreload" crossorigin href="./assets/copilot-BiqH8PgI.js">
171
- <link rel="modulepreload" crossorigin href="./assets/agent-visibility-mwTztYpe.js">
172
- <link rel="modulepreload" crossorigin href="./assets/use-settings-route-KYTTaHV0.js">
171
+ <link rel="modulepreload" crossorigin href="./assets/agent-visibility-DJ6Bc0aU.js">
172
+ <link rel="modulepreload" crossorigin href="./assets/use-settings-route-BX1P2p9-.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-ZCy01ehf.js">
174
- <link rel="modulepreload" crossorigin href="./assets/skills-api-141pFhWO.js">
175
- <link rel="modulepreload" crossorigin href="./assets/use-workspace-CNU53RmX.js">
176
- <link rel="modulepreload" crossorigin href="./assets/skill-actions-4cV_4pjw.js">
174
+ <link rel="modulepreload" crossorigin href="./assets/skills-api-DWPhWBud.js">
175
+ <link rel="modulepreload" crossorigin href="./assets/use-workspace-DcPrrukl.js">
176
+ <link rel="modulepreload" crossorigin href="./assets/skill-actions-ByBHG3Gh.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/square-pen-C1vIlMAW.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/field-BNyAQHKf.js">
179
- <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-Bkm-5pQl.js">
179
+ <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-CEu3ZBI_.js">
180
180
  <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-Bx4JLuKB.js">
181
- <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-EO01lM9G.js">
182
- <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-Bz4DL9DZ.js">
181
+ <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-t5K6mYGs.js">
182
+ <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-CtZeptxC.js">
183
183
  <link rel="modulepreload" crossorigin href="./assets/panel-right-open-CWgBRlZa.js">
184
184
  <link rel="modulepreload" crossorigin href="./assets/timeline-diff-store-BwCud4Ug.js">
185
185
  <link rel="modulepreload" crossorigin href="./assets/form-gDsa08Xi.js">
186
- <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-12SdK7ya.js">
186
+ <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-DBmNyzRU.js">
187
187
  <link rel="modulepreload" crossorigin href="./assets/wrench-4e3jxe5l.js">
188
188
  <link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-BoxMoaxR.js">
189
189
  <link rel="modulepreload" crossorigin href="./assets/panel-BbxjQP3-.js">
190
190
  <link rel="modulepreload" crossorigin href="./assets/skeleton-Mo1oLtEu.js">
191
- <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-DuRvcTVz.js">
191
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-CZREoy8B.js">
192
192
  <link rel="modulepreload" crossorigin href="./assets/ConfigSharingInfoTooltip-BMJ7SIjf.js">
193
193
  <link rel="modulepreload" crossorigin href="./assets/project-paths-DdZAF_-I.js">
194
194
  <link rel="modulepreload" crossorigin href="./assets/follow-file-BVJ6G9Hs.js">
195
- <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-C9l0Uy9t.js">
196
- <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-CcwDxQK9.js">
197
- <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BzJodEAL.js">
198
- <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-DeW6SO6V.js">
195
+ <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-c4ru9pmD.js">
196
+ <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-BvRAZqCN.js">
197
+ <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-B5jnqgZ_.js">
198
+ <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-B2MdP4nP.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/use-installed-clis-8r2iSkgN.js">
200
- <link rel="modulepreload" crossorigin href="./assets/terminal-telemetry-CXqhqIkk.js">
200
+ <link rel="modulepreload" crossorigin href="./assets/terminal-telemetry-CvNM4wYv.js">
201
201
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-BdWbAeV-.js">
202
202
  <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-CDAQY6Np.js">
203
203
  <link rel="modulepreload" crossorigin href="./assets/overlay-layers-Dhz8IqAf.js">
204
- <link rel="modulepreload" crossorigin href="./assets/receive-store-CCj5OCl8.js">
204
+ <link rel="modulepreload" crossorigin href="./assets/receive-store-C8NL_Ow-.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/worktree-store-B-NxI13K.js">
206
206
  <link rel="stylesheet" crossorigin href="./assets/globals-Cf_md-qZ.css">
207
207
  <link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
@@ -32,7 +32,7 @@
32
32
  script above.
33
33
  -->
34
34
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
35
- <script type="module" crossorigin src="./assets/uninstall-9ZXPO59t.js"></script>
35
+ <script type="module" crossorigin src="./assets/uninstall-CA1cQCnA.js"></script>
36
36
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
37
37
  <link rel="modulepreload" crossorigin href="./assets/dist-BCZq3DKc.js">
38
38
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
@@ -43,7 +43,7 @@
43
43
  <link rel="modulepreload" crossorigin href="./assets/lib-Iu39CNZE.js">
44
44
  <link rel="modulepreload" crossorigin href="./assets/markdownit-YwcN3EvW.js">
45
45
  <link rel="modulepreload" crossorigin href="./assets/w3c-keyname-DtWCia6R.js">
46
- <link rel="modulepreload" crossorigin href="./assets/dist-Cv2LF2DL.js">
46
+ <link rel="modulepreload" crossorigin href="./assets/dist-DJbbCXtB.js">
47
47
  <link rel="modulepreload" crossorigin href="./assets/jsx-runtime-BUgB2tll.js">
48
48
  <link rel="modulepreload" crossorigin href="./assets/dist-Nvb76hAm.js">
49
49
  <link rel="modulepreload" crossorigin href="./assets/bundle-mjs-SHeFpKGC.js">
@@ -1,2 +1,2 @@
1
- import{t as e}from"./launch-json-removal-CmpnCINi.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
- //# sourceMappingURL=repair-launch-json-B-4hsfw8.mjs.map
1
+ import{t as e}from"./launch-json-removal-DuEviY27.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
+ //# sourceMappingURL=repair-launch-json-DuW7FPUd.mjs.map
@@ -1,2 +1,2 @@
1
- import{d as e,l as t,v as n}from"./write-project-skill-W6wm8WGO.mjs";import{d as r,v as i}from"./init-D0wKKFay.mjs";import{t as a}from"./mcp-migrate-event-CWx0WLdE.mjs";import{homedir as o}from"node:os";function s(n){let r=n.logger??u,i=n.home??o(),a=[];if(n.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=e[o],s=c(()=>t.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),t.projectConfigPath){let e=t.projectConfigPath,i=c(()=>e(n.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:t,home:void 0,cwd:n.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let t={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=r(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...t,outcome:`no-entry`};if(n(o))return{...t,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=i(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let n=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:n}),{...t,outcome:`write-failed`,error:n}}return s.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:s.declineReason}),{...t,outcome:`declined`}):{...t,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs--yGPDCBl.mjs.map
1
+ import{d as e,l as t,v as n}from"./write-project-skill-BzhJIXSv.mjs";import{d as r,v as i}from"./init-B0r5j8e-.mjs";import{t as a}from"./mcp-migrate-event-CWx0WLdE.mjs";import{homedir as o}from"node:os";function s(n){let r=n.logger??u,i=n.home??o(),a=[];if(n.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=e[o],s=c(()=>t.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),t.projectConfigPath){let e=t.projectConfigPath,i=c(()=>e(n.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:t,home:void 0,cwd:n.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let t={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=r(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...t,outcome:`no-entry`};if(n(o))return{...t,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=i(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let n=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:n}),{...t,outcome:`write-failed`,error:n}}return s.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:s.declineReason}),{...t,outcome:`declined`}):{...t,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-BQGk6jEy.mjs.map
@@ -1,4 +1,4 @@
1
- import{w as e}from"./src-2StQCkyf.mjs";import{ar as t,dr as n,gr as r,hr as i,lr as a,nr as o,or as s,sr as c,tr as l}from"./src-DV_Dbu6a.mjs";import{C as u,a as d,d as f,f as p,o as m,s as h,t as g}from"./write-project-skill-W6wm8WGO.mjs";import{n as _,s as v,t as y}from"./colors-BsmVIwfM.mjs";import{dirname as b,join as x,relative as S,resolve as C}from"node:path";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,statSync as k,writeFileSync as A}from"node:fs";import{homedir as j}from"node:os";import{createInterface as M}from"node:readline/promises";const N={existsSync:e=>w(e),isDirectory:e=>{try{return k(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>D(e),readFileSync:e=>E(e),writeFileSync:(e,t)=>{A(e,t)},mkdirSync:(e,t)=>{T(e,t)},rmSync:(e,t)=>{O(e,t)}},P={resolveProjectBundledSkillDir:()=>n(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>n(e,{checkDesktop:!1}),readBundledVersion:()=>o(),readRecordedVersion:e=>t(e,`cli-hosts`),writeRecordedVersion:(e,t)=>c(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>a(e),readBundleDecision:(e,t)=>l(e,t),writeBundleDecision:(e,t,n)=>s(e,t,n),removeBundleFromDisk:(e,t)=>h(e,t)};function F(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function I(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(b(t),{recursive:!0}),L(e,t,n)}function L(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=x(e,r),a=x(t,r);n.isDirectory(i)?L(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function R(e,t,n,r,i,a){let o=[],s=x(e,`.agents`,`skills`,t),c=r.existsSync(s),l=!1;try{I(n,s,r),l=!0,o.push({kind:`central`,path:s,outcome:c?`overwritten`:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:c,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of p){let l=x(e,c.hostDir),u=x(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}let d=r.existsSync(u);try{I(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:d?`overwritten`:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:d,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:l}}function z(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function B(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of p){let o=x(e,t.hostDir,`skills`,`open-knowledge`),s=x(o,`SKILL.md`),c=n.existsSync(s),l=f[t.editorId]?.projectConfigPath?.(e),u=!c&&z(l,n);if(!c&&!u){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{g(o,e),I(i,o,n);let s=c?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:c?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function V(t,n,a,o){let s=e=>{n.recordEvent(e).catch(()=>{})},c=()=>new Date().toISOString(),l;try{l=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await n.readRecordedVersion(t)}catch(e){o({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of r)try{d.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return o({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let r of d){let s=i[r.id],c=a.existsSync(x(t,`.agents`,`skills`,s)),l=await n.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{n.removeBundleFromDisk(t,r.id),o({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:r.id})}catch(e){o({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:r.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await n.writeBundleDecision(t,s,!0)}catch(e){o({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:r.id,error:e instanceof Error?e.message:String(e)})}p.push(r)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>a.existsSync(x(t,`.agents`,`skills`,i[e.id])));if(u!==null&&u===l&&m)return o({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===r.length,_=!0;for(let{id:e,sourceDir:n}of p){let r=R(t,i[e],n,a,o,l);h.push(...r.entries),r.centralWritten||(_=!1)}let v=h.some(e=>e.kind===`central`&&(e.outcome===`written`||e.outcome===`overwritten`));if(g&&_&&v){let e=null;try{await n.writeRecordedVersion(t,l),o({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),o({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t}of p)s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?`installed`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:l,entries:h}}async function H(e){let t=e.logger??F,n=e.fs??N,r=e.home??j(),i={...P,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=B(e.projectDir,i,n,t),o=await V(r,i,n,t),s=m(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=d(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function U(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function W(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
1
+ import{w as e}from"./src-DmtkLnli.mjs";import{ar as t,dr as n,gr as r,hr as i,lr as a,nr as o,or as s,sr as c,tr as l}from"./src-T1lGYBC1.mjs";import{C as u,a as d,d as f,f as p,o as m,s as h,t as g}from"./write-project-skill-BzhJIXSv.mjs";import{n as _,s as v,t as y}from"./colors-BsmVIwfM.mjs";import{dirname as b,join as x,relative as S,resolve as C}from"node:path";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,statSync as k,writeFileSync as A}from"node:fs";import{homedir as j}from"node:os";import{createInterface as M}from"node:readline/promises";const N={existsSync:e=>w(e),isDirectory:e=>{try{return k(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>D(e),readFileSync:e=>E(e),writeFileSync:(e,t)=>{A(e,t)},mkdirSync:(e,t)=>{T(e,t)},rmSync:(e,t)=>{O(e,t)}},P={resolveProjectBundledSkillDir:()=>n(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>n(e,{checkDesktop:!1}),readBundledVersion:()=>o(),readRecordedVersion:e=>t(e,`cli-hosts`),writeRecordedVersion:(e,t)=>c(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>a(e),readBundleDecision:(e,t)=>l(e,t),writeBundleDecision:(e,t,n)=>s(e,t,n),removeBundleFromDisk:(e,t)=>h(e,t)};function F(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function I(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(b(t),{recursive:!0}),L(e,t,n)}function L(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=x(e,r),a=x(t,r);n.isDirectory(i)?L(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function R(e,t,n,r,i,a){let o=[],s=x(e,`.agents`,`skills`,t),c=r.existsSync(s),l=!1;try{I(n,s,r),l=!0,o.push({kind:`central`,path:s,outcome:c?`overwritten`:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:c,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of p){let l=x(e,c.hostDir),u=x(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}let d=r.existsSync(u);try{I(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:d?`overwritten`:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:d,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:l}}function z(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function B(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of p){let o=x(e,t.hostDir,`skills`,`open-knowledge`),s=x(o,`SKILL.md`),c=n.existsSync(s),l=f[t.editorId]?.projectConfigPath?.(e),u=!c&&z(l,n);if(!c&&!u){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{g(o,e),I(i,o,n);let s=c?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:c?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function V(t,n,a,o){let s=e=>{n.recordEvent(e).catch(()=>{})},c=()=>new Date().toISOString(),l;try{l=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await n.readRecordedVersion(t)}catch(e){o({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of r)try{d.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return o({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let r of d){let s=i[r.id],c=a.existsSync(x(t,`.agents`,`skills`,s)),l=await n.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{n.removeBundleFromDisk(t,r.id),o({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:r.id})}catch(e){o({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:r.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await n.writeBundleDecision(t,s,!0)}catch(e){o({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:r.id,error:e instanceof Error?e.message:String(e)})}p.push(r)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>a.existsSync(x(t,`.agents`,`skills`,i[e.id])));if(u!==null&&u===l&&m)return o({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===r.length,_=!0;for(let{id:e,sourceDir:n}of p){let r=R(t,i[e],n,a,o,l);h.push(...r.entries),r.centralWritten||(_=!1)}let v=h.some(e=>e.kind===`central`&&(e.outcome===`written`||e.outcome===`overwritten`));if(g&&_&&v){let e=null;try{await n.writeRecordedVersion(t,l),o({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),o({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t}of p)s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?`installed`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:l,entries:h}}async function H(e){let t=e.logger??F,n=e.fs??N,r=e.home??j(),i={...P,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=B(e.projectDir,i,n,t),o=await V(r,i,n,t),s=m(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=d(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function U(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function W(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
2
2
  `)}function G(){return new u(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").option(`-y, --yes`,`Skip the confirmation prompt for removing directories left by a pre-0.42 install.`).action(async e=>{let t=await H({projectDir:C(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>K(t,{yes:e.yes===!0})});process.stdout.write(`${W(t)}\n`),process.exitCode=U(t)})}async function K(e,t){let n=j(),r=e=>`~/${S(n,e)}`,i=t.input??process.stdin,a=[``,y(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),_(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${y(`Remove OpenKnowledge skills:`)} ${e.skillDirs.length}`,...e.skillDirs.map(e=>` ${r(e)}`)),e.emptyDirs.length>0){let t=e.skillDirs.length>0?`Then remove these, which hold nothing else once the above are gone:`:`Remove these empty directories, left behind by that install:`;a.push(``,`${y(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,_(`Nothing outside these paths is touched. A directory that still holds anything is kept.`)),process.stdout.write(`${a.join(`
3
3
  `)}\n`),t.yes)return!0;if(!i.isTTY)return process.stdout.write(`${v("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=M({input:i,output:process.stdout});try{let e=(await o.question(`\n${y(`Remove them?`)} ${_(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{G as n,H as t};
4
- //# sourceMappingURL=repair-skills-CH8FwF78.mjs.map
4
+ //# sourceMappingURL=repair-skills-BHY_AeM4.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./repair-skills-BHY_AeM4.mjs";export{e as repairSkills};
@@ -0,0 +1 @@
1
+ import{a as e,o as t,r as n}from"./server-lock-D7crxuP7.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
@@ -1,2 +1,2 @@
1
- import"./src-2StQCkyf.mjs";import{r as e}from"./logger-B7Z8XO-z.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s,readFileSync as c,unlinkSync as l,writeFileSync as u,writeSync as d}from"node:fs";import{homedir as f,hostname as p}from"node:os";import{fileURLToPath as m}from"node:url";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function v(e){return new URL(e.url??``,`http://localhost`).searchParams}function y(e){let t=e?.code;return typeof t==`string`?t:void 0}const b=/^[A-Za-z0-9-]{8,64}$/;let x=null;function S(e){return n(e??f(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=c(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{o(t(r),{recursive:!0}),u(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(x=i),i}function w(){try{let e=r(t(m(import.meta.url)),`..`,`package.json`),n=JSON.parse(c(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===C():e.hostname===p()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(c(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==C()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==p())continue;l(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(c(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,c=`[${t}-lock]`;o(n,{recursive:!0});let f=k(n,t),m={pid:process.pid,hostname:p(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:C(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!a(f))try{let e=s(f,`wx`,384);try{d(e,h)}finally{i(e)}return j(f),I(f),z({lockName:t,lockDir:n,lockPath:f})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(f,c);if(e){if(N(e)&&e.pid===process.pid)return u(f,h,{encoding:`utf-8`,mode:384}),j(f),I(f),z({lockName:t,lockDir:n,lockPath:f});if(g(e.pid))throw new O(e,f,t);D.warn({pid:e.pid,host:e.hostname},`${c} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{l(f)}catch{}}throw Error(`${c} Failed to acquire ${f} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,o=k(n,t);if(!a(o)){D.warn({lockPath:o},`${i} Lock file missing at ${o} during port update — skipping`);return}let s;try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:o},`${i} Corrupt lock at ${o} during port update — skipping`);return}s=e}catch{D.warn({lockPath:o},`${i} Unreadable lock at ${o} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{u(o,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(c(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){y(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{u(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return null;let i;try{let e=JSON.parse(c(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!g(i.pid)){try{l(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return{status:`absent`};let i;try{i=JSON.parse(c(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o=i;if(!_(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{l(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,o=k(n,t);if(M(o)){if(r){V({lockName:t,lockDir:n});return}if(a(o))try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;l(o),P.delete(o)}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{_ as S,E as _,X as a,v as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,C as v,g as x,y};
2
- //# sourceMappingURL=server-lock-D6rSSnhg.mjs.map
1
+ import"./src-DmtkLnli.mjs";import{r as e}from"./logger-B7Z8XO-z.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s,readFileSync as c,unlinkSync as l,writeFileSync as u,writeSync as d}from"node:fs";import{homedir as f,hostname as p}from"node:os";import{fileURLToPath as m}from"node:url";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function v(e){return new URL(e.url??``,`http://localhost`).searchParams}function y(e){let t=e?.code;return typeof t==`string`?t:void 0}const b=/^[A-Za-z0-9-]{8,64}$/;let x=null;function S(e){return n(e??f(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=c(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{o(t(r),{recursive:!0}),u(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(x=i),i}function w(){try{let e=r(t(m(import.meta.url)),`..`,`package.json`),n=JSON.parse(c(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===C():e.hostname===p()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(c(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==C()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==p())continue;l(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(c(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,c=`[${t}-lock]`;o(n,{recursive:!0});let f=k(n,t),m={pid:process.pid,hostname:p(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:C(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!a(f))try{let e=s(f,`wx`,384);try{d(e,h)}finally{i(e)}return j(f),I(f),z({lockName:t,lockDir:n,lockPath:f})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(f,c);if(e){if(N(e)&&e.pid===process.pid)return u(f,h,{encoding:`utf-8`,mode:384}),j(f),I(f),z({lockName:t,lockDir:n,lockPath:f});if(g(e.pid))throw new O(e,f,t);D.warn({pid:e.pid,host:e.hostname},`${c} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{l(f)}catch{}}throw Error(`${c} Failed to acquire ${f} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,o=k(n,t);if(!a(o)){D.warn({lockPath:o},`${i} Lock file missing at ${o} during port update — skipping`);return}let s;try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:o},`${i} Corrupt lock at ${o} during port update — skipping`);return}s=e}catch{D.warn({lockPath:o},`${i} Unreadable lock at ${o} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{u(o,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(c(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){y(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{u(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return null;let i;try{let e=JSON.parse(c(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!g(i.pid)){try{l(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return{status:`absent`};let i;try{i=JSON.parse(c(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o=i;if(!_(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{l(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,o=k(n,t);if(M(o)){if(r){V({lockName:t,lockDir:n});return}if(a(o))try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;l(o),P.delete(o)}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{_ as S,E as _,X as a,v as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,C as v,g as x,y};
2
+ //# sourceMappingURL=server-lock-D7crxuP7.mjs.map
@@ -1 +1 @@
1
- import{Ga as e,Ka as t,No as n,Wa as r,b as i,co as a,d as o,l as s,oo as c,vo as l,w as u}from"./src-2StQCkyf.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,At as y,B as b,Bi as x,Bn as S,Br as C,Bt as w,C as T,Ci as E,Cn as D,Cr as O,Ct as k,D as A,Di as j,Dn as M,Dr as N,Dt as P,E as F,Ei as I,En as L,Er as R,Et as z,F as B,Fi as V,Fn as H,Fr as U,Ft as W,G,Gi as K,Gn as q,Gr as J,Gt as Y,H as X,Hi as Z,Hn as Q,Hr as $,Ht as ee,I as te,Ii as ne,In as re,Ir as ie,It as ae,J as oe,Ji as se,Jn as ce,Jr as le,Jt as ue,K as de,Ki as fe,Kn as pe,Kr as me,Kt as he,L as ge,Li as _e,Ln as ve,Lr as ye,Lt as be,M as xe,Mi as Se,Mn as Ce,Mt as we,N as Te,Ni as Ee,Nn as De,Nr as Oe,Nt as ke,O as Ae,Oi as je,On as Me,Ot as Ne,P as Pe,Pi as Fe,Pn as Ie,Pr as Le,Pt as Re,Q as ze,Qi as Be,Qn as Ve,Qr as He,Qt as Ue,R as We,Ri as Ge,Rn as Ke,Rr as qe,Rt as Je,S as Ye,Si as Xe,Sn as Ze,Sr as Qe,St as $e,T as et,Ti as tt,Tn as nt,Tr as rt,Tt as it,U as at,Ui as ot,Un as st,Ur as ct,Ut as lt,V as ut,Vi as dt,Vn as ft,Vr as pt,Vt as mt,W as ht,Wi as gt,Wn as _t,Wr as vt,Wt as yt,X as bt,Xi as xt,Xn as St,Xr as Ct,Xt as wt,Y as Tt,Yi as Et,Yn as Dt,Yr as Ot,Yt as kt,Z as At,Zi as jt,Zn as Mt,Zr as Nt,Zt as Pt,_ as Ft,_a as It,_i as Lt,_n as Rt,_r as zt,_t as Bt,a as Vt,aa as Ht,ai as Ut,an as Wt,ar as Gt,at as Kt,b as qt,ba as Jt,bi as Yt,bn as Xt,br as Zt,bt as Qt,c as $t,ca as en,ci as tn,cn as nn,cr as rn,ct as an,d as on,da as sn,di as cn,dn as ln,dr as un,ea as dn,ei as fn,en as pn,er as mn,et as hn,f as gn,fa as _n,fi as vn,fn as yn,fr as bn,g as xn,ga as Sn,gi as Cn,gn as wn,gr as Tn,gt as En,h as Dn,ha as On,hi as kn,hn as An,hr as jn,ht as Mn,i as Nn,ia as Pn,ii as Fn,in as In,ir as Ln,it as Rn,j as zn,ji as Bn,jn as Vn,jt as Hn,k as Un,ki as Wn,kn as Gn,kt as Kn,l as qn,la as Jn,li as Yn,ln as Xn,lr as Zn,m as Qn,ma as $n,mi as er,mn as tr,mr as nr,n as rr,na as ir,ni as ar,nn as or,nr as sr,nt as cr,o as lr,oa as ur,oi as dr,on as fr,or as pr,ot as mr,p as hr,pa as gr,pi as _r,pn as vr,pr as yr,q as br,qi as xr,qn as Sr,qr as Cr,qt as wr,r as Tr,ra as Er,ri as Dr,rn as Or,rr as kr,rt as Ar,s as jr,sa as Mr,si as Nr,sn as Pr,sr as Fr,st as Ir,t as Lr,ta as Rr,ti as zr,tn as Br,tr as Vr,tt as Hr,u as Ur,ua as Wr,ui as Gr,un as Kr,ur as qr,v as Jr,va as Yr,vi as Xr,vn as Zr,vr as Qr,vt as $r,w as ei,wi as ti,wn as ni,wr as ri,wt as ii,x as ai,xi as oi,xn as si,xr as ci,xt as li,y as ui,ya as di,yi as fi,yn as pi,yr as mi,yt as hi,z as gi,zi as _i,zn as vi,zr as yi,zt as bi}from"./src-DV_Dbu6a.mjs";import{C as xi,E as Si,T as Ci,_ as wi,b as Ti,c as Ei,d as Di,g as Oi,i as ki,l as Ai,m as ji,n as Mi,p as Ni,s as Pi,t as Fi,u as Ii,v as Li,w as Ri,x as zi,y as Bi}from"./fs-traced-B-x7hAhD.mjs";import{a as Vi,d as Hi,f as Ui,i as Wi,l as Gi,n as Ki,r as qi,t as Ji,u as Yi}from"./logger-B7Z8XO-z.mjs";import{S as Xi,_ as Zi,a as Qi,c as $i,f as ea,g as ta,h as na,i as ra,l as ia,m as aa,n as oa,o as sa,p as ca,r as la,s as ua,t as da,u as fa,v as pa,x as ma}from"./server-lock-D6rSSnhg.mjs";export{sn as AGENT_ID_MAX_LEN,_n as AGENT_ID_RE,j as AGENT_WRITE_ORIGIN,Yr as AcpPermissionStore,On as AcpRegistry,ti as AcpThreadManager,Xe as AgentFocusBroadcaster,oi as AgentPresenceBroadcaster,je as AgentSessionCapacityError,Wn as AgentSessionManager,En as AutoStartDisabledError,yr as BUNDLE_IDS,nr as BUNDLE_SCOPE,jn as BUNDLE_SKILL_NAME,Ce as BacklinkIndex,_i as CC1Broadcaster,a as CC1_CONTRACT_VERSION,or as CONFIG_FILENAME,L as CONFLICT_MARKER_RE,ye as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ft as ConfigSchema,K as DEFAULT_CHECKPOINT_RETENTION,m as DEFAULT_EMBEDDINGS_DIMENSIONS,W as DEFAULT_PACK_ID,ut as DocumentDurabilityState,fn as EMBEDDINGS_API_KEY_ENV,Sn as FEATURED_AGENT_IDS,fe as FILE_SYSTEM_WRITER,v as FILE_WATCHER_ORIGIN,Cr as FileEmbeddingsBackend,Pt as GIT_PREFLIGHT_FAIL_SPAN_NAME,xr as GIT_UPSTREAM_WRITER,di as GitDirAccessError,vi as GitNotAvailableError,S as GitTooOldError,Bt as HOCUSPOCUS_AUTH_REJECTION_REASONS,$r as HocuspocusAuthRejection,hi as HocuspocusAuthTokenSchema,ct as INSTALLED_AGENTS_SCHEMES,c as LINEAGE_EPOCH_KEY,We as LIVE_DERIVED_INDEX_DEBOUNCE_MS,ae as LOG_MD_TEMPLATE,it as MANAGED_RENAME_ORIGIN,tt as MAX_ACP_THREADS,_ as MAX_AGENT_SESSIONS,Ir as MCP_CONNECTION_ID_HEADER,r as MCP_SERVER_NAME,Bn as MIN_EVICTABLE_IDLE_MS,ft as MIN_GIT_VERSION,X as MISSING_OK_CONFIG_MESSAGE,Jt as MalformedGitPointerError,d as McpLogger,at as MissingOkConfigError,Ee as OBSERVER_SYNC_ORIGIN,Or as OK_OKIGNORE_TEMPLATE,e as ORPHAN_MODES,n as PROTOCOL_VERSION,Ji as PinoLogger,$i as ProcessLockCollisionError,qn as ProjectGitInitError,z as ROLLBACK_ORIGIN,In as ROOT_GITIGNORE_TEMPLATE,ta as RUNTIME_VERSION,kn as RemoteConfigError,se as SERVICE_WRITER,rn as SKILL_INSTALL_EVENTS_FILE_REL,i as SKILL_STATE_TARGETS,be as STARTER_FOLDERS,Je as STARTER_FOLDER_FRONTMATTER_FILENAME,bi as STARTER_PACKS,w as STARTER_PACK_IDS,mt as STARTER_TEMPLATES,et as STATE_MANIFEST_FILENAME,Zi as STATE_SCHEMA_VERSION,l as SYSTEM_DOC_NAME,wr as SeedPrerequisiteError,ue as SeedRootDirError,da as ServerLockCollisionError,Lr as SingleFileNotAFileError,rr as SingleFileNotFoundError,Tr as SingleFileNotMarkdownError,F as StateManifestError,Vn as TagIndex,Tn as USER_GLOBAL_BUNDLE_IDS,Ie as UiLockCollisionError,P as __getShowAllWalkStatsForTesting,Ne as __resetShowAllWalkStatsForTesting,ia as acquireProcessLock,oa as acquireServerLock,H as acquireUiLock,Se as applyAgentMarkdownWrite,ni as applyExternalChange,Re as applySeed,A as assertCompatibleStateManifest,Q as assertGitAvailable,yn as assertNeverDiskEvent,E as attachAcpThreadSocket,Mn as attachIdleShutdown,Jr as bootServer,Mt as buildAndOpenSkill,Wt as buildConfigYmlContent,oe as buildExecResult,I as buildOkMcpStdioCommand,qr as buildSkillZip,ee as buildStarterFolderFrontmatterYaml,Et as buildWipTree,zt as bundleSkillMdPath,le as canonicalProjectKey,vr as classifyEvents,Fi as classifyFsPath,Ot as clearAllEmbeddingsKeys,ar as clearContributors,lt as coercePackId,s as colorFromSeed,xt as commitUpstreamImport,jt as commitWip,Be as commitWipFromTree,st as compareSemver,Zt as composeEffectiveLinterConfig,ci as composeFrontmatterSchemasConfig,M as containsConflictMarkers,tr as contentHash,Dr as contributorCount,Pe as countShadowObjects,B as countStaleAgentWipRefs,te as countWipRefs,Kn as createApiExtension,vn as createAssetServeMiddleware,Oe as createContentFilter,Le as createContentFilterAsync,Ct as createEmbeddingsSecretStore,Nn as createEphemeralProjectDir,nt as createExternalChangeHandler,gn as createFileLogger,gi as createLiveDerivedIndexExtension,de as createMcpHttpHandler,vt as createOsProbe,Te as createPersistenceExtension,T as createServer,zn as createServerObserverExtension,ne as createStreamingErrorWriter,Ki as createTestLogger,Nt as describeStoredEmbeddingsKey,xn as detectClaudeDesktopPresence,_t as detectGit,Ae as detectProjectShape,Ve as detectUserSkillHosts,cr as discoverLockDirs,ri as discoverMarkdownlintConfig,Ue as emitPreflightFailureSpan,Tt as encodeDocName,bt as encodeFolderRoute,At as encodeSkillRoute,Ur as ensureProjectGit,fr as ensureProjectSkillGitignore,_e as errorResponse,An as evictStaleTrackerEntries,y as extractHeadings,Ar as extractOkBinaryPath,De as extractWikiLinksFromMarkdown,q as fallbackPaths,on as findEnclosingGitRoot,Kr as findEnclosingProjectRoot,rt as findNativeMarkdownlintFile,hr as flushFileLogger,Qt as formatAuthRejectionWire,Fn as formatContributors,Ut as formatContributorsFrom,we as formatPackRationale,f as gcCheckpointRefs,hn as getCurrentMcpLogger,Yn as getLocalDir,Qn as getLogFilePath,qi as getLogger,Dn as getLogsDir,pa as getMachineId,Bi as getMeter,ur as getMetrics,Ti as getTracer,Mr as handleCollabSocketError,qe as handleSpawnCursor,Cn as hasForwardingHeaders,ge as hasGcLogLatch,o as iconFromClientName,en as incrementCollabSocketFilteredError,Jn as incrementServerObserverFire,Pr as initContent,dn as initShadowRepo,zi as initTelemetry,qt as initToleranceTelemetryWriter,mr as installPrettyZodErrors,Wi as installTestLoggers,p as installUserSkill,er as isAllowedApiOrigin,fi as isAllowedWorkspaceHostHeader,x as isConfigDoc,li as isHocuspocusAuthRejectionReason,yt as isKnownPackId,dt as isLinkIndexExcludedDoc,Yt as isLoopbackAddress,Z as isManagedArtifactDoc,t as isOrphanMode,Fe as isPairedWriteOrigin,yi as isPathWithinDir,ma as isProcessAlive,ln as isProjectRoot,Sr as isProjectSkillManaged,Lt as isRemoteAdmitted,ot as isReservedForUserTree,wn as isSelfWrite,gt as isSystemDoc,ai as isToleranceTelemetryEnabled,Xi as isValidLockPid,Rt as lastKnownHash,Rr as listRescueCheckpoints,Y as listStarterPacks,It as loadCustomAgents,xe as loadPrincipal,fa as lockFilePath,Vi as loggerFactory,Gi as logsCurrentPath,Yi as logsPreviousPath,He as makeLazyEmbeddingsKeyStore,la as markServerLockDraining,ht as mountMcpAndApi,Mi as normalizeFsPath,Qr as originGitHubHost,nn as packageVersionMajorMinor,$e as parseAuthRejectionWire,pe as parseGitVersion,k as parseHocuspocusAuthToken,G as parseKeepaliveConnectionId,Zr as pathToDocName,ke as planSeed,Vt as prepareSingleFileOpen,Rn as processCommand,Kt as processUsage,mn as readAllTargets,Vr as readBundleDecision,R as readOwnNativeRules,ea as readProcessLock,ca as readProcessLockDetailed,b as readProjectHeadState,me as readProjectLocalSemanticConfig,ra as readServerLock,sr as readServerPackageVersion,kr as readSkillInstallStateSnapshot,ce as readSkillManagement,Un as readStateManifest,Ln as readTargetRecordedAt,Gt as readTargetVersion,re as readUiLock,Me as reconcile,dr as recordContributor,Zn as recordSkillInstallEvent,br as registerAllTools,pi as registerWrite,aa as releaseProcessLock,Qi as releaseServerLock,ve as releaseUiLock,Xt as removeLastKnownHash,Wr as resetMetrics,u as resolveBundleEnabled,un as resolveBundledSkillDir,Gr as resolveContentDir,C as resolveCursorBinaryDefault,pt as resolveCursorSpawnInvocation,Qe as resolveEffectiveLinterConfig,zr as resolveEmbeddingsCredential,cn as resolveLockDir,O as resolveNativeConfigForDoc,N as resolveNativeMarkdownlintConfig,he as resolvePack,jr as resolvePackageVersion,Xr as resolveRemoteAccess,ze as resolveUiInfo,Nr as restoreContributors,ui as restoreLifecycleFromConflictsJson,U as rewriteMarkdownLinksForDocumentRename,ie as rewriteWikiLinksForDocumentRename,h as runAuthReposSubprocess,pn as runAuthStatusSubprocess,kt as runCloneSubprocess,Br as runDeviceFlowSubprocess,Hr as runWithMcpLogger,_r as safeContentPath,Hn as safeSubdir,ir as safetyCheckpoint,an as sanitizeClientName,Er as saveInMemoryCheckpoint,Pn as saveVersion,ii as seedBasenameIndex,lr as serializeError,xi as setActiveSpanAttributes,V as setupServerObservers,Ht as shadowGit,Ri as shutdownTelemetry,Dt as skillManagementPath,Hi as spansCurrentPath,Ui as spansPreviousPath,$ as spawnDetached,Gn as splitMarkdownBlocks,si as startWatcher,Ge as streamingProblemEvent,tn as swapContributors,Ye as teardownToleranceTelemetryWriter,gr as toBroadcasterKey,ki as tracedAppendFileSync,Pi as tracedLinkSync,Ei as tracedMkdir,Ai as tracedMkdirSync,Ii as tracedRename,Di as tracedRenameSync,Ni as tracedRmSync,ji as tracedRmdirSync,Oi as tracedUnlinkSync,wi as tracedWriteFile,Li as tracedWriteFileSync,ei as trustSystemCertificates,$t as untrackTrackedProjectSkillProjection,Ze as updateLastKnownHash,na as updateProcessLockPort,sa as updateServerLockPort,Ke as updateUiLockPort,$n as validateAgentId,wt as validateCloneInputs,bn as validateSkillZip,ua as waitForServerLockDrain,J as withHiddenWindowsConsole,Ci as withSpan,Si as withSpanSync,pr as writeBundleDecision,mi as writeMarkdownlintRule,Xn as writeRootGitignoreForNewRepo,St as writeSkillManagement,g as writeStateManifest,Fr as writeTargetVersion,D as writeTracker};
1
+ import{Fo as e,Ja as t,Ka as n,b as r,bo as i,co as a,d as o,l as s,qa as c,uo as l,w as u}from"./src-DmtkLnli.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,At as y,B as b,Bi as x,Bn as S,Br as C,Bt as w,C as T,Ci as E,Cn as D,Cr as O,Ct as k,D as A,Di as j,Dn as M,Dr as N,Dt as P,E as F,Ei as I,En as L,Er as R,Et as z,F as B,Fi as V,Fn as H,Fr as U,Ft as W,G,Gi as K,Gn as q,Gr as J,Gt as Y,H as X,Hi as Z,Hn as Q,Hr as $,Ht as ee,I as te,Ii as ne,In as re,Ir as ie,It as ae,J as oe,Ji as se,Jn as ce,Jr as le,Jt as ue,K as de,Ki as fe,Kn as pe,Kr as me,Kt as he,L as ge,Li as _e,Ln as ve,Lr as ye,Lt as be,M as xe,Mi as Se,Mn as Ce,Mt as we,N as Te,Ni as Ee,Nn as De,Nr as Oe,Nt as ke,O as Ae,Oi as je,On as Me,Ot as Ne,P as Pe,Pi as Fe,Pn as Ie,Pr as Le,Pt as Re,Q as ze,Qi as Be,Qn as Ve,Qr as He,Qt as Ue,R as We,Ri as Ge,Rn as Ke,Rr as qe,Rt as Je,S as Ye,Si as Xe,Sn as Ze,Sr as Qe,St as $e,T as et,Ti as tt,Tn as nt,Tr as rt,Tt as it,U as at,Ui as ot,Un as st,Ur as ct,Ut as lt,V as ut,Vi as dt,Vn as ft,Vr as pt,Vt as mt,W as ht,Wi as gt,Wn as _t,Wr as vt,Wt as yt,X as bt,Xi as xt,Xn as St,Xr as Ct,Xt as wt,Y as Tt,Yi as Et,Yn as Dt,Yr as Ot,Yt as kt,Z as At,Zi as jt,Zn as Mt,Zr as Nt,Zt as Pt,_ as Ft,_a as It,_i as Lt,_n as Rt,_r as zt,_t as Bt,a as Vt,aa as Ht,ai as Ut,an as Wt,ar as Gt,at as Kt,b as qt,ba as Jt,bi as Yt,bn as Xt,br as Zt,bt as Qt,c as $t,ca as en,ci as tn,cn as nn,cr as rn,ct as an,d as on,da as sn,di as cn,dn as ln,dr as un,ea as dn,ei as fn,en as pn,er as mn,et as hn,f as gn,fa as _n,fi as vn,fn as yn,fr as bn,g as xn,ga as Sn,gi as Cn,gn as wn,gr as Tn,gt as En,h as Dn,ha as On,hi as kn,hn as An,hr as jn,ht as Mn,i as Nn,ia as Pn,ii as Fn,in as In,ir as Ln,it as Rn,j as zn,ji as Bn,jn as Vn,jt as Hn,k as Un,ki as Wn,kn as Gn,kt as Kn,l as qn,la as Jn,li as Yn,ln as Xn,lr as Zn,m as Qn,ma as $n,mi as er,mn as tr,mr as nr,n as rr,na as ir,ni as ar,nn as or,nr as sr,nt as cr,o as lr,oa as ur,oi as dr,on as fr,or as pr,ot as mr,p as hr,pa as gr,pi as _r,pn as vr,pr as yr,q as br,qi as xr,qn as Sr,qr as Cr,qt as wr,r as Tr,ra as Er,ri as Dr,rn as Or,rr as kr,rt as Ar,s as jr,sa as Mr,si as Nr,sn as Pr,sr as Fr,st as Ir,t as Lr,ta as Rr,ti as zr,tn as Br,tr as Vr,tt as Hr,u as Ur,ua as Wr,ui as Gr,un as Kr,ur as qr,v as Jr,va as Yr,vi as Xr,vn as Zr,vr as Qr,vt as $r,w as ei,wi as ti,wn as ni,wr as ri,wt as ii,x as ai,xi as oi,xn as si,xr as ci,xt as li,y as ui,ya as di,yi as fi,yn as pi,yr as mi,yt as hi,z as gi,zi as _i,zn as vi,zr as yi,zt as bi}from"./src-T1lGYBC1.mjs";import{C as xi,E as Si,T as Ci,_ as wi,b as Ti,c as Ei,d as Di,g as Oi,i as ki,l as Ai,m as ji,n as Mi,p as Ni,s as Pi,t as Fi,u as Ii,v as Li,w as Ri,x as zi,y as Bi}from"./fs-traced-B-x7hAhD.mjs";import{a as Vi,d as Hi,f as Ui,i as Wi,l as Gi,n as Ki,r as qi,t as Ji,u as Yi}from"./logger-B7Z8XO-z.mjs";import{S as Xi,_ as Zi,a as Qi,c as $i,f as ea,g as ta,h as na,i as ra,l as ia,m as aa,n as oa,o as sa,p as ca,r as la,s as ua,t as da,u as fa,v as pa,x as ma}from"./server-lock-D7crxuP7.mjs";export{sn as AGENT_ID_MAX_LEN,_n as AGENT_ID_RE,j as AGENT_WRITE_ORIGIN,Yr as AcpPermissionStore,On as AcpRegistry,ti as AcpThreadManager,Xe as AgentFocusBroadcaster,oi as AgentPresenceBroadcaster,je as AgentSessionCapacityError,Wn as AgentSessionManager,En as AutoStartDisabledError,yr as BUNDLE_IDS,nr as BUNDLE_SCOPE,jn as BUNDLE_SKILL_NAME,Ce as BacklinkIndex,_i as CC1Broadcaster,l as CC1_CONTRACT_VERSION,or as CONFIG_FILENAME,L as CONFLICT_MARKER_RE,ye as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ft as ConfigSchema,K as DEFAULT_CHECKPOINT_RETENTION,m as DEFAULT_EMBEDDINGS_DIMENSIONS,W as DEFAULT_PACK_ID,ut as DocumentDurabilityState,fn as EMBEDDINGS_API_KEY_ENV,Sn as FEATURED_AGENT_IDS,fe as FILE_SYSTEM_WRITER,v as FILE_WATCHER_ORIGIN,Cr as FileEmbeddingsBackend,Pt as GIT_PREFLIGHT_FAIL_SPAN_NAME,xr as GIT_UPSTREAM_WRITER,di as GitDirAccessError,vi as GitNotAvailableError,S as GitTooOldError,Bt as HOCUSPOCUS_AUTH_REJECTION_REASONS,$r as HocuspocusAuthRejection,hi as HocuspocusAuthTokenSchema,ct as INSTALLED_AGENTS_SCHEMES,a as LINEAGE_EPOCH_KEY,We as LIVE_DERIVED_INDEX_DEBOUNCE_MS,ae as LOG_MD_TEMPLATE,it as MANAGED_RENAME_ORIGIN,tt as MAX_ACP_THREADS,_ as MAX_AGENT_SESSIONS,Ir as MCP_CONNECTION_ID_HEADER,n as MCP_SERVER_NAME,Bn as MIN_EVICTABLE_IDLE_MS,ft as MIN_GIT_VERSION,X as MISSING_OK_CONFIG_MESSAGE,Jt as MalformedGitPointerError,d as McpLogger,at as MissingOkConfigError,Ee as OBSERVER_SYNC_ORIGIN,Or as OK_OKIGNORE_TEMPLATE,c as ORPHAN_MODES,e as PROTOCOL_VERSION,Ji as PinoLogger,$i as ProcessLockCollisionError,qn as ProjectGitInitError,z as ROLLBACK_ORIGIN,In as ROOT_GITIGNORE_TEMPLATE,ta as RUNTIME_VERSION,kn as RemoteConfigError,se as SERVICE_WRITER,rn as SKILL_INSTALL_EVENTS_FILE_REL,r as SKILL_STATE_TARGETS,be as STARTER_FOLDERS,Je as STARTER_FOLDER_FRONTMATTER_FILENAME,bi as STARTER_PACKS,w as STARTER_PACK_IDS,mt as STARTER_TEMPLATES,et as STATE_MANIFEST_FILENAME,Zi as STATE_SCHEMA_VERSION,i as SYSTEM_DOC_NAME,wr as SeedPrerequisiteError,ue as SeedRootDirError,da as ServerLockCollisionError,Lr as SingleFileNotAFileError,rr as SingleFileNotFoundError,Tr as SingleFileNotMarkdownError,F as StateManifestError,Vn as TagIndex,Tn as USER_GLOBAL_BUNDLE_IDS,Ie as UiLockCollisionError,P as __getShowAllWalkStatsForTesting,Ne as __resetShowAllWalkStatsForTesting,ia as acquireProcessLock,oa as acquireServerLock,H as acquireUiLock,Se as applyAgentMarkdownWrite,ni as applyExternalChange,Re as applySeed,A as assertCompatibleStateManifest,Q as assertGitAvailable,yn as assertNeverDiskEvent,E as attachAcpThreadSocket,Mn as attachIdleShutdown,Jr as bootServer,Mt as buildAndOpenSkill,Wt as buildConfigYmlContent,oe as buildExecResult,I as buildOkMcpStdioCommand,qr as buildSkillZip,ee as buildStarterFolderFrontmatterYaml,Et as buildWipTree,zt as bundleSkillMdPath,le as canonicalProjectKey,vr as classifyEvents,Fi as classifyFsPath,Ot as clearAllEmbeddingsKeys,ar as clearContributors,lt as coercePackId,s as colorFromSeed,xt as commitUpstreamImport,jt as commitWip,Be as commitWipFromTree,st as compareSemver,Zt as composeEffectiveLinterConfig,ci as composeFrontmatterSchemasConfig,M as containsConflictMarkers,tr as contentHash,Dr as contributorCount,Pe as countShadowObjects,B as countStaleAgentWipRefs,te as countWipRefs,Kn as createApiExtension,vn as createAssetServeMiddleware,Oe as createContentFilter,Le as createContentFilterAsync,Ct as createEmbeddingsSecretStore,Nn as createEphemeralProjectDir,nt as createExternalChangeHandler,gn as createFileLogger,gi as createLiveDerivedIndexExtension,de as createMcpHttpHandler,vt as createOsProbe,Te as createPersistenceExtension,T as createServer,zn as createServerObserverExtension,ne as createStreamingErrorWriter,Ki as createTestLogger,Nt as describeStoredEmbeddingsKey,xn as detectClaudeDesktopPresence,_t as detectGit,Ae as detectProjectShape,Ve as detectUserSkillHosts,cr as discoverLockDirs,ri as discoverMarkdownlintConfig,Ue as emitPreflightFailureSpan,Tt as encodeDocName,bt as encodeFolderRoute,At as encodeSkillRoute,Ur as ensureProjectGit,fr as ensureProjectSkillGitignore,_e as errorResponse,An as evictStaleTrackerEntries,y as extractHeadings,Ar as extractOkBinaryPath,De as extractWikiLinksFromMarkdown,q as fallbackPaths,on as findEnclosingGitRoot,Kr as findEnclosingProjectRoot,rt as findNativeMarkdownlintFile,hr as flushFileLogger,Qt as formatAuthRejectionWire,Fn as formatContributors,Ut as formatContributorsFrom,we as formatPackRationale,f as gcCheckpointRefs,hn as getCurrentMcpLogger,Yn as getLocalDir,Qn as getLogFilePath,qi as getLogger,Dn as getLogsDir,pa as getMachineId,Bi as getMeter,ur as getMetrics,Ti as getTracer,Mr as handleCollabSocketError,qe as handleSpawnCursor,Cn as hasForwardingHeaders,ge as hasGcLogLatch,o as iconFromClientName,en as incrementCollabSocketFilteredError,Jn as incrementServerObserverFire,Pr as initContent,dn as initShadowRepo,zi as initTelemetry,qt as initToleranceTelemetryWriter,mr as installPrettyZodErrors,Wi as installTestLoggers,p as installUserSkill,er as isAllowedApiOrigin,fi as isAllowedWorkspaceHostHeader,x as isConfigDoc,li as isHocuspocusAuthRejectionReason,yt as isKnownPackId,dt as isLinkIndexExcludedDoc,Yt as isLoopbackAddress,Z as isManagedArtifactDoc,t as isOrphanMode,Fe as isPairedWriteOrigin,yi as isPathWithinDir,ma as isProcessAlive,ln as isProjectRoot,Sr as isProjectSkillManaged,Lt as isRemoteAdmitted,ot as isReservedForUserTree,wn as isSelfWrite,gt as isSystemDoc,ai as isToleranceTelemetryEnabled,Xi as isValidLockPid,Rt as lastKnownHash,Rr as listRescueCheckpoints,Y as listStarterPacks,It as loadCustomAgents,xe as loadPrincipal,fa as lockFilePath,Vi as loggerFactory,Gi as logsCurrentPath,Yi as logsPreviousPath,He as makeLazyEmbeddingsKeyStore,la as markServerLockDraining,ht as mountMcpAndApi,Mi as normalizeFsPath,Qr as originGitHubHost,nn as packageVersionMajorMinor,$e as parseAuthRejectionWire,pe as parseGitVersion,k as parseHocuspocusAuthToken,G as parseKeepaliveConnectionId,Zr as pathToDocName,ke as planSeed,Vt as prepareSingleFileOpen,Rn as processCommand,Kt as processUsage,mn as readAllTargets,Vr as readBundleDecision,R as readOwnNativeRules,ea as readProcessLock,ca as readProcessLockDetailed,b as readProjectHeadState,me as readProjectLocalSemanticConfig,ra as readServerLock,sr as readServerPackageVersion,kr as readSkillInstallStateSnapshot,ce as readSkillManagement,Un as readStateManifest,Ln as readTargetRecordedAt,Gt as readTargetVersion,re as readUiLock,Me as reconcile,dr as recordContributor,Zn as recordSkillInstallEvent,br as registerAllTools,pi as registerWrite,aa as releaseProcessLock,Qi as releaseServerLock,ve as releaseUiLock,Xt as removeLastKnownHash,Wr as resetMetrics,u as resolveBundleEnabled,un as resolveBundledSkillDir,Gr as resolveContentDir,C as resolveCursorBinaryDefault,pt as resolveCursorSpawnInvocation,Qe as resolveEffectiveLinterConfig,zr as resolveEmbeddingsCredential,cn as resolveLockDir,O as resolveNativeConfigForDoc,N as resolveNativeMarkdownlintConfig,he as resolvePack,jr as resolvePackageVersion,Xr as resolveRemoteAccess,ze as resolveUiInfo,Nr as restoreContributors,ui as restoreLifecycleFromConflictsJson,U as rewriteMarkdownLinksForDocumentRename,ie as rewriteWikiLinksForDocumentRename,h as runAuthReposSubprocess,pn as runAuthStatusSubprocess,kt as runCloneSubprocess,Br as runDeviceFlowSubprocess,Hr as runWithMcpLogger,_r as safeContentPath,Hn as safeSubdir,ir as safetyCheckpoint,an as sanitizeClientName,Er as saveInMemoryCheckpoint,Pn as saveVersion,ii as seedBasenameIndex,lr as serializeError,xi as setActiveSpanAttributes,V as setupServerObservers,Ht as shadowGit,Ri as shutdownTelemetry,Dt as skillManagementPath,Hi as spansCurrentPath,Ui as spansPreviousPath,$ as spawnDetached,Gn as splitMarkdownBlocks,si as startWatcher,Ge as streamingProblemEvent,tn as swapContributors,Ye as teardownToleranceTelemetryWriter,gr as toBroadcasterKey,ki as tracedAppendFileSync,Pi as tracedLinkSync,Ei as tracedMkdir,Ai as tracedMkdirSync,Ii as tracedRename,Di as tracedRenameSync,Ni as tracedRmSync,ji as tracedRmdirSync,Oi as tracedUnlinkSync,wi as tracedWriteFile,Li as tracedWriteFileSync,ei as trustSystemCertificates,$t as untrackTrackedProjectSkillProjection,Ze as updateLastKnownHash,na as updateProcessLockPort,sa as updateServerLockPort,Ke as updateUiLockPort,$n as validateAgentId,wt as validateCloneInputs,bn as validateSkillZip,ua as waitForServerLockDrain,J as withHiddenWindowsConsole,Ci as withSpan,Si as withSpanSync,pr as writeBundleDecision,mi as writeMarkdownlintRule,Xn as writeRootGitignoreForNewRepo,St as writeSkillManagement,g as writeStateManifest,Fr as writeTargetVersion,D as writeTracker};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{Ao as t,I as n,L as r,Ya as i,ko as a}from"./src-2StQCkyf.mjs";import{Ca as o,Gr as s,at as c,di as l,it as u,nt as d,rt as f,un as p}from"./src-DV_Dbu6a.mjs";import{K as m}from"./sleep-IcuyYCzq.mjs";import{O as h,P as g}from"./fs-traced-B-x7hAhD.mjs";import{S as _,u as v,v as y,x as b}from"./server-lock-D6rSSnhg.mjs";import{t as x}from"./yazl-BafwB467.mjs";import{C as S,d as C,i as w,v as T,y as ee}from"./write-project-skill-W6wm8WGO.mjs";import{c as te}from"./colors-BsmVIwfM.mjs";import"./acp-harness-probe-BQ3_wze1.mjs";import{D as E,E as D,S as ne,T as O,_ as k,b as re,o as ie,v as A}from"./init-D0wKKFay.mjs";import{n as ae}from"./constants-7P_R76Oj.mjs";import{t as j}from"./is-object-ByG7RnjH.mjs";import"./loader-Sk1Z2HXI.mjs";import"./preview-B4nElYVr.mjs";import{execSync as oe,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,isAbsolute as se,join as F,relative as ce,resolve as I,sep as le}from"node:path";import{cpSync as ue,createWriteStream as de,existsSync as L,lstatSync as fe,mkdirSync as R,mkdtempSync as pe,readFileSync as z,readdirSync as me,readlinkSync as he,rmSync as ge,statSync as _e,writeFileSync as B}from"node:fs";import{arch as ve,freemem as ye,homedir as be,hostname as xe,platform as Se,release as Ce,tmpdir as we,totalmem as Te,type as Ee,uptime as De}from"node:os";import{realpath as V}from"node:fs/promises";import{createHash as Oe}from"node:crypto";var H=m();const ke=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ae(e,t,n=p){if(e!==void 0&&!ke.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let je=null;function Me(e){je=e}function Ne(){return je??process.cwd()}function Pe(){return F(be(),`.ok`,`bug-reports`)}function Fe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Pe(),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 Ie(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`))?Oe(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function Le(){let e={timestamp:new Date().toISOString(),platform:Se(),osType:Ee(),osRelease:Ce(),hostname:`[redacted]`,uptime:De(),freeMem:ye(),totalMem:Te(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=oe(`sw_vers -productVersion 2>/dev/null`,s({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}function Re(e,t){return ze(e,t).files}function ze(e,t){if(!L(t))return{files:[]};let n=me(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function Be(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,n].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ve(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 He(e){if(e.redact){let{redacted:n,patterns:r,lineCount:i}=t(e.content);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function U(e){for(let t of e.files)try{He({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 Ue(t){let{redact:n,outputPath:r,logger:i}=t,o=t.userLogsDir??F(be(),`.ok`,`logs`),s=t.projectDir?Ie(t.projectDir,i):null;R(P(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Le();c.desktop=t.desktop??null;let{files:l}=ze(s,o),{files:u}=t.projectDir?Be(t.projectDir):{files:[]},{files:d}=t.projectDir?Ve(t.projectDir):{files:[]};i?.info({logFileCount:l.length,lockFileCount:u.length,localSinkFileCount:d.length},`files collected`);let f=[],p=[],{ZipFile:m}=await import(`./yazl-vwTkB7U0.mjs`).then(t=>e(t.default,1)),h=new m;U({zipfile:h,files:l,prefix:`logs`,redact:n,bundleFiles:p,redactions:f,logger:i}),U({zipfile:h,files:u,prefix:`lockdir`,redact:n,bundleFiles:p,redactions:f,logger:i}),U({zipfile:h,files:d,prefix:`local-logs`,redact:n,bundleFiles:p,redactions:f,logger:i});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;h.addBuffer(t,n),p.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&He({zipfile:h,name:`note.txt`,content:t.note,redact:n,bundleFiles:p,redactions:f});let g=JSON.stringify(c,null,2);h.addBuffer(Buffer.from(g,`utf8`),`sysinfo.json`),p.push(`sysinfo.json`);let _={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:p,redactions:f,sysinfo:c};h.addBuffer(Buffer.from(JSON.stringify(_,null,2),`utf8`),`MANIFEST.json`);let v=f.reduce((e,t)=>e+t.lineCount,0),y=[`# Bug Report Bundle`,``,`Generated: ${_.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${_.disciplineVersion}`,``,`## Contents`,``,...p.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,v>0?`${v} line(s) were scrubbed across ${f.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(`
1
+ import{o as e}from"./chunk-DTipWd-i.mjs";import{I as t,L as n,Mo as r,Za as i,jo as a}from"./src-DmtkLnli.mjs";import{Ca as o,Gr as s,at as c,di as l,it as u,nt as d,rt as f,un as p}from"./src-T1lGYBC1.mjs";import{K as m}from"./sleep-IcuyYCzq.mjs";import{O as h,P as g}from"./fs-traced-B-x7hAhD.mjs";import{S as _,u as v,v as y,x as b}from"./server-lock-D7crxuP7.mjs";import{t as x}from"./yazl-BafwB467.mjs";import{C as S,d as C,i as w,v as T,y as ee}from"./write-project-skill-BzhJIXSv.mjs";import{c as te}from"./colors-BsmVIwfM.mjs";import"./acp-harness-probe-z0k-zB9k.mjs";import{D as E,E as D,S as ne,T as O,_ as k,b as re,o as ie,v as A}from"./init-B0r5j8e-.mjs";import{n as ae}from"./constants-tslCao45.mjs";import{t as j}from"./is-object-ByG7RnjH.mjs";import"./loader-17-u4oG7.mjs";import"./preview-D9rdyPNb.mjs";import{execSync as oe,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,isAbsolute as se,join as F,relative as ce,resolve as I,sep as le}from"node:path";import{cpSync as ue,createWriteStream as de,existsSync as L,lstatSync as fe,mkdirSync as R,mkdtempSync as pe,readFileSync as z,readdirSync as me,readlinkSync as he,rmSync as ge,statSync as _e,writeFileSync as B}from"node:fs";import{arch as ve,freemem as ye,homedir as be,hostname as xe,platform as Se,release as Ce,tmpdir as we,totalmem as Te,type as Ee,uptime as De}from"node:os";import{realpath as V}from"node:fs/promises";import{createHash as Oe}from"node:crypto";var H=m();const ke=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ae(e,t,n=p){if(e!==void 0&&!ke.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let je=null;function Me(e){je=e}function Ne(){return je??process.cwd()}function Pe(){return F(be(),`.ok`,`bug-reports`)}function Fe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Pe(),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 Ie(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`))?Oe(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function Le(){let e={timestamp:new Date().toISOString(),platform:Se(),osType:Ee(),osRelease:Ce(),hostname:`[redacted]`,uptime:De(),freeMem:ye(),totalMem:Te(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=oe(`sw_vers -productVersion 2>/dev/null`,s({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}function Re(e,t){return ze(e,t).files}function ze(e,t){if(!L(t))return{files:[]};let n=me(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function Be(e){let n=F(e,`.ok`,`local`);return L(n)?{files:[`server.lock`,`last-spawn-error.log`,t].map(e=>F(n,e)).filter(e=>L(e))}:{files:[]}}function Ve(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 He(e){if(e.redact){let{redacted:t,patterns:n,lineCount:i}=r(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:i,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function U(e){for(let t of e.files)try{He({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 Ue(t){let{redact:n,outputPath:r,logger:i}=t,o=t.userLogsDir??F(be(),`.ok`,`logs`),s=t.projectDir?Ie(t.projectDir,i):null;R(P(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Le();c.desktop=t.desktop??null;let{files:l}=ze(s,o),{files:u}=t.projectDir?Be(t.projectDir):{files:[]},{files:d}=t.projectDir?Ve(t.projectDir):{files:[]};i?.info({logFileCount:l.length,lockFileCount:u.length,localSinkFileCount:d.length},`files collected`);let f=[],p=[],{ZipFile:m}=await import(`./yazl-vwTkB7U0.mjs`).then(t=>e(t.default,1)),h=new m;U({zipfile:h,files:l,prefix:`logs`,redact:n,bundleFiles:p,redactions:f,logger:i}),U({zipfile:h,files:u,prefix:`lockdir`,redact:n,bundleFiles:p,redactions:f,logger:i}),U({zipfile:h,files:d,prefix:`local-logs`,redact:n,bundleFiles:p,redactions:f,logger:i});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;h.addBuffer(t,n),p.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&He({zipfile:h,name:`note.txt`,content:t.note,redact:n,bundleFiles:p,redactions:f});let g=JSON.stringify(c,null,2);h.addBuffer(Buffer.from(g,`utf8`),`sysinfo.json`),p.push(`sysinfo.json`);let _={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:p,redactions:f,sysinfo:c};h.addBuffer(Buffer.from(JSON.stringify(_,null,2),`utf8`),`MANIFEST.json`);let v=f.reduce((e,t)=>e+t.lineCount,0),y=[`# Bug Report Bundle`,``,`Generated: ${_.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${_.disciplineVersion}`,``,`## Contents`,``,...p.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,v>0?`${v} line(s) were scrubbed across ${f.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
2
  `);h.addBuffer(Buffer.from(y,`utf8`),`README.md`),h.end();let b=de(r);return h.outputStream.pipe(b),await new Promise((e,t)=>{b.on(`close`,e),b.on(`error`,t)}),i?.info({bundlePath:r,fileCount:p.length,redactionCount:v},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:p,redactions:f,redactedLineCount:v,generatedAt:_.generatedAt}}}var We=e(x(),1),W=e(te(),1);function G(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return G(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!Ge(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=K(i,t);return n}function Ke(e,t){let n=z(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
3
  `),i=n.split(`
4
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)}}}B(e,r?`${a.join(`
@@ -6,8 +6,8 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{Ao as t,I as n,L as r,Ya as i,ko
6
6
  `))}function qe(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
7
  `)?`
8
8
  `:``;B(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=G(n,t.contentDir);r!==n&&B(e,r)}}function Je(e,t){let n=z(e,`utf-8`),r=G(n,t.contentDir);r!==n&&B(e,r)}function Ye(e){try{return me(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>F(e,t.name))}catch{return[]}}const Xe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Ze(e){return/\.log\.\d+$/.test(e)}function Qe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||Ze(e)}function $e(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of Ye(F(e.stagingDir,n)))Qe(r)?Ke(r,t):r.endsWith(`.json`)?qe(r,t):Je(r,t);for(let n of Ye(F(e.stagingDir,`state`))){let e=N(n);n.endsWith(`.jsonl`)?Ke(n,t):Xe.has(e)?qe(n,t):Je(n,t)}}const et=[`.ok`,`local`,`telemetry`],tt=[`.ok`,`local`,`logs`],nt=[`.ok`,`local`,`loss-capture`],rt=`spans-current.jsonl`,it=`spans-prev.jsonl`,at=`server-current.jsonl`,ot=`server-prev.jsonl`,st=`loss-current.jsonl`,ct=`loss-prev.jsonl`;function lt(e){return F(e,...et,rt)}function ut(e){return F(e,...et,it)}function dt(e){return F(e,...tt,at)}function ft(e){return F(e,...tt,ot)}function pt(e){return F(e,...nt,st)}function mt(e){return F(e,...nt,ct)}const q=1e3;async function ht(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(q)});return t.ok?await t.text():null}catch{return null}}async function gt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(q)});return t.ok?await t.text():null}catch{return null}}async function _t(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(q)});return t.ok?await t.text():null}catch{return null}}function vt(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 yt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`log`,`--oneline`,`-50`],s({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function bt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],s({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function xt(){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 St(){return{nodeVersion:process.version,platform:Se(),arch:ve()}}function Ct(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wt(e){if(!L(e))return{};let t;try{t=(0,H.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(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function Tt(e){return typeof e==`boolean`?e:void 0}function Et(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return Et(e.maxBytes)}function Dt(e){let t=wt(h(`project`,e)),n=wt(h(`project-local`,e));return{enabled:Tt(n.enabled)??Tt(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Ot(e){return Oe(`sha256`).update(e).digest(`hex`)}function kt(e){let t=z(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function At(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 X(e,t){return L(e)?(R(P(t),{recursive:!0}),ue(e,t),!0):!1}function jt(e){let t=[],n=e=>{let r=me(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 Mt=new Set([`.jsonl`]);function Nt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Mt.has(e.slice(t))}const Pt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Ft(e){if(Ze(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Pt.has(e.slice(t))}function It(e){let n=[];for(let r of jt(e)){let i=Lt(e,r);if(!Ft(i))continue;let{redacted:a,patterns:o,lineCount:s}=t(z(r,`utf-8`));o.length!==0&&(B(r,a),n.push({file:i,lineCount:s,patterns:o}))}return{redactions:n,redactedLineCount:n.reduce((e,t)=>e+t.lineCount,0)}}function Lt(e,t){return ce(e,t).split(le).join(`/`)}async function Rt(e){let t=I(e.contentDir),i=I(e.projectDir??e.contentDir),a=e.deps??{},o=a.fetchAgentPresence??ht,s=a.fetchAgentEffects??gt,c=a.fetchWatcherRecent??_t,l=a.readShadowHead??yt,u=a.readCheckpointRefs??bt,d=a.now??(()=>new Date),f=a.okVersion??(()=>ae),p=a.readDesktopEnv??xt,m=a.readRuntime??St,h=a.isOtlpPushEnabled??Ct,g=pe(F(we(),`ok-bundle-`));try{R(F(g,`telemetry`),{recursive:!0}),R(F(g,`logs`),{recursive:!0}),R(F(g,`state`),{recursive:!0}),X(lt(i),F(g,`telemetry`,rt)),X(ut(i),F(g,`telemetry`,it)),X(dt(i),F(g,`logs`,at)),X(ft(i),F(g,`logs`,ot));for(let t of e.userLogFiles??[])X(t,F(g,`logs`,N(t)));let _=F(i,`.ok`,`local`),v=F(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(L(v)){X(v,F(g,`state`,`server.lock`));try{let e=z(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await o(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(B(F(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await s(x);t!==null&&B(F(g,`state`,`agent-effects.json`),t);let n=await c(x);if(n!==null){let e=vt(n);e!==null&&B(F(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(t);S!==null&&B(F(g,`state`,`shadow-head.txt`),S);let C=u(t);C!==null&&B(F(g,`state`,`checkpoint-refs.txt`),C),X(pt(i),F(g,`state`,st)),X(mt(i),F(g,`state`,ct)),X(F(_,`last-spawn-error.log`),F(g,`state`,`last-spawn-error.log`)),X(F(_,r),F(g,`state`,r)),X(F(_,n),F(g,`state`,n));let w=m(),T=p(),ee={ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T}};B(F(g,`state`,`runtime.json`),`${JSON.stringify(ee,null,2)}\n`);let te=y===`running`?`running
10
- `:`not-running (${b})\n`;if(B(F(g,`state`,`server-status.txt`),te),e.processDir&&L(e.processDir)){let t=F(g,`process`);R(t,{recursive:!0}),ue(e.processDir,t,{recursive:!0})}let E=e.redact===!0;E&&$e({stagingDir:g,contentDir:t}),e.note&&B(F(g,`note.txt`),e.note);let D=null;e.scrubSecrets===!0&&(D=It(g));for(let t of e.extraFiles??[])X(t.sourcePath,F(g,`extra`,t.zipName??N(t.sourcePath)))||a.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let ne=Dt(i),O=jt(g),k=[],re=0,ie=0;for(let e of O){let t=Lt(g,e),n=_e(e).size,r=Nt(t)?kt(e):0;k.push({path:t,bytes:n,lines:r}),re+=n,t.startsWith(`telemetry/`)&&Nt(t)&&(ie+=At(e))}let A={applied:E};D!==null&&(A.secretScrub=D);let ae={schemaVersion:2,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T},contentDir:{pathSha256:Ot(t),absolutePath:E?`<CONTENT_DIR>`:t},telemetry:{localSink:ne,otlpPushEnabled:h()},redaction:A,serverStatus:y,files:k};B(F(g,`manifest.json`),`${JSON.stringify(ae,null,2)}\n`);let j=O.some(e=>{try{return z(e,`utf-8`).includes(t)}catch{return!1}}),oe={totalBytes:re,fileCount:k.length,docNameCount:ie,contentDirVisible:j,redacted:E},M=!1;return{stagingDir:g,manifest:ae,summary:oe,cleanup:()=>{M||(M=!0,ge(g,{recursive:!0,force:!0}))}}}catch(e){throw ge(g,{recursive:!0,force:!0}),e}}async function zt(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 We.ZipFile,a=jt(t.stagingDir);for(let e of a){let n=Lt(t.stagingDir,e);i.addFile(e,n)}i.end();let o=de(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 Bt(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let t=(0,H.parse)(z(n,`utf-8`)),r=j(t)?t.content:void 0,i=j(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 Vt(e,t,n){let r=Ie(t,e.logger),i=await Rt({contentDir:Bt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:Re(r,e.userLogsDir??F(be(),`.ok`,`logs`)),deps:{readDesktopEnv:n,logger:e.logger}});try{R(P(e.outputPath),{recursive:!0}),await zt({collected:i,outputPath:e.outputPath});let t=i.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:r,files:i.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:i.manifest.createdAt}}}finally{i.cleanup()}}async function Ht(e){let{projectDir:t}=e,n=e.readDesktopEnv??xt;if(e.level===`full`&&t!==void 0)return Vt(e,t,n);let{zipPath:r,summary:i}=await Ue({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n()});return{zipPath:r,summary:{level:e.level,systemWide:t===void 0,projectSlug:i.projectSlug,files:i.files,redactions:i.redactions,redactedLineCount:i.redactedLineCount,generatedAt:i.generatedAt}}}function Z(e,t,n={}){let r=v(e,t);if(!L(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(z(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!_(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??b)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??y())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??xe();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Ut(e){return e.replace(/:\d+$/,``)}function Wt(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Ut(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Ut(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Ut(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}function Gt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=i(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let a,o,s,c;try{a=decodeURIComponent(r[0]),o=decodeURIComponent(r[1]),s=decodeURIComponent(r[3]),c=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.length===0||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function Kt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=i(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let a=r.slice(5);a.length===1&&a[0]===``&&a.pop();let o,s,c,l;try{o=decodeURIComponent(r[1]),s=decodeURIComponent(r[2]),c=decodeURIComponent(r[4]),l=a.map(e=>decodeURIComponent(e))}catch{return null}return!o||!s||!c||l.some(e=>e.length===0)?null:{host:n,owner:o,repo:s,branch:c,path:l.join(`/`)}}function qt(e){let t=Gt(e);if(t)return{kind:`doc`,...t};let n=Kt(e);return n?{kind:`folder`,...n}:null}const Jt=`# >>> open-knowledge cli >>>`,Yt=`# <<< open-knowledge cli <<<`,Xt=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Zt(e){return F(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Qt={existsSync:e=>L(e),readFileSync:(e,t)=>z(e,t),lstatSync:e=>fe(e),readlinkSync:e=>he(e)};function $t(e,t=Qt){let n=Zt(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 en(e){let t=e.replace(Xt,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function tn(e,t,n=Qt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function nn(e){return T(e)||ee(e)||ne(e)}const rn=10*1024*1024;function an(e,t,n,r){let i=ie(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(!nn(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);return e.format===`file`?(ge(a,{force:!0}),{kind:`removed`}):e.format===`toml`?cn(a,o):e.format===`yaml`?sn(a,e.topLevelKey,o):on(a,e.topLevelKey,e.serverMapSubKey,o)}function on(e,t,n,r){let i;try{i=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=E(i,k(t,n,r));return o?(g(e,a,{mode:O(e)}),{kind:`removed`}):{kind:`not-present`}}function sn(e,t,n){let r;try{r=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,H.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=D(a);a.trim()===``||a.endsWith(`
9
+ `)}\n`:null}catch{return null}}function yt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`log`,`--oneline`,`-50`],s({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function bt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],s({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function xt(){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 St(){return{nodeVersion:process.version,platform:Se(),arch:ve()}}function Ct(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wt(e){if(!L(e))return{};let t;try{t=(0,H.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(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function Tt(e){return typeof e==`boolean`?e:void 0}function Et(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return Et(e.maxBytes)}function Dt(e){let t=wt(h(`project`,e)),n=wt(h(`project-local`,e));return{enabled:Tt(n.enabled)??Tt(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Ot(e){return Oe(`sha256`).update(e).digest(`hex`)}function kt(e){let t=z(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function At(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 X(e,t){return L(e)?(R(P(t),{recursive:!0}),ue(e,t),!0):!1}function jt(e){let t=[],n=e=>{let r=me(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 Mt=new Set([`.jsonl`]);function Nt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Mt.has(e.slice(t))}const Pt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Ft(e){if(Ze(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Pt.has(e.slice(t))}function It(e){let t=[];for(let n of jt(e)){let i=Lt(e,n);if(!Ft(i))continue;let{redacted:a,patterns:o,lineCount:s}=r(z(n,`utf-8`));o.length!==0&&(B(n,a),t.push({file:i,lineCount:s,patterns:o}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Lt(e,t){return ce(e,t).split(le).join(`/`)}async function Rt(e){let r=I(e.contentDir),i=I(e.projectDir??e.contentDir),a=e.deps??{},o=a.fetchAgentPresence??ht,s=a.fetchAgentEffects??gt,c=a.fetchWatcherRecent??_t,l=a.readShadowHead??yt,u=a.readCheckpointRefs??bt,d=a.now??(()=>new Date),f=a.okVersion??(()=>ae),p=a.readDesktopEnv??xt,m=a.readRuntime??St,h=a.isOtlpPushEnabled??Ct,g=pe(F(we(),`ok-bundle-`));try{R(F(g,`telemetry`),{recursive:!0}),R(F(g,`logs`),{recursive:!0}),R(F(g,`state`),{recursive:!0}),X(lt(i),F(g,`telemetry`,rt)),X(ut(i),F(g,`telemetry`,it)),X(dt(i),F(g,`logs`,at)),X(ft(i),F(g,`logs`,ot));for(let t of e.userLogFiles??[])X(t,F(g,`logs`,N(t)));let _=F(i,`.ok`,`local`),v=F(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(L(v)){X(v,F(g,`state`,`server.lock`));try{let e=z(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await o(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(B(F(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await s(x);t!==null&&B(F(g,`state`,`agent-effects.json`),t);let n=await c(x);if(n!==null){let e=vt(n);e!==null&&B(F(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(r);S!==null&&B(F(g,`state`,`shadow-head.txt`),S);let C=u(r);C!==null&&B(F(g,`state`,`checkpoint-refs.txt`),C),X(pt(i),F(g,`state`,st)),X(mt(i),F(g,`state`,ct)),X(F(_,`last-spawn-error.log`),F(g,`state`,`last-spawn-error.log`)),X(F(_,n),F(g,`state`,n)),X(F(_,t),F(g,`state`,t));let w=m(),T=p(),ee={ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T}};B(F(g,`state`,`runtime.json`),`${JSON.stringify(ee,null,2)}\n`);let te=y===`running`?`running
10
+ `:`not-running (${b})\n`;if(B(F(g,`state`,`server-status.txt`),te),e.processDir&&L(e.processDir)){let t=F(g,`process`);R(t,{recursive:!0}),ue(e.processDir,t,{recursive:!0})}let E=e.redact===!0;E&&$e({stagingDir:g,contentDir:r}),e.note&&B(F(g,`note.txt`),e.note);let D=null;e.scrubSecrets===!0&&(D=It(g));for(let t of e.extraFiles??[])X(t.sourcePath,F(g,`extra`,t.zipName??N(t.sourcePath)))||a.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let ne=Dt(i),O=jt(g),k=[],re=0,ie=0;for(let e of O){let t=Lt(g,e),n=_e(e).size,r=Nt(t)?kt(e):0;k.push({path:t,bytes:n,lines:r}),re+=n,t.startsWith(`telemetry/`)&&Nt(t)&&(ie+=At(e))}let A={applied:E};D!==null&&(A.secretScrub=D);let ae={schemaVersion:2,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T},contentDir:{pathSha256:Ot(r),absolutePath:E?`<CONTENT_DIR>`:r},telemetry:{localSink:ne,otlpPushEnabled:h()},redaction:A,serverStatus:y,files:k};B(F(g,`manifest.json`),`${JSON.stringify(ae,null,2)}\n`);let j=O.some(e=>{try{return z(e,`utf-8`).includes(r)}catch{return!1}}),oe={totalBytes:re,fileCount:k.length,docNameCount:ie,contentDirVisible:j,redacted:E},M=!1;return{stagingDir:g,manifest:ae,summary:oe,cleanup:()=>{M||(M=!0,ge(g,{recursive:!0,force:!0}))}}}catch(e){throw ge(g,{recursive:!0,force:!0}),e}}async function zt(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 We.ZipFile,a=jt(t.stagingDir);for(let e of a){let n=Lt(t.stagingDir,e);i.addFile(e,n)}i.end();let o=de(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 Bt(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let t=(0,H.parse)(z(n,`utf-8`)),r=j(t)?t.content:void 0,i=j(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 Vt(e,t,n){let r=Ie(t,e.logger),i=await Rt({contentDir:Bt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:Re(r,e.userLogsDir??F(be(),`.ok`,`logs`)),deps:{readDesktopEnv:n,logger:e.logger}});try{R(P(e.outputPath),{recursive:!0}),await zt({collected:i,outputPath:e.outputPath});let t=i.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:r,files:i.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:i.manifest.createdAt}}}finally{i.cleanup()}}async function Ht(e){let{projectDir:t}=e,n=e.readDesktopEnv??xt;if(e.level===`full`&&t!==void 0)return Vt(e,t,n);let{zipPath:r,summary:i}=await Ue({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n()});return{zipPath:r,summary:{level:e.level,systemWide:t===void 0,projectSlug:i.projectSlug,files:i.files,redactions:i.redactions,redactedLineCount:i.redactedLineCount,generatedAt:i.generatedAt}}}function Z(e,t,n={}){let r=v(e,t);if(!L(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(z(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!_(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??b)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??y())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??xe();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Ut(e){return e.replace(/:\d+$/,``)}function Wt(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Ut(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Ut(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Ut(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}function Gt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=i(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let a,o,s,c;try{a=decodeURIComponent(r[0]),o=decodeURIComponent(r[1]),s=decodeURIComponent(r[3]),c=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.length===0||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function Kt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=i(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let a=r.slice(5);a.length===1&&a[0]===``&&a.pop();let o,s,c,l;try{o=decodeURIComponent(r[1]),s=decodeURIComponent(r[2]),c=decodeURIComponent(r[4]),l=a.map(e=>decodeURIComponent(e))}catch{return null}return!o||!s||!c||l.some(e=>e.length===0)?null:{host:n,owner:o,repo:s,branch:c,path:l.join(`/`)}}function qt(e){let t=Gt(e);if(t)return{kind:`doc`,...t};let n=Kt(e);return n?{kind:`folder`,...n}:null}const Jt=`# >>> open-knowledge cli >>>`,Yt=`# <<< open-knowledge cli <<<`,Xt=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Zt(e){return F(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Qt={existsSync:e=>L(e),readFileSync:(e,t)=>z(e,t),lstatSync:e=>fe(e),readlinkSync:e=>he(e)};function $t(e,t=Qt){let n=Zt(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 en(e){let t=e.replace(Xt,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function tn(e,t,n=Qt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function nn(e){return T(e)||ee(e)||ne(e)}const rn=10*1024*1024;function an(e,t,n,r){let i=ie(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(!nn(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);return e.format===`file`?(ge(a,{force:!0}),{kind:`removed`}):e.format===`toml`?cn(a,o):e.format===`yaml`?sn(a,e.topLevelKey,o):on(a,e.topLevelKey,e.serverMapSubKey,o)}function on(e,t,n,r){let i;try{i=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=E(i,k(t,n,r));return o?(g(e,a,{mode:O(e)}),{kind:`removed`}):{kind:`not-present`}}function sn(e,t,n){let r;try{r=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,H.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=D(a);a.trim()===``||a.endsWith(`
11
11
  `)?c.endsWith(`
12
12
  `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
13
13
  `).replace(/\n/g,`\r
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{Ao as t,I as n,L as r,Ya as i,ko
17
17
  `).replace(/\n/g,`\r
18
18
  `));let u=`${i?``:``}${l}`;return u!==r&&g(e,u,{mode:O(e)}),{kind:`removed`}}function ln(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function un(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 dn(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:f(r),command:r,isDesktop:ln(r)}}function fn(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&fn(e)?`ui-orphan`:`stale`}const pn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function mn(e){switch(e){case`running`:return W.default.green(e);case`desktop`:return W.default.blue(e);case`foreign`:return W.default.cyan(e);case`ui-orphan`:return W.default.magenta(e);case`stale`:return W.default.yellow(e)}}function hn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function gn(e){return`${hn(e.server.usage)} | ${hn(e.ui?.usage??null)}`}function _n(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function vn(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=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,_n(e),gn(e),t,String(n),un(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=mn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=W.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
19
19
  `)}async function yn(e={}){let t=e.discover??d,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??u,a=e.resolveUsage??c,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=dn(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(vn(e.all?s:s.filter(e=>pn.has(Q(e)))))}function bn(){return new S(`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 yn({all:t.all===!0||e===`all`,json:t.json===!0})})}function xn(e,t,n={}){let r=n.isAlive??b,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 Sn(e){let t=e.inspect??(t=>Z(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=xn(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 Cn(e,t=b){let n=await d(),r=null;for(let i of n){let n=Z(i,`server`),a=Z(i,`ui`);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 wn(e){let t=Sn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Tn(e){return new S(`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=Sn({lockDir:l(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 yn({});return}if(n===`all`){let e=await d();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=Z(n,`server`),r=Z(n,`ui`);!$(e,b)&&!$(r,b)||(wn(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 Cn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}wn(t);return}wn(l(I(Ne(),n)))})}function En(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}async function Dn(e,t){let n,r;try{n=await V(I(e)),r=await V(I(P(e)))}catch{return{kind:`not-git`}}if(!On(n,r))return{kind:`symlink-escape`};let a=F(n,`.git`),s;try{s=_e(a)}catch{return{kind:`not-git`}}if(s.isDirectory()){let e;try{e=await V(a)}catch{return{kind:`not-git`}}if(!On(e,n))return{kind:`symlink-escape`}}else if(!s.isFile())return{kind:`not-git`};let c=o(n);if(c.kind!==`repository`)return{kind:`not-git`};let l=c.repository.readRemoteUrl(`origin`);if(l.kind===`unreadable`)return{kind:`not-git`};if(l.kind===`absent`)return l.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let u=l.url,d=Wt(u);if(d===null)return{kind:`non-github`};let f=i(d.hostname);if(f===null)return{kind:`non-github`};let p=f===t.host.toLowerCase(),m=d.owner.toLowerCase()===t.owner.toLowerCase(),h=d.name.toLowerCase()===t.repo.toLowerCase();return!p&&m&&h?{kind:`wrong-host`,actualHost:f}:!p||!m||!h?{kind:`wrong-repo`,actualOwner:d.owner,actualRepo:d.name}:{kind:`ok`,gitRemoteUrl:`https://${f}/${d.owner}/${d.name}.git`}}function On(e,t){if(e===t)return!0;let n=ce(t,e);return n.length>0&&!n.startsWith(`..`)&&!se(n)}const kn=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=A(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=w(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function An(e,t,n={},r=kn){let i=[];for(let a of t){let t=C[a];for(let a of r)i.push(a.write(t,e,n))}return i}function jn(e,t,n={}){return{integrations:An(e,t,n)}}export{Fe as C,Ae as D,Me as E,zt as S,Ne as T,Kt as _,Tn as a,Ht as b,Jt as c,tn as d,Zt as f,qt as g,Gt as h,Sn as i,Xt as l,en as m,Dn as n,bn as o,$t as p,En as r,an as s,jn as t,Yt as u,Wt as v,Pe as w,Rt as x,Z as y};
20
- //# sourceMappingURL=src-y0VSl78g.mjs.map
20
+ //# sourceMappingURL=src-Dgr9qydu.mjs.map