@inkeep/open-knowledge 0.43.0-beta.1 → 0.43.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-DGTFmQbn.mjs → acp-harness-probe-FScZV-OJ.mjs} +2 -2
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/assets/skills/write-skill/SKILL.md +1 -1
- package/dist/cli.mjs +49 -49
- package/dist/constants-BGUGvvvl.mjs +2 -0
- package/dist/git-handle-Df2gTERY.mjs +1 -0
- package/dist/{git-handle-vqpcA9VH.mjs → git-handle-DtR_jYUx.mjs} +2 -2
- package/dist/index.d.mts +0 -4
- package/dist/index.mjs +1 -1
- package/dist/init-BN5ycAVH.mjs +1 -0
- package/dist/{init-CCnKaiOs.mjs → init-DOMbM9QZ.mjs} +31 -31
- package/dist/{launch-json-removal-DpMakhDe.mjs → launch-json-removal-BvzisN3q.mjs} +2 -2
- package/dist/{loader-96AKdkqe.mjs → loader-Bh7WABE3.mjs} +2 -2
- package/dist/loader-CzSKMzBj.mjs +1 -0
- package/dist/md-manager-YqgOJSVI.mjs +2 -0
- package/dist/{open-browser-D62jJdtT.mjs → open-browser-peVrHuth.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-DyAg02Zz.mjs → preview-DMMV4nt0.mjs} +2 -2
- package/dist/preview-Doi3j_Cy.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-g89D5S8f.js → ActivityModeContent-HvPAzuap.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-DEEEC5SC.js → AgentDiffPane-DXVF7xlv.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-DEl9X_lO.js → AgentThreadClientBinder-IMQ8kqrK.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Bu3Fs6zS.js → CodeMirrorPropInput-B6WcHF3z.js} +2 -2
- package/dist/public/assets/DocumentContext-QO2VJVUd.js +38 -0
- package/dist/public/assets/{EditorModeToggle-sLw-NDKx.js → EditorModeToggle-Br3TJSCO.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-CyQvFQvF.js → EnableSyncConfirmDialog-URmUoyAC.js} +1 -1
- package/dist/public/assets/FeedbackForm-CwFVGju3.js +1 -0
- package/dist/public/assets/{GraphPanel-D__pyQFw.js → GraphPanel-DHT3M_Xf.js} +2 -2
- package/dist/public/assets/LintConfigEditor-D6wXCH7g.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-C6PhweIc.js → ManagedArtifactProperties-CvnDCIWw.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-v3xzJlUc.js → McpConsentDialogBody-C6b_iEsN.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-Cb1XUuYg.js → MermaidDocEditor-Ckjm-HWk.js} +1 -1
- package/dist/public/assets/PropertyPanel-BCDQKDSD.js +2 -0
- package/dist/public/assets/ReportBugDialogBody-lMg15sYD.js +3 -0
- package/dist/public/assets/SchemaConfigEditor-Bf9Tfipc.js +1 -0
- package/dist/public/assets/{SettingsDialogBody-D60WwzYw.js → SettingsDialogBody-CV0CO7sa.js} +3 -3
- package/dist/public/assets/{ShareBranchSwitchDialog-CBAwJPzC.js → ShareBranchSwitchDialog-PmMhJ9zu.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-By_ADxES.js → ShareReceiveDialog-DUde-jX4.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DRPeFjq_.js → ShareReceiveMissDialog-CQTG5IFu.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-DUmsYRmo.js → SkillEditorActions-CrM2BHhi.js} +1 -1
- package/dist/public/assets/SourceEditor-I-pbVLHm.js +1 -0
- package/dist/public/assets/{TerminalPanel-CTqU6o3s.js → TerminalPanel-BJuvvjn8.js} +2 -2
- package/dist/public/assets/{TerminalSessionsHost-BPvs6cwd.js → TerminalSessionsHost-CxF-jkuS.js} +2 -2
- package/dist/public/assets/{TerminalWindowApp-OPcXReB3.js → TerminalWindowApp-CGrMEICf.js} +1 -1
- package/dist/public/assets/{ThreadView-3ad12XVo.js → ThreadView-CDeOr2kl.js} +3 -3
- package/dist/public/assets/{TimelineDiffPane-DgNva1gq.js → TimelineDiffPane-DTug7oMZ.js} +1 -1
- package/dist/public/assets/{agent-diff-store-C047fGBn.js → agent-diff-store-DyEP3Km6.js} +1 -1
- package/dist/public/assets/{agent-visibility-BF9jUA-S.js → agent-visibility-ik0M421s.js} +1 -1
- package/dist/public/assets/auth-state-cache--uMim9lN.js +11 -0
- package/dist/public/assets/client-version-C5fqEdXh.js +1 -0
- package/dist/public/assets/{config-provider-Csi6hMEt.js → config-provider-CY7XLhYT.js} +2 -2
- package/dist/public/assets/{dist-D5TEqH45.js → dist-BMPs3czI.js} +174 -172
- package/dist/public/assets/{doc-hash--5hQmcT5.js → doc-hash-Cx09mMdJ.js} +1 -1
- package/dist/public/assets/{documents-events-B0k6hZi4.js → documents-events-CsZSbgqD.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-CZ6DDAA4.js → file-tree-adapter-DUQncykJ.js} +1 -1
- package/dist/public/assets/{file-tree-utils-BaZOVY6J.js → file-tree-utils-CMdRs-iN.js} +1 -1
- package/dist/public/assets/{globals-88oPHAs4.css → globals-B1VH9dVh.css} +1 -1
- package/dist/public/assets/{globals-BzYms-F0.js → globals-CdwCpkXl.js} +1 -1
- package/dist/public/assets/index-DPtaNCi4.js +2013 -0
- package/dist/public/assets/{lint-config-client-DbmBCBFs.js → lint-config-client-T5L7AekD.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-CKqigNbJ.js → markdownlint-rule-browser-DFieU89D.js} +1 -1
- package/dist/public/assets/{navigation-targets-CYyBnqZZ.js → navigation-targets-BYWxwjbH.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-BEVP0SdK.js → open-managed-artifact-tab-DHg0RpJW.js} +1 -1
- package/dist/public/assets/pending-receive-nav-store-DJ88nbxo.js +1 -0
- package/dist/public/assets/{prop-types-BBKV1S78.js → prop-types-CBLBXb_o.js} +1 -1
- package/dist/public/assets/{receive-store-CLSRRsUo.js → receive-store-D9WHZxmq.js} +1 -1
- package/dist/public/assets/{schema-fields-view-intent-BeD8vY0v.js → schema-fields-view-intent-D_s-Cynn.js} +1 -1
- package/dist/public/assets/{selection-context-CoAzJLgJ.js → selection-context-DUT4aHVv.js} +1 -1
- package/dist/public/assets/{skill-actions-G-6FdAWg.js → skill-actions-BIWFZvwD.js} +1 -1
- package/dist/public/assets/{skills-api-nci6FoVp.js → skills-api-CzT5ZHi7.js} +1 -1
- package/dist/public/assets/{src-Dqj4tsR9.js → src-BffE3bRu.js} +1 -1
- package/dist/public/assets/{tag-pill-input-BGvE8IPF.js → tag-pill-input-iCzfP5zx.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BtjSk9Ck.js → target-navigation-intent-BJNDfVBU.js} +1 -1
- package/dist/public/assets/{telemetry-impl-Z8PmW_aL.js → telemetry-impl-llHFvtad.js} +1 -1
- package/dist/public/assets/{telemetry-startup-Cy7C8oSF.js → telemetry-startup-Ce8-_9qU.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-BAOu6SND.js → terminal-launch-events-CnydHAmR.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-CSLY2tMg.js → terminal-telemetry-CgddbfDu.js} +1 -1
- package/dist/public/assets/typing-burst-detector-Bq4PIaYN.js +8 -0
- package/dist/public/assets/{uninstall-CVwJS9oE.js → uninstall-7eKZCCHA.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DRiVx8dd.js → use-activity-panel-BVKEKlCy.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-8mWh6sFH.js → use-apply-config-color-theme-VU8Nd0Xm.js} +2 -2
- package/dist/public/assets/{use-collab-url-Byylx1V6.js → use-collab-url-Bb6AGYgx.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-B8pvprD8.js → use-live-xterm-theme-C30BtcRX.js} +1 -1
- package/dist/public/assets/use-settings-route-D3WOGF5C.js +1 -0
- package/dist/public/assets/{use-terminal-enabled-LoKyqz9U.js → use-terminal-enabled-BAUrOHbA.js} +1 -1
- package/dist/public/assets/use-timeline-entry-diff-B2Lo0NgF.js +6 -0
- package/dist/public/assets/{use-workspace-BVbiw6ue.js → use-workspace-BkbyFgS0.js} +1 -1
- package/dist/public/assets/{workspace-paths-xqj_kQWP.js → workspace-paths-SOIn4Gp4.js} +1 -1
- package/dist/public/index.html +37 -37
- package/dist/public/uninstall.html +4 -4
- package/dist/{repair-launch-json-yRaU75sa.mjs → repair-launch-json-A72nX3ay.mjs} +2 -2
- package/dist/{repair-mcp-configs-Dhz6Ht8f.mjs → repair-mcp-configs-DDgR6Hw-.mjs} +2 -2
- package/dist/repair-skills-BFhWJnt3.mjs +1 -0
- package/dist/{repair-skills-hJ4Ol2SE.mjs → repair-skills-CbG5sTm2.mjs} +2 -2
- package/dist/server-lock-CQupI16l.mjs +1 -0
- package/dist/{server-lock-BaAxTOkZ.mjs → server-lock-Dasu-v2i.mjs} +2 -2
- package/dist/src-CG_sJ7fr.mjs +3275 -0
- package/dist/src-Cne-ucNX.mjs +1 -0
- package/dist/{src-B5_KtSx0.mjs → src-Dn5gGky8.mjs} +125 -123
- package/dist/{src-BctJxQjz.mjs → src-NZxNysCL.mjs} +5 -5
- package/dist/start-CFKsyapS.mjs +4 -0
- package/dist/start-vmGNxdER.mjs +1 -0
- package/dist/{write-project-skill-2xPw07AZ.mjs → write-project-skill-xElcbz-O.mjs} +4 -4
- package/package.json +4 -4
- package/dist/constants-O0xpb7mH.mjs +0 -2
- package/dist/git-handle-DsVW51IO.mjs +0 -1
- package/dist/init-CF2-_1EB.mjs +0 -1
- package/dist/loader-Bm4GaiwL.mjs +0 -1
- package/dist/md-manager-DqqkZBfY.mjs +0 -2
- package/dist/preview-Df7P6EY2.mjs +0 -1
- package/dist/public/assets/DocumentContext-rC30TeU1.js +0 -38
- package/dist/public/assets/FeedbackForm-Xv5Ofoot.js +0 -1
- package/dist/public/assets/LintConfigEditor-8qwaKsqI.js +0 -1
- package/dist/public/assets/PropertyPanel-CNbo8u41.js +0 -2
- package/dist/public/assets/ReportBugDialogBody-B9Fanm3L.js +0 -3
- package/dist/public/assets/SchemaConfigEditor-BsQuL-UF.js +0 -1
- package/dist/public/assets/SourceEditor-C-UqlkGB.js +0 -1
- package/dist/public/assets/auth-state-cache-BlO5xkpU.js +0 -11
- package/dist/public/assets/client-version-BXkMIB54.js +0 -1
- package/dist/public/assets/index-CMPrUhWJ.js +0 -2014
- package/dist/public/assets/pending-receive-nav-store-D6BuHzW7.js +0 -1
- package/dist/public/assets/typing-burst-detector-YikvFcgi.js +0 -6
- package/dist/public/assets/use-settings-route-CCeZ7dN_.js +0 -1
- package/dist/public/assets/use-timeline-entry-diff-CdO4y6y7.js +0 -6
- package/dist/repair-skills-BH1pQ2tJ.mjs +0 -1
- package/dist/server-lock-BT7lExvG.mjs +0 -1
- package/dist/src-Bpg-FG-z.mjs +0 -1
- package/dist/src-DZ0ZiS77.mjs +0 -3269
- package/dist/start-D0gmTzCW.mjs +0 -4
- package/dist/start-D5jQn9rZ.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e}from"./src-
|
|
1
|
+
import{C as e}from"./src-Dn5gGky8.mjs";import{ar as t,cr as n,er as r,hr as i,ir as a,mr as o,or as s,tr as c,ur as l}from"./src-CG_sJ7fr.mjs";import{C as u,a as d,d as f,f as p,o as m,s as h,t as g}from"./write-project-skill-xElcbz-O.mjs";import{n as _,s as v,t as y}from"./colors-BsmVIwfM.mjs";import{dirname as b,join as x,relative as S,resolve as C}from"node:path";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,statSync as k,writeFileSync as A}from"node:fs";import{homedir as j}from"node:os";import{createInterface as M}from"node:readline/promises";const N={existsSync:e=>w(e),isDirectory:e=>{try{return k(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>D(e),readFileSync:e=>E(e),writeFileSync:(e,t)=>{A(e,t)},mkdirSync:(e,t)=>{T(e,t)},rmSync:(e,t)=>{O(e,t)}},P={resolveProjectBundledSkillDir:()=>l(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>l(e,{checkDesktop:!1}),readBundledVersion:()=>c(),readRecordedVersion:e=>a(e,`cli-hosts`),writeRecordedVersion:(e,t)=>s(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>n(e),readBundleDecision:(e,t)=>r(e,t),writeBundleDecision:(e,n,r)=>t(e,n,r),removeBundleFromDisk:(e,t)=>h(e,t)};function F(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function I(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(b(t),{recursive:!0}),L(e,t,n)}function L(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=x(e,r),a=x(t,r);n.isDirectory(i)?L(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function R(e,t,n,r,i,a){let o=[],s=x(e,`.agents`,`skills`,t),c=r.existsSync(s),l=!1;try{I(n,s,r),l=!0,o.push({kind:`central`,path:s,outcome:c?`overwritten`:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:c,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of p){let l=x(e,c.hostDir),u=x(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}let d=r.existsSync(u);try{I(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:d?`overwritten`:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:d,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:l}}function z(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function B(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of p){let o=x(e,t.hostDir,`skills`,`open-knowledge`),s=x(o,`SKILL.md`),c=n.existsSync(s),l=f[t.editorId]?.projectConfigPath?.(e),u=!c&&z(l,n);if(!c&&!u){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{g(o,e),I(i,o,n);let s=c?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:c?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function V(t,n,r,a){let s=e=>{n.recordEvent(e).catch(()=>{})},c=()=>new Date().toISOString(),l;try{l=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return a({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await n.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of i)try{d.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return a({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let i of d){let s=o[i.id],c=r.existsSync(x(t,`.agents`,`skills`,s)),l=await n.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{n.removeBundleFromDisk(t,i.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:i.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:i.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await n.writeBundleDecision(t,s,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:i.id,error:e instanceof Error?e.message:String(e)})}p.push(i)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>r.existsSync(x(t,`.agents`,`skills`,o[e.id])));if(u!==null&&u===l&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===i.length,_=!0;for(let{id:e,sourceDir:n}of p){let i=R(t,o[e],n,r,a,l);h.push(...i.entries),i.centralWritten||(_=!1)}let v=h.some(e=>e.kind===`central`&&(e.outcome===`written`||e.outcome===`overwritten`));if(g&&_&&v){let e=null;try{await n.writeRecordedVersion(t,l),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t}of p)s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?`installed`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:l,entries:h}}async function H(e){let t=e.logger??F,n=e.fs??N,r=e.home??j(),i={...P,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=B(e.projectDir,i,n,t),o=await V(r,i,n,t),s=m(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=d(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function U(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function W(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
|
|
2
2
|
`)}function G(){return new u(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").option(`-y, --yes`,`Skip the confirmation prompt for removing directories left by a pre-0.42 install.`).action(async e=>{let t=await H({projectDir:C(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>K(t,{yes:e.yes===!0})});process.stdout.write(`${W(t)}\n`),process.exitCode=U(t)})}async function K(e,t){let n=j(),r=e=>`~/${S(n,e)}`,i=t.input??process.stdin,a=[``,y(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),_(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${y(`Remove OpenKnowledge skills:`)} ${e.skillDirs.length}`,...e.skillDirs.map(e=>` ${r(e)}`)),e.emptyDirs.length>0){let t=e.skillDirs.length>0?`Then remove these, which hold nothing else once the above are gone:`:`Remove these empty directories, left behind by that install:`;a.push(``,`${y(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,_(`Nothing outside these paths is touched. A directory that still holds anything is kept.`)),process.stdout.write(`${a.join(`
|
|
3
3
|
`)}\n`),t.yes)return!0;if(!i.isTTY)return process.stdout.write(`${v("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=M({input:i,output:process.stdout});try{let e=(await o.question(`\n${y(`Remove them?`)} ${_(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{G as n,H as t};
|
|
4
|
-
//# sourceMappingURL=repair-skills-
|
|
4
|
+
//# sourceMappingURL=repair-skills-CbG5sTm2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,o as t,r as n}from"./server-lock-Dasu-v2i.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./src-
|
|
2
|
-
//# sourceMappingURL=server-lock-
|
|
1
|
+
import"./src-Dn5gGky8.mjs";import{r as e}from"./logger-B7Z8XO-z.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s,readFileSync as c,unlinkSync as l,writeFileSync as u,writeSync as d}from"node:fs";import{homedir as f,hostname as p}from"node:os";import{fileURLToPath as m}from"node:url";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function v(e){return new URL(e.url??``,`http://localhost`).searchParams}function y(e){let t=e?.code;return typeof t==`string`?t:void 0}const b=/^[A-Za-z0-9-]{8,64}$/;let x=null;function S(e){return n(e??f(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=c(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{o(t(r),{recursive:!0}),u(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(x=i),i}function w(){try{let e=r(t(m(import.meta.url)),`..`,`package.json`),n=JSON.parse(c(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===C():e.hostname===p()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(c(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==C()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==p())continue;l(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(c(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,c=`[${t}-lock]`;o(n,{recursive:!0});let f=k(n,t),m={pid:process.pid,hostname:p(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:C(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!a(f))try{let e=s(f,`wx`,384);try{d(e,h)}finally{i(e)}return j(f),I(f),z({lockName:t,lockDir:n,lockPath:f})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(f,c);if(e){if(N(e)&&e.pid===process.pid)return u(f,h,{encoding:`utf-8`,mode:384}),j(f),I(f),z({lockName:t,lockDir:n,lockPath:f});if(g(e.pid))throw new O(e,f,t);D.warn({pid:e.pid,host:e.hostname},`${c} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{l(f)}catch{}}throw Error(`${c} Failed to acquire ${f} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,o=k(n,t);if(!a(o)){D.warn({lockPath:o},`${i} Lock file missing at ${o} during port update — skipping`);return}let s;try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:o},`${i} Corrupt lock at ${o} during port update — skipping`);return}s=e}catch{D.warn({lockPath:o},`${i} Unreadable lock at ${o} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{u(o,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(c(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){y(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{u(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return null;let i;try{let e=JSON.parse(c(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!g(i.pid)){try{l(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return{status:`absent`};let i;try{i=JSON.parse(c(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o=i;if(!_(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{l(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,o=k(n,t);if(M(o)){if(r){V({lockName:t,lockDir:n});return}if(a(o))try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;l(o),P.delete(o)}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{_ as S,E as _,X as a,v as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,C as v,g as x,y};
|
|
2
|
+
//# sourceMappingURL=server-lock-Dasu-v2i.mjs.map
|