@inkeep/open-knowledge 0.63.0-beta.14 → 0.63.0-beta.16

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 (144) hide show
  1. package/README.md +1 -1
  2. package/dist/{acp-harness-probe-DRbySBVr.mjs → acp-harness-probe-ClLen5mV.mjs} +2 -2
  3. package/dist/assets/skills/discovery/SKILL.md +12 -3
  4. package/dist/assets/skills/project/references/preview.md +1 -0
  5. package/dist/cli.d.mts +1 -7
  6. package/dist/cli.mjs +63 -61
  7. package/dist/constants--Mefqd_Y.mjs +2 -0
  8. package/dist/{git-handle-NTLKBuxQ.mjs → git-handle-B-wIq9_v.mjs} +2 -2
  9. package/dist/git-handle-Die2olDM.mjs +1 -0
  10. package/dist/index.d.mts +17 -1
  11. package/dist/index.mjs +184 -184
  12. package/dist/{init-44bY7bDu.mjs → init-DTAgv3R5.mjs} +34 -34
  13. package/dist/init-mgIG_U9p.mjs +1 -0
  14. package/dist/{launch-json-removal-NGM0vd0O.mjs → launch-json-removal-CdUHSdLM.mjs} +2 -2
  15. package/dist/{loader-Bqy2LPc4.mjs → loader-CX9-nOcJ.mjs} +2 -2
  16. package/dist/loader-CtQdAM2a.mjs +1 -0
  17. package/dist/md-manager-B5SZ3ICb.mjs +2 -0
  18. package/dist/{open-browser-CTBKeB6u.mjs → open-browser-BR2Im42W.mjs} +2 -2
  19. package/dist/parse-worker.mjs +1 -1
  20. package/dist/{preview-CBcNW71i.mjs → preview-Be1nfx_a.mjs} +2 -2
  21. package/dist/preview-CxQ9YhvK.mjs +1 -0
  22. package/dist/public/assets/{ActivityModeContent-DpSXlSDK.js → ActivityModeContent-CHILMZNT.js} +1 -1
  23. package/dist/public/assets/{AddPropertiesButton-D4JAaZQQ.js → AddPropertiesButton-N2hquuuJ.js} +1 -1
  24. package/dist/public/assets/{AgentDiffPane-CyDxOvCL.js → AgentDiffPane-DZIVlX7T.js} +1 -1
  25. package/dist/public/assets/{AgentThreadClientBinder-0PMIVX8t.js → AgentThreadClientBinder-D-WSZFly.js} +1 -1
  26. package/dist/public/assets/{BugReportHistory-C0wa0XGQ.js → BugReportHistory-Do8Akfia.js} +1 -1
  27. package/dist/public/assets/{BugReportHistoryDialog-DHqxk14p.js → BugReportHistoryDialog-CUVvL_V_.js} +1 -1
  28. package/dist/public/assets/{CodeMirrorPropInput-DruAtwJ7.js → CodeMirrorPropInput-BonPS-HY.js} +2 -2
  29. package/dist/public/assets/DocumentContext-CHklKdJU.js +38 -0
  30. package/dist/public/assets/{EditorModeToggle-bhfSOn_q.js → EditorModeToggle-ry71w-tr.js} +1 -1
  31. package/dist/public/assets/{EnableSyncConfirmDialog-B6yilqtJ.js → EnableSyncConfirmDialog-MNxsnx25.js} +1 -1
  32. package/dist/public/assets/{ExcalidrawDocEditor-CHNZnMVl.js → ExcalidrawDocEditor-B60Bbxuj.js} +1 -1
  33. package/dist/public/assets/FeedbackForm-Bg4JztCb.js +1 -0
  34. package/dist/public/assets/{GraphPanel-BUCcv-kh.js → GraphPanel-Doc3UkYk.js} +1 -1
  35. package/dist/public/assets/{ImportSkillDialog-BpdACb4T.js → ImportSkillDialog-CJDNe4Hm.js} +1 -1
  36. package/dist/public/assets/{LintConfigEditor-Bjo--Jlu.js → LintConfigEditor-C7bY5Vg9.js} +1 -1
  37. package/dist/public/assets/{ManagedArtifactProperties-CAjO5kPP.js → ManagedArtifactProperties-Bjd-HmPr.js} +1 -1
  38. package/dist/public/assets/ManagedArtifactProperties-Bq1W2pn6.js +1 -0
  39. package/dist/public/assets/{MermaidDocEditor-sVFVDRu0.js → MermaidDocEditor-98PHlD5d.js} +1 -1
  40. package/dist/public/assets/{PropertyDisplayRow-Zs1Dojtm.js → PropertyDisplayRow-gpEd0kfb.js} +1 -1
  41. package/dist/public/assets/{ReportBugDialogBody-IBysJpfl.js → ReportBugDialogBody-BAu2r8QZ.js} +1 -1
  42. package/dist/public/assets/{SchemaConfigEditor-DRO7Pk3U.js → SchemaConfigEditor-vjVfM5Sj.js} +1 -1
  43. package/dist/public/assets/SessionsHost-cu-i_Py-.js +2 -0
  44. package/dist/public/assets/{SettingsDialogBody-BMGAvrlE.js → SettingsDialogBody-CO2rU2Ts.js} +1 -1
  45. package/dist/public/assets/{ShareBranchSwitchDialog-AhlfSSFn.js → ShareBranchSwitchDialog-DYyy9FZ6.js} +1 -1
  46. package/dist/public/assets/{ShareReceiveDialog-CtBx5On-.js → ShareReceiveDialog-Bf8y_Djr.js} +1 -1
  47. package/dist/public/assets/{ShareReceiveMissDialog-DLEnh_5D.js → ShareReceiveMissDialog-2dn8BUR-.js} +1 -1
  48. package/dist/public/assets/{SkillCostValue-CvzNMqXu.js → SkillCostValue-DdoKihcJ.js} +1 -1
  49. package/dist/public/assets/{SkillEditBanner-tXNHuYvo.js → SkillEditBanner-B5Rhz1sK.js} +1 -1
  50. package/dist/public/assets/{SkillInstallMenu-BIQ8kFyt.js → SkillInstallMenu-BbGLFnIp.js} +1 -1
  51. package/dist/public/assets/{SkillOriginInline-o3OTyjM5.js → SkillOriginInline-BLqb-Q9f.js} +1 -1
  52. package/dist/public/assets/{SkillToolbarControls-NfRRvRVu.js → SkillToolbarControls-DuseqJHs.js} +1 -1
  53. package/dist/public/assets/{SlidesToolbarControls-3EMlFJ8t.js → SlidesToolbarControls-HDhusqiO.js} +1 -1
  54. package/dist/public/assets/{SourceEditor-D2uTTlMz.js → SourceEditor-Clg6eI_3.js} +1 -1
  55. package/dist/public/assets/{TerminalPanel-BCA5YFGB.js → TerminalPanel-CLna_vO1.js} +1 -1
  56. package/dist/public/assets/{TerminalWindowApp-C7BK93wZ.js → TerminalWindowApp-gPY6AEoz.js} +1 -1
  57. package/dist/public/assets/{TextDocEditor-Cv822TBa.js → TextDocEditor-CklZnKak.js} +1 -1
  58. package/dist/public/assets/{ThreadView-BrcLsj4M.js → ThreadView-Cx7IoasQ.js} +4 -4
  59. package/dist/public/assets/{TimelineDiffPane-COkWCc-p.js → TimelineDiffPane-6_BmgW-q.js} +1 -1
  60. package/dist/public/assets/{agent-diff-store-BzoWerAN.js → agent-diff-store-BQ63ociD.js} +1 -1
  61. package/dist/public/assets/{auth-state-cache-BY_HBQxD.js → auth-state-cache-BoEHhg1J.js} +1 -1
  62. package/dist/public/assets/{bug-report-send-manager-D8S8BM9G.js → bug-report-send-manager-i5VL8tcj.js} +1 -1
  63. package/dist/public/assets/{client-version-DgFD9pEA.js → client-version-B5-HmGfc.js} +1 -1
  64. package/dist/public/assets/{comment-chips-ENEVohZ7.js → comment-chips-BJp4Z6gM.js} +1 -1
  65. package/dist/public/assets/{config-provider-dIusLQHf.js → config-provider-EruTjtaU.js} +1 -1
  66. package/dist/public/assets/{dist-ClHGFbjP2.js → dist-CnzPyMX52.js} +1 -1
  67. package/dist/public/assets/{doc-paths-DAr9Ew0q.js → doc-paths-BRPkH6xf.js} +1 -1
  68. package/dist/public/assets/{documents-events-BYjMJCtr.js → documents-events-CCQgw0nj.js} +1 -1
  69. package/dist/public/assets/{file-tree-adapter-DsXEGhjb.js → file-tree-adapter-CUCkGST6.js} +1 -1
  70. package/dist/public/assets/{file-tree-utils-B2Axpvgc.js → file-tree-utils-rWtfRJr1.js} +1 -1
  71. package/dist/public/assets/{folder-config-api-yRQlw6u0.js → folder-config-api-lyyhTvfi.js} +1 -1
  72. package/dist/public/assets/globals-Br_tCgC1.css +1 -0
  73. package/dist/public/assets/i18n-B6VtcWE-.js +1 -0
  74. package/dist/public/assets/index-71h2S3L-.js +2196 -0
  75. package/dist/public/assets/{lint-config-client-CvBLe774.js → lint-config-client-CUY7G3d1.js} +1 -1
  76. package/dist/public/assets/{markdownlint-rule-browser-DPzJ-2Lh.js → markdownlint-rule-browser-Dz_YV4nb.js} +1 -1
  77. package/dist/public/assets/page-list-cache-B3hpCgnI.js +1 -0
  78. package/dist/public/assets/{pending-receive-nav-store-DWJKoDM1.js → pending-receive-nav-store-GeyTv6vL.js} +1 -1
  79. package/dist/public/assets/{progress-BpDlLX4d.js → progress-COZ-vSR3.js} +1 -1
  80. package/dist/public/assets/{prop-types-CNBRspY6.js → prop-types-B_H9lOE2.js} +1 -1
  81. package/dist/public/assets/{receive-store-B9Ct8-SS.js → receive-store-C2e1W-CK.js} +1 -1
  82. package/dist/public/assets/{selection-context-vyl25V2m.js → selection-context-ExCMrk51.js} +1 -1
  83. package/dist/public/assets/{skill-scope-2ZCES3JH.js → skill-scope-mDqM7wzc.js} +1 -1
  84. package/dist/public/assets/{skills-api--ee5EeEm.js → skills-api-PeIbMIpS.js} +1 -1
  85. package/dist/public/assets/{src-CXCKDhky.js → src-DoJGoHbH.js} +1 -1
  86. package/dist/public/assets/{tag-pill-input-BNoYWhVX.js → tag-pill-input-DGdY4F_y.js} +1 -1
  87. package/dist/public/assets/{target-navigation-intent-DHP7_t_c.js → target-navigation-intent-BAfh4f5r.js} +1 -1
  88. package/dist/public/assets/{terminal-cli-display-BocYbbO4.js → terminal-cli-display-B9RLqrD0.js} +1 -1
  89. package/dist/public/assets/{terminal-launch-events-CAYVVL7j.js → terminal-launch-events-T1RxH2D_.js} +1 -1
  90. package/dist/public/assets/{terminal-telemetry-DVozpHQ9.js → terminal-telemetry-2xaVQF-W.js} +1 -1
  91. package/dist/public/assets/thread-client-Dd5imB2t.js +1 -0
  92. package/dist/public/assets/{typing-burst-detector-Dr0Uop8d.js → typing-burst-detector-4uDZY4-2.js} +1 -1
  93. package/dist/public/assets/{uninstall-CXQd-im6.js → uninstall-DwDCHx8s.js} +1 -1
  94. package/dist/public/assets/{use-activity-panel-GiVhJhnJ.js → use-activity-panel-cGCIgDHR.js} +1 -1
  95. package/dist/public/assets/{use-apply-config-color-theme-CFCI2GNF.js → use-apply-config-color-theme-Ds1FD3HK.js} +1 -1
  96. package/dist/public/assets/{use-collab-url-DEYfnaMS.js → use-collab-url-Cy83Ius9.js} +1 -1
  97. package/dist/public/assets/{use-live-xterm-theme-BFOnU-eC.js → use-live-xterm-theme-DaoAg9zj.js} +1 -1
  98. package/dist/public/assets/{use-open-skill-D21lvadY.js → use-open-skill-BJdJacrt.js} +1 -1
  99. package/dist/public/assets/{use-settings-route-BoEnTMeF.js → use-settings-route-CJVQDwmj.js} +1 -1
  100. package/dist/public/assets/{use-skill-origin-DDhmkGv4.js → use-skill-origin-BSotwjrK.js} +1 -1
  101. package/dist/public/assets/{use-skills-D4lRvSJa.js → use-skills-C787R0nA.js} +1 -1
  102. package/dist/public/assets/{use-terminal-enabled-CTRJVZCQ.js → use-terminal-enabled-CGA4TB6i.js} +1 -1
  103. package/dist/public/assets/{use-timeline-entry-diff-uDSMtgCJ.js → use-timeline-entry-diff-C9r_zVID.js} +1 -1
  104. package/dist/public/assets/{use-workspace-BuMImy8_.js → use-workspace-rmOBMRnx.js} +1 -1
  105. package/dist/public/index.html +47 -47
  106. package/dist/public/uninstall.html +5 -5
  107. package/dist/{repair-launch-json-pD-V682S.mjs → repair-launch-json-FhJ1-gFe.mjs} +2 -2
  108. package/dist/{repair-mcp-configs-BztWuczT.mjs → repair-mcp-configs-CVOPExvD.mjs} +2 -2
  109. package/dist/repair-skills-BAuMFgEP.mjs +1 -0
  110. package/dist/{repair-skills-DD0pO9KG.mjs → repair-skills-Bc9E4eeA.mjs} +2 -2
  111. package/dist/{resolve-project-root-BmEYZjtQ.mjs → resolve-project-root-C8lkeQRG.mjs} +3 -3
  112. package/dist/server-lock-6JxF9TCZ.mjs +1 -0
  113. package/dist/{server-lock-_XWgcmNh.mjs → server-lock-D3VEPV5W.mjs} +2 -2
  114. package/dist/{skill-teardown-DJadYmS9.mjs → skill-teardown-CrI8hOjf.mjs} +2 -2
  115. package/dist/src-BYHpzYVs.mjs +1 -0
  116. package/dist/src-BjxleI-A.mjs +20 -0
  117. package/dist/{src-DifwZnFy.mjs → src-CADYcyVw.mjs} +400 -400
  118. package/dist/{src-B5PnzP5L.mjs → src-DI-4tHhA.mjs} +2 -2
  119. package/dist/src-DKJ4ztC7.mjs +1 -0
  120. package/dist/{start-D6zGIr_Q.mjs → start-BjlDf_Bu.mjs} +3 -3
  121. package/dist/start-Dbcx2ERQ.mjs +1 -0
  122. package/package.json +4 -4
  123. package/dist/constants-C7GcNmeI.mjs +0 -2
  124. package/dist/git-handle-CxBV0Wpn.mjs +0 -1
  125. package/dist/init-JcBDV_oY.mjs +0 -1
  126. package/dist/loader-B56L22Gi.mjs +0 -1
  127. package/dist/md-manager-BZ9HvsZ5.mjs +0 -2
  128. package/dist/preview-CD2IbfNk.mjs +0 -1
  129. package/dist/public/assets/DocumentContext-BAge_zSA.js +0 -38
  130. package/dist/public/assets/FeedbackForm-zVLbVP8X.js +0 -1
  131. package/dist/public/assets/ManagedArtifactProperties-BLA-YQZP.js +0 -1
  132. package/dist/public/assets/SessionsHost-DDc_pyiu.js +0 -2
  133. package/dist/public/assets/globals-DG05ucI2.css +0 -1
  134. package/dist/public/assets/i18n-DxXpBJoo.js +0 -1
  135. package/dist/public/assets/index-BxqdFknQ.js +0 -2196
  136. package/dist/public/assets/page-list-cache-DJODoSOh.js +0 -1
  137. package/dist/public/assets/thread-client-BpWutFry.js +0 -1
  138. package/dist/repair-skills-BKbFH2b2.mjs +0 -1
  139. package/dist/server-lock-CyzgE09K.mjs +0 -1
  140. package/dist/src-CNBY5GiX.mjs +0 -20
  141. package/dist/src-Db2adcph.mjs +0 -1
  142. package/dist/src-qYDMEf4S.mjs +0 -1
  143. package/dist/start-D8D6GD4Q.mjs +0 -1
  144. /package/dist/public/assets/{globals-CuEz5zF0.js → globals-DWxOaSHQ.js} +0 -0
@@ -1 +0,0 @@
1
- import{Bo as e,D as t,Es as n,Fo as r,Ho as i,Io as a,Ko as o,Lo as s,Ts as c,Uo as l,Ur as u,Zi as d,jo as f,js as p,ks as m,qo as h,zo as g}from"./dist-ClHGFbjP2.js";import{r as _}from"./doc-paths-DAr9Ew0q.js";import{o as v,r as y}from"./file-tree-utils-B2Axpvgc.js";function b(e){return e.scope===`project`?o(x(e)):l(e.scope,e.name,e.hostQualifier)}function x(e){return e.canonicalPath??e.path}function S(e,t){return e.scope===`project`?`${x(e).replace(/\/SKILL\.mdx?$/i,``)}/${o(t)}`:i(e.scope,e.name,t,e.hostQualifier)}function C(e){let t=s(e);return t?.kind===`skill`?t.name:null}function w(e){let t=e.trim();return{normalizedTarget:t.replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\/+$/g,``),expectsFolder:/\/+$/.test(t)}}function T(e){return _(e).replace(/\/+$/g,``)}function E(e){let t=new Set;for(let n of e)for(let e of y(n))t.add(e);return t}function D(e,t){if(!t)return;let n=d(e);if(n)return t.get(n)}function O(e,t){if(!t||e.includes(`/`))return;let n=d(e);if(n)return t.get(n)}function k(e,t){return t?`${e}${t}`:(e.split(`/`).pop()??``).lastIndexOf(`.`)>0?e:`${e}.md`}function A(e,t){if(!v(e)||g(e)||t.pages.has(e))return null;let n=k(e,t.docExt);return{kind:`asset`,target:n,assetPath:n,mediaKind:p(n.slice(n.lastIndexOf(`.`)+1))}}function j(t,i){if(f(t)){let n=a(t);if(n?.kind===`skill`&&n.scope===`project`){let t=e(n.name);return{kind:`doc`,target:t,docName:t}}let i=r(t);if(i){let e=h(i.folder,i.name);return{kind:`doc`,target:e,docName:e}}return{kind:`doc`,target:t,docName:t}}if(C(t))return{kind:`doc`,target:t,docName:t};let o=g(t);if(o){let e=h(o.folder,o.name);return{kind:`doc`,target:e,docName:e}}let{normalizedTarget:s,expectsFolder:l}=w(t);if(!s)return{kind:`missing`,target:s};if(!l&&(m(s)||n(s)||c(s)))return{kind:`doc`,target:s,docName:s};let u=T(t);if(!l&&i.pages.has(s))return{kind:`doc`,target:s,docName:s};if(!l&&u!==s&&i.pages.has(u))return{kind:`doc`,target:u,docName:u};if(!l){let e=D(u,i.pagesBySlug);if(e)return{kind:`doc`,target:e,docName:e}}let d=`${u}/index`;if(i.pages.has(d))return{kind:`folder-index`,target:u,folderPath:u,docName:d,noteKind:`canonical-index`};let p=u.split(`/`).pop(),_=p?`${u}/${p}`:null;if(_&&i.pages.has(_))return{kind:`folder-index`,target:u,folderPath:u,docName:_,noteKind:`legacy-folder-note`};if(!l){let e=O(u,i.pagesByBasename);if(e)return{kind:`doc`,target:e,docName:e}}if((i.folderPaths??E(i.pages)).has(u))return{kind:`folder`,target:u,folderPath:u};if(!l){let e=A(s,i);if(e)return e}return{kind:`missing`,target:u||s}}function M(e){return e.kind===`folder-index`?{kind:`folder`,target:e.folderPath,folderPath:e.folderPath}:e}function N(e,n,r=t){return typeof n!=`number`||!u(n,r)?null:{kind:`large-file`,target:e,docName:e,size:n,limit:r}}function P(e,n,r=t){return e.kind!==`doc`&&e.kind!==`folder-index`?e:N(e.docName,n.get(e.docName)?.size,r)??e}function F(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return e.docName;case`missing`:return e.target;case`asset`:case`skill-file`:case`skills`:case`skill-preview`:case`folder`:return null}}var I=null,L=new Set;function R(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function z(e,t){return e===null?!1:e===t?!0:R(e.pages,t.pages)&&R(e.folderPaths,t.folderPaths)&&R(e.assetPaths??new Set,t.assetPaths??new Set)&&R(e.filePaths??new Set,t.filePaths??new Set)&&B(e.pageIcons,t.pageIcons)}function B(e,t){if(e===t)return!0;let n=e?.size??0;if(n!==(t?.size??0))return!1;if(n===0)return!0;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function V(e){let t=new Map;for(let[n,r]of e){let e=r.icon;typeof e==`string`&&e.trim()!==``&&t.set(n,e)}return t}function H(){return I}function U(e){if(!z(I,e)){I=e;for(let t of Array.from(L))try{t(e)}catch(e){console.error(`[page-list-cache] subscriber threw:`,e)}}}function W(e){if(L.add(e),I!==null)try{e(I)}catch(e){console.error(`[page-list-cache] subscriber threw on replay:`,e)}return()=>{L.delete(e)}}export{E as a,N as c,P as d,C as f,W as i,A as l,b as m,H as n,F as o,S as p,U as r,M as s,V as t,j as u};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import{n as r}from"./dist-CuH7ikCn.js";import{t as i}from"./dist-BIGNzOeF2.js";var a=n(),o=9e4,s=e(t(),1),c=`ok-acp-agent-settings-v1`;function l(e){return`${e.source}:${e.id}`}function u(){try{let e=localStorage.getItem(c);if(e===null)return{};let t=JSON.parse(e);return typeof t==`object`&&t?t:{}}catch{return{}}}function d(e){try{localStorage.setItem(c,JSON.stringify(e))}catch(e){console.warn(`[acp-settings] could not persist agent settings`,e)}}function f(e,t,n){let r=u(),i=r[e]??{};r[e]={...i,config:{...i.config,[t]:n}},d(r)}function p(e){let t=u()[e]?.config;if(typeof t!=`object`||!t)return;let n={};for(let[e,r]of Object.entries(t))(typeof r==`string`||typeof r==`boolean`)&&(n[e]=r);return Object.keys(n).length>0?n:void 0}function m(e,t){if(t===``)return;let n=u();n[e]={...n[e]??{},modeId:t},d(n)}function h(e){let t=u()[e]?.modeId;return typeof t==`string`&&t!==``?t:void 0}var g=64e3;function _(e){if(typeof e!=`object`||!e)return null;let t=e;return t.type===`text`&&typeof t.text==`string`?t.text:null}function v(e){return e!==null&&(e.reason===`connect`||e.reason===`session-setup`||e.reason===`auth-required`)}var y=class{items=[];plan=[];turnActive=!1;tokenUsage=null;terminals={};toolCallIndex=new Map;permissionIndex=new Map;permissionByToolCall=new Map;permissionsByToolCall={};messageIndex=new Map;runtimeConsentIndex=new Map;piBridgeIndex=new Map;lastConsentIndex=null;appliedCount=0;dirty=!1;snapshot={items:[],plan:[],turnActive:!1,tokenUsage:null,terminals:{},permissionsByToolCall:{}};sync(e){e.length<this.appliedCount&&this.reset();for(let t=this.appliedCount;t<e.length;t++)this.applyEvent(e[t]);return this.appliedCount=e.length,this.dirty&&=(this.snapshot={items:[...this.items],plan:this.plan,turnActive:this.turnActive,tokenUsage:this.tokenUsage,terminals:{...this.terminals},permissionsByToolCall:{...this.permissionsByToolCall}},!1),this.snapshot}reset(){this.items=[],this.plan=[],this.turnActive=!1,this.tokenUsage=null,this.terminals={},this.toolCallIndex=new Map,this.permissionIndex=new Map,this.permissionByToolCall=new Map,this.permissionsByToolCall={},this.messageIndex=new Map,this.runtimeConsentIndex=new Map,this.piBridgeIndex=new Map,this.lastConsentIndex=null,this.appliedCount=0,this.dirty=!0}applyEvent(e){switch(this.dirty=!0,e.kind){case`user_message`:{let t={kind:`message`,role:`user`,text:e.content,messageId:`user-${this.items.length}`};e.attachments!==void 0&&e.attachments.length>0&&(t.attachments=e.attachments),this.items.push(t),this.messageIndex.clear();break}case`turn_started`:this.turnActive=!0;break;case`turn_ended`:this.turnActive=!1,this.messageIndex.clear();break;case`status`:if(e.status===`exited`&&(this.turnActive=!1),this.lastConsentIndex!==null){let t=this.items[this.lastConsentIndex];t?.kind===`runtime_consent`&&t.install===`running`&&(e.status===`spawning`||e.status===`ready`||e.status===`running`?this.items[this.lastConsentIndex]={...t,install:`done`}:(e.status===`error`||e.status===`exited`)&&(this.items[this.lastConsentIndex]={...t,install:`failed`}))}if(e.status===`ready`)for(let e=0;e<this.items.length;e+=1){let t=this.items[e];t?.kind===`notice`&&t.superseded!==!0&&v(t.failure)&&(this.items[e]={...t,superseded:!0})}if((e.status===`error`||e.status===`auth_required`)&&(e.failure!==void 0||(e.detail??``)!==``)){let t={kind:`notice`,text:e.detail??``,tone:e.status===`error`?`error`:`info`,failure:e.failure??null,attempts:1},n=this.items[this.items.length-1];n?.kind===`notice`&&n.superseded!==!0&&C(n,t)?this.items[this.items.length-1]={...n,attempts:n.attempts+1}:this.items.push(t)}break;case`permission_request`:{let t=e.toolCall.toolCallId??null,n={kind:`permission`,requestId:e.requestId,title:e.toolCall.title??i._({id:`Ya3PlJ`}),toolKind:e.toolCall.kind??`other`,options:e.options,resolved:null,toolCallId:t,mergedIntoToolCall:t!==null&&this.toolCallIndex.has(t)};this.permissionIndex.set(e.requestId,this.items.length),t!==null&&(this.permissionByToolCall.set(t,this.items.length),this.permissionsByToolCall[t]=n),this.items.push(n);break}case`permission_resolved`:{let t=this.permissionIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`permission`)break;let r={...n,resolved:{optionId:e.optionId,auto:e.auto}};this.items[t]=r,r.toolCallId!==null&&(this.permissionsByToolCall[r.toolCallId]=r);break}case`runtime_consent_request`:this.runtimeConsentIndex.set(e.requestId,this.items.length),this.lastConsentIndex=this.items.length,this.items.push({kind:`runtime_consent`,requestId:e.requestId,runtime:e.runtime,displayName:e.displayName,provides:e.provides,version:e.version,approxSizeMB:e.approxSizeMB,sourceHost:e.sourceHost,agentName:e.agentName,reason:e.reason??`missing`,resolved:null,install:null,progress:null});break;case`runtime_consent_resolved`:{let t=this.runtimeConsentIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`runtime_consent`)break;this.items[t]={...n,resolved:e.decision,install:e.decision===`granted`?`running`:null};break}case`pi_bridge_consent_request`:this.piBridgeIndex.set(e.requestId,this.items.length),this.items.push({kind:`pi_bridge`,row:`prompted`,prompt:{requestId:e.requestId,agentName:e.agentName,cwd:e.cwd,otherExtensions:e.otherExtensions??[]},bridgePath:e.bridgePath,decision:null,outcome:null});break;case`pi_bridge_consent_resolved`:{let t=this.piBridgeIndex.get(e.requestId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`pi_bridge`)break;this.items[t]={...n,decision:e.decision};break}case`pi_bridge_status`:{let t={state:e.state,detail:e.detail??null},n=e.requestId===void 0?void 0:this.piBridgeIndex.get(e.requestId),r=n===void 0?void 0:this.items[n];if(n!==void 0&&r?.kind===`pi_bridge`){this.items[n]={...r,outcome:t};break}this.items.push({kind:`pi_bridge`,row:`notice`,prompt:null,bridgePath:e.bridgePath,decision:null,outcome:t});break}case`runtime_install_progress`:{if(this.lastConsentIndex===null)break;let t=this.items[this.lastConsentIndex];if(t===void 0||t.kind!==`runtime_consent`)break;this.items[this.lastConsentIndex]={...t,progress:{receivedBytes:e.receivedBytes??0,totalBytes:e.totalBytes??null}};break}case`terminal_created`:this.terminals[e.terminalId]={terminalId:e.terminalId,command:e.command,args:e.args,output:``,truncated:!1,exit:null};break;case`terminal_output`:{let t=this.terminals[e.terminalId];if(t===void 0)break;let n=t.output+e.chunk,r=t.truncated;n.length>g&&(n=n.slice(-g),r=!0),this.terminals[e.terminalId]={...t,output:n,truncated:r};break}case`terminal_exit`:{let t=this.terminals[e.terminalId];if(t===void 0)break;this.terminals[e.terminalId]={...t,exit:{exitCode:e.exitCode,signal:e.signal}};break}case`session_update`:this.applyUpdate(e.update);break;default:break}}mergePermissionInto(e){let t=this.permissionByToolCall.get(e);if(t===void 0)return;let n=this.items[t];if(n===void 0||n.kind!==`permission`||n.mergedIntoToolCall)return;let r={...n,mergedIntoToolCall:!0};this.items[t]=r,this.permissionsByToolCall[e]=r}pushMessageChunk(e,t,n){let r=`${e}:${t}`,i=this.messageIndex.get(r);if(i!==void 0&&i===this.items.length-1){let e=this.items[i];this.items[i]={...e,text:e.text+n};return}this.messageIndex.set(r,this.items.length),this.items.push({kind:`message`,role:e,text:n,messageId:t})}applyUpdate(e){switch(e.sessionUpdate){case`agent_message_chunk`:{let t=_(e.content);t!==null&&this.pushMessageChunk(`agent`,x(e),t);break}case`agent_thought_chunk`:{let t=_(e.content);t!==null&&this.pushMessageChunk(`thought`,x(e),t);break}case`user_message_chunk`:{let t=_(e.content);t!==null&&this.pushMessageChunk(`user`,x(e),t);break}case`tool_call`:{let t={kind:`tool_call`,toolCallId:e.toolCallId,title:e.title??i._({id:`EvIJVD`}),toolKind:e.kind??`other`,status:e.status??`pending`,diffs:[],terminalIds:[],content:[],locations:S(e.locations),rawInput:e.rawInput};w(t,e.content),this.toolCallIndex.set(e.toolCallId,this.items.length),this.items.push(t),this.mergePermissionInto(e.toolCallId);break}case`tool_call_update`:{let t=this.toolCallIndex.get(e.toolCallId);if(t===void 0)break;let n=this.items[t];if(n.kind!==`tool_call`)break;let r={...n,diffs:[...n.diffs],terminalIds:[...n.terminalIds],content:[...n.content]};e.status&&(r.status=e.status),e.title&&(r.title=e.title),e.locations&&(r.locations=S(e.locations));let i=e.rawInput;i!==void 0&&(r.rawInput=i),w(r,e.content),this.items[t]=r;break}case`plan`:{let t=e.entries;Array.isArray(t)&&(this.plan=t.map(e=>e).filter(e=>typeof e.content==`string`).map(e=>({content:e.content,priority:typeof e.priority==`string`?e.priority:void 0,status:typeof e.status==`string`?e.status:void 0})));break}case`usage_update`:{let t=e;this.tokenUsage={used:typeof t.used==`number`?t.used:void 0,size:typeof t.size==`number`?t.size:void 0};break}default:{let t=e.usage;t!==void 0&&(this.tokenUsage={used:t.used,size:t.size});break}}}};function b(e){let t=e.resolved;if(t===null)return null;if(t.optionId===null)return t.auto?{kind:`dismissed`}:{kind:`denied`,auto:!1,optionName:null};let n=e.options.find(e=>e.optionId===t.optionId);if(n===void 0)return{kind:`dismissed`};let r=n.kind.startsWith(`reject`),i=n.kind.startsWith(`allow`);return!r&&!i?{kind:`dismissed`}:{kind:r?`denied`:`approved`,auto:t.auto,optionName:n.name}}function x(e){let t=e.messageId;return typeof t==`string`?t:`default`}function S(e){return Array.isArray(e)?e.map(e=>e).filter(e=>typeof e.path==`string`).map(e=>({path:e.path,line:typeof e.line==`number`?e.line:void 0})):[]}function C(e,t){return!(e.tone!==t.tone||e.text!==t.text||e.failure===null!=(t.failure===null)||e.failure!==null&&t.failure!==null&&(e.failure.reason!==t.failure.reason||(e.failure.agentMessage??``)!==(t.failure.agentMessage??``)||(e.failure.machineDetail??``)!==(t.failure.machineDetail??``)))}function w(e,t){if(Array.isArray(t))for(let n of t){let t=n;if(t.type===`diff`&&typeof t.path==`string`&&typeof t.newText==`string`)e.diffs.push({path:t.path,oldText:typeof t.oldText==`string`?t.oldText:null,newText:t.newText});else if(t.type===`terminal`&&typeof t.terminalId==`string`)e.terminalIds.includes(t.terminalId)||e.terminalIds.push(t.terminalId);else if(t.type===`content`){let n=_(t.content);n!==null&&e.content.push(n)}else{let n=_(t);n!==null&&e.content.push(n)}}}var T=500,E=15e3,D=3e4,O=o,k=o,A=18e4,j=8e3,M=1e4,N=class extends Error{code;constructor(e,t){super(t),this.name=`ThreadResumeError`,this.code=e}},P=class extends Error{constructor(){super(`agent-thread channel is not connected`),this.name=`ThreadChannelUnavailableError`}},F=class{url=null;ws=null;reconnectDelay=T;reconnectTimer=null;threads=new Map;listeners=new Set;pendingCreates=new Map;pendingResumes=new Map;pendingRetries=new Map;pendingAuths=new Map;pendingQueueEdits=new Map;openedArchived=new Set;reqCounter=0;status=`idle`;version=0;setUrl(e){e!==this.url&&(this.url=e,this.teardownSocket(),e===null?this.setStatus(`idle`):this.connect())}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));threadsSnapshot=[];threadsSnapshotVersion=-1;getThreads=()=>(this.threadsSnapshotVersion!==this.version&&(this.threadsSnapshot=[...this.threads.values()].map(e=>e.info).sort((e,t)=>e.createdAt-t.createdAt),this.threadsSnapshotVersion=this.version),this.threadsSnapshot);openTabsSnapshot=[];openTabsSnapshotVersion=-1;getOpenTabs=()=>(this.openTabsSnapshotVersion!==this.version&&(this.openTabsSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived!==!0||this.openedArchived.has(e.threadId)).sort((e,t)=>e.createdAt-t.createdAt),this.openTabsSnapshotVersion=this.version),this.openTabsSnapshot);archivedSnapshot=[];archivedSnapshotVersion=-1;getArchivedThreads=()=>(this.archivedSnapshotVersion!==this.version&&(this.archivedSnapshot=[...this.threads.values()].map(e=>e.info).filter(e=>e.archived===!0).sort((e,t)=>t.lastActivityAt-e.lastActivityAt),this.archivedSnapshotVersion=this.version),this.archivedSnapshot);getThread=e=>this.threads.get(e)??null;modelBuilders=new Map;getThreadModel=e=>{let t=this.threads.get(e);if(t===void 0)return null;let n=this.modelBuilders.get(e);return n===void 0&&(n=new y,this.modelBuilders.set(e,n)),n.sync(t.events)};getConnectionStatus=()=>this.status;async createThread(e){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let t=`create-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingCreates.delete(t),n(Error(`thread creation timed out`))},D);this.pendingCreates.set(t,{resolve:e,reject:n,timer:r})}),r=l(e.agent),i=p(r),a=h(r),o=i!==void 0||a!==void 0?{...i===void 0?{}:{config:i},...a===void 0?{}:{modeId:a}}:void 0;return this.send({op:`create`,reqId:t,...e,...o===void 0?{}:{settings:o}}),n}prompt(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`prompt`,threadId:e,reqId:`prompt-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}steer(e,t,n){let r=t.trim(),i=n!==void 0&&n.length>0;r===``&&!i||(this.reqCounter+=1,this.send({op:`steer`,threadId:e,reqId:`steer-${this.reqCounter}`,content:r,...i?{attachments:n}:{}}))}editQueued(e,t,n){let r=n.trim();if(r===``)return Promise.resolve();this.reqCounter+=1;let i=`queue-edit-${this.reqCounter}`,a=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingQueueEdits.delete(i),e()},M);this.pendingQueueEdits.set(i,{resolve:e,reject:t,timer:n})});return this.send({op:`queue_edit`,threadId:e,id:t,content:r,reqId:i}),a}holdQueued(e,t,n){this.send({op:`queue_hold`,threadId:e,id:t,held:n})}removeQueued(e,t){this.send({op:`queue_remove`,threadId:e,id:t})}respondPermission(e,t,n){this.send({op:`permission_response`,threadId:e,requestId:t,outcome:n})}respondRuntimeConsent(e,t,n){this.send({op:`runtime_consent_response`,threadId:e,requestId:t,outcome:n})}respondPiBridgeConsent(e,t,n){this.send({op:`pi_bridge_consent_response`,threadId:e,requestId:t,outcome:n})}cancel(e){this.send({op:`cancel`,threadId:e})}setMode(e,t){this.send({op:`set_mode`,threadId:e,modeId:t})}renameThread(e,t){let n=t.trim();n!==``&&this.send({op:`rename`,threadId:e,title:n})}setConfigOption(e,t,n){this.send({op:`set_config_option`,threadId:e,configId:t,value:n})}closeThread(e){let t=this.threads.get(e);if(t?.info.archived===!0){this.send({op:`unsubscribe`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.set(e,{info:t.info,events:[],lastSeq:-1}),this.bump();return}this.send({op:`close`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}openArchivedThread(e){let t=this.threads.get(e);t===void 0||t.info.archived!==!0||this.openedArchived.has(e)||(this.openedArchived.add(e),this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1}),this.bump())}deleteThread(e){this.send({op:`delete`,threadId:e}),this.openedArchived.delete(e),this.modelBuilders.delete(e),this.threads.delete(e)&&this.bump()}async resumeThread(e,t,n){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let r=`resume-${this.reqCounter}`,i=new Promise((e,t)=>{let n=setTimeout(()=>{this.pendingResumes.delete(r),t(new N(`timeout`,`resume timed out`))},O);this.pendingResumes.set(r,{resolve:e,reject:t,timer:n})});return this.send({op:`resume`,threadId:e,reqId:r,prompt:t,...n!==void 0&&n.length>0?{attachments:n}:{}}),i}async retryThread(e){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let t=`retry-${this.reqCounter}`,n=new Promise((e,n)=>{let r=setTimeout(()=>{this.pendingRetries.delete(t),n(Error(`retry timed out`))},k);this.pendingRetries.set(t,{resolve:e,reject:n,timer:r})});return this.send({op:`retry`,threadId:e,reqId:t}),n}async authenticateThread(e,t){this.connectNow(),await this.waitForOpen(j),this.reqCounter+=1;let n=`authenticate-${this.reqCounter}`,r=new Promise((e,t)=>{let r=setTimeout(()=>{this.pendingAuths.delete(n),t(Error(`sign-in timed out`))},A);this.pendingAuths.set(n,{resolve:e,reject:t,timer:r})});return this.send({op:`authenticate`,threadId:e,reqId:n,methodId:t}),r}connectNow(){this.url===null||this.ws!==null||(this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectDelay=T,this.connect())}waitForOpen(e){return this.ws!==null&&this.ws.readyState===WebSocket.OPEN?Promise.resolve():new Promise((t,n)=>{let r=e=>{clearTimeout(a),i(),e?t():n(new P)},i=this.subscribe(()=>{this.ws!==null&&this.ws.readyState===WebSocket.OPEN&&r(!0)}),a=setTimeout(()=>r(!1),e)})}connect(){if(this.url===null)return;this.setStatus(`connecting`);let e;try{e=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=e,e.onopen=()=>{if(this.ws===e){this.reconnectDelay=T,this.setStatus(`open`),this.send({op:`list`});for(let[e,t]of this.threads)t.info.archived===!0&&!this.openedArchived.has(e)||this.send({op:`subscribe`,threadId:e,sinceSeq:t.lastSeq+1})}},e.onmessage=t=>{if(this.ws!==e||typeof t.data!=`string`)return;let n;try{n=JSON.parse(t.data)}catch{return}this.handleFrame(n)},e.onclose=()=>{this.ws===e&&(this.ws=null,this.setStatus(`closed`),this.scheduleReconnect())},e.onerror=()=>{}}teardownSocket(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);for(let e of this.pendingCreates.values())clearTimeout(e.timer),e.reject(new P);this.pendingCreates.clear();for(let e of this.pendingResumes.values())clearTimeout(e.timer),e.reject(new P);this.pendingResumes.clear();for(let e of this.pendingRetries.values())clearTimeout(e.timer),e.reject(new P);this.pendingRetries.clear();for(let e of this.pendingAuths.values())clearTimeout(e.timer),e.reject(new P);this.pendingAuths.clear();for(let e of this.pendingQueueEdits.values())clearTimeout(e.timer),e.resolve();this.pendingQueueEdits.clear();let e=this.ws;if(this.ws=null,e!==null)try{e.close()}catch{}}scheduleReconnect(){if(this.url===null||this.reconnectTimer!==null)return;let e=this.reconnectDelay;this.reconnectDelay=Math.min(this.reconnectDelay*2,E),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}send(e){let t=this.ws;if(!(t===null||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify(e))}catch{}}handleFrame(e){switch(e.op){case`created`:{let t=this.pendingCreates.get(e.reqId);t!==void 0&&(this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`threads`:{let t=new Set;for(let n of e.threads){t.add(n.threadId);let e=this.threads.has(n.threadId);this.upsertInfo(n),!e&&n.archived!==!0&&this.send({op:`subscribe`,threadId:n.threadId,sinceSeq:0})}let n=!1;for(let e of Array.from(this.threads.keys()))t.has(e)||(this.threads.delete(e),this.modelBuilders.delete(e),this.openedArchived.delete(e),n=!0);n&&this.bump();return}case`resumed`:{let t=this.pendingResumes.get(e.reqId);t!==void 0&&(this.pendingResumes.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`retried`:{let t=this.pendingRetries.get(e.reqId);t!==void 0&&(this.pendingRetries.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`authenticated`:{let t=this.pendingAuths.get(e.reqId);t!==void 0&&(this.pendingAuths.delete(e.reqId),clearTimeout(t.timer),t.resolve(e.info)),this.upsertInfo(e.info);return}case`subscribed`:this.upsertInfo(e.info);return;case`queue_edited`:{let t=this.pendingQueueEdits.get(e.reqId);t!==void 0&&(this.pendingQueueEdits.delete(e.reqId),clearTimeout(t.timer),t.resolve());return}case`info`:this.upsertInfo(e.info);return;case`event`:this.appendEvents(e.threadId,e.seq,[e.event]);return;case`events`:this.appendEvents(e.threadId,e.fromSeq,e.events);return;case`error`:if(e.reqId!==void 0){let t=this.pendingCreates.get(e.reqId);if(t!==void 0){this.pendingCreates.delete(e.reqId),clearTimeout(t.timer),t.reject(Error(e.message));return}let n=this.pendingResumes.get(e.reqId);if(n!==void 0){this.pendingResumes.delete(e.reqId),clearTimeout(n.timer),n.reject(new N(e.code,e.message));return}let a=this.pendingRetries.get(e.reqId);if(a!==void 0){this.pendingRetries.delete(e.reqId),clearTimeout(a.timer),a.reject(Error(e.message));return}let o=this.pendingAuths.get(e.reqId);if(o!==void 0){this.pendingAuths.delete(e.reqId),clearTimeout(o.timer),o.reject(Error(e.message));return}let s=this.pendingQueueEdits.get(e.reqId);if(s!==void 0){this.pendingQueueEdits.delete(e.reqId),clearTimeout(s.timer),s.reject(Error(e.message));return}if(e.reqId.startsWith(`prompt-`)||e.reqId.startsWith(`steer-`)){r.error(i._({id:`XNBGZw`,values:{0:e.message}}));return}}console.warn(`[agent-threads] server error frame:`,e.code,e.message);return;default:return}}appendEvents(e,t,n){let r=this.threads.get(e);if(r===void 0||n.length===0)return;let i=Math.max(r.lastSeq+1-t,0);if(i>=n.length)return;let a=i===0?n:n.slice(i),o=r.info;for(let e of a)o=I(o,e);this.threads.set(e,{info:o,events:[...r.events,...a],lastSeq:t+n.length-1}),this.bump()}upsertInfo(e){let t=this.threads.get(e.threadId);t===void 0?this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1}):e.archived===!0&&t.info.archived!==!0?(this.openedArchived.delete(e.threadId),this.modelBuilders.delete(e.threadId),this.threads.set(e.threadId,{info:e,events:[],lastSeq:-1})):this.threads.set(e.threadId,{...t,info:e}),this.bump()}setStatus(e){this.status!==e&&(this.status=e,this.bump())}bump(){this.version+=1;for(let e of this.listeners)e()}};function I(e,t){switch(t.kind){case`status`:return{...e,status:t.status,lastActivityAt:t.ts};case`title_changed`:return{...e,title:t.title,lastActivityAt:t.ts};default:return{...e,lastActivityAt:t.ts}}}var L=new F;function R(){return L}function z(){return(0,s.useSyncExternalStore)(L.subscribe,L.getOpenTabs,L.getOpenTabs)}function B(){return(0,s.useSyncExternalStore)(L.subscribe,L.getArchivedThreads,L.getArchivedThreads)}function V(e){let t=(0,a.c)(2),n;t[0]===e?n=t[1]:(n=()=>L.getThread(e),t[0]=e,t[1]=n);let r=n;return(0,s.useSyncExternalStore)(L.subscribe,r,r)}function H(e){let t=(0,a.c)(2),n;t[0]===e?n=t[1]:(n=()=>L.getThreadModel(e),t[0]=e,t[1]=n);let r=n;return(0,s.useSyncExternalStore)(L.subscribe,r,r)}function U(){return(0,s.useSyncExternalStore)(L.subscribe,L.getConnectionStatus,L.getConnectionStatus)}function W(e){if(e===null)return null;try{let t=new URL(e);return t.pathname=`/collab/thread`,t.search=``,t.toString()}catch{return null}}export{V as a,B as c,l as d,f,W as i,z as l,N as n,U as o,m as p,R as r,H as s,P as t,b as u};
@@ -1 +0,0 @@
1
- import{t as e}from"./repair-skills-DD0pO9KG.mjs";export{e as repairSkills};
@@ -1 +0,0 @@
1
- import{i as e,o as t,s as n}from"./server-lock-_XWgcmNh.mjs";export{e as markServerLockDraining,t as releaseServerLock,n as updateServerLockPort};
@@ -1,20 +0,0 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-BZo73vVn.mjs";import{Bc as i,Do as a,Fc as o,Pc as s,lt as c,ut as l,zc as u}from"./src-B5PnzP5L.mjs";import{Ri as d,ct as f,di as p,kn as m,lt as h,ot as g,st as ee}from"./src-DifwZnFy.mjs";import{D as _,F as v,I as y,k as b}from"./fs-traced-Cu6kXy54.mjs";import{C as x,S,_ as C,f as w,r as T}from"./server-lock-_XWgcmNh.mjs";import{t as E}from"./yazl-DejPO9b3.mjs";import{h as D,m as te,x as ne}from"./resolve-project-root-BmEYZjtQ.mjs";import{c as O}from"./colors-DSyAT9Cz.mjs";import{a as k,i as re}from"./acp-harness-probe-DRbySBVr.mjs";import{D as ie,E as A,S as ae,T as j,_ as oe,b as se,o as ce}from"./init-44bY7bDu.mjs";import{n as le}from"./constants-C7GcNmeI.mjs";import{t as M}from"./is-object-Bw0-z8qH.mjs";import"./loader-Bqy2LPc4.mjs";import"./skill-teardown-DJadYmS9.mjs";import"./preview-CBcNW71i.mjs";import{execSync as ue,spawnSync as de}from"node:child_process";import{basename as N,dirname as P,join as F,relative as fe,resolve as I,sep as pe}from"node:path";import{cpSync as me,createWriteStream as he,existsSync as L,lstatSync as ge,mkdirSync as R,mkdtempSync as _e,readFileSync as z,readdirSync as B,readlinkSync as ve,rmSync as ye,statSync as be,writeFileSync as V}from"node:fs";import{arch as xe,freemem as Se,homedir as H,hostname as Ce,platform as we,release as Te,tmpdir as Ee,totalmem as De,type as Oe,uptime as ke}from"node:os";import"node:fs/promises";import{createHash as Ae}from"node:crypto";var je=n();const Me=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ne(e,t,n=m){if(e!==void 0&&!Me.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Pe=null;function Fe(e){Pe=e}function Ie(){return Pe??process.cwd()}function U(){return F(H(),`.ok`,`bug-reports`)}function Le(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=U(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Re(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?Ae(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function ze(){let e={timestamp:new Date().toISOString(),platform:we(),osType:Oe(),osRelease:Te(),hostname:`[redacted]`,uptime:ke(),freeMem:Se(),totalMem:De(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ue(`sw_vers -productVersion 2>/dev/null`,d({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}const Be=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function Ve(e){let t=N(e);return Be.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function He(e,t){return Ke(e,t).files}const Ue=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function We(e,t=k){let n=F(e,`${t}.ShipIt`);return L(n)?Ue.map(e=>F(n,e)).filter(e=>L(e)):[]}function Ge(e){if(!L(e))return[];try{let t=new Map;for(let n of B(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-u.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>F(e,t))}catch{return[]}}function Ke(e,t){if(!L(t))return{files:[],excludedByProjectSlug:0};let n=B(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(Ve),i=[],a=r.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!Ve(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function qe(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,c].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Je(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ye(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=o(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{Ye({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Xe(t){let{redact:n,outputPath:r,logger:a}=t,o=t.userLogsDir??F(H(),`.ok`,`logs`),c=t.projectDir?Re(t.projectDir,a):null;R(P(r),{recursive:!0}),a?.info({projectSlug:c},`gathering diagnostic data`);let l=ze();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:d}=Ke(c,o),{files:f}=t.projectDir?qe(t.projectDir):{files:[]},{files:p}=t.projectDir?Je(t.projectDir):{files:[]},m=t.shipItLogFiles??[];a?.info({logFileCount:u.length,logFilesExcludedByProjectSlug:d,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length},`files collected`);let h=[],g=[],{ZipFile:ee}=await import(`./yazl-BwMlCqRQ.mjs`).then(t=>e(t.default,1)),_=new ee;W({zipfile:_,files:[...u,...m],prefix:`logs`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:f,prefix:`lockdir`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:p,prefix:`local-logs`,redact:n,bundleFiles:g,redactions:h,logger:a}),W({zipfile:_,files:t.bugReportLedgerFiles??[],prefix:i,redact:n,bundleFiles:g,redactions:h,logger:a});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;_.addBuffer(t,n),g.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ye({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:g,redactions:h});let v=JSON.stringify(l,null,2);_.addBuffer(Buffer.from(v,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let y={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:c,files:g,redactions:h,sysinfo:l};_.addBuffer(Buffer.from(JSON.stringify(y,null,2),`utf8`),`MANIFEST.json`);let b=h.reduce((e,t)=>e+t.lineCount,0),x=new Set(m.map(e=>`logs/${N(e)}`)),S=g.filter(e=>x.has(e)),C=new Set((t.bugReportLedgerFiles??[]).map(e=>`${i}/${N(e)}`)),w=g.filter(e=>C.has(e)),T=c?g.filter(e=>e.startsWith(`logs/`)&&!Ve(e)&&!x.has(e)):[],E=[`# Bug Report Bundle`,``,`Generated: ${y.generatedAt}`,`Project: ${c??`(unscoped)`}`,`Discipline version: ${y.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...T.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...T.map(e=>`- ${e}`),``]:[],...S.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...S.map(e=>`- ${e}`),``]:[],...w.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...w.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${s.join(`, `)}`,b>0?`${b} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
2
- `);_.addBuffer(Buffer.from(E,`utf8`),`README.md`),_.end();let D=he(r);return _.outputStream.pipe(D),await new Promise((e,t)=>{D.on(`close`,e),D.on(`error`,t)}),a?.info({bundlePath:r,fileCount:g.length,redactionCount:b},`bundle written`),{zipPath:r,summary:{projectSlug:c,files:g,redactions:h,redactedLineCount:b,generatedAt:y.generatedAt}}}var Ze=e(E(),1),G=e(O(),1);function Qe(e){return y({absPath:b(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function $e({home:e=H(),env:n=process.env}={}){let i=Qe(e),{override:o,preferenceList:s}=_(n),{locale:c,source:l}=a({override:o,storedPreference:i,supportedLocales:r,preferenceList:s,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:s}}function et(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function tt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return et(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!tt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=K(i,t);return n}function nt(e,t){let n=z(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
- `),i=n.split(`
4
- `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=K(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}V(e,r?`${a.join(`
5
- `)}\n`:a.join(`
6
- `))}function rt(e,t){let n=z(e,`utf-8`);if(n.trim().length!==0)try{let r=K(JSON.parse(n),t),i=n.endsWith(`
7
- `)?`
8
- `:``;V(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=et(n,t.contentDir);r!==n&&V(e,r)}}function it(e,t){let n=z(e,`utf-8`),r=et(n,t.contentDir);r!==n&&V(e,r)}function at(e){try{return B(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>F(e,t.name))}catch{return[]}}const ot=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function st(e){return/\.log\.\d+$/.test(e)}function ct(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||st(e)}function lt(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of at(F(e.stagingDir,n)))ct(r)?nt(r,t):r.endsWith(`.json`)?rt(r,t):it(r,t);for(let n of at(F(e.stagingDir,`state`))){let e=N(n);n.endsWith(`.jsonl`)?nt(n,t):ot.has(e)?rt(n,t):it(n,t)}}const ut=[`.ok`,`local`,`telemetry`],dt=[`.ok`,`local`,`logs`],ft=[`.ok`,`local`,`loss-capture`],pt=`spans-current.jsonl`,mt=`spans-prev.jsonl`,ht=`server-current.jsonl`,gt=`server-prev.jsonl`,_t=`loss-current.jsonl`,vt=`loss-prev.jsonl`;function yt(e){return F(e,...ut,pt)}function bt(e){return F(e,...ut,mt)}function xt(e){return F(e,...dt,ht)}function St(e){return F(e,...dt,gt)}function Ct(e){return F(e,...ft,_t)}function wt(e){return F(e,...ft,vt)}const Tt=1e3;async function Et(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Tt)});return t.ok?await t.text():null}catch{return null}}async function Dt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Tt)});return t.ok?await t.text():null}catch{return null}}async function Ot(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Tt)});return t.ok?await t.text():null}catch{return null}}function kt(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
9
- `)}\n`:null}catch{return null}}function At(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=de(`git`,[`-C`,t,`log`,`--oneline`,`-50`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function jt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=de(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Mt(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Nt(){return{nodeVersion:process.version,platform:we(),arch:xe()}}function Pt(){return process.env.OTEL_SDK_DISABLED===`false`}function q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ft(e){if(!L(e))return{};let t;try{t=(0,je.parse)(z(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q(t))return{};let n=t.telemetry;if(!q(n))return{};let r=n.localSink;return q(r)?r:{}}function It(e){return typeof e==`boolean`?e:void 0}function Lt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function J(e){if(q(e))return Lt(e.maxBytes)}function Rt(e){let t=Ft(b(`project`,e)),n=Ft(b(`project-local`,e));return{enabled:It(n.enabled)??It(t.enabled)??!0,spansMaxBytes:J(n.spans)??J(t.spans)??52428800,logsMaxBytes:J(n.logs)??J(t.logs)??26214400}}function zt(e){return Ae(`sha256`).update(e).digest(`hex`)}function Bt(e){let t=z(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Vt(e){let t=z(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function Y(e,t){if(!L(e))return!1;try{return R(P(t),{recursive:!0}),me(e,t),!0}catch{return!1}}function Ht(e){let t=[],n=e=>{let r=B(e,{withFileTypes:!0});for(let i of r){let r=F(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Ut=new Set([`.jsonl`]);function Wt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Ut.has(e.slice(t))}const Gt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`]);function Kt(e){if(st(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Gt.has(e.slice(t))}function qt(e){let t=[];for(let n of Ht(e)){let r=Jt(e,n);if(!Kt(r))continue;let{redacted:i,patterns:a,lineCount:s}=o(z(n,`utf-8`));a.length!==0&&(V(n,i),t.push({file:r,lineCount:s,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Jt(e,t){return fe(e,t).split(pe).join(`/`)}async function Yt(e){let t=I(e.contentDir),n=I(e.projectDir??e.contentDir),r=e.deps??{},a=r.fetchAgentPresence??Et,o=r.fetchAgentEffects??Dt,s=r.fetchWatcherRecent??Ot,u=r.readShadowHead??At,d=r.readCheckpointRefs??jt,f=r.now??(()=>new Date),p=r.okVersion??(()=>le),m=r.readDesktopEnv??Mt,h=r.readLanguage??$e,g=r.readRuntime??Nt,ee=r.isOtlpPushEnabled??Pt,_=_e(F(Ee(),`ok-bundle-`));try{R(F(_,`telemetry`),{recursive:!0}),R(F(_,`logs`),{recursive:!0}),R(F(_,`state`),{recursive:!0}),Y(yt(n),F(_,`telemetry`,pt)),Y(bt(n),F(_,`telemetry`,mt)),Y(xt(n),F(_,`logs`,ht)),Y(St(n),F(_,`logs`,gt));for(let t of e.userLogFiles??[])Y(t,F(_,`logs`,N(t)));for(let t of e.userStateFiles??[])Y(t,F(_,i,N(t)));let v=F(n,`.ok`,`local`),y=F(v,`server.lock`),b=`not-running`,x=`no server.lock`,S=null;if(L(y)){Y(y,F(_,`state`,`server.lock`));try{let e=z(y,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?S=t.port:x=`lock present but no port`}catch{x=`lock present but unparseable`}}if(S!==null){let e=await a(S);e===null?x=`agent-presence endpoint at :${S} unreachable`:(V(F(_,`state`,`agent-presence.json`),e),b=`running`,x=``);let t=await o(S);t!==null&&V(F(_,`state`,`agent-effects.json`),t);let n=await s(S);if(n!==null){let e=kt(n);e!==null&&V(F(_,`state`,`watcher-recent.jsonl`),e)}}let C=u(t);C!==null&&V(F(_,`state`,`shadow-head.txt`),C);let w=d(t);w!==null&&V(F(_,`state`,`checkpoint-refs.txt`),w),Y(Ct(n),F(_,`state`,_t)),Y(wt(n),F(_,`state`,vt)),Y(F(v,`last-spawn-error.log`),F(_,`state`,`last-spawn-error.log`)),Y(F(v,l),F(_,`state`,l)),Y(F(v,c),F(_,`state`,c));let T=g(),E=m(),D=h(),te={ok:{version:p(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:E,language:D}};V(F(_,`state`,`runtime.json`),`${JSON.stringify(te,null,2)}\n`);let ne=b===`running`?`running
10
- `:`not-running (${x})\n`;if(V(F(_,`state`,`server-status.txt`),ne),e.processDir&&L(e.processDir)){let t=F(_,`process`);R(t,{recursive:!0}),me(e.processDir,t,{recursive:!0})}let O=e.redact===!0;O&&lt({stagingDir:_,contentDir:t}),e.note&&V(F(_,`note.txt`),e.note);let k=null;e.scrubSecrets===!0&&(k=qt(_));for(let t of e.extraFiles??[])Y(t.sourcePath,F(_,`extra`,t.zipName??N(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let re=Rt(n),ie=Ht(_),A=[],ae=0,j=0;for(let e of ie){let t=Jt(_,e),n=be(e).size,r=Wt(t)?Bt(e):0;A.push({path:t,bytes:n,lines:r}),ae+=n,t.startsWith(`telemetry/`)&&Wt(t)&&(j+=Vt(e))}let oe={applied:O};k!==null&&(oe.secretScrub=k);let se={schemaVersion:2,createdAt:f().toISOString(),ok:{version:p(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:E,language:D},contentDir:{pathSha256:zt(t),absolutePath:O?`<CONTENT_DIR>`:t},telemetry:{localSink:re,otlpPushEnabled:ee()},redaction:oe,serverStatus:b,files:A};V(F(_,`manifest.json`),`${JSON.stringify(se,null,2)}\n`);let ce=ie.some(e=>{try{return z(e,`utf-8`).includes(t)}catch{return!1}}),le={totalBytes:ae,fileCount:A.length,docNameCount:j,contentDirVisible:ce,redacted:O},M=!1;return{stagingDir:_,manifest:se,summary:le,cleanup:()=>{M||(M=!0,ye(_,{recursive:!0,force:!0}))}}}catch(e){throw ye(_,{recursive:!0,force:!0}),e}}async function Xt(e){let{collected:t,outputPath:n}=e,r=P(n);if(!L(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Ze.ZipFile,a=Ht(t.stagingDir);for(let e of a){let n=Jt(t.stagingDir,e);i.addFile(e,n)}i.end();let o=he(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function Zt(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let t=(0,je.parse)(z(n,`utf-8`)),r=M(t)?t.content:void 0,i=M(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return I(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return I(e)}async function Qt(e,t,n,r){let i=Re(t,e.logger),a=await Yt({contentDir:Zt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...He(i,e.userLogsDir??F(H(),`.ok`,`logs`)),...We(e.cachesDir??F(H(),`Library`,`Caches`))],userStateFiles:Ge(e.bugReportsDir??U()),deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{R(P(e.outputPath),{recursive:!0}),await Xt({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function $t(e){let{projectDir:t}=e,n=e.readDesktopEnv??Mt,r=e.readLanguage??$e;if(e.level===`full`&&t!==void 0)return Qt(e,t,n,r);let{zipPath:i,summary:a}=await Xe({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:We(e.cachesDir??F(H(),`Library`,`Caches`)),bugReportLedgerFiles:Ge(e.bugReportsDir??U()),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}function en(e,t){if(!L(e))return{status:`missing`,lockPath:e};let n;try{n=JSON.parse(z(e,`utf-8`))}catch{return{status:`corrupt`,lockPath:e}}if(!n||typeof n!=`object`||!x(n.pid))return{status:`corrupt`,lockPath:e};let r=n;if(!(t.isAlive??S)(r.pid))return{status:`dead-pid`,lockPath:e,lock:r};if(typeof r.machineId==`string`)return r.machineId===(t.machineId??C())?{status:`alive`,lockPath:e,lock:r}:{status:`foreign-host`,lockPath:e,lock:r};let i=t.host??Ce();return r.hostname===i?{status:`alive`,lockPath:e,lock:r}:{status:`foreign-host`,lockPath:e,lock:r}}function X(e,t,n={}){return en(w(e,t),n)}function Z(e,t={}){return en(F(e,`ui.lock`),t)}function tn(e){return e.replace(/:\d+$/,``)}function nn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:tn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:tn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:tn(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const rn=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function an(e){return F(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const on={existsSync:e=>L(e),readFileSync:(e,t)=>z(e,t),lstatSync:e=>ge(e),readlinkSync:e=>ve(e)};function sn(e,t=on){let n=an(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function cn(e){let t=e.replace(rn,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function ln(e,t,n=on){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function un(e){return te(e)||D(e)||ae(e)}const dn=10*1024*1024;function fn(e,t,n,r){let i=ce(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!un(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);if(e.format===`file`){ye(a,{force:!0});let e=re(t,n);return{kind:`removed`,trust:e.action,...e.error===void 0?{}:{trustError:e.error}}}return e.format===`toml`?hn(a,o):e.format===`yaml`?mn(a,e.topLevelKey,o):pn(a,e.topLevelKey,e.serverMapSubKey,o)}function pn(e,t,n,r){let i;try{i=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>dn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=ie(i,oe(t,n,r));return o?(v(e,a,{mode:j(e)}),{kind:`removed`}):{kind:`not-present`}}function mn(e,t,n){let r;try{r=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>dn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,je.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=A(a);a.trim()===``||a.endsWith(`
11
- `)?c.endsWith(`
12
- `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
13
- `).replace(/\n/g,`\r
14
- `));let u=`${i?``:``}${c}`;return u!==r&&v(e,u,{mode:j(e)}),{kind:`removed`}}function hn(e,t){let n=se();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=A(a),s=a.trim()===``||a.endsWith(`
15
- `),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
16
- `)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
17
- `).replace(/\n/g,`\r
18
- `));let u=`${i?``:``}${l}`;return u!==r&&v(e,u,{mode:j(e)}),{kind:`removed`}}function gn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function _n(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function vn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&T(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:ee(n),command:n,isDesktop:gn(n)}}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const yn=new Set([`running`,`desktop`,`foreign`]);function bn(e){switch(e){case`running`:return G.default.green(e);case`desktop`:return G.default.blue(e);case`foreign`:return G.default.cyan(e);case`stale`:return G.default.yellow(e)}}function xn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Sn(e){return`${xn(e.server.usage)} | ${xn(e.ui?.usage??null)}`}function Cn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function wn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,Cn(e),Sn(e),Q(e),String(e.server.pid),_n(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=bn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=G.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
19
- `)}async function Tn(e={}){let t=e.discover??g,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??f,a=e.resolveUsage??h,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=vn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(wn(e.all?s:s.filter(e=>yn.has(Q(e)))))}function En(){return new ne(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Tn({all:t.all===!0||e===`all`,json:t.json===!0})})}function Dn(e,t,n={}){let r=n.isAlive??S,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function On(e){let t=e.inspect??(t=>t===`ui`?Z(e.lockDir):X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=Dn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function kn(e,t=S){let n=await g(),r=null;for(let i of n){let n=X(i,`server`),a=Z(i);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function An(e){let t=On({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function jn(e){return new ne(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=On({lockDir:p(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await Tn({});return}if(n===`all`){let e=await g();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=Z(n);!$(e,S)&&!$(r,S)||(An(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await kn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}An(t);return}An(p(I(Ie(),n)))})}export{U as _,rn as a,Ne as b,sn as c,Z as d,X as f,Le as g,Xt as h,fn as i,cn as l,Yt as m,jn as n,ln as o,$t as p,En as r,an as s,On as t,nn as u,Ie as v,Fe as y};
20
- //# sourceMappingURL=src-CNBY5GiX.mjs.map
@@ -1 +0,0 @@
1
- import{J as e,Ms as t,Os as n,Qs as r,Rc as i,W as a,Xs as o,cc as s,js as c,x as l,y as u}from"./src-B5PnzP5L.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Aa as _,Ai as v,An as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ca as D,Ci as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Fr as q,Ft as J,G as Y,Gi as X,Gn as Z,Gr as Q,Gt as $,H as ee,Hi as te,Hn as ne,Hr as re,Ht as ie,I as ae,Ii as oe,In as se,Ir as ce,It as le,J as ue,Ji as de,Jn as fe,Jr as pe,Jt as me,K as he,Ki as ge,Kn as _e,Kr as ve,Kt as ye,L as be,Li as xe,Ln as Se,Lr as Ce,Lt as we,M as Te,Ma as Ee,Mi as De,Mn as Oe,Mt as ke,N as Ae,Ni as je,Nn as Me,Nr as Ne,Nt as Pe,O as Fe,Oa as Ie,Oi as Le,On as Re,Ot as ze,P as Be,Pi as Ve,Pn as He,Pr as Ue,Pt as We,Q as Ge,Qi as Ke,Qn as qe,Qr as Je,Qt as Ye,R as Xe,Ri as Ze,Rn as Qe,Rr as $e,Rt as et,S as tt,Sa as nt,Si as rt,Sn as it,Sr as at,St as ot,T as st,Ta as ct,Ti as lt,Tn as ut,Tr as dt,Tt as ft,U as pt,Ui as mt,Un as ht,Ur as gt,Ut as _t,V as vt,Vi as yt,Vn as bt,Vr as xt,Vt as St,W as Ct,Wi as wt,Wn as Tt,Wr as Et,Wt as Dt,X as Ot,Xi as kt,Xn as At,Xr as jt,Xt as Mt,Y as Nt,Yi as Pt,Yn as Ft,Yr as It,Yt as Lt,Z as Rt,Zi as zt,Zn as Bt,Zr as Vt,Zt as Ht,_ as Ut,_a as Wt,_i as Gt,_n as Kt,_r as qt,a as Jt,aa as Yt,ai as Xt,an as Zt,ar as Qt,at as $t,b as en,ba as tn,bi as nn,bn as rn,br as an,bt as on,c as sn,ca as cn,ci as ln,cn as un,cr as dn,ct as fn,d as pn,da as mn,di as hn,dn as gn,dr as _n,dt as vn,ea as yn,ei as bn,en as xn,er as Sn,et as Cn,f as wn,fa as Tn,fi as En,fn as Dn,fr as On,ft as kn,g as An,ga as jn,gi as Mn,gn as Nn,gr as Pn,h as Fn,ha as In,hi as Ln,hn as Rn,hr as zn,i as Bn,ia as Vn,ii as Hn,in as Un,ir as Wn,it as Gn,j as Kn,ja as qn,ji as Jn,jn as Yn,jt as Xn,k as Zn,ka as Qn,ki as $n,kn as er,kt as tr,l as nr,la as rr,li as ir,ln as ar,lr as or,lt as sr,m as cr,ma as lr,mi as ur,mn as dr,mr as fr,n as pr,na as mr,ni as hr,nn as gr,nr as _r,nt as vr,o as yr,oa as br,oi as xr,on as Sr,or as Cr,ot as wr,p as Tr,pa as Er,pi as Dr,pn as Or,pr as kr,q as Ar,qi as jr,qn as Mr,qr as Nr,qt as Pr,r as Fr,ra as Ir,ri as Lr,rn as Rr,rr as zr,rt as Br,s as Vr,sa as Hr,si as Ur,sn as Wr,sr as Gr,st as Kr,t as qr,ta as Jr,ti as Yr,tn as Xr,tr as Zr,tt as Qr,u as $r,ua as ei,ui as ti,un as ni,ur as ri,ut as ii,v as ai,va as oi,vi as si,vn as ci,vr as li,w as ui,wa as di,wi as fi,wn as pi,wr as mi,wt as hi,x as gi,xa as _i,xn as vi,xr as yi,xt as bi,y as xi,ya as Si,yi as Ci,yn as wi,yr as Ti,yt as Ei,z as Di,zi as Oi,zn as ki,zr as Ai,zt as ji}from"./src-DifwZnFy.mjs";import{C as Mi,E as Ni,T as Pi,_ as Fi,b as Ii,c as Li,d as Ri,g as zi,i as Bi,l as Vi,m as Hi,n as Ui,p as Wi,s as Gi,t as Ki,u as qi,v as Ji,w as Yi,x as Xi,y as Zi}from"./fs-traced-Cu6kXy54.mjs";import{a as Qi,d as $i,f as ea,i as ta,l as na,n as ra,r as ia,t as aa,u as oa}from"./logger-Dq-cRhcP.mjs";import{C as sa,S as ca,_ as la,a as ua,b as da,c as fa,d as pa,f as ma,g as ha,h as ga,i as _a,l as va,m as ya,n as ba,o as xa,p as Sa,r as Ca,s as wa,t as Ta,u as Ea,x as Da}from"./server-lock-_XWgcmNh.mjs";export{D as AGENT_ID_MAX_LEN,di as AGENT_ID_RE,Oi as AGENT_WRITE_ORIGIN,_ as AcpPermissionStore,N as AcpRegistry,lt as AcpThreadManager,O as AgentFocusBroadcaster,rt as AgentPresenceBroadcaster,S as AgentSessionCapacityError,yt as AgentSessionManager,on as AutoStartDisabledError,Ln as BUNDLE_IDS,Mn as BUNDLE_SCOPE,Gt as BUNDLE_SKILL_NAME,Bt as BacklinkIndex,zt as CC1Broadcaster,r as CC1_CONTRACT_VERSION,Wr as CONFIG_FILENAME,Z as CONFLICT_MARKER_RE,q as CURSOR_BUNDLE_PATHS_BY_PLATFORM,xi as ConfigSchema,Ir as DEFAULT_CHECKPOINT_RETENTION,m as DEFAULT_EMBEDDINGS_DIMENSIONS,T as DEFAULT_PACK_ID,Ct as DocumentDurabilityState,bn as EMBEDDINGS_API_KEY_ENV,qr as EPHEMERAL_PROJECT_DIR_PREFIX,wi as ExposureConsentError,Ie as FEATURED_AGENT_IDS,Vn as FILE_SYSTEM_WRITER,Ft as FILE_WATCHER_ORIGIN,Nr as FileEmbeddingsBackend,gr as GIT_PREFLIGHT_FAIL_SPAN_NAME,Yt as GIT_UPSTREAM_WRITER,qn as GitDirAccessError,v as GitNotAvailableError,Jn as GitTooOldError,bi as HOCUSPOCUS_AUTH_REJECTION_REASONS,ot as HocuspocusAuthRejection,j as HocuspocusAuthTokenSchema,Rn as HomeProjectRootError,xt as INSTALLED_AGENTS_SCHEMES,vn as JSON_SCHEMA_DIALECT_2020_12,o as LINEAGE_EPOCH_KEY,vt as LIVE_DERIVED_INDEX_DEBOUNCE_MS,St as LOG_MD_TEMPLATE,b as MANAGED_RENAME_ORIGIN,B as MAX_ACP_THREADS,te as MAX_AGENT_SESSIONS,Le as MCP_CONNECTION_ID_HEADER,n as MCP_SERVER_NAME,mt as MIN_EVICTABLE_IDLE_MS,De as MIN_GIT_VERSION,Y as MISSING_OK_CONFIG_MESSAGE,Ee as MalformedGitPointerError,Br as McpLogger,he as MissingOkConfigError,X as OBSERVER_SYNC_ORIGIN,un as OK_OKIGNORE_TEMPLATE,si as ONBOARDING_BUNDLE_IDS,c as ORPHAN_MODES,i as PROTOCOL_VERSION,aa as PinoLogger,va as ProcessLockCollisionError,pn as ProjectGitInitError,Xn as ROLLBACK_ORIGIN,ar as ROOT_GITIGNORE_TEMPLATE,da as RUNTIME_VERSION,br as SERVICE_WRITER,kr as SKILL_INSTALL_EVENTS_FILE_REL,a as SKILL_STATE_TARGETS,ie as STARTER_FOLDERS,_t as STARTER_FOLDER_FRONTMATTER_FILENAME,Dt as STARTER_PACKS,$ as STARTER_PACK_IDS,ye as STARTER_TEMPLATES,Fe as STATE_MANIFEST_FILENAME,Da as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,Ye as SeedPrerequisiteError,h as SeedRootDirError,Ta as ServerLockCollisionError,pr as SingleFileNotAFileError,Fr as SingleFileNotFoundError,Bn as SingleFileNotMarkdownError,Zn as StateManifestError,At as TagIndex,Ci as USER_GLOBAL_BUNDLE_IDS,ke as __getShowAllWalkStatsForTesting,Pe as __resetShowAllWalkStatsForTesting,Ea as acquireProcessLock,ba as acquireServerLock,wt as applyAgentMarkdownWrite,ht as applyExternalChange,ji as applySeed,g as assertCompatibleStateManifest,je as assertGitAvailable,Yn as assertNeverDiskEvent,Nn as assertNotHomeProjectRoot,fi as attachAcpThreadSocket,Ei as attachIdleShutdown,en as bootServer,p as buildAndOpenSkill,ni as buildConfigYmlContent,Ge as buildExecResult,rn as buildIngressPolicy,P as buildOkMcpStdioCommand,En as buildSkillZip,Pr as buildStarterFolderFrontmatterYaml,Hr as buildWipTree,nn as bundleSkillMdPath,pe as canonicalProjectKey,Kt as canonicalizeForCompare,Oe as classifyEvents,Ki as classifyFsPath,It as clearAllEmbeddingsKeys,hr as clearContributors,me as coercePackId,u as colorFromSeed,cn as commitUpstreamImport,rr as commitWip,ei as commitWipFromTree,Ve as compareSemver,an as composeEffectiveLinterConfig,yi as composeFrontmatterSchemasConfig,_e as containsConflictMarkers,Me as contentHash,Lr as contributorCount,be as countShadowObjects,Xe as countStaleAgentWipRefs,Di as countWipRefs,We as createApiExtension,tr as createAssetServeMiddleware,ue as createCollaborationHost,Ne as createContentFilter,Ue as createContentFilterAsync,jt as createEmbeddingsSecretStore,Jt as createEphemeralProjectDir,Tt as createExternalChangeHandler,cr as createFileLogger,ee as createLiveDerivedIndexExtension,Ot as createMcpHttpHandler,re as createOsProbe,ae as createPersistenceExtension,st as createServer,Be as createServerObserverExtension,de as createStreamingErrorWriter,ra as createTestLogger,Vt as describeStoredEmbeddingsKey,ai as detectClaudeDesktopPresence,G as detectGit,Kn as detectProjectShape,Sn as detectUserSkillHosts,wr as discoverLockDirs,mi as discoverMarkdownlintConfig,Rr as emitPreflightFailureSpan,d as encodeDocName,Cn as encodeFolderRoute,Qr as encodeSkillRoute,wn as ensureProjectGit,gn as ensureProjectSkillGitignore,Pt as errorResponse,He as evictStaleTrackerEntries,J as extractHeadings,Kr as extractOkBinaryPath,qe as extractWikiLinksFromMarkdown,oe as fallbackPaths,Tr as findEnclosingGitRoot,er as findEnclosingProjectRoot,dt as findNativeMarkdownlintFile,Fn as flushFileLogger,hi as formatAuthRejectionWire,Hn as formatContributors,Xt as formatContributorsFrom,we as formatPackRationale,mn as gcCheckpointRefs,Gn as getCurrentMcpLogger,vi as getIngressContext,ir as getLocalDir,An as getLogFilePath,ia as getLogger,Ut as getLogsDir,la as getMachineId,Zi as getMeter,oi as getMetrics,Ii as getTracer,Si as handleCollabSocketError,ce as handleSpawnCursor,it as hasForwardingHeaders,x as hasGcLogLatch,l as iconFromClientName,tn as incrementCollabSocketFilteredError,_i as incrementServerObserverFire,Dn as initContent,Tn as initShadowRepo,Xi as initTelemetry,tt as initToleranceTelemetryWriter,kn as installJsonSchemaDialect,ii as installPrettyZodErrors,ta as installTestLoggers,Zr as installUserSkill,Re as isAllowedApiOrigin,V as isAllowedWorkspaceHostHeader,Ke as isConfigDoc,ft as isHocuspocusAuthRejectionReason,ci as isHomeDir,k as isHostAdmitted,Lt as isKnownPackId,f as isLinkIndexExcludedDoc,F as isLoopbackAddress,yn as isManagedArtifactDoc,pi as isOriginAdmitted,t as isOrphanMode,ge as isPairedWriteOrigin,Ce as isPathWithinDir,ut as isPeerAdmitted,ca as isProcessAlive,y as isProjectRoot,Jr as isReservedForUserTree,K as isSelfWrite,mr as isSystemDoc,E as isToleranceTelemetryEnabled,sa as isValidLockPid,se as lastKnownHash,Er as listRescueCheckpoints,Mt as listStarterPacks,Qn as loadCustomAgents,W as loadPrincipal,Ca as lockAdvertisesUi,pa as lockBaseUrl,ma as lockFilePath,Qi as loggerFactory,Pn as loginShapedUserinfoUser,na as logsCurrentPath,oa as logsPreviousPath,Je as makeLazyEmbeddingsKeyStore,_a as markServerLockDraining,Ar as mountMcpAndApi,Ui as normalizeFsPath,qt as originGitHubHost,Or as packageVersionMajorMinor,U as parseAuthRejectionWire,xe as parseGitVersion,L as parseHocuspocusAuthToken,Nt as parseKeepaliveConnectionId,Se as pathToDocName,et as planSeed,yr as prepareSingleFileOpen,fn as processCommand,sr as processUsage,Wn as readAllTargets,Qt as readBundleDecision,H as readOwnNativeRules,Sa as readProcessLock,ya as readProcessLockDetailed,pt as readProjectHeadState,ve as readProjectLocalSemanticConfig,ua as readServerLock,Cr as readServerPackageVersion,Gr as readSkillInstallStateSnapshot,Te as readStateManifest,dn as readTargetRecordedAt,or as readTargetVersion,Mr as reconcile,xr as recordContributor,fr as recordSkillInstallEvent,zn as redactShareSubprocessStderr,Rt as registerAllTools,Qe as registerWrite,ga as releaseProcessLock,xa as releaseServerLock,ki as removeLastKnownHash,zr as reportSkillInstall,nt as resetMetrics,_r as resolveBuiltinSkillHosts,e as resolveBundleEnabled,Dr as resolveBundledSkillDir,ti as resolveContentDir,$e as resolveCursorBinaryDefault,Ai as resolveCursorSpawnInvocation,at as resolveEffectiveLinterConfig,Yr as resolveEmbeddingsCredential,M as resolveGitHubAccountFromUrl,hn as resolveLockDir,A as resolveNativeConfigForDoc,I as resolveNativeMarkdownlintConfig,Ht as resolvePack,nr as resolvePackageVersion,On as resolveSkillInstallReportSettings,vr as resolveUiInfo,Ur as restoreContributors,gi as restoreLifecycleFromConflictsJson,Et as rewriteMarkdownLinksForDocumentRename,Q as rewriteWikiLinksForDocumentRename,Un as runAuthReposSubprocess,Zt as runAuthStatusSubprocess,xn as runCloneSubprocess,Sr as runDeviceFlowSubprocess,$t as runWithMcpLogger,gt as safeContentPath,le as safeSubdir,lr as safetyCheckpoint,li as sameGitHubLogin,$n as sanitizeClientName,In as saveInMemoryCheckpoint,jn as saveVersion,ze as seedBasenameIndex,Vr as seedEphemeralProjectDir,sn as serializeError,Mi as setActiveSpanAttributes,jr as setupServerObservers,Wt as shadowGit,Yi as shutdownTelemetry,$i as spansCurrentPath,ea as spansPreviousPath,w as spawnDetached,fe as splitMarkdownBlocks,C as startWatcher,kt as streamingProblemEvent,ln as swapContributors,ui as teardownToleranceTelemetryWriter,ct as toBroadcasterKey,Bi as tracedAppendFileSync,Gi as tracedLinkSync,Li as tracedMkdir,Vi as tracedMkdirSync,qi as tracedRename,Ri as tracedRenameSync,Wi as tracedRmSync,Hi as tracedRmdirSync,zi as tracedUnlinkSync,Fi as tracedWriteFile,Ji as tracedWriteFileSync,R as trustSystemCertificates,$r as untrackTrackedProjectSkillProjection,bt as updateLastKnownHash,ha as updateProcessLockPort,wa as updateServerLockPort,z as validateAgentId,Xr as validateCloneInputs,ur as validateSkillZip,fa as waitForServerLockDrain,Ze as withHiddenWindowsConsole,Pi as withSpan,Ni as withSpanSync,ri as writeBundleDecision,Ti as writeMarkdownlintRule,dr as writeRootGitignoreForNewRepo,Ae as writeStateManifest,_n as writeTargetVersion,ne as writeTracker};
@@ -1 +0,0 @@
1
- import"./src-B5PnzP5L.mjs";import"./resolve-project-root-BmEYZjtQ.mjs";import"./src-CNBY5GiX.mjs";import"./acp-harness-probe-DRbySBVr.mjs";import"./init-44bY7bDu.mjs";import{n as e}from"./loader-Bqy2LPc4.mjs";import"./skill-teardown-DJadYmS9.mjs";import"./preview-CBcNW71i.mjs";import"./mcp-migrate-event-9DFnNzHa.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{S as e,m as t,p as n,r}from"./start-D6zGIr_Q.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};