@inkeep/open-knowledge 0.47.4 → 0.47.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.
- package/dist/{acp-harness-probe-B1Hzf1SD.mjs → acp-harness-probe-inKMbnTO.mjs} +2 -2
- package/dist/cli.mjs +57 -57
- package/dist/constants-iJqy8Hia.mjs +2 -0
- package/dist/{git-handle-CllEzrX4.mjs → git-handle-BKNpWc-0.mjs} +2 -2
- package/dist/git-handle-vAOkZizz.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/init-Bp0b6aXB.mjs +1 -0
- package/dist/{init-CB3lq_i9.mjs → init-D0r4e25M.mjs} +3 -3
- package/dist/{launch-json-removal-DfaHcfms.mjs → launch-json-removal-p9WHQkrd.mjs} +2 -2
- package/dist/loader-C6qDEjnp.mjs +1 -0
- package/dist/{loader-7y3WQNVR.mjs → loader-DI6RYqwy.mjs} +2 -2
- package/dist/md-manager-BuZAb56s.mjs +2 -0
- package/dist/{open-browser-BXJKGvZF.mjs → open-browser-BGPHwSRQ.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-CcFBEKQd.mjs → preview-B-2W99IX.mjs} +2 -2
- package/dist/preview-CITNy9Et.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-2l8BA531.js → ActivityModeContent-Cs_G4A2z.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-wqdF9lpR.js → AgentDiffPane-CWfs6hRd.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-56IhVeqo.js → AgentThreadClientBinder-GaJMQpHN.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-eT1ODdAD.js → ChangedOutsideBadge-DhOK_p1U.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-L7fbBlLy.js → CodeMirrorPropInput-DvoNWmdR.js} +1 -1
- package/dist/public/assets/{DocumentContext-DD95gIt4.js → DocumentContext-BaYg4CBg.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CR5jA0YM.js → EditorModeToggle-C9I-Efpm.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-C5fNw26t.js → EnableSyncConfirmDialog-DCen-fKk.js} +1 -1
- package/dist/public/assets/FeedbackForm-EBcXu2CA.js +1 -0
- package/dist/public/assets/{GraphPanel-BDGxPSvY.js → GraphPanel-B9HMPssx.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-B2ilfqxe.js → ImportSkillDialog-BjLITatU.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-ByUOzhaw.js → LintConfigEditor-D6dnss9h.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-CVGjtd3P.js → ManagedArtifactProperties-BO70pd59.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BkBzFhn7.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-B3ubISnW.js → McpConsentDialogBody-CZC9r_Ug.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-CftVeU4U.js → MermaidDocEditor-C6SV6GjT.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-CWbkwdNL.js → ReportBugDialogBody-BZrgGB1Z.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-UkvF3UAn.js → SchemaConfigEditor-BYBjMHsb.js} +1 -1
- package/dist/public/assets/{SessionsHost-Pa6hY3sI.js → SessionsHost-llsZYWbP.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-Be8P3Vqa.js → SettingsDialogBody-DXaeMFz_.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-BmGWQCY6.js → ShareBranchSwitchDialog-DUzjoGVJ.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-BoqZXYhT.js → ShareReceiveDialog-BQhhG70Y.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-B_DT1dz2.js → ShareReceiveMissDialog-CaI0eq9C.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-hcLaEQ2F.js → SkillEditBanner-WG0cwpb-.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-CtSdZ4_j.js → SkillOriginInline-8KJ3qbz8.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DQYbvJTe.js → SkillToolbarControls-LDRTNFTx.js} +1 -1
- package/dist/public/assets/{SourceEditor-DX9L1Mci.js → SourceEditor-nYPGo8QU.js} +1 -1
- package/dist/public/assets/{TerminalPanel-WTiFd3Z6.js → TerminalPanel-CkcArSmy.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CnhrK_tv.js → TerminalWindowApp-COjq6Uas.js} +1 -1
- package/dist/public/assets/{TextDocEditor-BGlQEeBq.js → TextDocEditor-eS5P-G2H.js} +1 -1
- package/dist/public/assets/{ThreadView-CExveDEV.js → ThreadView-v9Y3Ih_a.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-DDFvXSlv.js → TimelineDiffPane-3nkpH5uW.js} +1 -1
- package/dist/public/assets/{agent-diff-store-jazihC28.js → agent-diff-store-PJFwSxS1.js} +1 -1
- package/dist/public/assets/{agent-visibility-Ch0XQMkJ.js → agent-visibility-Cieocxzz.js} +1 -1
- package/dist/public/assets/{auth-state-cache-D47fide1.js → auth-state-cache-B8KE-_17.js} +1 -1
- package/dist/public/assets/{client-version-CHRlMl4l.js → client-version-uMlMQx33.js} +1 -1
- package/dist/public/assets/{config-context-B2fceTMP.js → config-context-BIynQsCe.js} +1 -1
- package/dist/public/assets/{config-provider-Cb43FIW2.js → config-provider-DKj_NBqh.js} +1 -1
- package/dist/public/assets/{dist-5ovMzVKN2.js → dist-CrqBb5y32.js} +175 -175
- package/dist/public/assets/{doc-paths-BFNbv2er.js → doc-paths-CCYuGvJq.js} +1 -1
- package/dist/public/assets/{documents-events-BM8xyAJz.js → documents-events-CdU1iFH9.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-C1zJK1Gk.js → file-tree-adapter-a1hBKu8z.js} +1 -1
- package/dist/public/assets/{file-tree-utils-Dma5c4k_.js → file-tree-utils-CClHAhYa.js} +1 -1
- package/dist/public/assets/{folder-config-api-BxuLFuqM.js → folder-config-api-6QhNU0oa.js} +1 -1
- package/dist/public/assets/{index-DlH6tzhG.js → index-kaTVsIsC.js} +108 -108
- package/dist/public/assets/{lint-config-client-DDxBMTZk.js → lint-config-client-B0H2okzr.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-c2Uv_5Ry.js → markdownlint-rule-browser-BXGIkBuD.js} +1 -1
- package/dist/public/assets/{navigation-targets-D9VW9WdW.js → navigation-targets-BwmQHp3k.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-CLwVAGCD.js → open-managed-artifact-tab-BzW5kLR0.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BmcjNZOu.js → pending-receive-nav-store-B1W7hvut.js} +1 -1
- package/dist/public/assets/{prop-types-BPmLSxhG.js → prop-types-DIaGyPZM.js} +1 -1
- package/dist/public/assets/{receive-store-BlAqmJZT.js → receive-store-DlIsfkuF.js} +1 -1
- package/dist/public/assets/{selection-context-DJvv-kK_.js → selection-context-DS--IqEv.js} +1 -1
- package/dist/public/assets/{skill-actions-CfQkZqK6.js → skill-actions-DCISbh85.js} +2 -2
- package/dist/public/assets/skill-scope-7fBhGcjl.js +1 -0
- package/dist/public/assets/{skills-api-BTy9LAk0.js → skills-api-wUsPYcxD.js} +1 -1
- package/dist/public/assets/{src-hNXjwMT1.js → src-ScxRfF8q.js} +1 -1
- package/dist/public/assets/{tag-pill-input-DVdwNfBT.js → tag-pill-input-Bx_oWl-2.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-C6AhTsfc.js → target-navigation-intent-D2TXEip5.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-B1DGOVIv.js → terminal-launch-events-B3gBFWc1.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-CviFLmIq.js → terminal-telemetry-Bv3GE2Aw.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B4AQIJp7.js → typing-burst-detector-lX1cLLkC.js} +2 -2
- package/dist/public/assets/{uninstall-CfW-qETg.js → uninstall-BILpXTW1.js} +1 -1
- package/dist/public/assets/{use-activity-panel-D8pDT3xu.js → use-activity-panel-CxtCUEYv.js} +1 -1
- package/dist/public/assets/{use-collab-url-CUHlgRv5.js → use-collab-url-BjRhUqsT.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-CLCjRdjJ.js → use-live-xterm-theme-Cvtrg0j6.js} +1 -1
- package/dist/public/assets/{use-open-skill-akwbVkG4.js → use-open-skill-BHdzD0v1.js} +1 -1
- package/dist/public/assets/{use-settings-route-BnOIfxuB.js → use-settings-route-aXWIMVRt.js} +1 -1
- package/dist/public/assets/{use-skill-directory-CSx9txvQ.js → use-skill-directory-BV092Gnw.js} +1 -1
- package/dist/public/assets/{use-skill-origin-DvSOmIz_.js → use-skill-origin-DMt7ay7U.js} +1 -1
- package/dist/public/assets/{use-skills-DcLUuUJ9.js → use-skills-C7huRzJa.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CgG0yd-l.js → use-terminal-enabled-C5zv0ln-.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-DD-1OHsM.js → use-timeline-entry-diff-EbqHCjsV.js} +1 -1
- package/dist/public/assets/{use-workspace-J5QvjwOx.js → use-workspace-D80aSSBD.js} +1 -1
- package/dist/public/index.html +41 -41
- package/dist/public/uninstall.html +2 -2
- package/dist/{repair-launch-json-C-n2O-Po.mjs → repair-launch-json-CSPeJG-m.mjs} +2 -2
- package/dist/{repair-mcp-configs-BOlWztB-.mjs → repair-mcp-configs-Basw3obQ.mjs} +2 -2
- package/dist/{repair-skills-IlcXRdDC.mjs → repair-skills-CXOdNyyU.mjs} +2 -2
- package/dist/repair-skills-CdFjRSeM.mjs +1 -0
- package/dist/{server-lock-CmYdHyX7.mjs → server-lock-9wk8At58.mjs} +2 -2
- package/dist/server-lock-DxjYF04b.mjs +1 -0
- package/dist/src-7fluFHtm.mjs +1 -0
- package/dist/{src-BS7drzIV.mjs → src-BA6UmYHS.mjs} +318 -318
- package/dist/{src-C-GJXht_.mjs → src-D81OiBLA.mjs} +2 -2
- package/dist/{src-CHSJwcpc.mjs → src-Dkrbi5Bh.mjs} +87 -87
- package/dist/start-B5xwD4lL.mjs +1 -0
- package/dist/{start-BITNJysu.mjs → start-DUP_Th9B.mjs} +3 -3
- package/dist/{write-project-skill-CzrMSTf3.mjs → write-project-skill-D_i5y_ki.mjs} +4 -4
- package/package.json +5 -5
- package/dist/constants-BpeoO1T6.mjs +0 -2
- package/dist/git-handle-DJPLRe3o.mjs +0 -1
- package/dist/init-BGPGjp1S.mjs +0 -1
- package/dist/loader-BeuP5hjg.mjs +0 -1
- package/dist/md-manager-DqRVEVmJ.mjs +0 -2
- package/dist/preview-lBskg3BM.mjs +0 -1
- package/dist/public/assets/FeedbackForm-macxQS8x.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-m1GRSrIt.js +0 -1
- package/dist/public/assets/skill-scope-DwJ84s_r.js +0 -1
- package/dist/repair-skills-3_7Dtv4E.mjs +0 -1
- package/dist/server-lock-D61z37T2.mjs +0 -1
- package/dist/src-BWFntIGk.mjs +0 -1
- package/dist/start-DPqozQkA.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,r as t,v as n}from"./start-DUP_Th9B.mjs";export{t as bootStartServer,e as resolveHost,n as startCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Q as e,Y as t}from"./src-CHSJwcpc.mjs";import{Hr as n,Yr as r,a as i,bn as a}from"./src-BS7drzIV.mjs";import{E as o,T as s}from"./write-project-skill-CzrMSTf3.mjs";import{a as c,n as l,t as u}from"./acp-harness-probe-B1Hzf1SD.mjs";import{n as d}from"./constants-BpeoO1T6.mjs";import{spawn as f}from"node:child_process";import{basename as p,join as m,posix as h,resolve as g,win32 as _}from"node:path";import{closeSync as v,existsSync as y,mkdirSync as b,openSync as x,statSync as S}from"node:fs";import{homedir as C}from"node:os";import{rm as w}from"node:fs/promises";import{setTimeout as T}from"node:timers/promises";function E(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function D(e,t,r={}){let i=(r.spawn??f)(e,[...t],n({detached:!0,stdio:`ignore`,env:E(r.env??process.env)}));return i.unref(),i}const O=`OpenKnowledge.app`,k=`/Applications/${O}`;function A(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return S(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function j(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(M(e,k))return k;let t=m(e.homeDir??C(),`Applications`,O);return M(e,t)?t:null}function M(e,t){return N(e,m(t,`Contents`,`MacOS`,`OpenKnowledge`))}function N(e,t){try{let n=e.statSync(t);return n&&typeof n.isFile==`function`?n.isFile():!1}catch{return!1}}const ee=[`@inkeepopen-knowledge-desktop`,`OpenKnowledge`];function P(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&/\\OpenKnowledge\.exe$/i.test(e.execPath))return e.execPath;let t=e.env.LOCALAPPDATA;if(t)for(let n of ee){let r=_.join(t,`Programs`,n,`OpenKnowledge.exe`);if(N(e,r))return r}return null}function F(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&e.execPath.endsWith(`/openknowledge`))return e.execPath;let t=`/opt/OpenKnowledge/openknowledge`;return N(e,t)?t:null}function I(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`};let t;try{t=e.platform===`darwin`?j(e):e.platform===`win32`?P(e):F(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:!(e.isTTY===!0||e.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function L(e,t){let n=e.log??(e=>console.error(e)),r=e.platform??process.platform;if(n("Launching OpenKnowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)"),r===`darwin`){D(`open`,[`-b`,`com.inkeep.open-knowledge`],{spawn:e.spawn});return}let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}D(i,[],{spawn:e.spawn})}function R(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}function z(e){return h.join(h.dirname(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const te=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function ne(e){if(e.platform!==`darwin`||!te.test(e.execPath))return null;let t=z(e.execPath);return e.exists(t)?t:null}function B(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??y,a=r[1];return a?{command:ne({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function V(e,t){return e.host??t.HOST??`127.0.0.1`}function H(e,t){return t&&(e===`::`||e===`::1`||e===`[::1]`||e===`localhost`||e===`0.0.0.0`)?{host:`127.0.0.1`,coerced:!0}:{host:e,coerced:!1}}function U(e){let t=p(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var W=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function G(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function K(t){y(t.lockDir)||b(t.lockDir,{recursive:!0});let n=x(m(t.lockDir,e),`w`),r=t.spawn??f,{PORT:i,...a}=process.env,o=B();try{let e=r(o.command,[...o.prefixArgs,...t.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,n],windowsHide:!0,cwd:t.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return e.unref(),e}finally{try{v(n)}catch{}}}function q(e,t,n,r=!1){return e??(n!==void 0||r?void 0:t)}function J(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function Y(e,t,n){return e??+(t!=null&&!n)}async function X(e){let t=e.spawn??f,n=B(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,windowsHide:!0,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=Y(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function Z(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const re=t;function ie(e,t,n=e=>w(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function ae(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function Q(e){let t=e.sigtermGraceMs??re,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>T(e)),i=e.reason??`teardown`;try{let a=e.readUiLock(),o=e.spawnedUiPid();if(a&&e.isAlive(a.pid)&&a.pid!==o)e.log?.info({pid:a.pid,port:a.port,spawnedUiPid:o},`${i}: ui.lock holder is not our spawned sibling — leaving it alone`);else if(a&&e.isAlive(a.pid))try{e.killPid(a.pid,`SIGTERM`),e.log?.info({pid:a.pid,port:a.port},`${i}: SIGTERM UI sibling`);let o=Date.now()+t;for(;Date.now()<o&&e.isAlive(a.pid);)await r(n);if(e.isAlive(a.pid))try{e.killPid(a.pid,`SIGKILL`),e.log?.warn({pid:a.pid,graceMs:t},`${i}: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:a.pid,err:t},`${i}: SIGKILL failed`)}}catch(t){e.log?.warn({pid:a.pid,err:t},`${i}: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t},`${i}: UI lookup failed; proceeding`)}}function oe(e){let{destroy:t,...n}=e;return async()=>{await Q({...n,reason:`idle-shutdown`}),await t()}}async function se(e){let{config:t,cwd:n,host:o}=e,s=e.skipAutoInit??!1,d=e.skipUiAutoSpawn??!1,f=e.idleThresholdMs??18e5,{existsSync:p,mkdirSync:m}=await import(`node:fs`),{basename:h,dirname:g}=await import(`node:path`),{bootServer:_,getLogger:v,isProcessAlive:y,readUiLock:b,resolveContentDir:x,resolveLockDir:S,waitForServerLockDrain:C}=await import(`./src-BWFntIGk.mjs`),w=e.log??v(`start`),E=e.singleFile!==void 0,D=e.projectDir??n,O=E?i(e.singleFile).canonicalFilePath:void 0,k=O?g(O):void 0,A=O?h(O):void 0;if(!E){if(!s&&!a(n))throw new W(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&w.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-BOlWztB-.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-C-n2O-Po.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-3_7Dtv4E.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let j=k??x(t,n);!E&&!p(j)&&(m(j,{recursive:!0}),w.info({contentDir:j},`Created content directory`));let M=null,N=null,ee=async({lockDir:t})=>{if(M=G({uiLock:b(t),isAlive:y}),M.action===`spawn`&&!d)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];N=K({lockDir:t,cwd:n,spawn:e.spawn,args:r}).pid??null,w.info({reason:M.reason,uiPort:e.uiPort},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else M.action===`skip`&&w.info({port:M.port,pid:M.pid},`UI already running at port ${M.port}`)},P=e.reactShellDistDir===void 0,F=c(),I=r();{let e=S(E?D:n),t=Date.now(),r=await C(e);r!==`no-drain`&&w.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let L=await _({config:t,contentDir:j,projectDir:E?D:n,contentRoot:E?void 0:t.content.dir,port:e.port,host:o,...e.enableRemote===!0?{enableRemote:!0}:{},quiet:!1,detectGh:l,tokenStore:F,embeddingsKeyStore:I,...E?{ephemeral:!0,singleDocRelPath:A,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>u(e,t),attachUiSibling:P,idleShutdownMs:f,skipAutoInit:!0,...P?{spawnUiSiblingFn:ee}:{},idleShutdownHandler:t=>{let n=oe({readUiLock:()=>b(L.lockDir),spawnedUiPid:()=>N,isAlive:y,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return ae(E?ie(n,D):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});M||={action:`skip`,reason:`alive`,pid:0,port:0};let R=M,z=null;if(R.action===`skip`)z=R.port>0?R.port:null;else if(!d){let t=e.uiBindTimeoutMs??3e3;z=await Z({readUiLock:()=>b(L.lockDir),now:Date.now,sleep:e=>T(e),timeoutMs:t,pollIntervalMs:50}),z===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:L.httpServer,destroy:L.destroy,lockDir:L.lockDir,contentDir:j,port:L.port,ready:L.ready,degraded:L.degraded,uiSpawnDecision:M,spawnedUiPid:N,resolvedUiPort:z}}function ce(e){if(e===`browser`||e===`app`)return e;throw new o(`--mode must be 'browser' or 'app'`)}function le(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new o(`--ui-port must be a port number between 1 and 65535`);return t}function ue(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function $(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function de(e,t){let n=ue(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner--DGfdMN8.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-MGDi6UGf.mjs`),c=process.cwd(),l=t.remote!==void 0&&t.remote!==!1,u=typeof t.remote==`string`?t.remote:void 0,f=u===void 0?e:{...e,remote:{...e.remote,url:u}};process.title=U(c),l&&(typeof f.remote?.url!=`string`||f.remote.url===``)&&(console.error(o("--remote requires a public tunnel URL — pass it (`ok start --remote https://<your-tunnel-host>`) or set remote.url in .ok/config.yml.")),process.exit(78)),l&&console.warn(s([``,`⚠ REMOTE ACCESS ENABLED — no server-side authentication.`,` Anyone who can reach ${f.remote?.url} has FULL control of this`,` knowledge base, including sync, publishing, credentials, and local operations.`,` Restrict who can reach it at the tunnel: ngrok OAuth, Cloudflare Access,`,` Tailscale ACLs, or equivalent edge auth.`,``].join(`
|
|
2
|
-
`)));let p=V(t,process.env),m=H(p,l);m.coerced&&console.warn(`remote access is enabled and ${p} is not an IPv4 loopback bind — tunnels proxy to 127.0.0.1, so binding ${p} would leave the tunnel dialing a dead port. Using 127.0.0.1.`);let h=m.host,_=t.port===void 0?void 0:Number(t.port),v=process.env.PORT?Number(process.env.PORT):void 0,b=t.uiPort===void 0?void 0:Number(t.uiPort);l&&_===void 0&&v!==void 0&&console.warn(`remote access is enabled — ignoring env PORT=${process.env.PORT}; the tunnel's port mapping targets the stable remote port (${f.remote?.port}). Pass --port to override deliberately.`);let x=q(_,v,b,l)??(l?f.remote?.port:void 0);if(b!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./src-
|
|
1
|
+
import{Q as e,Y as t}from"./src-Dkrbi5Bh.mjs";import{Hr as n,Yr as r,a as i,bn as a}from"./src-BA6UmYHS.mjs";import{E as o,T as s}from"./write-project-skill-D_i5y_ki.mjs";import{a as c,n as l,t as u}from"./acp-harness-probe-inKMbnTO.mjs";import{n as d}from"./constants-iJqy8Hia.mjs";import{spawn as f}from"node:child_process";import{basename as p,join as m,posix as h,resolve as g,win32 as _}from"node:path";import{closeSync as v,existsSync as y,mkdirSync as b,openSync as x,statSync as S}from"node:fs";import{homedir as C}from"node:os";import{rm as w}from"node:fs/promises";import{setTimeout as T}from"node:timers/promises";function E(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function D(e,t,r={}){let i=(r.spawn??f)(e,[...t],n({detached:!0,stdio:`ignore`,env:E(r.env??process.env)}));return i.unref(),i}const O=`OpenKnowledge.app`,k=`/Applications/${O}`;function A(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return S(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function j(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(M(e,k))return k;let t=m(e.homeDir??C(),`Applications`,O);return M(e,t)?t:null}function M(e,t){return N(e,m(t,`Contents`,`MacOS`,`OpenKnowledge`))}function N(e,t){try{let n=e.statSync(t);return n&&typeof n.isFile==`function`?n.isFile():!1}catch{return!1}}const ee=[`@inkeepopen-knowledge-desktop`,`OpenKnowledge`];function P(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&/\\OpenKnowledge\.exe$/i.test(e.execPath))return e.execPath;let t=e.env.LOCALAPPDATA;if(t)for(let n of ee){let r=_.join(t,`Programs`,n,`OpenKnowledge.exe`);if(N(e,r))return r}return null}function F(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&e.execPath.endsWith(`/openknowledge`))return e.execPath;let t=`/opt/OpenKnowledge/openknowledge`;return N(e,t)?t:null}function I(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`};let t;try{t=e.platform===`darwin`?j(e):e.platform===`win32`?P(e):F(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:!(e.isTTY===!0||e.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function L(e,t){let n=e.log??(e=>console.error(e)),r=e.platform??process.platform;if(n("Launching OpenKnowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)"),r===`darwin`){D(`open`,[`-b`,`com.inkeep.open-knowledge`],{spawn:e.spawn});return}let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}D(i,[],{spawn:e.spawn})}function R(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}function z(e){return h.join(h.dirname(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const te=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function ne(e){if(e.platform!==`darwin`||!te.test(e.execPath))return null;let t=z(e.execPath);return e.exists(t)?t:null}function B(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??y,a=r[1];return a?{command:ne({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function V(e,t){return e.host??t.HOST??`127.0.0.1`}function H(e,t){return t&&(e===`::`||e===`::1`||e===`[::1]`||e===`localhost`||e===`0.0.0.0`)?{host:`127.0.0.1`,coerced:!0}:{host:e,coerced:!1}}function U(e){let t=p(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var W=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function G(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function K(t){y(t.lockDir)||b(t.lockDir,{recursive:!0});let n=x(m(t.lockDir,e),`w`),r=t.spawn??f,{PORT:i,...a}=process.env,o=B();try{let e=r(o.command,[...o.prefixArgs,...t.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,n],windowsHide:!0,cwd:t.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return e.unref(),e}finally{try{v(n)}catch{}}}function q(e,t,n,r=!1){return e??(n!==void 0||r?void 0:t)}function J(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function Y(e,t,n){return e??+(t!=null&&!n)}async function X(e){let t=e.spawn??f,n=B(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,windowsHide:!0,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=Y(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function Z(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const re=t;function ie(e,t,n=e=>w(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function ae(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function Q(e){let t=e.sigtermGraceMs??re,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>T(e)),i=e.reason??`teardown`;try{let a=e.readUiLock(),o=e.spawnedUiPid();if(a&&e.isAlive(a.pid)&&a.pid!==o)e.log?.info({pid:a.pid,port:a.port,spawnedUiPid:o},`${i}: ui.lock holder is not our spawned sibling — leaving it alone`);else if(a&&e.isAlive(a.pid))try{e.killPid(a.pid,`SIGTERM`),e.log?.info({pid:a.pid,port:a.port},`${i}: SIGTERM UI sibling`);let o=Date.now()+t;for(;Date.now()<o&&e.isAlive(a.pid);)await r(n);if(e.isAlive(a.pid))try{e.killPid(a.pid,`SIGKILL`),e.log?.warn({pid:a.pid,graceMs:t},`${i}: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:a.pid,err:t},`${i}: SIGKILL failed`)}}catch(t){e.log?.warn({pid:a.pid,err:t},`${i}: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t},`${i}: UI lookup failed; proceeding`)}}function oe(e){let{destroy:t,...n}=e;return async()=>{await Q({...n,reason:`idle-shutdown`}),await t()}}async function se(e){let{config:t,cwd:n,host:o}=e,s=e.skipAutoInit??!1,d=e.skipUiAutoSpawn??!1,f=e.idleThresholdMs??18e5,{existsSync:p,mkdirSync:m}=await import(`node:fs`),{basename:h,dirname:g}=await import(`node:path`),{bootServer:_,getLogger:v,isProcessAlive:y,readUiLock:b,resolveContentDir:x,resolveLockDir:S,waitForServerLockDrain:C}=await import(`./src-7fluFHtm.mjs`),w=e.log??v(`start`),E=e.singleFile!==void 0,D=e.projectDir??n,O=E?i(e.singleFile).canonicalFilePath:void 0,k=O?g(O):void 0,A=O?h(O):void 0;if(!E){if(!s&&!a(n))throw new W(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&w.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-Basw3obQ.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-CSPeJG-m.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-CdFjRSeM.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let j=k??x(t,n);!E&&!p(j)&&(m(j,{recursive:!0}),w.info({contentDir:j},`Created content directory`));let M=null,N=null,ee=async({lockDir:t})=>{if(M=G({uiLock:b(t),isAlive:y}),M.action===`spawn`&&!d)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];N=K({lockDir:t,cwd:n,spawn:e.spawn,args:r}).pid??null,w.info({reason:M.reason,uiPort:e.uiPort},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else M.action===`skip`&&w.info({port:M.port,pid:M.pid},`UI already running at port ${M.port}`)},P=e.reactShellDistDir===void 0,F=c(),I=r();{let e=S(E?D:n),t=Date.now(),r=await C(e);r!==`no-drain`&&w.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let L=await _({config:t,contentDir:j,projectDir:E?D:n,contentRoot:E?void 0:t.content.dir,port:e.port,host:o,...e.enableRemote===!0?{enableRemote:!0}:{},quiet:!1,detectGh:l,tokenStore:F,embeddingsKeyStore:I,...E?{ephemeral:!0,singleDocRelPath:A,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>u(e,t),attachUiSibling:P,idleShutdownMs:f,skipAutoInit:!0,...P?{spawnUiSiblingFn:ee}:{},idleShutdownHandler:t=>{let n=oe({readUiLock:()=>b(L.lockDir),spawnedUiPid:()=>N,isAlive:y,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return ae(E?ie(n,D):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});M||={action:`skip`,reason:`alive`,pid:0,port:0};let R=M,z=null;if(R.action===`skip`)z=R.port>0?R.port:null;else if(!d){let t=e.uiBindTimeoutMs??3e3;z=await Z({readUiLock:()=>b(L.lockDir),now:Date.now,sleep:e=>T(e),timeoutMs:t,pollIntervalMs:50}),z===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:L.httpServer,destroy:L.destroy,lockDir:L.lockDir,contentDir:j,port:L.port,ready:L.ready,degraded:L.degraded,uiSpawnDecision:M,spawnedUiPid:N,resolvedUiPort:z}}function ce(e){if(e===`browser`||e===`app`)return e;throw new o(`--mode must be 'browser' or 'app'`)}function le(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new o(`--ui-port must be a port number between 1 and 65535`);return t}function ue(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function $(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function de(e,t){let n=ue(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner--DGfdMN8.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-MGDi6UGf.mjs`),c=process.cwd(),l=t.remote!==void 0&&t.remote!==!1,u=typeof t.remote==`string`?t.remote:void 0,f=u===void 0?e:{...e,remote:{...e.remote,url:u}};process.title=U(c),l&&(typeof f.remote?.url!=`string`||f.remote.url===``)&&(console.error(o("--remote requires a public tunnel URL — pass it (`ok start --remote https://<your-tunnel-host>`) or set remote.url in .ok/config.yml.")),process.exit(78)),l&&console.warn(s([``,`⚠ REMOTE ACCESS ENABLED — no server-side authentication.`,` Anyone who can reach ${f.remote?.url} has FULL control of this`,` knowledge base, including sync, publishing, credentials, and local operations.`,` Restrict who can reach it at the tunnel: ngrok OAuth, Cloudflare Access,`,` Tailscale ACLs, or equivalent edge auth.`,``].join(`
|
|
2
|
+
`)));let p=V(t,process.env),m=H(p,l);m.coerced&&console.warn(`remote access is enabled and ${p} is not an IPv4 loopback bind — tunnels proxy to 127.0.0.1, so binding ${p} would leave the tunnel dialing a dead port. Using 127.0.0.1.`);let h=m.host,_=t.port===void 0?void 0:Number(t.port),v=process.env.PORT?Number(process.env.PORT):void 0,b=t.uiPort===void 0?void 0:Number(t.uiPort);l&&_===void 0&&v!==void 0&&console.warn(`remote access is enabled — ignoring env PORT=${process.env.PORT}; the tunnel's port mapping targets the stable remote port (${f.remote?.port}). Pass --port to override deliberately.`);let x=q(_,v,b,l)??(l?f.remote?.port:void 0);if(b!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./src-7fluFHtm.mjs`);if(J(b,e(t(c)))){await X({cwd:c,uiPort:b});return}}let S=t.reactShellDistDir;if(l&&S===void 0){let e=import.meta.dirname??new URL(`.`,import.meta.url).pathname;S=[g(e,`public`),g(e,`../../app/dist`),g(e,`../../../app/dist`)].find(e=>y(e)),S===void 0&&console.warn(`remote access: bundled web UI not found — serving /mcp and /api only over the tunnel.`)}let C;try{C=await se({config:f,cwd:c,host:h,port:x,...b===void 0?{}:{uiPort:b},...t.serveContentAssets===void 0?{}:{serveContentAssets:t.serveContentAssets},...S?{reactShellDistDir:S}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{},...l?{enableRemote:!0}:{}})}catch(e){e instanceof W&&(console.error(o(e.message)),process.exit(1));let t=await import(`./src-7fluFHtm.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),e instanceof t.RemoteConfigError&&(console.error(o(e.message)),process.exit(78)),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(o(e.message)),process.exit(1)),b!==void 0&&fe(e,t)){await X({cwd:c,uiPort:b});return}let n=pe(e,c,t);n!==null&&(console.error(o(n)),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let w=!1,T=async e=>{if(w)return;w=!0;let[t,...n]=$(e);console.log(i(`\n${t}`));for(let e of n)console.log(a(` ${e}`));if(C.spawnedUiPid!==null)try{let{getLogger:e,isProcessAlive:t,readUiLock:n}=await import(`./src-7fluFHtm.mjs`);await Q({readUiLock:()=>n(C.lockDir),spawnedUiPid:()=>C.spawnedUiPid,isAlive:t,killPid:(e,t)=>process.kill(e,t),log:e(`start`),reason:`shutdown`})}catch(e){console.error(`${o(`ui sibling teardown failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`)}try{await C.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{T(`SIGINT`)}),process.once(`SIGTERM`,()=>{T(`SIGTERM`)});let E=`http://${h}:${C.port}`,D=h===`0.0.0.0`||h===`::`?`http://0.0.0.0:${C.port}`:void 0,O=C.resolvedUiPort,k=O!==null&&O>0?`http://${h}:${O}`:E;console.log(r({name:`open-knowledge`,version:d,localUrl:k,apiUrl:k===E?void 0:E,networkUrl:D,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let A={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};C.ready.then(async()=>{if(C.degraded.length>0){console.log();for(let e of C.degraded){let t=A[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${a(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-BGPHwSRQ.mjs`);e(k)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function fe(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function pe(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=m(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`OpenKnowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function me(e){return new s(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`--ui-port <port>`,`Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path`,le).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,ce).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).option(`--remote [url]`,`Serve through a tunnel: admit requests carrying the tunnel Host with NO server-side auth (anyone who can reach the URL has full control — restrict access at the tunnel with edge auth). Bare --remote uses remote.url from .ok/config.yml; --remote <url> supplies it for this run.`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
3
3
|
`),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.uiPort!==void 0&&e.push(`--ui-port`),t.host!==void 0&&e.push(`--host`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=I(A());if(n.available){L({spawn:f},n);return}console.error(R(n.reason)),process.exit(1)}await de(n,t)})}export{B as C,D,L as E,ae as S,I as T,K as _,H as a,pe as b,G as c,fe as d,q as f,J as g,de as h,oe as i,U as l,ue as m,Z as n,Y as o,V as p,se as r,X as s,W as t,$ as u,me as v,A as w,ie as x,Q as y};
|
|
4
|
-
//# sourceMappingURL=start-
|
|
4
|
+
//# sourceMappingURL=start-DUP_Th9B.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{Ao as r,Ho as i,Lo as a,Ro as o}from"./src-Dkrbi5Bh.mjs";import{Or as s,cr as c,fr as l,pr as u}from"./src-BA6UmYHS.mjs";import{basename as d,dirname as f,isAbsolute as p,join as m,posix as h,relative as g,resolve as _,sep as v,win32 as y}from"node:path";import{cpSync as ee,existsSync as b,lstatSync as x,mkdirSync as te,readFileSync as ne,readdirSync as re,realpathSync as S,rmSync as C,rmdirSync as ie,statSync as ae}from"node:fs";import{homedir as w}from"node:os";var T=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),E=n((e=>{let{InvalidArgumentError:t}=T();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),D=n((e=>{let{humanReadableArgName:t}=E();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
2
2
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
3
3
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
4
4
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),O=n((e=>{let{InvalidArgumentError:t}=T();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -16,7 +16,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
17
|
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
18
18
|
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
19
|
-
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}t.Command=h,t.useColor=_}));const{program:ce,createCommand:le,createArgument:ue,createOption:de,CommanderError:fe,InvalidArgumentError:pe,InvalidOptionArgumentError:me,Command:he,Argument:ge,Option:_e,Help:ve}=t(n((e=>{let{Argument:t}=E(),{Command:n}=se(),{CommanderError:r,InvalidArgumentError:i}=T(),{Help:a}=D(),{Option:o}=O();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default,k=
|
|
19
|
+
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}t.Command=h,t.useColor=_}));const{program:ce,createCommand:le,createArgument:ue,createOption:de,CommanderError:fe,InvalidArgumentError:pe,InvalidOptionArgumentError:me,Command:he,Argument:ge,Option:_e,Help:ve}=t(n((e=>{let{Argument:t}=E(),{Command:n}=se(),{CommanderError:r,InvalidArgumentError:i}=T(),{Help:a}=D(),{Option:o}=O();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default,k=a,A=o,j=i,M=`node`,N={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},P=`# ok-mcp-v2
|
|
20
20
|
USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
|
|
21
21
|
[ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
|
|
22
22
|
BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
|
|
@@ -52,5 +52,5 @@ foreach ($d in $dirs) {
|
|
|
52
52
|
if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
|
|
53
53
|
}
|
|
54
54
|
[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
|
|
55
|
-
exit 127`,I=`// ok-pi-bridge`,L=`${I}-v1`,ye=`ok-pi-managed-extension`;function be(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(L)}return!1}function R(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=_(e);if(d(t)===`cli.mjs`&&d(f(t))===`dist`)return t;let n=t.split(v),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return m(i.length===0?v:i.join(v),`packages`,`cli`,`dist`,`cli.mjs`)}function z(e={}){return e.mode===`dev`?{command:M,args:[R(),`mcp`],env:{...N}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{command:`/bin/sh`,args:[`-l`,`-c`,P]}}function xe(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[M,R(),`mcp`],environment:{...N}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,P]}}function Se(e){if(typeof e!=`object`||!e)return!1;let t=e;return B(t,z({mode:`published`,platformName:`darwin`}))||B(t,z({mode:`published`,platformName:`win32`}))}function B(e,t){return Object.keys(e).length===Object.keys(t).length?Ce(e,t):!1}function Ce(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function V(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function we(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:V(t.args,t.command)}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&V(r,n)}function H(e){return e===`win32`?y:h}function Ee(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=e.env??process.env,i=H(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA??i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME??i.join(n,`.config`)}function De(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.claude.json`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=e.env??process.env;if(t===`darwin`)return h.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??y.join(n,`AppData`,`Roaming`);return y.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function W(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.cursor`,`mcp.json`)}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??w();return(e.env??process.env).CODEX_HOME??H(t).join(n,`.codex`)}function ke(e={}){return H(e.platformName??process.platform).join(Oe(e),`config.toml`)}function G(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=(e.env??process.env).COPILOT_HOME??H(t).join(n,`.copilot`);return H(t).join(r,`mcp-config.json`)}function Ae(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=e.env??process.env,i=H(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function K(e={}){return H(e.platformName??process.platform).join(Ae(e),`opencode.json`)}function je(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.openclaw`,`openclaw.json`)}function Me(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.hermes`,`config.yaml`)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??w();return(e.env??process.env).PI_CODING_AGENT_DIR??H(t).join(n,`.pi`,`agent`)}function Pe(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Fe(e,t){let n=H(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function q(e={}){let t=e.platformName??process.platform,n=Fe(e.home??w(),t);return n.find(e=>b(e))||n.find(e=>b(f(e)))||n[0]}function Ie(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function Le(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const J={claude:{id:`claude`,label:A.claude,configPath:(e,t)=>De({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.claude`),projectConfigPath:e=>m(e,`.mcp.json`),projectSkillPath:e=>m(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:A[`claude-desktop`],configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(U({home:t}))},cursor:{id:`cursor`,label:A.cursor,configPath:(e,t)=>W({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(W({home:t})),projectConfigPath:e=>m(e,`.cursor`,`mcp.json`),projectSkillPath:e=>m(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:A.codex,configPath:(e,t)=>ke({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(ke({home:t})),projectConfigPath:e=>m(e,`.codex`,`config.toml`),projectSkillPath:e=>m(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:A.copilot,configPath:(e,t)=>G({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(G({home:t})),projectSkillPath:e=>m(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:A.opencode,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>i,buildEntry:(e,t)=>xe(t),scope:`global`,detectPath:(e,t)=>f(K({home:t})),projectConfigPath:e=>m(e,`opencode.json`),projectSkillPath:e=>m(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:A.openclaw,configPath:(e,t)=>je({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:A.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>Ne({home:t}),projectConfigPath:e=>m(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>m(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:A.antigravity,configPath:(e,t)=>Pe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:A[`lm-studio`],configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(q({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:A.hermes,configPath:(e,t)=>Me({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>i,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.hermes`),offerOnlyWhenDetected:!0}};function Re(e){let t=e.filter(e=>!Object.hasOwn(J,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${k.join(`, `)}`);return e.map(e=>J[e])}const Y=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],X=[...u.map(e=>l[e]),`open-knowledge`];function Z(e){if(!p(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=_(e);if(t===v||f(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Q(e,t){let n=g(e,t);if(n.startsWith(`..`)||p(n))return!1;let r=e;for(let e of n.split(v)){r=m(r,e);try{if(!x(r).isDirectory())return!1}catch{return!1}}return!0}function ze(e,t){try{return re(e).every(n=>t.has(m(e,n)))}catch{return!1}}function Be(e){let t=Z(e),n=[],r=[],i=new Set;for(let e of Y){let a=m(t,e.hostDir,`skills`);if(!Q(t,a))continue;let o=X.map(e=>m(a,e)).filter(e=>b(e));n.push(...o);for(let e of o)i.add(e);let s=m(t,e.pruneRoot),c=a;for(;ze(c,i)&&(r.push(c),i.add(c),c!==s);){let e=f(c);if(e===c||e===t||!e.startsWith(t+v))break;c=e}}return{skillDirs:n,emptyDirs:r}}function Ve(e){try{if(!x(e).isDirectory())return!1;let t=re(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function He(e){let t=new Set,n=new Set;for(let r of Y){let i=m(e,r.hostDir,`skills`);for(let e of X)t.add(m(i,e));let a=m(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=f(o);if(t===o||t===e||!t.startsWith(e+v))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Ue(e,t){let n=Z(e),r=He(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(Q(n,e)&&Ve(e))try{C(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Q(n,e))try{ie(e),a.push(e)}catch{}return a}function We(e){let t=Z(e),n=[];for(let e of u){let r=l[e];n.push({path:m(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of j)n.push({path:m(t,i.hostDir,`skills`,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function Ge(e,t){let n=[];for(let r of We(e))if(r.bundleId===t)try{C(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function Ke(e,t){let n;try{n=x(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Je(e,t)}function qe(e,t){Je(e,t)}function Je(e,t){let n;try{n=S(t)}catch{n=_(t)}let r=f(e);for(;r.length>1&&r!==v;){let t;try{t=S(r)}catch(e){if(e.code===`ENOENT`){r=f(r);continue}throw e}let i=g(n,t);if(i===``||!i.startsWith(`..`)&&!p(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ye(e,t,n){try{if(ae(n).size>10485760)return!1}catch{return!1}let r;try{r=ne(n,`utf-8`)}catch{return!1}let i=[],a=s(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!$(a))return!1;let o=a[e.topLevelKey];if(!$(o))return!1;let c=e.serverMapSubKey?o[e.serverMapSubKey]:o;return $(c)?$(c[e.serverName(t)]):!1}function Xe(e,t,n={}){if(e.id!==`copilot`)return!0;try{return Ye(e,t,e.configPath(t,n.home))}catch{return!1}}function Ze(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Xe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=c(`project`,{checkDesktop:!0}),i=f(r);Ke(i,t);let a=b(r)?`overwritten`:`written`;return C(i,{recursive:!0,force:!0}),te(f(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function Qe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=f(n);return b(n)?(qe(r,t),C(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}export{Ee as C,_e as D,pe as E,Te as S,he as T,Le as _,Ue as a,be as b,We as c,J as d,j as f,z as g,ye as h,Ze as i,k as l,L as m,qe as n,Be as o,I as p,Qe as r,Ge as s,Ke as t,A as u,Ie as v,Re as w,Se as x,we as y};
|
|
56
|
-
//# sourceMappingURL=write-project-skill-
|
|
55
|
+
exit 127`,I=`// ok-pi-bridge`,L=`${I}-v1`,ye=`ok-pi-managed-extension`;function be(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(L)}return!1}function R(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=_(e);if(d(t)===`cli.mjs`&&d(f(t))===`dist`)return t;let n=t.split(v),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return m(i.length===0?v:i.join(v),`packages`,`cli`,`dist`,`cli.mjs`)}function z(e={}){return e.mode===`dev`?{command:M,args:[R(),`mcp`],env:{...N}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{command:`/bin/sh`,args:[`-l`,`-c`,P]}}function xe(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[M,R(),`mcp`],environment:{...N}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,P]}}function Se(e){if(typeof e!=`object`||!e)return!1;let t=e;return B(t,z({mode:`published`,platformName:`darwin`}))||B(t,z({mode:`published`,platformName:`win32`}))}function B(e,t){return Object.keys(e).length===Object.keys(t).length?Ce(e,t):!1}function Ce(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function V(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function we(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:V(t.args,t.command)}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&V(r,n)}function H(e){return e===`win32`?y:h}function Ee(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=e.env??process.env,i=H(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA??i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME??i.join(n,`.config`)}function De(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.claude.json`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=e.env??process.env;if(t===`darwin`)return h.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??y.join(n,`AppData`,`Roaming`);return y.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function W(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.cursor`,`mcp.json`)}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??w();return(e.env??process.env).CODEX_HOME??H(t).join(n,`.codex`)}function ke(e={}){return H(e.platformName??process.platform).join(Oe(e),`config.toml`)}function G(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=(e.env??process.env).COPILOT_HOME??H(t).join(n,`.copilot`);return H(t).join(r,`mcp-config.json`)}function Ae(e={}){let t=e.platformName??process.platform,n=e.home??w(),r=e.env??process.env,i=H(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function K(e={}){return H(e.platformName??process.platform).join(Ae(e),`opencode.json`)}function je(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.openclaw`,`openclaw.json`)}function Me(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.hermes`,`config.yaml`)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??w();return(e.env??process.env).PI_CODING_AGENT_DIR??H(t).join(n,`.pi`,`agent`)}function Pe(e={}){let t=e.platformName??process.platform,n=e.home??w();return H(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Fe(e,t){let n=H(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function q(e={}){let t=e.platformName??process.platform,n=Fe(e.home??w(),t);return n.find(e=>b(e))||n.find(e=>b(f(e)))||n[0]}function Ie(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function Le(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const J={claude:{id:`claude`,label:A.claude,configPath:(e,t)=>De({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.claude`),projectConfigPath:e=>m(e,`.mcp.json`),projectSkillPath:e=>m(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:A[`claude-desktop`],configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(U({home:t}))},cursor:{id:`cursor`,label:A.cursor,configPath:(e,t)=>W({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(W({home:t})),projectConfigPath:e=>m(e,`.cursor`,`mcp.json`),projectSkillPath:e=>m(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:A.codex,configPath:(e,t)=>ke({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(ke({home:t})),projectConfigPath:e=>m(e,`.codex`,`config.toml`),projectSkillPath:e=>m(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:A.copilot,configPath:(e,t)=>G({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(G({home:t})),projectSkillPath:e=>m(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:A.opencode,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>r,buildEntry:(e,t)=>xe(t),scope:`global`,detectPath:(e,t)=>f(K({home:t})),projectConfigPath:e=>m(e,`opencode.json`),projectSkillPath:e=>m(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:A.openclaw,configPath:(e,t)=>je({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:A.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>r,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>Ne({home:t}),projectConfigPath:e=>m(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>m(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:A.antigravity,configPath:(e,t)=>Pe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:A[`lm-studio`],configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(q({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:A.hermes,configPath:(e,t)=>Me({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>r,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>m(t??w(),`.hermes`),offerOnlyWhenDetected:!0}};function Re(e){let t=e.filter(e=>!Object.hasOwn(J,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${k.join(`, `)}`);return e.map(e=>J[e])}const Y=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],X=[...u.map(e=>l[e]),`open-knowledge`];function Z(e){if(!p(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=_(e);if(t===v||f(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Q(e,t){let n=g(e,t);if(n.startsWith(`..`)||p(n))return!1;let r=e;for(let e of n.split(v)){r=m(r,e);try{if(!x(r).isDirectory())return!1}catch{return!1}}return!0}function ze(e,t){try{return re(e).every(n=>t.has(m(e,n)))}catch{return!1}}function Be(e){let t=Z(e),n=[],r=[],i=new Set;for(let e of Y){let a=m(t,e.hostDir,`skills`);if(!Q(t,a))continue;let o=X.map(e=>m(a,e)).filter(e=>b(e));n.push(...o);for(let e of o)i.add(e);let s=m(t,e.pruneRoot),c=a;for(;ze(c,i)&&(r.push(c),i.add(c),c!==s);){let e=f(c);if(e===c||e===t||!e.startsWith(t+v))break;c=e}}return{skillDirs:n,emptyDirs:r}}function Ve(e){try{if(!x(e).isDirectory())return!1;let t=re(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function He(e){let t=new Set,n=new Set;for(let r of Y){let i=m(e,r.hostDir,`skills`);for(let e of X)t.add(m(i,e));let a=m(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=f(o);if(t===o||t===e||!t.startsWith(e+v))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Ue(e,t){let n=Z(e),r=He(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(Q(n,e)&&Ve(e))try{C(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Q(n,e))try{ie(e),a.push(e)}catch{}return a}function We(e){let t=Z(e),n=[];for(let e of u){let r=l[e];n.push({path:m(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of j)n.push({path:m(t,i.hostDir,`skills`,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function Ge(e,t){let n=[];for(let r of We(e))if(r.bundleId===t)try{C(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function Ke(e,t){let n;try{n=x(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Je(e,t)}function qe(e,t){Je(e,t)}function Je(e,t){let n;try{n=S(t)}catch{n=_(t)}let r=f(e);for(;r.length>1&&r!==v;){let t;try{t=S(r)}catch(e){if(e.code===`ENOENT`){r=f(r);continue}throw e}let i=g(n,t);if(i===``||!i.startsWith(`..`)&&!p(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ye(e,t,n){try{if(ae(n).size>10485760)return!1}catch{return!1}let r;try{r=ne(n,`utf-8`)}catch{return!1}let i=[],a=s(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!$(a))return!1;let o=a[e.topLevelKey];if(!$(o))return!1;let c=e.serverMapSubKey?o[e.serverMapSubKey]:o;return $(c)?$(c[e.serverName(t)]):!1}function Xe(e,t,n={}){if(e.id!==`copilot`)return!0;try{return Ye(e,t,e.configPath(t,n.home))}catch{return!1}}function Ze(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Xe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=c(`project`,{checkDesktop:!0}),i=f(r);Ke(i,t);let a=b(r)?`overwritten`:`written`;return C(i,{recursive:!0,force:!0}),te(f(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function Qe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=f(n);return b(n)?(qe(r,t),C(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}export{Ee as C,_e as D,pe as E,Te as S,he as T,Le as _,Ue as a,be as b,We as c,J as d,j as f,z as g,ye as h,Ze as i,k as l,L as m,qe as n,Be as o,I as p,Qe as r,Ge as s,Ke as t,A as u,Ie as v,Re as w,Se as x,we as y};
|
|
56
|
+
//# sourceMappingURL=write-project-skill-D_i5y_ki.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/open-knowledge",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.5",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"ajv-formats": "^3.0.1",
|
|
62
62
|
"tsdown": "^0.21.7",
|
|
63
63
|
"typescript": "^5.9.3",
|
|
64
|
-
"@inkeep/open-knowledge-app": "0.47.
|
|
65
|
-
"@inkeep/open-knowledge-
|
|
66
|
-
"@inkeep/open-knowledge-server": "0.47.
|
|
67
|
-
"@inkeep/open-knowledge-
|
|
64
|
+
"@inkeep/open-knowledge-app": "0.47.5",
|
|
65
|
+
"@inkeep/open-knowledge-core": "0.47.5",
|
|
66
|
+
"@inkeep/open-knowledge-server": "0.47.5",
|
|
67
|
+
"@inkeep/open-knowledge-native-config": "0.0.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build:cli": "tsdown",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./git-handle-CllEzrX4.mjs";export{e as createGitInstance};
|
package/dist/init-BGPGjp1S.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./init-CB3lq_i9.mjs";export{e as runInit};
|
package/dist/loader-BeuP5hjg.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-7y3WQNVR.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-CcFBEKQd.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./index-DlH6tzhG.js";export{e as FeedbackForm};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./ManagedArtifactProperties-CVGjtd3P.js";export{e as ManagedArtifactProperties};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./dist-Nvb76hAm.js";import{Sa as t,ga as n,kt as r,va as i}from"./dist-5ovMzVKN2.js";function a(e){return e.path.split(`/`).slice(0,-1).join(`/`)}var o=[`project`,`global`];function s(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))}}function c(e){return e.startsWith(`open-knowledge-pack-`)?e.slice(t.length):e}function l(e){let t=e.path.replace(/\/SKILL\.mdx?$/i,``);return e.scope===`global`?`~/${t}`:t}function u(e){return e.replace(/^\/(?:Users|home)\/[^/]+/,`~`).replace(/^\/root/,`~`)}function d(){let{_:t}=e();return{project:t({id:`e0NrBM`}),global:t({id:`2GT3Hf`})}}function f(){let{_:t}=e();return{project:t({id:`Es3G-g`}),global:t({id:`fvrHin`})}}function p(e,t){if(e.includes(`/`))return t===`global`?`~/${e}`:e;let r=e===`agents`?`.agents/skills`:(t===`global`?i:n)[e]??`.${e}/skills`;return t===`global`?`~/${r}`:r}function m(e,t){return!e||t===``?[]:Object.keys(e).filter(n=>e[n]===t)}function h(e){let t=e.hostAliases??{},n=e=>e.split(`/`).slice(0,-1).join(`/`),r=new Set(e.hosts),i=new Set([...e.hosts.filter(e=>!e.includes(`/`)).map(t=>p(t,e.scope).replace(/^~\//,``)),...(e.customPlacements??[]).map(e=>n(e.path)),...e.path.includes(`/`)?[n(e.path.replace(/\/SKILL\.mdx?$/i,``))]:[]]);return Object.entries(t).filter(([e,t])=>!r.has(e)&&i.has(t)).map(([e])=>e)}function g(e){let t=new Set(e.symlinkedHosts??[]),n=[],r=new Set,i=(e,t)=>{r.has(e)||(r.add(e),n.push({dir:e,symlink:t}))};i(l(e),t.has(e.hosts[0]??``));for(let n of e.hosts)i(`${p(n,e.scope)}/${e.name}`,t.has(n));for(let t of e.customPlacements??[])i(t.path,t.mode===`link`);return n}function _(e,t=e.hosts){let n=r.options,i=h(e);return[...t.includes(`agents`)?[`agents`]:[],...n.filter(e=>t.includes(e)||i.includes(e)),...(e.customPlacements??[]).map(e=>a(e))]}export{c as a,s as c,d,_ as i,u as l,m as n,g as o,a as r,p as s,o as t,f as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./repair-skills-IlcXRdDC.mjs";export{e as repairSkills};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,o as t,r as n}from"./server-lock-CmYdHyX7.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
|
package/dist/src-BWFntIGk.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Mo as e,No as t,P as n,Po as r,R as i,Yo as a,Zo as o,d as s,l as c,ss as l,ws as u}from"./src-CHSJwcpc.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,Ar as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ci as D,Cn as O,Cr as k,Ct as A,D as j,Di as M,Dn as N,Dt as P,E as F,Ei as I,En as L,Et as R,F as z,Fi as B,Fn as V,Fr as H,Ft as U,G as W,Gi as G,Gn as K,Gr as q,Gt as J,H as Y,Hi as X,Hn as Z,Hr as Q,Ht as $,I as ee,Ii as te,In as ne,Ir as re,It as ie,J as ae,Ji as oe,Jn as se,Jr as ce,Jt as le,K as ue,Ki as de,Kn as fe,Kr as pe,Kt as me,L as he,Li as ge,Ln as _e,Lr as ve,Lt as ye,M as be,Mi as xe,Mn as Se,Mr 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,Tt as rt,U as it,Ui as at,Un as ot,Ur as st,Ut as ct,V as lt,Vi as ut,Vn as dt,Vr as ft,Vt as pt,W as mt,Wi as ht,Wn as gt,Wr as _t,Wt as vt,X as yt,Xi as bt,Xn as xt,Xr as St,Xt as Ct,Y as wt,Yi as Tt,Yn as Et,Yr as Dt,Yt as Ot,Z as kt,Zi as At,Zn as jt,Zr as Mt,Zt as Nt,_ as Pt,_a as Ft,_i as It,_n as Lt,_r as Rt,_t as zt,a as Bt,aa as Vt,ai as Ht,an as Ut,ar as Wt,at as Gt,b as Kt,bi as qt,bn as Jt,br as Yt,bt as Xt,c as Zt,ca as Qt,ci as $t,cn as en,cr as tn,ct as nn,d as rn,da as an,di as on,dn as sn,dr as cn,ea as ln,ei as un,en as dn,er as fn,et as pn,f as mn,fa as hn,fi as gn,fn as _n,fr as vn,g as yn,ga as bn,gi as xn,gn as Sn,gr as Cn,gt as wn,h as Tn,ha as En,hi as Dn,hn as On,hr as kn,i as An,ia as jn,ii as Mn,in as Nn,ir as Pn,it as Fn,j as In,ji as Ln,jn as Rn,jr as zn,jt as Bn,k as Vn,ki as Hn,kn as Un,kt as Wn,l as Gn,la as Kn,li as qn,ln as Jn,lr as Yn,lt as Xn,m as Zn,ma as Qn,mi as $n,mn as er,mr as tr,n as nr,na as rr,ni as ir,nn as ar,nr as or,nt as sr,o as cr,oa as lr,oi as ur,on as dr,or as fr,ot as pr,p as mr,pa as hr,pi as gr,pn as _r,pr as vr,q as yr,qi as br,qn as xr,qr as Sr,qt as Cr,r as wr,ra as Tr,ri as Er,rn as Dr,rr as Or,rt as kr,s as Ar,sa as jr,si as Mr,sn as Nr,sr as Pr,st as Fr,t as Ir,ta as Lr,ti as Rr,tn as zr,tr as Br,tt as Vr,u as Hr,ua as Ur,ui as Wr,un as Gr,ur as Kr,v as qr,va as Jr,vn as Yr,vr as Xr,vt as Zr,w as Qr,wi as $r,wn as ei,wr as ti,wt as ni,x as ri,xi as ii,xn as ai,xr as oi,xt as si,y as ci,yi as li,yn as ui,yr as di,yt as fi,z as pi,zi as mi,zn as hi,zr as gi,zt as _i}from"./src-BS7drzIV.mjs";import{C as vi,E as yi,T as bi,_ as xi,b as Si,c as Ci,d as wi,g as Ti,i as Ei,l as Di,m as Oi,n as ki,p as Ai,s as ji,t as Mi,u as Ni,v as Pi,w as Fi,x as Ii,y as Li}from"./fs-traced-D12ehU8a.mjs";import{a as Ri,d as zi,f as Bi,i as Vi,l as Hi,n as Ui,r as Wi,t as Gi,u as Ki}from"./logger-5LePyO3n.mjs";import{S as qi,_ as Ji,a as Yi,c as Xi,f as Zi,g as Qi,h as $i,i as ea,l as ta,m as na,n as ra,o as ia,p as aa,r as oa,s as sa,t as ca,u as la,v as ua,x as da}from"./server-lock-CmYdHyX7.mjs";export{Kn as AGENT_ID_MAX_LEN,Ur as AGENT_ID_RE,tt as AGENT_WRITE_ORIGIN,bn as AcpPermissionStore,hr as AcpRegistry,Xe as AcpThreadManager,qt as AgentFocusBroadcaster,li as AgentPresenceBroadcaster,I as AgentSessionCapacityError,M as AgentSessionManager,zt as AutoStartDisabledError,Kr as BUNDLE_IDS,cn as BUNDLE_SCOPE,vn as BUNDLE_SKILL_NAME,dt as BacklinkIndex,ge as CC1Broadcaster,o as CC1_CONTRACT_VERSION,sn as CONFIG_FILENAME,V as CONFLICT_MARKER_RE,Le as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Pt as ConfigSchema,at as DEFAULT_CHECKPOINT_RETENTION,St as DEFAULT_EMBEDDINGS_DIMENSIONS,ie as DEFAULT_PACK_ID,lt as DocumentDurabilityState,Mt as EMBEDDINGS_API_KEY_ENV,Qn as FEATURED_AGENT_IDS,ht as FILE_SYSTEM_WRITER,hi as FILE_WATCHER_ORIGIN,_t as FileEmbeddingsBackend,Ue as GIT_PREFLIGHT_FAIL_SPAN_NAME,G as GIT_UPSTREAM_WRITER,Ft as GitDirAccessError,dn as GitNotAvailableError,zr as GitTooOldError,Zr as HOCUSPOCUS_AUTH_REJECTION_REASONS,fi as HocuspocusAuthRejection,Xt as HocuspocusAuthTokenSchema,w as INSTALLED_AGENTS_SCHEMES,a as LINEAGE_EPOCH_KEY,We as LIVE_DERIVED_INDEX_DEBOUNCE_MS,ye as LOG_MD_TEMPLATE,R as MANAGED_RENAME_ORIGIN,D as MAX_ACP_THREADS,je as MAX_AGENT_SESSIONS,nn as MCP_CONNECTION_ID_HEADER,e as MCP_SERVER_NAME,Hn as MIN_EVICTABLE_IDLE_MS,ar as MIN_GIT_VERSION,Y as MISSING_OK_CONFIG_MESSAGE,Jr as MalformedGitPointerError,pn as McpLogger,it as MissingOkConfigError,Ln as OBSERVER_SYNC_ORIGIN,_n as OK_OKIGNORE_TEMPLATE,t as ORPHAN_MODES,u as PROTOCOL_VERSION,Gi as PinoLogger,Xi as ProcessLockCollisionError,Gn as ProjectGitInitError,P as ROLLBACK_ORIGIN,_r as ROOT_GITIGNORE_TEMPLATE,Qi as RUNTIME_VERSION,gn as RemoteConfigError,de as SERVICE_WRITER,Wt as SKILL_INSTALL_EVENTS_FILE_REL,n as SKILL_STATE_TARGETS,Je as STARTER_FOLDERS,_i as STARTER_FOLDER_FRONTMATTER_FILENAME,T as STARTER_PACKS,pt as STARTER_PACK_IDS,$ as STARTER_TEMPLATES,et as STATE_MANIFEST_FILENAME,Ji as STATE_SCHEMA_VERSION,l as SYSTEM_DOC_NAME,le as SeedPrerequisiteError,Ot as SeedRootDirError,ca as ServerLockCollisionError,Ir as SingleFileNotAFileError,nr as SingleFileNotFoundError,wr as SingleFileNotMarkdownError,F as StateManifestError,C as TagIndex,vr as USER_GLOBAL_BUNDLE_IDS,ot as UiLockCollisionError,Ne as __getShowAllWalkStatsForTesting,Wn as __resetShowAllWalkStatsForTesting,ta as acquireProcessLock,ra as acquireServerLock,gt as acquireUiLock,_ as applyAgentMarkdownWrite,De as applyExternalChange,U as applySeed,j as assertCompatibleStateManifest,Dr as assertGitAvailable,ai as assertNeverDiskEvent,ii as attachAcpThreadSocket,wn as attachIdleShutdown,qr as bootServer,se as buildAndOpenSkill,er as buildConfigYmlContent,wt as buildExecResult,$r as buildOkMcpStdioCommand,Pr as buildSkillZip,ct as buildStarterFolderFrontmatterYaml,br as buildWipTree,tr as bundleSkillMdPath,q as canonicalProjectKey,Ze as classifyEvents,Mi as classifyFsPath,pe as clearAllEmbeddingsKeys,m as clearContributors,vt as coercePackId,c as colorFromSeed,oe as commitUpstreamImport,Tt as commitWip,bt as commitWipFromTree,Nn as compareSemver,Rt as composeEffectiveLinterConfig,Xr as composeFrontmatterSchemasConfig,ne as containsConflictMarkers,O as contentHash,un as contributorCount,Pe as countShadowObjects,z as countStaleAgentWipRefs,ee as countWipRefs,b as createApiExtension,qn as createAssetServeMiddleware,W as createCollaborationHost,y as createContentFilter,zn as createContentFilterAsync,Sr as createEmbeddingsSecretStore,An as createEphemeralProjectDir,Ie as createExternalChangeHandler,mn as createFileLogger,pi as createLiveDerivedIndexExtension,yr as createMcpHttpHandler,ft as createOsProbe,Te as createPersistenceExtension,E as createServer,In as createServerObserverExtension,Fe as createStreamingErrorWriter,Ui as createTestLogger,ce as describeStoredEmbeddingsKey,yn as detectClaudeDesktopPresence,Ut as detectGit,Ae as detectProjectShape,Et as detectUserSkillHosts,kr as discoverLockDirs,oi as discoverMarkdownlintConfig,h as emitPreflightFailureSpan,yt as encodeDocName,kt as encodeFolderRoute,ze as encodeSkillRoute,Hr as ensureProjectGit,On as ensureProjectSkillGitignore,B as errorResponse,ei as evictStaleTrackerEntries,Bn as extractHeadings,Fn as extractOkBinaryPath,Z as extractWikiLinksFromMarkdown,dr as fallbackPaths,rn as findEnclosingGitRoot,ui as findEnclosingProjectRoot,Qe as findNativeMarkdownlintFile,mr as flushFileLogger,si as formatAuthRejectionWire,Rr as formatContributors,ir as formatContributorsFrom,ke as formatPackRationale,At as gcCheckpointRefs,Vr as getCurrentMcpLogger,ur as getLocalDir,Zn as getLogFilePath,Wi as getLogger,Tn as getLogsDir,ua as getMachineId,Li as getMeter,jn as getMetrics,Si as getTracer,Vt as handleCollabSocketError,H as handleSpawnCursor,gr as hasForwardingHeaders,he as hasGcLogLatch,s as iconFromClientName,lr as incrementCollabSocketFilteredError,jr as incrementServerObserverFire,Sn as initContent,Be as initShadowRepo,Ii as initTelemetry,Kt as initToleranceTelemetryWriter,Fr as installPrettyZodErrors,Vi as installTestLoggers,xt as installUserSkill,on as isAllowedApiOrigin,xn as isAllowedWorkspaceHostHeader,Ge as isConfigDoc,$e as isHocuspocusAuthRejectionReason,J as isKnownPackId,mi as isLinkIndexExcludedDoc,It as isLoopbackAddress,S as isManagedArtifactDoc,r as isOrphanMode,xe as isPairedWriteOrigin,re as isPathWithinDir,da as isProcessAlive,Jt as isProjectRoot,$n as isRemoteAdmitted,ut as isReservedForUserTree,nt as isSelfWrite,X as isSystemDoc,ri as isToleranceTelemetryEnabled,qi as isValidLockPid,L as lastKnownHash,f as listRescueCheckpoints,me as listStarterPacks,En as loadCustomAgents,be as loadPrincipal,la as lockFilePath,Ri as loggerFactory,Hi as logsCurrentPath,Ki as logsPreviousPath,Dt as makeLazyEmbeddingsKeyStore,oa as markServerLockDraining,mt as mountMcpAndApi,ki as normalizeFsPath,kn as originGitHubHost,Lt as packageVersionMajorMinor,A as parseAuthRejectionWire,Nr as parseGitVersion,ni as parseHocuspocusAuthToken,ue as parseKeepaliveConnectionId,N as pathToDocName,Re as planSeed,Bt as prepareSingleFileOpen,Gt as processCommand,pr as processUsage,jt as readAllTargets,Ve as readBundleDecision,k as readOwnNativeRules,Zi as readProcessLock,aa as readProcessLockDetailed,x as readProjectHeadState,st as readProjectLocalSemanticConfig,ea as readServerLock,p as readServerPackageVersion,fn as readSkillInstallStateSnapshot,Vn as readStateManifest,Br as readTargetRecordedAt,or as readTargetVersion,K as readUiLock,_e as reconcile,Er as recordContributor,fr as recordSkillInstallEvent,ae as registerAllTools,Me as registerWrite,na as releaseProcessLock,Yi as releaseServerLock,fe as releaseUiLock,Un as removeLastKnownHash,Qt as resetMetrics,i as resolveBundleEnabled,tn as resolveBundledSkillDir,Mr as resolveContentDir,ve as resolveCursorBinaryDefault,qe as resolveCursorSpawnInvocation,di as resolveEffectiveLinterConfig,He as resolveEmbeddingsCredential,$t as resolveLockDir,Yt as resolveNativeConfigForDoc,ti as resolveNativeMarkdownlintConfig,Cr as resolvePack,Ar as resolvePackageVersion,Dn as resolveRemoteAccess,d as resolveUiInfo,Mn as restoreContributors,ci as restoreLifecycleFromConflictsJson,Ce as rewriteMarkdownLinksForDocumentRename,Oe as rewriteWikiLinksForDocumentRename,en as runAuthReposSubprocess,Jn as runAuthStatusSubprocess,Ct as runCloneSubprocess,Gr as runDeviceFlowSubprocess,sr as runWithMcpLogger,Wr as safeContentPath,we as safeSubdir,ln as safetyCheckpoint,Xn as sanitizeClientName,Lr as saveInMemoryCheckpoint,rr as saveVersion,rt as seedBasenameIndex,cr as serializeError,vi as setActiveSpanAttributes,Ee as setupServerObservers,Tr as shadowGit,Fi as shutdownTelemetry,zi as spansCurrentPath,Bi as spansPreviousPath,gi as spawnDetached,Ke as splitMarkdownBlocks,v as startWatcher,te as streamingProblemEvent,Ht as swapContributors,Ye as teardownToleranceTelemetryWriter,an as toBroadcasterKey,Ei as tracedAppendFileSync,ji as tracedLinkSync,Ci as tracedMkdir,Di as tracedMkdirSync,Ni as tracedRename,wi as tracedRenameSync,Ai as tracedRmSync,Oi as tracedRmdirSync,Ti as tracedUnlinkSync,xi as tracedWriteFile,Pi as tracedWriteFileSync,Qr as trustSystemCertificates,Zt as untrackTrackedProjectSkillProjection,Rn as updateLastKnownHash,$i as updateProcessLockPort,ia as updateServerLockPort,xr as updateUiLockPort,hn as validateAgentId,Nt as validateCloneInputs,Yn as validateSkillZip,sa as waitForServerLockDrain,Q as withHiddenWindowsConsole,bi as withSpan,yi as withSpanSync,Or as writeBundleDecision,Cn as writeMarkdownlintRule,Yr as writeRootGitignoreForNewRepo,g as writeStateManifest,Pn as writeTargetVersion,Se as writeTracker};
|
package/dist/start-DPqozQkA.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as e,r as t,v as n}from"./start-BITNJysu.mjs";export{t as bootStartServer,e as resolveHost,n as startCommand};
|