@inkeep/open-knowledge 0.80.0-beta.5 → 0.80.0-beta.6
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/cli.mjs +72 -74
- package/dist/config-schema.json +3 -3
- package/dist/config.project-local.schema.json +1 -1
- package/dist/config.user.schema.json +2 -2
- package/dist/constants-BM21y1CS.mjs +1 -0
- package/dist/dist-BBi7mVvL.mjs +1 -0
- package/dist/dist-GcFBLEr5.mjs +2130 -0
- package/dist/index.mjs +233 -233
- package/dist/{init-Boyt6ulg.mjs → init-BR_RY0pY.mjs} +17 -17
- package/dist/init-z4dkIpZb.mjs +1 -0
- package/dist/{js-exec-VXN6TZ7U-B4rL1N_3.mjs → js-exec-VXN6TZ7U-Z8_USGOo.mjs} +4 -4
- package/dist/{launch-json-removal-B7LKMRLc.mjs → launch-json-removal-CSulcUxI.mjs} +1 -1
- package/dist/loader-CDBcy7_5.mjs +1 -0
- package/dist/{loader-DXL-jEwi.mjs → loader-CpDpte48.mjs} +1 -1
- package/dist/{lzma-C5bZvzmx.mjs → lzma-CEMDJHEs.mjs} +2 -2
- package/dist/{md-manager-BGnqyqi1-LuKRfqxD.mjs → md-manager-BGnqyqi1-DCa5-0ww.mjs} +153 -153
- package/dist/{open-browser-B_00nhl_.mjs → open-browser-CDL2mqCk.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-B_9MsldP.mjs → preview-BCSrELqH.mjs} +1 -1
- package/dist/preview-rGoADBsd.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Fa2Bc7H7.js → ActivityModeContent-DItZVTCk.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-CY_aojnI.js → AddPropertiesButton-CvdBSXbP.js} +2 -2
- package/dist/public/assets/{AgentDiffPane-VQlod0uk.js → AgentDiffPane-Cm2GzZBM.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-D83Ifc_u.js → AgentThreadClientBinder-CFgtBbQR.js} +1 -1
- package/dist/public/assets/{BugReportHistory-DNPLKDE6.js → BugReportHistory-DDQ7rrrr.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-BMwN9BIK.js → BugReportHistoryDialog-Bt-xM9-I.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-q5OQqF4N.js → CodeMirrorPropInput-Bf645WUa.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-BarwUkfl.js → ConsentDialogBody-RBMJ0gc0.js} +1 -1
- package/dist/public/assets/{DeleteConfirmationDialog-tv35CpzH.js → DeleteConfirmationDialog-n90yA0mh.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-Df7pBeha.js → DiffViewBoundary-DsG9GOLX.js} +1 -1
- package/dist/public/assets/{DocumentContext-VRYqEU-B.js → DocumentContext-B3xlplVb.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-Ey6xkZS2.js → EditorModeToggle-Blopqyef.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-Di9qhAZg.js → EnableSyncConfirmDialog-B056XoQ0.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-CjG9RZeu.js → ExcalidrawDocEditor-C4F3udw2.js} +1 -1
- package/dist/public/assets/FeedbackForm-GRSOr0fy.js +1 -0
- package/dist/public/assets/{GraphPanel-sDvfmrPI.js → GraphPanel-CewYgyfZ.js} +1 -1
- package/dist/public/assets/{ImageAttachments-COJDM7Zs.js → ImageAttachments-DmjOMNqA.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DZI_Ymxz.js → ImportSkillDialog-CgCFe5Pv.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-CMCb-_WR.js → LintConfigEditor-BgrTlSeu.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-C-o6w1oB.js → ManagedArtifactProperties-BTFq6Ngk.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-mFeT6hbW.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-af9-qY7T.js → MermaidDocEditor-C5hGyxfZ.js} +1 -1
- package/dist/public/assets/{OpenInAgentMenuItem-lbV79xn9.js → OpenInAgentMenuItem-QrteG6Br.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-CbnGGdQB.js → PropertyDisplayRow-D2nLNITg.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-Btbw9w2J.js → RegisteredAgentIcon--fiCkSba.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-B1H-65Sn.js → ReportBugDialogBody-BHJJSRc_.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-B-ySnIcK.js → ReportBugMenuTrigger-DDbgWwFU.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-T4_tM4AM.js → SchemaConfigEditor-CkjLP98S.js} +1 -1
- package/dist/public/assets/{SessionsHost-Df6cK8IF.js → SessionsHost-4CsyZngA.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-7ULgKnMJ.js → SettingsDialogBody-bpn_QRzv.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-ycuaed88.js → ShareBranchSwitchDialog-C4Eqwx_r.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-DmE16_gX.js → ShareReceiveDialog-CNa1HD1Q.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DqsqkZ98.js → ShareReceiveMissDialog-B-_2h-KD.js} +1 -1
- package/dist/public/assets/{SkillCostValue-C43y1frw.js → SkillCostValue-CYw_tCqR.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-DttpBxOJ.js → SkillEditBanner-BuW2sJvG.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-Dzre8M2R.js → SkillForkDialog-DAn5-JZV.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-B0JB7kZB.js → SkillInstallMenu-Cesp0OI6.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-CShk5VBB.js → SkillOriginInline-_uPhVG7Y.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-1BYcSekj.js → SkillToolbarControls-C3cT4d_4.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-CIR9Gt5P.js → SlidesToolbarControls-zHguPndQ.js} +1 -1
- package/dist/public/assets/{SourceEditor-dlengKQr.js → SourceEditor-Dkmhiwbb.js} +1 -1
- package/dist/public/assets/{TerminalPanel-DVVYNGxU.js → TerminalPanel-BzL8_A5I.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-Dbf1LEIb.js → TerminalWindowApp-vD_LAXsa.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Bfgflu7Y.js → TextDocEditor-DqBZzHgY.js} +1 -1
- package/dist/public/assets/{ThreadView-BAqefrNB.js → ThreadView-DMbL0dhG.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-C5Pk8YKQ.js → TimelineDiffPane-vm_67Xp-.js} +1 -1
- package/dist/public/assets/{agent-connections-36VzA4Nj.js → agent-connections-BZwWjV-L.js} +1 -1
- package/dist/public/assets/{auth-state-cache-y7ZNLaEX.js → auth-state-cache-DYtj5a86.js} +1 -1
- package/dist/public/assets/{bug-report-send-manager-WZvhB30v.js → bug-report-send-manager-DOLrtOEv.js} +1 -1
- package/dist/public/assets/{client-version-DAE_LnJT.js → client-version-CDitBjAS.js} +1 -1
- package/dist/public/assets/{comment-chips-mEcLNjUa.js → comment-chips-ClsM-kmI.js} +1 -1
- package/dist/public/assets/{config-provider-Dc4ERnKv.js → config-provider-Ca2HUShB.js} +1 -1
- package/dist/public/assets/{css-color-to-hex-HXZok3qq.js → css-color-to-hex-AUn7eIel.js} +1 -1
- package/dist/public/assets/{diagnostic-breadcrumb-Da90WJfg.js → diagnostic-breadcrumb-g0QEaFL4.js} +1 -1
- package/dist/public/assets/{dist-BXv2iH4t.js → dist-DILeGueK.js} +192 -192
- package/dist/public/assets/{doc-paths-DbP8RoCY.js → doc-paths-BWrKtSx2.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-BuQfcH7g.js → doc-undo-manager-DSaQkZ_X.js} +1 -1
- package/dist/public/assets/{documents-events-B9_p7FnW.js → documents-events-Do7TM3Hd.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-CC3PZmuz.js → file-tree-adapter-C1_qOMsA.js} +1 -1
- package/dist/public/assets/{file-tree-utils-SoxHR8nZ.js → file-tree-utils-BcIIWtsU.js} +1 -1
- package/dist/public/assets/{folder-config-api-D2T7lLE2.js → folder-config-api-CDR1eAcz.js} +1 -1
- package/dist/public/assets/{index-ZJRhdCXy.js → index-KTOtrBN1.js} +8 -8
- package/dist/public/assets/{lint-config-client-ByyVt3Ji.js → lint-config-client--83L6Vzq.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-DLR8ICzt.js → markdownlint-rule-browser-Dwh97LWk.js} +1 -1
- package/dist/public/assets/{navigation-targets-CPBRP2pX.js → navigation-targets-CJ9ZxyzV.js} +1 -1
- package/dist/public/assets/{page-list-cache-DP6EykyZ.js → page-list-cache-C6t_W1Qs.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BiglQO8z.js → pending-receive-nav-store-CRjoDiuf.js} +1 -1
- package/dist/public/assets/{preferred-session-events-Bw6PF8j6.js → preferred-session-events-CwZtdTs7.js} +1 -1
- package/dist/public/assets/{progress-3N7lmUHc.js → progress-_zYa5fpq.js} +1 -1
- package/dist/public/assets/{project-paths-WwDCX6Wj.js → project-paths-ygpKMwOT.js} +1 -1
- package/dist/public/assets/{prop-types-D7m1bgZd.js → prop-types-CT1xGqpW.js} +1 -1
- package/dist/public/assets/{receive-store-s0TOnYEX.js → receive-store-DutQ_RL1.js} +1 -1
- package/dist/public/assets/{selection-context-DFvB64m4.js → selection-context-C1ld48kx.js} +1 -1
- package/dist/public/assets/{sign-in-terminal-events-n2711hbP.js → sign-in-terminal-events-BqTVNN-V.js} +1 -1
- package/dist/public/assets/{skill-scope-BEZoxlA_.js → skill-scope-CUAEKGV-.js} +1 -1
- package/dist/public/assets/{skills-api-xEJYLsBT.js → skills-api-CM8h9xtl.js} +1 -1
- package/dist/public/assets/{src-DW6dj9Em.js → src-U7mQYf3e.js} +1 -1
- package/dist/public/assets/{startup-marks-BI3f20Ai.js → startup-marks-vgWlVGPK.js} +1 -1
- package/dist/public/assets/{tag-pill-input-9A5egJpq.js → tag-pill-input-BRyN2FKA.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-KL1RgeS2.js → target-navigation-intent-7jeW8XWM.js} +1 -1
- package/dist/public/assets/{telemetry-startup-D5AbtRQp.js → telemetry-startup-DiFICPCo.js} +1 -1
- package/dist/public/assets/{terminal-command-events-Cwnlls-2.js → terminal-command-events-CVCqfbNT.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-BeaRJslN.js → terminal-launch-events-DuaMfoq_.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-B-Ex6x4P.js → terminal-telemetry-BHuv7G5q.js} +1 -1
- package/dist/public/assets/{thread-client-BohJshIz.js → thread-client-BZoVbxhe.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-CRC92mGc.js → typing-burst-detector-d8VRIyWa.js} +1 -1
- package/dist/public/assets/{uninstall-BI1OhVGa.js → uninstall-D2krzbU2.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DSA7U3E8.js → use-activity-panel-HUILZrq4.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-BQbUd-j-.js → use-apply-config-language-BwIOrXvC.js} +1 -1
- package/dist/public/assets/{use-collab-url-BLYPZ3GH.js → use-collab-url-JUcW-mVG.js} +1 -1
- package/dist/public/assets/{use-conflicts-Bk4ek4CK.js → use-conflicts-yBw-ZjZM.js} +1 -1
- package/dist/public/assets/{use-git-sync-status-CDLRE1Yh.js → use-git-sync-status-CoUdayE7.js} +1 -1
- package/dist/public/assets/{use-installed-clis-e8k5ayDZ.js → use-installed-clis-j9XDtwV2.js} +2 -2
- package/dist/public/assets/{use-live-xterm-theme-CumqDZtn.js → use-live-xterm-theme-DBWjwre6.js} +1 -1
- package/dist/public/assets/{use-open-skill-LwyclBox.js → use-open-skill-Ci_4ajE0.js} +1 -1
- package/dist/public/assets/{use-settings-route-4si6XFq0.js → use-settings-route-DHuAch1j.js} +1 -1
- package/dist/public/assets/{use-skill-origin-BuNz7780.js → use-skill-origin-DhcploXf.js} +1 -1
- package/dist/public/assets/{use-skills-C1ayg_tU.js → use-skills-DJX6inxB.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-DH9NZVb3.js → use-terminal-enabled-Y78SBxmZ.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-x56ANf6r.js → use-timeline-entry-diff-Cf1oA_J7.js} +1 -1
- package/dist/public/assets/{use-workspace-DkzDvF62.js → use-workspace-2aIeQVoi.js} +1 -1
- package/dist/public/index.html +59 -59
- package/dist/public/uninstall.html +3 -3
- package/dist/{python3-DNGS4G3E-Cm5Hwa-u.mjs → python3-DNGS4G3E-CixyRGKv.mjs} +3 -3
- package/dist/registry-probes-CpUHw0Pt.mjs +17 -0
- package/dist/{removal-file-path-3ZpUklLl.mjs → removal-file-path-D4u7hIns.mjs} +1 -1
- package/dist/{repair-launch-json-CMMYwCjW.mjs → repair-launch-json-D12M3uwf.mjs} +1 -1
- package/dist/{repair-mcp-configs-DzGALib-.mjs → repair-mcp-configs-CFOzC6j6.mjs} +1 -1
- package/dist/schemas/v0/config.project-local.schema.json +1 -1
- package/dist/schemas/v0/config.user.schema.json +2 -2
- package/dist/{sqlite3-TE5AIOTF-DxxxT49W.mjs → sqlite3-TE5AIOTF-DVwda1Ow.mjs} +3 -3
- package/dist/src-CO1INi5A.mjs +11 -0
- package/dist/src-DmfAVE82.mjs +1 -0
- package/dist/{start-Jnb5yYdV.mjs → start-CfQ2ZJ9V.mjs} +3 -3
- package/dist/start-DjI3fnEc.mjs +1 -0
- package/dist/{tar-MZQD7NO4-JRjaVj6V.mjs → tar-MZQD7NO4-BRGDcHqv.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-BZiqchuc.mjs +0 -1
- package/dist/dist-CuWl8z8W.mjs +0 -1
- package/dist/dist-DZXRg1jC.mjs +0 -2130
- package/dist/init-Bx1lz5rE.mjs +0 -1
- package/dist/loader-C5L_-7Kf.mjs +0 -1
- package/dist/preview-C2LIBolB.mjs +0 -1
- package/dist/public/assets/FeedbackForm-0otENm61.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-C-JL8uLM.js +0 -1
- package/dist/registry-probes-3L8CRnGg.mjs +0 -17
- package/dist/src-DU6Xx1gD.mjs +0 -11
- package/dist/src-DjmVymt-.mjs +0 -1
- package/dist/start-B8Yg-ZtE.mjs +0 -1
package/dist/init-Bx1lz5rE.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-DZXRg1jC.mjs";import{_ as e}from"./init-Boyt6ulg.mjs";export{e as runInit};
|
package/dist/loader-C5L_-7Kf.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-DXL-jEwi.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-B_9MsldP.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./index-ZJRhdCXy.js";export{e as FeedbackForm};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./ManagedArtifactProperties-C-o6w1oB.js";export{e as ManagedArtifactProperties};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{Gd as r,Hd as i,Jl as a,Ku as o,Wd as s,if as c,lf as l,qd as u,td as d,uf as f}from"./md-manager-BGnqyqi1-LuKRfqxD.mjs";import{Dn as p,Ko as m,Vn as h,Vo as g,go as _,ia as v,jo as ee,m as y,nr as b,qo as te}from"./dist-DZXRg1jC.mjs";import{$ as x,A as ne,J as re,M as S,O as C,P as w,R as ie,T as ae,X as T,at as oe,ct as se,d as ce,dt as le,f as ue,it as de,j as fe,k as pe,lt as me,nt as he,o as ge,rt as _e,tt as ve,v as ye,w as be,x as xe,y as Se}from"./init-Boyt6ulg.mjs";import{t as Ce}from"./is-object-BGze3w87.mjs";import{t as we}from"./removal-file-path-3ZpUklLl.mjs";import{spawn as Te}from"node:child_process";import{basename as E,dirname as D,join as O,resolve as k,win32 as Ee}from"node:path";import{accessSync as De,constants as A,existsSync as j,lstatSync as M,mkdirSync as Oe,readFileSync as N,readdirSync as P,realpathSync as F,rmSync as ke,rmdirSync as Ae,statSync as I,unlinkSync as je}from"node:fs";import{homedir as L}from"node:os";import{createHash as Me}from"node:crypto";import{isDeepStrictEqual as Ne}from"node:util";import{setTimeout as Pe}from"node:timers/promises";var Fe=o();let Ie;function Le(){return Ie}function Re(e,t){if(t!==void 0&&t.length>0)return t;try{return b(e)?.rootPath}catch{return}}function ze(e){let t=Re(e.cwd,e.configuredProjectName),n=p({name:`cli`,project:t});return Ie=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}const R=`open-knowledge`;function z(e){try{e()}catch{}}var Be=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(R,e).getPassword()}catch(t){return z(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return z(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return z(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(R,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(R,e).deletePassword()}catch{}}},B=class{backend=`file`;authFile;constructor(e){this.authFile=e??O(L(),`.ok`,`auth.yml`)}read(){if(!j(this.authFile))return{};try{let e=N(this.authFile,`utf-8`);return(0,Fe.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=D(this.authFile);j(t)||Oe(t,{recursive:!0,mode:448}),g(this.authFile,(0,Fe.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},Ve=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ~/.ok/auth.yml to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function He(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(R,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
|
|
2
|
-
`),z(()=>t?.onBackendSelected?.({backend:`keyring`})),new Ve(new Be(t?.onKeychainRead),new B(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (~/.ok/auth.yml) — OS keychain unavailable: ${r}\n`),z(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new B(e)}}function Ue(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (~/.ok/auth.yml)\n`),r(new B(e))},n)});try{return await Promise.race([He(e),r])}catch{return new B(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function We(e){let t=Ue(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}function Ge(e){let t=Ue(e);return{backend:`file`,async get(e){return(await t()).get(e)},async set(e,n,r,i){return(await t()).set(e,n,r,i)},async clear(e){return(await t()).clear(e)}}}async function Ke(e,t){let n=[],r=new B(t);await r.get(e)!=null&&(await r.clear(e),n.push(`file`));let i;try{let{Entry:t}=await import(`@napi-rs/keyring`);new t(R,`__probe__`);let r,a=await new Be(e=>{e.kind===`read-error`&&(r=e.error??`read-error`)}).get(e);if(r!==void 0)i=r;else if(a!=null)try{new t(R,e).deletePassword(),n.push(`keychain`)}catch(e){i=e instanceof Error?e.name:`delete-error`}}catch{}return{touched:n,keychainError:i}}function qe(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function Je(e){let t=e?.code;return t===`ENOENT`||t===`EACCES`||t===`EPERM`?{ok:!1,reason:`not-installed`}:{ok:!1,reason:`spawn-error`}}function Ye(e){return _({detached:!0,stdio:`ignore`,shell:!1,env:qe(e)})}function Xe(e,t,n={}){let r=(n.spawn??Te)(e,[...t],Ye(n.env??process.env));return r.unref(),r}function Ze(e,t,n={}){let r=n.spawn??Te,i=n.timeoutMs??2e3;return new Promise(a=>{let o=!1,s=e=>{o||(o=!0,a(e))},c=setTimeout(()=>s({ok:!1,reason:`timeout`}),i);try{let i=r(e,[...t],Ye(n.env??process.env));i.once(`error`,e=>{clearTimeout(c),s(Je(e))}),i.once(`spawn`,()=>{clearTimeout(c),s({ok:!0})});try{i.unref()}catch{}}catch(e){clearTimeout(c),s(Je(e))}})}const Qe=c.stable.appId,V=[c.stable,c.beta];function $e(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return I(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function et(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}let t=e.homeDir??L();for(let n of V)for(let r of[O(t,`Applications`),`/Applications`]){let t=O(r,`${n.productName}.app`);if(tt(e,O(t,`Contents`,`MacOS`,n.productName)))return t}return null}function tt(e,t){try{let n=e.statSync(t);return n?typeof n.isFile==`function`&&n.isFile():!1}catch{return!1}}function nt(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&V.find(t=>e.execPath.toLowerCase().endsWith(`\\${l(t).toLowerCase()}`)))return e.execPath;let t=e.env.LOCALAPPDATA;if(t)for(let n of V)for(let r of f(n)){let i=Ee.join(t,`Programs`,r,l(n));if(tt(e,i))return i}return null}function rt(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&V.find(t=>e.execPath.endsWith(`/${t.linuxExecutableName}`)))return e.execPath;for(let t of V){let n=`/opt/${t.productName}/${t.linuxExecutableName}`;if(tt(e,n))return n}return null}function it(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`?et(e):e.platform===`win32`?nt(e):rt(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 at(e,t){let n=e.log??(e=>console.error(e)),r=e.platform??process.platform;n("Launching OpenKnowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}if(r===`darwin`){Xe(`open`,[`-a`,i],{spawn:e.spawn});return}Xe(i,[],{spawn:e.spawn})}function ot(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it from https://openknowledge.ai/download, 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 H(e){return e.replace(/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}\u200b\ufeff]/gu,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function st(e){return Me(`sha256`).update(e).digest(`hex`)}function U(e){return O(k(e),`.ok`,`pi-trust`)}function ct(e,t){return O(U(e),st(k(t)))}function lt(e,t,n){return O(ct(e,t),`${st(n)}.json`)}var W=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${H(e)} ${H(t)}; ${H(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function G(e,t,n){let r=n.code,i=n instanceof Error?n.message:String(n),a;switch(r){case`EACCES`:case`EPERM`:a=`check receipt and parent-directory permissions, then retry`;break;case`ENOENT`:a=`the location no longer exists; restore access to its expected location, then retry`;break;default:a=`check the path and available storage, then retry`}return new W(e,`could not ${t}: ${i}`,a,n)}function K(e){let t;try{t=M(e)}catch(t){if(t.code===`ENOENT`)return!1;throw G(e,`be inspected`,t)}if(!t.isDirectory())throw new W(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function ut(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function dt(e,t){if(!Ce(e)||!ut(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==k(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==k(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==k(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!Ce(e.previous))throw new W(t,`has invalid contents`,`restore a valid ownership record from a backup without guessing its trust decision, then retry`);let n;if(e.previous.present===!1&&ut(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&ut(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new W(t,`has an invalid previous decision`,`restore the recorded previous decision from a backup without guessing its value, then retry`);return{version:1,cwd:e.cwd,configuredTrustPath:e.configuredTrustPath,canonicalTrustPath:e.canonicalTrustPath,state:e.state,previous:n}}function ft(e,t,n){let r;try{r=M(n)}catch(e){throw G(n,`be inspected`,e)}if(!r.isFile())throw new W(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=N(n,`utf8`)}catch(e){throw G(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new W(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=dt(a,n);if(o.cwd!==k(t)||n!==lt(e,t,o.canonicalTrustPath))throw new W(n,`does not match its project or trust-store location`,`restore the ownership record to its original project and trust-store location, then retry`);return{path:n,record:o}}function pt(e,t){let{record:n,path:r}=t;for(let t of[U(e),ct(e,n.cwd)])if(!K(t))throw new W(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=ft(e,n.cwd,r);if(!Ne(i.record,n))throw new W(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function mt(e,t,n,r,i){let a={version:1,cwd:k(t),configuredTrustPath:k(n),canonicalTrustPath:k(r),state:`pending`,previous:i},o=lt(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Ne(dt(JSON.parse(s),o),a))throw new W(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);K(U(e)),K(D(o));try{Oe(D(o),{recursive:!0,mode:448})}catch(e){throw G(D(o),`be created`,e)}let c;try{c=M(o,{throwIfNoEntry:!1})}catch(e){throw G(o,`be inspected`,e)}if(c)throw new W(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{g(o,s,{mode:384})}catch(e){throw G(o,`be written`,e)}return{path:o,record:a}}function ht(e,t){let n=pt(e,t);if(n.record.state!==`pending`)throw new W(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{g(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw G(n.path,`be committed`,e)}return{path:n.path,record:r}}function q(e,t){if(!K(U(e)))return[];let n=ct(e,t);if(!K(n))return[];let r;try{r=P(n).sort()}catch(e){throw G(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>ft(e,t,O(n,r)))}function J(e,t){let n=pt(e,t);try{je(n.path)}catch(e){throw G(n.path,`be removed after reconciling its grant`,e)}for(let t of[D(n.path),U(e)])try{Ae(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw G(t,`be removed after reconciling its grant`,e)}}var gt=n(((t,n)=>{var r=e(`constants`),i=process.cwd,a=null,o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return a||=i.call(process),a};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var s=process.chdir;process.chdir=function(e){a=null,s.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,s)}n.exports=c;function c(e){r.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=a(e.chmodSync),e.fchmodSync=a(e.fchmodSync),e.lchmodSync=a(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),o===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,n,i){e.open(t,r.O_WRONLY|r.O_SYMLINK,n,function(t,r){if(t){i&&i(t);return}e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,n){var i=e.openSync(t,r.O_WRONLY|r.O_SYMLINK,n),a=!0,o;try{o=e.fchmodSync(i,n),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function n(e){r.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,n,i,a){e.open(t,r.O_SYMLINK,function(t,r){if(t){a&&a(t);return}e.futimes(r,n,i,function(t){e.close(r,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,n,i){var a=e.openSync(t,r.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,n,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function a(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),_t=n(((t,n)=>{var r=e(`stream`).Stream;n.exports=i;function i(e){return{ReadStream:t,WriteStream:n};function t(n,i){if(!(this instanceof t))return new t(n,i);r.call(this);var a=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=65536,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.end===void 0)this.end=1/0;else if(typeof this.end!=`number`)throw TypeError(`end must be a Number`);if(this.start>this.end)throw Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function n(t,i){if(!(this instanceof n))return new n(t,i);r.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw Error(`start must be >= zero`);this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}})),vt=n(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),yt=n(((t,n)=>{var r=e(`fs`),i=gt(),a=_t(),o=vt(),s=e(`util`),c,l;typeof Symbol==`function`&&typeof Symbol.for==`function`?(c=Symbol.for(`graceful-fs.queue`),l=Symbol.for(`graceful-fs.previous`)):(c=`___graceful-fs.queue`,l=`___graceful-fs.previous`);function u(){}function d(e,t){Object.defineProperty(e,c,{get:function(){return t}})}var f=u;s.debuglog?f=s.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(f=function(){var e=s.format.apply(s,arguments);e=`GFS4: `+e.split(/\n/).join(`
|
|
3
|
-
GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){function t(t,n){return e.call(r,t,function(e){e||g(),typeof n==`function`&&n.apply(this,arguments)})}return Object.defineProperty(t,l,{value:e}),t})(r.close),r.closeSync=(function(e){function t(t){e.apply(r,arguments),g()}return Object.defineProperty(t,l,{value:e}),t})(r.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&process.on(`exit`,function(){f(r[c]),e(`assert`).equal(r[c].length,0)})),global[c]||d(global,r[c]),n.exports=p(o(r)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched&&(n.exports=p(r),r.__patched=!0);function p(e){i(e),e.gracefulify=p,e.createReadStream=re,e.createWriteStream=S;var t=e.readFile;e.readFile=n;function n(e,n,r){return typeof n==`function`&&(r=n,n=null),i(e,n,r);function i(e,n,r,a){return t(e,n,function(t){t&&(t.code===`EMFILE`||t.code===`ENFILE`)?m([i,[e,n,r],t,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=o;function o(e,t,n,i){return typeof n==`function`&&(i=n,n=null),a(e,t,n,i);function a(e,t,n,i,o){return r(e,t,n,function(r){r&&(r.code===`EMFILE`||r.code===`ENFILE`)?m([a,[e,t,n,i],r,o||Date.now(),Date.now()]):typeof i==`function`&&i.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=c);function c(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return s(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(e,t,n,r){return typeof n==`function`&&(r=n,n=0),i(e,t,n,r);function i(e,t,n,r,a){return l(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var f=/^v[0-5]\./;function h(e,t,n){typeof t==`function`&&(n=t,t=null);var r=f.test(process.version)?function(e,t,n,r){return d(e,i(e,t,n,r))}:function(e,t,n,r){return d(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(a,o){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?m([r,[e,t,n],a,i||Date.now(),Date.now()]):(o&&o.sort&&o.sort(),typeof n==`function`&&n.call(this,a,o))}}}if(process.version.substr(0,4)===`v0.8`){var g=a(e);b=g.ReadStream,x=g.WriteStream}var _=e.ReadStream;_&&(b.prototype=Object.create(_.prototype),b.prototype.open=te);var v=e.WriteStream;v&&(x.prototype=Object.create(v.prototype),x.prototype.open=ne),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0});var ee=b;Object.defineProperty(e,"FileReadStream",{get:function(){return ee},set:function(e){ee=e},enumerable:!0,configurable:!0});var y=x;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});function b(e,t){return this instanceof b?(_.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function te(){var e=this;w(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n),e.read())})}function x(e,t){return this instanceof x?(v.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function ne(){var e=this;w(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function re(t,n){return new e.ReadStream(t,n)}function S(t,n){return new e.WriteStream(t,n)}var C=e.open;e.open=w;function w(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return C(e,t,n,function(o,s){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}return e}function m(e){f(`ENQUEUE`,e[0].name,e[1]),r[c].push(e),_()}var h;function g(){for(var e=Date.now(),t=0;t<r[c].length;++t)r[c][t].length>2&&(r[c][t][3]=e,r[c][t][4]=e);_()}function _(){if(clearTimeout(h),h=void 0,r[c].length!==0){var e=r[c].shift(),t=e[0],n=e[1],i=e[2],a=e[3],o=e[4];if(a===void 0)f(`RETRY`,t.name,n),t.apply(null,n);else if(Date.now()-a>=6e4){f(`TIMEOUT`,t.name,n);var s=n.pop();typeof s==`function`&&s.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-a,1);l>=Math.min(u*1.2,100)?(f(`RETRY`,t.name,n),t.apply(null,n.concat([a]))):r[c].push(e)}h===void 0&&(h=setTimeout(_,0))}}})),bt=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0){if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1}var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),xt=n((e=>{var t=bt();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),St=n(((e,t)=>{t.exports=xt()})),Ct=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),wt=n(((t,n)=>{var r=global.process;let i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=Ct(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}return _.apply(this,arguments)}}})),Tt=n(((e,t)=>{let n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Et=n(((t,n)=>{let r=e(`path`),i=yt(),a=St(),o=wt(),s=Tt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function d(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?d(e,{...t,stale:0},n):n(r);if(!f(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));p(e,t,r=>{if(r)return n(r);d(e,{...t,stale:0},n)})})})}function f(e,t){return e.mtime.getTime()<Date.now()-t.stale}function p(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function m(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return h(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,m(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function h(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function g(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{d(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};m(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));_(r,{...t,realpath:!1},e)})})})})}function _(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],p(r,t,n)})}function v(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!f(r,t)))})}function ee(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=g,n.exports.unlock=_,n.exports.check=v,n.exports.getLocks=ee})),Dt=n(((e,t)=>{let n=yt();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Ot=t(n(((e,t)=>{let n=Et(),{toPromise:r,toSync:i,toSyncOptions:a}=Dt();async function o(e,t){let i=await r(n.lock)(e,t);return r(i)}function s(e,t){let r=i(n.lock)(e,a(t));return i(r)}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}))(),1);const kt=5e3;function At(e,t,n){if(!(e instanceof Error)||!(`code`in e)||e.code!==`ELOCKED`)throw e;let r=t-performance.now();if(r<=0)throw Object.assign(Error(`Could not acquire Pi trust lock at ${n}.lock within ${kt}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function jt(e,t){Le()?.warn(t,e)}function Mt(e,t){if(e.length===0)return;if(e.length===1)throw e[0];let[n,r]=e,i=n instanceof Error?n.message:String(n),a=r instanceof Error?r.message:String(r);throw AggregateError(e,`Pi trust update failed: ${i}\nReleasing Pi trust lock ${t}.lock also failed: ${a}`)}async function Nt(e,t,n){await m(`${t}.ok.lock`,async()=>{let t=performance.now()+kt,r;for(;;)try{r=await Ot.default.lock(D(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await Pe(At(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}Mt(i,e)},{onWarn:jt})}function Pt(e,t,n){te(`${t}.ok.lock`,()=>{let t=performance.now()+kt,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=Ot.default.lockSync(D(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,At(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}Mt(a,e)},{onWarn:jt})}const Ft=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var It=class extends Error{name=`PiResourceInspectionError`};function Y(e){let t;try{t=M(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=I(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new It(fe(`missing-symlink-target`),{cause:e}):e}return De(e,A.R_OK|(n.isDirectory()?A.X_OK:0)),!0}function Lt(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function Rt(e,t,n){let r=e;try{let i=F(e),a;r=t;try{a=F(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=k(t)}let o=O(a,`.agents`,`skills`),s=[];for(let e of Ft)r=O(i,`.pi`,e),Y(r)&&s.push(r);if(r=O(i,`.pi`,`extensions`),Y(r))for(let t of P(r).sort()){let i=O(r,t);k(n)!==O(k(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[O(i,`.pi`,`skills`),O(i,`.agents`,`skills`)])if(e!==o&&(r=e,Y(e)))for(let t of P(e).sort())Lt(t)||s.push(O(e,t));let c=D(i);for(;c!==i;){r=O(c,`.agents`,`skills`),r!==o&&Y(r)&&s.push(r);let e=D(c);if(e===c)break;c=e}return s.length===0?{kind:`none`}:{kind:`shared`,paths:s.sort()}}catch(e){return{kind:`unreadable`,error:`Could not inspect Pi project resources at ${H(r)}: ${e instanceof It?e.message:fe(S(e))}`}}}function zt(e,t,n){let r=k(e),i=se({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:T.pi.projectConfigPath(r),trustPath:O(i,`trust.json`)}}function X(e){try{let t=F(e);return I(t).isDirectory()?(De(t,A.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${H(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${H(e)} could not be resolved or accessed: ${H(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function Bt(e){let t=X(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${H(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function Vt(e,t,n){let r=ge(T.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return _e(i)?{state:`own-current`,text:a}:ae(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function Ht(e,t){let n;try{n=N(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:S(t)}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,reason:`invalid-json`}}return Ce(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
|
|
4
|
-
`)}:{state:`unreadable`,reason:`invalid-json`}}function Ut(e){switch(e){case`invalid-json`:return`the file is not a valid JSON object; repair its JSON, then retry`;case`path-changed`:return`the path changed while waiting for its lock; retry to check its current state`;case`unavailable-root`:return`the filesystem root is unavailable; reconnect the drive or network share, then retry`;default:return fe(e)}}function Z(e,t){return{kind:`refused`,error:`trust store ${H(e)}: ${Ut(t)}`}}function Q(e){let t=we(e);try{switch(t.kind){case`declined`:return Z(e,t.reason);case`ready`:return{kind:`ready`,path:F(t.path)};case`not-present`:break;default:throw Error(`unhandled trust file resolution: ${t}`)}let n=D(e),r=[E(e)],i=M(n,{throwIfNoEntry:!1});for(;!i;){let t=D(n);if(t===n)return Z(e,`unavailable-root`);r.unshift(E(n)),n=t,i=M(n,{throwIfNoEntry:!1})}try{return{kind:`missing`,path:O(F(n),...r)}}catch(t){return Z(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:S(t))}}catch(t){return Z(e,S(t))}}function Wt(e,t){let n=Q(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?Z(e,`path-changed`):n}function Gt(e,t,n){let r=zt(e,t,n),i=X(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=Vt(r.cwd,r.bridgePath,t).state,o=Q(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:Ht(o,i.project.canonical).state;return{...r,project:`ready`,canonicalCwd:i.project.canonical,bridge:a,trust:s,bridgeLoadable:(a===`own-current`||a===`own-stale`)&&s===`trusted`,otherExtensions:Kt(r.bridgePath).displayNames}}function Kt(e){let t=D(e),n=E(e);try{return{displayNames:P(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>H(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function qt(e,t={mode:`published`},n,r,i){let a=zt(e,n,r),o=X(a.cwd);if(o.kind===`refused`)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:o.error};if(i!==void 0&&o.project.canonical!==i)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:`The approved Pi project directory ${H(i)} no longer matches the current directory ${H(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=Vt(a.cwd,a.bridgePath,n);if(s.state===`foreign`)return{...a,ok:!1,bridge:`refused-foreign`,trust:`skipped`};if(s.state===`unreadable`)return{...a,ok:!1,bridge:`refused-unreadable`,trust:`skipped`};let c;if(s.state===`absent`)c=`written`;else{let e;try{e=be(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=Se(T.pi,a.cwd,t,n,a.bridgePath);if(e.action!==`written`&&e.action!==`overwritten`)return{...a,ok:!1,bridge:`failed`,trust:`skipped`,error:e.error===void 0?`bridge write ${e.action}`:H(e.error)}}let l=await Jt(a.trustPath,o.project,n??L());return{...a,ok:l.action===`already-trusted`||l.action===`added`,bridge:c,trust:l.action,...l.error===void 0?{}:{error:l.error}}}async function Jt(e,t,n){let r=t.canonical,i=Q(e);if(i.kind===`refused`)return{action:`refused-unreadable`,error:i.error};try{Oe(D(i.path),{recursive:!0})}catch(e){return{action:`failed`,error:H(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await Nt(e,i.path,()=>{let o=Bt(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=Wt(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=Ht(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=Z(e,c.reason).error;return}let l=$(n,()=>{let t=q(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&J(n,t),mt(n,r,e,s.path,Object.hasOwn(c.entries,r)?{present:!0,value:c.entries[r]}:{present:!1})}),u={...c.entries,[r]:!0},d=JSON.stringify(u,null,2)+(c.trailingNewline?`
|
|
5
|
-
`:``),f=C(s.path);g(s.path,d,f===void 0?void 0:{mode:f}),$(n,()=>ht(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:H(e instanceof Error?e.message:String(e))}}return a}function Yt(e){let t=[],n=e;try{for(;;){if(M(n,{throwIfNoEntry:!1})){if(t.length===0)return;let e=F(n);return I(e).isDirectory()?(De(e,A.X_OK),O(e,...t)):void 0}let e=D(n);if(e===n)return;t.unshift(E(n)),n=e}}catch{return}}function Xt(e){let t={"not-present":0,removed:1,"kept-unowned":2,"kept-shared":3,"kept-unverified":4,"refused-unreadable":5,failed:6},n=e.reduce((e,n)=>t[n.action]>t[e.action]?n:e,{action:`not-present`}),r=e.flatMap(e=>e.error??[]),i=e.flatMap(e=>e.detail??[]);return r.length>0?{action:n.error===void 0?`failed`:n.action,error:[...r,...i].join(`
|
|
6
|
-
`)}:n.detail===void 0?n:{...n,detail:i.join(`
|
|
7
|
-
`)}}function Zt(e,t,n,r={}){let i=zt(e,t,n),a=t??L(),o=X(i.cwd),s=o.kind===`refused`&&r.recordedOnly?Yt(i.cwd):void 0,c=o.kind===`ready`?o.project.canonical:s,l;try{l=$(a,()=>{let e=q(a,i.cwd);return c===void 0||c===i.cwd?e:[...q(a,c),...e]})}catch(e){return{action:`failed`,error:H(e instanceof Error?e.message:String(e))}}if(l.length===0&&r.recordedOnly)return o.kind===`ready`||s!==void 0?{action:`not-present`}:{action:`kept-unverified`,error:`${o.error}. OpenKnowledge could not verify whether this path refers to a project with recorded Pi trust; cleanup was left pending. Retry once the project path can be resolved to check again.`};if(o.kind===`refused`){if(l.length===0)return{action:`kept-unverified`,error:o.error};let e=l.map(({path:e,record:t})=>`key ${H(JSON.stringify(t.cwd))}; configured store ${H(JSON.stringify(t.configuredTrustPath))}; recorded destination ${H(JSON.stringify(t.canonicalTrustPath))}; ownership record ${H(JSON.stringify(e))} (${t.state})`);return{action:`kept-unverified`,error:[`${o.error}. OpenKnowledge kept these Pi trust ownership records; current trust decisions were not checked:`,...e,`To review manually, close Pi, verify the intended store against its recorded destination, and inspect only the exact key. A pending record does not prove setup completed or ownership of a current grant. If you choose to undo a current true decision, restore the recorded previous value, or remove that key only when no previous entry was recorded. Preserve other current decisions; parent-folder and global trust settings still apply.`].join(`
|
|
8
|
-
`)}}let u=Rt(o.project.canonical,a,T.pi.projectConfigPath(o.project.canonical));if(u.kind===`unreadable`)return{action:`kept-unverified`,error:u.error};let d=u.kind===`shared`?u.paths:[],f=[],p=new Map,m=(e,t)=>{let n=p.get(e);if(!n){let t=Q(e);if(t.kind===`refused`){f.push({action:`refused-unreadable`,error:t.error});return}n={trustPath:e,resolved:t,keys:new Map},p.set(e,n)}if(t){if(n.resolved.path!==t.record.canonicalTrustPath){f.push({action:`refused-unreadable`,error:`Pi trust store ${H(e)} no longer points to its recorded destination ${H(t.record.canonicalTrustPath)}; restore the intended file location or symlink, then retry`});return}n.keys.set(t.record.cwd,{cwd:t.record.cwd,mode:`recorded`,receipt:t})}};for(let e of l)m(e.record.configuredTrustPath,e);m(i.trustPath);for(let e of p.values()){for(let t of[o.project.canonical,i.cwd])e.keys.has(t)||e.keys.set(t,{cwd:t,mode:`inspect`,receipt:l.find(n=>n.record.cwd===t&&n.record.canonicalTrustPath===e.resolved.path)});f.push(Qt(e,a,d,o.project))}return Xt(f)}function $(e,t){try{return t()}catch(t){throw t instanceof W?t:Error(`Could not access OpenKnowledge's Pi trust ownership records at ${H(O(e,`.ok`,`pi-trust`))}: ${H(t instanceof Error?t.message:String(t))}. Check the records and their permissions, then retry.`,{cause:t})}}function Qt(e,t,n,r){let{trustPath:i,resolved:a}=e,o=[...e.keys.values()];if(!o.some(e=>e.mode===`recorded`)&&a.kind===`missing`)return{action:`not-present`};if(a.kind===`missing`)try{M(D(a.path))}catch(e){return{action:`failed`,error:`The recorded Pi trust directory ${H(D(a.path))} is unavailable: ${H(e instanceof Error?e.message:String(e))}. Restore access to its parent directory or mounted drive, then retry; the ownership record was kept.`}}let s=[],c={result:{action:`not-present`}};try{Pt(i,a.path,()=>{let e=Bt(r);if(e){c.result={action:`kept-unverified`,error:e};return}let l=Wt(i,a);if(l.kind===`refused`){c.result={action:`refused-unreadable`,error:l.error};return}let u=Ht(l,r.canonical);if(u.state===`unreadable`){c.result={action:`refused-unreadable`,error:Z(i,u.reason).error};return}let d=o.map(e=>({cwd:e.cwd,mode:e.mode,expectedConfiguredPath:e.receipt?.record.configuredTrustPath,receipt:$(t,()=>q(t,e.cwd).find(e=>e.record.canonicalTrustPath===l.path))}));if(d.some(e=>e.receipt&&e.receipt.record.configuredTrustPath!==e.expectedConfiguredPath)){c.result={action:`failed`,error:`The Pi trust ownership record changed during cleanup; retry to read its current location.`};return}for(let e of d){try{$t(e,t,i,l.path,u,n,r,c)}catch(t){let n=H(t instanceof Error?t.message:String(t)),r=t instanceof W?``:`; retry to check its current state.`;s.push({action:`failed`,error:`Pi trust entry ${H(JSON.stringify(e.cwd))} in ${H(i)} could not be reconciled: ${n}${r}`})}s.push(c.result),c.result={action:`not-present`}}})}catch(e){s.push({action:`failed`,error:H(e instanceof Error?e.message:String(e))})}return Xt([...s,c.result])}function $t(e,t,n,r,i,a,o,s){let{cwd:c,receipt:l}=e;if(i.entries[c]!==!0){l&&e.mode===`recorded`&&$(t,()=>J(t,l)),s.result={action:`not-present`};return}let u=`To remove this grant manually, close Pi and remove only the ${H(JSON.stringify(c))} entry from ${H(n)}; parent-folder and global trust settings still apply.`;if(a.length>0&&c===o.canonical){let n=`kept Pi's folder trust because other resources still need it: ${a.slice(0,3).map(e=>H(JSON.stringify(e))).join(`, `)}${a.length>3?` (+${a.length-3} more)`:``}. ${u} Removing this grant may stop Pi from loading those resources, including any not listed here.`;s.result={action:`kept-shared`,detail:n},l&&e.mode===`recorded`&&$(t,()=>J(t,l)),s.result={action:`kept-shared`,detail:`${n} ${l?e.mode===`recorded`?`OpenKnowledge has relinquished this grant and will not revoke it on later cleanup runs.`:`OpenKnowledge kept the existing ownership record; cleanup of its recorded location remains incomplete.`:`OpenKnowledge has no ownership record for this grant and will not revoke it on later cleanup runs.`}`};return}if(e.mode===`inspect`||!l||l.record.state===`pending`){let e=l?l.record.state===`pending`?`its ownership record is pending after an interrupted setup; completion cannot be verified. Re-running setup or cleanup does not reconcile this record while the folder remains trusted.`:`OpenKnowledge must reconcile its recorded location at ${H(l.record.configuredTrustPath)} before removing it.`:`no OpenKnowledge ownership record exists; this includes every grant made before ownership recording was introduced.`;s.result={action:`kept-unowned`,detail:`${c===o.canonical?`kept Pi's folder trust because ${e}`:`kept a Pi trust entry under a non-canonical project path because ${e} Pi uses the real project directory instead of this key.`} ${u}`};return}let d={...i.entries};l.record.previous.present?d[c]=l.record.previous.value:delete d[c];let f=JSON.stringify(d,null,2)+(i.trailingNewline?`
|
|
9
|
-
`:``),p=C(r);g(r,f,p===void 0?void 0:{mode:p}),i.entries=d,$(t,()=>J(t,l)),s.result={action:`removed`}}function en(e){return _e(e)||de(e)||ae(e)}const tn=10485760;function nn(e,t,n,r=!1){let i=Zt(e,t,n,{recordedOnly:r});switch(i.action){case`removed`:case`not-present`:return{trust:i.action};case`kept-shared`:case`kept-unowned`:return{trust:i.action,trustDetail:i.detail};case`failed`:case`refused-unreadable`:case`kept-unverified`:{let e=r?`Trust cleanup remains incomplete`:`The bridge file was left untouched`;throw Error(`Pi trust cleanup failed (${i.action}):\n${i.error}\n${e} so cleanup can be retried.`)}default:throw Error(`unhandled Pi trust cleanup result: ${i}`)}}function rn(e,t,n,r){if(e.id!==`pi`)return{kind:`not-present`};let i=nn(t,n,r,!0);return i.trust===`not-present`?{kind:`not-present`}:{kind:`removed`,...i}}function an(e,t,n,r,i){let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=we(a);if(o.kind===`not-present`)return rn(e,t,n,i);if(o.kind===`declined`)return o;let s=ge(e,t,n,o.path);if(s.kind===`absent`||s.kind===`no-entry`)return rn(e,t,n,i);if(s.kind===`decline`)return{kind:`declined`,reason:s.reason};if(!en(s.entry))return{kind:`left-foreign`};let c=e.serverName(t);if(e.format===`file`){let e=nn(t,n,i);try{ke(a,{force:!0})}catch(t){throw e.trustDetail?Error(`${t instanceof Error?t.message:String(t)}\n${e.trustDetail}`,{cause:t}):t}return{kind:`removed`,...e}}return e.format===`toml`?cn(o.path,c):e.format===`yaml`?sn(o.path,e.topLevelKey,c):on(o.path,e.topLevelKey,e.serverMapSubKey,c)}function on(e,t,n,r){let i;try{i=N(e,`utf-8`)}catch(e){return{kind:`declined`,reason:S(e)}}if(Buffer.byteLength(i,`utf-8`)>tn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=ne(i,ye(t,n,r));return o?(g(e,a,{mode:C(e)}),{kind:`removed`}):{kind:`not-present`}}function sn(e,t,n){let r;try{r=N(e,`utf-8`)}catch(e){return{kind:`declined`,reason:S(e)}}if(Buffer.byteLength(r,`utf-8`)>tn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,Fe.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=pe(a);a.trim()===``||a.endsWith(`
|
|
10
|
-
`)?c.endsWith(`
|
|
11
|
-
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
12
|
-
`).replace(/\n/g,`\r
|
|
13
|
-
`));let u=`${i?``:``}${c}`;return u!==r&&g(e,u,{mode:C(e)}),{kind:`removed`}}function cn(e,t){let n=le();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=N(e,`utf-8`)}catch(e){return{kind:`declined`,reason:S(e)}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=pe(a),s=a.trim()===``||a.endsWith(`
|
|
14
|
-
`),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
|
|
15
|
-
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
16
|
-
`).replace(/\n/g,`\r
|
|
17
|
-
`));let u=`${i?``:``}${l}`;return u!==r&&g(e,u,{mode:C(e)}),{kind:`removed`}}function ln(e,t){let n=r[e];return n===null?null:O(t,...n.split(`/`),y.discovery,`SKILL.md`)}function un(e,t){let n=ln(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!h(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=v(`discovery`,{checkDesktop:!0});return w(D(n),t),{editorId:e,label:e,action:ie(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function dn(e){return j(O(e,...`.agents/skills`.split(`/`),y.discovery))?!0:i.some(t=>{let n=ln(t,e);return n!==null&&j(D(n))})}function fn(e,t){let n=ln(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=D(n);try{return j(n)?(w(r,t),ke(r,{recursive:!0,force:!0}),{editorId:e,label:e,action:`removed`,path:n}):{editorId:e,label:e,action:`not-present`,path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function pn(e){return e===`opencode`?oe:he}function mn(e,t,n){let r=T[e],i=pn(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=ue(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function hn(e,t,n=[]){let r=j(O(e,y[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function gn(e,t){let n=re.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=u.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:a}));return[...n,...r]}function _n(e,t,n,r){let i=ee(e,gn(t,r)),a=i.find(e=>e.host===n);if(a===void 0||a.state===`absent`)return[];let o=a.real;return i.filter(e=>e.host!==n&&e.state!==`absent`&&e.real===o).map(e=>e.host)}function vn(e,t){let n=(t??L()).replace(/[\\/]+$/,``);if(!n.includes(`\\`))return e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e;let r=e=>e.replace(/\\/g,`/`),i=r(n),a=r(e);return a.startsWith(`${i}/`)?`~/${a.slice(i.length+1)}`:e}function yn(e,t){let n=T[e];return xe(n,``,t)&&!ce(n,``,t)}function bn(e,t,n,r,i){let a=T[e],o;if(i===void 0)try{o=a.configPath(n,r)}catch{return{state:`structural-na`}}else o=i;let s=i===void 0?vn(o,r):void 0,c=ge(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&yn(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];_e(r)&&i.push(`reclaim-permissive`),de(r)&&i.push(`pre-approval-exact`),pn(e)(r)&&i.push(`injection-functional`);let o=x(a,n);return i.length>0&&(o!==null&&ve(r,o)||t.includes(`pre-approval-exact`)&&i.includes(`reclaim-permissive`)&&!i.includes(`pre-approval-exact`))?{state:`drifted`,strictness:i,path:s}:i.length>0?{state:`satisfied`,strictness:i,path:s}:me(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function xn(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let i=d(e.pathId);if(i===null)return null;if(i.kind===`central-skill-store`)return n===void 0?null:hn(O(n,a),`discovery`,_n(n,r,e.agent,`global`));let o=i.editor;switch(i.kind){case`editor-user-skill-root`:{let e=r[o];return e===null||n===void 0?null:h(n).some(e=>e.editorId===o)?hn(O(n,e),`discovery`,_n(n,r,o,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=s[o];return e===null?null:hn(O(t,e),`project`,_n(t,s,o,`project`))}case`editor-user-config`:return bn(o,e.strictness,t,n);case`editor-project-config`:{let r=T[o].projectConfigPath?.(t);return r===void 0?null:bn(o,e.strictness,t,n,r)}}}}export{He as _,un as a,Le as b,Gt as c,it as d,at as f,Ke as g,Ze as h,dn as i,Qe as l,Xe as m,mn as n,an as o,ot as p,fn as r,qt as s,xn as t,$e as u,We as v,ze as x,Ge as y};
|
package/dist/src-DU6Xx1gD.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{$d as t,Dc as n,Eo as r,Hn as i,Ku as a,Nn as o,Pn as s,Rs as c,il as l,kc as u,ks as d,nl as ee,tl as f}from"./md-manager-BGnqyqi1-LuKRfqxD.mjs";import{Ei as p,Go as m,Hn as h,Qn as g,Ti as _,Tt as v,Uo as y,Wo as b,Xr as x,ci as S,fa as C,go as w,hr as T,li as E,m as D,ni as O,nr as k,ui as A}from"./dist-DZXRg1jC.mjs";import{t as j}from"./yazl-BBz29IQN.mjs";import{Ct as M,ot as N,st as P}from"./init-Boyt6ulg.mjs";import{b as te,l as ne}from"./registry-probes-3L8CRnGg.mjs";import{c as F}from"./colors-r_owlCuY.mjs";import{t as I}from"./is-object-BGze3w87.mjs";import{n as re}from"./constants-BZiqchuc.mjs";import"./loader-DXL-jEwi.mjs";import"./preview-B_9MsldP.mjs";import{execSync as ie,spawnSync as ae}from"node:child_process";import{basename as L,dirname as R,isAbsolute as oe,join as z,relative as B,resolve as V,sep as H}from"node:path";import{closeSync as se,cpSync as ce,createWriteStream as le,existsSync as U,lstatSync as ue,mkdirSync as W,mkdtempSync as de,openSync as fe,readFileSync as G,readSync as pe,readdirSync as K,rmSync as q,rmdirSync as me,statSync as he,writeFileSync as J}from"node:fs";import{arch as ge,freemem as _e,homedir as Y,hostname as ve,platform as ye,release as be,tmpdir as xe,totalmem as Se,type as Ce,uptime as we}from"node:os";import"node:fs/promises";import{createHash as Te}from"node:crypto";const Ee=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function De(e,t,n=k){if(e!==void 0&&!Ee.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Oe=null;function ke(e){Oe=e}function Ae(){return Oe??process.cwd()}const je=`Open Knowledge`;function Me(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return N(t).join(P({...e,platformName:t}),n)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??Y(),r=e.env??process.env,i=N(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function Pe(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Fe(e){let t=z(e,`state.json`);if(!U(t))return[];let n;try{n=JSON.parse(G(t,`utf-8`))}catch{return[]}return Pe(n)??[]}function Ie(e){let t=z(e,`state.json`);if(!U(t))return!1;try{return Pe(JSON.parse(G(t,`utf-8`)))!==null}catch{return!1}}const Le=8192;function Re(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function ze(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Be=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ve(e){return e.replace(Be,`$1"[REDACTED-DEVICE-ID]"`)}function He(e){return Ve(ze(e))}const Ue=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function We(e){if(typeof e!=`string`)return null;let t=Ue.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function Ge(e){let t=fe(e,`r`);try{let e=Buffer.alloc(Le),n=0,r=!1;for(;n<Le;){let i=pe(t,e,n,Le-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{se(t)}}function Ke(e){try{let t=Ge(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:We(a)}}catch{return{kind:`unreadable`}}}function qe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function Je(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=K(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=z(e,t.name),r;try{r=he(n).mtimeMs}catch{continue}if(r<i)continue;let c=Ke(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!qe(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}function Ye(){return z(Y(),`.ok`,`bug-reports`)}function Xe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Ye(),r=`${t}-bugreport`,i=z(n,`${r}.zip`);for(let e=2;U(i);e+=1)i=z(n,`${r}-${e}.zip`);return i}function Ze(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function Qe(e,t){let n=z(e,`.ok`,`config.yml`);if(U(n))try{let e=G(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return U(z(e,`.ok`))?Te(`sha256`).update(V(e)).digest(`hex`).slice(0,12):null}function $e(){let e={timestamp:new Date().toISOString(),platform:ye(),osType:Ce(),osRelease:be(),hostname:`[redacted]`,uptime:we(),freeMem:_e(),totalMem:Se(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ie(`sw_vers -productVersion 2>/dev/null`,w({encoding:`utf8`})).trim()}catch{}try{let t=z(__dirname,`..`,`..`,`package.json`);U(t)&&(e.okVersion=JSON.parse(G(t,`utf8`)).version)}catch{}return e}const et=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function tt(e){let t=L(e);return et.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function nt(e,t){return ot(e,t).files}const rt=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function it(e,t=ne){let n=z(e,`${t}.ShipIt`);if(!U(n))return[];let r;try{r=K(n)}catch{return[]}return rt.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>z(n,e.entry)))}function at(e){if(!U(e))return[];try{let t=new Map;for(let n of K(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-o.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>z(e,t))}catch{return[]}}function ot(e,t){if(!U(t))return{files:[],excludedByProjectSlug:0};let n=K(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>z(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(tt),i=[],a=r.filter(t=>{try{return G(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!tt(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function st(e){let t=z(e,`.ok`,`local`);return U(t)?{files:[`server.lock`,`last-spawn-error.log`,f,n].map(e=>z(t,e)).filter(e=>U(e))}:{files:[]}}function ct(e){let t=z(e,`.ok`,`local`,`logs`);return U(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>z(t,e)).filter(e=>U(e))}:{files:[]}}function lt(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Te(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function ut(e){let t=e.revealDocNames?e.content:lt(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=d(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function X(e){for(let t of e.files)try{let n=G(t,`utf8`);ut({zipfile:e.zipfile,name:`${e.prefix}/${L(t)}`,content:t.endsWith(`.ips`)?He(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function dt(t){let{redact:n,outputPath:r,logger:a}=t,o=t.revealDocNames??!1,c=t.userLogsDir??z(Y(),`.ok`,`logs`),l=t.projectDir?Qe(t.projectDir,a):null;W(R(r),{recursive:!0}),a?.info({projectSlug:l},`gathering diagnostic data`);let u=$e();u.desktop=t.desktop??null,u.language=t.language??null;let{files:d,excludedByProjectSlug:ee}=ot(l,c),{files:f}=t.projectDir?st(t.projectDir):{files:[]},{files:p}=t.projectDir?ct(t.projectDir):{files:[]},m=t.shipItLogFiles??[],h=t.diagnosticReports?.files??[];a?.info({logFileCount:d.length,logFilesExcludedByProjectSlug:ee,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length,diagnosticReportCount:h.length},`files collected`);let g=[],_=[],{ZipFile:v}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),y=new v;X({zipfile:y,files:[...d,...m],prefix:`logs`,redact:n,revealDocNames:o,bundleFiles:_,redactions:g,logger:a}),X({zipfile:y,files:f,prefix:`lockdir`,redact:n,revealDocNames:o,bundleFiles:_,redactions:g,logger:a}),X({zipfile:y,files:p,prefix:`local-logs`,redact:n,revealDocNames:o,bundleFiles:_,redactions:g,logger:a}),X({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:s,redact:n,revealDocNames:o,bundleFiles:_,redactions:g,logger:a}),X({zipfile:y,files:h,prefix:`diagnostic-reports`,redact:n,revealDocNames:o,bundleFiles:_,redactions:g,logger:a});for(let e of t.extraFiles??[])try{let t=G(e.sourcePath),n=`extra/${e.zipName??L(e.sourcePath)}`;y.addBuffer(t,n),_.push(n);let r=Ze(e,n);r!==null&&g.push(r)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&ut({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:o,bundleFiles:_,redactions:g});let b=new Set(h.map(e=>`diagnostic-reports/${L(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Re(t.diagnosticReports,x.length);y.addBuffer(Buffer.from(`${S}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let C=JSON.stringify(u,null,2);y.addBuffer(Buffer.from(C,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let w={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:l,files:_,redactions:g,sysinfo:u};y.addBuffer(Buffer.from(JSON.stringify(w,null,2),`utf8`),`MANIFEST.json`);let T=g.reduce((e,t)=>e+t.lineCount,0),E=new Set(m.map(e=>`logs/${L(e)}`)),D=_.filter(e=>E.has(e)),O=new Set((t.bugReportLedgerFiles??[]).map(e=>`${s}/${L(e)}`)),k=_.filter(e=>O.has(e)),A=l?_.filter(e=>e.startsWith(`logs/`)&&!tt(e)&&!E.has(e)):[],j=x.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],M=j.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...j]:[`Redaction was disabled for this bundle; file contents are unmodified.`],N=[`# Bug Report Bundle`,``,`Generated: ${w.generatedAt}`,`Project: ${l??`(unscoped)`}`,`Discipline version: ${w.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...A.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...A.map(e=>`- ${e}`),``]:[],...D.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...D.map(e=>`- ${e}`),``]:[],...x.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...x.map(e=>`- ${e}`),``]:[],...k.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...k.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${i.join(`, `)}`,T>0?`${T} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...j,``,`This bundle is safe to attach to a GitHub issue.`]:M].join(`
|
|
2
|
-
`);y.addBuffer(Buffer.from(N,`utf8`),`README.md`),y.end();let P=le(r);return y.outputStream.pipe(P),await new Promise((e,t)=>{P.on(`close`,e),P.on(`error`,t)}),a?.info({bundlePath:r,fileCount:_.length,redactionCount:T},`bundle written`),{zipPath:r,summary:{projectSlug:l,files:_,redactions:g,redactedLineCount:T,generatedAt:w.generatedAt}}}var ft=a(),pt=e(j(),1),Z=e(F(),1);function mt(e){let t=m(`user`,e,e);return y({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function ht({home:e=Y(),env:t=process.env}={}){let n=mt(e),{override:r,preferenceList:i}=b(t),{locale:a,source:o}=c({override:r,storedPreference:n,supportedLocales:l,preferenceList:i,autoDetectableLocales:u});return{preference:n,locale:a,source:o,systemLanguages:i}}function gt(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function _t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vt(e,t){if(typeof e==`string`)return gt(e,t.contentDir);if(Array.isArray(e))return e.map(e=>vt(e,t));if(!_t(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=vt(i,t);return n}function yt(e,t){let n=G(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
|
-
`),i=n.split(`
|
|
4
|
-
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=vt(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
|
|
5
|
-
`)}\n`:a.join(`
|
|
6
|
-
`);J(e,o)}function bt(e,t){let n=G(e,`utf-8`);if(n.trim().length!==0)try{let r=vt(JSON.parse(n),t),i=n.endsWith(`
|
|
7
|
-
`)?`
|
|
8
|
-
`:``;J(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=gt(n,t.contentDir);r!==n&&J(e,r)}}function xt(e,t){let n=G(e,`utf-8`),r=gt(n,t.contentDir);r!==n&&J(e,r)}function St(e){try{return K(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>z(e,t.name))}catch{return[]}}const Ct=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function wt(e){return/\.log\.\d+$/.test(e)}function Tt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||wt(e)}const Et=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Dt(e){let t={contentDir:e.contentDir};for(let n of Et)for(let r of St(z(e.stagingDir,n)))Tt(r)?yt(r,t):r.endsWith(`.json`)?bt(r,t):xt(r,t);for(let n of St(z(e.stagingDir,`state`))){let e=L(n);n.endsWith(`.jsonl`)?yt(n,t):Ct.has(e)?bt(n,t):xt(n,t)}}const Ot=[`.ok`,`local`,`telemetry`],kt=[`.ok`,`local`,`logs`],At=[`.ok`,`local`,`loss-capture`],jt=`spans-current.jsonl`,Mt=`spans-prev.jsonl`,Nt=`server-current.jsonl`,Pt=`server-prev.jsonl`,Ft=`loss-current.jsonl`,It=`loss-prev.jsonl`;function Lt(e){return z(e,...Ot,jt)}function Rt(e){return z(e,...Ot,Mt)}function zt(e){return z(e,...kt,Nt)}function Bt(e){return z(e,...kt,Pt)}function Vt(e){return z(e,...At,Ft)}function Ht(e){return z(e,...At,It)}const Ut=1e3;async function Wt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Ut)});return t.ok?await t.text():null}catch{return null}}async function Gt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Ut)});return t.ok?await t.text():null}catch{return null}}async function Kt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Ut)});return t.ok?await t.text():null}catch{return null}}function qt(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
|
|
9
|
-
`)}\n`:null}catch{return null}}function Jt(e){let t=z(e,`.git`,`ok`);if(!U(t))return null;let n=ae(`git`,[`-C`,t,`log`,`--oneline`,`-50`],w({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Yt(e){let t=z(e,`.git`,`ok`);if(!U(t))return null;let n=ae(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],w({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Xt(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Zt(){return{nodeVersion:process.version,platform:ye(),arch:ge()}}function Qt(){return process.env.OTEL_SDK_DISABLED===`false`}function $t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function en(e){if(!U(e))return{};let t;try{t=(0,ft.parse)(G(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!$t(t))return{};let n=t.telemetry;if(!$t(n))return{};let r=n.localSink;return $t(r)?r:{}}function tn(e){return typeof e==`boolean`?e:void 0}function nn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function rn(e){if($t(e))return nn(e.maxBytes)}function an(e){let t=en(m(`project`,e)),n=en(m(`project-local`,e));return{enabled:tn(n.enabled)??tn(t.enabled)??!0,spansMaxBytes:rn(n.spans)??rn(t.spans)??52428800,logsMaxBytes:rn(n.logs)??rn(t.logs)??26214400}}function on(e){return Te(`sha256`).update(e).digest(`hex`)}function sn(e){let t=G(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const cn=[`"doc.name"`,`"docName"`];function ln(e){let t=G(e,`utf-8`),n=0;for(let e of cn){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Q(e,t){if(!U(e))return!1;try{return W(R(t),{recursive:!0}),e.endsWith(`.ips`)?J(t,He(G(e,`utf-8`))):ce(e,t),!0}catch{return!1}}function un(e){let t=[],n=e=>{let r=K(e,{withFileTypes:!0});for(let i of r){let r=z(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const dn=new Set([`.jsonl`]);function fn(e){let t=e.lastIndexOf(`.`);return t!==-1&&dn.has(e.slice(t))}const pn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function mn(e){if(wt(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&pn.has(e.slice(t))}function hn(e){let t=[];for(let n of un(e)){let r=gn(e,n);if(!mn(r))continue;let{redacted:i,patterns:a,lineCount:o}=d(G(n,`utf-8`));a.length!==0&&(J(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function gn(e,t){return B(e,t).split(H).join(`/`)}async function _n(e){let t=V(e.contentDir),r=V(e.projectDir??e.contentDir),i=e.deps??{},a=i.fetchAgentPresence??Wt,o=i.fetchAgentEffects??Gt,c=i.fetchWatcherRecent??Kt,l=i.readShadowHead??Jt,u=i.readCheckpointRefs??Yt,d=i.now??(()=>new Date),p=i.okVersion??(()=>re),m=i.readDesktopEnv??Xt,h=i.readLanguage??ht,g=i.readRuntime??Zt,_=i.isOtlpPushEnabled??Qt,v=de(z(xe(),`ok-bundle-`));try{W(z(v,`telemetry`),{recursive:!0}),W(z(v,`logs`),{recursive:!0}),W(z(v,`state`),{recursive:!0}),Q(Lt(r),z(v,`telemetry`,jt)),Q(Rt(r),z(v,`telemetry`,Mt)),Q(zt(r),z(v,`logs`,Nt)),Q(Bt(r),z(v,`logs`,Pt));for(let t of e.userLogFiles??[])Q(t,z(v,`logs`,L(t)));for(let t of e.userStateFiles??[])Q(t,z(v,s,L(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Q(t,z(v,`diagnostic-reports`,L(t)))&&(y+=1);let b=z(r,`.ok`,`local`),x=z(b,`server.lock`),S=`not-running`,C=`no server.lock`,w=null;if(U(x)){Q(x,z(v,`state`,`server.lock`));try{let e=G(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?w=t.port:C=`lock present but no port`}catch{C=`lock present but unparseable`}}if(w!==null){let e=await a(w);e===null?C=`agent-presence endpoint at :${w} unreachable`:(J(z(v,`state`,`agent-presence.json`),e),S=`running`,C=``);let t=await o(w);t!==null&&J(z(v,`state`,`agent-effects.json`),t);let n=await c(w);if(n!==null){let e=qt(n);e!==null&&J(z(v,`state`,`watcher-recent.jsonl`),e)}}let T=l(t);T!==null&&J(z(v,`state`,`shadow-head.txt`),T);let E=u(t);E!==null&&J(z(v,`state`,`checkpoint-refs.txt`),E),Q(Vt(r),z(v,`state`,Ft)),Q(Ht(r),z(v,`state`,It)),Q(z(b,`last-spawn-error.log`),z(v,`state`,`last-spawn-error.log`)),Q(z(b,ee),z(v,`state`,ee)),Q(z(b,f),z(v,`state`,f)),Q(z(b,n),z(v,`state`,n));let D=g(),O=m(),k=h(),A={ok:{version:p(),nodeVersion:D.nodeVersion,platform:D.platform,arch:D.arch},host:{desktop:O,language:k}};J(z(v,`state`,`runtime.json`),`${JSON.stringify(A,null,2)}\n`);let j=S===`running`?`running
|
|
10
|
-
`:`not-running (${C})\n`;J(z(v,`state`,`server-status.txt`),j);let M=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:Re(e.diagnosticReports,y);if(J(z(v,`state`,`diagnostic-reports-status.txt`),`${M}\n`),e.processDir&&U(e.processDir)){let t=z(v,`process`);W(t,{recursive:!0}),ce(e.processDir,t,{recursive:!0})}let N=e.redact===!0;N&&Dt({stagingDir:v,contentDir:t}),e.note&&J(z(v,`note.txt`),e.note);let P=null;e.scrubSecrets===!0&&(P=hn(v));for(let t of e.extraFiles??[]){let e=t.zipName??L(t.sourcePath);if(!Q(t.sourcePath,z(v,`extra`,e))){i.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=Ze(t,`extra/${e}`);n!==null&&(P??={redactions:[],redactedLineCount:0},P.redactions.push(n),P.redactedLineCount+=n.lineCount)}let te=an(r),ne=un(v),F=[],I=0,re=0;for(let e of ne){let t=gn(v,e),n=he(e).size,r=fn(t)?sn(e):0;F.push({path:t,bytes:n,lines:r}),I+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(re+=ln(e))}let ie={applied:N};P!==null&&(ie.secretScrub=P);let ae={schemaVersion:2,createdAt:d().toISOString(),ok:{version:p(),nodeVersion:D.nodeVersion,platform:D.platform,arch:D.arch},host:{desktop:O,language:k},contentDir:{pathSha256:on(t),absolutePath:N?`<CONTENT_DIR>`:t},telemetry:{localSink:te,otlpPushEnabled:_()},redaction:ie,serverStatus:S,files:F};J(z(v,`manifest.json`),`${JSON.stringify(ae,null,2)}\n`);let R=ne.some(e=>{try{return G(e,`utf-8`).includes(t)}catch{return!1}}),oe={stagedDiagnosticReports:y,totalBytes:I,fileCount:F.length,docNameCount:re,contentDirVisible:R,redacted:N},B=!1;return{stagingDir:v,manifest:ae,summary:oe,cleanup:()=>{B||(B=!0,q(v,{recursive:!0,force:!0}))}}}catch(e){throw q(v,{recursive:!0,force:!0}),e}}async function vn(e){let{collected:t,outputPath:n}=e,r=R(n);if(!U(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new pt.ZipFile,a=un(t.stagingDir);for(let e of a){let n=gn(t.stagingDir,e);i.addFile(e,n)}i.end();let o=le(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function yn(e,t){let n=z(e,`.ok`,`config.yml`);if(U(n))try{let t=(0,ft.parse)(G(n,`utf-8`)),r=I(t)?t.content:void 0,i=I(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return V(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return V(e)}async function bn(e,t,n,r,i){let a=Qe(t,e.logger),o=await _n({contentDir:yn(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...nt(a,e.userLogsDir??z(Y(),`.ok`,`logs`)),...it(e.cachesDir??z(Y(),`Library`,`Caches`))],userStateFiles:at(e.bugReportsDir??Ye()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{W(R(e.outputPath),{recursive:!0}),await vn({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function xn(e){let{projectDir:t}=e,n=e.readDesktopEnv??Xt,r=e.readLanguage??ht,i=()=>Je(e.diagnosticReportsDir??z(Y(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return bn(e,t,n,r,i());let{zipPath:a,summary:o}=await dt({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:it(e.cachesDir??z(Y(),`Library`,`Caches`)),bugReportLedgerFiles:at(e.bugReportsDir??Ye()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}function $(e,t,n={}){let r=A(e,t),i;try{i=G(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??T()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??ve());if(!a||typeof a!=`object`||!O(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??x)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}function Sn(e){return e.status===`unverified-owner`?`Cannot verify shutdown: the server lock at ${e.lockPath} does not record its owning machine, and its recorded process ${e.pid} is still running on this machine. Check whether process ${e.pid} is an OpenKnowledge server. If it is, stop it and retry. Do not remove the lock file while that process is running.`:`Cannot verify shutdown: the server lock at ${e.lockPath} belongs to another machine. Stop OpenKnowledge on the owning machine. Confirm that no OpenKnowledge server is using this directory on the owning machine or any other machine sharing it. Only then remove the stale lock file at ${e.lockPath} and retry cleanup.`}function Cn(e){return e.replace(/:\d+$/,``)}function wn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Cn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Cn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Cn(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const Tn=[{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`}],En=[...v.map(e=>D[e]),`open-knowledge`];function Dn(e){if(!oe(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=V(e);if(t===H||R(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function On(e,t){let n=B(e,t);if(n.startsWith(`..`)||oe(n))return!1;let r=e;for(let e of n.split(H)){r=z(r,e);try{if(!ue(r).isDirectory())return!1}catch{return!1}}return!0}function kn(e,t){try{return K(e).every(n=>t.has(z(e,n)))}catch{return!1}}function An(e){let t=Dn(e),n=[],r=[],i=new Set;for(let e of Tn){let a=z(t,e.hostDir,`skills`);if(!On(t,a))continue;let o=En.map(e=>z(a,e)).filter(e=>U(e));n.push(...o);for(let e of o)i.add(e);let s=z(t,e.pruneRoot),c=a;for(;kn(c,i)&&(r.push(c),i.add(c),c!==s);){let e=R(c);if(e===c||e===t||!e.startsWith(t+H))break;c=e}}return{skillDirs:n,emptyDirs:r}}function jn(e){try{if(!ue(e).isDirectory())return!1;let t=K(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function Mn(e){let t=new Set,n=new Set;for(let r of Tn){let i=z(e,r.hostDir,`skills`);for(let e of En)t.add(z(i,e));let a=z(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=R(o);if(t===o||t===e||!t.startsWith(e+H))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Nn(e,t){let n=Dn(e),r=Mn(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(On(n,e)&&jn(e))try{q(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(On(n,e))try{me(e),a.push(e)}catch{}return a}function Pn(e){let n=Dn(e),r=[];for(let e of v){let i=D[e];r.push({path:z(n,`.agents`,`skills`,i),bundleId:e,scope:`central`});for(let a of t)r.push({path:z(n,a.skillsRoot,i),bundleId:e,scope:`host`,hostDir:a.hostDir})}return r}function Fn(e,t){let n=[];for(let r of Pn(e))if(r.bundleId===t)try{q(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 In(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function Ln(e,t=Date.now()){if(e===null)return`—`;let n=r(e,t);return n===`unknown`?`—`:n}function Rn(e){let t=R(e);return L(e)===`local`&&L(t)===`.ok`?R(t):L(e)===`.ok`?t:null}function zn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`||t.status===`read-error`)return null;if(t.status===`unverified-owner`)return{directory:Rn(e),server:{port:null,status:t.status,pid:t.pid,startedAt:null,usage:null},ui:null,hostname:null,lockPath:t.lockPath,binary:null,command:null,isDesktop:!1};let i=t.lock,a=t.status===`alive`&&S(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:g(n),command:n,isDesktop:In(n)}}function Bn(e){let t=e.server.status;switch(t){case`unverified-owner`:return`unverified`;case`alive`:return e.isDesktop?`desktop`:`running`;case`foreign-host`:return e.isDesktop?`desktop`:`foreign`;case`dead-pid`:return`stale`;default:return t}}const Vn=new Set([`running`,`desktop`,`foreign`,`unverified`]);function Hn(e){switch(e){case`running`:return Z.default.green(e);case`desktop`:return Z.default.blue(e);case`foreign`:return Z.default.cyan(e);case`unverified`:case`stale`:return Z.default.yellow(e)}}function Un(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Wn(e){return`${Un(e.server.usage)} | ${Un(e.ui?.usage??null)}`}function Gn(e){return`${e.server.port===null?`—`:e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function Kn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory??`—`,Gn(e),Wn(e),Bn(e),String(e.server.pid),Ln(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=Hn(Bn(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=Z.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
11
|
-
`)}async function qn(e={}){let t=e.discover??h,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??_,a=e.resolveUsage??p,o=await t(),s=[];for(let e of o){let t=n(e),r=zn(e,t,t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Bn(e)}));r(JSON.stringify(e,null,2));return}r(Kn(e.all?s:s.filter(e=>Vn.has(Bn(e)))))}function Jn(){return new M(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale entries (foreign and unverified entries already show)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await qn({all:t.all===!0||e===`all`,json:t.json===!0})})}async function Yn(e,t=te()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=E(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function Xn(e,t={}){return{targets:Qn(e,t.isAlive??x)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function Zn(e){let t=e.inspect??(()=>$(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??Yn,o=e.logger??te(),s=Xn(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function Qn(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function $n(e,t=x){let n=await h(),r=null;for(let i of n){let n=$(i,`server`);if(Qn(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function er(e,t){let n=await Zn({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function tr(e,t,n={}){return t===0?`Nothing was running for ${e}, and no other open-knowledge servers are running.`:`Nothing was running for ${e}. ${t} other open-knowledge server${t===1?` is`:`s are`} running${n.listingFollows===!0?``:" — run `ok ps` to list them"}.`}async function nr(e){let t=await h(),n=0;for(let r of t)r!==e&&Qn($(r,`server`),x)&&n++;return n}function rr(e){return new M(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the enclosing project — run it from anywhere inside the project. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).option(`--force`,`Stop even when editor windows or agents are still connected to the server`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=C(process.cwd()),n=await Zn({lockDir:t,force:r,log:()=>{}});if(n.hadTargets){if(n.stopped.length>0){let e=n.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1)}else{let e=await nr(t);console.log(tr(process.cwd(),e,{listingFollows:e>0})),e>0&&await qn({})}return}if(i===`all`){let e=await h();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)Qn($(n,`server`),x)&&(await er(n,r),t++);t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(i)){let e=Number.parseInt(i,10),t=await $n(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await er(t,r);return}let a=V(Ae(),i),o=C(a),s=[],c=await Zn({lockDir:o,force:r,log:e=>s.push(e)});if((c.failed.length>0||c.declined!==void 0)&&(process.exitCode=1),c.hadTargets)for(let e of s)console.log(e);else console.log(tr(a,await nr(o)))})}export{Ie as C,De as E,Fe as S,ke as T,Je as _,Nn as a,Ne as b,Pn as c,$ as d,xn as f,Ye as g,Xe as h,Jn as i,wn as l,vn as m,Zn as n,An as o,_n as p,rr as r,Fn as s,Yn as t,Sn as u,Re as v,Ae as w,Me as x,je as y};
|
package/dist/src-DjmVymt-.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./md-manager-BGnqyqi1-LuKRfqxD.mjs";import"./init-Boyt6ulg.mjs";import"./registry-probes-3L8CRnGg.mjs";import"./src-DU6Xx1gD.mjs";import"./start-Jnb5yYdV.mjs";import{n as e}from"./loader-DXL-jEwi.mjs";import"./preview-B_9MsldP.mjs";import"./cli.mjs";import"./repair-mcp-configs-DzGALib-.mjs";export{e as loadConfig};
|
package/dist/start-B8Yg-ZtE.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,m as t,p as n,r}from"./start-Jnb5yYdV.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|