@inkeep/open-knowledge 0.56.0 → 0.57.0
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-CW_nXSWP.mjs → acp-harness-probe-BjVzId3b.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/config-schema.json +2 -1
- package/dist/config.user.schema.json +2 -1
- package/dist/constants-Cqj0SNOo.mjs +2 -0
- package/dist/fs-traced-BEuPZxxL.mjs +1 -0
- package/dist/{fs-traced-uUie5siN.mjs → fs-traced-xJfl5Rxd.mjs} +2 -2
- package/dist/{git-handle-BI3zkVk-.mjs → git-handle-B0tCzHAN.mjs} +2 -2
- package/dist/git-handle-DQRBUWfE.mjs +1 -0
- package/dist/index.d.mts +19 -18
- package/dist/index.mjs +2 -2
- package/dist/init-DJASX2p8.mjs +1 -0
- package/dist/{init--f4zFUMB.mjs → init-NUPb6gHO.mjs} +3 -3
- package/dist/{launch-json-removal-CfLRLAib.mjs → launch-json-removal-BZFnjRR8.mjs} +2 -2
- package/dist/{loader-B4KkmTuM.mjs → loader-DG4WWofW.mjs} +2 -2
- package/dist/loader-DH2qFFXE.mjs +1 -0
- package/dist/md-manager-IForifhX.mjs +2 -0
- package/dist/{open-browser-CvutfNRO.mjs → open-browser-CXZADc20.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-BbBZEvyk.mjs → preview-DsEL6XB0.mjs} +2 -2
- package/dist/preview-L8PxEh_R.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-CuxM2GI1.js → ActivityModeContent-U1FJ3QIy.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-CAsMvyqx.js → AgentDiffPane-CHkouQJB.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-FSBCMKY3.js → AgentThreadClientBinder-ChxqWHn_.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Cw0ePGRQ.js → CodeMirrorPropInput-CBdNV6SE.js} +1 -1
- package/dist/public/assets/{DocumentContext-BOGc7fjB.js → DocumentContext-CmVCZjAv.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-DDFDVZ-W.js → EditorModeToggle-CoLPtq1t.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-rACItPww.js → EnableSyncConfirmDialog-CFRlwXGj.js} +1 -1
- package/dist/public/assets/FeedbackForm-DN6bfc_e.js +1 -0
- package/dist/public/assets/{GraphPanel--hj263vb.js → GraphPanel-COPEU9QX.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-Dip726xX.js → ImportSkillDialog-SdjDKtJN.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-mJ7Vq7Gu.js → LintConfigEditor-BDyWMcfJ.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-IThNpL1R.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-CM_NiJGd.js → ManagedArtifactProperties-TjF4BQQf.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-BAZN_O20.js → McpConsentDialogBody-CVb-mMB8.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-B1RjPntQ.js → MermaidDocEditor-BhQaXQjB.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BUTotMt7.js → PropertyDisplayRow-B3TVSycQ.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-CBkRZUpU.js → ReportBugDialogBody-Ajl3p6In.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DlZiHNGy.js → SchemaConfigEditor-BQjnFuKU.js} +1 -1
- package/dist/public/assets/{SessionsHost-Dmk8ARcn.js → SessionsHost-D0b_fHz9.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-DboXXu3o.js → SettingsDialogBody-BVL7tByV.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-BNq_3Gef.js → ShareBranchSwitchDialog-oqH7CVAK.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-B5FddHIB.js → ShareReceiveDialog-qvhiGzxM.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DJsrMn_9.js → ShareReceiveMissDialog-DdivT93v.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-BW2VDVIo.js → SkillEditBanner-C2NwXGwp.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-CxQT1ld3.js → SkillInstallMenu-DG2UypgE.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-DUXTbZ1I.js → SkillOriginInline-Bfr_LvLW.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DZaJ1ZyP.js → SkillToolbarControls-BfQkA4sf.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-DNGBygyg.js → SlidesToolbarControls-Cib12Sqv.js} +1 -1
- package/dist/public/assets/{SourceEditor-HnDtiE3q.js → SourceEditor-Dbik8eCt.js} +1 -1
- package/dist/public/assets/{TerminalPanel-18X_ZMlO.js → TerminalPanel-CyjfYWsq.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-B6mvY0PM.js → TerminalWindowApp-CcYZi-zD.js} +1 -1
- package/dist/public/assets/{TextDocEditor-BpXrF4Sq.js → TextDocEditor-DRMRlxJq.js} +1 -1
- package/dist/public/assets/{ThreadView-CuvPDOR2.js → ThreadView-jlS0ehwV.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-BEO6_jvM.js → TimelineDiffPane-BvbIPNLH.js} +1 -1
- package/dist/public/assets/{agent-diff-store-DuZJJ7Ci.js → agent-diff-store-CbfY0VSo.js} +1 -1
- package/dist/public/assets/{auth-state-cache-CHAm12x1.js → auth-state-cache-C6rYX6hP.js} +1 -1
- package/dist/public/assets/client-version-CvdpPTtb.js +1 -0
- package/dist/public/assets/{comment-chips-0OZCB2iB.js → comment-chips-8I53Qmd9.js} +1 -1
- package/dist/public/assets/{config-provider-Cgwz6Lof.js → config-provider-DE1EpoHY.js} +2 -2
- package/dist/public/assets/{dist-A3OTH2KL2.js → dist-COv61_fZ2.js} +2 -2
- package/dist/public/assets/{doc-paths-BABCQ0wh.js → doc-paths-7BigDJzU.js} +1 -1
- package/dist/public/assets/{documents-events-CK6j9M45.js → documents-events-BG9v7ZR8.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-DcrKUDBN.js → file-tree-adapter-BaT9ZAI6.js} +1 -1
- package/dist/public/assets/{file-tree-utils-CJ-q2ioX.js → file-tree-utils-BnMWB0rN.js} +1 -1
- package/dist/public/assets/{folder-config-api-CjDyND9I.js → folder-config-api-CspTyRPC.js} +1 -1
- package/dist/public/assets/{follow-file-DAdcgwn_.js → follow-file-CTh6w0Fk.js} +1 -1
- package/dist/public/assets/i18n-C-GzCn3p.js +1 -0
- package/dist/public/assets/{index-aXt_JWZ2.js → index-C0lgUj3_.js} +7 -7
- package/dist/public/assets/{lint-config-client-Ci5UGAFH.js → lint-config-client-D4Gin48u.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-6w4wGoBF.js → markdownlint-rule-browser-qdlEJqGK.js} +1 -1
- package/dist/public/assets/messages-CuB-3U4F.js +1 -0
- package/dist/public/assets/{navigation-targets-Cq8reTNr.js → navigation-targets-BlmF0SDc.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-WbPC9lqJ.js → open-managed-artifact-tab-DyQLDLZu.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-DWYln4pm.js → pending-receive-nav-store-hMEGGslQ.js} +1 -1
- package/dist/public/assets/{prop-types-JZyx8uP_.js → prop-types-x3L5Ba9q.js} +1 -1
- package/dist/public/assets/{receive-store-Bq6Ld9zP.js → receive-store-DyKO2VJp.js} +1 -1
- package/dist/public/assets/{selection-context-h9OrguDp.js → selection-context-B5-XIY2b.js} +1 -1
- package/dist/public/assets/{skill-actions-P6hLIq0o.js → skill-actions-D_LBQ9Ds.js} +1 -1
- package/dist/public/assets/{skill-scope-CbkpErsk.js → skill-scope-Dvl0F_Nc.js} +1 -1
- package/dist/public/assets/{skills-api-C_ayTuhp.js → skills-api-D3yktqw_.js} +1 -1
- package/dist/public/assets/{src-BdAe1iLc.js → src-CI7Rk9PO.js} +1 -1
- package/dist/public/assets/{tag-pill-input-Bl7OJSC_.js → tag-pill-input-B-KJK7ye.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BBy6G0-P.js → target-navigation-intent-Cq4g4MwT.js} +1 -1
- package/dist/public/assets/{telemetry-impl-BXKSOWP8.js → telemetry-impl-DRTdire4.js} +2 -2
- package/dist/public/assets/{telemetry-startup-BbS8KkvZ.js → telemetry-startup-DWe6KY2T.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-_UKgGxrA.js → terminal-cli-display-CpAOcb2j.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-gIAwvS38.js → terminal-launch-events-mKO9oOVx.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-BoIx62eZ.js → terminal-telemetry-hqCajE8l.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-ClR2eDHr.js → typing-burst-detector-B73zIKbr.js} +1 -1
- package/dist/public/assets/{uninstall-CKF78F-5.js → uninstall-DQiMrABF.js} +1 -1
- package/dist/public/assets/{use-activity-panel-yqtV5LnI.js → use-activity-panel-IvNsnSV8.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-BIhgV6Ch.js → use-apply-config-color-theme-B1zL7AB7.js} +1 -1
- package/dist/public/assets/{use-collab-url-Cp-Rj0bC.js → use-collab-url-CBEaRBLp.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-BT8isURw.js → use-live-xterm-theme-Bg0pl-eA.js} +1 -1
- package/dist/public/assets/{use-open-skill-D96TChRC.js → use-open-skill-CAdcxfnz.js} +1 -1
- package/dist/public/assets/{use-popular-skills-BvPp-gxD.js → use-popular-skills-DyxaSas-.js} +1 -1
- package/dist/public/assets/{use-settings-route-BNd_oo0M.js → use-settings-route-CQWgqLVD.js} +1 -1
- package/dist/public/assets/{use-skill-origin-BenKziPn.js → use-skill-origin-DschKPDB.js} +1 -1
- package/dist/public/assets/{use-skills-bayaEv_Y.js → use-skills-RGrgR7Ae.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CX-aqvuQ.js → use-terminal-enabled-DRFMuFx0.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-BbNfyqQd.js → use-timeline-entry-diff-Cndr8_xa.js} +1 -1
- package/dist/public/assets/{use-workspace-tdp7vU_c.js → use-workspace-CTox7-Ea.js} +1 -1
- package/dist/public/index.html +45 -45
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-Z9hZ2Ecf.mjs → repair-launch-json-ClbP0ADR.mjs} +2 -2
- package/dist/{repair-mcp-configs-BFWH-O-X.mjs → repair-mcp-configs-nTBjJ02w.mjs} +2 -2
- package/dist/{repair-skills-GEvrJzaq.mjs → repair-skills-B1yLGVCl.mjs} +2 -2
- package/dist/repair-skills-nLLLv3za.mjs +1 -0
- package/dist/schemas/v0/config.user.schema.json +2 -1
- package/dist/{server-lock-C-cXu0qQ.mjs → server-lock-BHY1C3dW.mjs} +2 -2
- package/dist/server-lock-CXt9yQWS.mjs +1 -0
- package/dist/{skill-teardown-D1piAzOB.mjs → skill-teardown-CJl8M28h.mjs} +2 -2
- package/dist/{sleep-OHCt3UoV.mjs → sleep-D_nNc7T_.mjs} +2 -2
- package/dist/{src-DHp3eXPs.mjs → src--C17TQmO.mjs} +1 -1
- package/dist/{src-Dhqa-DT-.mjs → src-C6s1YGEs.mjs} +6 -6
- package/dist/{src-BljoChXq.mjs → src-Cf7CX_wY.mjs} +2 -2
- package/dist/{src-DQgEWrUq.mjs → src-DMi2O7yV.mjs} +2 -2
- package/dist/src-uwF6km_J.mjs +1 -0
- package/dist/start-DEi99-nO.mjs +1 -0
- package/dist/{start-Byz-i73C.mjs → start-DaNS3_L5.mjs} +4 -4
- package/dist/{ui-vKry5mIJ.mjs → ui-CSid4Ybi.mjs} +3 -3
- package/dist/{write-project-skill-BfsBXTaY.mjs → write-project-skill-G2p_hc1u.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-C0QuALA7.mjs +0 -2
- package/dist/fs-traced-DN8Ne6OV.mjs +0 -1
- package/dist/git-handle-Bo4ytezq.mjs +0 -1
- package/dist/init-yZIwxM4j.mjs +0 -1
- package/dist/loader-fKOwJB6S.mjs +0 -1
- package/dist/md-manager-Q1tI0hzy.mjs +0 -2
- package/dist/preview-ssmwZAWL.mjs +0 -1
- package/dist/public/assets/FeedbackForm-Cg1ck408.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-DChOnvya.js +0 -1
- package/dist/public/assets/client-version-xTNgCY5Y.js +0 -1
- package/dist/public/assets/i18n-BYT2p-2f.js +0 -1
- package/dist/repair-skills-dpqiLSBb.mjs +0 -1
- package/dist/server-lock-BJIPnZ6Y.mjs +0 -1
- package/dist/src-BtcwR3z-.mjs +0 -1
- package/dist/start-wRJOuq9q.mjs +0 -1
- /package/dist/public/assets/{__vite-browser-external-DD8Jl_VU.js → __vite-browser-external-N4Ia604h.js} +0 -0
- /package/dist/public/assets/{messages-CzCSQgXH.js → messages-BNVZJyDD.js} +0 -0
- /package/dist/public/assets/{messages-B0JNOJmY.js → messages-DDp8k2cy.js} +0 -0
- /package/dist/public/assets/{messages-pZwFjfzt.js → messages-DmcPLWJb.js} +0 -0
- /package/dist/public/assets/{messages--jxWd8S9.js → messages-DwQQdLmE.js} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -4069,6 +4069,7 @@ declare const ConfigSchema: ZodObject<{
|
|
|
4069
4069
|
"pt-BR": "pt-BR";
|
|
4070
4070
|
id: "id";
|
|
4071
4071
|
ur: "ur";
|
|
4072
|
+
ko: "ko";
|
|
4072
4073
|
}>>;
|
|
4073
4074
|
colorThemeLight: ZodOptional<ZodString>;
|
|
4074
4075
|
colorThemeDark: ZodOptional<ZodString>;
|
|
@@ -9493,6 +9494,23 @@ declare module '@tiptap/core' {
|
|
|
9493
9494
|
* special-case in the mdxJsxTextElement handler.
|
|
9494
9495
|
*/
|
|
9495
9496
|
//#endregion
|
|
9497
|
+
//#region ../../node_modules/.pnpm/@tiptap+extension-horizontal-rule@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4__@tiptap+pm@3.22.4/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
|
|
9498
|
+
declare module '@tiptap/core' {
|
|
9499
|
+
interface Commands<ReturnType> {
|
|
9500
|
+
horizontalRule: {
|
|
9501
|
+
/**
|
|
9502
|
+
* Add a horizontal rule
|
|
9503
|
+
* @example editor.commands.setHorizontalRule()
|
|
9504
|
+
*/
|
|
9505
|
+
setHorizontalRule: () => ReturnType;
|
|
9506
|
+
};
|
|
9507
|
+
}
|
|
9508
|
+
}
|
|
9509
|
+
/**
|
|
9510
|
+
* This extension allows you to insert horizontal rules.
|
|
9511
|
+
* @see https://www.tiptap.dev/api/nodes/horizontal-rule
|
|
9512
|
+
*/
|
|
9513
|
+
//#endregion
|
|
9496
9514
|
//#region ../../node_modules/.pnpm/@tiptap+extension-blockquote@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4_/node_modules/@tiptap/extension-blockquote/dist/index.d.ts
|
|
9497
9515
|
declare module '@tiptap/core' {
|
|
9498
9516
|
interface Commands<ReturnType> {
|
|
@@ -9516,23 +9534,6 @@ declare module '@tiptap/core' {
|
|
|
9516
9534
|
* Matches a blockquote to a `>` as input.
|
|
9517
9535
|
*/
|
|
9518
9536
|
//#endregion
|
|
9519
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-horizontal-rule@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4__@tiptap+pm@3.22.4/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
|
|
9520
|
-
declare module '@tiptap/core' {
|
|
9521
|
-
interface Commands<ReturnType> {
|
|
9522
|
-
horizontalRule: {
|
|
9523
|
-
/**
|
|
9524
|
-
* Add a horizontal rule
|
|
9525
|
-
* @example editor.commands.setHorizontalRule()
|
|
9526
|
-
*/
|
|
9527
|
-
setHorizontalRule: () => ReturnType;
|
|
9528
|
-
};
|
|
9529
|
-
}
|
|
9530
|
-
}
|
|
9531
|
-
/**
|
|
9532
|
-
* This extension allows you to insert horizontal rules.
|
|
9533
|
-
* @see https://www.tiptap.dev/api/nodes/horizontal-rule
|
|
9534
|
-
*/
|
|
9535
|
-
//#endregion
|
|
9536
9537
|
//#region ../../node_modules/.pnpm/@tiptap+extension-code@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4_/node_modules/@tiptap/extension-code/dist/index.d.ts
|
|
9537
9538
|
declare module '@tiptap/core' {
|
|
9538
9539
|
interface Commands<ReturnType> {
|
|
@@ -9970,7 +9971,7 @@ declare module '@tiptap/core' {
|
|
|
9970
9971
|
* `zod`, other browser-safe core modules, and platform-neutral globals. No
|
|
9971
9972
|
* `node:` builtins, no `process.env` — the renderer bundles it.
|
|
9972
9973
|
*/
|
|
9973
|
-
declare const SUPPORTED_LOCALES: readonly ["en", "zh-Hans", "zh-Hant", "hi", "es", "ar", "fr", "bn", "pt-BR", "id", "ur"];
|
|
9974
|
+
declare const SUPPORTED_LOCALES: readonly ["en", "zh-Hans", "zh-Hant", "hi", "es", "ar", "fr", "bn", "pt-BR", "id", "ur", "ko"];
|
|
9974
9975
|
type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];
|
|
9975
9976
|
/**
|
|
9976
9977
|
* What the language preference holds: an enumerated locale, or the sentinel
|
package/dist/index.mjs
CHANGED
|
@@ -178,7 +178,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
178
178
|
|
|
179
179
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Zi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ea(t,`input`,e.processors),output:ea(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Qi(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Qi(r.element,n);if(r.type===`set`)return Qi(r.valueType,n);if(r.type===`lazy`)return Qi(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Qi(r.innerType,n);if(r.type===`intersection`)return Qi(r.left,n)||Qi(r.right,n);if(r.type===`record`||r.type===`map`)return Qi(r.keyType,n)||Qi(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Qi(r.in,n)||Qi(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Qi(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Qi(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Qi(e,n))return!0;return!!(r.rest&&Qi(r.rest,n))}return!1}const $i=(e,t={})=>n=>{let r=Ji({...n,processors:t});return Yi(e,r),Xi(r,e),Zi(r,e)},ea=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ji({...i??{},target:a,io:t,processors:n});return Yi(e,o),Xi(o,e),Zi(o,e)},ta={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},na=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ta[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Jte=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Yte=(e,t,n,r)=>{n.type=`boolean`},Xte=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Zte=(e,t,n,r)=>{n.not={}},Qte=(e,t,n,r)=>{let i=e._zod.def,a=on(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},$te=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},ene=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},tne=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},nne=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Yi(a.element,t,{...r,path:[...r.path,`items`]})},rne=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Yi(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Yi(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ine=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Yi(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ane=(e,t,n,r)=>{let i=e._zod.def,a=Yi(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Yi(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},one=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Yi(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Yi(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Yi(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},sne=(e,t,n,r)=>{let i=e._zod.def,a=Yi(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},cne=(e,t,n,r)=>{let i=e._zod.def;Yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lne=(e,t,n,r)=>{let i=e._zod.def;Yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},une=(e,t,n,r)=>{let i=e._zod.def;Yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},dne=(e,t,n,r)=>{let i=e._zod.def;Yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},fne=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Yi(o,t,r);let s=t.seen.get(e);s.ref=o},pne=(e,t,n,r)=>{let i=e._zod.def;Yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ra=(e,t,n,r)=>{let i=e._zod.def;Yi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},mne=(e,t,n,r)=>{let i=e._zod.innerType;Yi(i,t,r);let a=t.seen.get(e);a.ref=i},hne=P(`ZodISODateTime`,(e,t)=>{zee.init(e,t),_a.init(e,t)});function ia(e){return _i(hne,e)}const gne=P(`ZodISODate`,(e,t)=>{Bee.init(e,t),_a.init(e,t)});function _ne(e){return Wte(gne,e)}const vne=P(`ZodISOTime`,(e,t)=>{Vee.init(e,t),_a.init(e,t)});function yne(e){return Gte(vne,e)}const bne=P(`ZodISODuration`,(e,t)=>{Hee.init(e,t),_a.init(e,t)});function xne(e){return vi(bne,e)}const aa=P(`ZodError`,(e,t)=>{Mn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Dee(e,t)},flatten:{value:t=>Eee(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,sn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,sn,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Sne=Pn(aa),Cne=Fn(aa),wne=In(aa),Tne=Rn(aa),Ene=Bn(aa),Dne=Vn(aa),oa=Hn(aa),sa=Un(aa),ca=Wn(aa),la=Gn(aa),ua=Kn(aa),da=qn(aa),fa=new WeakMap;function pa(e,t,n){let r=Object.getPrototypeOf(e),i=fa.get(r);if(i||(i=new Set,fa.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const ma=P(`ZodType`,(e,t)=>(Wr.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ea(e,`input`),output:ea(e,`output`)}}),e.toJSONSchema=$i(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>Sne(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>wne(e,t,n),e.parseAsync=async(t,n)=>Cne(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Tne(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ene(e,t,n),e.decode=(t,n)=>Dne(e,t,n),e.encodeAsync=async(t,n)=>oa(e,t,n),e.decodeAsync=async(t,n)=>sa(e,t,n),e.safeEncode=(t,n)=>ca(e,t,n),e.safeDecode=(t,n)=>la(e,t,n),e.safeEncodeAsync=async(t,n)=>ua(e,t,n),e.safeDecodeAsync=async(t,n)=>da(e,t,n),pa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(hn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Cn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Wne(e,t))},superRefine(e,t){return this.check(Gne(e,t))},overwrite(e){return this.check(Li(e))},optional(){return so(this)},exactOptional(){return jne(this)},nullable(){return co(this)},nullish(){return so(co(this))},nonoptional(e){return Lne(this,e)},array(){return z(this)},or(e){return Qa([this,e])},and(e){return no(this,e)},transform(e){return fo(this,ao(e))},default(e){return Pne(this,e)},prefault(e){return Ine(this,e)},catch(e){return zne(this,e)},pipe(e){return fo(this,e)},readonly(){return Hne(this)},describe(e){let t=this.clone();return pi.add(t,{description:e}),t},meta(...e){if(e.length===0)return pi.get(this);let t=this.clone();return pi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return pi.get(e)?.description},configurable:!0}),e)),ha=P(`_ZodString`,(e,t)=>{Gr.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,pa(e,`_ZodString`,{regex(...e){return this.check(Kte(...e))},includes(...e){return this.check(Pi(...e))},startsWith(...e){return this.check(Fi(...e))},endsWith(...e){return this.check(Ii(...e))},min(...e){return this.check(ji(...e))},max(...e){return this.check(Ai(...e))},length(...e){return this.check(Mi(...e))},nonempty(...e){return this.check(ji(1,...e))},lowercase(e){return this.check(qte(e))},uppercase(e){return this.check(Ni(e))},trim(){return this.check(zi())},normalize(...e){return this.check(Ri(...e))},toLowerCase(){return this.check(Bi())},toUpperCase(){return this.check(Vi())},slugify(){return this.check(Hi())}})}),ga=P(`ZodString`,(e,t)=>{Gr.init(e,t),ha.init(e,t),e.email=t=>e.check(Tte(va,t)),e.url=t=>e.check(gi(Sa,t)),e.jwt=t=>e.check(Ute(Ra,t)),e.emoji=t=>e.check(kte(wa,t)),e.guid=t=>e.check(mi(ya,t)),e.uuid=t=>e.check(hi(ba,t)),e.uuidv4=t=>e.check(Ete(ba,t)),e.uuidv6=t=>e.check(Dte(ba,t)),e.uuidv7=t=>e.check(Ote(ba,t)),e.nanoid=t=>e.check(Ate(Ta,t)),e.guid=t=>e.check(mi(ya,t)),e.cuid=t=>e.check(jte(Ea,t)),e.cuid2=t=>e.check(Mte(Da,t)),e.ulid=t=>e.check(Nte(Oa,t)),e.base64=t=>e.check(Bte(Fa,t)),e.base64url=t=>e.check(Vte(Ia,t)),e.xid=t=>e.check(Pte(ka,t)),e.ksuid=t=>e.check(Fte(Aa,t)),e.ipv4=t=>e.check(Ite(ja,t)),e.ipv6=t=>e.check(Lte(Ma,t)),e.cidrv4=t=>e.check(Rte(Na,t)),e.cidrv6=t=>e.check(zte(Pa,t)),e.e164=t=>e.check(Hte(La,t)),e.datetime=t=>e.check(ia(t)),e.date=t=>e.check(_ne(t)),e.time=t=>e.check(yne(t)),e.duration=t=>e.check(xne(t))});function F(e){return wte(ga,e)}const _a=P(`ZodStringFormat`,(e,t)=>{Kr.init(e,t),ha.init(e,t)}),va=P(`ZodEmail`,(e,t)=>{Aee.init(e,t),_a.init(e,t)}),ya=P(`ZodGUID`,(e,t)=>{Oee.init(e,t),_a.init(e,t)}),ba=P(`ZodUUID`,(e,t)=>{kee.init(e,t),_a.init(e,t)});function xa(e){return hi(ba,e)}const Sa=P(`ZodURL`,(e,t)=>{jee.init(e,t),_a.init(e,t)});function Ca(e){return gi(Sa,e)}const wa=P(`ZodEmoji`,(e,t)=>{Mee.init(e,t),_a.init(e,t)}),Ta=P(`ZodNanoID`,(e,t)=>{Nee.init(e,t),_a.init(e,t)}),Ea=P(`ZodCUID`,(e,t)=>{Pee.init(e,t),_a.init(e,t)}),Da=P(`ZodCUID2`,(e,t)=>{Fee.init(e,t),_a.init(e,t)}),Oa=P(`ZodULID`,(e,t)=>{Iee.init(e,t),_a.init(e,t)}),ka=P(`ZodXID`,(e,t)=>{Lee.init(e,t),_a.init(e,t)}),Aa=P(`ZodKSUID`,(e,t)=>{Ree.init(e,t),_a.init(e,t)}),ja=P(`ZodIPv4`,(e,t)=>{Uee.init(e,t),_a.init(e,t)}),Ma=P(`ZodIPv6`,(e,t)=>{Wee.init(e,t),_a.init(e,t)}),Na=P(`ZodCIDRv4`,(e,t)=>{Gee.init(e,t),_a.init(e,t)}),Pa=P(`ZodCIDRv6`,(e,t)=>{Kee.init(e,t),_a.init(e,t)}),Fa=P(`ZodBase64`,(e,t)=>{qee.init(e,t),_a.init(e,t)}),Ia=P(`ZodBase64URL`,(e,t)=>{Yee.init(e,t),_a.init(e,t)}),La=P(`ZodE164`,(e,t)=>{Xee.init(e,t),_a.init(e,t)}),Ra=P(`ZodJWT`,(e,t)=>{Qee.init(e,t),_a.init(e,t)}),za=P(`ZodNumber`,(e,t)=>{Jr.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jte(e,t,n,r),pa(e,`ZodNumber`,{gt(e,t){return this.check(Di(e,t))},gte(e,t){return this.check(Oi(e,t))},min(e,t){return this.check(Oi(e,t))},lt(e,t){return this.check(Ti(e,t))},lte(e,t){return this.check(Ei(e,t))},max(e,t){return this.check(Ei(e,t))},int(e){return this.check(Va(e))},safe(e){return this.check(Va(e))},positive(e){return this.check(Di(0,e))},nonnegative(e){return this.check(Oi(0,e))},negative(e){return this.check(Ti(0,e))},nonpositive(e){return this.check(Ei(0,e))},multipleOf(e,t){return this.check(ki(e,t))},step(e,t){return this.check(ki(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return yi(za,e)}const Ba=P(`ZodNumberFormat`,(e,t)=>{$ee.init(e,t),za.init(e,t)});function Va(e){return bi(Ba,e)}const Ha=P(`ZodBoolean`,(e,t)=>{ete.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yte(e,t,n,r)});function L(e){return xi(Ha,e)}const Ua=P(`ZodNull`,(e,t)=>{tte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xte(e,t,n,r)});function Wa(e){return Si(Ua,e)}const Ga=P(`ZodUnknown`,(e,t)=>{nte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return Ci(Ga)}const Ka=P(`ZodNever`,(e,t)=>{rte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zte(e,t,n,r)});function qa(e){return wi(Ka,e)}const Ja=P(`ZodArray`,(e,t)=>{ite.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nne(e,t,n,r),e.element=t.element,pa(e,`ZodArray`,{min(e,t){return this.check(ji(e,t))},nonempty(e){return this.check(ji(1,e))},max(e,t){return this.check(Ai(e,t))},length(e,t){return this.check(Mi(e,t))},unwrap(){return this.element}})});function z(e,t){return Ui(Ja,e,t)}const Ya=P(`ZodObject`,(e,t)=>{ote.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rne(e,t,n,r),pn(e,`shape`,()=>t.shape),pa(e,`ZodObject`,{keyof(){return H(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:qa()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return bee(this,e)},safeExtend(e){return xee(this,e)},merge(e){return See(this,e)},pick(e){return vee(this,e)},omit(e){return yee(this,e)},partial(...e){return Cee(oo,this,e[0])},required(...e){return wee(lo,this,e[0])}})});function B(e,t){return new Ya({type:`object`,shape:e??{},...wn(t)})}function Xa(e,t){return new Ya({type:`object`,shape:e,catchall:R(),...wn(t)})}const Za=P(`ZodUnion`,(e,t)=>{ei.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ine(e,t,n,r),e.options=t.options});function Qa(e,t){return new Za({type:`union`,options:e,...wn(t)})}const $a=P(`ZodDiscriminatedUnion`,(e,t)=>{Za.init(e,t),ste.init(e,t)});function eo(e,t,n){return new $a({type:`union`,options:t,discriminator:e,...wn(n)})}const to=P(`ZodIntersection`,(e,t)=>{cte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ane(e,t,n,r)});function no(e,t){return new to({type:`intersection`,left:e,right:t})}const ro=P(`ZodRecord`,(e,t)=>{lte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>one(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return!t||!t._zod?new ro({type:`record`,keyType:F(),valueType:e,...wn(t)}):new ro({type:`record`,keyType:e,valueType:t,...wn(n)})}const io=P(`ZodEnum`,(e,t)=>{ute.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qte(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new io({...t,checks:[],...wn(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new io({...t,checks:[],...wn(r),entries:i})}});function H(e,t){return new io({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...wn(t)})}const One=P(`ZodLiteral`,(e,t)=>{dte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$te(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U(e,t){return new One({type:`literal`,values:Array.isArray(e)?e:[e],...wn(t)})}const kne=P(`ZodTransform`,(e,t)=>{fte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tne(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new nn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(An(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(An(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ao(e){return new kne({type:`transform`,transform:e})}const oo=P(`ZodOptional`,(e,t)=>{ii.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function so(e){return new oo({type:`optional`,innerType:e})}const Ane=P(`ZodExactOptional`,(e,t)=>{pte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jne(e){return new Ane({type:`optional`,innerType:e})}const Mne=P(`ZodNullable`,(e,t)=>{mte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sne(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function co(e){return new Mne({type:`nullable`,innerType:e})}const Nne=P(`ZodDefault`,(e,t)=>{hte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lne(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pne(e,t){return new Nne({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():xn(t)}})}const Fne=P(`ZodPrefault`,(e,t)=>{gte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>une(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ine(e,t){return new Fne({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():xn(t)}})}const lo=P(`ZodNonOptional`,(e,t)=>{_te.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cne(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lne(e,t){return new lo({type:`nonoptional`,innerType:e,...wn(t)})}const Rne=P(`ZodCatch`,(e,t)=>{vte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dne(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zne(e,t){return new Rne({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const uo=P(`ZodPipe`,(e,t)=>{si.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fne(e,t,n,r),e.in=t.in,e.out=t.out});function fo(e,t){return new uo({type:`pipe`,in:e,out:t})}const Bne=P(`ZodPreprocess`,(e,t)=>{uo.init(e,t),yte.init(e,t)}),Vne=P(`ZodReadonly`,(e,t)=>{bte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pne(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hne(e){return new Vne({type:`readonly`,innerType:e})}const Une=P(`ZodLazy`,(e,t)=>{xte.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mne(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function po(e){return new Une({type:`lazy`,getter:e})}const mo=P(`ZodCustom`,(e,t)=>{Ste.init(e,t),ma.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ene(e,t,n,r)});function ho(e,t){return Wi(mo,e??(()=>!0),t)}function Wne(e,t={}){return Gi(mo,e,t)}function Gne(e,t){return Ki(e,t)}function go(e,t){return new Bne({type:`pipe`,in:ao(e),out:t})}const Kne=Xa({at:F(),transport:F(),outcome:F(),reference:F().optional(),error:F().optional()}),qne=Xa({reason:F(),at:F()});Xa({version:I().int().catch(1),id:F(),createdAt:F(),bundleLevel:F(),zipBytes:I().int().nonnegative().catch(0),zipDeleted:L().optional(),state:F(),systemWide:L().optional(),projectSlug:F().nullable().optional(),reference:F().optional(),lastError:qne.optional(),attempts:z(Kne).optional(),note:F().optional()});const _o=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)[^"]+/g,replacement:`$1[REDACTED]`}],Jne=_o.map(e=>e.name);function vo(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
180
180
|
`).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of _o)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
|
|
181
|
-
`),patterns:[...t],lineCount:n}}function yo(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?xo(e.position):`start`in e||`end`in e?xo(e):`line`in e||`column`in e?bo(e):``}function bo(e){return So(e&&e.line)+`:`+So(e&&e.column)}function xo(e){return bo(e&&e.start)+`-`+bo(e&&e.end)}function So(e){return e&&typeof e==`number`?e:1}var Co=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=yo(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Co.prototype.file=``,Co.prototype.name=``,Co.prototype.reason=``,Co.prototype.message=``,Co.prototype.stack=``,Co.prototype.column=void 0,Co.prototype.line=void 0,Co.prototype.ancestors=void 0,Co.prototype.cause=void 0,Co.prototype.fatal=void 0,Co.prototype.place=void 0,Co.prototype.ruleId=void 0,Co.prototype.source=void 0;const Yne=[`off`,`follow`,`full`],wo=`pull`,To=[`off`,`follow`,`full`,wo],Xne=[`follow`,`full`,wo],Zne=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`})),Qne=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...Zne,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Qne.has(e)));const Eo=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],$ne=[`video/mp4`,`video/webm`,`video/ogg`],ere=[`audio/mpeg`,`audio/wav`,`audio/ogg`],tre=[`application/pdf`],Do=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Oo=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),nre=new Set([`pdf`]),ko=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Ao=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(`.`)),jo=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(`.`)),rre=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(`.`)),Mo=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(`.`)),No=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Po=[`mp4`,`webm`,`mov`,`m4v`],Fo=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Io=[`pdf`],Lo=[`json`,`toml`,`lock`];function Ro(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Ro(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,No,Do),Ro(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Po,Oo),Ro(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Fo,ko),Ro(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Io,nre),Ro(`FILE_ATTACHMENT_EXTENSIONS`,[...Ao],Mo),Ro(`WIKI_EMBED_EXTENSIONS`,[...Mo],jo),new Set(No),new Set(Po),new Set(Fo),new Set(Io),new Set(Lo),Ro(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...No,...Po,...Fo,...Io,...Lo])],rre);const ire=new Set([`base`,`canvas`]),are=new Set([`mmd`,`mermaid`]),zo=new Set([...jo,...ire,...are]),Bo=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`],ore=new Set([`ar`,`ur`]),sre=Bo.filter(e=>!ore.has(e)),cre=[`off`,`warning`,`error`],Vo=`warning`,lre=[`error`,`warning`],Ho=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],ure={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`},dre=/\P{White_Space}/u;function fre(e){return dre.test(e)}function pre(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,...hre(t)}}const Uo={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`},mre=Object.keys(Uo);function hre(e){let t={};for(let n of mre)t[`ansi-${gre(n)}`]=e[Uo[n]];return t}function gre(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const _re={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`}},vre={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`}},yre={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`}},bre={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`}},xre={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`}},Sre={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 Wo(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>pre(n)}}function Go(e,t){return{id:e,label:t,kind:`system`}}const Ko=[Go(`default`,`Default`),Wo(`dracula`,`Dracula`,_re),Wo(`catppuccin-frappe`,`Catppuccin Frappé`,vre),Wo(`catppuccin-latte`,`Catppuccin Latte`,yre),Wo(`monokai`,`Monokai`,bre),Wo(`gruvbox`,`Gruvbox`,xre),Wo(`solarized`,`Solarized`,Sre),Go(`custom`,`Custom`)],Cre=Ko.map(e=>e.id),qo=/^[a-z0-9-]{1,32}$/;new Map(Ko.map(e=>[e.id,e]));const Jo=Symbol.for(`@inkeep/open-knowledge/field-registry`),Yo=globalThis;Yo[Jo]===void 0&&(Yo[Jo]=fi());const Xo=Yo[Jo];function wre(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=Tre(t)?Xo.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function Tre(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Ere(){return Object.fromEntries(Ho.map(e=>[e,F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${ure[e]}, as a #rrggbb hex string.`}).optional()]))}function Zo(){return Cre.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const Qo=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),$o=52428800,es=26214400,ts=12582912,ns=`https://api.openai.com/v1`,rs=`text-embedding-3-small`,is=Object.freeze([`127.0.0.1`]),as=/^[1-9]\d*(s|m|h)$/,ss=/^https?:\/\//;function cs(e){let t=e.trim();return t===``?`./`:t}function ls(e){let t=cs(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const us=Xa({content:Xa({dir:F().register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,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. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:F().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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(ls,{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:Xa({theme:H([`light`,`dark`,`system`]).register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:H([`system`,...Bo]).register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Zo()}, 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(qo,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Zo()}, 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(qo,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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(qo,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:Xa({name:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:H([`dark`,`light`]).register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Ere()}).optional(),preview:Xa({autoOpen:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({showHiddenFiles:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Xa({wordWrap:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({autoApproveOkTools:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({mode:H(To).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:H(Xne).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Qa([L(),H(To)]).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({localSink:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({maxBytes:I().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default($o)}).default({maxBytes:$o}),logs:Xa({maxBytes:I().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(es)}).default({maxBytes:es}),attributeDenylist:z(F()).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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([...Qo])}).default({enabled:!0,spans:{maxBytes:$o},logs:{maxBytes:es},attributeDenylist:[...Qo]}),skillInstallReports:Xa({enabled:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:$o},logs:{maxBytes:es},attributeDenylist:[...Qo]},skillInstallReports:{enabled:!0}}),lossCapture:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:I().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(ts)}).default({enabled:!0,maxBytes:ts}),bridge:Xa({backgroundThrottle:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({semantic:Xa({enabled:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:F().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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(ns),model:F().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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(rs),dimensions:I().int().positive().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:I().min(0).max(1).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:ns,model:rs})}).default({semantic:{enabled:!1,baseUrl:ns,model:rs}}),contentRules:Xa({markdownlint:B({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:B({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:z(B({appliesTo:Qa([F(),z(F())]).optional(),file:F(),enabled:L().optional()})).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:[]}),okf:B({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:V(F(),L()).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:B({index:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:Xa({links:H(cre).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Vo),fileTreeIndicators:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Vo,fileTreeIndicators:!0}),linkPreviews:Xa({enabled:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Xa({url:F().register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:"Superseded by server.externalUrl — read only while server.externalUrl (and its deprecated server.publicUrl spelling) is absent. 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:I().int().min(1).max(65535).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Superseded by server.port — read only while server.port is absent. 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.`}).optional()}).default({}),server:Xa({port:I().int().min(1).max(65535).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Supersedes remote.port (still read while this key is absent). Read at server start; changing it requires a restart.`}).optional(),bind:z(F().min(1)).min(1).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...is]),externalUrl:Ca({protocol:/^https?$/}).regex(ss).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — drives issued URLs and CORS. Unset by default: a loopback server derives http://localhost:<port>. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Supersedes server.publicUrl (its former name) and remote.url — both still read while this key is absent. Read at server start; changing it requires a restart.`}).optional(),publicUrl:Ca({protocol:/^https?$/}).regex(ss).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Deprecated alias of server.externalUrl (the former name of that key) — read only while server.externalUrl is absent, with identical semantics. Use server.externalUrl instead; if this config is committed and shared, keep both keys until every collaborator has upgraded (older versions read only server.publicUrl).`}).optional(),allowExternal:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:Qa([U(`off`),F().regex(as)]).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' when every bind address is loopback, 'off' otherwise (an exposed or containerized server stays up). Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...is],allowExternal:!1})});var ds,fs=n((()=>{ds=`1.9.1`}));function ps(e){let t=new Set([e]),n=new Set,r=e.match(ms);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(ms);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var ms,hs,gs=n((()=>{fs(),ms=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,hs=ps(ds)}));function _s(e,t,n,r=!1){let i=Ss[xs]=Ss[xs]??{version:ds};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${ds}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${ds}.`),!0}function vs(e){let t=Ss[xs]?.version;if(!(!t||!hs(t)))return Ss[xs]?.[e]}function ys(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${ds}.`);let n=Ss[xs];n&&delete n[e]}var bs,xs,Ss,Cs=n((()=>{fs(),gs(),bs=ds.split(`.`)[0],xs=Symbol.for(`opentelemetry.js.api.${bs}`),Ss=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function ws(e,t,n){let r=vs(`diag`);if(r)return r[e](t,...n)}var Ts,Es=n((()=>{Cs(),Ts=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return ws(`debug`,this._namespace,e)}error(...e){return ws(`error`,this._namespace,e)}info(...e){return ws(`info`,this._namespace,e)}warn(...e){return ws(`warn`,this._namespace,e)}verbose(...e){return ws(`verbose`,this._namespace,e)}}})),Ds,Os=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(Ds||={})}));function ks(e,t){e<Ds.NONE?e=Ds.NONE:e>Ds.ALL&&(e=Ds.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,Ds.ERROR),warn:n(`warn`,Ds.WARN),info:n(`info`,Ds.INFO),debug:n(`debug`,Ds.DEBUG),verbose:n(`verbose`,Ds.VERBOSE)}}var As=n((()=>{Os()})),js,Ms,Ns=n((()=>{Es(),As(),Os(),Cs(),js=`diag`,Ms=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=vs(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:Ds.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=vs(`diag`),i=ks(n.logLevel??Ds.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return _s(`diag`,i,t,!0)},t.disable=()=>{ys(js,t)},t.createComponentLogger=e=>new Ts(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function Ps(e){return Symbol.for(e)}var Fs,Is,Ls=n((()=>{Fs=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Is=new Fs})),Rs,zs=n((()=>{Ls(),Rs=class{active(){return Is}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Bs,Vs,Hs,Us=n((()=>{zs(),Cs(),Ns(),Bs=`context`,Vs=new Rs,Hs=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return _s(Bs,e,Ms.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return vs(Bs)||Vs}disable(){this._getContextManager().disable(),ys(Bs,Ms.instance())}}})),Ws,Gs=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(Ws||={})})),Ks,qs,Js,Ys=n((()=>{Gs(),Ks=`0000000000000000`,qs=`00000000000000000000000000000000`,Js={traceId:qs,spanId:Ks,traceFlags:Ws.NONE}})),Xs,Zs=n((()=>{Ys(),Xs=class{constructor(e=Js){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Qs(e){return e.getValue(ic)||void 0}function $s(){return Qs(Hs.getInstance().active())}function ec(e,t){return e.setValue(ic,t)}function tc(e){return e.deleteValue(ic)}function nc(e,t){return ec(e,new Xs(t))}function rc(e){return Qs(e)?.spanContext()}var ic,ac=n((()=>{Ls(),Zs(),Us(),ic=Ps(`OpenTelemetry Context Key SPAN`)}));function oc(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(dc[e.charCodeAt(t)]|0)+(dc[e.charCodeAt(t+1)]|0)+(dc[e.charCodeAt(t+2)]|0)+(dc[e.charCodeAt(t+3)]|0);return n===t}function sc(e){return oc(e,32)&&e!==`00000000000000000000000000000000`}function cc(e){return oc(e,16)&&e!==`0000000000000000`}function lc(e){return sc(e.traceId)&&cc(e.spanId)}function uc(e){return new Xs(e)}var dc,fc=n((()=>{Ys(),Zs(),dc=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function pc(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var mc,hc,gc=n((()=>{Us(),ac(),Zs(),fc(),mc=Hs.getInstance(),hc=class{startSpan(e,t,n=mc.active()){if(t?.root)return new Xs;let r=n&&rc(n);return pc(r)&&lc(r)?new Xs(r):new Xs}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??mc.active(),c=this.startSpan(e,i,s),l=ec(s,c);return mc.with(l,o,void 0,c)}}})),_c,vc,yc=n((()=>{gc(),_c=new hc,vc=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):_c}}})),bc,xc=n((()=>{gc(),bc=class{getTracer(e,t,n){return new hc}}})),Sc,Cc,wc=n((()=>{yc(),xc(),Sc=new bc,Cc=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new vc(this,e,t,n)}getDelegate(){return this._delegate??Sc}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),Tc,Ec=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Tc||={})})),Dc,Oc=n((()=>{Us(),Dc=Hs.getInstance()})),kc,Ac,jc=n((()=>{Cs(),wc(),fc(),ac(),Ns(),kc=`trace`,Ac=class e{constructor(){this._proxyTracerProvider=new Cc,this.wrapSpanContext=uc,this.isSpanContextValid=lc,this.deleteSpan=tc,this.getSpan=Qs,this.getActiveSpan=$s,this.getSpanContext=rc,this.setSpan=ec,this.setSpanContext=nc}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=_s(kc,this._proxyTracerProvider,Ms.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return vs(kc)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){ys(kc,Ms.instance()),this._proxyTracerProvider=new Cc}}})),Mc,Nc=n((()=>{jc(),Mc=Ac.getInstance()})),Pc=n((()=>{Ns(),Ls(),Os(),yc(),wc(),Ec(),Gs(),fc(),Ys(),Oc(),Nc()}));function Fc(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 Ic(e,t){let n=e;for(let e of t){n=Fc(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Lc(e,t){let n=Ic(e,t);if(n!==void 0)return wre(n)}const Rc=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function zc(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Bc(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(zc).join(`_`)}`}function Vc(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,Kt.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,Kt.isNode)(r))return r}return e.contents??null}function Hc(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 Uc(e,t,n,r,i){let a=e.split(`
|
|
181
|
+
`),patterns:[...t],lineCount:n}}function yo(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?xo(e.position):`start`in e||`end`in e?xo(e):`line`in e||`column`in e?bo(e):``}function bo(e){return So(e&&e.line)+`:`+So(e&&e.column)}function xo(e){return bo(e&&e.start)+`-`+bo(e&&e.end)}function So(e){return e&&typeof e==`number`?e:1}var Co=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=yo(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Co.prototype.file=``,Co.prototype.name=``,Co.prototype.reason=``,Co.prototype.message=``,Co.prototype.stack=``,Co.prototype.column=void 0,Co.prototype.line=void 0,Co.prototype.ancestors=void 0,Co.prototype.cause=void 0,Co.prototype.fatal=void 0,Co.prototype.place=void 0,Co.prototype.ruleId=void 0,Co.prototype.source=void 0;const Yne=[`off`,`follow`,`full`],wo=`pull`,To=[`off`,`follow`,`full`,wo],Xne=[`follow`,`full`,wo],Zne=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`})),Qne=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...Zne,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Qne.has(e)));const Eo=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],$ne=[`video/mp4`,`video/webm`,`video/ogg`],ere=[`audio/mpeg`,`audio/wav`,`audio/ogg`],tre=[`application/pdf`],Do=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Oo=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),nre=new Set([`pdf`]),ko=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Ao=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(`.`)),jo=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(`.`)),rre=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(`.`)),Mo=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(`.`)),No=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Po=[`mp4`,`webm`,`mov`,`m4v`],Fo=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Io=[`pdf`],Lo=[`json`,`toml`,`lock`];function Ro(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Ro(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,No,Do),Ro(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Po,Oo),Ro(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Fo,ko),Ro(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Io,nre),Ro(`FILE_ATTACHMENT_EXTENSIONS`,[...Ao],Mo),Ro(`WIKI_EMBED_EXTENSIONS`,[...Mo],jo),new Set(No),new Set(Po),new Set(Fo),new Set(Io),new Set(Lo),Ro(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...No,...Po,...Fo,...Io,...Lo])],rre);const ire=new Set([`base`,`canvas`]),are=new Set([`mmd`,`mermaid`]),zo=new Set([...jo,...ire,...are]),Bo=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`],ore=new Set([`ar`,`ur`]),sre=Bo.filter(e=>!ore.has(e)),cre=[`off`,`warning`,`error`],Vo=`warning`,lre=[`error`,`warning`],Ho=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],ure={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`},dre=/\P{White_Space}/u;function fre(e){return dre.test(e)}function pre(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,...hre(t)}}const Uo={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`},mre=Object.keys(Uo);function hre(e){let t={};for(let n of mre)t[`ansi-${gre(n)}`]=e[Uo[n]];return t}function gre(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const _re={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`}},vre={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`}},yre={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`}},bre={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`}},xre={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`}},Sre={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 Wo(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>pre(n)}}function Go(e,t){return{id:e,label:t,kind:`system`}}const Ko=[Go(`default`,`Default`),Wo(`dracula`,`Dracula`,_re),Wo(`catppuccin-frappe`,`Catppuccin Frappé`,vre),Wo(`catppuccin-latte`,`Catppuccin Latte`,yre),Wo(`monokai`,`Monokai`,bre),Wo(`gruvbox`,`Gruvbox`,xre),Wo(`solarized`,`Solarized`,Sre),Go(`custom`,`Custom`)],Cre=Ko.map(e=>e.id),qo=/^[a-z0-9-]{1,32}$/;new Map(Ko.map(e=>[e.id,e]));const Jo=Symbol.for(`@inkeep/open-knowledge/field-registry`),Yo=globalThis;Yo[Jo]===void 0&&(Yo[Jo]=fi());const Xo=Yo[Jo];function wre(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=Tre(t)?Xo.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function Tre(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Ere(){return Object.fromEntries(Ho.map(e=>[e,F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${ure[e]}, as a #rrggbb hex string.`}).optional()]))}function Zo(){return Cre.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const Qo=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),$o=52428800,es=26214400,ts=12582912,ns=`https://api.openai.com/v1`,rs=`text-embedding-3-small`,is=Object.freeze([`127.0.0.1`]),as=/^[1-9]\d*(s|m|h)$/,ss=/^https?:\/\//;function cs(e){let t=e.trim();return t===``?`./`:t}function ls(e){let t=cs(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const us=Xa({content:Xa({dir:F().register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,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. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:F().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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(ls,{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:Xa({theme:H([`light`,`dark`,`system`]).register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:H([`system`,...Bo]).register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Zo()}, 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(qo,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Zo()}, 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(qo,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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(qo,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:Xa({name:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:F().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:H([`dark`,`light`]).register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Ere()}).optional(),preview:Xa({autoOpen:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({showHiddenFiles:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Xa({wordWrap:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({autoApproveOkTools:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({mode:H(To).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:H(Xne).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Qa([L(),H(To)]).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:Xa({localSink:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({maxBytes:I().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default($o)}).default({maxBytes:$o}),logs:Xa({maxBytes:I().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(es)}).default({maxBytes:es}),attributeDenylist:z(F()).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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([...Qo])}).default({enabled:!0,spans:{maxBytes:$o},logs:{maxBytes:es},attributeDenylist:[...Qo]}),skillInstallReports:Xa({enabled:L().register(Xo,{scope:`user`,agentSettable:!1,reload:`live`,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:$o},logs:{maxBytes:es},attributeDenylist:[...Qo]},skillInstallReports:{enabled:!0}}),lossCapture:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:I().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(ts)}).default({enabled:!0,maxBytes:ts}),bridge:Xa({backgroundThrottle:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:Xa({semantic:Xa({enabled:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:F().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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(ns),model:F().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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(rs),dimensions:I().int().positive().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:I().min(0).max(1).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:ns,model:rs})}).default({semantic:{enabled:!1,baseUrl:ns,model:rs}}),contentRules:Xa({markdownlint:B({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:B({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:z(B({appliesTo:Qa([F(),z(F())]).optional(),file:F(),enabled:L().optional()})).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,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:[]}),okf:B({enabled:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:V(F(),L()).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:B({index:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:Xa({links:H(cre).register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Vo),fileTreeIndicators:L().register(Xo,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Vo,fileTreeIndicators:!0}),linkPreviews:Xa({enabled:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,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:Xa({url:F().register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:"Superseded by server.externalUrl — read only while server.externalUrl (and its deprecated server.publicUrl spelling) is absent. 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:I().int().min(1).max(65535).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Superseded by server.port — read only while server.port is absent. 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.`}).optional()}).default({}),server:Xa({port:I().int().min(1).max(65535).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Supersedes remote.port (still read while this key is absent). Read at server start; changing it requires a restart.`}).optional(),bind:z(F().min(1)).min(1).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...is]),externalUrl:Ca({protocol:/^https?$/}).regex(ss).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — drives issued URLs and CORS. Unset by default: a loopback server derives http://localhost:<port>. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Supersedes server.publicUrl (its former name) and remote.url — both still read while this key is absent. Read at server start; changing it requires a restart.`}).optional(),publicUrl:Ca({protocol:/^https?$/}).regex(ss).register(Xo,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Deprecated alias of server.externalUrl (the former name of that key) — read only while server.externalUrl is absent, with identical semantics. Use server.externalUrl instead; if this config is committed and shared, keep both keys until every collaborator has upgraded (older versions read only server.publicUrl).`}).optional(),allowExternal:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:L().register(Xo,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:Qa([U(`off`),F().regex(as)]).register(Xo,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' when every bind address is loopback, 'off' otherwise (an exposed or containerized server stays up). Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...is],allowExternal:!1})});var ds,fs=n((()=>{ds=`1.9.1`}));function ps(e){let t=new Set([e]),n=new Set,r=e.match(ms);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(ms);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var ms,hs,gs=n((()=>{fs(),ms=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,hs=ps(ds)}));function _s(e,t,n,r=!1){let i=Ss[xs]=Ss[xs]??{version:ds};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${ds}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${ds}.`),!0}function vs(e){let t=Ss[xs]?.version;if(!(!t||!hs(t)))return Ss[xs]?.[e]}function ys(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${ds}.`);let n=Ss[xs];n&&delete n[e]}var bs,xs,Ss,Cs=n((()=>{fs(),gs(),bs=ds.split(`.`)[0],xs=Symbol.for(`opentelemetry.js.api.${bs}`),Ss=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function ws(e,t,n){let r=vs(`diag`);if(r)return r[e](t,...n)}var Ts,Es=n((()=>{Cs(),Ts=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return ws(`debug`,this._namespace,e)}error(...e){return ws(`error`,this._namespace,e)}info(...e){return ws(`info`,this._namespace,e)}warn(...e){return ws(`warn`,this._namespace,e)}verbose(...e){return ws(`verbose`,this._namespace,e)}}})),Ds,Os=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(Ds||={})}));function ks(e,t){e<Ds.NONE?e=Ds.NONE:e>Ds.ALL&&(e=Ds.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,Ds.ERROR),warn:n(`warn`,Ds.WARN),info:n(`info`,Ds.INFO),debug:n(`debug`,Ds.DEBUG),verbose:n(`verbose`,Ds.VERBOSE)}}var As=n((()=>{Os()})),js,Ms,Ns=n((()=>{Es(),As(),Os(),Cs(),js=`diag`,Ms=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=vs(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:Ds.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=vs(`diag`),i=ks(n.logLevel??Ds.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return _s(`diag`,i,t,!0)},t.disable=()=>{ys(js,t)},t.createComponentLogger=e=>new Ts(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function Ps(e){return Symbol.for(e)}var Fs,Is,Ls=n((()=>{Fs=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Is=new Fs})),Rs,zs=n((()=>{Ls(),Rs=class{active(){return Is}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Bs,Vs,Hs,Us=n((()=>{zs(),Cs(),Ns(),Bs=`context`,Vs=new Rs,Hs=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return _s(Bs,e,Ms.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return vs(Bs)||Vs}disable(){this._getContextManager().disable(),ys(Bs,Ms.instance())}}})),Ws,Gs=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(Ws||={})})),Ks,qs,Js,Ys=n((()=>{Gs(),Ks=`0000000000000000`,qs=`00000000000000000000000000000000`,Js={traceId:qs,spanId:Ks,traceFlags:Ws.NONE}})),Xs,Zs=n((()=>{Ys(),Xs=class{constructor(e=Js){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Qs(e){return e.getValue(ic)||void 0}function $s(){return Qs(Hs.getInstance().active())}function ec(e,t){return e.setValue(ic,t)}function tc(e){return e.deleteValue(ic)}function nc(e,t){return ec(e,new Xs(t))}function rc(e){return Qs(e)?.spanContext()}var ic,ac=n((()=>{Ls(),Zs(),Us(),ic=Ps(`OpenTelemetry Context Key SPAN`)}));function oc(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(dc[e.charCodeAt(t)]|0)+(dc[e.charCodeAt(t+1)]|0)+(dc[e.charCodeAt(t+2)]|0)+(dc[e.charCodeAt(t+3)]|0);return n===t}function sc(e){return oc(e,32)&&e!==`00000000000000000000000000000000`}function cc(e){return oc(e,16)&&e!==`0000000000000000`}function lc(e){return sc(e.traceId)&&cc(e.spanId)}function uc(e){return new Xs(e)}var dc,fc=n((()=>{Ys(),Zs(),dc=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function pc(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var mc,hc,gc=n((()=>{Us(),ac(),Zs(),fc(),mc=Hs.getInstance(),hc=class{startSpan(e,t,n=mc.active()){if(t?.root)return new Xs;let r=n&&rc(n);return pc(r)&&lc(r)?new Xs(r):new Xs}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??mc.active(),c=this.startSpan(e,i,s),l=ec(s,c);return mc.with(l,o,void 0,c)}}})),_c,vc,yc=n((()=>{gc(),_c=new hc,vc=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):_c}}})),bc,xc=n((()=>{gc(),bc=class{getTracer(e,t,n){return new hc}}})),Sc,Cc,wc=n((()=>{yc(),xc(),Sc=new bc,Cc=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new vc(this,e,t,n)}getDelegate(){return this._delegate??Sc}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),Tc,Ec=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Tc||={})})),Dc,Oc=n((()=>{Us(),Dc=Hs.getInstance()})),kc,Ac,jc=n((()=>{Cs(),wc(),fc(),ac(),Ns(),kc=`trace`,Ac=class e{constructor(){this._proxyTracerProvider=new Cc,this.wrapSpanContext=uc,this.isSpanContextValid=lc,this.deleteSpan=tc,this.getSpan=Qs,this.getActiveSpan=$s,this.getSpanContext=rc,this.setSpan=ec,this.setSpanContext=nc}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=_s(kc,this._proxyTracerProvider,Ms.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return vs(kc)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){ys(kc,Ms.instance()),this._proxyTracerProvider=new Cc}}})),Mc,Nc=n((()=>{jc(),Mc=Ac.getInstance()})),Pc=n((()=>{Ns(),Ls(),Os(),yc(),wc(),Ec(),Gs(),fc(),Ys(),Oc(),Nc()}));function Fc(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 Ic(e,t){let n=e;for(let e of t){n=Fc(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Lc(e,t){let n=Ic(e,t);if(n!==void 0)return wre(n)}const Rc=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function zc(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Bc(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(zc).join(`_`)}`}function Vc(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,Kt.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,Kt.isNode)(r))return r}return e.contents??null}function Hc(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 Uc(e,t,n,r,i){let a=e.split(`
|
|
182
182
|
`),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(`
|
|
183
183
|
`)}function Wc(e){let t=Vc(e.doc,e.path);if(!t)return;let n=t.range;if(!n)return;let[r,,i=r]=n,{line:a,column:o}=Hc(e.source,r),s=(0,Kt.isCollection)(t)?Uc(e.source,r,r+1,a,o):Uc(e.source,r,i,a,o);return{file:e.file,line:a,column:o,snippet:s.length>0?s:void 0}}function Gc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kc(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=Lc(us,t);if(e!==void 0){if(e.scope===`project-local`){let e=Bc(t),o;i!=null&&r!=null&&n!=null&&(o=Wc({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...Rc.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if(Gc(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}const qc=B({file:F(),line:I().int().min(1),column:I().int().min(1),snippet:F().optional()}),Jc=B({path:z(Qa([F(),I()])),message:F(),issueCode:F(),params:V(F(),R()).optional(),source:qc.optional()}),Yc=H([`user`,`project`,`project-local`,`either`]),Xc=H([`user`,`project`,`project-local`]),Zc=B({code:U(`YAML_PARSE`),detail:F()}),Qc=B({code:U(`UNREADABLE`),detail:F()}),$c=B({code:U(`SCHEMA_INVALID`),issues:z(Jc)}),el=B({code:U(`REMOVED_KEY`),path:z(F()),redirect:F(),source:qc.optional()}),tl=eo(`code`,[Zc,$c,Qc,B({code:U(`SCOPE_VIOLATION`),path:z(F()),expectedScope:Yc,actualScope:Xc}),B({code:U(`NOT_AGENT_SETTABLE`),path:z(F())}),B({code:U(`MIXED_SCOPE`),paths:z(B({path:z(F()),scope:Xc}))}),el,B({code:U(`WRITE_ERROR`),detail:F()}),B({code:U(`OKIGNORE_INVALID`),detail:F(),lineNumber:I().int().min(1).optional()}),B({code:U(`UNKNOWN`),message:F().optional()})]);eo(`code`,[el,Zc,$c,Qc]),B({diagnostics:z(eo(`code`,[B({code:U(`REMOVED_KEY`),scope:Xc,file:F(),path:z(F()),redirect:F()}),B({code:U(`YAML_PARSE`),scope:Xc,file:F()}),B({code:U(`SCHEMA_INVALID`),scope:Xc,file:F()}),B({code:U(`UNREADABLE`),scope:Xc,file:F()})]))});const nl=new Set(tl.options.map(e=>e.shape.code.value)),rl=Qa([tl,Xa({code:F(),message:F().optional()})]);function il(e){return nl.has(e.code)}function al(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 ol(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 sl(e){if(!il(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(`
|
|
184
184
|
`))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
|
|
@@ -1520,6 +1520,6 @@ export default function okBridge(pi: {
|
|
|
1520
1520
|
`))}function j9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=k9(JSON.parse(n),t),i=n.endsWith(`
|
|
1521
1521
|
`)?`
|
|
1522
1522
|
`:``;ne(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDir);r!==n&&ne(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDir);r!==n&&ne(e,r)}function N9(e){try{return C(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const bwe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function xwe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}function Swe(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of N9(N(e.stagingDir,n)))xwe(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(N(e.stagingDir,`state`))){let e=fe(n);n.endsWith(`.jsonl`)?A9(n,t):bwe.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function Cwe(e){return N(e,...F9,R9)}function wwe(e){return N(e,...F9,z9)}function Twe(e){return N(e,...I9,B9)}function Ewe(e){return N(e,...I9,V9)}function Dwe(e){return N(e,...L9,H9)}function Owe(e){return N(e,...L9,U9)}const W9=1e3;async function kwe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function Awe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function jwe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function Mwe(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(`
|
|
1523
|
-
`)}\n`:null}catch{return null}}function Nwe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],j3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Pwe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],j3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){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 Fwe(){return{nodeVersion:process.version,platform:k(),arch:ie()}}function Iwe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,Kt.parse)(S(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(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function Lwe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return Lwe(e.maxBytes)}function Rwe(e){let t=q9(o$(`project`,e)),n=q9(o$(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function zwe(e){return Ae(`sha256`).update(e).digest(`hex`)}function Bwe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Vwe(e){let t=S(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 X9(e,t){if(!g(e))return!1;try{return v(pe(t),{recursive:!0}),m(e,t),!0}catch{return!1}}function Z9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Hwe=new Set([`.jsonl`]);function Q9(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Hwe.has(e.slice(t))}const Uwe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Wwe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Uwe.has(e.slice(t))}function Gwe(e){let t=[];for(let n of Z9(e)){let r=$9(e,n);if(!Wwe(r))continue;let{redacted:i,patterns:a,lineCount:o}=vo(S(n,`utf-8`));a.length!==0&&(ne(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return _e(e,t).split(ye).join(`/`)}async function Kwe(e){let t=ve(e.contentDir),n=ve(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??kwe,a=r.fetchAgentEffects??Awe,o=r.fetchWatcherRecent??jwe,s=r.readShadowHead??Nwe,c=r.readCheckpointRefs??Pwe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.
|
|
1523
|
+
`)}\n`:null}catch{return null}}function Nwe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],j3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Pwe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],j3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){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 Fwe(){return{nodeVersion:process.version,platform:k(),arch:ie()}}function Iwe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,Kt.parse)(S(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(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function Lwe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return Lwe(e.maxBytes)}function Rwe(e){let t=q9(o$(`project`,e)),n=q9(o$(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function zwe(e){return Ae(`sha256`).update(e).digest(`hex`)}function Bwe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Vwe(e){let t=S(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 X9(e,t){if(!g(e))return!1;try{return v(pe(t),{recursive:!0}),m(e,t),!0}catch{return!1}}function Z9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Hwe=new Set([`.jsonl`]);function Q9(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Hwe.has(e.slice(t))}const Uwe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Wwe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:Uwe.has(e.slice(t))}function Gwe(e){let t=[];for(let n of Z9(e)){let r=$9(e,n);if(!Wwe(r))continue;let{redacted:i,patterns:a,lineCount:o}=vo(S(n,`utf-8`));a.length!==0&&(ne(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return _e(e,t).split(ye).join(`/`)}async function Kwe(e){let t=ve(e.contentDir),n=ve(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??kwe,a=r.fetchAgentEffects??Awe,o=r.fetchWatcherRecent??jwe,s=r.readShadowHead??Nwe,c=r.readCheckpointRefs??Pwe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.57.0`),d=r.readDesktopEnv??G9,f=r.readLanguage??D9,p=r.readRuntime??Fwe,h=r.isOtlpPushEnabled??Iwe,_=y(N(le(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),X9(Cwe(n),N(_,`telemetry`,R9)),X9(wwe(n),N(_,`telemetry`,z9)),X9(Twe(n),N(_,`logs`,B9)),X9(Ewe(n),N(_,`logs`,V9));for(let t of e.userLogFiles??[])X9(t,N(_,`logs`,fe(t)));let y=N(n,`.ok`,`local`),b=N(y,`server.lock`),x=`not-running`,C=`no server.lock`,w=null;if(g(b)){X9(b,N(_,`state`,`server.lock`));try{let e=S(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?w=t.port:C=`lock present but no port`}catch{C=`lock present but unparseable`}}if(w!==null){let e=await i(w);e===null?C=`agent-presence endpoint at :${w} unreachable`:(ne(N(_,`state`,`agent-presence.json`),e),x=`running`,C=``);let t=await a(w);t!==null&&ne(N(_,`state`,`agent-effects.json`),t);let n=await o(w);if(n!==null){let e=Mwe(n);e!==null&&ne(N(_,`state`,`watcher-recent.jsonl`),e)}}let T=s(t);T!==null&&ne(N(_,`state`,`shadow-head.txt`),T);let E=c(t);E!==null&&ne(N(_,`state`,`checkpoint-refs.txt`),E),X9(Dwe(n),N(_,`state`,H9)),X9(Owe(n),N(_,`state`,U9)),X9(N(y,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),X9(N(y,cX),N(_,`state`,cX)),X9(N(y,lX),N(_,`state`,lX));let te=p(),re=d(),ie=f(),ae={ok:{version:u(),nodeVersion:te.nodeVersion,platform:te.platform,arch:te.arch},host:{desktop:re,language:ie}};ne(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=x===`running`?`running
|
|
1524
1524
|
`:`not-running (${C})\n`;if(ne(N(_,`state`,`server-status.txt`),oe),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let O=e.redact===!0;O&&Swe({stagingDir:_,contentDir:t}),e.note&&ne(N(_,`note.txt`),e.note);let se=null;e.scrubSecrets===!0&&(se=Gwe(_));for(let t of e.extraFiles??[])X9(t.sourcePath,N(_,`extra`,t.zipName??fe(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let k=Rwe(n),ce=Z9(_),le=[],ue=0,A=0;for(let e of ce){let t=$9(_,e),n=ee(e).size,r=Q9(t)?Bwe(e):0;le.push({path:t,bytes:n,lines:r}),ue+=n,t.startsWith(`telemetry/`)&&Q9(t)&&(A+=Vwe(e))}let j={applied:O};se!==null&&(j.secretScrub=se);let de={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:te.nodeVersion,platform:te.platform,arch:te.arch},host:{desktop:re,language:ie},contentDir:{pathSha256:zwe(t),absolutePath:O?`<CONTENT_DIR>`:t},telemetry:{localSink:k,otlpPushEnabled:h()},redaction:j,serverStatus:x,files:le};ne(N(_,`manifest.json`),`${JSON.stringify(de,null,2)}\n`);let pe=ce.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),me={totalBytes:ue,fileCount:le.length,docNameCount:A,contentDirVisible:pe,redacted:O},M=!1;return{stagingDir:_,manifest:de,summary:me,cleanup:()=>{M||(M=!0,D(_,{recursive:!0,force:!0}))}}}catch(e){throw D(_,{recursive:!0,force:!0}),e}}async function qwe(e){let{collected:t,outputPath:n}=e,r=pe(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Tye.ZipFile,a=Z9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(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 Jwe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,Kt.parse)(S(n,`utf-8`)),r=I7(t)?t.content:void 0,i=I7(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return ve(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 ve(e)}async function Ywe(e,t,n,r){let i=f9(t,e.logger),a=await Kwe({contentDir:Jwe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...WCe(i,e.userLogsDir??N(O(),`.ok`,`logs`)),...m9(e.cachesDir??N(O(),`Library`,`Caches`))],deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(pe(e.outputPath),{recursive:!0}),await qwe({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function Xwe(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9,r=e.readLanguage??D9;if(e.level===`full`&&t!==void 0)return Ywe(e,t,n,r);let{zipPath:i,summary:a}=await JCe({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:m9(e.cachesDir??N(O(),`Library`,`Caches`)),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}export{H5 as ALL_EDITOR_IDS,U5 as EDITOR_LABELS,l7 as EDITOR_TARGETS,eSe as HOSTS_WITH_USER_SKILL_DIR,FCe as LAUNCH_CONFIG_NAME,lwe as PATH_SHIM_BEGIN,dwe as PATH_SHIM_BLOCK_RE,uwe as PATH_SHIM_END,_Ce as addOkPathsToGitExclude,O7 as assertProjectPathSafe,Q5 as buildManagedServerEntry,ewe as buildMcpConfigDeclineEvent,twe as buildMcpConfigMigrateEvent,u9 as classifyExistingMcpEntry,Xwe as collectReportBundle,Xt as createTokenStore,VCe as defaultBugReportZipPath,Be as detectGh,zCe as detectInstalledEditors,mSe as editorConfigPathDisplay,pSe as editorEntryLocator,G7 as formatTrackedRemediation,bCe as getExcludedOkPaths,U7 as getOkArtifactPaths,X5 as isEntryUpToDate,$5 as isOwnManagedEntry,owe as loadConfig,Qt as makeLazyProbeTokenStore,d9 as okBugReportsDir,C9 as parseGitHubBlobUrl,swe as parseGitHubShareUrl,w9 as parseGitHubTreeUrl,S9 as parseGitUrl,fwe as pathInstallMarkerPath,JSe as previewContent,BCe as probeOwnManagedEditorMcpEntry,W7 as probeTrackedOkPaths,c9 as readExistingMcpEntry,yCe as readSharingMode,xCe as readSkillsShared,vo as redactContent,vCe as removeOkPathsFromGitExclude,XCe as removeOwnMcpEntry,oCe as removeProjectSkill,mwe as removeUserGlobalSkillBundle,nCe as resolveProjectRoot,iwe as runStop,SCe as setSkillsShared,y9 as truncatePriorEntry,E9 as userGlobalSkillBundleTargets,cwe as validateLocalFolderForShare,s9 as writeEditorMcpConfig,_we as writeProjectAiIntegrations,j7 as writeProjectSkill,RCe as writeUserMcpConfigs};
|
|
1525
1525
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as e}from"./init-NUPb6gHO.mjs";export{e as runInit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{ft as r}from"./sleep-OHCt3UoV.mjs";import{$ as i,Ss as a,X as o,es as s,zs as c}from"./src-DQgEWrUq.mjs";import{Br as l,Cr as u,Ea as d,Ir as f,Lr as p,Pn as m,Rr as h,Sn as g,Zr as _,an as v,ar as y,bn as b,c as x,hr as S,in as C,ir as ee,l as w,or as te,pr as ne,u as re,wr as ie,yn as ae}from"./src-Dhqa-DT-.mjs";import{F as T,N as oe}from"./fs-traced-uUie5siN.mjs";import{_ as se,a as ce,b as E,c as D,d as le,i as ue,l as de,o as fe,r as pe,t as me,u as he,v as ge}from"./write-project-skill-BfsBXTaY.mjs";import{i as O,n as k,o as A,r as j,s as M,t as N}from"./colors-BsmVIwfM.mjs";import{t as _e}from"./constants-C0QuALA7.mjs";import{t as P}from"./is-object-ByG7RnjH.mjs";import{t as ve}from"./preview-BbBZEvyk.mjs";import{createRequire as ye}from"node:module";import{execFileSync as be}from"node:child_process";import xe,{dirname as F,isAbsolute as Se,join as I,relative as L,resolve as Ce,sep as we}from"node:path";import R from"node:process";import{fileURLToPath as Te}from"node:url";import{existsSync as z,lstatSync as Ee,mkdirSync as De,readFileSync as B,readlinkSync as Oe,realpathSync as ke,statSync as Ae,writeFileSync as je}from"node:fs";import{homedir as Me}from"node:os";import*as Ne from"node:readline";import{inspect as Pe,stripVTControlCharacters as Fe,styleText as V}from"node:util";import{AsyncLocalStorage as Ie,AsyncResource as Le}from"node:async_hooks";const Re=new Set([`emacs`,`vim`]);function ze(e){return Re.has(e)}function Be(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(ze))):[]}const H=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ve=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,He=e=>e.name===`space`,Ue=e=>e.name===`backspace`,We=e=>`1234567890`.includes(e.name),Ge=e=>e.name===`enter`||e.name===`return`;var Ke=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Je=class extends Error{name=`ExitPromptError`},Ye=class extends Error{name=`HookError`},Xe=class extends Error{name=`ValidationError`};const Ze=new Ie;function Qe(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function $e(e,t){let n=Qe(e);return Ze.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function U(){let e=Ze.getStore();if(!e)throw new Ye(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function et(){return U().rl}function tt(e){return Le.bind((...t)=>{let n=U(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function nt(e){let t=U(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function rt(){U().handleChange()}const W={queue(e){let t=U(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(et());if(r!=null&&typeof r!=`function`)throw new Xe(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=U();tt(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=U();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function it(e){return typeof e==`function`}function G(e){return nt(t=>{let n=Le.bind(function(e){t.get()!==e&&(t.set(e),rt())});if(t.initialized)return[t.get(),n];let r=it(e)?e():e;return t.set(r),[r,n]})}function at(e,t){nt(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&W.queue(e),n.set(t)})}function ot(){return R.platform.startsWith(`win`)?!!R.env.CI||!!R.env.WT_SESSION||!!R.env.TERMINUS_SUBLIME||R.env.ConEmuTask===`{cmd::Cmder}`||R.env.TERM_PROGRAM===`Terminus-Sublime`||R.env.TERM_PROGRAM===`vscode`||R.env.TERM===`xterm-256color`||R.env.TERM===`alacritty`||R.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:R.env.TERM!==`linux`}const st={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},ct={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},lt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},ut={...st,...ct},dt={...st,...lt},K=ot()?ut:dt;Object.entries(ct);const ft={prefix:{idle:V(`blue`,`?`),done:V(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>V(`yellow`,e))},keybindings:[],style:{answer:e=>V(`cyan`,e),message:e=>V(`bold`,e),error:e=>V(`red`,`> ${e}`),defaultAnswer:e=>V(`dim`,`(${e})`),help:e=>V(`dim`,e),highlight:e=>V(`cyan`,e),key:e=>V(`cyan`,V(`bold`,`<${e}>`))}};function pt(){return{...ft,keybindings:Be()}}function mt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ht(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=mt(n)&&mt(r)?ht(n,r):r}return t}function gt(...e){return ht(pt(),...e.filter(e=>e!=null))}function _t({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=gt(t);return at(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function vt(e,t){return nt(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function yt(e){return G({current:e})[0]}function bt(e){let t=yt(e);t.current=e,at(e=>{let n=!1,r=tt((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var xt=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const St=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Ct=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,wt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Tt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Et=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Dt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Ot=/\t{1,1000}/y,kt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,At=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,jt=/\p{M}+/gu,Mt={limit:1/0,ellipsis:``},Nt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Nt(i,Mt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[At,l],[Tt,0],[Et,o],[Ot,s],[kt,c],[Dt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(jt,``)){let t=e.codePointAt(0)||0;if(S=Ct(t)?2:wt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Dt?St(e.slice(p,n.lastIndex)):n===kt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Pt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>Nt(e,Pt,t).width,Ft=`]8;;`,It=RegExp(`(?:\\[(?<code>\\d+)m|\\${Ft}(?<uri>.*))`,`y`),Lt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Rt=e=>`[${e}m`,zt=e=>`${Ft}${e}`,Bt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Ft,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Vt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ht=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Bt(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Bt(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Bt(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Vt(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{ft as r}from"./sleep-D_nNc7T_.mjs";import{$ as i,Ss as a,X as o,es as s,zs as c}from"./src-DMi2O7yV.mjs";import{Br as l,Cr as u,Ea as d,Ir as f,Lr as p,Pn as m,Rr as h,Sn as g,Zr as _,an as v,ar as y,bn as b,c as x,hr as S,in as C,ir as ee,l as w,or as te,pr as ne,u as re,wr as ie,yn as ae}from"./src-C6s1YGEs.mjs";import{F as T,N as oe}from"./fs-traced-xJfl5Rxd.mjs";import{_ as se,a as ce,b as E,c as D,d as le,i as ue,l as de,o as fe,r as pe,t as me,u as he,v as ge}from"./write-project-skill-G2p_hc1u.mjs";import{i as O,n as k,o as A,r as j,s as M,t as N}from"./colors-BsmVIwfM.mjs";import{t as _e}from"./constants-Cqj0SNOo.mjs";import{t as P}from"./is-object-ByG7RnjH.mjs";import{t as ve}from"./preview-DsEL6XB0.mjs";import{createRequire as ye}from"node:module";import{execFileSync as be}from"node:child_process";import xe,{dirname as F,isAbsolute as Se,join as I,relative as L,resolve as Ce,sep as we}from"node:path";import R from"node:process";import{fileURLToPath as Te}from"node:url";import{existsSync as z,lstatSync as Ee,mkdirSync as De,readFileSync as B,readlinkSync as Oe,realpathSync as ke,statSync as Ae,writeFileSync as je}from"node:fs";import{homedir as Me}from"node:os";import*as Ne from"node:readline";import{inspect as Pe,stripVTControlCharacters as Fe,styleText as V}from"node:util";import{AsyncLocalStorage as Ie,AsyncResource as Le}from"node:async_hooks";const Re=new Set([`emacs`,`vim`]);function ze(e){return Re.has(e)}function Be(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(ze))):[]}const H=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ve=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,He=e=>e.name===`space`,Ue=e=>e.name===`backspace`,We=e=>`1234567890`.includes(e.name),Ge=e=>e.name===`enter`||e.name===`return`;var Ke=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Je=class extends Error{name=`ExitPromptError`},Ye=class extends Error{name=`HookError`},Xe=class extends Error{name=`ValidationError`};const Ze=new Ie;function Qe(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function $e(e,t){let n=Qe(e);return Ze.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function U(){let e=Ze.getStore();if(!e)throw new Ye(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function et(){return U().rl}function tt(e){return Le.bind((...t)=>{let n=U(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function nt(e){let t=U(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function rt(){U().handleChange()}const W={queue(e){let t=U(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(et());if(r!=null&&typeof r!=`function`)throw new Xe(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=U();tt(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=U();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function it(e){return typeof e==`function`}function G(e){return nt(t=>{let n=Le.bind(function(e){t.get()!==e&&(t.set(e),rt())});if(t.initialized)return[t.get(),n];let r=it(e)?e():e;return t.set(r),[r,n]})}function at(e,t){nt(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&W.queue(e),n.set(t)})}function ot(){return R.platform.startsWith(`win`)?!!R.env.CI||!!R.env.WT_SESSION||!!R.env.TERMINUS_SUBLIME||R.env.ConEmuTask===`{cmd::Cmder}`||R.env.TERM_PROGRAM===`Terminus-Sublime`||R.env.TERM_PROGRAM===`vscode`||R.env.TERM===`xterm-256color`||R.env.TERM===`alacritty`||R.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:R.env.TERM!==`linux`}const st={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},ct={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},lt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},ut={...st,...ct},dt={...st,...lt},K=ot()?ut:dt;Object.entries(ct);const ft={prefix:{idle:V(`blue`,`?`),done:V(`green`,K.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>V(`yellow`,e))},keybindings:[],style:{answer:e=>V(`cyan`,e),message:e=>V(`bold`,e),error:e=>V(`red`,`> ${e}`),defaultAnswer:e=>V(`dim`,`(${e})`),help:e=>V(`dim`,e),highlight:e=>V(`cyan`,e),key:e=>V(`cyan`,V(`bold`,`<${e}>`))}};function pt(){return{...ft,keybindings:Be()}}function mt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ht(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=mt(n)&&mt(r)?ht(n,r):r}return t}function gt(...e){return ht(pt(),...e.filter(e=>e!=null))}function _t({status:e=`idle`,theme:t}){let[n,r]=G(!1),[i,a]=G(0),{prefix:o,spinner:s}=gt(t);return at(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function vt(e,t){return nt(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function yt(e){return G({current:e})[0]}function bt(e){let t=yt(e);t.current=e,at(e=>{let n=!1,r=tt((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var xt=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const St=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Ct=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,wt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,Tt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Et=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Dt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Ot=/\t{1,1000}/y,kt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,At=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,jt=/\p{M}+/gu,Mt={limit:1/0,ellipsis:``},Nt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Nt(i,Mt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[At,l],[Tt,0],[Et,o],[Ot,s],[kt,c],[Dt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(jt,``)){let t=e.codePointAt(0)||0;if(S=Ct(t)?2:wt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Dt?St(e.slice(p,n.lastIndex)):n===kt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Pt={limit:1/0,ellipsis:``,ellipsisWidth:0},q=(e,t={})=>Nt(e,Pt,t).width,Ft=`]8;;`,It=RegExp(`(?:\\[(?<code>\\d+)m|\\${Ft}(?<uri>.*))`,`y`),Lt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Rt=e=>`[${e}m`,zt=e=>`${Ft}${e}`,Bt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:q(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=q(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(Ft,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Vt=e=>{let t=e.split(` `),n=t.length;for(;n&&!q(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ht=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=q(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=q(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Bt(s,r,t),c=q(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Bt(s,r,t),c=q(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Bt(s,r,t),c=q(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Vt(e)));let l=s.join(`
|
|
2
2
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){It.lastIndex=e+1;let t=It.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
3
3
|
`){a&&(r+=zt(``));let e=i?Lt(i):void 0;i&&e&&(r+=Rt(e))}else t===`
|
|
4
4
|
`&&(i&&Lt(i)&&(r+=Rt(i)),a&&(r+=zt(a)))}return r},Ut=/\r?\n/;function Wt(e,t,n){return String(e).normalize().split(Ut).map(e=>Ht(e,t,n)).join(`
|
|
@@ -633,6 +633,6 @@ export default function okBridge(pi: {
|
|
|
633
633
|
`));let f=`${a?``:``}${u}`;return f!==i&&T(e,f,{mode:Hn(e)}),{kind:l?`overwritten`:`written`}}const bi=e=>e!==`project`,xi=e=>e!==`user`;async function Si(){let e=await Zn({message:`Where should the MCP server be configured?
|
|
634
634
|
`,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function Ci(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Si)():`both`}async function wi(e){return nr({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json, project skills)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function Ti(e){if(e.sharing!==void 0)return e.sharing;let t=kn(e.projectRoot)===`local-only`?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??wi)(t):t}var $=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function Ei(e){if(e===void 0||e===!0)return new Set(ie);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(ie.filter(e=>t.includes(e)))}function Di(e,t,n){let r=Ce(n,e),i;try{i=Ae(r)}catch(e){let t=e.code;throw t===`ENOENT`?new $(`--content-dir path does not exist: ${r}`):new $(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new $(`--content-dir must be a directory: ${r}`);let a=L(Oi(t),Oi(r));if(a.startsWith(`..`)||Se(a))throw new $(`--content-dir must be inside the project root (${t}); got ${r}`);return a===``?`.`:a}function Oi(e){try{return ke(e)}catch{return e}}const ki=`open-knowledge-ui`;function Ai(e,t,n){try{return z(e.detectPath?.(t,n)??F(e.configPath(t,n)))}catch{return!1}}function ji(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0;if(!i&&s&&!Ai(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{me(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Ni(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{De(F(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{oe(`${o}.lock`,()=>{let t=Yr(o).writePath;if(De(F(t),{recursive:!0}),e.format===`toml`){let n=vi(ri(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=yi(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=_i(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Mi={pi:Lr};function Ni(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=Mi[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{De(F(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{oe(`${t}.lock`,()=>{let e=null;try{e=B(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}T(t,c,e===null?void 0:{mode:Hn(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function Pi(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!z(n)))return{editorId:e.id,label:e.label,path:n}}function Fi(e,t,n,r){let i=Li(e,t,n,r);return i.kind===`present`?i.entry:null}function Ii(e,t,n,r){let i=gi(e,t,r);if(!P(i))return{kind:`no-entry`};let a=i[n];return P(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Li(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!z(i))return{kind:`absent`};try{if(Ae(i).size>di)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=B(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Ir(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ri().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Ii(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,Cn.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Ii(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=oi(a);return s?si(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Ii(p(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ri(e={}){let t=Ce(e.cwd??process.cwd()),n=Vr(t,{homeDir:e.home}),r=n.projectRoot,i=!z(I(r,`.ok`)),a=n.gitRootPromoted?L(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:Di(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${M(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let c={mode:e.devMcp?`dev`:`published`},l=await re(r),d;try{d=b(r,{contentDir:o})}catch(t){let i=fe.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let f=d.created.includes(_e),p=!1;if(l.didInit)try{p=g(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{ae(r)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore entry at ${r}: ${e instanceof Error?e.message:String(e)}`)}let m=await x(r);m.kind===`untracked`&&console.warn(`[ok] Untracked the OpenKnowledge project skill (${m.dirs.join(`, `)}) — it is now local-only. Teammates will see this as a deletion on their next pull.`);let h=await Ci({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),_=e.editors??Wi(r,e.home),v=e.editors??_,C=se(_),w=se(v),T=e.mcp===!1||h===null,oe=Array.from(new Map([...C,...T?[]:w].map(e=>[e.id,e])).values()),ce=C.filter(t=>Ai(t,r,e.home)),E=[],D=[],le=new Set;for(let t of oe){if(T){let n=``;try{n=t.configPath(r,e.home)}catch{}E.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(bi(h)&&C.includes(t)&&t.scope===`global`&&E.push(ji(t,r,c,e.home)),xi(h)&&w.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=ji(t,r,c,e.home,n);E.push(i),(i.action===`written`||i.action===`overwritten`)&&le.add(n)}}let ue=new Set;for(let t of w){let n=t.projectSkillPath?.(r);!n||ue.has(n)||(ue.add(n),D.push(pe(t,r,{home:e.home})))}let de=D.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(de.length>0){let t=e.home??Me();te({source:s,skills:[u.project],agents:de,scope:r},{home:t,enabled:S(t).enabled})}let me=!T&&h!==null&&xi(h)?w.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,he=T?[]:ce.map(e=>Pi(e,r)).filter(e=>e!==void 0).filter(e=>!le.has(e.path)),ge=e.installUserSkill??y,O=e.home??Me(),k=Ei(e.skills),A=!1,j=!1,N=!1,P=!1,ve=!1;for(let t of ie){if(!k.has(t))continue;await ne(O,u[t],!0).catch(()=>{}),A=!0;let n=await ge({home:e.home,bundleId:t,force:!0});n===`installed`?j=!0:n===`failed`?N=!0:n===`no-hosts`?ve=!0:P=!0}let ye=N?`failed`:j?`installed`:A&&P?`skip-current`:A&&ve?`no-hosts`:`declined`,be=j?ee(O).map(e=>e.editorId):[],xe=T?`skipped-flag`:`skipped-missing`,F=E.find(e=>e.editorId===`claude`)??E[0]??{action:xe,configPath:fe.claude.configPath(r,e.home)},Se=await zi({projectRoot:r,desiredMode:await Ti({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:d.created,contentUpdated:d.updated,contentSkipped:d.skipped,editors:E,projectSkills:D,legacyProjectConfigs:he,skillInstall:ye,skillHosts:be,didGitInit:l.didInit,rootGitignoreCreated:p,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:f?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:F.action,mcpPath:F.configPath,mcpError:`error`in F?F.error:void 0,projectScopeUnsupportedLabels:me,sharing:Se}}async function zi(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=kn(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=En(t);if(n===`local-only`){let e=Dn(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Bi(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=On(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Bi(t,o,`remove`)}function Bi(e,t,n){let r=kn(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:[]}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Vi(e){switch(e){case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;default:return`config not readable`}}function Hi(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=I(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(N(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(N(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(N(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(N(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(N(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?L(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${A(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${A(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${j(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Vi(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(N(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?L(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${A(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${A(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${j(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${L(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(N(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>ce[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${A(`installed for ${r}`)}`),n.push(` ${k(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${k(`Opt out: DO_NOT_TRACK=1, or Settings → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${A(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${k(`skipped for this run (--no-skills)`)}`),n.push(` ${k(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${k(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${k(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${k(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${M(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${M(` ok repair-skills`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(M(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(M(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(ve(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...qi(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${A(`✓`)} ${N(`Next steps:`)}`),n.push(` 1. Open your editor (${O(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${O(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${O(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
|
|
635
635
|
`)}function Ui(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Wi(e,t){let n=[];for(let r of ue)Ai(fe[r],e,t)&&n.push(r);return n}function Gi(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Pe(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Ki(){return new ge(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new E(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new E(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new E(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Gi():null;try{let r;try{r=await Ri({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof $){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof C||e instanceof v){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof w){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
|
|
636
|
-
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-
|
|
636
|
+
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-DH2qFFXE.mjs`),{resolveContentDir:s}=await import(`./src--C17TQmO.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-L8PxEh_R.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Ui(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Hi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function qi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(N(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?n.push(` ${A(`local-only`)} — appended ${e.appended.length} path(s) to ${N(`${t}/.git/info/exclude`)} (per-clone, not committed).`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${A(`local-only`)} — already excluded; nothing to do.`):n.push(` ${A(`local-only`)}`):e.action===`removed`?n.push(` ${A(`shared`)} — removed OK paths from ${N(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${A(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(M(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
|
|
637
637
|
`))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${O(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(M(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${O(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${O(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(M(`Sharing mode unavailable: ${e.reason}.`));return n}}export{En as A,G as B,Zn as C,Dn as D,Un as E,Sn as F,un as I,bt as L,kn as M,jn as N,Nn as O,On as P,_t as R,nr as S,Vn as T,Ge as V,mi as _,Ui as a,Vr as b,Hi as c,Fi as d,Ei as f,Ri as g,Ti as h,zi as i,Mn as j,An as k,qi as l,Di as m,ki as n,Li as o,Ci as p,Mi as r,Wi as s,$ as t,Ki as u,ji as v,Hn as w,Fr as x,ri as y,gt as z};
|
|
638
|
-
//# sourceMappingURL=init
|
|
638
|
+
//# sourceMappingURL=init-NUPb6gHO.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Br as e,Lr as t}from"./src-
|
|
2
|
-
//# sourceMappingURL=launch-json-removal-
|
|
1
|
+
import{Br as e,Lr as t}from"./src-C6s1YGEs.mjs";import{F as n}from"./fs-traced-xJfl5Rxd.mjs";import{E as r,w as i}from"./init-NUPb6gHO.mjs";import{t as a}from"./is-object-ByG7RnjH.mjs";import{join as o}from"node:path";import{existsSync as s,readFileSync as c,rmSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(f){let p=o(f,`.claude`,`launch.json`);if(!s(p))return{kind:`not-present`};let m;try{m=c(p,`utf-8`)}catch{return{kind:`declined`}}let h=[],g=e(m,h,u)??void 0;if(h.some(e=>!d(e,m))||!g||g.type!==`object`)return{kind:`declined`};let _=t(g).configurations;if(!Array.isArray(_))return{kind:`not-present`};let v=_.findIndex(e=>a(e)&&e.name===`open-knowledge-ui`);if(v===-1)return{kind:`not-present`};if(_.length===1)return l(p,{force:!0}),{kind:`removed-file`};let{text:y,changed:b}=r(m,[`configurations`,v]);return b?(n(p,y,{mode:i(p)}),{kind:`removed`}):{kind:`not-present`}}export{f as t};
|
|
2
|
+
//# sourceMappingURL=launch-json-removal-BZFnjRR8.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ft as e,h as t,l as n,p as r,u as i}from"./sleep-
|
|
2
|
-
//# sourceMappingURL=loader-
|
|
1
|
+
import{ft as e,h as t,l as n,p as r,u as i}from"./sleep-D_nNc7T_.mjs";import{ac as a,oc as o}from"./src-DMi2O7yV.mjs";import{_ as s}from"./src-C6s1YGEs.mjs";import{I as c,k as l}from"./fs-traced-xJfl5Rxd.mjs";import{t as u}from"./constants-Cqj0SNOo.mjs";import{t as d}from"./is-object-ByG7RnjH.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=e();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return d(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,n){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(n.doc!==null&&n.source!==null){let e=t({file:n.path,source:n.source,doc:n.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(e){let t=e??process.cwd(),d=[],p=[],m=[],h=[],g=l(`user`,t),_=c({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(e,t=!1)=>{let r=v(e);if(r.diagnostic!==void 0&&p.push(r.diagnostic),r.value===null)return{};let a=n({value:r.value,file:r.path,source:r.source,doc:r.doc});p.push(...a),d.push(e);let s=a.length>0?i(r.value):r.value;return t&&h.push(...o({value:s,file:r.path,source:r.source,doc:r.doc})),s},x=f(t,`.ok`,u),S=b(x,!0),C=b(l(`project-local`,t)),w=a(_.value,S,C),T=s.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(r(t))}return{config:T.data,sources:d,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
|
|
2
|
+
//# sourceMappingURL=loader-DG4WWofW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-DG4WWofW.mjs";export{e as loadConfig};
|