@inkeep/open-knowledge 0.50.0-beta.6 → 0.50.0-beta.8
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-PEHo_hYG.mjs → acp-harness-probe-CcFQmgX3.mjs} +2 -2
- package/dist/cli.mjs +18 -18
- package/dist/config-schema.json +6 -33
- package/dist/config.user.schema.json +6 -33
- package/dist/constants-B51mAM4l.mjs +2 -0
- package/dist/fs-traced-B2GMd7hO.mjs +12 -0
- package/dist/fs-traced-Bkh7Uqka.mjs +1 -0
- package/dist/{git-handle-D48CPnbp.mjs → git-handle-C_J8Il_Y.mjs} +2 -2
- package/dist/git-handle-k-1cd6rA.mjs +1 -0
- package/dist/index.d.mts +4 -31
- package/dist/index.mjs +170 -170
- package/dist/{init-BJCusUuy.mjs → init-BBQ5oZSu.mjs} +5 -5
- package/dist/init-DnZMOBvW.mjs +1 -0
- package/dist/{launch-json-removal-BXFgQzfH.mjs → launch-json-removal-2TjcexXj.mjs} +2 -2
- package/dist/loader-BIpUYYKt.mjs +2 -0
- package/dist/loader-CyB-T8UJ.mjs +1 -0
- package/dist/md-manager-CmcPG20v.mjs +2 -0
- package/dist/{open-browser-DITljs8e.mjs → open-browser-BE__nPRv.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-D3Txy4Ba.mjs +1 -0
- package/dist/{preview-DXyVMz8b.mjs → preview-DmCOiYiE.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-c7Ng5dOt.js → ActivityModeContent-Do0P5PkB.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-CdvdlrTA.js → AgentDiffPane-DFRVwXr-.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-CvHvukLZ.js → AgentThreadClientBinder-BO7zX8GD.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-Bu8uPTJS.js → ChangedOutsideBadge-do2_817w.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-BTBqLMWS.js +3 -0
- package/dist/public/assets/{DocumentContext-sNpqhUlI.js → DocumentContext-B1UtgXw5.js} +10 -10
- package/dist/public/assets/{EditorModeToggle-D4871FSZ.js → EditorModeToggle-DsMo0oeU.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-cBuI6coM.js → EnableSyncConfirmDialog-BrRBeEzr.js} +1 -1
- package/dist/public/assets/FeedbackForm-BXQKPBhM.js +1 -0
- package/dist/public/assets/{GraphPanel-CAMYjjtr.js → GraphPanel-CNCFVViE.js} +2 -2
- package/dist/public/assets/{ImportSkillDialog-BepHDHz6.js → ImportSkillDialog-ChNKMjwJ.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-DRA7zDJD.js → LintConfigEditor-Cg_osArr.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CBhFU95H.js +1 -0
- package/dist/public/assets/ManagedArtifactProperties-DmLlKjD9.js +2 -0
- package/dist/public/assets/{McpConsentDialogBody-ONRUf-u9.js → McpConsentDialogBody-C02gJb5g.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-DC95RR-G.js → MermaidDocEditor-BmIEBgEV.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-7VaenClj.js → ReportBugDialogBody-CrlxwAm_.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-B2VRQNhY.js → SchemaConfigEditor-BBqKhENz.js} +1 -1
- package/dist/public/assets/{SessionsHost-CJM2wXx0.js → SessionsHost-BQqsJZay.js} +2 -2
- package/dist/public/assets/SettingsDialogBody-okmHTajR.js +12 -0
- package/dist/public/assets/{ShareBranchSwitchDialog-DD7xybfa.js → ShareBranchSwitchDialog-BUEkE4LA.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-Bz3zpKKF.js → ShareReceiveDialog-XWYS81GX.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DqXylco3.js → ShareReceiveMissDialog-BRiPsQxv.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-BwzPIxd8.js → SkillEditBanner-SWeBUR9w.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-BFCXo8sI.js → SkillOriginInline-BG4CIOQu.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DF0m8f6g.js → SkillToolbarControls-CIzXYpP0.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-DJXDoZdd.js → SlidesToolbarControls-qIPApX9s.js} +1 -1
- package/dist/public/assets/SourceEditor-D-ZojZ1R.js +1 -0
- package/dist/public/assets/{TerminalPanel-BlK8X0ar.js → TerminalPanel-BY_O1gj3.js} +2 -2
- package/dist/public/assets/{TerminalWindowApp-Cy9Ov0_z.js → TerminalWindowApp--SieYOj2.js} +1 -1
- package/dist/public/assets/{TextDocEditor-D3Hjb2Vu.js → TextDocEditor-CR8RlbZz.js} +1 -1
- package/dist/public/assets/{ThreadView-YWeuTsL5.js → ThreadView-BZQgz_OT.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CGiWI4cl.js → TimelineDiffPane-CBnAmGxS.js} +1 -1
- package/dist/public/assets/{agent-diff-store-CEeOURzl.js → agent-diff-store-CGbJo0xm.js} +1 -1
- package/dist/public/assets/auth-state-cache-BrIjR7Qf.js +11 -0
- package/dist/public/assets/{client-version-B0MkkJjB.js → client-version-BM5nu9rX.js} +1 -1
- package/dist/public/assets/{comment-chips-CmSdX8nJ.js → comment-chips-uegP4pH6.js} +1 -1
- package/dist/public/assets/config-provider-7a2bYG1Y.js +5 -0
- package/dist/public/assets/{dist-Cy5lktAQ2.js → dist-D6d8jhW_2.js} +184 -184
- package/dist/public/assets/{doc-paths-CBKXYveW.js → doc-paths-B610Q5eD.js} +1 -1
- package/dist/public/assets/{documents-events-DNLLVEPR.js → documents-events-DQ-lmKb8.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-BQ9idF-F.js → file-tree-adapter-Bmhiw8ek.js} +1 -1
- package/dist/public/assets/{file-tree-utils-DrTcSGTj.js → file-tree-utils-bTlUKR2h.js} +1 -1
- package/dist/public/assets/{folder-config-api-Cf3ca6iE.js → folder-config-api-BFi_uZNT.js} +1 -1
- package/dist/public/assets/{follow-file-Ctr47jtP.js → follow-file-BcVK10qo.js} +1 -1
- package/dist/public/assets/globals-Bq7QmnDv.css +1 -0
- package/dist/public/assets/i18n-CDj8TaBr.js +1 -0
- package/dist/public/assets/{index-DrqV8949.js → index--rSjedb-.js} +14 -14
- package/dist/public/assets/{lint-config-client-DzdtSJp-.js → lint-config-client-DTg6epjB.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-DMQXiRek.js → markdownlint-rule-browser-BG8UPutR.js} +1 -1
- package/dist/public/assets/messages-7Y8pfBz0.js +1 -0
- package/dist/public/assets/messages-B4sBf5fy.js +1 -0
- package/dist/public/assets/messages-BIEb40JZ.js +1 -0
- package/dist/public/assets/messages-BfLJys0I.js +1 -0
- package/dist/public/assets/messages-Cf6YBtq4.js +1 -0
- package/dist/public/assets/messages-CtiGbVvK.js +1 -0
- package/dist/public/assets/messages-D1QObPqW.js +1 -0
- package/dist/public/assets/messages-D1nlMujt.js +1 -0
- package/dist/public/assets/messages-Dg4RPh9k.js +1 -0
- package/dist/public/assets/messages-gxmuaITL.js +1 -0
- package/dist/public/assets/messages-mE27tR2H.js +1 -0
- package/dist/public/assets/navigation-targets-Ch69zMGC.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-B84Y6EsP.js → open-managed-artifact-tab-CY_LAv2n.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-DosIhFkt.js → pending-receive-nav-store-Bgy0uGX1.js} +1 -1
- package/dist/public/assets/{prop-types-BxhIEdp4.js → prop-types-C-BAUUTo.js} +1 -1
- package/dist/public/assets/{receive-store-DO5w93VK.js → receive-store-CbFpknqD.js} +1 -1
- package/dist/public/assets/{selection-context-DAl-Wxy6.js → selection-context-BzSHpc5K.js} +1 -1
- package/dist/public/assets/{skill-actions-1VvTttnO.js → skill-actions-CcWeYGSe.js} +2 -2
- package/dist/public/assets/{skill-scope-uWACL-4X.js → skill-scope-BpzNeizS.js} +1 -1
- package/dist/public/assets/{skills-api-S9b1zvZ6.js → skills-api-CnFnvcRc.js} +1 -1
- package/dist/public/assets/{src-CVA7Dtfv.js → src-CuYJwSNo.js} +2 -2
- package/dist/public/assets/{tag-pill-input-er0MqvFK.js → tag-pill-input-BMvx5BmV.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DBvgpA7l.js → target-navigation-intent-C776WObz.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-CBMTYLbQ.js → terminal-cli-display-C7F4bitQ.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-CbqKUJ57.js → terminal-launch-events-9H84Qwtv.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-BRNk9k9Y.js → terminal-telemetry-CedWu1hq.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-D114TNgO.js → typing-burst-detector-BBlqPp_d.js} +2 -2
- package/dist/public/assets/{uninstall-B7OIrc24.js → uninstall-BmrDQXtu.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DnpzFXIs.js → use-activity-panel-aHDXnP43.js} +1 -1
- package/dist/public/assets/use-apply-config-color-theme-DA6djYET.js +1 -0
- package/dist/public/assets/{use-collab-url-CjkHphlr.js → use-collab-url-DCLqu1UG.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-CVQrPooY.js → use-live-xterm-theme-Br4z4FVs.js} +1 -1
- package/dist/public/assets/{use-open-skill-DImLrKgY.js → use-open-skill-IVQ8LRcM.js} +1 -1
- package/dist/public/assets/{use-popular-skills-Dj_DcxJ4.js → use-popular-skills-BAuUERAB.js} +1 -1
- package/dist/public/assets/{use-settings-route-DEoOHvHf.js → use-settings-route-C0dQSoJu.js} +1 -1
- package/dist/public/assets/{use-skill-origin-Bj3wYKq2.js → use-skill-origin-Dsa-uKgK.js} +1 -1
- package/dist/public/assets/{use-skills-k_NyqOb0.js → use-skills-CFPPlRb6.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-D2ShR7ZJ.js → use-terminal-enabled-BXKMhE7B.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CjhWQfrw.js → use-timeline-entry-diff-DBpBbxuy.js} +4 -4
- package/dist/public/assets/{use-workspace-D0EhHpoU.js → use-workspace-ow-NJpFl.js} +1 -1
- package/dist/public/index.html +57 -54
- package/dist/public/uninstall.html +6 -6
- package/dist/{repair-launch-json-DJCBlxLw.mjs → repair-launch-json-Ccf7daSp.mjs} +2 -2
- package/dist/{repair-mcp-configs-C8bpTpxh.mjs → repair-mcp-configs-CoNwCRjc.mjs} +2 -2
- package/dist/{repair-skills-CMm13M8P.mjs → repair-skills-BrOFbDSH.mjs} +2 -2
- package/dist/repair-skills-SUdBvS9h.mjs +1 -0
- package/dist/schemas/v0/config.user.schema.json +6 -33
- package/dist/{server-lock-V3bg8zL0.mjs → server-lock-BOsuOHaz.mjs} +2 -2
- package/dist/server-lock-SvEBQb4s.mjs +1 -0
- package/dist/{skill-teardown-CO4xteJC.mjs → skill-teardown-D31Ah_77.mjs} +2 -2
- package/dist/{sleep-DVOInM4H.mjs → sleep-Dj1Ck0gp.mjs} +6 -5
- package/dist/src-5W71opsG.mjs +1 -0
- package/dist/{src-DwT4IlXo.mjs → src-BvzFYC4G.mjs} +3 -3
- package/dist/src-D6v6esDL.mjs +2032 -0
- package/dist/{src-IM6msWeV.mjs → src-DS92rBYx.mjs} +131 -131
- package/dist/src-DqxPJWfl.mjs +1 -0
- package/dist/start-Bjkfv8bC.mjs +1 -0
- package/dist/{start-Bua6MR2W.mjs → start-CCD3K5PY.mjs} +3 -3
- package/dist/{write-project-skill-BoeD2RUw.mjs → write-project-skill-Dpr3DYpv.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-D9HRzNQG.mjs +0 -2
- package/dist/fs-traced-DVpoNaQJ.mjs +0 -12
- package/dist/fs-traced-_QGcVmcb.mjs +0 -1
- package/dist/git-handle-B24ZRv9k.mjs +0 -1
- package/dist/init-zePCt6tf.mjs +0 -1
- package/dist/loader-DDNAwcPM.mjs +0 -1
- package/dist/loader-DbPx77mt.mjs +0 -2
- package/dist/md-manager-DLcJdRDn.mjs +0 -2
- package/dist/preview-AsssSL6s.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-fWbdlCkS.js +0 -3
- package/dist/public/assets/FeedbackForm-BFd0ubqI.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CLh5T0qS.js +0 -2
- package/dist/public/assets/ManagedArtifactProperties-Ct_XfVJo.js +0 -1
- package/dist/public/assets/SettingsDialogBody-LwuRFjnU.js +0 -12
- package/dist/public/assets/SourceEditor-CBToWgb8.js +0 -1
- package/dist/public/assets/auth-state-cache-kFk2nWdi.js +0 -11
- package/dist/public/assets/config-provider-BkvKKK43.js +0 -5
- package/dist/public/assets/globals-B-lWUzDu.css +0 -1
- package/dist/public/assets/i18n-CC8DkJXO.js +0 -1
- package/dist/public/assets/messages-BNq0JS1I.js +0 -1
- package/dist/public/assets/messages-C1QZwdEx.js +0 -1
- package/dist/public/assets/messages-CAevTmZQ.js +0 -1
- package/dist/public/assets/messages-CG-GHBB9.js +0 -1
- package/dist/public/assets/messages-CIxg-v3C.js +0 -1
- package/dist/public/assets/messages-CKi8pZ4Q.js +0 -1
- package/dist/public/assets/messages-Cv5HHzZF.js +0 -1
- package/dist/public/assets/messages-DTRz3g9F.js +0 -1
- package/dist/public/assets/messages-DWBpIisU.js +0 -1
- package/dist/public/assets/messages-XzeH2iOB.js +0 -1
- package/dist/public/assets/messages-bBtIkGs7.js +0 -1
- package/dist/public/assets/navigation-targets-Ce74CisT.js +0 -1
- package/dist/public/assets/use-apply-config-color-theme-DLZre1dS.js +0 -1
- package/dist/repair-skills-BK1EcvXS.mjs +0 -1
- package/dist/server-lock-Dy_yO6Nk.mjs +0 -1
- package/dist/src-C2Gyjygx.mjs +0 -1
- package/dist/src-CRHuZPcr.mjs +0 -1
- package/dist/src-bozJXbns.mjs +0 -2032
- package/dist/start-BGjifSjp.mjs +0 -1
- /package/dist/public/assets/{globals-CZJtsuL5.js → globals-B8Za6o5Q.js} +0 -0
|
@@ -176,13 +176,14 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
176
176
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
177
177
|
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){u(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(a(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=l(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(a(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(s(t.key)&&!a(t.sep,`newline`)){let e=l(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):a(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!a(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){u(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||a(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=l(c(t));d(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
178
178
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
179
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=l(c(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=l(c(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),dc=t((e=>{var t=rc(),n=Bs(),r=Vs(),i=ms(),a=K(),o=lc(),s=uc();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),fc=t((e=>{var t=rc(),n=Bs(),r=Rs(),i=Vs(),a=os(),o=K(),s=Y(),c=J(),l=X(),u=Z();sc();var d=cc(),f=lc(),p=uc(),m=dc(),h=ts();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync}));const pc=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),mc=new Set([`md`,`mdx`,`mmd`,`mermaid`]),hc=new Set([...pc,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!mc.has(e)));function gc(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:hc.has(t.slice(n+1).toLowerCase())}const _c=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],vc=[`video/mp4`,`video/webm`,`video/ogg`],yc=[`audio/mpeg`,`audio/wav`,`audio/ogg`],bc=[`application/pdf`],xc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Sc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Cc=new Set([`pdf`]),wc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Tc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Ec=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),Dc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Oc=new Set([`html`,`htm`]),kc=`sandbox allow-scripts; connect-src 'none'`,Ac=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),jc=`same-dir`,Mc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Nc=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Pc=[`mp4`,`webm`,`mov`,`m4v`],Fc=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Ic=[`pdf`],Lc=[`json`,`toml`,`lock`];function Rc(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Rc(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Nc,xc),Rc(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Pc,Sc),Rc(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Fc,wc),Rc(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Ic,Cc),Rc(`FILE_ATTACHMENT_EXTENSIONS`,[...Tc],Mc),Rc(`WIKI_EMBED_EXTENSIONS`,[...Mc],Dc);const zc=new Set(Nc),Bc=new Set(Pc),Vc=new Set(Fc),Hc=new Set(Ic),Uc=new Set(Lc);Rc(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Nc,...Pc,...Fc,...Ic,...Lc])],Ac);const Wc=new Set([`base`,`canvas`]),Gc=new Set([`mmd`,`mermaid`]);function Kc(e){let t=e.lastIndexOf(`.`);return t<0?!1:Gc.has(e.slice(t+1).toLowerCase())}const qc=new Set([...Dc,...Wc,...Gc]);function Jc(e){let t=e.toLowerCase().replace(/^\./,``);return zc.has(t)?`image`:Bc.has(t)?`video`:Vc.has(t)?`audio`:Hc.has(t)?`pdf`:Uc.has(t)||Wc.has(t)?`text`:Gc.has(t)?`mermaid`:pc.has(t)?`text`:null}const Yc=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`],Xc=new Set([`ar`,`ur`]);Yc.filter(e=>!Xc.has(e));const Zc=[`off`,`warning`,`error`],Qc=`warning`,$c=[`error`,`warning`];var el=fc();const tl=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],nl={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`};function rl(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...ol(t)}}const il={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},al=Object.keys(il);function ol(e){let t={};for(let n of al)t[`ansi-${sl(n)}`]=e[il[n]];return t}function sl(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const cl={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},ll={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},ul={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1e66f5`,base0E:`#8839ef`,base0F:`#dd7878`}},dl={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},fl={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},pl={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#268bd2`,base0E:`#6c71c4`,base0F:`#d33682`}};function ml(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>rl(n)}}function hl(e,t){return{id:e,label:t,kind:`system`}}const gl=[hl(`default`,`Default`),ml(`dracula`,`Dracula`,cl),ml(`catppuccin-frappe`,`Catppuccin Frappé`,ll),ml(`catppuccin-latte`,`Catppuccin Latte`,ul),ml(`monokai`,`Monokai`,dl),ml(`gruvbox`,`Gruvbox`,fl),ml(`solarized`,`Solarized`,pl),hl(`custom`,`Custom`)],_l=gl.map(e=>e.id);new Map(gl.map(e=>[e.id,e]));const vl=Symbol.for(`@inkeep/open-knowledge/field-registry`),yl=globalThis;yl[vl]===void 0&&(yl[vl]=tr());const Q=yl[vl];function bl(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=xl(t)?Q.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function xl(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Sl(){return Object.fromEntries(tl.map(e=>[e,L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${nl[e]}, as a #rrggbb hex string.`}).optional()]))}function Cl(){return _l.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const wl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Tl=52428800,El=26214400,Dl=12582912,Ol=`https://api.openai.com/v1`,kl=`text-embedding-3-small`;function Al(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function jl(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&Al(e)?null:`insecure-scheme`}function Ml(e){let t=e.trim();return t===``?`./`:t}function Nl(e){let t=Ml(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Pl=U({content:U({dir:L().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:L().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Nl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:U({theme:W([`light`,`dark`,`system`]).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:W([`system`,...Yc]).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:W(_l).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of ${Cl()}. A personal preference (user scope) — not shared with the project.`}).optional(),colorThemeDark:W(_l).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of ${Cl()}. A personal preference (user scope) — not shared with the project.`}).optional(),colorTheme:W(_l).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A personal preference (user scope) — not shared with the project.`}).optional(),colorThemeEnabled:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:U({name:L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:W([`dark`,`light`]).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Sl()}).optional(),preview:U({autoOpen:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:U({showHiddenFiles:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:U({wordWrap:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:U({autoApproveOkTools:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:U({mode:W(Jo).register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:W(Yo).register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:co([B(),W(Jo)]).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:U({enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:U({enabled:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:U({localSink:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:U({maxBytes:z().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Tl)}).default({maxBytes:Tl}),logs:U({maxBytes:z().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(El)}).default({maxBytes:El}),attributeDenylist:V(L()).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...wl])}).default({enabled:!0,spans:{maxBytes:Tl},logs:{maxBytes:El},attributeDenylist:[...wl]}),skillInstallReports:U({enabled:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:Tl},logs:{maxBytes:El},attributeDenylist:[...wl]},skillInstallReports:{enabled:!0}}),lossCapture:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:z().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Dl)}).default({enabled:!0,maxBytes:Dl}),bridge:U({backgroundThrottle:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:U({semantic:U({enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:L().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Ol),model:L().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(kl),dimensions:z().int().positive().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:z().min(0).max(1).register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Ol,model:kl})}).default({semantic:{enabled:!1,baseUrl:Ol,model:kl}}),contentRules:U({markdownlint:H({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:H({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:V(H({appliesTo:co([L(),V(L())]).optional(),file:L(),enabled:B().optional()})).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]}}),validation:U({links:W(Zc).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Qc),fileTreeIndicators:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Qc,fileTreeIndicators:!0}),linkPreviews:U({enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),remote:U({url:L().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Public URL your tunnel gives you, e.g. https://myproject.ngrok.app. Used only with `ok start --remote` (config alone never enables remote access); its host is admitted through the Host-header allowlist. There is no server-side auth, so restrict access at the tunnel (ngrok OAuth, Cloudflare Access, Tailscale ACLs)."}).optional(),port:z().int().min(1).max(65535).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`TCP port the server binds when remote access is enabled (default 24550). Fixed so the tunnel's port mapping survives restarts. Set it only on a conflict. An explicit --port still wins; the PORT env var is ignored in remote mode.`}).default(24550)}).default({port:24550})});r();const Fl=`open-knowledge-config`;async function Il(e,t,r){let a=i.getTracer(Fl),o=t?{attributes:t}:{};return a.startActiveSpan(e,o,async e=>{try{return await r(e)}catch(t){throw e.recordException(t),e.setStatus({code:n.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Ll(e,t,r){let a=i.getTracer(Fl),o=t?{attributes:t}:{};return a.startActiveSpan(e,o,e=>{try{return r(e)}catch(t){throw e.recordException(t),e.setStatus({code:n.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Rl(e,t){let n=i.getActiveSpan();n&&n.addEvent(e,t)}function zl(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Bl(e,t){let n=e;for(let e of t){n=zl(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Vl(e,t){let n=Bl(e,t);if(n!==void 0)return bl(n)}function Hl(e,t){return e===`either`?!0:e===t}function Ul(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Vl(Pl,i);a?.scope!==void 0&&(Hl(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Wl(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,el.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function Gl(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Wl(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Wl(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Kl(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const ql=H({file:L(),line:z().int().min(1),column:z().int().min(1),snippet:L().optional()}),Jl=H({path:V(co([L(),z()])),message:L(),issueCode:L(),params:ho(L(),no()).optional(),source:ql.optional()}),Yl=W([`user`,`project`,`project-local`,`either`]),Xl=W([`user`,`project`,`project-local`]),Zl=H({code:G(`YAML_PARSE`),detail:L()}),Ql=H({code:G(`UNREADABLE`),detail:L()}),$l=H({code:G(`SCHEMA_INVALID`),issues:V(Jl)}),eu=H({code:G(`REMOVED_KEY`),path:V(L()),redirect:L(),source:ql.optional()}),tu=uo(`code`,[Zl,$l,Ql,H({code:G(`SCOPE_VIOLATION`),path:V(L()),expectedScope:Yl,actualScope:Xl}),H({code:G(`NOT_AGENT_SETTABLE`),path:V(L())}),H({code:G(`MIXED_SCOPE`),paths:V(H({path:V(L()),scope:Xl}))}),eu,H({code:G(`WRITE_ERROR`),detail:L()}),H({code:G(`OKIGNORE_INVALID`),detail:L(),lineNumber:z().int().min(1).optional()}),H({code:G(`UNKNOWN`),message:L().optional()})]);uo(`code`,[eu,Zl,$l,Ql]);const nu=H({diagnostics:V(uo(`code`,[H({code:G(`REMOVED_KEY`),scope:Xl,file:L(),path:V(L()),redirect:L()}),H({code:G(`YAML_PARSE`),scope:Xl,file:L()}),H({code:G(`SCHEMA_INVALID`),scope:Xl,file:L()}),H({code:G(`UNREADABLE`),scope:Xl,file:L()})]))}),ru=new Set(tu.options.map(e=>e.shape.code.value)),iu=co([tu,U({code:L(),message:L().optional()})]);function au(e){return ru.has(e.code)}function ou(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function su(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function cu(e){if(!au(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
179
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=l(c(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=l(c(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),dc=t((e=>{var t=rc(),n=Bs(),r=Vs(),i=ms(),a=K(),o=lc(),s=uc();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),fc=t((e=>{var t=rc(),n=Bs(),r=Rs(),i=Vs(),a=os(),o=K(),s=Y(),c=J(),l=X(),u=Z();sc();var d=cc(),f=lc(),p=uc(),m=dc(),h=ts();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync}));const pc=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),mc=new Set([`md`,`mdx`,`mmd`,`mermaid`]),hc=new Set([...pc,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!mc.has(e)));function gc(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:hc.has(t.slice(n+1).toLowerCase())}const _c=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],vc=[`video/mp4`,`video/webm`,`video/ogg`],yc=[`audio/mpeg`,`audio/wav`,`audio/ogg`],bc=[`application/pdf`],xc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Sc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Cc=new Set([`pdf`]),wc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Tc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Ec=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),Dc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Oc=new Set([`html`,`htm`]),kc=`sandbox allow-scripts; connect-src 'none'`,Ac=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),jc=`same-dir`,Mc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Nc=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Pc=[`mp4`,`webm`,`mov`,`m4v`],Fc=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Ic=[`pdf`],Lc=[`json`,`toml`,`lock`];function Rc(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Rc(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Nc,xc),Rc(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Pc,Sc),Rc(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Fc,wc),Rc(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Ic,Cc),Rc(`FILE_ATTACHMENT_EXTENSIONS`,[...Tc],Mc),Rc(`WIKI_EMBED_EXTENSIONS`,[...Mc],Dc);const zc=new Set(Nc),Bc=new Set(Pc),Vc=new Set(Fc),Hc=new Set(Ic),Uc=new Set(Lc);Rc(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Nc,...Pc,...Fc,...Ic,...Lc])],Ac);const Wc=new Set([`base`,`canvas`]),Gc=new Set([`mmd`,`mermaid`]);function Kc(e){let t=e.lastIndexOf(`.`);return t<0?!1:Gc.has(e.slice(t+1).toLowerCase())}const qc=new Set([...Dc,...Wc,...Gc]);function Jc(e){let t=e.toLowerCase().replace(/^\./,``);return zc.has(t)?`image`:Bc.has(t)?`video`:Vc.has(t)?`audio`:Hc.has(t)?`pdf`:Uc.has(t)||Wc.has(t)?`text`:Gc.has(t)?`mermaid`:pc.has(t)?`text`:null}const Yc=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`],Xc=new Set([`ar`,`ur`]);Yc.filter(e=>!Xc.has(e));const Zc=[`off`,`warning`,`error`],Qc=`warning`,$c=[`error`,`warning`];var el=fc();const tl=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],nl={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},rl=/^#[0-9a-fA-F]{6}$/,il=/\P{White_Space}/u;function al(e){return il.test(e)}function ol(e){return typeof e==`string`&&rl.test(e)}function sl(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...ul(t)}}const cl={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},ll=Object.keys(cl);function ul(e){let t={};for(let n of ll)t[`ansi-${dl(n)}`]=e[cl[n]];return t}function dl(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function fl(e){return JSON.stringify(e).replace(/[\u007f-\u009f\u2028\u2029\ufffe\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function pl(e){return`${[`system: "base16"`,`name: ${fl(e.name)}`,...e.author?[`author: ${fl(e.author)}`]:[],`variant: ${fl(e.variant)}`,`palette:`,...tl.map(t=>` ${t}: ${fl(e.palette[t])}`)].join(`
|
|
180
|
+
`)}\n`}function ml(e){let t;try{t=(0,el.parse)(e,{schema:`failsafe`})}catch(e){let t=e?.linePos;return{ok:!1,error:{kind:`unparseable`,line:typeof t?.[0]?.line==`number`?t[0].line:void 0}}}if(!t||typeof t!=`object`||Array.isArray(t))return{ok:!1,error:{kind:`not-a-scheme`}};let n=t,r=n.palette,i=r&&typeof r==`object`&&!Array.isArray(r)?r:n,a={},o=[],s=[];for(let e of tl){let t=i[e]??i[e.toLowerCase()];if(t==null){o.push(e);continue}let n=hl(t);if(!n){s.push(e);continue}a[e]=n}return o.length?{ok:!1,error:{kind:`missing-slots`,slots:o}}:s.length?{ok:!1,error:{kind:`bad-hex`,slots:s}}:typeof n.name==`string`&&!al(n.name)||typeof n.author==`string`&&!al(n.author)?{ok:!1,error:{kind:`not-a-scheme`}}:{ok:!0,scheme:{name:typeof n.name==`string`?n.name:`Imported`,author:typeof n.author==`string`?n.author:void 0,variant:n.variant===`light`||n.variant===`dark`?n.variant:_l(a),palette:a}}}function hl(e){if(typeof e!=`string`)return null;let t=e.trim();return t.startsWith(`#`)||(t=`#${t}`),/^#[0-9a-fA-F]{3}$/.test(t)&&(t=`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`),rl.test(t)?t.toLowerCase():null}function gl(e){let t=ol(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}function _l(e){return gl(e.base00)<gl(e.base05)?`dark`:`light`}const vl={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},yl={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},bl={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1e66f5`,base0E:`#8839ef`,base0F:`#dd7878`}},xl={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},Sl={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},Cl={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#268bd2`,base0E:`#6c71c4`,base0F:`#d33682`}};function wl(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>sl(n)}}function Tl(e,t){return{id:e,label:t,kind:`system`}}const El=[Tl(`default`,`Default`),wl(`dracula`,`Dracula`,vl),wl(`catppuccin-frappe`,`Catppuccin Frappé`,yl),wl(`catppuccin-latte`,`Catppuccin Latte`,bl),wl(`monokai`,`Monokai`,xl),wl(`gruvbox`,`Gruvbox`,Sl),wl(`solarized`,`Solarized`,Cl),Tl(`custom`,`Custom`)],Dl=El.map(e=>e.id),Ol=/^[a-z0-9-]{1,32}$/,kl=/\p{M}+/gu,Al=/['\u2019\u02bc]+/gu,jl=/[^a-z0-9]+/g;function Ml(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function Nl(e){let t=e.trim();if(t.length===0)return{ok:!1,code:`empty`};let n=t.normalize(`NFKD`).replace(kl,``).toLowerCase().replace(Al,``).replace(jl,`-`).replace(/^-+|-+$/g,``),r=Ml(t),i=n.length===0?`theme-${r}`:n.length<=26?n:`${n.slice(0,26-r.length-1).replace(/-+$/g,``)}-${r}`,a=Pl(i);if(!a.ok)throw Error(`Saved theme name derivation produced an invalid id`);return{ok:!0,name:t,stem:i,id:a.id}}function Pl(e){if(e.length===0)return{ok:!1,code:`empty`};let t=`saved-`+e;return Ol.test(t)?{ok:!0,id:t}:{ok:!1,code:/^[a-z0-9-]+$/.test(t)?`too-long`:`invalid-chars`}}function Fl(e){if(!Ol.test(e)||!e.startsWith(`saved-`))return{ok:!1};let t=e.slice(6);return t.length===0?{ok:!1}:{ok:!0,stem:t}}new Map(El.map(e=>[e.id,e]));const Il=Symbol.for(`@inkeep/open-knowledge/field-registry`),Ll=globalThis;Ll[Il]===void 0&&(Ll[Il]=tr());const Q=Ll[Il];function Rl(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=zl(t)?Q.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function zl(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Bl(){return Object.fromEntries(tl.map(e=>[e,L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${nl[e]}, as a #rrggbb hex string.`}).optional()]))}function Vl(){return Dl.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const Hl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Ul=52428800,Wl=26214400,Gl=12582912,Kl=`https://api.openai.com/v1`,ql=`text-embedding-3-small`;function Jl(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function Yl(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&Jl(e)?null:`insecure-scheme`}function Xl(e){let t=e.trim();return t===``?`./`:t}function Zl(e){let t=Xl(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ql=U({content:U({dir:L().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:L().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Zl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:U({theme:W([`light`,`dark`,`system`]).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:W([`system`,...Yc]).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Vl()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Ol,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Vl()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Ol,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(Ol,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:U({name:L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:L().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:W([`dark`,`light`]).register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Bl()}).optional(),preview:U({autoOpen:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:U({showHiddenFiles:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:U({wordWrap:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:U({autoApproveOkTools:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:U({mode:W(Jo).register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:W(Yo).register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:co([B(),W(Jo)]).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:U({enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:U({enabled:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:U({localSink:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:U({maxBytes:z().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Ul)}).default({maxBytes:Ul}),logs:U({maxBytes:z().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Wl)}).default({maxBytes:Wl}),attributeDenylist:V(L()).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...Hl])}).default({enabled:!0,spans:{maxBytes:Ul},logs:{maxBytes:Wl},attributeDenylist:[...Hl]}),skillInstallReports:U({enabled:B().register(Q,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:Ul},logs:{maxBytes:Wl},attributeDenylist:[...Hl]},skillInstallReports:{enabled:!0}}),lossCapture:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:z().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Gl)}).default({enabled:!0,maxBytes:Gl}),bridge:U({backgroundThrottle:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:U({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:U({semantic:U({enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:L().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Kl),model:L().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(ql),dimensions:z().int().positive().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:z().min(0).max(1).register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Kl,model:ql})}).default({semantic:{enabled:!1,baseUrl:Kl,model:ql}}),contentRules:U({markdownlint:H({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:H({enabled:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:V(H({appliesTo:co([L(),V(L())]).optional(),file:L(),enabled:B().optional()})).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]}}),validation:U({links:W(Zc).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Qc),fileTreeIndicators:B().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Qc,fileTreeIndicators:!0}),linkPreviews:U({enabled:B().register(Q,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),remote:U({url:L().register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Public URL your tunnel gives you, e.g. https://myproject.ngrok.app. Used only with `ok start --remote` (config alone never enables remote access); its host is admitted through the Host-header allowlist. There is no server-side auth, so restrict access at the tunnel (ngrok OAuth, Cloudflare Access, Tailscale ACLs)."}).optional(),port:z().int().min(1).max(65535).register(Q,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`TCP port the server binds when remote access is enabled (default 24550). Fixed so the tunnel's port mapping survives restarts. Set it only on a conflict. An explicit --port still wins; the PORT env var is ignored in remote mode.`}).default(24550)}).default({port:24550})});r();const $l=`open-knowledge-config`;async function eu(e,t,r){let a=i.getTracer($l),o=t?{attributes:t}:{};return a.startActiveSpan(e,o,async e=>{try{return await r(e)}catch(t){throw e.recordException(t),e.setStatus({code:n.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function tu(e,t,r){let a=i.getTracer($l),o=t?{attributes:t}:{};return a.startActiveSpan(e,o,e=>{try{return r(e)}catch(t){throw e.recordException(t),e.setStatus({code:n.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function nu(e,t){let n=i.getActiveSpan();n&&n.addEvent(e,t)}function ru(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function iu(e,t){let n=e;for(let e of t){n=ru(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function au(e,t){let n=iu(e,t);if(n!==void 0)return Rl(n)}function ou(e,t){return e===`either`?!0:e===t}function su(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=au(Ql,i);a?.scope!==void 0&&(ou(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function cu(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&((0,el.isCollection)(e.getIn(r,!0))||e.deleteIn(r))}}function lu(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){cu(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}cu(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function uu(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}const du=H({file:L(),line:z().int().min(1),column:z().int().min(1),snippet:L().optional()}),fu=H({path:V(co([L(),z()])),message:L(),issueCode:L(),params:ho(L(),no()).optional(),source:du.optional()}),pu=W([`user`,`project`,`project-local`,`either`]),mu=W([`user`,`project`,`project-local`]),hu=H({code:G(`YAML_PARSE`),detail:L()}),gu=H({code:G(`UNREADABLE`),detail:L()}),_u=H({code:G(`SCHEMA_INVALID`),issues:V(fu)}),vu=H({code:G(`REMOVED_KEY`),path:V(L()),redirect:L(),source:du.optional()}),yu=uo(`code`,[hu,_u,gu,H({code:G(`SCOPE_VIOLATION`),path:V(L()),expectedScope:pu,actualScope:mu}),H({code:G(`NOT_AGENT_SETTABLE`),path:V(L())}),H({code:G(`MIXED_SCOPE`),paths:V(H({path:V(L()),scope:mu}))}),vu,H({code:G(`WRITE_ERROR`),detail:L()}),H({code:G(`OKIGNORE_INVALID`),detail:L(),lineNumber:z().int().min(1).optional()}),H({code:G(`UNKNOWN`),message:L().optional()})]);uo(`code`,[vu,hu,_u,gu]);const bu=H({diagnostics:V(uo(`code`,[H({code:G(`REMOVED_KEY`),scope:mu,file:L(),path:V(L()),redirect:L()}),H({code:G(`YAML_PARSE`),scope:mu,file:L()}),H({code:G(`SCHEMA_INVALID`),scope:mu,file:L()}),H({code:G(`UNREADABLE`),scope:mu,file:L()})]))}),xu=new Set(yu.options.map(e=>e.shape.code.value)),Su=co([yu,U({code:L(),message:L().optional()})]);function Cu(e){return xu.has(e.code)}function wu(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function Tu(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function Eu(e){if(!Cu(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
180
181
|
`))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
|
|
181
|
-
`)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${
|
|
182
|
+
`)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${wu(e.expectedScope)} — ${Tu(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${wu(e.actualScope)}).`,`Move it to ${wu(e.expectedScope)}.`].join(` `);case`NOT_AGENT_SETTABLE`:return[`Setting ${e.path.join(`.`)} is human-only and can't be changed by an agent.`,`Change it in the Settings pane, or edit the config.yml by hand.`].join(` `);case`MIXED_SCOPE`:return[`This change touches settings that live in different config files. Apply them one file at a time:`,e.paths.map(({path:e,scope:t})=>` ${e.join(`.`)} → ${wu(t)} (${t})`).join(`
|
|
182
183
|
`)].join(`
|
|
183
184
|
`);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
|
|
184
185
|
`))n.push(` ${t}`);return n.join(`
|
|
185
|
-
`)}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
|
|
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 Du(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,el.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,el.isNode)(r))return r}return e.contents??null}function Ou(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 ku(e,t,n,r,i){let a=e.split(`
|
|
186
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(`
|
|
187
|
-
`)}function
|
|
188
|
-
//# sourceMappingURL=sleep-
|
|
188
|
+
`)}function Au(e){let t=Du(e.doc,e.path);if(!t)return;let n=t.range;if(!n)return;let[r,,i=r]=n,{line:a,column:o}=Ou(e.source,r),s=(0,el.isCollection)(t)?ku(e.source,r,r+1,a,o):ku(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.",ju=[{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 the --host CLI flag or the HOST environment variable instead.`,$].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 Mu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Nu(e,t){let n=e;for(let e=0;e<t.length-1;e++){if(!Mu(n))return!1;n=n[t[e]]}return Mu(n)?t[t.length-1]in n:!1}function Pu(e){let{value:t,file:n,source:r,doc:i}=e;if(!Mu(t))return[];let a=[];for(let e of ju){if(!Nu(t,e.path))continue;let o;i!=null&&r!=null&&n!=null&&(o=Au({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 Fu(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 Mu(a)&&(i[n]=Fu(a,r)),i}function Iu(e){if(!Mu(e))return e;let t=e;for(let e of ju)Nu(t,e.path)&&(t=Fu(t,e.path));return t}const Lu=`v0`,Ru=`.ok/config.yml`,zu=`local`,Bu=`themes`;function Vu(e){return new Promise(t=>{setTimeout(t,e)})}export{Sc as $,Pl as A,ka as At,_c as B,Ne as Bt,Wl as C,xo as Ct,Jl as D,co as Dt,Yl as E,L as Et,al as F,Cn as Ft,jc as G,s as Gt,vc as H,D as Ht,ml as I,j as It,xc as J,Ec as K,o as Kt,Qc as L,De as Lt,Fl as M,ta as Mt,tl as N,jr as Nt,Zl as O,no as Ot,pl as P,tr as Pt,Oc as Q,$c as R,ke as Rt,ql as S,H as St,Hl as T,ho as Tt,Dc as U,y as Ut,bc as V,Te as Vt,wc as W,O as Wt,qc as X,Ac as Y,kc as Z,nu as _,po as _t,Lu as a,$o as at,Ql as b,U as bt,Iu as c,bo as ct,Su as d,eo as dt,Kc as et,Eu as f,V as ft,su as g,Ya as gt,uu as h,uo as ht,Bu as i,Ko as it,Nl as j,ra as jt,Xl as k,ja as kt,Au as l,W as lt,lu as m,Ho as mt,zu as n,gc as nt,ju as o,es as ot,Cu as p,B as pt,Tc as q,Ru as r,fc as rt,Pu as s,qa as st,Vu as t,Jc as tt,bu as u,Qa as ut,eu as v,Bo as vt,Ul as w,Go as wt,Kl as x,z as xt,tu as y,G as yt,yc as z,je as zt};
|
|
189
|
+
//# sourceMappingURL=sleep-Dj1Ck0gp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Go as e,Is as t,P as n,R as r,Vo as i,Wo as a,_s as o,as as s,d as c,l,ss as u}from"./src-DS92rBYx.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,Ar as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ci as D,Cn as O,Cr as k,Ct as A,D as j,Di as M,Dn as N,Dr as P,Dt as F,E as I,Ei as L,En as R,Er as z,Et as B,F as V,Fi as H,Fn as U,Ft as W,G,Gi as K,Gn as q,Gr as J,Gt as Y,H as X,Hi as Z,Hn as Q,Hr as $,Ht as ee,I as te,Ii as ne,In as re,It as ie,J as ae,Ji as oe,Jn as se,Jr as ce,Jt as le,K as ue,Ki as de,Kn as fe,Kr as pe,Kt as me,L as he,Li as ge,Ln as _e,Lt as ve,M as ye,Mi as be,Mn as xe,Mr as Se,Mt as Ce,N as we,Ni as Te,Nn as Ee,Nt as De,O as Oe,Oi as ke,On as Ae,Or as je,Ot as Me,P as Ne,Pi as Pe,Pn as Fe,Pt as Ie,Q as Le,Qi as Re,Qn as ze,Qr as Be,Qt as Ve,R as He,Ri as Ue,Rn as We,Rr as Ge,Rt as Ke,S as qe,Si as Je,Sn as Ye,Sr as Xe,St as Ze,T as Qe,Ti as $e,Tn as et,Tr as tt,Tt as nt,U as rt,Ui as it,Un as at,Ur as ot,Ut as st,V as ct,Vi as lt,Vn as ut,Vr as dt,Vt as ft,W as pt,Wi as mt,Wn as ht,Wr as gt,Wt as _t,X as vt,Xi as yt,Xn as bt,Xr as xt,Xt as St,Y as Ct,Yi as wt,Yn as Tt,Yr as Et,Yt as Dt,Z as Ot,Zi as kt,Zn as At,Zr as jt,Zt as Mt,_ as Nt,_a as Pt,_i as Ft,_n as It,_r as Lt,_t as Rt,a as zt,aa as Bt,ai as Vt,an as Ht,ar as Ut,at as Wt,b as Gt,ba as Kt,bi as qt,bn as Jt,br as Yt,bt as Xt,c as Zt,ca as Qt,ci as $t,cn as en,cr as tn,d as nn,da as rn,di as an,dn as on,dr as sn,ea as cn,ei as ln,en as un,er as dn,et as fn,f as pn,fa as mn,fi as hn,fn as gn,fr as _n,g as vn,ga as yn,gi as bn,gn as xn,gr as Sn,gt as Cn,h as wn,ha as Tn,hi as En,hn as Dn,hr as On,ht as kn,i as An,ia as jn,ii as Mn,in as Nn,ir as Pn,it as Fn,j as In,ji as Ln,jn as Rn,jr as zn,jt as Bn,k as Vn,ki as Hn,kn as Un,kr as Wn,kt as Gn,l as Kn,la as qn,li as Jn,ln as Yn,lr as Xn,m as Zn,ma as Qn,mi as $n,mn as er,mr as tr,mt as nr,n as rr,na as ir,ni as ar,nn as or,nr as sr,nt as cr,o as lr,oa as ur,oi as dr,on as fr,or as pr,ot as mr,p as hr,pa as gr,pi as _r,pn as vr,pr as yr,q as br,qi as xr,qn as Sr,qr as Cr,qt as wr,r as Tr,ra as Er,ri as Dr,rn as Or,rr as kr,rt as Ar,s as jr,sa as Mr,si as Nr,sn as Pr,sr as Fr,st as Ir,t as Lr,ta as Rr,ti as zr,tn as Br,tr as Vr,tt as Hr,u as Ur,ua as Wr,ui as Gr,un as Kr,ur as qr,v as Jr,va as Yr,vn as Xr,vr as Zr,vt as Qr,w as $r,wi as ei,wn as ti,wr as ni,wt as ri,x as ii,xi as ai,xn as oi,xr as si,xt as ci,y as li,ya as ui,yi as di,yn as fi,yr as pi,yt as mi,z as hi,zi as gi,zn as _i,zr as vi,zt as yi}from"./src-D6v6esDL.mjs";import{C as bi,E as xi,T as Si,_ as Ci,b as wi,c as Ti,d as Ei,g as Di,i as Oi,l as ki,m as Ai,n as ji,p as Mi,s as Ni,t as Pi,u as Fi,v as Ii,w as Li,x as Ri,y as zi}from"./fs-traced-B2GMd7hO.mjs";import{a as Bi,d as Vi,f as Hi,i as Ui,l as Wi,n as Gi,r as Ki,t as qi,u as Ji}from"./logger-DFxEUjvj.mjs";import{C as Yi,S as Xi,_ as Zi,a as Qi,c as $i,d as ea,g as ta,h as na,i as ra,l as ia,m as aa,n as oa,o as sa,p as ca,r as la,s as ua,t as da,u as fa,v as pa,y as ma}from"./server-lock-BOsuOHaz.mjs";export{rn as AGENT_ID_MAX_LEN,mn as AGENT_ID_RE,M as AGENT_WRITE_ORIGIN,Yr as AcpPermissionStore,Tn as AcpRegistry,Je as AcpThreadManager,qt as AgentFocusBroadcaster,di as AgentPresenceBroadcaster,ke as AgentSessionCapacityError,Hn as AgentSessionManager,kn as AutoStartDisabledError,Zr as BUNDLE_IDS,pi as BUNDLE_SCOPE,Yt as BUNDLE_SKILL_NAME,Sr as BacklinkIndex,gi as CC1Broadcaster,u as CC1_CONTRACT_VERSION,Kr as CONFIG_FILENAME,ut as CONFLICT_MARKER_RE,w as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Nt as ConfigSchema,K as DEFAULT_CHECKPOINT_RETENTION,Vt as DEFAULT_EMBEDDINGS_DIMENSIONS,W as DEFAULT_PACK_ID,ct as DocumentDurabilityState,dr as EMBEDDINGS_API_KEY_ENV,yn as FEATURED_AGENT_IDS,de as FILE_SYSTEM_WRITER,q as FILE_WATCHER_ORIGIN,m as FileEmbeddingsBackend,Mt as GIT_PREFLIGHT_FAIL_SPAN_NAME,xr as GIT_UPSTREAM_WRITER,ui as GitDirAccessError,h as GitNotAvailableError,un as GitTooOldError,Cn as HOCUSPOCUS_AUTH_REJECTION_REASONS,Rt as HocuspocusAuthRejection,Qr as HocuspocusAuthTokenSchema,pe as INSTALLED_AGENTS_SCHEMES,s as LINEAGE_EPOCH_KEY,He as LIVE_DERIVED_INDEX_DEBOUNCE_MS,ie as LOG_MD_TEMPLATE,nt as MANAGED_RENAME_ORIGIN,D as MAX_ACP_THREADS,_ as MAX_AGENT_SESSIONS,$e as MCP_CONNECTION_ID_HEADER,i as MCP_SERVER_NAME,Ln as MIN_EVICTABLE_IDLE_MS,Br as MIN_GIT_VERSION,X as MISSING_OK_CONFIG_MESSAGE,Kt as MalformedGitPointerError,fn as McpLogger,rt as MissingOkConfigError,Te as OBSERVER_SYNC_ORIGIN,on as OK_OKIGNORE_TEMPLATE,a as ORPHAN_MODES,t as PROTOCOL_VERSION,qi as PinoLogger,$i as ProcessLockCollisionError,Kn as ProjectGitInitError,B as ROLLBACK_ORIGIN,gn as ROOT_GITIGNORE_TEMPLATE,Zi as RUNTIME_VERSION,fi as RemoteConfigError,oe as SERVICE_WRITER,yr as SKILL_INSTALL_EVENTS_FILE_REL,n as SKILL_STATE_TARGETS,ve as STARTER_FOLDERS,Ke as STARTER_FOLDER_FRONTMATTER_FILENAME,yi as STARTER_PACKS,T as STARTER_PACK_IDS,ft as STARTER_TEMPLATES,Qe as STATE_MANIFEST_FILENAME,pa as STATE_SCHEMA_VERSION,o as SYSTEM_DOC_NAME,wr as SeedPrerequisiteError,le as SeedRootDirError,da as ServerLockCollisionError,Lr as SingleFileNotAFileError,rr as SingleFileNotFoundError,Tr as SingleFileNotMarkdownError,I as StateManifestError,fe as TagIndex,si as USER_GLOBAL_BUNDLE_IDS,Tt as UiLockCollisionError,F as __getShowAllWalkStatsForTesting,Me as __resetShowAllWalkStatsForTesting,ia as acquireProcessLock,oa as acquireServerLock,bt as acquireUiLock,be as applyAgentMarkdownWrite,_i as applyExternalChange,Ie as applySeed,j as assertCompatibleStateManifest,or as assertGitAvailable,N as assertNeverDiskEvent,ai as attachAcpThreadSocket,nr as attachIdleShutdown,Jr as bootServer,dn as buildAndOpenSkill,vr as buildConfigYmlContent,Ct as buildExecResult,ei as buildOkMcpStdioCommand,On as buildSkillZip,ee as buildStarterFolderFrontmatterYaml,wt as buildWipTree,Xe as bundleSkillMdPath,ln as canonicalProjectKey,Ae as classifyEvents,Pi as classifyFsPath,zr as clearAllEmbeddingsKeys,$t as clearContributors,st as coercePackId,l as colorFromSeed,yt as commitUpstreamImport,kt as commitWip,Re as commitWipFromTree,Or as compareSemver,tt as composeEffectiveLinterConfig,z as composeFrontmatterSchemasConfig,Q as containsConflictMarkers,Un as contentHash,Jn as contributorCount,Ne as countShadowObjects,V as countStaleAgentWipRefs,te as countWipRefs,Gn as createApiExtension,ri as createAssetServeMiddleware,G as createCollaborationHost,Ge as createContentFilter,vi as createContentFilterAsync,ar as createEmbeddingsSecretStore,An as createEphemeralProjectDir,C as createExternalChangeHandler,pn as createFileLogger,hi as createLiveDerivedIndexExtension,br as createMcpHttpHandler,Cr as createOsProbe,we as createPersistenceExtension,E as createServer,In as createServerObserverExtension,ne as createStreamingErrorWriter,Gi as createTestLogger,Dr as describeStoredEmbeddingsKey,vn as detectClaudeDesktopPresence,Nn as detectGit,Oe as detectProjectShape,Vr as detectUserSkillHosts,Ar as discoverLockDirs,Wn as discoverMarkdownlintConfig,Ve as emitPreflightFailureSpan,vt as encodeDocName,Ot as encodeFolderRoute,Le as encodeSkillRoute,Ur as ensureProjectGit,er as ensureProjectSkillGitignore,ge as errorResponse,v as evictStaleTrackerEntries,b as extractHeadings,Fn as extractOkBinaryPath,se as extractWikiLinksFromMarkdown,Ht as fallbackPaths,nn as findEnclosingGitRoot,et as findEnclosingProjectRoot,y as findNativeMarkdownlintFile,hr as flushFileLogger,mi as formatAuthRejectionWire,Gr as formatContributors,an as formatContributorsFrom,Ce as formatPackRationale,f as gcCheckpointRefs,Hr as getCurrentMcpLogger,En as getLocalDir,Zn as getLogFilePath,Ki as getLogger,wn as getLogsDir,ma as getMachineId,zi as getMeter,ur as getMetrics,wi as getTracer,Mr as handleCollabSocketError,dt as handleSpawnCursor,Jt as hasForwardingHeaders,he as hasGcLogLatch,c as iconFromClientName,Qt as incrementCollabSocketFilteredError,qn as incrementServerObserverFire,Dn as initContent,cn as initShadowRepo,Ri as initTelemetry,Gt as initToleranceTelemetryWriter,Ir as installPrettyZodErrors,Ui as installTestLoggers,sr as installUserSkill,Xr as isAllowedApiOrigin,O as isAllowedWorkspaceHostHeader,S as isConfigDoc,Xt as isHocuspocusAuthRejectionReason,_t as isKnownPackId,lt as isLinkIndexExcludedDoc,ti as isLoopbackAddress,Z as isManagedArtifactDoc,e as isOrphanMode,Pe as isPairedWriteOrigin,$ as isPathWithinDir,Xi as isProcessAlive,R as isProjectRoot,oi as isRemoteAdmitted,it as isReservedForUserTree,Rn as isSelfWrite,mt as isSystemDoc,ii as isToleranceTelemetryEnabled,Yi as isValidLockPid,xe as lastKnownHash,Rr as listRescueCheckpoints,Y as listStarterPacks,Pt as loadCustomAgents,ye as loadPrincipal,fa as lockBaseUrl,ea as lockFilePath,Bi as loggerFactory,Wi as logsCurrentPath,Ji as logsPreviousPath,Mn as makeLazyEmbeddingsKeyStore,la as markServerLockDraining,pt as mountMcpAndApi,ji as normalizeFsPath,k as originGitHubHost,xn as packageVersionMajorMinor,ci as parseAuthRejectionWire,fr as parseGitVersion,Ze as parseHocuspocusAuthToken,ue as parseKeepaliveConnectionId,Ee as pathToDocName,De as planSeed,zt as prepareSingleFileOpen,Wt as processCommand,mr as processUsage,Pn as readAllTargets,Ut as readBundleDecision,zn as readOwnNativeRules,ca as readProcessLock,aa as readProcessLockDetailed,x as readProjectHeadState,Be as readProjectLocalSemanticConfig,ra as readServerLock,pr as readServerPackageVersion,Fr as readSkillInstallStateSnapshot,Vn as readStateManifest,tn as readTargetRecordedAt,Xn as readTargetVersion,At as readUiLock,at as reconcile,hn as recordContributor,tr as recordSkillInstallEvent,ae as registerAllTools,Fe as registerWrite,na as releaseProcessLock,Qi as releaseServerLock,ze as releaseUiLock,U as removeLastKnownHash,kr as reportSkillInstall,Wr as resetMetrics,r as resolveBundleEnabled,Sn as resolveBundledSkillDir,bn as resolveContentDir,ot as resolveCursorBinaryDefault,gt as resolveCursorSpawnInvocation,P as resolveEffectiveLinterConfig,Nr as resolveEmbeddingsCredential,Ft as resolveLockDir,je as resolveNativeConfigForDoc,Se as resolveNativeMarkdownlintConfig,me as resolvePack,jr as resolvePackageVersion,Ye as resolveRemoteAccess,_n as resolveSkillInstallReportSettings,d as resolveUiInfo,_r as restoreContributors,li as restoreLifecycleFromConflictsJson,xt as rewriteMarkdownLinksForDocumentRename,jt as rewriteWikiLinksForDocumentRename,Pr as runAuthReposSubprocess,en as runAuthStatusSubprocess,Dt as runCloneSubprocess,Yn as runDeviceFlowSubprocess,cr as runWithMcpLogger,Et as safeContentPath,Bn as safeSubdir,ir as safetyCheckpoint,L as sanitizeClientName,Er as saveInMemoryCheckpoint,jn as saveVersion,A as seedBasenameIndex,lr as serializeError,bi as setActiveSpanAttributes,H as setupServerObservers,Bt as shadowGit,Li as shutdownTelemetry,Vi as spansCurrentPath,Hi as spansPreviousPath,J as spawnDetached,ht as splitMarkdownBlocks,re as startWatcher,Ue as streamingProblemEvent,$n as swapContributors,qe as teardownToleranceTelemetryWriter,gr as toBroadcasterKey,Oi as tracedAppendFileSync,Ni as tracedLinkSync,Ti as tracedMkdir,ki as tracedMkdirSync,Fi as tracedRename,Ei as tracedRenameSync,Mi as tracedRmSync,Ai as tracedRmdirSync,Di as tracedUnlinkSync,Ci as tracedWriteFile,Ii as tracedWriteFileSync,$r as trustSystemCertificates,Zt as untrackTrackedProjectSkillProjection,_e as updateLastKnownHash,ta as updateProcessLockPort,sa as updateServerLockPort,p as updateUiLockPort,Qn as validateAgentId,St as validateCloneInputs,Lt as validateSkillZip,ua as waitForServerLockDrain,ce as withHiddenWindowsConsole,Si as withSpan,xi as withSpanSync,qr as writeBundleDecision,ni as writeMarkdownlintRule,It as writeRootGitignoreForNewRepo,g as writeStateManifest,sn as writeTargetVersion,We as writeTracker};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{rt as t}from"./sleep-Dj1Ck0gp.mjs";import{Ms as n,Ns as r,X as i,Z as a}from"./src-DS92rBYx.mjs";import{Jr as o,Tn as s,_i as c,at as l,it as u,ot as d,rt as f}from"./src-D6v6esDL.mjs";import{O as p,P as m}from"./fs-traced-B2GMd7hO.mjs";import{C as h,S as g,d as _,y as v}from"./server-lock-BOsuOHaz.mjs";import{t as y}from"./yazl-DZr4PyKA.mjs";import{m as b,p as x,v as S}from"./write-project-skill-Dpr3DYpv.mjs";import{c as C}from"./colors-BsmVIwfM.mjs";import{n as w}from"./acp-harness-probe-CcFQmgX3.mjs";import{E as T,T as E,_ as ee,o as D,w as O,x as te,y as ne}from"./init-BBQ5oZSu.mjs";import{n as k}from"./constants-B51mAM4l.mjs";import{t as A}from"./is-object-ByG7RnjH.mjs";import"./loader-BIpUYYKt.mjs";import"./skill-teardown-D31Ah_77.mjs";import"./preview-DmCOiYiE.mjs";import{execSync as j,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,join as F,relative as re,resolve as I,sep as ie}from"node:path";import{cpSync as ae,createWriteStream as oe,existsSync as L,lstatSync as se,mkdirSync as R,mkdtempSync as ce,readFileSync as z,readdirSync as B,readlinkSync as le,rmSync as V,statSync as ue,writeFileSync as H}from"node:fs";import{arch as de,freemem as fe,homedir as U,hostname as pe,platform as me,release as he,tmpdir as ge,totalmem as _e,type as ve,uptime as ye}from"node:os";import"node:fs/promises";import{createHash as be}from"node:crypto";var W=t();const xe=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Se(e,t,n=s){if(e!==void 0&&!xe.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ce=null;function we(e){Ce=e}function Te(){return Ce??process.cwd()}function Ee(){return F(U(),`.ok`,`bug-reports`)}function De(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Ee(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Oe(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?be(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function ke(){let e={timestamp:new Date().toISOString(),platform:me(),osType:ve(),osRelease:he(),hostname:`[redacted]`,uptime:ye(),freeMem:fe(),totalMem:_e(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=j(`sw_vers -productVersion 2>/dev/null`,o({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}const Ae=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function G(e){let t=N(e);return Ae.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function je(e,t){return Pe(e,t).files}const Me=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function Ne(e,t=w){let n=F(e,`${t}.ShipIt`);return L(n)?Me.map(e=>F(n,e)).filter(e=>L(e)):[]}function Pe(e,t){if(!L(t))return{files:[],excludedByProjectSlug:0};let n=B(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(G),i=[],a=r.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!G(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Fe(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,i].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ie(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Le(e){if(e.redact){let{redacted:t,patterns:n,lineCount:i}=r(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:i,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function Re(e){for(let t of e.files)try{Le({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function ze(t){let{redact:r,outputPath:i,logger:a}=t,o=t.userLogsDir??F(U(),`.ok`,`logs`),s=t.projectDir?Oe(t.projectDir,a):null;R(P(i),{recursive:!0}),a?.info({projectSlug:s},`gathering diagnostic data`);let c=ke();c.desktop=t.desktop??null;let{files:l,excludedByProjectSlug:u}=Pe(s,o),{files:d}=t.projectDir?Fe(t.projectDir):{files:[]},{files:f}=t.projectDir?Ie(t.projectDir):{files:[]},p=t.shipItLogFiles??[];a?.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;Re({zipfile:_,files:[...l,...p],prefix:`logs`,redact:r,bundleFiles:h,redactions:m,logger:a}),Re({zipfile:_,files:d,prefix:`lockdir`,redact:r,bundleFiles:h,redactions:m,logger:a}),Re({zipfile:_,files:f,prefix:`local-logs`,redact:r,bundleFiles:h,redactions:m,logger:a});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;_.addBuffer(t,n),h.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Le({zipfile:_,name:`note.txt`,content:t.note,redact:r,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/${N(e)}`)),S=h.filter(e=>x.has(e)),C=s?h.filter(e=>e.startsWith(`logs/`)&&!G(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}`),``]:[],...r?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${n.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
2
|
`);_.addBuffer(Buffer.from(w,`utf8`),`README.md`),_.end();let T=oe(i);return _.outputStream.pipe(T),await new Promise((e,t)=>{T.on(`close`,e),T.on(`error`,t)}),a?.info({bundlePath:i,fileCount:h.length,redactionCount:b},`bundle written`),{zipPath:i,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:b,generatedAt:y.generatedAt}}}var Be=e(y(),1),K=e(C(),1);function Ve(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function He(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e,t){if(typeof e==`string`)return Ve(e,t.contentDir);if(Array.isArray(e))return e.map(e=>q(e,t));if(!He(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=q(i,t);return n}function Ue(e,t){let n=z(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)}}}H(e,r?`${a.join(`
|
|
@@ -6,7 +6,7 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{Y as t}from"./sleep-DVOInM4H.mjs
|
|
|
6
6
|
`))}function We(e,t){let n=z(e,`utf-8`);if(n.trim().length!==0)try{let r=q(JSON.parse(n),t),i=n.endsWith(`
|
|
7
7
|
`)?`
|
|
8
8
|
`:``;H(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=Ve(n,t.contentDir);r!==n&&H(e,r)}}function Ge(e,t){let n=z(e,`utf-8`),r=Ve(n,t.contentDir);r!==n&&H(e,r)}function Ke(e){try{return B(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>F(e,t.name))}catch{return[]}}const qe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Je(e){return/\.log\.\d+$/.test(e)}function Ye(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||Je(e)}function Xe(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of Ke(F(e.stagingDir,n)))Ye(r)?Ue(r,t):r.endsWith(`.json`)?We(r,t):Ge(r,t);for(let n of Ke(F(e.stagingDir,`state`))){let e=N(n);n.endsWith(`.jsonl`)?Ue(n,t):qe.has(e)?We(n,t):Ge(n,t)}}const Ze=[`.ok`,`local`,`telemetry`],Qe=[`.ok`,`local`,`logs`],$e=[`.ok`,`local`,`loss-capture`],et=`spans-current.jsonl`,tt=`spans-prev.jsonl`,nt=`server-current.jsonl`,rt=`server-prev.jsonl`,it=`loss-current.jsonl`,at=`loss-prev.jsonl`;function ot(e){return F(e,...Ze,et)}function st(e){return F(e,...Ze,tt)}function ct(e){return F(e,...Qe,nt)}function lt(e){return F(e,...Qe,rt)}function ut(e){return F(e,...$e,it)}function dt(e){return F(e,...$e,at)}const ft=1e3;async function pt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(ft)});return t.ok?await t.text():null}catch{return null}}async function mt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(ft)});return t.ok?await t.text():null}catch{return null}}async function ht(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(ft)});return t.ok?await t.text():null}catch{return null}}function gt(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 _t(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`log`,`--oneline`,`-50`],o({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function vt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],o({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function yt(){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 bt(){return{nodeVersion:process.version,platform:me(),arch:de()}}function xt(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function St(e){if(!L(e))return{};let t;try{t=(0,W.parse)(z(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function Ct(e){return typeof e==`boolean`?e:void 0}function wt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return wt(e.maxBytes)}function Tt(e){let t=St(p(`project`,e)),n=St(p(`project-local`,e));return{enabled:Ct(n.enabled)??Ct(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Et(e){return be(`sha256`).update(e).digest(`hex`)}function Dt(e){let t=z(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Ot(e){let t=z(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X(e,t){if(!L(e))return!1;try{return R(P(t),{recursive:!0}),ae(e,t),!0}catch{return!1}}function kt(e){let t=[],n=e=>{let r=B(e,{withFileTypes:!0});for(let i of r){let r=F(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const At=new Set([`.jsonl`]);function jt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:At.has(e.slice(t))}const Mt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Nt(e){if(Je(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Mt.has(e.slice(t))}function Pt(e){let t=[];for(let
|
|
9
|
+
`)}\n`:null}catch{return null}}function _t(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`log`,`--oneline`,`-50`],o({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function vt(e){let t=F(e,`.git`,`ok`);if(!L(t))return null;let n=M(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],o({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function yt(){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 bt(){return{nodeVersion:process.version,platform:me(),arch:de()}}function xt(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function St(e){if(!L(e))return{};let t;try{t=(0,W.parse)(z(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function Ct(e){return typeof e==`boolean`?e:void 0}function wt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return wt(e.maxBytes)}function Tt(e){let t=St(p(`project`,e)),n=St(p(`project-local`,e));return{enabled:Ct(n.enabled)??Ct(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Et(e){return be(`sha256`).update(e).digest(`hex`)}function Dt(e){let t=z(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Ot(e){let t=z(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X(e,t){if(!L(e))return!1;try{return R(P(t),{recursive:!0}),ae(e,t),!0}catch{return!1}}function kt(e){let t=[],n=e=>{let r=B(e,{withFileTypes:!0});for(let i of r){let r=F(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const At=new Set([`.jsonl`]);function jt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:At.has(e.slice(t))}const Mt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Nt(e){if(Je(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Mt.has(e.slice(t))}function Pt(e){let t=[];for(let n of kt(e)){let i=Ft(e,n);if(!Nt(i))continue;let{redacted:a,patterns:o,lineCount:s}=r(z(n,`utf-8`));o.length!==0&&(H(n,a),t.push({file:i,lineCount:s,patterns:o}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Ft(e,t){return re(e,t).split(ie).join(`/`)}async function It(e){let t=I(e.contentDir),n=I(e.projectDir??e.contentDir),r=e.deps??{},o=r.fetchAgentPresence??pt,s=r.fetchAgentEffects??mt,c=r.fetchWatcherRecent??ht,l=r.readShadowHead??_t,u=r.readCheckpointRefs??vt,d=r.now??(()=>new Date),f=r.okVersion??(()=>k),p=r.readDesktopEnv??yt,m=r.readRuntime??bt,h=r.isOtlpPushEnabled??xt,g=ce(F(ge(),`ok-bundle-`));try{R(F(g,`telemetry`),{recursive:!0}),R(F(g,`logs`),{recursive:!0}),R(F(g,`state`),{recursive:!0}),X(ot(n),F(g,`telemetry`,et)),X(st(n),F(g,`telemetry`,tt)),X(ct(n),F(g,`logs`,nt)),X(lt(n),F(g,`logs`,rt));for(let t of e.userLogFiles??[])X(t,F(g,`logs`,N(t)));let _=F(n,`.ok`,`local`),v=F(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(L(v)){X(v,F(g,`state`,`server.lock`));try{let e=z(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await o(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(H(F(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await s(x);t!==null&&H(F(g,`state`,`agent-effects.json`),t);let n=await c(x);if(n!==null){let e=gt(n);e!==null&&H(F(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(t);S!==null&&H(F(g,`state`,`shadow-head.txt`),S);let C=u(t);C!==null&&H(F(g,`state`,`checkpoint-refs.txt`),C),X(ut(n),F(g,`state`,it)),X(dt(n),F(g,`state`,at)),X(F(_,`last-spawn-error.log`),F(g,`state`,`last-spawn-error.log`)),X(F(_,a),F(g,`state`,a)),X(F(_,i),F(g,`state`,i));let w=m(),T=p(),E={ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T}};H(F(g,`state`,`runtime.json`),`${JSON.stringify(E,null,2)}\n`);let ee=y===`running`?`running
|
|
10
10
|
`:`not-running (${b})\n`;if(H(F(g,`state`,`server-status.txt`),ee),e.processDir&&L(e.processDir)){let t=F(g,`process`);R(t,{recursive:!0}),ae(e.processDir,t,{recursive:!0})}let D=e.redact===!0;D&&Xe({stagingDir:g,contentDir:t}),e.note&&H(F(g,`note.txt`),e.note);let O=null;e.scrubSecrets===!0&&(O=Pt(g));for(let t of e.extraFiles??[])X(t.sourcePath,F(g,`extra`,t.zipName??N(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let te=Tt(n),ne=kt(g),k=[],A=0,j=0;for(let e of ne){let t=Ft(g,e),n=ue(e).size,r=jt(t)?Dt(e):0;k.push({path:t,bytes:n,lines:r}),A+=n,t.startsWith(`telemetry/`)&&jt(t)&&(j+=Ot(e))}let M={applied:D};O!==null&&(M.secretScrub=O);let P={schemaVersion:2,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T},contentDir:{pathSha256:Et(t),absolutePath:D?`<CONTENT_DIR>`:t},telemetry:{localSink:te,otlpPushEnabled:h()},redaction:M,serverStatus:y,files:k};H(F(g,`manifest.json`),`${JSON.stringify(P,null,2)}\n`);let re=ne.some(e=>{try{return z(e,`utf-8`).includes(t)}catch{return!1}}),I={totalBytes:A,fileCount:k.length,docNameCount:j,contentDirVisible:re,redacted:D},ie=!1;return{stagingDir:g,manifest:P,summary:I,cleanup:()=>{ie||(ie=!0,V(g,{recursive:!0,force:!0}))}}}catch(e){throw V(g,{recursive:!0,force:!0}),e}}async function Lt(e){let{collected:t,outputPath:n}=e,r=P(n);if(!L(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Be.ZipFile,a=kt(t.stagingDir);for(let e of a){let n=Ft(t.stagingDir,e);i.addFile(e,n)}i.end();let o=oe(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 Rt(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let t=(0,W.parse)(z(n,`utf-8`)),r=A(t)?t.content:void 0,i=A(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return I(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return I(e)}async function zt(e,t,n){let r=Oe(t,e.logger),i=await It({contentDir:Rt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...je(r,e.userLogsDir??F(U(),`.ok`,`logs`)),...Ne(e.cachesDir??F(U(),`Library`,`Caches`))],deps:{readDesktopEnv:n,logger:e.logger}});try{R(P(e.outputPath),{recursive:!0}),await Lt({collected:i,outputPath:e.outputPath});let t=i.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:r,files:i.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:i.manifest.createdAt}}}finally{i.cleanup()}}async function Bt(e){let{projectDir:t}=e,n=e.readDesktopEnv??yt;if(e.level===`full`&&t!==void 0)return zt(e,t,n);let{zipPath:r,summary:i}=await ze({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:Ne(e.cachesDir??F(U(),`Library`,`Caches`)),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n()});return{zipPath:r,summary:{level:e.level,systemWide:t===void 0,projectSlug:i.projectSlug,files:i.files,redactions:i.redactions,redactedLineCount:i.redactedLineCount,generatedAt:i.generatedAt}}}function Z(e,t,n={}){let r=_(e,t);if(!L(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(z(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!h(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??g)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??v())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??pe();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Vt(e){return e.replace(/:\d+$/,``)}function Ht(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Vt(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Vt(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Vt(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 Ut=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Wt(e){return F(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Gt={existsSync:e=>L(e),readFileSync:(e,t)=>z(e,t),lstatSync:e=>se(e),readlinkSync:e=>le(e)};function Kt(e,t=Gt){let n=Wt(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 qt(e){let t=e.replace(Ut,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Jt(e,t,n=Gt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function Yt(e){return x(e)||b(e)||te(e)}const Xt=10*1024*1024;function Zt(e,t,n,r){let i=D(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(!Yt(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`?(V(a,{force:!0}),{kind:`removed`}):e.format===`toml`?en(a,o):e.format===`yaml`?$t(a,e.topLevelKey,o):Qt(a,e.topLevelKey,e.serverMapSubKey,o)}function Qt(e,t,n,r){let i;try{i=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>Xt)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=T(i,ee(t,n,r));return o?(m(e,a,{mode:O(e)}),{kind:`removed`}):{kind:`not-present`}}function $t(e,t,n){let r;try{r=z(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>Xt)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,W.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=E(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,`
|
|
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{Y as t}from"./sleep-DVOInM4H.mjs
|
|
|
17
17
|
`).replace(/\n/g,`\r
|
|
18
18
|
`));let u=`${i?``:``}${l}`;return u!==r&&m(e,u,{mode:O(e)}),{kind:`removed`}}function tn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function nn(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 rn(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:u(r),command:r,isDesktop:tn(r)}}function an(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`&&an(e)?`ui-orphan`:`stale`}const on=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function sn(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 cn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function ln(e){return`${cn(e.server.usage)} | ${cn(e.ui?.usage??null)}`}function un(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function dn(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,un(e),ln(e),t,String(n),nn(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=sn(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
19
|
`)}async function fn(e={}){let t=e.discover??f,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??l,a=e.resolveUsage??d,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=rn(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(dn(e.all?s:s.filter(e=>on.has(Q(e)))))}function pn(){return new S(`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 fn({all:t.all===!0||e===`all`,json:t.json===!0})})}function mn(e,t,n={}){let r=n.isAlive??g,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 hn(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=mn(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 gn(e,t=g){let n=await f(),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 _n(e){let t=hn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function vn(e){return new S(`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=hn({lockDir:c(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 fn({});return}if(n===`all`){let e=await f();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,g)&&!$(r,g)||(_n(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 gn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}_n(t);return}_n(c(I(Te(),n)))})}export{Te as _,Ut as a,Kt as c,Z as d,Bt as f,Ee as g,De as h,Zt as i,qt as l,Lt as m,vn as n,Jt as o,It as p,pn as r,Wt as s,hn as t,Ht as u,we as v,Se as y};
|
|
20
|
-
//# sourceMappingURL=src-
|
|
20
|
+
//# sourceMappingURL=src-BvzFYC4G.mjs.map
|