@inkeep/open-knowledge 0.50.1 → 0.51.0-beta.1
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-DEQXdsjT.mjs → acp-harness-probe-5Bd7W9lp.mjs} +2 -2
- package/dist/cli.mjs +51 -51
- package/dist/constants-QeQKosNT.mjs +2 -0
- package/dist/fs-traced-D4-U3iIC.mjs +1 -0
- package/dist/{fs-traced-BUirY9_X.mjs → fs-traced-RPXwxrA5.mjs} +6 -6
- package/dist/git-handle-Bw80Zwhs.mjs +1 -0
- package/dist/{git-handle-BWXziar2.mjs → git-handle-KAEFG2Xp.mjs} +2 -2
- package/dist/index.d.mts +17 -17
- package/dist/index.mjs +184 -184
- package/dist/{init-D5NDes00.mjs → init-DGihqAzs.mjs} +34 -34
- package/dist/init-DpRNnzFn.mjs +1 -0
- package/dist/{launch-json-removal-Dl7uCpuY.mjs → launch-json-removal-BVPFVWm2.mjs} +2 -2
- package/dist/loader-BAOw2Vq0.mjs +1 -0
- package/dist/loader-B_nowTX3.mjs +2 -0
- package/dist/md-manager-DiVPjAYl.mjs +2 -0
- package/dist/{open-browser-iA8nPdIv.mjs → open-browser-De70N-tU.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-NUFfTNAF.mjs → preview-B88pOGOc.mjs} +2 -2
- package/dist/preview-CJAgM4pS.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-CYdn5I4Y.js → ActivityModeContent-Cjkui6nd.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-DpKorIT_.js → AgentDiffPane-u-5ilTRE.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-D85mW3F8.js → AgentThreadClientBinder-BrrOZdn1.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-B0as4qVr.js → ChangedOutsideBadge-BcoH6-nw.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-D50z9yLP.js +3 -0
- package/dist/public/assets/DocumentContext-CasGadtG.js +38 -0
- package/dist/public/assets/{EditorModeToggle-DYe6ugjz.js → EditorModeToggle-6-QjT8Ga.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-CZhoCX06.js → EnableSyncConfirmDialog-CYGOKMM4.js} +1 -1
- package/dist/public/assets/FeedbackForm-jU5fMAff.js +1 -0
- package/dist/public/assets/{GraphPanel-BgjTBQzf.js → GraphPanel-H0Dz8I1Y.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DgaLRDa2.js → ImportSkillDialog-mMdMQEcu.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-m8s0kHpU.js → LintConfigEditor-DGxetApx.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-CNkIjYyD.js → ManagedArtifactProperties-5u803JAP.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CutBH5nQ.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-CDj5MfEH.js → McpConsentDialogBody-BB44PQE6.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-CpEV_vjl.js → MermaidDocEditor-BDExs-LW.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-9QPpMvae.js → ReportBugDialogBody-Cedm28lz.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DGC-Ifl7.js → SchemaConfigEditor-Dbn9RObT.js} +1 -1
- package/dist/public/assets/{SessionsHost-CfMAKMV0.js → SessionsHost-CPuk32sz.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-COkVan2W.js → SettingsDialogBody-Cy0NXh6T.js} +4 -4
- package/dist/public/assets/{ShareBranchSwitchDialog-BvB0M0F8.js → ShareBranchSwitchDialog-Co8TuLoa.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-DdTZvKPD.js → ShareReceiveDialog-DHLrIRs0.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-C01SdPiI.js → ShareReceiveMissDialog-BHMkU4HH.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-xwl6MInS.js → SkillEditBanner-UvWXpguP.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-1lmATcpN.js → SkillOriginInline-D8kmShJA.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-CPO0igHl.js → SkillToolbarControls-B9upYwy8.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-guFXAVIS.js → SlidesToolbarControls-B_zJy_NS.js} +1 -1
- package/dist/public/assets/SourceEditor-BYbqK1qo.js +1 -0
- package/dist/public/assets/{TerminalPanel-CP9vexOS.js → TerminalPanel-D5dGBcUr.js} +3 -3
- package/dist/public/assets/{TerminalWindowApp-Cwcma4mH.js → TerminalWindowApp-DxDcT0Nb.js} +1 -1
- package/dist/public/assets/{TextDocEditor-DEx6Kq9N.js → TextDocEditor-GLvDavbc.js} +1 -1
- package/dist/public/assets/{ThreadView-BA1CLPVi.js → ThreadView-B7F0lkW2.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-BICt_08r.js → TimelineDiffPane-CjnN3faR.js} +1 -1
- package/dist/public/assets/{agent-diff-store-DEzJgiR6.js → agent-diff-store-ghKYlKOr.js} +1 -1
- package/dist/public/assets/auth-state-cache-Z9zb3Xiw.js +11 -0
- package/dist/public/assets/client-version-C6LF52yy.js +1 -0
- package/dist/public/assets/{comment-chips-BfGPrQWn.js → comment-chips-S0s83wIP.js} +1 -1
- package/dist/public/assets/config-provider-BIse3_Yo.js +5 -0
- package/dist/public/assets/{dist-B6uhnkqb2.js → dist-CHVHOG7X2.js} +183 -183
- package/dist/public/assets/{doc-paths-DCnBNou3.js → doc-paths-DEUIlKvV.js} +1 -1
- package/dist/public/assets/{documents-events-BE14yj3s.js → documents-events-CNRzblNO.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-BOumv5bR.js → file-tree-adapter-DYdb8QDM.js} +1 -1
- package/dist/public/assets/{file-tree-utils-zx8XyJDX.js → file-tree-utils-CaXhxBar.js} +1 -1
- package/dist/public/assets/{folder-config-api-DzcYYQUB.js → folder-config-api-Cm-dSVuA.js} +1 -1
- package/dist/public/assets/{follow-file-CjaFA8Bl.js → follow-file-DIXrodzs.js} +1 -1
- package/dist/public/assets/{globals-Bq7QmnDv.css → globals-Ba8eSnNC.css} +1 -1
- package/dist/public/assets/i18n-lVHP3BYW.js +1 -0
- package/dist/public/assets/index-DbydDmJw.js +2097 -0
- package/dist/public/assets/{lint-config-client-CXdpjOMj.js → lint-config-client-Di_wU0g4.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-MV3bVGCC.js → markdownlint-rule-browser-CepJct7F.js} +1 -1
- package/dist/public/assets/navigation-targets-Dh0TaCXK.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-DzG5xo47.js → open-managed-artifact-tab-DflI2eed.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-MbkxejK0.js → pending-receive-nav-store-yXsV1Iit.js} +1 -1
- package/dist/public/assets/{prop-types-DOjW8INh.js → prop-types-CLe_EOJt.js} +1 -1
- package/dist/public/assets/{receive-store-8XeTNhUV.js → receive-store-DrPPaP0S.js} +1 -1
- package/dist/public/assets/{selection-context-DYJs4iye.js → selection-context-BxRPPU5Z.js} +1 -1
- package/dist/public/assets/{skill-actions-Dvp72hct.js → skill-actions-Dj2NwLGa.js} +2 -2
- package/dist/public/assets/{skill-scope-qH5lhviP.js → skill-scope-BzUNaBG8.js} +1 -1
- package/dist/public/assets/{skills-api-Dl_Mtb7L.js → skills-api-VZRmji1_.js} +1 -1
- package/dist/public/assets/{src-BgeX0ooS.js → src-CbX6YXDU.js} +1 -1
- package/dist/public/assets/{tag-pill-input-Cg2Wozsu.js → tag-pill-input-GrIUFiT7.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-uYgRrqg5.js → target-navigation-intent-CqhpK9cj.js} +1 -1
- package/dist/public/assets/{telemetry-impl-Bbdtn9J6.js → telemetry-impl-DlE3Lv5F.js} +1 -1
- package/dist/public/assets/{telemetry-startup-CqGbFCKQ.js → telemetry-startup-hv8lBqwj.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-BqUx5532.js → terminal-cli-display-DLfTA9tz.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-C9cyVGWq.js → terminal-launch-events-DaPNTH_g.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-BoS_NSJ3.js → terminal-telemetry-BdrnMW3b.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DJTF6TYE.js → typing-burst-detector-COX8FDXD.js} +2 -2
- package/dist/public/assets/{uninstall-DTD665q0.js → uninstall-e3XxU518.js} +1 -1
- package/dist/public/assets/{use-activity-panel-CoU7WjCv.js → use-activity-panel-CtHXJ4mx.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-6RHjH1SX.js → use-apply-config-color-theme-Be4mSe54.js} +1 -1
- package/dist/public/assets/{use-collab-url-4QmUjyTo.js → use-collab-url-ChXwOaQi.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-BaPGSFwn.js → use-live-xterm-theme-CaipyTAZ.js} +1 -1
- package/dist/public/assets/{use-open-skill-DN4VQ0HP.js → use-open-skill-DASBRT-Y.js} +1 -1
- package/dist/public/assets/{use-popular-skills-CETv50qW.js → use-popular-skills-BEpYkbxf.js} +1 -1
- package/dist/public/assets/{use-settings-route-Ln_W_o3I.js → use-settings-route-MF7LcF5y.js} +1 -1
- package/dist/public/assets/{use-skill-origin-BjoZBPjm.js → use-skill-origin-qCGon4Nv.js} +1 -1
- package/dist/public/assets/{use-skills-DyoXP6p3.js → use-skills-C13KTW_J.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-Rnwv8rq4.js → use-terminal-enabled-r2pfLhCY.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-fL6Q6imU.js → use-timeline-entry-diff-C9owRy-n.js} +4 -4
- package/dist/public/assets/{use-workspace-C5uwuxa8.js → use-workspace-CEaEfKKU.js} +1 -1
- package/dist/public/index.html +46 -46
- package/dist/public/uninstall.html +5 -5
- package/dist/{repair-launch-json-Dj813bOM.mjs → repair-launch-json-DXPSD0ub.mjs} +2 -2
- package/dist/{repair-mcp-configs-CL14xUMJ.mjs → repair-mcp-configs-Do4zIXkE.mjs} +2 -2
- package/dist/{repair-skills-B_ZAQaXn.mjs → repair-skills-BFfQjF9F.mjs} +2 -2
- package/dist/repair-skills-Dz417BMs.mjs +1 -0
- package/dist/server-lock-B4Z9_lXn.mjs +1 -0
- package/dist/{server-lock-DbS4Uxaj.mjs → server-lock-BV0Ktccm.mjs} +2 -2
- package/dist/{skill-teardown-mTNzEFkM.mjs → skill-teardown-BppNXkpR.mjs} +2 -2
- package/dist/{sleep-DdJljU3h.mjs → sleep-ChZE9826.mjs} +2 -2
- package/dist/{src-BDSe-YIB.mjs → src-BabT8t0g.mjs} +6 -6
- package/dist/src-CMD64NyP.mjs +1 -0
- package/dist/src-CwuSSZyu.mjs +2032 -0
- package/dist/src-DMpGVIiQ.mjs +348 -0
- package/dist/src-DR51i3QD.mjs +1 -0
- package/dist/start-C2dEkRx7.mjs +1 -0
- package/dist/start-hkzQEInB.mjs +10 -0
- package/dist/ui-BBGFVQDX.mjs +1 -0
- package/dist/{ui-BC8TqXI0.mjs → ui-CNA2d6cp.mjs} +3 -3
- package/dist/{write-project-skill-CyyI2a52.mjs → write-project-skill-DHsuRyv9.mjs} +2 -2
- package/package.json +5 -5
- package/dist/constants-CaKELAh9.mjs +0 -2
- package/dist/fs-traced-CDdByB1Z.mjs +0 -1
- package/dist/git-handle-BHbVb-kE.mjs +0 -1
- package/dist/init-D8Avhxo1.mjs +0 -1
- package/dist/loader-BjuhzcUO.mjs +0 -1
- package/dist/loader-DWGxP7ZW.mjs +0 -2
- package/dist/md-manager-BP88oH5c.mjs +0 -2
- package/dist/preview-BMmryl_A.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-CfyM9jmf.js +0 -3
- package/dist/public/assets/DocumentContext-DQeqcbba.js +0 -38
- package/dist/public/assets/FeedbackForm-1SPYA54M.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-DYFSQG10.js +0 -1
- package/dist/public/assets/SourceEditor-DPQOUOr0.js +0 -1
- package/dist/public/assets/auth-state-cache-Bsh1HmX2.js +0 -11
- package/dist/public/assets/client-version-B_vQj5m0.js +0 -1
- package/dist/public/assets/config-provider-CCU8qlmR.js +0 -5
- package/dist/public/assets/i18n-Bm86sjGW.js +0 -1
- package/dist/public/assets/index-Cg1k8Ayr.js +0 -2097
- package/dist/public/assets/navigation-targets-GITJ7Tz8.js +0 -1
- package/dist/repair-skills-cJ6ASlsh.mjs +0 -1
- package/dist/server-lock-C_lebUd3.mjs +0 -1
- package/dist/src-CjvpBVI9.mjs +0 -1
- package/dist/src-_krIFkyE.mjs +0 -1
- package/dist/src-c73kUNxd.mjs +0 -348
- package/dist/src-d4u8XMdW.mjs +0 -2032
- package/dist/start-BiW9hFuV.mjs +0 -10
- package/dist/start-D4pnGfoA.mjs +0 -1
- package/dist/ui-B1pZuo-s.mjs +0 -1
- /package/dist/public/assets/{globals-B8Za6o5Q.js → globals-BSqcs0wt.js} +0 -0
|
@@ -185,5 +185,5 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
185
185
|
`))n.push(` ${t}`);return n.join(`
|
|
186
186
|
`)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function Mu(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,tl.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,tl.isNode)(r))return r}return e.contents??null}function Nu(e,t){let n=1,r=1,i=Math.min(t,e.length);for(let t=0;t<i;t++)e.charCodeAt(t)===10?(n++,r=1):r++;return{line:n,column:r}}function Pu(e,t,n,r,i){let a=e.split(`
|
|
187
187
|
`),o=r-1;if(o<0||o>=a.length)return``;let s=a[o]??``,c=t-(i-1)+s.length,l=Math.max(1,Math.min(n,c)-t),u=[],d=String(o+2).length;for(let e=Math.max(0,o-1);e<=Math.min(a.length-1,o+1);e++){let t=e===o,n=t?`>`:` `,r=String(e+1).padStart(d,` `);if(u.push(`${n} ${r} | ${a[e]??``}`),t){let e=` `.repeat(2+d+3+i-1);u.push(`${e}${`^`.repeat(l)}`)}}return u.join(`
|
|
188
|
-
`)}function Fu(e){let t=Mu(e.doc,e.path);if(!t)return;let n=t.range;if(!n)return;let[r,,i=r]=n,{line:a,column:o}=Nu(e.source,r),s=(0,tl.isCollection)(t)?Pu(e.source,r,r+1,a,o):Pu(e.source,r,i,a,o);return{file:e.file,line:a,column:o,snippet:s.length>0?s:void 0}}const $="Run `ok config migrate` to strip the obsolete key automatically, or remove it by hand.",Iu=[{path:[`content`,`include`],redirect:[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,$].join(` `)},{path:[`content`,`exclude`],redirect:[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,$].join(` `)},{path:[`folders`],redirect:[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",$].join(` `)},{path:[`appearance`,`editorModeDefault`],redirect:[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,$].join(` `)},{path:[`upload`,`maxBytes`],redirect:[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,$].join(` `)},{path:[`github`,`oauthAppClientId`],redirect:[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,$].join(` `)},{path:[`server`,`host`],redirect:[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --host CLI flag and HOST environment variable also remain available.`,$].join(` `)},{path:[`server`,`openOnAgentEdit`],redirect:[`This behavior was removed; the value is hardcoded.`,$].join(` `)},{path:[`mcp`,`autoStart`],redirect:[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,$].join(` `)},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,$].join(` `)},{path:[`mcp`,`tools`,`grep`,`maxResults`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,$].join(` `)},{path:[`mcp`,`tools`,`search`,`maxResults`],redirect:[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,$].join(` `)},{path:[`preview`,`baseUrl`],redirect:["preview URLs now resolve only to the running UI process — start one with `ok ui`.",$].join(` `)},{path:[`preview`,`scriptSrc`],redirect:[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,$].join(` `)},{path:[`appearance`,`sidebar`,`showAllFiles`],redirect:[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,$].join(` `)}];function Lu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ru(e,t){let n=e;for(let e=0;e<t.length-1;e++){if(!Lu(n))return!1;n=n[t[e]]}return Lu(n)?t[t.length-1]in n:!1}function zu(e){let{value:t,file:n,source:r,doc:i}=e;if(!Lu(t))return[];let a=[];for(let e of Iu){if(!Ru(t,e.path))continue;let o;i!=null&&r!=null&&n!=null&&(o=Fu({file:n,source:r,doc:i,path:e.path})),a.push({code:`REMOVED_KEY`,path:e.path,redirect:e.redirect,...o===void 0?{}:{source:o}})}return a}function Bu(e,t){let[n,...r]=t;if(n===void 0)return e;let i={...e};if(r.length===0)return delete i[n],i;let a=i[n];return Lu(a)&&(i[n]=Bu(a,r)),i}function Vu(e){if(!Lu(e))return e;let t=e;for(let e of Iu)Ru(t,e.path)&&(t=Bu(t,e.path));return t}const Hu=`v0`,Uu=`.ok/config.yml`,Wu=`local`,Gu=`themes`;function Ku(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function qu(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}function Ju(e){return new Promise(t=>{setTimeout(t,e)})}export{
|
|
189
|
-
//# sourceMappingURL=sleep-
|
|
188
|
+
`)}function Fu(e){let t=Mu(e.doc,e.path);if(!t)return;let n=t.range;if(!n)return;let[r,,i=r]=n,{line:a,column:o}=Nu(e.source,r),s=(0,tl.isCollection)(t)?Pu(e.source,r,r+1,a,o):Pu(e.source,r,i,a,o);return{file:e.file,line:a,column:o,snippet:s.length>0?s:void 0}}const $="Run `ok config migrate` to strip the obsolete key automatically, or remove it by hand.",Iu=[{path:[`content`,`include`],redirect:[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,$].join(` `)},{path:[`content`,`exclude`],redirect:[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,$].join(` `)},{path:[`folders`],redirect:[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",$].join(` `)},{path:[`appearance`,`editorModeDefault`],redirect:[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,$].join(` `)},{path:[`upload`,`maxBytes`],redirect:[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,$].join(` `)},{path:[`github`,`oauthAppClientId`],redirect:[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,$].join(` `)},{path:[`server`,`host`],redirect:[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --host CLI flag and HOST environment variable also remain available.`,$].join(` `)},{path:[`server`,`openOnAgentEdit`],redirect:[`This behavior was removed; the value is hardcoded.`,$].join(` `)},{path:[`mcp`,`autoStart`],redirect:[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,$].join(` `)},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,$].join(` `)},{path:[`mcp`,`tools`,`grep`,`maxResults`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,$].join(` `)},{path:[`mcp`,`tools`,`search`,`maxResults`],redirect:[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,$].join(` `)},{path:[`preview`,`baseUrl`],redirect:["preview URLs now resolve only to the running UI process — start one with `ok ui`.",$].join(` `)},{path:[`preview`,`scriptSrc`],redirect:[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,$].join(` `)},{path:[`appearance`,`sidebar`,`showAllFiles`],redirect:[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,$].join(` `)}];function Lu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ru(e,t){let n=e;for(let e=0;e<t.length-1;e++){if(!Lu(n))return!1;n=n[t[e]]}return Lu(n)?t[t.length-1]in n:!1}function zu(e){let{value:t,file:n,source:r,doc:i}=e;if(!Lu(t))return[];let a=[];for(let e of Iu){if(!Ru(t,e.path))continue;let o;i!=null&&r!=null&&n!=null&&(o=Fu({file:n,source:r,doc:i,path:e.path})),a.push({code:`REMOVED_KEY`,path:e.path,redirect:e.redirect,...o===void 0?{}:{source:o}})}return a}function Bu(e,t){let[n,...r]=t;if(n===void 0)return e;let i={...e};if(r.length===0)return delete i[n],i;let a=i[n];return Lu(a)&&(i[n]=Bu(a,r)),i}function Vu(e){if(!Lu(e))return e;let t=e;for(let e of Iu)Ru(t,e.path)&&(t=Bu(t,e.path));return t}const Hu=`v0`,Uu=`.ok/config.yml`,Wu=`local`,Gu=`themes`;function Ku(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function qu(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}function Ju(e){return new Promise(t=>{setTimeout(t,e)})}export{wc as $,O as $t,Wl as A,z as At,nl as B,ra as Bt,ou as C,Vo as Ct,Gl as D,zo as Dt,Jl as E,fo as Et,nu as F,L as Ft,el as G,j as Gt,ol as H,jr as Ht,tu as I,W as It,yc as J,je as Jt,Zc as K,De as Kt,Fl as L,no as Lt,Xl as M,bo as Mt,eu as N,Wo as Nt,Ql as O,K as Ot,$l as P,mo as Pt,Dc as Q,y as Qt,Pl as R,ja as Rt,au as S,B as St,ql as T,Ya as Tt,hl as U,tr as Ut,ml as V,ta as Vt,$c as W,Cn as Wt,bc as X,Te as Xt,_c as Y,Ne as Yt,vc as Z,D as Zt,hu as _,yo as _t,Uu as a,qc as at,lu as b,eo as bt,Iu as c,Sc as ct,Fu as d,gc as dt,s as en,jc as et,Tu as f,fc as ft,mu as g,qa as gt,Ou as h,$o as ht,Wu as i,Ac as it,Ul as j,H as jt,Yl as k,U as kt,zu as l,Kc as lt,ju as m,Qo as mt,Ku as n,Tc as nt,Gu as o,kc as ot,Du as p,Go as pt,Yc as q,ke as qt,qu as r,xc as rt,Hu as s,Oc as st,Ju as t,o as tn,Ec as tt,Vu as u,Jc as ut,fu as v,G as vt,ru as w,lo as wt,su as x,V as xt,uu as y,Qa as yt,Il as z,ka as zt};
|
|
189
|
+
//# sourceMappingURL=sleep-ChZE9826.mjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{
|
|
2
|
-
`);_.addBuffer(Buffer.from(w,`utf8`),`README.md`),_.end();let T=le(r);return _.outputStream.pipe(T),await new Promise((e,t)=>{T.on(`close`,e),T.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:b},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:b,generatedAt:y.generatedAt}}}var Ge=e(w(),1),K=e(ee(),1);function Ke(e){return v({absPath:y(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function qe({home:e=G(),env:
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,ft as n,q as r}from"./sleep-ChZE9826.mjs";import{Ga as i,Hs as a,Vs as o,X as s,Z as c}from"./src-DMpGVIiQ.mjs";import{Ci as l,at as u,ei as d,it as f,jn as p,ot as m,rt as h}from"./src-CwuSSZyu.mjs";import{D as g,F as _,I as v,k as y}from"./fs-traced-RPXwxrA5.mjs";import{C as b,S as x,d as S,y as C}from"./server-lock-BV0Ktccm.mjs";import{t as w}from"./yazl-DZr4PyKA.mjs";import{t as T}from"./esm-DmX1RzAi.mjs";import{c as ee}from"./colors-BsmVIwfM.mjs";import{n as E}from"./acp-harness-probe-5Bd7W9lp.mjs";import{E as te,T as D,_ as O,o as k,w as A,x as j,y as M}from"./init-DGihqAzs.mjs";import{n as N}from"./constants-QeQKosNT.mjs";import{t as P}from"./is-object-ByG7RnjH.mjs";import{m as ne,p as re}from"./write-project-skill-DHsuRyv9.mjs";import"./loader-B_nowTX3.mjs";import"./skill-teardown-BppNXkpR.mjs";import"./preview-B88pOGOc.mjs";import{execSync as ie,spawnSync as ae}from"node:child_process";import{basename as F,dirname as I,join as L,relative as oe,resolve as R,sep as se}from"node:path";import{cpSync as ce,createWriteStream as le,existsSync as z,lstatSync as ue,mkdirSync as B,mkdtempSync as de,readFileSync as V,readdirSync as H,readlinkSync as fe,rmSync as U,statSync as pe,writeFileSync as W}from"node:fs";import{arch as me,freemem as he,homedir as G,hostname as ge,platform as _e,release as ve,tmpdir as ye,totalmem as be,type as xe,uptime as Se}from"node:os";import"node:fs/promises";import{createHash as Ce}from"node:crypto";var we=n();const Te=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ee(e,t,n=p){if(e!==void 0&&!Te.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let De=null;function Oe(e){De=e}function ke(){return De??process.cwd()}function Ae(){return L(G(),`.ok`,`bug-reports`)}function je(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Ae(),r=`${t}-bugreport`,i=L(n,`${r}.zip`);for(let e=2;z(i);e+=1)i=L(n,`${r}-${e}.zip`);return i}function Me(e,t){let n=L(e,`.ok`,`config.yml`);if(z(n))try{let e=V(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 z(L(e,`.ok`))?Ce(`sha256`).update(R(e)).digest(`hex`).slice(0,12):null}function Ne(){let e={timestamp:new Date().toISOString(),platform:_e(),osType:xe(),osRelease:ve(),hostname:`[redacted]`,uptime:Se(),freeMem:he(),totalMem:be(),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`,d({encoding:`utf8`})).trim()}catch{}try{let t=L(__dirname,`..`,`..`,`package.json`);z(t)&&(e.okVersion=JSON.parse(V(t,`utf8`)).version)}catch{}return e}const Pe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function Fe(e){let t=F(e);return Pe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Ie(e,t){return ze(e,t).files}const Le=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function Re(e,t=E){let n=L(e,`${t}.ShipIt`);return z(n)?Le.map(e=>L(n,e)).filter(e=>z(e)):[]}function ze(e,t){if(!z(t))return{files:[],excludedByProjectSlug:0};let n=H(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>L(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(Fe),i=[],a=r.filter(t=>{try{return V(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=>!Fe(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Be(e){let t=L(e,`.ok`,`local`);return z(t)?{files:[`server.lock`,`last-spawn-error.log`,s].map(e=>L(t,e)).filter(e=>z(e))}:{files:[]}}function Ve(e){let t=L(e,`.ok`,`local`,`logs`);return z(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>L(t,e)).filter(e=>z(e))}:{files:[]}}function He(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=a(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function Ue(e){for(let t of e.files)try{He({zipfile:e.zipfile,name:`${e.prefix}/${F(t)}`,content:V(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function We(t){let{redact:n,outputPath:r,logger:i}=t,a=t.userLogsDir??L(G(),`.ok`,`logs`),s=t.projectDir?Me(t.projectDir,i):null;B(I(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Ne();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=ze(s,a),{files:d}=t.projectDir?Be(t.projectDir):{files:[]},{files:f}=t.projectDir?Ve(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],h=[],{ZipFile:g}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),_=new g;Ue({zipfile:_,files:[...l,...p],prefix:`logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),Ue({zipfile:_,files:d,prefix:`lockdir`,redact:n,bundleFiles:h,redactions:m,logger:i}),Ue({zipfile:_,files:f,prefix:`local-logs`,redact:n,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=V(e.sourcePath),n=`extra/${e.zipName??F(e.sourcePath)}`;_.addBuffer(t,n),h.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&He({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:h,redactions:m});let v=JSON.stringify(c,null,2);_.addBuffer(Buffer.from(v,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let y={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:h,redactions:m,sysinfo:c};_.addBuffer(Buffer.from(JSON.stringify(y,null,2),`utf8`),`MANIFEST.json`);let b=m.reduce((e,t)=>e+t.lineCount,0),x=new Set(p.map(e=>`logs/${F(e)}`)),S=h.filter(e=>x.has(e)),C=s?h.filter(e=>e.startsWith(`logs/`)&&!Fe(e)&&!x.has(e)):[],w=[`# Bug Report Bundle`,``,`Generated: ${y.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${y.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...C.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:`,...C.map(e=>`- ${e}`),``]:[],...S.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...S.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${o.join(`, `)}`,b>0?`${b} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
2
|
+
`);_.addBuffer(Buffer.from(w,`utf8`),`README.md`),_.end();let T=le(r);return _.outputStream.pipe(T),await new Promise((e,t)=>{T.on(`close`,e),T.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:b},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:b,generatedAt:y.generatedAt}}}var Ge=e(w(),1),K=e(ee(),1);function Ke(e){return v({absPath:y(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function qe({home:e=G(),env:n=process.env}={}){let a=Ke(e),{override:o,preferenceList:s}=g(n),{locale:c,source:l}=i({override:o,storedPreference:a,supportedLocales:r,preferenceList:s,autoDetectableLocales:t});return{preference:a,locale:c,source:l,systemLanguages:s}}function Je(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e,t){if(typeof e==`string`)return Je(e,t.contentDir);if(Array.isArray(e))return e.map(e=>q(e,t));if(!Ye(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=q(i,t);return n}function Xe(e,t){let n=V(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
3
|
`),i=n.split(`
|
|
4
4
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=q(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}W(e,r?`${a.join(`
|
|
5
5
|
`)}\n`:a.join(`
|
|
6
6
|
`))}function Ze(e,t){let n=V(e,`utf-8`);if(n.trim().length!==0)try{let r=q(JSON.parse(n),t),i=n.endsWith(`
|
|
7
7
|
`)?`
|
|
8
8
|
`:``;W(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=Je(n,t.contentDir);r!==n&&W(e,r)}}function Qe(e,t){let n=V(e,`utf-8`),r=Je(n,t.contentDir);r!==n&&W(e,r)}function $e(e){try{return H(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>L(e,t.name))}catch{return[]}}const et=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function tt(e){return/\.log\.\d+$/.test(e)}function nt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||tt(e)}function rt(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of $e(L(e.stagingDir,n)))nt(r)?Xe(r,t):r.endsWith(`.json`)?Ze(r,t):Qe(r,t);for(let n of $e(L(e.stagingDir,`state`))){let e=F(n);n.endsWith(`.jsonl`)?Xe(n,t):et.has(e)?Ze(n,t):Qe(n,t)}}const it=[`.ok`,`local`,`telemetry`],at=[`.ok`,`local`,`logs`],ot=[`.ok`,`local`,`loss-capture`],st=`spans-current.jsonl`,ct=`spans-prev.jsonl`,lt=`server-current.jsonl`,ut=`server-prev.jsonl`,dt=`loss-current.jsonl`,ft=`loss-prev.jsonl`;function pt(e){return L(e,...it,st)}function mt(e){return L(e,...it,ct)}function ht(e){return L(e,...at,lt)}function gt(e){return L(e,...at,ut)}function _t(e){return L(e,...ot,dt)}function vt(e){return L(e,...ot,ft)}const yt=1e3;async function bt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}async function xt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}async function St(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}function Ct(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 wt(e){let t=L(e,`.git`,`ok`);if(!z(t))return null;let n=ae(`git`,[`-C`,t,`log`,`--oneline`,`-50`],
|
|
9
|
+
`)}\n`:null}catch{return null}}function wt(e){let t=L(e,`.git`,`ok`);if(!z(t))return null;let n=ae(`git`,[`-C`,t,`log`,`--oneline`,`-50`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Tt(e){let t=L(e,`.git`,`ok`);if(!z(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/`],d({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Et(){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 Dt(){return{nodeVersion:process.version,platform:_e(),arch:me()}}function Ot(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function kt(e){if(!z(e))return{};let t;try{t=(0,we.parse)(V(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function At(e){return typeof e==`boolean`?e:void 0}function jt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return jt(e.maxBytes)}function Mt(e){let t=kt(y(`project`,e)),n=kt(y(`project-local`,e));return{enabled:At(n.enabled)??At(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Nt(e){return Ce(`sha256`).update(e).digest(`hex`)}function Pt(e){let t=V(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Ft(e){let t=V(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X(e,t){if(!z(e))return!1;try{return B(I(t),{recursive:!0}),ce(e,t),!0}catch{return!1}}function It(e){let t=[],n=e=>{let r=H(e,{withFileTypes:!0});for(let i of r){let r=L(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Lt=new Set([`.jsonl`]);function Rt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Lt.has(e.slice(t))}const zt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Bt(e){if(tt(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:zt.has(e.slice(t))}function Vt(e){let t=[];for(let n of It(e)){let r=Ht(e,n);if(!Bt(r))continue;let{redacted:i,patterns:o,lineCount:s}=a(V(n,`utf-8`));o.length!==0&&(W(n,i),t.push({file:r,lineCount:s,patterns:o}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Ht(e,t){return oe(e,t).split(se).join(`/`)}async function Ut(e){let t=R(e.contentDir),n=R(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??bt,a=r.fetchAgentEffects??xt,o=r.fetchWatcherRecent??St,l=r.readShadowHead??wt,u=r.readCheckpointRefs??Tt,d=r.now??(()=>new Date),f=r.okVersion??(()=>N),p=r.readDesktopEnv??Et,m=r.readLanguage??qe,h=r.readRuntime??Dt,g=r.isOtlpPushEnabled??Ot,_=de(L(ye(),`ok-bundle-`));try{B(L(_,`telemetry`),{recursive:!0}),B(L(_,`logs`),{recursive:!0}),B(L(_,`state`),{recursive:!0}),X(pt(n),L(_,`telemetry`,st)),X(mt(n),L(_,`telemetry`,ct)),X(ht(n),L(_,`logs`,lt)),X(gt(n),L(_,`logs`,ut));for(let t of e.userLogFiles??[])X(t,L(_,`logs`,F(t)));let v=L(n,`.ok`,`local`),y=L(v,`server.lock`),b=`not-running`,x=`no server.lock`,S=null;if(z(y)){X(y,L(_,`state`,`server.lock`));try{let e=V(y,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?S=t.port:x=`lock present but no port`}catch{x=`lock present but unparseable`}}if(S!==null){let e=await i(S);e===null?x=`agent-presence endpoint at :${S} unreachable`:(W(L(_,`state`,`agent-presence.json`),e),b=`running`,x=``);let t=await a(S);t!==null&&W(L(_,`state`,`agent-effects.json`),t);let n=await o(S);if(n!==null){let e=Ct(n);e!==null&&W(L(_,`state`,`watcher-recent.jsonl`),e)}}let C=l(t);C!==null&&W(L(_,`state`,`shadow-head.txt`),C);let w=u(t);w!==null&&W(L(_,`state`,`checkpoint-refs.txt`),w),X(_t(n),L(_,`state`,dt)),X(vt(n),L(_,`state`,ft)),X(L(v,`last-spawn-error.log`),L(_,`state`,`last-spawn-error.log`)),X(L(v,c),L(_,`state`,c)),X(L(v,s),L(_,`state`,s));let T=h(),ee=p(),E=m(),te={ok:{version:f(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:ee,language:E}};W(L(_,`state`,`runtime.json`),`${JSON.stringify(te,null,2)}\n`);let D=b===`running`?`running
|
|
10
10
|
`:`not-running (${x})\n`;if(W(L(_,`state`,`server-status.txt`),D),e.processDir&&z(e.processDir)){let t=L(_,`process`);B(t,{recursive:!0}),ce(e.processDir,t,{recursive:!0})}let O=e.redact===!0;O&&rt({stagingDir:_,contentDir:t}),e.note&&W(L(_,`note.txt`),e.note);let k=null;e.scrubSecrets===!0&&(k=Vt(_));for(let t of e.extraFiles??[])X(t.sourcePath,L(_,`extra`,t.zipName??F(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let A=Mt(n),j=It(_),M=[],N=0,P=0;for(let e of j){let t=Ht(_,e),n=pe(e).size,r=Rt(t)?Pt(e):0;M.push({path:t,bytes:n,lines:r}),N+=n,t.startsWith(`telemetry/`)&&Rt(t)&&(P+=Ft(e))}let ne={applied:O};k!==null&&(ne.secretScrub=k);let re={schemaVersion:2,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:ee,language:E},contentDir:{pathSha256:Nt(t),absolutePath:O?`<CONTENT_DIR>`:t},telemetry:{localSink:A,otlpPushEnabled:g()},redaction:ne,serverStatus:b,files:M};W(L(_,`manifest.json`),`${JSON.stringify(re,null,2)}\n`);let ie=j.some(e=>{try{return V(e,`utf-8`).includes(t)}catch{return!1}}),ae={totalBytes:N,fileCount:M.length,docNameCount:P,contentDirVisible:ie,redacted:O},I=!1;return{stagingDir:_,manifest:re,summary:ae,cleanup:()=>{I||(I=!0,U(_,{recursive:!0,force:!0}))}}}catch(e){throw U(_,{recursive:!0,force:!0}),e}}async function Wt(e){let{collected:t,outputPath:n}=e,r=I(n);if(!z(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Ge.ZipFile,a=It(t.stagingDir);for(let e of a){let n=Ht(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 Gt(e,t){let n=L(e,`.ok`,`config.yml`);if(z(n))try{let t=(0,we.parse)(V(n,`utf-8`)),r=P(t)?t.content:void 0,i=P(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return R(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 R(e)}async function Kt(e,t,n,r){let i=Me(t,e.logger),a=await Ut({contentDir:Gt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...Ie(i,e.userLogsDir??L(G(),`.ok`,`logs`)),...Re(e.cachesDir??L(G(),`Library`,`Caches`))],deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{B(I(e.outputPath),{recursive:!0}),await Wt({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function qt(e){let{projectDir:t}=e,n=e.readDesktopEnv??Et,r=e.readLanguage??qe;if(e.level===`full`&&t!==void 0)return Kt(e,t,n,r);let{zipPath:i,summary:a}=await We({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:Re(e.cachesDir??L(G(),`Library`,`Caches`)),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}function Z(e,t,n={}){let r=S(e,t);if(!z(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(V(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!b(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??x)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??C())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ge();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Jt(e){return e.replace(/:\d+$/,``)}function Yt(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Jt(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 Xt=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Zt(e){return L(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Qt={existsSync:e=>z(e),readFileSync:(e,t)=>V(e,t),lstatSync:e=>ue(e),readlinkSync:e=>fe(e)};function $t(e,t=Qt){let n=Zt(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function en(e){let t=e.replace(Xt,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function tn(e,t,n=Qt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function nn(e){return re(e)||ne(e)||j(e)}const rn=10*1024*1024;function an(e,t,n,r){let i=k(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!nn(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);return e.format===`file`?(U(a,{force:!0}),{kind:`removed`}):e.format===`toml`?cn(a,o):e.format===`yaml`?sn(a,e.topLevelKey,o):on(a,e.topLevelKey,e.serverMapSubKey,o)}function on(e,t,n,r){let i;try{i=V(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=te(i,O(t,n,r));return o?(_(e,a,{mode:A(e)}),{kind:`removed`}):{kind:`not-present`}}function sn(e,t,n){let r;try{r=V(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,we.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=D(a);a.trim()===``||a.endsWith(`
|
|
11
11
|
`)?c.endsWith(`
|
|
12
12
|
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
@@ -15,6 +15,6 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{H as t,U as n,ct as r}from"./sle
|
|
|
15
15
|
`),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
|
|
16
16
|
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
17
17
|
`).replace(/\n/g,`\r
|
|
18
|
-
`));let u=`${i?``:``}${l}`;return u!==r&&_(e,u,{mode:A(e)}),{kind:`removed`}}function ln(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function un(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function dn(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:
|
|
19
|
-
`)}async function yn(e={}){let t=e.discover??h,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??
|
|
20
|
-
//# sourceMappingURL=src-
|
|
18
|
+
`));let u=`${i?``:``}${l}`;return u!==r&&_(e,u,{mode:A(e)}),{kind:`removed`}}function ln(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function un(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function dn(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:f(r),command:r,isDesktop:ln(r)}}function fn(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&fn(e)?`ui-orphan`:`stale`}const pn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function mn(e){switch(e){case`running`:return K.default.green(e);case`desktop`:return K.default.blue(e);case`foreign`:return K.default.cyan(e);case`ui-orphan`:return K.default.magenta(e);case`stale`:return K.default.yellow(e)}}function hn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function gn(e){return`${hn(e.server.usage)} | ${hn(e.ui?.usage??null)}`}function _n(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function vn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,_n(e),gn(e),t,String(n),un(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=mn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=K.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
19
|
+
`)}async function yn(e={}){let t=e.discover??h,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??u,a=e.resolveUsage??m,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=dn(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(vn(e.all?s:s.filter(e=>pn.has(Q(e)))))}function bn(){return new T(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await yn({all:t.all===!0||e===`all`,json:t.json===!0})})}function xn(e,t,n={}){let r=n.isAlive??x,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function Sn(e){let t=e.inspect??(t=>Z(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=xn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Cn(e,t=x){let n=await h(),r=null;for(let i of n){let n=Z(i,`server`),a=Z(i,`ui`);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function wn(e){let t=Sn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Tn(e){return new T(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=Sn({lockDir:l(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await yn({});return}if(n===`all`){let e=await h();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=Z(n,`server`),r=Z(n,`ui`);!$(e,x)&&!$(r,x)||(wn(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Cn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}wn(t);return}wn(l(R(ke(),n)))})}export{ke as _,Xt as a,$t as c,Z as d,qt as f,Ae as g,je as h,an as i,en as l,Wt as m,Tn as n,tn as o,Ut as p,bn as r,Zt as s,Sn as t,Yt as u,Oe as v,Ee as y};
|
|
20
|
+
//# sourceMappingURL=src-BabT8t0g.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-DMpGVIiQ.mjs";import"./src-BabT8t0g.mjs";import"./acp-harness-probe-5Bd7W9lp.mjs";import"./init-DGihqAzs.mjs";import"./write-project-skill-DHsuRyv9.mjs";import{n as e}from"./loader-B_nowTX3.mjs";import"./skill-teardown-BppNXkpR.mjs";import"./preview-B88pOGOc.mjs";import"./mcp-migrate-event-BsswfOLm.mjs";export{e as loadConfig};
|