@inkeep/open-knowledge 0.87.5-beta.0 → 0.87.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +72 -72
- package/dist/constants-DpDsY5an.mjs +1 -0
- package/dist/dist-Be8q4E8P.mjs +2224 -0
- package/dist/{dist-catZfEB7.mjs → dist-CAVfTttU.mjs} +1 -1
- package/dist/index.mjs +6 -6
- package/dist/{init-B0HZTMrR.mjs → init-CAX7eVNx.mjs} +39 -39
- package/dist/init-DKprWOvJ.mjs +1 -0
- package/dist/{launch-json-removal-BkTNm3c-.mjs → launch-json-removal-Dxu_Lz6l.mjs} +1 -1
- package/dist/loader-Biutv0tI.mjs +1 -0
- package/dist/{loader-DP-nPPZA.mjs → loader-Df4p271f.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-DoZJSsFD.mjs → md-manager-BGnqyqi1-CU8xHS4D.mjs} +172 -172
- package/dist/{open-browser-Bouj-ci9.mjs → open-browser-BBYzWw_v.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-Cbp_rERj.mjs +1 -0
- package/dist/{preview-C92fHry_.mjs → preview-icmJu7Kd.mjs} +1 -1
- package/dist/public/assets/{AccountSection-CHLobgpO.js → AccountSection-6IC0PuC_.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-BCDNq6Vj.js → ActivityModeContent-D3vguJ9G.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-Df8YbLY4.js → AddPropertiesButton-CvP0prMu.js} +2 -2
- package/dist/public/assets/{AgentConnectionsSection-CrXyZ7s0.js → AgentConnectionsSection-CIV6IvM9.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-ClLlEwwH.js → AgentDiffPane-ClyLzIYU.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-BaNEINam.js → AttachmentsSection-Fa_a7uwJ.js} +1 -1
- package/dist/public/assets/{AuthModal-CiMWDLP2.js → AuthModal-BF2Z7OJL.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-BArPCB_D.js → CodeMirrorPropInput-Bp863w-S.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-D3U4OKY-.js → ContentRulesSection-BzYrpu5v.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-3eDWqiFB.js → DiffViewBoundary-Ct8EAcvE.js} +1 -1
- package/dist/public/assets/{DocumentContext-Bqs88KmQ.js → DocumentContext-CYEtGh9P.js} +2 -2
- package/dist/public/assets/{EditorModeToggle-CqGUDvi5.js → EditorModeToggle-DpVPuW6o.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-8vsPu1pP.js → ExcalidrawDocEditor-B5aDVmiH.js} +1 -1
- package/dist/public/assets/FeedbackForm-BVXqBFQp.js +1 -0
- package/dist/public/assets/{GraphPanel-CbJhUFdz.js → GraphPanel-Cjjh0X-I.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-FEorgbTw.js → ImportSkillDialog-DU8URPUN.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-4-TD7MMH.js → LinkPreviewsSection-B4Mb26O6.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-Db2YKLpK.js → LintConfigEditor-Bgcif27S.js} +1 -1
- package/dist/public/assets/{LintingSection-5q-82m8S.js → LintingSection-CrM7A9Pu.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-C4tDV1dh.js → ManagedArtifactProperties-CzDNg07Y.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-wAOzK2s4.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-DxwWgnS9.js → MermaidDocEditor-CFyc7az-.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-Bli_TwC9.js → NetworkAccessSection-D70-r8l0.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-Dm9jRJL0.js → ProjectTemplatesSection-WddJ1lhc.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-CGHweNEd.js → PropertyDisplayRow-CIPMHB1z.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-B2me1giD.js → PublishToGitHubDialog-BSewRvqe.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-g86u94_w.js → RegisteredAgentIcon-Bq2z3oRf.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-xdiDSy2g.js → SchemaConfigEditor-CFEd3Soc.js} +1 -1
- package/dist/public/assets/{SearchSection-Bf1V9QwZ.js → SearchSection-BqJPWJjo.js} +1 -1
- package/dist/public/assets/{SessionsHost-DM9lcsTc.js → SessionsHost-OlqCKR31.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-DftEF818.js → SettingsDialogBody-thd1s5Jf.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-BfsIZpEx.js → ShareReceiveMissDialog-YI2u6d7L.js} +1 -1
- package/dist/public/assets/{SkillCostValue-Cv4fxI3N.js → SkillCostValue-DDhTa5Kn.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-B7AI0Y-p.js → SkillForkDialog-BcgrUab0.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-ujjOQM8T.js → SkillInstallMenu-f08QXFO6.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-COdARBhh.js → SkillOriginInline-BQhnp-U4.js} +1 -1
- package/dist/public/assets/{SkillPluginBundleDialog-CriBEhj8.js → SkillPluginBundleDialog-AajGslYO.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-uynLsV5F.js → SkillToolbarControls-3am6dR2z.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-De-RcGVw.js → SkillsManagerSection-cOVbfp1s.js} +1 -1
- package/dist/public/assets/{SlidesPluginSection-dXy1hGNp.js → SlidesPluginSection-CayFA0zh.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-C79NF9Vc.js → SlidesToolbarControls-BTg9RQ0D.js} +1 -1
- package/dist/public/assets/{SourceEditor-GFY333ie.js → SourceEditor-CRCsnrFo.js} +1 -1
- package/dist/public/assets/{SpellingSettings-CdT9a_rM.js → SpellingSettings-C3gKNkGi.js} +1 -1
- package/dist/public/assets/{SyncSection-oPddlij9.js → SyncSection-C9fwr4y1.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-Byx3qoQq.js → SyncStatusBadge-Cj83WuBK.js} +1 -1
- package/dist/public/assets/{TemplateRow-DK66-N83.js → TemplateRow-B1g-a4Pw.js} +1 -1
- package/dist/public/assets/{TerminalLaunchContext-8h1FtRCM.js → TerminalLaunchContext-CGtoVZtX.js} +1 -1
- package/dist/public/assets/{TerminalPanel-BQ72xwRb.js → TerminalPanel-COTcQZbU.js} +1 -1
- package/dist/public/assets/{TerminalSection-DbfCiHbJ.js → TerminalSection-CWB1b2pE.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CaI80HFq.js → TerminalWindowApp-vThWyHoc.js} +1 -1
- package/dist/public/assets/{TextDocEditor-C-pM2yOa.js → TextDocEditor-CSKNTrXF.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-X00m8_oh.js → ThemePluginSection-Dhue16Q2.js} +1 -1
- package/dist/public/assets/{ThreadView-DesX-mmn.js → ThreadView-BT8OZ1HL.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-B6lBH3xv.js → TimelineDiffPane-COtkC6YJ.js} +1 -1
- package/dist/public/assets/{_envelope-q8XHEv4O-C-Qnl5Tu.js → _envelope-aSbxdSNI-BbmN1FUH.js} +1 -1
- package/dist/public/assets/{agent-connections-WVUAXE1-.js → agent-connections-DOlRC9J4.js} +1 -1
- package/dist/public/assets/{agent-registry-tQw4RviC.js → agent-registry-Dw7Mum0u.js} +1 -1
- package/dist/public/assets/{bridge-D0zaOiIE.js → bridge-C-lLcgzt.js} +1 -1
- package/dist/public/assets/{catalog-igkheV1C.js → catalog-BNmmHvVJ.js} +1 -1
- package/dist/public/assets/{client-version-DTnfpIjW.js → client-version-Dj7y7X2p.js} +1 -1
- package/dist/public/assets/{comment-chips-BtMos4uY.js → comment-chips-DvoKtv_l.js} +1 -1
- package/dist/public/assets/{config-provider-BJVaZWcl.js → config-provider-3wkoDnhc.js} +1 -1
- package/dist/public/assets/config-schema-GlF078Yz.js +1 -0
- package/dist/public/assets/{css-color-to-hex-CkzbmYKA.js → css-color-to-hex-Cnqvo0uF.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-BcgKArWo.js → doc-undo-manager-BYzRP5g6.js} +1 -1
- package/dist/public/assets/{field-controls-BiNEe5aI.js → field-controls-BwRnSCqe.js} +1 -1
- package/dist/public/assets/field-controls-OOVz_aSI.js +1 -0
- package/dist/public/assets/{handoff-DzPPe6fp.js → handoff-BDTTOcb6.js} +1 -1
- package/dist/public/assets/{ime-composition-BAiFUm_0.js → ime-composition-C6RElBur.js} +1 -1
- package/dist/public/assets/{index-C9Dhh52J.js → index-DHUYes5V.js} +125 -125
- package/dist/public/assets/{lint-config-client-N8fwiy94.js → lint-config-client-CkU0vqu3.js} +1 -1
- package/dist/public/assets/{lint-plugins-B41rezsy.js → lint-plugins-V3EMqFLw.js} +1 -1
- package/dist/public/assets/{markdown-lint-DXOOOaOH.js → markdown-lint-BDbIoz4f.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-Bp3fW5jF.js → markdownlint-rule-browser-B7stW6Oh.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-B9uyVDcN.js → pending-receive-nav-store-Dd1br4ja.js} +1 -1
- package/dist/public/assets/{preferred-session-events-lXAuS48Q.js → preferred-session-events-XveQLNcI.js} +1 -1
- package/dist/public/assets/{progress-C0gt7LAt.js → progress-ROPletxo.js} +1 -1
- package/dist/public/assets/{saved-themes-client-D8SE9Dxo.js → saved-themes-client-B3RNutYm.js} +1 -1
- package/dist/public/assets/{schema-section-QQLWvNa_.js → schema-section-B7Ec9YkJ.js} +1 -1
- package/dist/public/assets/{schemas-api-CxajedMJ.js → schemas-api-DYoYU1Zh.js} +2 -2
- package/dist/public/assets/{selection-context-Bpox3Yhn.js → selection-context-Df0KmJCv.js} +1 -1
- package/dist/public/assets/{skills-api-BA63vOx_.js → skills-api-DPNzK8ks.js} +1 -1
- package/dist/public/assets/{src-DvFRMb_f.js → src-DSVx1YPZ.js} +1 -1
- package/dist/public/assets/storage-scope-D82mTrBx.js +1 -0
- package/dist/public/assets/{tag-pill-input--UfEq84b.js → tag-pill-input-CHT8aIYs.js} +1 -1
- package/dist/public/assets/{telemetry-impl-C3w8nakT.js → telemetry-impl-C8N3qCpc.js} +1 -1
- package/dist/public/assets/{telemetry-startup-6J8BtuaH.js → telemetry-startup-DIO-T71a.js} +1 -1
- package/dist/public/assets/terminal-cli-display-B__FxqFM.js +1 -0
- package/dist/public/assets/{terminal-command-events-h-p66odT.js → terminal-command-events-DEYKqKZt.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-DHPVU8Cu.js → terminal-launch-events-Bg7uGfvu.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-qyrW2QW_.js → typing-burst-detector-B6bKsypc.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DdkcoGpF.js → use-activity-panel-CF3KFrd9.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-QBoEiHRM.js → use-apply-config-color-theme-KcqN_kbT.js} +1 -1
- package/dist/public/assets/{use-conflicts-DZvpR_hq.js → use-conflicts-2mx0_ZrI.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-COXlqksJ.js → use-live-xterm-theme-BD2co7eQ.js} +1 -1
- package/dist/public/assets/{use-open-skill-CZ1zDukA.js → use-open-skill-CRn4rlJ-.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-BENQM7pt.js → use-semantic-search-status-DdF3HjO-.js} +1 -1
- package/dist/public/assets/{use-skill-origin-H8JMxGxS.js → use-skill-origin-DKeppfSH.js} +1 -1
- package/dist/public/assets/{use-skill-targets-DJsi-lk-.js → use-skill-targets-DuCl3F30.js} +1 -1
- package/dist/public/assets/{use-skills-BQFGJ-V4.js → use-skills-BxAjFPL9.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-BXdPTHGz.js → use-terminal-enabled-CGbqSTTh.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-Dk-vSJNV.js → use-timeline-entry-diff-CLv-FT2j.js} +1 -1
- package/dist/public/assets/{use-workspace-DLEb_ZeP.js → use-workspace-CFQdH1aL.js} +1 -1
- package/dist/public/index.html +51 -51
- package/dist/{registry-probes-DR7RHs-x.mjs → registry-probes-BH7U4quJ.mjs} +3 -3
- package/dist/{removal-file-path-q6DdNYPp.mjs → removal-file-path-DBusekL7.mjs} +1 -1
- package/dist/{repair-launch-json-I57zhKjr.mjs → repair-launch-json-nZw0r3iQ.mjs} +1 -1
- package/dist/{repair-mcp-configs-CIePXQjA.mjs → repair-mcp-configs-9NUper1w.mjs} +1 -1
- package/dist/src-ChGfUh2I.mjs +1 -0
- package/dist/src-XxTqG9KM.mjs +16 -0
- package/dist/{start-BzsIwG3Z.mjs → start-5VcppmHb.mjs} +3 -3
- package/dist/start-oDeJSMOK.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-BTkEHXzz.mjs +0 -1
- package/dist/dist-Cv2PQOLP.mjs +0 -2221
- package/dist/init-Cxpu4pbQ.mjs +0 -1
- package/dist/loader-B3hEOQVY.mjs +0 -1
- package/dist/preview-BOXXnhBV.mjs +0 -1
- package/dist/public/assets/FeedbackForm-C49v3vCV.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-RV8k9v_W.js +0 -1
- package/dist/public/assets/config-schema-B1_3y0l5.js +0 -1
- package/dist/public/assets/field-controls-DDgmYrsM.js +0 -1
- package/dist/public/assets/storage-scope-DKwOLa7W.js +0 -1
- package/dist/public/assets/terminal-cli-display-nVuidfOl.js +0 -1
- package/dist/src-C6hpRK1Z.mjs +0 -16
- package/dist/src-CI-IG26s.mjs +0 -1
- package/dist/start-DXv1zj_Z.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -189,7 +189,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
189
189
|
`)].join(`
|
|
190
190
|
`);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
|
|
191
191
|
`))n.push(` ${t}`);return n.join(`
|
|
192
|
-
`)}case`NOT_SYNCED`:return`Settings are still loading. Try again in a moment.`;case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function kie(e,t,n){return Zd([e,t,n],[])}function Zd(e,t){if(t.length>0){let n=mu(du,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=Aie(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>jie(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=Zd(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function Aie(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function jie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Mie=Object.freeze([`__config__/project`,`__local__/project`,`__user__/config.yml`,`__config__/okignore`]),Qd=[`project`,`global`];function Nie(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}const $d=[`.mdx`,`.md`],ef={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},Pie=rt.stable.mcpServerName,Fie=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`];function Iie(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const tf=V(L().min(1)).max(50),Lie=W([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Rie=H({label:L().min(1),webUrl:Ri().nullable(),transport:W([`https`,`http`,`ssh`,`git`]).optional()}).loose(),zie=ha(`checkStatus`,[H({checkStatus:G(`allowed`)}).loose(),H({checkStatus:G(`denied`),deniedReason:W([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:L().optional(),declaredLogin:L().optional(),declaredSource:L().optional()}).loose(),H({checkStatus:G(`unknown`),unknownError:W([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),nf=W([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),Bie=W(_c),Vie=W([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);H({state:Lie,lastSyncUtc:L().nullable(),lastRunUtc:L().nullable().optional(),lastPullOkUtc:L().nullable().optional(),lastPushOkUtc:L().nullable().optional(),lastFetchUtc:L().nullable(),lastPushedSha:L().nullable(),ahead:R().int().min(0),behind:R().int().min(0),consecutiveFailures:R().int().min(0),consecutivePushFailures:R().int().min(0).optional(),conflictCount:R().int().min(0),hasRemote:z(),syncEnabled:z(),identityUnresolved:z(),remote:Rie.nullable().optional(),pushError:L().optional(),pushErrorCode:nf.optional(),pullError:L().optional(),pullErrorCode:nf.optional(),pausedReason:L().optional(),blockingPaths:V(L().min(1)).optional(),refusedSymlinkPaths:tf.optional(),pushPermission:zie.optional(),syncMode:Bie.optional(),lastPullUtc:L().nullable().optional(),lastPullOutcome:Vie.nullable().optional()}).loose(),H({action:W([`commit`]),paths:V(L().min(1)),commitSha:L().optional()}).loose(),H({action:W([`commit`])}).loose(),H({op:W([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),H({op:W([`sync`,`push`,`pull`,`fetch`])}).loose();const rf=W([`merge-native`,`working-tree`,`reconcile`]),af=W([`merged-with-markers`,`refused-conflict-markers`,`refused-no-base`,`refused-too-large`,`disk-markers`,`stale-external-write`]),Hie=W([`mine`,`theirs`,`content`,`delete`]);H({conflicts:V(H({file:L().min(1),detectedAt:L().min(1),conflict:rf,reason:af.optional().catch(void 0),conflictKind:W([`git`,`stale-external-write`]).optional(),docName:L().nullable(),theirsSha:L().optional(),baseSha:L().optional()}).loose())}).loose(),H({file:L().min(1),strategy:W([`mine`,`theirs`,`content`,`delete`]),content:L().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),H({}).loose(),H({file:L().min(1),base:L(),ours:L(),theirs:L(),kind:W([`both-modified`,`delete-modify`,`modify-delete`]),conflict:rf,reason:af.optional().catch(void 0),conflictKind:W([`git`,`stale-external-write`]).optional(),resolutionOptions:V(Hie)}).loose(),H({plan:Oa(e=>e!==void 0,{message:`plan is required`})}).loose(),H({plan:Oa(e=>e!==void 0,{message:`plan is required`})}).loose(),H({result:Oa(e=>e!==void 0,{message:`result is required`})}).loose(),H({packId:L().min(1)}).strict(),H({installedHosts:V(L()),skills:V(H({name:L().min(1),created:z()}).strict())}).strict();const Uie=H({path:L().min(1),summary:L().min(1)}).loose(),Wie=H({files:R().int().nonnegative(),folders:R().int().nonnegative()}).loose();H({packs:V(H({id:L().min(1),name:L().min(1),description:L().min(1),defaultSubfolder:L().optional(),folders:V(Uie),entryCounts:Wie}).loose())}).loose(),H({noOpen:z().optional(),out:L().min(1).optional()}).loose();const Gie=H({reason:W([`unsupported-platform`,`spawn-error`]),message:L()}).loose();ha(`status`,[H({status:G(`installed`),outputPath:L(),size:R().int().nonnegative(),sha256:L(),skillVersion:L()}).loose(),H({status:G(`built`),outputPath:L(),size:R().int().nonnegative(),sha256:L(),skillVersion:L(),handoffError:Gie.optional()}).loose(),H({status:G(`failed`),buildError:L()}).loose(),H({status:G(`skip-current`),skillVersion:L(),recordedAt:L().optional()}).loose()]),ha(`kind`,[H({kind:G(`doc`),docPath:L().min(1)}).loose(),H({kind:G(`folder`),folderPath:L()}).loose()]);const of=W([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),sf=W([`current`,`stale`,`absent`,`empty`]);ha(`ok`,[H({ok:G(!0),shareUrl:L().min(1),sharedUrl:L().min(1),branch:L().min(1),freshness:sf.optional().catch(void 0)}).loose(),H({ok:G(!1),error:of,branch:L().min(1).optional()}).loose()]);const Kie=W([`user`,`org`]),qie=H({login:L().min(1),kind:Kie,avatarUrl:L().optional()}).loose(),cf=W([`auth-required`,`network`]);ha(`ok`,[H({ok:G(!0),owners:V(qie)}).loose(),H({ok:G(!1),error:cf}).loose()]),ha(`ok`,[H({ok:G(!0),available:z()}).loose(),H({ok:G(!1),error:cf}).loose()]);const Jie=W([`public`,`private`]);H({owner:L().min(1),name:L().min(1),visibility:Jie,description:L().optional()}).loose();const Yie=W([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);ha(`ok`,[H({ok:G(!0),ownerLogin:L().min(1),repoName:L().min(1),cloneUrl:L().min(1),defaultBranch:L().min(1)}).loose(),H({ok:G(!1),error:Yie}).loose()]);function lf(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const uf=e=>e.refine(lf,`invalid branch name`),df={shareTargetExists:z(),dirtyConflicts:H({conflicts:z(),files:V(L().min(1))}).loose(),branchIsLocal:z(),shareTargetOnOriginBranch:z().optional()};ha(`detached`,[H({detached:G(!1),currentBranch:L().min(1).nullable(),currentHeadSha:aa(),...df}).loose(),H({detached:G(!0),currentBranch:aa(),currentHeadSha:L().min(1),...df}).loose()]),H({branch:uf(L().min(1)),principalId:L().optional(),fastForward:z().optional()}).loose();const Xie=W([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`,`unsafe-symlinks`,`symlink-check-failed`]);ha(`ok`,[H({ok:G(!0)}).loose(),H({ok:G(!1),reason:Xie,files:V(L().min(1)).optional(),otherWorktreePath:L().min(1).optional(),refusedSymlinkPaths:tf.optional()}).loose()]),W([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),H({branch:uf(L().min(1)),path:L(),kind:W([`doc`,`folder`]),contentRootDepth:R().int().min(1).max(65535).optional()}).loose(),ha(`verdict`,[H({verdict:G(`on-origin`)}).loose(),H({verdict:G(`renamed`),renamedTo:L().min(1)}).loose(),H({verdict:G(`deleted`)}).loose(),H({verdict:G(`never-on-branch`)}).loose(),H({verdict:G(`changed-locally`)}).loose(),H({verdict:G(`unknown`)}).loose()]).catch({verdict:`unknown`});function Zie(e){return e>=0&&e<=31&&e!==9&&e!==10&&e!==13}function ff(e,t,n=[]){for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(Zie(i)){t.addIssue({code:`custom`,path:n,params:{contentControlAdmission:!0},message:`Disallowed content control U+${i.toString(16).toUpperCase().padStart(4,`0`)} at zero-based UTF-16 offset ${r}. C0 controls allow only TAB, LF and CR. Remove the character or replace it with a printable escape such as \\u0000.`});return}}}const pf=L().superRefine(ff);function mf(e,t){let n=Iie(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const hf=L().superRefine(mf).optional(),Qie=L().superRefine(mf),gf={agentId:L().optional(),agentName:L().optional(),colorSeed:L().optional(),clientName:L().optional(),clientVersion:L().optional(),label:L().optional()},_f=L().optional(),$ie=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,eae=H({startedAt:L().min(1),httpListenMs:R().nonnegative().optional(),seedWalkMs:R().nonnegative().optional(),indexesMs:R().nonnegative().optional(),readyMs:R().nonnegative().optional(),fileCount:R().nonnegative().optional()});H({serverInstanceId:L().min(1),currentBranch:L().min(1).optional(),currentDiskAckSVs:U(L().min(1),L().min(1)).optional(),boot:eae.optional(),collabClients:R().int().nonnegative().optional(),runtimeVersion:L().min(1).optional(),protocolVersion:R().int().positive().optional()}).loose(),H({id:L().min(1),display_name:L().min(1),display_email:L(),source:W([`git-config`,`synthesized`]),created_at:L().min(1)}).loose(),H({collabUrl:L().nullable(),previewUrl:L().nullable(),port:R(),singleFile:z().default(!1)}).loose();const vf=W(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:symlink-refused.urn:ok:error:links-not-permitted.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:unsupported-media-type.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:stale-external-write.urn:ok:error:store-refused.urn:ok:error:doc-removed.urn:ok:error:branch-switched.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),tae=H({type:vf,title:L().min(1),status:R().int().min(400).max(599),instance:L().regex($ie,`instance must be urn:uuid:<uuid>`).optional(),detail:L().optional()}).loose();H({parentDocName:L().min(1),placement:W([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:L().min(1).optional(),agentName:L().min(1).optional()}).loose(),H({src:L().min(1),path:L().min(1).optional(),deduped:z().optional()}).loose(),H({url:L().min(1),dir:L().min(1),branch:L().min(1).refine(lf,`invalid branch name`).optional()}).loose(),H({type:G(`error`),problem:tae}).loose(),H({docName:hf,summary:_f,content:pf.optional(),...gf}).loose(),H({docName:hf,summary:_f,markdown:pf,position:W([`append`,`prepend`,`replace`]).optional(),extension:W($d).optional(),...gf}).loose(),H({docName:hf,summary:_f,find:L().min(1),replace:pf,offset:R().int().nonnegative().optional(),...gf}).loose(),H({docName:hf,connectionId:L().min(1),scope:W([`last`,`session`,`file`,`count`]).optional(),count:R().int().positive().optional(),...gf}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});const yf=H({value:L(),truncatedFrom:R().int().nonnegative().optional(),hint:L().optional()}).loose(),nae=ha(`kind`,[H({kind:G(`inline`),content:L()}),H({kind:G(`truncated`),byteLength:R().int().nonnegative(),hint:L()})]),bf=H({kind:G(`content-divergence`),intendedBytes:R().int().nonnegative(),actualBytes:R().int().nonnegative(),byteDelta:R().int(),divergenceType:L().optional(),currentState:nae.optional(),hint:L().optional()}).loose(),rae=H({type:G(`orphan`),parentCandidates:V(L()),message:L()}).loose(),xf=H({kind:G(`disk-edit-reconciled`),intendedBytes:R().int().nonnegative(),actualBytes:R().int().nonnegative(),byteDelta:R().int(),mergeOutcome:L().optional(),duplicatedBlocks:R().int().nonnegative().optional(),restoredDeletedHere:R().int().nonnegative().optional(),restoredDeletedOutside:R().int().nonnegative().optional(),nextStep:L().optional(),hint:L().optional()}).loose();ha(`kind`,[bf,xf]);const iae=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0}),aae=H({kind:G(`mermaid-parse-error`),fenceIndex:R().int().positive(),fenceFirstLine:L(),message:L(),line:R().int().positive().optional()}).loose(),Sf=H({href:L(),targetKind:L(),role:L(),sourceForm:L(),resolvedTarget:L().nullable(),reason:L(),resolutionMethod:L(),fallbackTarget:L().nullable().optional(),definition:H({line:R().int().nonnegative(),label:L()}).loose().optional()}).loose(),Cf=ha(`kind`,[bf,xf,aae,H({kind:G(`lint-violation`),source:L(),code:L(),message:L(),severity:W([`error`,`warning`,`info`,`hint`]),line:R().int().positive(),column:R().int().positive(),linkTarget:L().optional(),localTarget:Sf.optional()}).loose(),H({kind:G(`link-check-deferred`),message:L()}).loose()]),wf=V(Cf).min(1),Tf=H({href:L(),resolvedTo:L().nullable(),reason:W([`no-such-doc`,`no-such-file`,`unresolvable`,`excluded`]),localTarget:Sf.optional()}).loose(),Ef=V(Tf),Df=H({reason:L().min(1),count:R().int().positive()}).loose();H({timestamp:L().min(1),summary:yf.optional(),warnings:wf.optional()}).loose(),H({timestamp:L().min(1),subscriberCount:R().int().nonnegative(),systemSubscriberCount:R().int().nonnegative(),hints:V(rae).optional(),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose(),H({timestamp:L().min(1),subscriberCount:R().int().nonnegative(),systemSubscriberCount:R().int().nonnegative(),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose(),H({docName:L().min(1),scope:W([`last`,`session`,`count`]),undone:z()}).loose(),H({docs:V(H({docName:Qie,markdown:pf,position:W([`append`,`prepend`,`replace`]).optional(),extension:W($d).optional(),summary:_f}).loose()).min(1).max(100),...gf}).loose();const oae=H({type:vf,title:L(),detail:L().optional()}).loose(),sae=ha(`status`,[H({status:G(`written`),docName:L().min(1),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose(),H({status:G(`error`),docName:L().min(1),error:oae}).loose()]);H({timestamp:L().min(1),results:V(sae),written:R().int().nonnegative(),failed:R().int().nonnegative()}).loose(),H({docName:hf,patch:U(L(),ma([So,aa()])),types:U(L(),W(bo)).optional(),summary:_f,...gf}).loose(),H({timestamp:L().min(1),subscriberCount:R().int().nonnegative(),systemSubscriberCount:R().int().nonnegative(),appliedKeys:V(L()),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose();function Of(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const kf=Rf(/[A-Za-z]/),Af=Rf(/[\dA-Za-z]/),cae=Rf(/[#-'*+\--9=?A-Z^-~]/);function jf(e){return e!==null&&(e<32||e===127)}const Mf=Rf(/\d/),lae=Rf(/[\dA-Fa-f]/),uae=Rf(/[!-/:-@[-`{-~]/);function Nf(e){return e!==null&&e<-2}function Pf(e){return e!==null&&(e<0||e===32)}function Ff(e){return e===-2||e===-1||e===32}const If=Rf(/\p{P}|\p{S}/u),Lf=Rf(/\s/);function Rf(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function zf(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}const Bf=(function(e,t,n,r,i){let a=Vf(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error(`Expected positive finite index`);if(r!=null&&(!Bf(r)||!r.children))throw Error(`Expected parent node`);if(r==null!=(n==null))throw Error(`Expected both parent and index`);return Uf(e)?a.call(i,e,n,r):!1}),Vf=(function(e){if(e==null)return mae;if(typeof e==`function`)return Hf(e);if(typeof e==`object`)return Array.isArray(e)?dae(e):fae(e);if(typeof e==`string`)return pae(e);throw Error(`Expected function, string, or object as test`)});function dae(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Vf(e[n]);return Hf(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function fae(e){let t=e;return Hf(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function pae(e){return Hf(t);function t(t){return t&&t.type===e}}function Hf(e){return t;function t(t,n,r){return!!(Uf(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function mae(){return!0}function Uf(e){return typeof e==`object`&&!!e&&`type`in e}function hae(e){return`\x1B[33m`+e+`\x1B[39m`}const Wf=[],Gf=`skip`;function Kf(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Vf(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+hae(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Wf,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=gae(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function gae(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Wf:[e]}function _ae(e,t,n){let r=Vf((n||{}).ignore||[]),i=vae(t),a=-1;for(;++a<i.length;)Kf(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function vae(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([yae(e[0]),bae(e[1])])}return t}function yae(e){return typeof e==`string`?new RegExp(zf(e),`g`):e}function bae(e){return typeof e==`function`?e:function(){return e}}const qf=`phrasing`,Jf=[`autolink`,`link`,`image`,`label`];function xae(){return{transforms:[Oae],enter:{literalAutolink:Cae,literalAutolinkEmail:Yf,literalAutolinkHttp:Yf,literalAutolinkWww:Yf},exit:{literalAutolink:Dae,literalAutolinkEmail:Eae,literalAutolinkHttp:wae,literalAutolinkWww:Tae}}}function Sae(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:qf,notInConstruct:Jf},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:qf,notInConstruct:Jf},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:qf,notInConstruct:Jf}]}}function Cae(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Yf(e){this.config.enter.autolinkProtocol.call(this,e)}function wae(e){this.config.exit.autolinkProtocol.call(this,e)}function Tae(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Eae(e){this.config.exit.autolinkEmail.call(this,e)}function Dae(e){this.exit(e)}function Oae(e){_ae(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,kae],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Aae]],{ignore:[`link`,`linkReference`]})}function kae(e,t,n,r,i){let a=``;if(!Xf(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!jae(n)))return!1;let o=Mae(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Aae(e,t,n,r){return!Xf(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function jae(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Mae(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Of(e,`(`),a=Of(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Xf(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Lf(n)||If(n))&&(!t||n!==47)}function Zf(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}Qf.peek=Vae;function Nae(){this.buffer()}function Pae(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Fae(){this.buffer()}function Iae(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Lae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zf(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Rae(e){this.exit(e)}function zae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zf(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Bae(e){this.exit(e)}function Vae(){return`[`}function Qf(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Hae(){return{enter:{gfmFootnoteCallString:Nae,gfmFootnoteCall:Pae,gfmFootnoteDefinitionLabelString:Fae,gfmFootnoteDefinition:Iae},exit:{gfmFootnoteCallString:Lae,gfmFootnoteCall:Rae,gfmFootnoteDefinitionLabelString:zae,gfmFootnoteDefinition:Bae}}}function Uae(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Qf},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
192
|
+
`)}case`NOT_SYNCED`:return`Settings are still loading. Try again in a moment.`;case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function kie(e,t,n){return Zd([e,t,n],[])}function Zd(e,t){if(t.length>0){let n=mu(du,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=Aie(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>jie(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=Zd(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function Aie(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function jie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Mie=Object.freeze([`__config__/project`,`__local__/project`,`__user__/config.yml`,`__config__/okignore`]),Qd=[`project`,`global`];function Nie(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}const $d=[`.mdx`,`.md`],ef={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},Pie=rt.stable.mcpServerName,Fie=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`];function Iie(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}const tf=V(L().min(1)).max(50),Lie=W([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Rie=H({label:L().min(1),webUrl:Ri().nullable(),transport:W([`https`,`http`,`ssh`,`git`]).optional()}).loose(),zie=ha(`checkStatus`,[H({checkStatus:G(`allowed`)}).loose(),H({checkStatus:G(`denied`),deniedReason:W([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:L().optional(),declaredLogin:L().optional(),declaredSource:L().optional()}).loose(),H({checkStatus:G(`unknown`),unknownError:W([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),nf=W([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),Bie=W(_c),Vie=W([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);H({state:Lie,lastSyncUtc:L().nullable(),lastRunUtc:L().nullable().optional(),lastPullOkUtc:L().nullable().optional(),lastPushOkUtc:L().nullable().optional(),lastFetchUtc:L().nullable(),lastPushedSha:L().nullable(),ahead:R().int().min(0),behind:R().int().min(0),consecutiveFailures:R().int().min(0),consecutivePushFailures:R().int().min(0).optional(),conflictCount:R().int().min(0),hasRemote:z(),syncEnabled:z(),identityUnresolved:z(),remote:Rie.nullable().optional(),pushError:L().optional(),pushErrorCode:nf.optional(),pullError:L().optional(),pullErrorCode:nf.optional(),pausedReason:L().optional(),blockingPaths:V(L().min(1)).optional(),refusedSymlinkPaths:tf.optional(),pushPermission:zie.optional(),syncMode:Bie.optional(),lastPullUtc:L().nullable().optional(),lastPullOutcome:Vie.nullable().optional()}).loose(),H({action:W([`commit`]),paths:V(L().min(1)),commitSha:L().optional()}).loose(),H({action:W([`commit`])}).loose(),H({op:W([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),H({op:W([`sync`,`push`,`pull`,`fetch`])}).loose();const rf=W([`merge-native`,`working-tree`,`reconcile`]),af=W([`merged-with-markers`,`refused-conflict-markers`,`refused-no-base`,`refused-too-large`,`disk-markers`,`stale-external-write`]),Hie=W([`mine`,`theirs`,`content`,`delete`]);H({conflicts:V(H({file:L().min(1),detectedAt:L().min(1),conflict:rf,reason:af.optional().catch(void 0),conflictKind:W([`git`,`stale-external-write`]).optional(),docName:L().nullable(),theirsSha:L().optional(),baseSha:L().optional()}).loose())}).loose(),H({file:L().min(1),strategy:W([`mine`,`theirs`,`content`,`delete`]),content:L().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),H({}).loose(),H({file:L().min(1),base:L(),ours:L(),theirs:L(),kind:W([`both-modified`,`delete-modify`,`modify-delete`]),conflict:rf,reason:af.optional().catch(void 0),conflictKind:W([`git`,`stale-external-write`]).optional(),resolutionOptions:V(Hie)}).loose(),H({plan:Oa(e=>e!==void 0,{message:`plan is required`})}).loose(),H({plan:Oa(e=>e!==void 0,{message:`plan is required`})}).loose(),H({result:Oa(e=>e!==void 0,{message:`result is required`})}).loose(),H({packId:L().min(1)}).strict(),H({installedHosts:V(L()),skills:V(H({name:L().min(1),created:z()}).strict())}).strict();const Uie=H({path:L().min(1),summary:L().min(1)}).loose(),Wie=H({files:R().int().nonnegative(),folders:R().int().nonnegative()}).loose();H({packs:V(H({id:L().min(1),name:L().min(1),description:L().min(1),defaultSubfolder:L().optional(),folders:V(Uie),entryCounts:Wie}).loose())}).loose(),H({noOpen:z().optional(),out:L().min(1).optional()}).loose();const Gie=H({reason:W([`unsupported-platform`,`spawn-error`]),message:L()}).loose();ha(`status`,[H({status:G(`installed`),outputPath:L(),size:R().int().nonnegative(),sha256:L(),skillVersion:L()}).loose(),H({status:G(`built`),outputPath:L(),size:R().int().nonnegative(),sha256:L(),skillVersion:L(),handoffError:Gie.optional()}).loose(),H({status:G(`failed`),buildError:L()}).loose(),H({status:G(`skip-current`),skillVersion:L(),recordedAt:L().optional()}).loose()]),ha(`kind`,[H({kind:G(`doc`),docPath:L().min(1)}).loose(),H({kind:G(`folder`),folderPath:L()}).loose()]);const of=W([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),sf=W([`current`,`stale`,`absent`,`empty`]);ha(`ok`,[H({ok:G(!0),shareUrl:L().min(1),sharedUrl:L().min(1),branch:L().min(1),freshness:sf.optional().catch(void 0)}).loose(),H({ok:G(!1),error:of,branch:L().min(1).optional()}).loose()]);const Kie=W([`user`,`org`]),qie=H({login:L().min(1),kind:Kie,avatarUrl:L().optional()}).loose(),cf=W([`auth-required`,`network`]);ha(`ok`,[H({ok:G(!0),owners:V(qie)}).loose(),H({ok:G(!1),error:cf}).loose()]),ha(`ok`,[H({ok:G(!0),available:z()}).loose(),H({ok:G(!1),error:cf}).loose()]);const Jie=W([`public`,`private`]);H({owner:L().min(1),name:L().min(1),visibility:Jie,description:L().optional()}).loose();const Yie=W([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);ha(`ok`,[H({ok:G(!0),ownerLogin:L().min(1),repoName:L().min(1),cloneUrl:L().min(1),defaultBranch:L().min(1)}).loose(),H({ok:G(!1),error:Yie}).loose()]);function lf(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const uf=e=>e.refine(lf,`invalid branch name`),df={shareTargetExists:z(),dirtyConflicts:H({conflicts:z(),files:V(L().min(1))}).loose(),branchIsLocal:z(),shareTargetOnOriginBranch:z().optional()};ha(`detached`,[H({detached:G(!1),currentBranch:L().min(1).nullable(),currentHeadSha:aa(),...df}).loose(),H({detached:G(!0),currentBranch:aa(),currentHeadSha:L().min(1),...df}).loose()]),H({branch:uf(L().min(1)),principalId:L().optional(),fastForward:z().optional()}).loose();const Xie=W([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`,`unsafe-symlinks`,`symlink-check-failed`]);ha(`ok`,[H({ok:G(!0)}).loose(),H({ok:G(!1),reason:Xie,files:V(L().min(1)).optional(),otherWorktreePath:L().min(1).optional(),refusedSymlinkPaths:tf.optional()}).loose()]),W([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),H({branch:uf(L().min(1)),path:L(),kind:W([`doc`,`folder`]),contentRootDepth:R().int().min(1).max(65535).optional()}).loose(),ha(`verdict`,[H({verdict:G(`on-origin`)}).loose(),H({verdict:G(`renamed`),renamedTo:L().min(1)}).loose(),H({verdict:G(`deleted`)}).loose(),H({verdict:G(`never-on-branch`)}).loose(),H({verdict:G(`changed-locally`)}).loose(),H({verdict:G(`unknown`)}).loose()]).catch({verdict:`unknown`});function Zie(e){return e>=0&&e<=31&&e!==9&&e!==10&&e!==13}function ff(e,t,n=[]){for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(Zie(i)){t.addIssue({code:`custom`,path:n,params:{contentControlAdmission:!0},message:`Disallowed content control U+${i.toString(16).toUpperCase().padStart(4,`0`)} at zero-based UTF-16 offset ${r}. C0 controls allow only TAB, LF and CR. Remove the character or replace it with a printable escape such as \\u0000.`});return}}}const pf=L().superRefine(ff);function mf(e,t){let n=Iie(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const hf=L().superRefine(mf).optional(),Qie=L().superRefine(mf),gf={agentId:L().optional(),agentName:L().optional(),colorSeed:L().optional(),clientName:L().optional(),clientVersion:L().optional(),label:L().optional()},_f=L().optional(),$ie=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,eae=H({startedAt:L().min(1),httpListenMs:R().nonnegative().optional(),seedWalkMs:R().nonnegative().optional(),indexesMs:R().nonnegative().optional(),readyMs:R().nonnegative().optional(),fileCount:R().nonnegative().optional()});H({serverInstanceId:L().min(1),currentBranch:L().min(1).optional(),currentDiskAckSVs:U(L().min(1),L().min(1)).optional(),boot:eae.optional(),collabClients:R().int().nonnegative().optional(),runtimeVersion:L().min(1).optional(),protocolVersion:R().int().positive().optional()}).loose(),H({id:L().min(1),display_name:L().min(1),display_email:L(),source:W([`git-config`,`synthesized`]),created_at:L().min(1)}).loose(),H({collabUrl:L().nullable(),previewUrl:L().nullable(),port:R(),singleFile:z().default(!1)}).loose();const vf=W(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:symlink-refused.urn:ok:error:links-not-permitted.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:unsupported-media-type.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:stale-external-write.urn:ok:error:store-refused.urn:ok:error:save-held.urn:ok:error:doc-removed.urn:ok:error:branch-switched.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:non-github-origin.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:concurrent-overwrite-refused.urn:ok:error:unresolved-conflict-markers.urn:ok:error:no-conflict-tracked.urn:ok:error:no-blocking-changes.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),tae=H({type:vf,title:L().min(1),status:R().int().min(400).max(599),instance:L().regex($ie,`instance must be urn:uuid:<uuid>`).optional(),detail:L().optional()}).loose();H({parentDocName:L().min(1),placement:W([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:L().min(1).optional(),agentName:L().min(1).optional()}).loose(),H({src:L().min(1),path:L().min(1).optional(),deduped:z().optional()}).loose(),H({url:L().min(1),dir:L().min(1),branch:L().min(1).refine(lf,`invalid branch name`).optional()}).loose(),H({type:G(`error`),problem:tae}).loose(),H({docName:hf,summary:_f,content:pf.optional(),...gf}).loose(),H({docName:hf,summary:_f,markdown:pf,position:W([`append`,`prepend`,`replace`]).optional(),extension:W($d).optional(),...gf}).loose(),H({docName:hf,summary:_f,find:L().min(1),replace:pf,offset:R().int().nonnegative().optional(),...gf}).loose(),H({docName:hf,connectionId:L().min(1),scope:W([`last`,`session`,`file`,`count`]).optional(),count:R().int().positive().optional(),...gf}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});const yf=H({value:L(),truncatedFrom:R().int().nonnegative().optional(),hint:L().optional()}).loose(),nae=ha(`kind`,[H({kind:G(`inline`),content:L()}),H({kind:G(`truncated`),byteLength:R().int().nonnegative(),hint:L()})]),bf=H({kind:G(`content-divergence`),intendedBytes:R().int().nonnegative(),actualBytes:R().int().nonnegative(),byteDelta:R().int(),divergenceType:L().optional(),currentState:nae.optional(),hint:L().optional()}).loose(),rae=H({type:G(`orphan`),parentCandidates:V(L()),message:L()}).loose(),xf=H({kind:G(`disk-edit-reconciled`),intendedBytes:R().int().nonnegative(),actualBytes:R().int().nonnegative(),byteDelta:R().int(),mergeOutcome:L().optional(),duplicatedBlocks:R().int().nonnegative().optional(),restoredDeletedHere:R().int().nonnegative().optional(),restoredDeletedOutside:R().int().nonnegative().optional(),nextStep:L().optional(),hint:L().optional()}).loose();ha(`kind`,[bf,xf]);const iae=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0}),aae=H({kind:G(`mermaid-parse-error`),fenceIndex:R().int().positive(),fenceFirstLine:L(),message:L(),line:R().int().positive().optional()}).loose(),Sf=H({href:L(),targetKind:L(),role:L(),sourceForm:L(),resolvedTarget:L().nullable(),reason:L(),resolutionMethod:L(),fallbackTarget:L().nullable().optional(),definition:H({line:R().int().nonnegative(),label:L()}).loose().optional()}).loose(),Cf=ha(`kind`,[bf,xf,aae,H({kind:G(`lint-violation`),source:L(),code:L(),message:L(),severity:W([`error`,`warning`,`info`,`hint`]),line:R().int().positive(),column:R().int().positive(),linkTarget:L().optional(),localTarget:Sf.optional()}).loose(),H({kind:G(`link-check-deferred`),message:L()}).loose()]),wf=V(Cf).min(1),Tf=H({href:L(),resolvedTo:L().nullable(),reason:W([`no-such-doc`,`no-such-file`,`unresolvable`,`excluded`]),localTarget:Sf.optional()}).loose(),Ef=V(Tf),Df=H({reason:L().min(1),count:R().int().positive()}).loose();H({timestamp:L().min(1),summary:yf.optional(),warnings:wf.optional()}).loose(),H({timestamp:L().min(1),subscriberCount:R().int().nonnegative(),systemSubscriberCount:R().int().nonnegative(),hints:V(rae).optional(),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose(),H({timestamp:L().min(1),subscriberCount:R().int().nonnegative(),systemSubscriberCount:R().int().nonnegative(),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose(),H({docName:L().min(1),scope:W([`last`,`session`,`count`]),undone:z()}).loose(),H({docs:V(H({docName:Qie,markdown:pf,position:W([`append`,`prepend`,`replace`]).optional(),extension:W($d).optional(),summary:_f}).loose()).min(1).max(100),...gf}).loose();const oae=H({type:vf,title:L(),detail:L().optional()}).loose(),sae=ha(`status`,[H({status:G(`written`),docName:L().min(1),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose(),H({status:G(`error`),docName:L().min(1),error:oae}).loose()]);H({timestamp:L().min(1),results:V(sae),written:R().int().nonnegative(),failed:R().int().nonnegative()}).loose(),H({docName:hf,patch:U(L(),ma([So,aa()])),types:U(L(),W(bo)).optional(),summary:_f,...gf}).loose(),H({timestamp:L().min(1),subscriberCount:R().int().nonnegative(),systemSubscriberCount:R().int().nonnegative(),appliedKeys:V(L()),summary:yf.optional(),warnings:wf.optional(),brokenLinks:Ef,brokenLinkSuppression:Df.optional()}).loose();function Of(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const kf=Rf(/[A-Za-z]/),Af=Rf(/[\dA-Za-z]/),cae=Rf(/[#-'*+\--9=?A-Z^-~]/);function jf(e){return e!==null&&(e<32||e===127)}const Mf=Rf(/\d/),lae=Rf(/[\dA-Fa-f]/),uae=Rf(/[!-/:-@[-`{-~]/);function Nf(e){return e!==null&&e<-2}function Pf(e){return e!==null&&(e<0||e===32)}function Ff(e){return e===-2||e===-1||e===32}const If=Rf(/\p{P}|\p{S}/u),Lf=Rf(/\s/);function Rf(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function zf(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}const Bf=(function(e,t,n,r,i){let a=Vf(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error(`Expected positive finite index`);if(r!=null&&(!Bf(r)||!r.children))throw Error(`Expected parent node`);if(r==null!=(n==null))throw Error(`Expected both parent and index`);return Uf(e)?a.call(i,e,n,r):!1}),Vf=(function(e){if(e==null)return mae;if(typeof e==`function`)return Hf(e);if(typeof e==`object`)return Array.isArray(e)?dae(e):fae(e);if(typeof e==`string`)return pae(e);throw Error(`Expected function, string, or object as test`)});function dae(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Vf(e[n]);return Hf(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function fae(e){let t=e;return Hf(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function pae(e){return Hf(t);function t(t){return t&&t.type===e}}function Hf(e){return t;function t(t,n,r){return!!(Uf(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function mae(){return!0}function Uf(e){return typeof e==`object`&&!!e&&`type`in e}function hae(e){return`\x1B[33m`+e+`\x1B[39m`}const Wf=[],Gf=`skip`;function Kf(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Vf(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+hae(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Wf,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=gae(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function gae(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Wf:[e]}function _ae(e,t,n){let r=Vf((n||{}).ignore||[]),i=vae(t),a=-1;for(;++a<i.length;)Kf(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function vae(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([yae(e[0]),bae(e[1])])}return t}function yae(e){return typeof e==`string`?new RegExp(zf(e),`g`):e}function bae(e){return typeof e==`function`?e:function(){return e}}const qf=`phrasing`,Jf=[`autolink`,`link`,`image`,`label`];function xae(){return{transforms:[Oae],enter:{literalAutolink:Cae,literalAutolinkEmail:Yf,literalAutolinkHttp:Yf,literalAutolinkWww:Yf},exit:{literalAutolink:Dae,literalAutolinkEmail:Eae,literalAutolinkHttp:wae,literalAutolinkWww:Tae}}}function Sae(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:qf,notInConstruct:Jf},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:qf,notInConstruct:Jf},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:qf,notInConstruct:Jf}]}}function Cae(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Yf(e){this.config.enter.autolinkProtocol.call(this,e)}function wae(e){this.config.exit.autolinkProtocol.call(this,e)}function Tae(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Eae(e){this.config.exit.autolinkEmail.call(this,e)}function Dae(e){this.exit(e)}function Oae(e){_ae(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,kae],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Aae]],{ignore:[`link`,`linkReference`]})}function kae(e,t,n,r,i){let a=``;if(!Xf(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!jae(n)))return!1;let o=Mae(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Aae(e,t,n,r){return!Xf(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function jae(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Mae(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Of(e,`(`),a=Of(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Xf(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Lf(n)||If(n))&&(!t||n!==47)}function Zf(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}Qf.peek=Vae;function Nae(){this.buffer()}function Pae(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Fae(){this.buffer()}function Iae(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Lae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zf(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Rae(e){this.exit(e)}function zae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zf(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Bae(e){this.exit(e)}function Vae(){return`[`}function Qf(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Hae(){return{enter:{gfmFootnoteCallString:Nae,gfmFootnoteCall:Pae,gfmFootnoteDefinitionLabelString:Fae,gfmFootnoteDefinition:Iae},exit:{gfmFootnoteCallString:Lae,gfmFootnoteCall:Rae,gfmFootnoteDefinitionLabelString:zae,gfmFootnoteDefinition:Bae}}}function Uae(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Qf},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
193
193
|
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?$f:Wae))),s(),o}}function Wae(e,t,n){return t===0?e:$f(e,t,n)}function $f(e,t,n){return(n?``:` `)+e}const Gae=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];ep.peek=Xae;function Kae(){return{canContainEols:[`delete`],enter:{strikethrough:Jae},exit:{strikethrough:Yae}}}function qae(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Gae}],handlers:{delete:ep}}}function Jae(e){this.enter({type:`delete`,children:[]},e)}function Yae(e){this.exit(e)}function ep(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Xae(){return`~`}function Zae(e){return e.length}function Qae(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Zae,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=$ae(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=tp(r[d]);else{let e=tp(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
194
194
|
`)}function $ae(e){return e==null?``:String(e)}function tp(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const np={}.hasOwnProperty;function rp(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&np.call(t,e)){let n=String(t[e]);i=np.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const eoe={}.hasOwnProperty;function ip(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)ip(e,t.extensions[n]);for(r in t)if(eoe.call(t,r))switch(r){case`extensions`:break;case`unsafe`:ap(e[r],t[r]);break;case`join`:ap(e[r],t[r]);break;case`handlers`:toe(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function ap(e,t){t&&e.push(...t)}function toe(e,t){t&&Object.assign(e,t)}function noe(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),roe);return i(),o}function roe(e,t,n){return`>`+(n?``:` `)+e}function op(e,t){return sp(e,t.inConstruct,!0)&&!sp(e,t.notInConstruct,!1)}function sp(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function cp(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
195
195
|
`&&op(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
@@ -426,7 +426,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
426
426
|
`)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=JK(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l={...i,attributes:(i.attributes??[]).map(G_e),children:(i.children??[]).map(U_e)};return V_e(l,t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=tq(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},underline(e,t,n,r){let i=e.data?.sourceForm===`ins`?`<ins>`:`<u>`,a=e.data?.sourceForm===`ins`?`</ins>`:`</u>`,o=n.createTracker(r),s=n.enter(`underline`),c=o.move(i);return c+=n.containerPhrasing(e,{before:c,after:a,...o.current()}),c+=o.move(a),s(),c},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=JK(e.attributes??[]),i=(e.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return i?r?`<${n} ${r}>${i}</${n}>`:`<${n}>${i}</${n}>`:r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=c++,i=s?.[r];return i===`lazy`&&r>0&&!H_e.test(e)?e:i===`none`||i===0?`>${e}`:typeof i==`number`&&i>=2&&!e.startsWith(` `)?`>${` `.repeat(i)}${e}`:`> ${e}`})}};function JK(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${YK(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function YK(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function G_e(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:YK(e.value)}}:e}function XK(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function ZK(e,t,n,r=!1){let i=String(n.url??``),a=i.startsWith(`<`)&&i.endsWith(`>`);if(n.data?.sourceUrlForm===`angle-bracketed`&&!a||r){let n=e.enter(`destinationLiteral`),r=t.move(K_e(i,e.stack.includes(`tableCell`)));return n(),r}let o=e.enter(`destinationRaw`),s=t.move(q_e(i));return o(),s}function K_e(e,t=!1){let n=`<`;for(let r=0;r<e.length;r++){let i=e[r];$V(i)||t&&i===`|`?n+=`\\${i}`:n+=i===`
|
|
427
427
|
`?`
`:i===`\r`?`
`:i===`\\`?eH(e[r+1])?`\\\\`:`\\`:i}return`${n}>`}function q_e(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function J_e(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>Y_e(t)?e:`\\${e}`)}function Y_e(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32||t===160}const X_e=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function Z_e(e){return e.replace(X_e,e=>pc(e)?``+e.slice(1):e)}function Q_e(e){return/[\r\n][\t ]*$/.test(e)}function QK(e,t,n,r=!1){let{matched:i}=sU(t,{escapeAware:!1});if(i.length===0)return $K(e,t,n,r);let a=``,o=0,s=i=>{i>o&&(a+=$K(e,t.slice(o,i),{...n,before:n.before+a,after:t.slice(i,i+1)||n.after},r)),o=i};for(let e of i)s(e.start),!Q_e(n.before+a)&&(a+=t.slice(e.start,e.end),o=e.end);return s(t.length),a}function $K(e,t,n,r=!1){let i=e.unsafe;e.unsafe=i.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character===`!`&&e.after===`\\[`&&e.inConstruct===`phrasing`||e.character===`@`&&e.before===`[+\\-.\\w]`||r&&e.character===`:`&&e.before===`[ps]`&&e.after===`\\/`||e.character===`{`&&Array.isArray(e.inConstruct)&&e.inConstruct.includes(`phrasing`)||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`)),e.unsafe=e.unsafe.map(e=>{if(e.character!==`)`||e.atBreak!==!0||e.before!==`\\d+`||e.after!==void 0)return e;let t={...e,after:`(?:[ \r
|
|
428
428
|
]|$)`};return delete t._compiled,t});let a;try{a=e.safe(Z_e(t),n)}finally{e.unsafe=i}return a=a.replaceAll(``,`\\&`),J_e(tve(a,n))}function eq(e){if(Number.isNaN(e))return`ws`;let t=pp(e);return t===1?`ws`:t===2?`punct`:`other`}function $_e(e,t,n){let r=eq(t),i=eq(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function eve(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
|
|
429
|
-
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function tve(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&eve(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=$_e(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function tq(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);nq(i.charCodeAt(i.length-1),s,r)&&(o=rq(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return nq(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+rq(c)),o}function nq(e,t,n){return!(pp(t)!==1||n===`_`&&pp(e)===void 0)}function rq(e){return`&#x${e.toString(16).toUpperCase()};`}function nve(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!ive(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function rve(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=tq(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function ive(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}const iq=[{mode:`protecting`,protect:fH,reservations:uH},{mode:`protecting`,protect:uU,reservations:_H},{mode:`protecting`,protect:oH,reservations:nH},{mode:`serializer-only`,reservations:[{to:``}]}];new Set(iq.flatMap(({reservations:e})=>e.map(({to:e})=>e)));function ave(e,t){switch(t.mode){case`protecting`:return t.protect(e);case`serializer-only`:return e}}function aq(e){return iq.reduce(ave,e)}function oq(e){return e.data?.sourceRaw}function ove(e){return e.type===`text`?e.value===``:e.type===`mdxJsxTextElement`&&oq(e)===``}function sq(e){return e.type===`paragraph`&&(e.children??[]).every(ove)}function cq(e){let t=e.children??[],n=t[0]?.children?.length??0,r=0;for(let e=1;e<t.length;e++)r=Math.max(r,t[e]?.children?.length??0);let i=e.align??[];return Math.max(n,r,i.length)}function sve(e){switch(e.type){case`table`:return cq(e)===0;case`code`:return e.data?.sourceStyle===`indented`&&/^\n*$/.test(e.value??``);case`thematicBreak`:return oq(e)===``;case`html`:return(e.value??``)===``;case`mdxJsxFlowElement`:return oq(e)===void 0&&e.data?.htmlBoundary===void 0&&(e.children??[]).length===0&&!e.name;case`list`:return(e.children??[]).length===0;default:return!1}}function cve(e){let t=[];for(let n of e.children){if(n.type===`table`&&cq(n)===0){console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:(n.children??[]).length}));continue}sve(n)||(n.type===`paragraph`&&n.children.length>0&&sq(n)&&(n.children=[]),t.push(n))}e.children=t}function lve(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const uve=(e,t)=>{if(sq(e)||lve(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},lq=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function dve(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;gp(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;let a=HN(e);lq.lastIndex=0;let o=[],s;for(;(s=lq.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(KN(a,e,1)||KN(a,t-1,1)){lq.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(GN(n,e,l,r));let a={type:`inlineMath`,value:t[1]},o=YN(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(GN(n,e,l,i.length)),r.children.splice(t,1,...c),[Gf,t+c.length]})}}const fve=new Set([`strong`,`emphasis`,`delete`,`link`,`mark`,`comment`]);function pve(e){if(e?.type!==`break`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}function mve(e){e.data??={},e.data.sourceRaw=`<br />`,e.data.sourceStyle=`html`}function uq(e){if(e?.type!==`text`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}const dq=/[ \t]+$/,fq=/^[ \t]*$/;function hve(e){return e.some(e=>!(uq(e)&&fq.test(e.value)))}function pq(e,t=!1){for(;e.length>0;){let n=e[e.length-1];if(pve(n)){mve(n);break}if(n&&fve.has(n.type)&&`children`in n){let t=n.children;if(pq(t,!0),t.length===0){e.pop();continue}}if(!t&&uq(n)&&dq.test(n.value)){let t=n.value.replace(dq,``);if(t.length>0){n.value=t;continue}if(hve(e.slice(0,-1))){e.pop();continue}if(e.every(e=>uq(e)&&fq.test(e.value))){let t=e[0];t.value=t.value.charAt(0),e.splice(1)}}break}}const gve=new Set([`paragraph`,`heading`,`tableCell`]);function _ve(e){let t=e=>{if(gve.has(e.type)&&`children`in e&&pq(e.children),`children`in e)for(let n of e.children)t(n)};t(e)}const mq={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[A-Za-z]|[^\\x00-\\x7F]`}]};function vve(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===mq)||e.toMarkdownExtensions.push(mq)}const yve=new Set([`u`,`ins`]);function bve(){return e=>{gp(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name===null||!yve.has(e.name)||(e.attributes??[]).length>0)return;let r={type:`underline`,children:e.children??[],data:{sourceForm:e.name===`ins`?`ins`:`u`}};return e.position&&(r.position=e.position),n.children.splice(t,1,r),t+1})}}function xve(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const Sve=[{name:`remark-parse`,plugin:yg},{name:`escape-provenance`,plugin:aK},{name:`remark-mdx-agnostic`,plugin:vU},{name:`remark-gfm`,plugin:Zm},{name:`remark-math`,plugin:SW,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:VU},{name:`remark-github-alerts`,plugin:vW,options:XW},{name:`callout-transformer`,plugin:YW},{name:`restore-from-mdx`,plugin:fU},{name:`void-br-promoter`,plugin:SU},{name:`restore-entity-refs`,plugin:lH},{name:`restore-backslash-escapes`,plugin:pH},{name:`details-accordion-promoter`,plugin:PG},{name:`div-align-promoter`,plugin:UG},{name:`image-promoter`,plugin:pK},{name:`indented-code-promoter`,plugin:yK},{name:`math-promoter`,plugin:kK},{name:`single-dollar-math-promoter`,plugin:dve},{name:`highlight-promoter`,plugin:fK},{name:`underline-promoter`,plugin:bve},{name:`mermaid-promoter`,plugin:k_e},{name:`comment-promoter`,plugin:$W},{name:`merged-post-parse-walker`,plugin:D_e},{name:`empty-task-item-unmint`,plugin:XG},{name:`link-reference-destination`,plugin:DK},{name:`non-rendering-context-demote`,plugin:R_e},{name:`ensure-non-empty-doc`,plugin:()=>xve}];function Cve(e){let t=vh();for(let e of Sve)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(uW,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function wve(e){let t=vh().use(qh,[`yaml`]).use(Zm,{tablePipeAlign:!1}).use(SW,{singleDollarTextMath:!1}).use(vU).use(VU).use(vve).use(Pz,{bullet:`-`,fences:!0,rule:`-`,join:[uve],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function hq(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const gq=/^\n+$/,_q=/^\n{2,}$/;function vq(e,t,n){let r,i,a=e.children;if(a.length>0){let e=a[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);gq.test(n)&&(r=n)}let n=a[a.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);_q.test(e)&&(i=e)}}if(!n&&r===void 0&&i===void 0)return;let o={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i}};return e.data??={},e.data.sourceDocBoundary=o,o}function Tve(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&gq.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&_q.test(t.trailing)&&(n.trailing=t.trailing),n.bom||n.leading||n.trailing?n:void 0}function Eve(e,t){let{source:n,hadBom:r}=hq(e),i=CG(n),a=new uh(aq(i)),o=t.parse(a);a.value=i;let s=t.runSync(o,a);CK(s,i);let c=vq(s,i,r),l=c?Ps(s,c):void 0,u=t.stringify(s);return l?u.type.create({...u.attrs,sourceDocBoundary:l},u.content,u.marks):u}function Dve(e,t){return yq(e,t,!1)}function Ove(e,t){return yq(e,t,!0)}function yq(e,t,n){let{source:r,hadBom:i}=hq(e),a=CG(r),o=new uh(aq(a)),s=t.parse(o);o.value=a;let c=t.runSync(s,o);n&&CK(c,a);let l=vq(c,a,i);return n&&l&&Ps(c,l),c}function kve(e,t,n){let r=fW(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});bq(r),JG(r),_ve(r),cve(r);let i=Tve(e.attrs?.sourceDocBoundary),a=String(t.stringify(r));return i?.leading&&(a=i.leading+a),i?.trailing&&(a=a.replace(/\n+$/,``)+i.trailing),i?.bom&&(a=`\uFEFF${a}`),a}function bq(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)bq(t);for(let t=0;t+1<e.children.length;){let n=e.children[t],r=e.children[t+1],i=n?.data,a=r?.data,o=LN(i)?i.escapedChars:null,s=LN(a)?a.escapedChars:null;if(n?.type!==`text`||r?.type!==`text`||typeof n.data?.sourceRaw==`string`||typeof r.data?.sourceRaw==`string`||o===null&&s===null){t+=1;continue}let c=n.value.length;n.value+=r.value,n.data??={},n.data.escapedChars=[...o??[],...(s??[]).map(e=>({...e,offset:e.offset+c}))],r.data?.entityRefSpans?.length&&(n.data.entityRefSpans=[...n.data.entityRefSpans??[],...r.data.entityRefSpans.map(e=>({...e,offset:e.offset+c}))]),e.children.splice(t+1,1)}}}var Ave=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=sO(e.extensions),this.handlers=Fve(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?cc({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=Ive(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=Cve({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=wve({toMarkdownHandlers:W_e})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return Eve(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Dve(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?Ove(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?TW(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return kve(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const xq=kB();function Sq(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else r[e]=i?.type===`boolean`?t.value===`true`:t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function jve(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function Mve(e,t){return e.attrs.sourceDirty||jve(e)?!0:t?t.isDiverged(e.toJSON()):!1}function Nve(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0||t.every(e=>e.type===`text`&&e.value===``)}function Cq(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function wq(e,t){if(e.length===0)return Cq({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return Cq({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[wq(n.children,t)]}}return Cq({type:`inlineCode`,value:Tq(e)},t)}function Tq(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=Tq(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const Pve=Rc;function Fve(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=sW(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=sW(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=JU(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r,sourceUrlForm:e.data?.sourceUrlForm??null})},i.imageReference=n.imageReference?e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&gc(t.raw)!==null&&pc(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i){if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=gc(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i))}u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=cW(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=cW(r.highlight)),r.underline&&(i.underline=cW(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=cW(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=sW(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=cW(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=cW(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=sW(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=sW(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=sW(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker,s=!!o.spec.attrs?.sourceUrlForm;i.definition=i=>{let c={title:i.title??null};return n&&(c.identifier=i.identifier??``),c.label=i.label??i.identifier??``,e?c.url=i.url??``:t&&(c.href=i.url??``),r&&(c.sourceLayout=i.data?.sourceLayout??null),a&&(c.sourceTitleMarker=i.data?.sourceTitleMarker??null),s&&(c.sourceUrlForm=i.data?.sourceUrlForm??null),o.createAndFill(c)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=xq.getOrWildcard(o),c=Sq(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=JU(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?xq.get(i):void 0;if(o&&n.jsxInline){let e=Sq(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=i.data?.sourceTarget??null,u=i.data?.sourceAnchor??null,d=i.data?.sourceAlias??null,f=YO(o),{resolveEmbed:p,sourcePath:m}=t.current,h=p&&m?p(o,m)??null:null,g=h?`/${h}`:o,_=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(_&&Pve.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,alt:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&zc.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&Vc.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&Hc.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&m?e(o,m)??null:null,i=r===null?null:YU(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,target:o,anchor:c,alias:s,size:i,sourceTarget:l,sourceAnchor:u,sourceAlias:d}})}let v=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:g,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d});return e.text(v,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=sW(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function Ive(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=pW(`paragraph`)),i.blockquote&&(n.blockquote=pW(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=pW(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0||void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0||void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=pW(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&Nve(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=pW(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:gP(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>{let t={type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title};return e.attrs.sourceUrlForm===`angle-bracketed`&&(t.data={sourceUrlForm:`angle-bracketed`}),t}),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!Mve(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:xq.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:xq,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return Qz(t,e,xq.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=mW(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=mW(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return wq(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0||void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=mW(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=mW(`mark`)),a.underline&&(r.underline=mW(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=mW(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=pW(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=pW(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,o=typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,s=typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null,c=i||(r?`${t}#${r}`:t),l=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return l!==c&&l.trim().length>0&&!l.includes(`]]`)&&(i=l,c=l),{type:`wikiLinkEmbed`,value:c,data:{target:t,anchor:r,alias:i,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return UO(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const Lve=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(DB.flatMap(e=>e.surface===`compat`&&Lve.has(e.rendersAs)?[[e.name,e]]:[])),Ese(`<>`);var Eq={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100};Eq.SINGLE_TILDE,Eq.COMPARISON_OPERATORS,Eq.HTML_TAGS,Eq.SETEXT_HEADINGS,Eq.LINKS,Eq.BOLD_ITALIC,Eq.BOLD,Eq.ITALIC_DOUBLE_UNDERSCORE,Eq.ITALIC_SINGLE_ASTERISK,Eq.ITALIC_SINGLE_UNDERSCORE,Eq.INLINE_CODE,Eq.STRIKETHROUGH,Eq.KATEX,Eq.INLINE_KATEX,vh().use(yg).use(Zm);const Dq=W(Ct),Rve=W(tee),zve=H({alwaysOn:R().int().nonnegative(),onTrigger:R().int().nonnegative(),onDemand:R().int().nonnegative()}).strict();H({intents:V(H({satisfierId:L().min(1),desired:W([`present`,`absent`])}).loose()),...gf,summary:_f}).loose();const Bve=H({satisfierId:L(),agentId:L(),piece:L(),scope:L(),kind:L(),pathId:L().optional(),desired:W([`present`,`absent`]),action:W(Na),errorId:L().optional()}).loose(),Vve=H({kind:L(),satisfierIds:V(L()),agentIds:V(L()),pathId:L().optional(),blockedReason:L().optional()}).loose(),Hve=H({state:L(),strictness:V(W(ja)).optional()}).loose(),Uve=H({probes:H({env:W([`desktop`,`local-web`,`remote-web`]),satisfiers:U(L(),Hve)}).loose(),detection:H({detected:V(L()),probed:z()}).loose()}).loose();H({actions:V(Bve),conflicts:V(Vve),withheld:V(L()),snapshot:Uve}).loose(),H({entries:V(H({level:W([`info`,`warn`,`error`]),message:L().max(8192),event:L().optional(),fields:U(L(),B()).optional(),ts:R().optional(),sourceId:L().optional(),lineNumber:R().optional()}).loose()).max(100),droppedSinceLastFlush:R().int().min(0).optional()}).loose(),H({accepted:R().int().min(0)}).loose();const Wve=H({exact:L().min(1),prefix:L(),suffix:L(),start:R().int().nonnegative(),end:R().int().nonnegative()}),Gve=V(ma([L(),R().int().nonnegative()])),Kve=ha(`kind`,[H({kind:G(`body`)}),H({kind:G(`property`),key:L().min(1),path:Gve.default([])})]).default({kind:`body`}),qve=W([`anchored`,`orphaned`,`resolved`]),Oq=H({threadId:L().min(1),docName:L().min(1),target:Kve,anchor:Wve.nullable(),state:qve,queued:z(),latestComment:L(),createdBy:L().min(1),createdAt:R(),updatedAt:R().optional()}),kq=H({docName:L(),instruction:L(),property:L().nullable(),passage:H({exact:L(),prefix:L(),suffix:L()}).nullable(),anchorLost:z(),passageRepeats:z()}).loose(),Aq=H({threadId:L(),ok:G(!0)}),jq=H({threadId:L(),ok:G(!1),error:G(`not-found`)});H({threads:V(Oq)}).loose(),H({meta:Oq,orphaned:z()}).loose(),H({threadId:L()}).loose(),H({meta:Oq,payload:kq}).loose(),H({results:V(ma([Aq.extend({meta:Oq,payload:kq}),jq]))}).loose(),H({results:V(ma([Aq.extend({meta:Oq}),jq]))}).loose();const Jve=[`ours`,`theirs`],Yve=[`check-failed`,`too-large`],Xve=H({duplicated:R().int().nonnegative(),restoredDeletedHere:R().int().nonnegative(),restoredDeletedOutside:R().int().nonnegative()}),Mq={id:L().min(1),docName:L().min(1),file:L().min(1),firstAt:L().min(1),lastAt:L().min(1),events:R().int().positive(),entries:V(L().min(1))},Nq=ha(`kind`,[H({...Mq,kind:G(`both-kept`),kept:Xve}).loose(),H({...Mq,kind:G(`moved-to-history`),side:W(Jve),reason:W(Yve)}).loose()]);H({notices:V(Nq)}).loose(),H({docName:L().min(1),id:L().min(1)}).loose(),H({dismissed:z()}).loose();const Zve=H({status:L().min(1),reason:L()}).loose();H({docName:L().min(1),content:L(),lifecycle:Zve.nullable()}).loose(),H({documents:V(H({kind:W([`document`,`asset`,`folder`,`file`]).default(`document`),docName:L().min(1).optional(),docExt:L().min(1).default(`.md`),size:R().int().nonnegative(),modified:L().min(1),isSymlink:z().default(!1),canonicalDocName:L().nullable().default(null),targetPath:L().nullable().default(null),path:L().min(1).optional(),assetExt:L().min(1).optional(),mediaKind:W([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:V(L().min(1)).optional(),hasChildren:z().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:z().optional()}).loose();const Qve=H({source:L().min(1),anchor:L().nullable(),title:L(),snippet:L().nullable()}).loose();H({docName:L().min(1),backlinks:V(Qve)}).loose(),H({counts:U(L().min(1),R().int().nonnegative())}).loose(),H({counts:U(L().min(1),R().int().nonnegative())}).loose();const $ve=ha(`kind`,[H({kind:G(`doc`),docName:L().min(1),anchor:L().nullable(),title:L(),snippet:L().nullable()}).loose(),H({kind:G(`external`),url:L().min(1),title:L(),snippet:L().nullable()}).loose()]),eye=H({role:L().min(1),sourceForm:L().min(1),targetKind:L().min(1),href:L(),resolvedTarget:L().nullable(),status:L().min(1),reason:L().nullable(),resolutionMethod:L().min(1),fallbackTarget:L().nullable().default(null),range:H({start:R().int().nonnegative(),end:R().int().nonnegative()}),line:R().int().nonnegative(),column:R().int().nonnegative(),definition:H({label:L(),line:R().int().nonnegative()}).nullable().default(null)}).loose();H({docName:L().min(1),forwardLinks:V($ve),localTargets:V(eye).optional()}).loose();const tye=ha(`kind`,[H({id:L().min(1),kind:G(`doc`),docName:L().min(1),anchor:L().nullable(),label:L(),cluster:L().nullable(),category:L().nullable(),tags:V(L()).nullable(),managed:z().optional()}).loose(),H({id:L().min(1),kind:G(`external`),url:L().min(1),label:L()}).loose()]),Pq=H({source:L().min(1),target:L().min(1)}).loose();H({nodes:V(tye),links:V(Pq)}).loose();const nye=H({ts:R().int().min(0),url:L(),method:L(),ua:L().optional(),origin:L().optional(),referer:L().optional(),host:L().optional(),remote:L().optional(),secChUa:L().optional(),secChUaMobile:L().optional(),secChUaPlatform:L().optional(),secFetchSite:L().optional(),secFetchDest:L().optional(),secFetchMode:L().optional(),secFetchUser:L().optional()}).loose(),rye=H({app:ma([G(`cursor`),G(`codex`),G(`claude`),aa()]),signals_fired:V(L())}).loose();H({entries:V(nye),count:R().int().min(0),detection:rye}).loose();const Fq=H({path:L().min(1),code:W([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:L().min(1).optional(),syncScoped:z(),open:ha(`kind`,[H({kind:G(`doc`),docName:L().min(1)}),H({kind:G(`asset`),path:L().min(1)})]).optional()}).loose();H({branch:L().nullable(),detached:z(),upstream:L().nullable(),staged:V(Fq),notStaged:V(Fq),untracked:V(Fq),incoming:V(Fq),truncated:z(),readable:z().default(!0)}).loose();const iye=W([`AWAITING_CHECKS`,`LOCKED`,`MERGEABLE`,`QUEUED`,`UNMERGEABLE`]),aye=W([`BEHIND`,`BLOCKED`,`CLEAN`,`DIRTY`,`DRAFT`,`HAS_HOOKS`,`UNKNOWN`,`UNSTABLE`]),oye=W([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]),sye=W([`ERROR`,`EXPECTED`,`FAILURE`,`PENDING`,`SUCCESS`]),cye=H({mergeQueue:H({position:R().int().nonnegative(),state:iye.nullable().catch(null)}).nullable().catch(null),autoMerge:z(),mergeState:aye.nullable().catch(null),reviewDecision:oye.nullable().catch(null),checks:sye.nullable().catch(null)}).loose(),lye=H({kind:W([`pull`,`issue`]),repo:L().min(1),number:R().int().positive(),title:L(),author:L().nullable(),createdAt:L(),lifecycle:W([`open`,`draft`,`merged`,`closed`,`completed`,`not-planned`]),additions:R().int().nonnegative().optional(),deletions:R().int().nonnegative().optional(),status:cye.optional()}).loose();H({url:L()}).loose(),ha(`ok`,[H({ok:G(!0),preview:lye}).loose(),H({ok:G(!1),reason:L()}).loose()]),H({writers:V(H({id:L().min(1),name:L().optional(),email:L().optional()}).loose()).optional(),summary:_f,...gf}).loose(),H({checkpointRef:L().min(1)}).loose();const uye=H({v:R().int().optional(),id:L().min(1),name:L().min(1),colorSeed:L().optional(),docs:V(L()),summaries:V(L()).optional()}).loose();H({entries:V(H({sha:L().min(1),timestamp:L().min(1),author:L(),authorEmail:L(),type:W([`checkpoint`,`wip`,`upstream`,`park`]),message:L(),contributors:V(uye),checkpoint:B().nullable(),parentSha:L().nullable().optional()}).loose()),total:R().int().nonnegative().optional(),truncated:z().optional(),hasMore:z().optional()}).loose(),H({sha:L().regex(/^[0-9a-f]{40}$/i),content:L(),timestamp:L(),author:L()}).loose(),H({contentDir:L().min(1),pathSeparator:W([`/`,`\\`]),symlinkResolved:z()}).loose(),V(ha(`source`,[H({docName:L().min(1),timestamp:L().min(1),size:R().int().nonnegative(),source:G(`flat`)}).loose(),H({docName:L().min(1),timestamp:L().min(1),source:G(`timeline`),sha:L().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const dye=H({domain:L().min(1),title:L().optional(),description:L().optional(),siteName:L().optional(),faviconDataUri:L().optional()}).loose();H({url:L()}).loose(),ha(`ok`,[H({ok:G(!0),metadata:dye}).loose(),H({ok:G(!1),reason:L()}).loose()]),H({orphans:V(H({docName:L().min(1),title:L()}).loose())}).loose(),H({hubs:V(H({docName:L().min(1),title:L(),count:R().int().nonnegative()}).loose())}).loose();const fye=H({source:L().min(1),title:L(),snippet:L().nullable()}).loose();H({deadLinks:V(H({target:L().min(1),sources:V(fye)}).loose())}).loose(),H({target:H({docName:L().min(1),title:L(),aliases:V(L())}).loose(),mentions:V(H({source:L().min(1),excerpt:L(),offset:R().int().nonnegative()}).loose()),truncated:z()}).loose(),H({projectPath:L().min(1)}).loose();const pye=W([`not-a-git-worktree`,`init-failed`]);ha(`ok`,[H({ok:G(!0),projectPath:L().min(1)}).loose(),H({ok:G(!1),reason:pye,message:L().min(1)}).loose()]),H({host:L().min(1).optional()}).loose(),H({host:L().min(1).optional(),token:L().min(1)}).loose(),H({host:L(),login:L()}).loose(),H({host:L().refine(Tc,{message:`Host must be a hostname with an optional :port, with no scheme or path`}),username:L().min(1),token:L().min(1)}).loose(),H({host:L(),login:L()}).loose(),H({key:L().min(1)}).loose(),H({keyPresent:z()}).loose();const mye=W([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);ha(`ok`,[H({ok:G(!0),endpoint:L().min(1),model:L().min(1),dimensions:R().int().positive()}).loose(),H({ok:G(!1),endpoint:L().min(1),model:L().min(1),reason:mye,status:R().int().optional()}).loose()]),H({name:L().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:L().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),H({authenticated:z()}).loose(),H({channel:W([`login`,`gh-login`]).default(`login`)}).loose(),H({}).loose();const hye=H({stackIndex:R().int().min(0),ts:R().int().min(0),additions:R().int().min(0),deletions:R().int().min(0)}).loose(),gye=H({docName:L().min(1),additionsTotal:R().int().min(0),deletionsTotal:R().int().min(0),lastTs:R().int().min(0),bursts:V(hye)}).loose(),_ye=H({displayName:L().min(1),color:L().min(1),icon:L().optional(),connectionId:L().min(1)}).loose();H({sessionAlive:z(),agent:_ye.nullable(),files:V(gye)}).loose(),H({diff:L(),before:L(),after:L(),properties:rP,generatedAt:R().int().min(0)}).loose(),H({}).loose(),H({}).loose(),H({}).loose(),H({}).loose(),H({}).loose(),H({}).loose();const vye=H({displayName:L().min(1),icon:L(),color:L().min(1),currentDoc:L().nullable(),mode:W([`idle`,`writing`]),ts:R().int().min(0)}).loose();H({presence:U(L().min(1),vye)}).loose();const yye=H({sessionId:L().min(1),agentType:L().min(1),ts:R().int().min(0),insertedChars:R().int().min(0),deletedChars:R().int().min(0)}).loose();H({effects:V(H({"doc.name":L().min(1),entries:V(yye)}).loose())}).loose(),H({decisions:V(H({ts:R().int().min(0),decision:L().min(1),kind:L().min(1),"doc.name":L().min(1),pathRole:L().min(1)}).loose())}).loose(),U(L().min(1),z()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),H({path:L().min(1,`path must be non-empty`)}).loose(),H({}).loose();const bye=H({fromDocName:L().min(1),toDocName:L().min(1)}).loose(),xye=H({fromPath:L().min(1),toPath:L().min(1)}).loose();H({}).loose(),H({path:L().min(1),...gf,summary:_f}).loose(),H({docName:L().min(1)}).loose(),H({path:L().min(1),...gf,summary:_f}).loose(),H({path:L().min(1)}).loose(),H({kind:W([`file`,`folder`]),path:L().min(1),...gf,summary:_f}).loose(),H({kind:W([`file`,`folder`]),path:L().min(1),duplicatedDocNames:V(L().min(1))}).loose(),H({pages:V(H({docName:L().min(1),title:L(),docExt:L().min(1),size:R().int().nonnegative(),modified:L().min(1),icon:L().min(1).max(2048).optional()}).loose())}).loose();const Sye=H({level:R().int().min(1).max(6),text:L(),slug:L()}).loose();H({docName:L().min(1),headings:V(Sye)}).loose();const Cye=H({docName:L().min(1),rewrites:R().int().nonnegative()}).loose();H({kind:W([`file`,`folder`,`asset`]),fromPath:L().min(1),toPath:L().min(1),...gf,summary:_f}).loose(),H({renamed:V(bye),renamedAssets:V(xye),rewrittenDocs:V(Cye).optional(),summary:yf.optional()}).loose(),H({kind:W([`file`,`folder`,`asset`]),path:L().min(1),...gf}).loose(),H({deletedDocNames:V(L().min(1))}).loose(),H({kind:W([`file`,`folder`,`asset`]),path:L().min(1),...gf,summary:_f}).loose(),H({deletedDocNames:V(L().min(1))}).loose(),H({docName:L().min(1),commitSha:L().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:_f,...gf}).loose(),H({restoredFrom:L().min(1),timestamp:L().min(1),summary:yf.optional(),warnings:wf.optional()}).loose();const wye=/^#[0-9a-fA-F]{6}$/,Tye=H(Object.fromEntries(ul.map(e=>[e,L().regex(wye,`must be a #rrggbb hex color`)]))),Iq=L().min(1).refine(hl,{message:`must contain a non-whitespace character`}),Lq=H({name:Iq,author:Iq.optional(),variant:W([`dark`,`light`]),palette:Tye}).loose();H({name:L().min(1),scheme:Lq,stem:L().min(1).optional(),extension:W([`.yaml`,`.yml`]).optional()}).loose(),H({id:L().min(1),filename:L().min(1)}).loose(),H({id:L().min(1),scheme:Lq}).loose(),H({id:L().min(1),filename:L().min(1)}).loose(),ha(`existed`,[H({existed:G(!1)}).loose(),H({existed:G(!0),filename:L().min(1),scheme:Lq}).loose()]),H({themes:V(ha(`ok`,[H({ok:G(!0),id:L().min(1),filename:L().min(1),scheme:Lq}),H({ok:G(!1),filename:L().min(1),id:L().min(1).optional(),code:L().min(1),conflictingFilenames:V(L().min(1)).min(2).optional()})])),truncated:z()}).loose();function Eye(e){return e.replace(/\\/g,`/`).split(`/`).filter(e=>e!==``&&e!==`.`)}function Dye(e){let t=Eye(e).at(-1);return t!==void 0&&$d.some(e=>t.toLowerCase().endsWith(e))}H({tags:V(H({name:L().min(1),count:R().int().nonnegative(),isLeaf:z()}).loose())}).loose();const Oye=H({docName:L().min(1),title:L(),matchingTags:V(L().min(1)),snippet:L().nullable()}).loose();H({name:L().min(1),docs:V(Oye)}).loose(),H({folder:B(),frontmatter_local:U(L(),B()).nullable(),warnings:V(L()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:V(W([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),H({path:L(),frontmatter:U(L(),B()).optional()}).loose(),H({applied:B()}).loose();const Rq=U(L(),B()).meta({description:`Free-form frontmatter map embedded in template payloads.`});H({template:H({name:L().min(1),folder:L(),scope:W([`local`,`inherited`]),path:L().min(1),frontmatter:Rq,body:L()}).strict()}).strict(),H({templates:V(H({name:L().min(1),title:L().optional(),description:L().optional(),path:L().min(1),source_folder:L()}).strict()),truncated:z()}).strict(),H({folder:L(),name:L(),body:pf.optional(),frontmatter:Rq.optional(),...gf,summary:_f}).strict(),H({path:L().min(1),created:z(),warnings:V(L())}).strict(),H({sourcePath:L().min(1),targetFolder:L(),name:L().optional(),title:L().optional(),deleteSource:z().optional(),...gf,summary:_f}).strict(),H({path:L().min(1),created:z(),warnings:V(L())}).strict(),H({existed:z(),path:L().min(1)}).strict(),H({fromFolder:L(),fromName:L(),toFolder:L(),toName:L(),body:pf.optional(),frontmatter:Rq.optional(),...gf,summary:_f}).strict(),H({from:L().min(1),to:L().min(1),committed:z()}).strict();const zq=W(Qd),kye=/^[a-z0-9-]+$/,Bq=H({name:L(),description:L(),metadata:H({pack:L()}).strict().optional()}).strict();H({skill:H({name:L().min(1),scope:zq,path:L().min(1),frontmatter:Bq,body:L(),files:V(H({path:L().min(1),text:L().nullable()})).optional(),managed:z().optional()}).strict()}).strict();const Aye=H({source:L().min(1),publisher:L().optional(),skill:L().optional(),marketplaceUrl:L().optional(),importedAt:L().min(1),autoUpdate:z().optional()}).strict(),jye=H({name:L().min(1),description:L().optional(),scope:zq,path:L().min(1),canonicalPath:L().min(1).optional(),filePaths:V(L()).optional(),absolutePath:L().min(1).optional(),installed:z(),hosts:V(L()),hostQualifier:L().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:V(L()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:U(L(),L()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:V(L()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:V(L()).optional(),installableEditors:V(L()).optional(),hubOffered:z().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:z().optional(),customPlacements:V(H({path:L(),mode:W([`copy`,`link`])}).strict()).optional(),plugin:H({name:L().min(1),marketplace:L().min(1),provider:L().min(1),url:L().optional()}).strict().optional(),managed:z().optional(),origin:Aye.optional(),pack:L().optional(),modified:z().optional(),revertable:z().optional(),ignored:z().optional(),size:zve.optional()}).strict();H({name:L().min(1),scope:zq,apply:z().optional()}).strict(),H({line:L().min(1),gitignorePath:L().min(1),applied:z(),alreadyTracked:z().optional()}).strict(),H({skills:V(jye),truncated:z()}).strict(),H({scope:zq.default(`project`),name:L().meta({description:`Managed skill name to create or update.`}),body:pf.optional(),frontmatter:Bq,...gf,summary:_f}).strict();const Vq=[`skill-name-vendor-word`,`skill-body-too-long`],Hq=V(W(Vq)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."});H({path:L().min(1),created:z(),warnings:V(L()),warningCodes:Hq}).strict(),H({scope:zq.default(`project`),name:L(),dryRun:z().optional(),setAutoUpdate:z().optional(),...gf,summary:_f}).strict(),H({name:L().min(1),updated:z(),source:L().min(1),localBody:L().optional(),upstreamBody:L().optional(),gitTracked:z().optional(),warnings:V(L()),warningCodes:Hq}).strict(),H({scope:zq.default(`project`),name:L(),...gf,summary:_f}).strict(),H({name:L().min(1),baselineRef:L().min(1),restoredFiles:V(L()),warnings:V(L())}).strict();const Uq=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`;H({existed:z(),path:L().min(1),warnings:V(L()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${Uq}`})}).strict(),H({scope:zq.default(`project`),fromName:L(),toName:L(),body:pf.optional(),frontmatter:Bq.optional(),...gf,summary:_f}).strict(),H({from:L().min(1),to:L().min(1),committed:z(),warnings:V(L()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${Uq}`})}).strict(),H({name:L(),toName:L().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:zq,toScope:zq,...gf,summary:_f}).strict(),H({scope:zq,path:L().optional(),droppedLocations:V(L()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:V(L()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${Uq}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),H({scope:zq,name:L(),toName:L(),...gf,summary:_f}).strict(),H({name:L().min(1)}).strict(),H({name:L(),home:L().min(1)}).strict(),H({docName:L().min(1)}).strict();const Wq=W([`reference`,`script`,`file`]);H({scope:zq.default(`project`),name:L(),path:L().min(1),content:L(),...gf,summary:_f}).strict().superRefine((e,t)=>{Dye(e.path)&&ff(e.content,t,[`content`])}),H({path:L().min(1),created:z(),kind:Wq,content:z()}).strict(),H({scope:zq.default(`project`),name:L(),from:L().min(1),to:L().min(1),...gf,summary:_f}).strict(),H({from:L().min(1),to:L().min(1),fromDocName:L().optional(),toDocName:L().optional()}).strict(),H({path:L().min(1),kind:Wq,text:L()}).strict(),H({path:L().min(1),existed:z(),kind:Wq}).strict();const Gq=ma([Rve,G(`agents`)]),Kq=L().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),qq=ma([Gq,Kq]);H({scope:zq.default(`project`),name:L(),targets:V(Gq).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:V(qq).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:V(qq).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:W([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:qq.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:z().optional(),setSource:L().min(1).optional(),place:H({dir:L().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:W([`copy`,`link`])}).strict().optional(),convert:H({target:qq.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:W([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:H({path:L().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...gf,summary:_f,fork:H({editor:L().min(1),action:W([`align`,`make-source`,`rename`]),toName:L().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"});const Jq=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`,`links-not-permitted`];H({name:L().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:V(L()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:z().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:V(L()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:V(W(Jq)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:L().optional(),sourceMovedTo:L().optional()}).strict(),H({scope:zq.default(`project`),name:L().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),H({name:L().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:z().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),H({targets:V(Dq),configured:z(),folders:V(H({scope:zq,host:L(),root:L(),state:W([`own`,`linked`,`linked-parent`,`absent`]),target:L().optional(),drift:G(!0).optional(),expected:L().optional()}).strict()).optional()}).strict();const Yq=H({action:G(`link`),scope:zq,root:L().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:L().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),Xq=H({action:G(`unlink`),scope:zq,root:L().min(1).meta({description:`The linked folder to materialize back.`}),exclude:V(L().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),Zq=H({action:G(`add-root`),scope:zq,root:Kq.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),Mye=ha(`action`,[Yq.extend({preview:z().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),Xq,Zq]);ha(`action`,[Yq.strict(),Xq,Zq]),H({folderAction:Mye}).strict();const Nye=H({moves:V(L()),drops:V(L()),removes:V(L()),replaces:V(L()),conflicts:V(L()),strays:V(L())}).strict();H({targets:V(Dq),reprojected:V(H({name:L(),hosts:V(L())}).strict()),bundleHosts:V(L()),removedFrom:V(L()),folder:H({moved:V(L()),dropped:V(L()),linked:V(L())}).strict().optional(),preview:Nye.optional()}).strict(),H({scope:zq.default(`project`),name:L(),version:L().regex(/^[0-9a-f]{40}$/i),...gf,summary:_f}).strict(),H({name:L().min(1),version:L(),restoredFiles:V(L()),warnings:V(L())}).strict(),H({query:L().optional(),intent:W([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:W([`navigation`,`relevance`]).optional(),scopes:V(W([`page`,`folder`,`content`,`file`])).optional(),scope:L().optional(),limit:R().int().nonnegative().optional(),semantic:z().optional(),source:W([`omnibar`,`mcp`,`http`]).optional()}).loose();const Pye=H({kind:W([`page`,`folder`,`content`,`file`]),path:L().min(1),title:L(),score:R(),signals:U(L(),B()),snippet:L().optional()}).loose(),Fye=W([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),Qq=W([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]),$q=H({capable:z(),applied:z(),outcome:Fye,providerErrorReason:Qq.nullable().optional().catch(null),coverage:H({embedded:R().int().nonnegative(),total:R().int().nonnegative()})}).loose();H({enabled:z(),keyPresent:z(),keyNotRequired:z(),keySource:W([`project`,`file`,`env`]).nullable(),keyHint:L().nullable(),ready:z(),capable:z(),providerError:z().optional(),providerErrorReason:Qq.nullable().optional().catch(null),embedded:R().int().nonnegative(),total:R().int().nonnegative()}).loose(),H({query:L(),intent:W([`autocomplete`,`full_text`,`omnibar`]),results:V(Pye),elapsedMs:R().nonnegative(),semantic:$q.optional(),truncated:z().optional(),ready:z().optional()}).loose();const Iye=H({version:L().min(1),recordedAt:L().min(1)}).loose();H({currentVersion:L().min(1),targets:U(L(),Iye.nullable())}).loose(),H({scope:zq.default(`project`),source:L().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:L().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:z().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:z().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...gf,summary:_f}).strict(),H({scope:zq.default(`project`),source:L().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:V(L().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:z().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:z().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...gf,summary:_f}).strict(),H({results:V(H({requested:L(),status:W([`imported`,`already-imported`,`not-found`,`failed`]),name:L().optional(),collisionRenamedFrom:L().optional(),warnings:V(L()),warningCodes:Hq,error:L().optional()}).loose()),imported:R(),alreadyImported:R(),failed:R()}).loose(),H({scope:zq.default(`project`),names:V(L().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...gf,summary:_f}).strict(),H({results:V(H({requested:L(),status:W([`updated`,`up-to-date`,`not-found`,`failed`]),source:L().optional(),warnings:V(L()),warningCodes:Hq,error:L().optional()}).loose()),updated:R(),upToDate:R(),failed:R()}).loose();const Lye=H({source:L(),ref:L().optional(),contentHash:L(),publisher:L().optional()}).loose();H({name:L().min(1).meta({description:`Managed skill name created or matched.`}),path:L().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:z().meta({description:`True when this request created new source files.`}),alreadyImported:z().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:L().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:Lye,warnings:V(L()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:Hq}).loose();const Rye=W([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]);H({v:G(1),ch:G(`server-info`),seq:R(),serverInstanceId:L().min(1),currentBranch:L().min(1).optional()}).loose(),H({v:G(1),ch:G(`branch-switched`),seq:R(),branch:L().min(1)}).loose(),H({v:G(1),ch:Rye,seq:R()}).loose(),H({v:G(1),ch:G(`disk-ack`),seq:R(),docName:L().min(1),sv:L().min(1)}).loose(),H({v:G(1),ch:G(`config-validation-rejected`),seq:R(),docName:L().min(1),error:Eie}).loose(),H({v:G(1),ch:G(`config-ignore-nested-error`),seq:R(),path:L().min(1),error:L().min(1)}).loose(),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const zye=fa({name:L(),description:L(),files:fa({skillMd:L(),scripts:V(L()),references:V(L())})}),Bye=fa({pluginProvider:L().optional(),plugin:L().optional(),marketplace:L().optional(),repositoryUrl:L().optional(),version:L().optional(),gitCommitSha:L().optional(),scope:L().optional(),projectPath:L().optional()}),Vye=fa({commands:z(),hooks:z(),mcp:z()}),Hye=fa({...zye.shape,sourceHarness:L(),sourceHarnesses:V(L()),home:L(),provenance:Bye,inert:Vye,outsideProject:z().optional()}),Uye=fa({schema:G(1),name:L(),version:L(),description:L().optional(),author:fa({name:L()}).optional(),skills:V(L()),hostCompatibility:V(L()).optional(),capabilities:fa({scripts:L(),network:L(),inert:V(L())}).optional(),provenance:fa({source:L(),ref:L(),contentHash:L()}).optional()});H({skills:V(Hye),packs:V(Uye)}).loose(),H({results:V(H({id:L().min(1),name:L().min(1),source:L().min(1),description:L(),installs:R().int().nonnegative().nullable(),publisher:L().nullable()}).loose()),backend:W([`skills.sh`,`github-fallback`]),degraded:z()}).loose(),H({title:L(),description:L(),image:L().nullable(),skillsUrl:L().nullable(),sourceKind:W([`github`,`site`]),sourceUrl:L()}).loose(),H({skills:V(H({name:L(),description:L().nullable()}).loose())}).loose(),H({kind:W([`local`,`import`,`none`]),scope:W(Qd).optional(),name:L().optional(),dir:L().optional(),source:L().optional(),ref:L().optional(),via:W([`source`,`publisher`]).optional()}).loose();const Wye=H({relPath:L(),content:L().nullable()}).loose(),Gye=H({provider:L(),plugin:L(),version:L().optional(),marketplace:L().optional(),repositoryUrl:L().optional()}).loose(),Kye=H({provider:L(),plugin:L(),version:L().optional(),description:L().optional(),repositoryUrl:L().optional(),bundledSkills:V(L()),capabilities:H({commands:z(),hooks:z(),mcp:z(),agents:z()}),setupSupported:z()}).loose();H({name:L(),description:L().nullable(),skillMd:L(),files:V(Wye),plugin:Gye.optional(),pluginBundle:Kye.optional()}).loose();const qye=[`auth-error`,`detached-head`,`dirty-tree`,`diverged-local-commits`,`external-changes-pending`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`no-push-permission`,`non-content-merge-failure`,`protected-branch`,`unsafe-incoming-symlinks`],eJ=e=>e*8+4;eJ(92),eJ(40),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null})(),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const tJ={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},nJ=`state/bug-reports`,Jye=fa({at:L(),transport:L(),outcome:L(),reference:L().optional(),error:L().optional(),errorCode:L().optional()}),Yye=fa({reason:L(),at:L(),errorCode:L().optional()});fa({version:R().int().catch(1),id:L(),createdAt:L(),bundleLevel:L(),zipBytes:R().int().nonnegative().catch(0),zipDeleted:z().optional(),state:L(),systemWide:z().optional(),projectSlug:L().nullable().optional(),reference:L().optional(),lastError:Yye.optional(),attempts:V(Jye).optional(),note:L().optional()}),fa({version:R().int().catch(1),id:L().optional(),sentAt:L().optional(),reference:L().optional()});const Xye=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 Zye(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Qye(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(Zye).join(`_`)}`}function $ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ebe(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=mu(du,t);if(e!==void 0){if(e.scope===`project-local`){let e=Qye(t),o;i!=null&&r!=null&&n!=null&&(o=Cd({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...Xye.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if($ye(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}const rJ=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${rJ}\\.${rJ}\\.${rJ}$`);function iJ(e,t){return e===`unix-chain`?`# ok-mcp${t}-v`:`# ok-mcp${t}-win-v`}function aJ(e){return e.replace(/\/+/g,`/`).replace(/\/+$/,``)}function tbe(e){return rt[e].userHomeDirName}function nbe(e,t){return e===`stable`?`${aJ(t)}/Library/Application Support/OpenKnowledge/path-install.json`:`${aJ(t)}/${tbe(e)}/path-install.json`}const rbe=[`.ok`,Pd,`installed-skills.json`],ibe=W(Qd),abe=fa({hosts:V(L()),scope:ibe,scripts:z(),installedAt:Di(),projection:W([`symlink`,`copy`]).optional(),contentHash:L().optional()}),obe=fa({schema:G(1),skills:U(L(),abe).default({})});function sbe(e){let t;try{t=JSON.parse(e)}catch{return null}let n=obe.safeParse(t);return n.success?n.data:null}function oJ(e){if(e===``)throw Error(`toPathspec: empty path. ":(literal)" is an empty pattern that matches every tracked path; pass "." if you meant the repo root.`);return`:(literal)${e}`}function cbe(e){if(e.length===0)throw Error(`pathspecArgs: empty path list. A bare "--" removes the pathspec restriction rather than selecting nothing.`);return[`--`,...e.map(e=>oJ(e))]}const sJ=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of sJ){let t=DB.find(t=>t.name===e.tagName);if(!t)throw Error(`JSX_SRC_REF_TAGS: no built-in component descriptor named '${e.tagName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the tagName to match a descriptor in builtInComponents.`);if(!t.props.some(t=>t.name===e.attrName))throw Error(`JSX_SRC_REF_TAGS: component '${e.tagName}' declares no prop named '${e.attrName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the attrName to match one of the descriptor's props.`)}GV(),lV(),uV();function lbe(){return DB.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function ube(){return lbe().filter(e=>{let t=dbe(e);return t!==`fence`&&t!==`html`})}function dbe(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}const cJ=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),lJ=globalThis;lJ[cJ]===void 0&&(lJ[cJ]=zr());const uJ=lJ[cJ],dJ=fa({version:L().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(uJ,{description:`Recorded skill version for this target.`}),recordedAt:Di().register(uJ,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:W([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(uJ,{description:`Install-source surface that recorded this entry.`}).optional()}),fbe=fa({enabled:z().register(uJ,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Di().register(uJ,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});fa({schema:G(1).register(uJ,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:fa({"claude-cowork":dJ.optional(),"cli-hosts":dJ.optional()}).register(uJ,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:U(L(),fbe).register(uJ,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:V(L()).register(uJ,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const pbe=/<script(?![^>]*\ssrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi;function mbe(e){return[[`script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'`,...[...e.matchAll(pbe)].map(e=>`'sha256-${Te(`sha256`).update(e[1]??``).digest(`base64`)}'`)].join(` `),`worker-src 'self' blob:`,`object-src 'none'`,`base-uri 'self'`].join(`; `)}mbe(``);function hbe(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Cd({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function fJ(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return O(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function pJ(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function gbe(e){let t=[],n=[[`maxBatchSize`,1,ru],[`maxBatchChars`,1,iu],[`docTimeoutMs`,1,au]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=pJ(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Cd({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function _be(e){let t=pJ(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=Ul.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Cd({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function vbe(e){let t=pJ(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=Gl.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Cd({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function mJ(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=du.parse({});if(!_(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=C(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,js.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?fJ(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=Od({value:c,file:t,source:o,doc:s}),u=l.length>0?Ad(c):c,d=[..._be({rawConfig:u,doc:s,source:o,absPath:t}),...vbe({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=du.safeParse(u);if(!f.success){let e=hbe(f,s,o,t),c=du.shape.git.safeParse(pJ(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?fJ(t,r,i):void 0,h=[...l,...d,...Yd(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...gbe({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}function hJ(e=_e()){return M(e,mt().userHomeDirName)}const gJ=`.tmp.`,_J=[8,4,4,4,12];function ybe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const bbe=_J.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),xbe=_J.map(e=>`[0-9a-f]{${e}}`).join(`-`);`${bbe}`,RegExp(`${ybe(gJ)}${xbe}$`);function Sbe(e){return`${e}${gJ}${Ee()}`}function Cbe(e){try{let t=A(e),n=`${ae(e)}${gJ}`,r=Date.now()-3e4;for(let e of T(t)){if(!e.startsWith(n))continue;let i=M(t,e);try{ne(i).mtimeMs<r&&re(i)}catch{}}}catch{}}function vJ(e,t,n={}){Cbe(e);let r=Sbe(e);try{k(r,t,{encoding:`utf-8`,mode:n.mode??420}),O(r,e)}catch(e){try{re(r)}catch{}throw e}}var yJ=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function wbe(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new yJ(e,r);s=!1;let c;try{c=x(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=ne(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{re(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new yJ(e,r);await yie(i);continue}try{return await t()}finally{try{f(c)}catch{}try{re(e)}catch{}}}}function Tbe(e){let t=Date.now()+e;for(;Date.now()<t;);}function bJ(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new yJ(e,r);s=!1;let c;try{c=x(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=ne(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{re(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new yJ(e,r);Tbe(i);continue}try{return t()}finally{try{f(c)}catch{}try{re(e)}catch{}}}}const xJ=`config.yml`;function SJ(e,t,n){if(e===`user`)return ce(hJ(n??_e()),`global.yml`);let r=oe(t)?t:ce(t);return e===`project-local`?ce(r,`.ok`,Pd,xJ):ce(r,`.ok`,xJ)}const Ebe=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function CJ(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:aP(t.replaceAll(`_`,`-`))}function Dbe(e){for(let t of Ebe){let n=e[t]?.trim();if(n!==void 0&&n!==``)return CJ(n)}return null}function Obe(e){let t=e.OK_LANG?.trim();if(t!==void 0&&t!==``)return aP(t)??void 0}function kbe(e=process.env){let t=Obe(e),n=Dbe(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=CJ(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}function wJ(){return zd(Id)}function TJ(){return mt().keyringService}function EJ(e){try{e()}catch{}}var Abe=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(TJ(),e).getPassword()}catch(t){return EJ(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return EJ(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return EJ(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(TJ(),e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(TJ(),e).deletePassword()}catch{}}},DJ=class{backend=`file`;authFile;constructor(e){this.authFile=e??M(hJ(),`auth.yml`)}read(){if(!_(this.authFile))return{};try{let e=C(this.authFile,`utf-8`);return(0,js.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=A(this.authFile);_(t)||y(t,{recursive:!0,mode:448}),vJ(this.authFile,(0,js.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},jbe=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ${wJ()} to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function OJ(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(TJ(),`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
|
|
429
|
+
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function tve(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&eve(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=$_e(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function tq(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);nq(i.charCodeAt(i.length-1),s,r)&&(o=rq(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return nq(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+rq(c)),o}function nq(e,t,n){return!(pp(t)!==1||n===`_`&&pp(e)===void 0)}function rq(e){return`&#x${e.toString(16).toUpperCase()};`}function nve(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!ive(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function rve(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=tq(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function ive(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}const iq=[{mode:`protecting`,protect:fH,reservations:uH},{mode:`protecting`,protect:uU,reservations:_H},{mode:`protecting`,protect:oH,reservations:nH},{mode:`serializer-only`,reservations:[{to:``}]}];new Set(iq.flatMap(({reservations:e})=>e.map(({to:e})=>e)));function ave(e,t){switch(t.mode){case`protecting`:return t.protect(e);case`serializer-only`:return e}}function aq(e){return iq.reduce(ave,e)}function oq(e){return e.data?.sourceRaw}function ove(e){return e.type===`text`?e.value===``:e.type===`mdxJsxTextElement`&&oq(e)===``}function sq(e){return e.type===`paragraph`&&(e.children??[]).every(ove)}function cq(e){let t=e.children??[],n=t[0]?.children?.length??0,r=0;for(let e=1;e<t.length;e++)r=Math.max(r,t[e]?.children?.length??0);let i=e.align??[];return Math.max(n,r,i.length)}function sve(e){switch(e.type){case`table`:return cq(e)===0;case`code`:return e.data?.sourceStyle===`indented`&&/^\n*$/.test(e.value??``);case`thematicBreak`:return oq(e)===``;case`html`:return(e.value??``)===``;case`mdxJsxFlowElement`:return oq(e)===void 0&&e.data?.htmlBoundary===void 0&&(e.children??[]).length===0&&!e.name;case`list`:return(e.children??[]).length===0;default:return!1}}function cve(e){let t=[];for(let n of e.children){if(n.type===`table`&&cq(n)===0){console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:(n.children??[]).length}));continue}sve(n)||(n.type===`paragraph`&&n.children.length>0&&sq(n)&&(n.children=[]),t.push(n))}e.children=t}function lve(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const uve=(e,t)=>{if(sq(e)||lve(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},lq=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function dve(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;gp(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;let a=HN(e);lq.lastIndex=0;let o=[],s;for(;(s=lq.exec(i))!==null;){let e=s.index,t=e+s[0].length;if(KN(a,e,1)||KN(a,t-1,1)){lq.lastIndex=e+1;continue}o.push(s)}if(o.length===0)return;let c=[],l=0;for(let t of o){let r=t.index,i=r+t[0].length;r>l&&c.push(GN(n,e,l,r));let a={type:`inlineMath`,value:t[1]},o=YN(n,e,r,i);o&&(a.position=o),c.push(a),l=i}return l<i.length&&c.push(GN(n,e,l,i.length)),r.children.splice(t,1,...c),[Gf,t+c.length]})}}const fve=new Set([`strong`,`emphasis`,`delete`,`link`,`mark`,`comment`]);function pve(e){if(e?.type!==`break`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}function mve(e){e.data??={},e.data.sourceRaw=`<br />`,e.data.sourceStyle=`html`}function uq(e){if(e?.type!==`text`)return!1;let t=e.data?.sourceRaw;return typeof t!=`string`||t.length===0}const dq=/[ \t]+$/,fq=/^[ \t]*$/;function hve(e){return e.some(e=>!(uq(e)&&fq.test(e.value)))}function pq(e,t=!1){for(;e.length>0;){let n=e[e.length-1];if(pve(n)){mve(n);break}if(n&&fve.has(n.type)&&`children`in n){let t=n.children;if(pq(t,!0),t.length===0){e.pop();continue}}if(!t&&uq(n)&&dq.test(n.value)){let t=n.value.replace(dq,``);if(t.length>0){n.value=t;continue}if(hve(e.slice(0,-1))){e.pop();continue}if(e.every(e=>uq(e)&&fq.test(e.value))){let t=e[0];t.value=t.value.charAt(0),e.splice(1)}}break}}const gve=new Set([`paragraph`,`heading`,`tableCell`]);function _ve(e){let t=e=>{if(gve.has(e.type)&&`children`in e&&pq(e.children),`children`in e)for(let n of e.children)t(n)};t(e)}const mq={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[A-Za-z]|[^\\x00-\\x7F]`}]};function vve(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===mq)||e.toMarkdownExtensions.push(mq)}const yve=new Set([`u`,`ins`]);function bve(){return e=>{gp(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name===null||!yve.has(e.name)||(e.attributes??[]).length>0)return;let r={type:`underline`,children:e.children??[],data:{sourceForm:e.name===`ins`?`ins`:`u`}};return e.position&&(r.position=e.position),n.children.splice(t,1,r),t+1})}}function xve(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const Sve=[{name:`remark-parse`,plugin:yg},{name:`escape-provenance`,plugin:aK},{name:`remark-mdx-agnostic`,plugin:vU},{name:`remark-gfm`,plugin:Zm},{name:`remark-math`,plugin:SW,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:VU},{name:`remark-github-alerts`,plugin:vW,options:XW},{name:`callout-transformer`,plugin:YW},{name:`restore-from-mdx`,plugin:fU},{name:`void-br-promoter`,plugin:SU},{name:`restore-entity-refs`,plugin:lH},{name:`restore-backslash-escapes`,plugin:pH},{name:`details-accordion-promoter`,plugin:PG},{name:`div-align-promoter`,plugin:UG},{name:`image-promoter`,plugin:pK},{name:`indented-code-promoter`,plugin:yK},{name:`math-promoter`,plugin:kK},{name:`single-dollar-math-promoter`,plugin:dve},{name:`highlight-promoter`,plugin:fK},{name:`underline-promoter`,plugin:bve},{name:`mermaid-promoter`,plugin:k_e},{name:`comment-promoter`,plugin:$W},{name:`merged-post-parse-walker`,plugin:D_e},{name:`empty-task-item-unmint`,plugin:XG},{name:`link-reference-destination`,plugin:DK},{name:`non-rendering-context-demote`,plugin:R_e},{name:`ensure-non-empty-doc`,plugin:()=>xve}];function Cve(e){let t=vh();for(let e of Sve)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(uW,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function wve(e){let t=vh().use(qh,[`yaml`]).use(Zm,{tablePipeAlign:!1}).use(SW,{singleDollarTextMath:!1}).use(vU).use(VU).use(vve).use(Pz,{bullet:`-`,fences:!0,rule:`-`,join:[uve],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function hq(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const gq=/^\n+$/,_q=/^\n{2,}$/;function vq(e,t,n){let r,i,a=e.children;if(a.length>0){let e=a[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);gq.test(n)&&(r=n)}let n=a[a.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);_q.test(e)&&(i=e)}}if(!n&&r===void 0&&i===void 0)return;let o={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i}};return e.data??={},e.data.sourceDocBoundary=o,o}function Tve(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&gq.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&_q.test(t.trailing)&&(n.trailing=t.trailing),n.bom||n.leading||n.trailing?n:void 0}function Eve(e,t){let{source:n,hadBom:r}=hq(e),i=CG(n),a=new uh(aq(i)),o=t.parse(a);a.value=i;let s=t.runSync(o,a);CK(s,i);let c=vq(s,i,r),l=c?Ps(s,c):void 0,u=t.stringify(s);return l?u.type.create({...u.attrs,sourceDocBoundary:l},u.content,u.marks):u}function Dve(e,t){return yq(e,t,!1)}function Ove(e,t){return yq(e,t,!0)}function yq(e,t,n){let{source:r,hadBom:i}=hq(e),a=CG(r),o=new uh(aq(a)),s=t.parse(o);o.value=a;let c=t.runSync(s,o);n&&CK(c,a);let l=vq(c,a,i);return n&&l&&Ps(c,l),c}function kve(e,t,n){let r=fW(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});bq(r),JG(r),_ve(r),cve(r);let i=Tve(e.attrs?.sourceDocBoundary),a=String(t.stringify(r));return i?.leading&&(a=i.leading+a),i?.trailing&&(a=a.replace(/\n+$/,``)+i.trailing),i?.bom&&(a=`\uFEFF${a}`),a}function bq(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)bq(t);for(let t=0;t+1<e.children.length;){let n=e.children[t],r=e.children[t+1],i=n?.data,a=r?.data,o=LN(i)?i.escapedChars:null,s=LN(a)?a.escapedChars:null;if(n?.type!==`text`||r?.type!==`text`||typeof n.data?.sourceRaw==`string`||typeof r.data?.sourceRaw==`string`||o===null&&s===null){t+=1;continue}let c=n.value.length;n.value+=r.value,n.data??={},n.data.escapedChars=[...o??[],...(s??[]).map(e=>({...e,offset:e.offset+c}))],r.data?.entityRefSpans?.length&&(n.data.entityRefSpans=[...n.data.entityRefSpans??[],...r.data.entityRefSpans.map(e=>({...e,offset:e.offset+c}))]),e.children.splice(t+1,1)}}}var Ave=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=sO(e.extensions),this.handlers=Fve(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?cc({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=Ive(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=Cve({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=wve({toMarkdownHandlers:W_e})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return Eve(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Dve(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?Ove(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?TW(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return kve(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}};const xq=kB();function Sq(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else r[e]=i?.type===`boolean`?t.value===`true`:t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function jve(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function Mve(e,t){return e.attrs.sourceDirty||jve(e)?!0:t?t.isDiverged(e.toJSON()):!1}function Nve(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0||t.every(e=>e.type===`text`&&e.value===``)}function Cq(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function wq(e,t){if(e.length===0)return Cq({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return Cq({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[wq(n.children,t)]}}return Cq({type:`inlineCode`,value:Tq(e)},t)}function Tq(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=Tq(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const Pve=Rc;function Fve(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=sW(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=sW(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=JU(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r,sourceUrlForm:e.data?.sourceUrlForm??null})},i.imageReference=n.imageReference?e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&gc(t.raw)!==null&&pc(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i){if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=gc(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i))}u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=cW(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=cW(r.highlight)),r.underline&&(i.underline=cW(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=cW(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=sW(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=cW(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=cW(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=sW(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=sW(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=sW(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker,s=!!o.spec.attrs?.sourceUrlForm;i.definition=i=>{let c={title:i.title??null};return n&&(c.identifier=i.identifier??``),c.label=i.label??i.identifier??``,e?c.url=i.url??``:t&&(c.href=i.url??``),r&&(c.sourceLayout=i.data?.sourceLayout??null),a&&(c.sourceTitleMarker=i.data?.sourceTitleMarker??null),s&&(c.sourceUrlForm=i.data?.sourceUrlForm??null),o.createAndFill(c)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=xq.getOrWildcard(o),c=Sq(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=JU(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?xq.get(i):void 0;if(o&&n.jsxInline){let e=Sq(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=i.data?.sourceTarget??null,u=i.data?.sourceAnchor??null,d=i.data?.sourceAlias??null,f=YO(o),{resolveEmbed:p,sourcePath:m}=t.current,h=p&&m?p(o,m)??null:null,g=h?`/${h}`:o,_=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(_&&Pve.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,alt:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&zc.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&Vc.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,title:s??o,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d}});if(_&&Hc.has(f)&&n.jsxComponent&&xq.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&m?e(o,m)??null:null,i=r===null?null:YU(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:g,target:o,anchor:c,alias:s,size:i,sourceTarget:l,sourceAnchor:u,sourceAlias:d}})}let v=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:g,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s,sourceTarget:l,sourceAnchor:u,sourceAlias:d});return e.text(v,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=sW(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function Ive(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=pW(`paragraph`)),i.blockquote&&(n.blockquote=pW(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=pW(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0||void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0||void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=pW(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&Nve(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=pW(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:gP(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>{let t={type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title};return e.attrs.sourceUrlForm===`angle-bracketed`&&(t.data={sourceUrlForm:`angle-bracketed`}),t}),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!Mve(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:xq.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:xq,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return Qz(t,e,xq.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=mW(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=mW(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return wq(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0||void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=mW(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=mW(`mark`)),a.underline&&(r.underline=mW(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=mW(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=pW(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=pW(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,o=typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,s=typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null,c=i||(r?`${t}#${r}`:t),l=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return l!==c&&l.trim().length>0&&!l.includes(`]]`)&&(i=l,c=l),{type:`wikiLinkEmbed`,value:c,data:{target:t,anchor:r,alias:i,sourceTarget:a,sourceAnchor:o,sourceAlias:s},children:[{type:`text`,value:c}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return UO(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}const Lve=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(DB.flatMap(e=>e.surface===`compat`&&Lve.has(e.rendersAs)?[[e.name,e]]:[])),Ese(`<>`);var Eq={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100};Eq.SINGLE_TILDE,Eq.COMPARISON_OPERATORS,Eq.HTML_TAGS,Eq.SETEXT_HEADINGS,Eq.LINKS,Eq.BOLD_ITALIC,Eq.BOLD,Eq.ITALIC_DOUBLE_UNDERSCORE,Eq.ITALIC_SINGLE_ASTERISK,Eq.ITALIC_SINGLE_UNDERSCORE,Eq.INLINE_CODE,Eq.STRIKETHROUGH,Eq.KATEX,Eq.INLINE_KATEX,vh().use(yg).use(Zm);const Dq=W(Ct),Rve=W(tee),zve=H({alwaysOn:R().int().nonnegative(),onTrigger:R().int().nonnegative(),onDemand:R().int().nonnegative()}).strict();H({intents:V(H({satisfierId:L().min(1),desired:W([`present`,`absent`])}).loose()),...gf,summary:_f}).loose();const Bve=H({satisfierId:L(),agentId:L(),piece:L(),scope:L(),kind:L(),pathId:L().optional(),desired:W([`present`,`absent`]),action:W(Na),errorId:L().optional()}).loose(),Vve=H({kind:L(),satisfierIds:V(L()),agentIds:V(L()),pathId:L().optional(),blockedReason:L().optional()}).loose(),Hve=H({state:L(),strictness:V(W(ja)).optional()}).loose(),Uve=H({probes:H({env:W([`desktop`,`local-web`,`remote-web`]),satisfiers:U(L(),Hve)}).loose(),detection:H({detected:V(L()),probed:z()}).loose()}).loose();H({actions:V(Bve),conflicts:V(Vve),withheld:V(L()),snapshot:Uve}).loose(),H({entries:V(H({level:W([`info`,`warn`,`error`]),message:L().max(8192),event:L().optional(),fields:U(L(),B()).optional(),ts:R().optional(),sourceId:L().optional(),lineNumber:R().optional()}).loose()).max(100),droppedSinceLastFlush:R().int().min(0).optional()}).loose(),H({accepted:R().int().min(0)}).loose();const Wve=H({exact:L().min(1),prefix:L(),suffix:L(),start:R().int().nonnegative(),end:R().int().nonnegative()}),Gve=V(ma([L(),R().int().nonnegative()])),Kve=ha(`kind`,[H({kind:G(`body`)}),H({kind:G(`property`),key:L().min(1),path:Gve.default([])})]).default({kind:`body`}),qve=W([`anchored`,`orphaned`,`resolved`]),Oq=H({threadId:L().min(1),docName:L().min(1),target:Kve,anchor:Wve.nullable(),state:qve,queued:z(),latestComment:L(),createdBy:L().min(1),createdAt:R(),updatedAt:R().optional()}),kq=H({docName:L(),instruction:L(),property:L().nullable(),passage:H({exact:L(),prefix:L(),suffix:L()}).nullable(),anchorLost:z(),passageRepeats:z()}).loose(),Aq=H({threadId:L(),ok:G(!0)}),jq=H({threadId:L(),ok:G(!1),error:G(`not-found`)});H({threads:V(Oq)}).loose(),H({meta:Oq,orphaned:z()}).loose(),H({threadId:L()}).loose(),H({meta:Oq,payload:kq}).loose(),H({results:V(ma([Aq.extend({meta:Oq,payload:kq}),jq]))}).loose(),H({results:V(ma([Aq.extend({meta:Oq}),jq]))}).loose();const Jve=[`ours`,`theirs`],Yve=[`check-failed`,`too-large`],Xve=H({duplicated:R().int().nonnegative(),restoredDeletedHere:R().int().nonnegative(),restoredDeletedOutside:R().int().nonnegative()}),Mq={id:L().min(1),docName:L().min(1),file:L().min(1),firstAt:L().min(1),lastAt:L().min(1),events:R().int().positive(),entries:V(L().min(1))},Nq=ha(`kind`,[H({...Mq,kind:G(`both-kept`),kept:Xve}).loose(),H({...Mq,kind:G(`moved-to-history`),side:W(Jve),reason:W(Yve)}).loose()]);H({notices:V(Nq)}).loose(),H({docName:L().min(1),id:L().min(1)}).loose(),H({dismissed:z()}).loose();const Zve=H({status:L().min(1),reason:L()}).loose();H({docName:L().min(1),content:L(),lifecycle:Zve.nullable()}).loose(),H({documents:V(H({kind:W([`document`,`asset`,`folder`,`file`]).default(`document`),docName:L().min(1).optional(),docExt:L().min(1).default(`.md`),size:R().int().nonnegative(),modified:L().min(1),isSymlink:z().default(!1),canonicalDocName:L().nullable().default(null),targetPath:L().nullable().default(null),path:L().min(1).optional(),assetExt:L().min(1).optional(),mediaKind:W([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:V(L().min(1)).optional(),hasChildren:z().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:z().optional()}).loose();const Qve=H({source:L().min(1),anchor:L().nullable(),title:L(),snippet:L().nullable()}).loose();H({docName:L().min(1),backlinks:V(Qve)}).loose(),H({counts:U(L().min(1),R().int().nonnegative())}).loose(),H({counts:U(L().min(1),R().int().nonnegative())}).loose();const $ve=ha(`kind`,[H({kind:G(`doc`),docName:L().min(1),anchor:L().nullable(),title:L(),snippet:L().nullable()}).loose(),H({kind:G(`external`),url:L().min(1),title:L(),snippet:L().nullable()}).loose()]),eye=H({role:L().min(1),sourceForm:L().min(1),targetKind:L().min(1),href:L(),resolvedTarget:L().nullable(),status:L().min(1),reason:L().nullable(),resolutionMethod:L().min(1),fallbackTarget:L().nullable().default(null),range:H({start:R().int().nonnegative(),end:R().int().nonnegative()}),line:R().int().nonnegative(),column:R().int().nonnegative(),definition:H({label:L(),line:R().int().nonnegative()}).nullable().default(null)}).loose();H({docName:L().min(1),forwardLinks:V($ve),localTargets:V(eye).optional()}).loose();const tye=ha(`kind`,[H({id:L().min(1),kind:G(`doc`),docName:L().min(1),anchor:L().nullable(),label:L(),cluster:L().nullable(),category:L().nullable(),tags:V(L()).nullable(),managed:z().optional()}).loose(),H({id:L().min(1),kind:G(`external`),url:L().min(1),label:L()}).loose()]),Pq=H({source:L().min(1),target:L().min(1)}).loose();H({nodes:V(tye),links:V(Pq)}).loose(),H({docNames:V(L().min(1).max(1024)).min(1).max(64)}).loose(),H({checked:R().int().nonnegative(),found:R().int().nonnegative()}).loose();const nye=H({ts:R().int().min(0),url:L(),method:L(),ua:L().optional(),origin:L().optional(),referer:L().optional(),host:L().optional(),remote:L().optional(),secChUa:L().optional(),secChUaMobile:L().optional(),secChUaPlatform:L().optional(),secFetchSite:L().optional(),secFetchDest:L().optional(),secFetchMode:L().optional(),secFetchUser:L().optional()}).loose(),rye=H({app:ma([G(`cursor`),G(`codex`),G(`claude`),aa()]),signals_fired:V(L())}).loose();H({entries:V(nye),count:R().int().min(0),detection:rye}).loose();const Fq=H({path:L().min(1),code:W([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:L().min(1).optional(),syncScoped:z(),open:ha(`kind`,[H({kind:G(`doc`),docName:L().min(1)}),H({kind:G(`asset`),path:L().min(1)})]).optional()}).loose();H({branch:L().nullable(),detached:z(),upstream:L().nullable(),staged:V(Fq),notStaged:V(Fq),untracked:V(Fq),incoming:V(Fq),truncated:z(),readable:z().default(!0)}).loose();const iye=W([`AWAITING_CHECKS`,`LOCKED`,`MERGEABLE`,`QUEUED`,`UNMERGEABLE`]),aye=W([`BEHIND`,`BLOCKED`,`CLEAN`,`DIRTY`,`DRAFT`,`HAS_HOOKS`,`UNKNOWN`,`UNSTABLE`]),oye=W([`APPROVED`,`CHANGES_REQUESTED`,`REVIEW_REQUIRED`]),sye=W([`ERROR`,`EXPECTED`,`FAILURE`,`PENDING`,`SUCCESS`]),cye=H({mergeQueue:H({position:R().int().nonnegative(),state:iye.nullable().catch(null)}).nullable().catch(null),autoMerge:z(),mergeState:aye.nullable().catch(null),reviewDecision:oye.nullable().catch(null),checks:sye.nullable().catch(null)}).loose(),lye=H({kind:W([`pull`,`issue`]),repo:L().min(1),number:R().int().positive(),title:L(),author:L().nullable(),createdAt:L(),lifecycle:W([`open`,`draft`,`merged`,`closed`,`completed`,`not-planned`]),additions:R().int().nonnegative().optional(),deletions:R().int().nonnegative().optional(),status:cye.optional()}).loose();H({url:L()}).loose(),ha(`ok`,[H({ok:G(!0),preview:lye}).loose(),H({ok:G(!1),reason:L()}).loose()]),H({writers:V(H({id:L().min(1),name:L().optional(),email:L().optional()}).loose()).optional(),summary:_f,...gf}).loose(),H({checkpointRef:L().min(1)}).loose();const uye=H({v:R().int().optional(),id:L().min(1),name:L().min(1),colorSeed:L().optional(),docs:V(L()),summaries:V(L()).optional()}).loose();H({entries:V(H({sha:L().min(1),timestamp:L().min(1),author:L(),authorEmail:L(),type:W([`checkpoint`,`wip`,`upstream`,`park`]),message:L(),contributors:V(uye),checkpoint:B().nullable(),parentSha:L().nullable().optional()}).loose()),total:R().int().nonnegative().optional(),truncated:z().optional(),hasMore:z().optional()}).loose(),H({sha:L().regex(/^[0-9a-f]{40}$/i),content:L(),timestamp:L(),author:L()}).loose(),H({contentDir:L().min(1),pathSeparator:W([`/`,`\\`]),symlinkResolved:z()}).loose(),V(ha(`source`,[H({docName:L().min(1),timestamp:L().min(1),size:R().int().nonnegative(),source:G(`flat`)}).loose(),H({docName:L().min(1),timestamp:L().min(1),source:G(`timeline`),sha:L().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const dye=H({domain:L().min(1),title:L().optional(),description:L().optional(),siteName:L().optional(),faviconDataUri:L().optional()}).loose();H({url:L()}).loose(),ha(`ok`,[H({ok:G(!0),metadata:dye}).loose(),H({ok:G(!1),reason:L()}).loose()]),H({orphans:V(H({docName:L().min(1),title:L()}).loose())}).loose(),H({hubs:V(H({docName:L().min(1),title:L(),count:R().int().nonnegative()}).loose())}).loose();const fye=H({source:L().min(1),title:L(),snippet:L().nullable()}).loose();H({deadLinks:V(H({target:L().min(1),sources:V(fye)}).loose())}).loose(),H({target:H({docName:L().min(1),title:L(),aliases:V(L())}).loose(),mentions:V(H({source:L().min(1),excerpt:L(),offset:R().int().nonnegative()}).loose()),truncated:z()}).loose(),H({projectPath:L().min(1)}).loose();const pye=W([`not-a-git-worktree`,`init-failed`]);ha(`ok`,[H({ok:G(!0),projectPath:L().min(1)}).loose(),H({ok:G(!1),reason:pye,message:L().min(1)}).loose()]),H({host:L().min(1).optional()}).loose(),H({host:L().min(1).optional(),token:L().min(1)}).loose(),H({host:L(),login:L()}).loose(),H({host:L().refine(Tc,{message:`Host must be a hostname with an optional :port, with no scheme or path`}),username:L().min(1),token:L().min(1)}).loose(),H({host:L(),login:L()}).loose(),H({key:L().min(1)}).loose(),H({keyPresent:z()}).loose();const mye=W([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);ha(`ok`,[H({ok:G(!0),endpoint:L().min(1),model:L().min(1),dimensions:R().int().positive()}).loose(),H({ok:G(!1),endpoint:L().min(1),model:L().min(1),reason:mye,status:R().int().optional()}).loose()]),H({name:L().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:L().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),H({authenticated:z()}).loose(),H({channel:W([`login`,`gh-login`]).default(`login`)}).loose(),H({}).loose();const hye=H({stackIndex:R().int().min(0),ts:R().int().min(0),additions:R().int().min(0),deletions:R().int().min(0)}).loose(),gye=H({docName:L().min(1),additionsTotal:R().int().min(0),deletionsTotal:R().int().min(0),lastTs:R().int().min(0),bursts:V(hye)}).loose(),_ye=H({displayName:L().min(1),color:L().min(1),icon:L().optional(),connectionId:L().min(1)}).loose();H({sessionAlive:z(),agent:_ye.nullable(),files:V(gye)}).loose(),H({diff:L(),before:L(),after:L(),properties:rP,generatedAt:R().int().min(0)}).loose(),H({}).loose(),H({}).loose(),H({}).loose(),H({}).loose(),H({}).loose(),H({}).loose();const vye=H({displayName:L().min(1),icon:L(),color:L().min(1),currentDoc:L().nullable(),mode:W([`idle`,`writing`]),ts:R().int().min(0)}).loose();H({presence:U(L().min(1),vye)}).loose();const yye=H({sessionId:L().min(1),agentType:L().min(1),ts:R().int().min(0),insertedChars:R().int().min(0),deletedChars:R().int().min(0)}).loose();H({effects:V(H({"doc.name":L().min(1),entries:V(yye)}).loose())}).loose(),H({decisions:V(H({ts:R().int().min(0),decision:L().min(1),kind:L().min(1),"doc.name":L().min(1),pathRole:L().min(1)}).loose())}).loose(),U(L().min(1),z()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),H({path:L().min(1,`path must be non-empty`)}).loose(),H({}).loose();const bye=H({fromDocName:L().min(1),toDocName:L().min(1)}).loose(),xye=H({fromPath:L().min(1),toPath:L().min(1)}).loose();H({}).loose(),H({path:L().min(1),...gf,summary:_f}).loose(),H({docName:L().min(1)}).loose(),H({path:L().min(1),...gf,summary:_f}).loose(),H({path:L().min(1)}).loose(),H({kind:W([`file`,`folder`]),path:L().min(1),...gf,summary:_f}).loose(),H({kind:W([`file`,`folder`]),path:L().min(1),duplicatedDocNames:V(L().min(1))}).loose(),H({pages:V(H({docName:L().min(1),title:L(),docExt:L().min(1),size:R().int().nonnegative(),modified:L().min(1),icon:L().min(1).max(2048).optional()}).loose())}).loose();const Sye=H({level:R().int().min(1).max(6),text:L(),slug:L()}).loose();H({docName:L().min(1),headings:V(Sye)}).loose();const Cye=H({docName:L().min(1),rewrites:R().int().nonnegative()}).loose();H({kind:W([`file`,`folder`,`asset`]),fromPath:L().min(1),toPath:L().min(1),...gf,summary:_f}).loose(),H({renamed:V(bye),renamedAssets:V(xye),rewrittenDocs:V(Cye).optional(),summary:yf.optional()}).loose(),H({kind:W([`file`,`folder`,`asset`]),path:L().min(1),...gf}).loose(),H({deletedDocNames:V(L().min(1))}).loose(),H({kind:W([`file`,`folder`,`asset`]),path:L().min(1),...gf,summary:_f}).loose(),H({deletedDocNames:V(L().min(1))}).loose(),H({docName:L().min(1),commitSha:L().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:_f,...gf}).loose(),H({restoredFrom:L().min(1),timestamp:L().min(1),summary:yf.optional(),warnings:wf.optional()}).loose();const wye=/^#[0-9a-fA-F]{6}$/,Tye=H(Object.fromEntries(ul.map(e=>[e,L().regex(wye,`must be a #rrggbb hex color`)]))),Iq=L().min(1).refine(hl,{message:`must contain a non-whitespace character`}),Lq=H({name:Iq,author:Iq.optional(),variant:W([`dark`,`light`]),palette:Tye}).loose();H({name:L().min(1),scheme:Lq,stem:L().min(1).optional(),extension:W([`.yaml`,`.yml`]).optional()}).loose(),H({id:L().min(1),filename:L().min(1)}).loose(),H({id:L().min(1),scheme:Lq}).loose(),H({id:L().min(1),filename:L().min(1)}).loose(),ha(`existed`,[H({existed:G(!1)}).loose(),H({existed:G(!0),filename:L().min(1),scheme:Lq}).loose()]),H({themes:V(ha(`ok`,[H({ok:G(!0),id:L().min(1),filename:L().min(1),scheme:Lq}),H({ok:G(!1),filename:L().min(1),id:L().min(1).optional(),code:L().min(1),conflictingFilenames:V(L().min(1)).min(2).optional()})])),truncated:z()}).loose();function Eye(e){return e.replace(/\\/g,`/`).split(`/`).filter(e=>e!==``&&e!==`.`)}function Dye(e){let t=Eye(e).at(-1);return t!==void 0&&$d.some(e=>t.toLowerCase().endsWith(e))}H({tags:V(H({name:L().min(1),count:R().int().nonnegative(),isLeaf:z()}).loose())}).loose();const Oye=H({docName:L().min(1),title:L(),matchingTags:V(L().min(1)),snippet:L().nullable()}).loose();H({name:L().min(1),docs:V(Oye)}).loose(),H({folder:B(),frontmatter_local:U(L(),B()).nullable(),warnings:V(L()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:V(W([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),H({path:L(),frontmatter:U(L(),B()).optional()}).loose(),H({applied:B()}).loose();const Rq=U(L(),B()).meta({description:`Free-form frontmatter map embedded in template payloads.`});H({template:H({name:L().min(1),folder:L(),scope:W([`local`,`inherited`]),path:L().min(1),frontmatter:Rq,body:L()}).strict()}).strict(),H({templates:V(H({name:L().min(1),title:L().optional(),description:L().optional(),path:L().min(1),source_folder:L()}).strict()),truncated:z()}).strict(),H({folder:L(),name:L(),body:pf.optional(),frontmatter:Rq.optional(),...gf,summary:_f}).strict(),H({path:L().min(1),created:z(),warnings:V(L())}).strict(),H({sourcePath:L().min(1),targetFolder:L(),name:L().optional(),title:L().optional(),deleteSource:z().optional(),...gf,summary:_f}).strict(),H({path:L().min(1),created:z(),warnings:V(L())}).strict(),H({existed:z(),path:L().min(1)}).strict(),H({fromFolder:L(),fromName:L(),toFolder:L(),toName:L(),body:pf.optional(),frontmatter:Rq.optional(),...gf,summary:_f}).strict(),H({from:L().min(1),to:L().min(1),committed:z()}).strict();const zq=W(Qd),kye=/^[a-z0-9-]+$/,Bq=H({name:L(),description:L(),metadata:H({pack:L()}).strict().optional()}).strict();H({skill:H({name:L().min(1),scope:zq,path:L().min(1),frontmatter:Bq,body:L(),files:V(H({path:L().min(1),text:L().nullable()})).optional(),managed:z().optional()}).strict()}).strict();const Aye=H({source:L().min(1),publisher:L().optional(),skill:L().optional(),marketplaceUrl:L().optional(),importedAt:L().min(1),autoUpdate:z().optional()}).strict(),jye=H({name:L().min(1),description:L().optional(),scope:zq,path:L().min(1),canonicalPath:L().min(1).optional(),filePaths:V(L()).optional(),absolutePath:L().min(1).optional(),installed:z(),hosts:V(L()),hostQualifier:L().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:V(L()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:U(L(),L()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:V(L()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:V(L()).optional(),installableEditors:V(L()).optional(),hubOffered:z().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:z().optional(),customPlacements:V(H({path:L(),mode:W([`copy`,`link`])}).strict()).optional(),plugin:H({name:L().min(1),marketplace:L().min(1),provider:L().min(1),url:L().optional()}).strict().optional(),managed:z().optional(),origin:Aye.optional(),pack:L().optional(),modified:z().optional(),revertable:z().optional(),ignored:z().optional(),size:zve.optional()}).strict();H({name:L().min(1),scope:zq,apply:z().optional()}).strict(),H({line:L().min(1),gitignorePath:L().min(1),applied:z(),alreadyTracked:z().optional()}).strict(),H({skills:V(jye),truncated:z()}).strict(),H({scope:zq.default(`project`),name:L().meta({description:`Managed skill name to create or update.`}),body:pf.optional(),frontmatter:Bq,...gf,summary:_f}).strict();const Vq=[`skill-name-vendor-word`,`skill-body-too-long`],Hq=V(W(Vq)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."});H({path:L().min(1),created:z(),warnings:V(L()),warningCodes:Hq}).strict(),H({scope:zq.default(`project`),name:L(),dryRun:z().optional(),setAutoUpdate:z().optional(),...gf,summary:_f}).strict(),H({name:L().min(1),updated:z(),source:L().min(1),localBody:L().optional(),upstreamBody:L().optional(),gitTracked:z().optional(),warnings:V(L()),warningCodes:Hq}).strict(),H({scope:zq.default(`project`),name:L(),...gf,summary:_f}).strict(),H({name:L().min(1),baselineRef:L().min(1),restoredFiles:V(L()),warnings:V(L())}).strict();const Uq=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`;H({existed:z(),path:L().min(1),warnings:V(L()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${Uq}`})}).strict(),H({scope:zq.default(`project`),fromName:L(),toName:L(),body:pf.optional(),frontmatter:Bq.optional(),...gf,summary:_f}).strict(),H({from:L().min(1),to:L().min(1),committed:z(),warnings:V(L()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${Uq}`})}).strict(),H({name:L(),toName:L().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:zq,toScope:zq,...gf,summary:_f}).strict(),H({scope:zq,path:L().optional(),droppedLocations:V(L()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:V(L()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${Uq}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),H({scope:zq,name:L(),toName:L(),...gf,summary:_f}).strict(),H({name:L().min(1)}).strict(),H({name:L(),home:L().min(1)}).strict(),H({docName:L().min(1)}).strict();const Wq=W([`reference`,`script`,`file`]);H({scope:zq.default(`project`),name:L(),path:L().min(1),content:L(),...gf,summary:_f}).strict().superRefine((e,t)=>{Dye(e.path)&&ff(e.content,t,[`content`])}),H({path:L().min(1),created:z(),kind:Wq,content:z()}).strict(),H({scope:zq.default(`project`),name:L(),from:L().min(1),to:L().min(1),...gf,summary:_f}).strict(),H({from:L().min(1),to:L().min(1),fromDocName:L().optional(),toDocName:L().optional()}).strict(),H({path:L().min(1),kind:Wq,text:L()}).strict(),H({path:L().min(1),existed:z(),kind:Wq}).strict();const Gq=ma([Rve,G(`agents`)]),Kq=L().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),qq=ma([Gq,Kq]);H({scope:zq.default(`project`),name:L(),targets:V(Gq).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:V(qq).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:V(qq).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:W([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:qq.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:z().optional(),setSource:L().min(1).optional(),place:H({dir:L().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:W([`copy`,`link`])}).strict().optional(),convert:H({target:qq.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:W([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:H({path:L().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...gf,summary:_f,fork:H({editor:L().min(1),action:W([`align`,`make-source`,`rename`]),toName:L().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"});const Jq=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`,`links-not-permitted`];H({name:L().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:V(L()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:z().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:V(L()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:V(W(Jq)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:L().optional(),sourceMovedTo:L().optional()}).strict(),H({scope:zq.default(`project`),name:L().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),H({name:L().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:z().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),H({targets:V(Dq),configured:z(),folders:V(H({scope:zq,host:L(),root:L(),state:W([`own`,`linked`,`linked-parent`,`absent`]),target:L().optional(),drift:G(!0).optional(),expected:L().optional()}).strict()).optional()}).strict();const Yq=H({action:G(`link`),scope:zq,root:L().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:L().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),Xq=H({action:G(`unlink`),scope:zq,root:L().min(1).meta({description:`The linked folder to materialize back.`}),exclude:V(L().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),Zq=H({action:G(`add-root`),scope:zq,root:Kq.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),Mye=ha(`action`,[Yq.extend({preview:z().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),Xq,Zq]);ha(`action`,[Yq.strict(),Xq,Zq]),H({folderAction:Mye}).strict();const Nye=H({moves:V(L()),drops:V(L()),removes:V(L()),replaces:V(L()),conflicts:V(L()),strays:V(L())}).strict();H({targets:V(Dq),reprojected:V(H({name:L(),hosts:V(L())}).strict()),bundleHosts:V(L()),removedFrom:V(L()),folder:H({moved:V(L()),dropped:V(L()),linked:V(L())}).strict().optional(),preview:Nye.optional()}).strict(),H({scope:zq.default(`project`),name:L(),version:L().regex(/^[0-9a-f]{40}$/i),...gf,summary:_f}).strict(),H({name:L().min(1),version:L(),restoredFiles:V(L()),warnings:V(L())}).strict(),H({query:L().optional(),intent:W([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:W([`navigation`,`relevance`]).optional(),scopes:V(W([`page`,`folder`,`content`,`file`])).optional(),scope:L().optional(),limit:R().int().nonnegative().optional(),semantic:z().optional(),source:W([`omnibar`,`mcp`,`http`]).optional()}).loose();const Pye=H({kind:W([`page`,`folder`,`content`,`file`]),path:L().min(1),title:L(),score:R(),signals:U(L(),B()),snippet:L().optional()}).loose(),Fye=W([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),Qq=W([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]),$q=H({capable:z(),applied:z(),outcome:Fye,providerErrorReason:Qq.nullable().optional().catch(null),coverage:H({embedded:R().int().nonnegative(),total:R().int().nonnegative()})}).loose();H({enabled:z(),keyPresent:z(),keyNotRequired:z(),keySource:W([`project`,`file`,`env`]).nullable(),keyHint:L().nullable(),ready:z(),capable:z(),providerError:z().optional(),providerErrorReason:Qq.nullable().optional().catch(null),embedded:R().int().nonnegative(),total:R().int().nonnegative()}).loose(),H({query:L(),intent:W([`autocomplete`,`full_text`,`omnibar`]),results:V(Pye),elapsedMs:R().nonnegative(),semantic:$q.optional(),truncated:z().optional(),ready:z().optional()}).loose();const Iye=H({version:L().min(1),recordedAt:L().min(1)}).loose();H({currentVersion:L().min(1),targets:U(L(),Iye.nullable())}).loose(),H({scope:zq.default(`project`),source:L().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:L().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:z().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:z().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...gf,summary:_f}).strict(),H({scope:zq.default(`project`),source:L().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:V(L().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:z().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:z().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...gf,summary:_f}).strict(),H({results:V(H({requested:L(),status:W([`imported`,`already-imported`,`not-found`,`failed`]),name:L().optional(),collisionRenamedFrom:L().optional(),warnings:V(L()),warningCodes:Hq,error:L().optional()}).loose()),imported:R(),alreadyImported:R(),failed:R()}).loose(),H({scope:zq.default(`project`),names:V(L().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...gf,summary:_f}).strict(),H({results:V(H({requested:L(),status:W([`updated`,`up-to-date`,`not-found`,`failed`]),source:L().optional(),warnings:V(L()),warningCodes:Hq,error:L().optional()}).loose()),updated:R(),upToDate:R(),failed:R()}).loose();const Lye=H({source:L(),ref:L().optional(),contentHash:L(),publisher:L().optional()}).loose();H({name:L().min(1).meta({description:`Managed skill name created or matched.`}),path:L().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:z().meta({description:`True when this request created new source files.`}),alreadyImported:z().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:L().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:Lye,warnings:V(L()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:Hq}).loose();const Rye=W([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]);H({v:G(1),ch:G(`server-info`),seq:R(),serverInstanceId:L().min(1),currentBranch:L().min(1).optional()}).loose(),H({v:G(1),ch:G(`branch-switched`),seq:R(),branch:L().min(1)}).loose(),H({v:G(1),ch:Rye,seq:R()}).loose(),H({v:G(1),ch:G(`disk-ack`),seq:R(),docName:L().min(1),sv:L().min(1)}).loose(),H({v:G(1),ch:G(`config-validation-rejected`),seq:R(),docName:L().min(1),error:Eie}).loose(),H({v:G(1),ch:G(`config-ignore-nested-error`),seq:R(),path:L().min(1),error:L().min(1)}).loose(),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const zye=fa({name:L(),description:L(),files:fa({skillMd:L(),scripts:V(L()),references:V(L())})}),Bye=fa({pluginProvider:L().optional(),plugin:L().optional(),marketplace:L().optional(),repositoryUrl:L().optional(),version:L().optional(),gitCommitSha:L().optional(),scope:L().optional(),projectPath:L().optional()}),Vye=fa({commands:z(),hooks:z(),mcp:z()}),Hye=fa({...zye.shape,sourceHarness:L(),sourceHarnesses:V(L()),home:L(),provenance:Bye,inert:Vye,outsideProject:z().optional()}),Uye=fa({schema:G(1),name:L(),version:L(),description:L().optional(),author:fa({name:L()}).optional(),skills:V(L()),hostCompatibility:V(L()).optional(),capabilities:fa({scripts:L(),network:L(),inert:V(L())}).optional(),provenance:fa({source:L(),ref:L(),contentHash:L()}).optional()});H({skills:V(Hye),packs:V(Uye)}).loose(),H({results:V(H({id:L().min(1),name:L().min(1),source:L().min(1),description:L(),installs:R().int().nonnegative().nullable(),publisher:L().nullable()}).loose()),backend:W([`skills.sh`,`github-fallback`]),degraded:z()}).loose(),H({title:L(),description:L(),image:L().nullable(),skillsUrl:L().nullable(),sourceKind:W([`github`,`site`]),sourceUrl:L()}).loose(),H({skills:V(H({name:L(),description:L().nullable()}).loose())}).loose(),H({kind:W([`local`,`import`,`none`]),scope:W(Qd).optional(),name:L().optional(),dir:L().optional(),source:L().optional(),ref:L().optional(),via:W([`source`,`publisher`]).optional()}).loose();const Wye=H({relPath:L(),content:L().nullable()}).loose(),Gye=H({provider:L(),plugin:L(),version:L().optional(),marketplace:L().optional(),repositoryUrl:L().optional()}).loose(),Kye=H({provider:L(),plugin:L(),version:L().optional(),description:L().optional(),repositoryUrl:L().optional(),bundledSkills:V(L()),capabilities:H({commands:z(),hooks:z(),mcp:z(),agents:z()}),setupSupported:z()}).loose();H({name:L(),description:L().nullable(),skillMd:L(),files:V(Wye),plugin:Gye.optional(),pluginBundle:Kye.optional()}).loose();const qye=[`auth-error`,`detached-head`,`dirty-tree`,`diverged-local-commits`,`external-changes-pending`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`no-push-permission`,`non-content-merge-failure`,`protected-branch`,`unsafe-incoming-symlinks`],eJ=e=>e*8+4;eJ(92),eJ(40),(()=>{let e=globalThis.Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null})(),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const tJ={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},nJ=`state/bug-reports`,Jye=fa({at:L(),transport:L(),outcome:L(),reference:L().optional(),error:L().optional(),errorCode:L().optional()}),Yye=fa({reason:L(),at:L(),errorCode:L().optional()});fa({version:R().int().catch(1),id:L(),createdAt:L(),bundleLevel:L(),zipBytes:R().int().nonnegative().catch(0),zipDeleted:z().optional(),state:L(),systemWide:z().optional(),projectSlug:L().nullable().optional(),reference:L().optional(),lastError:Yye.optional(),attempts:V(Jye).optional(),note:L().optional()}),fa({version:R().int().catch(1),id:L().optional(),sentAt:L().optional(),reference:L().optional()});const Xye=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 Zye(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Qye(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(Zye).join(`_`)}`}function $ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ebe(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=mu(du,t);if(e!==void 0){if(e.scope===`project-local`){let e=Qye(t),o;i!=null&&r!=null&&n!=null&&(o=Cd({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...Xye.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if($ye(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}const rJ=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${rJ}\\.${rJ}\\.${rJ}$`);function iJ(e,t){return e===`unix-chain`?`# ok-mcp${t}-v`:`# ok-mcp${t}-win-v`}function aJ(e){return e.replace(/\/+/g,`/`).replace(/\/+$/,``)}function tbe(e){return rt[e].userHomeDirName}function nbe(e,t){return e===`stable`?`${aJ(t)}/Library/Application Support/OpenKnowledge/path-install.json`:`${aJ(t)}/${tbe(e)}/path-install.json`}const rbe=[`.ok`,Pd,`installed-skills.json`],ibe=W(Qd),abe=fa({hosts:V(L()),scope:ibe,scripts:z(),installedAt:Di(),projection:W([`symlink`,`copy`]).optional(),contentHash:L().optional()}),obe=fa({schema:G(1),skills:U(L(),abe).default({})});function sbe(e){let t;try{t=JSON.parse(e)}catch{return null}let n=obe.safeParse(t);return n.success?n.data:null}function oJ(e){if(e===``)throw Error(`toPathspec: empty path. ":(literal)" is an empty pattern that matches every tracked path; pass "." if you meant the repo root.`);return`:(literal)${e}`}function cbe(e){if(e.length===0)throw Error(`pathspecArgs: empty path list. A bare "--" removes the pathspec restriction rather than selecting nothing.`);return[`--`,...e.map(e=>oJ(e))]}const sJ=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of sJ){let t=DB.find(t=>t.name===e.tagName);if(!t)throw Error(`JSX_SRC_REF_TAGS: no built-in component descriptor named '${e.tagName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the tagName to match a descriptor in builtInComponents.`);if(!t.props.some(t=>t.name===e.attrName))throw Error(`JSX_SRC_REF_TAGS: component '${e.tagName}' declares no prop named '${e.attrName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the attrName to match one of the descriptor's props.`)}GV(),lV(),uV();function lbe(){return DB.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function ube(){return lbe().filter(e=>{let t=dbe(e);return t!==`fence`&&t!==`html`})}function dbe(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}const cJ=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),lJ=globalThis;lJ[cJ]===void 0&&(lJ[cJ]=zr());const uJ=lJ[cJ],dJ=fa({version:L().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(uJ,{description:`Recorded skill version for this target.`}),recordedAt:Di().register(uJ,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:W([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(uJ,{description:`Install-source surface that recorded this entry.`}).optional()}),fbe=fa({enabled:z().register(uJ,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Di().register(uJ,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});fa({schema:G(1).register(uJ,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:fa({"claude-cowork":dJ.optional(),"cli-hosts":dJ.optional()}).register(uJ,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:U(L(),fbe).register(uJ,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:V(L()).register(uJ,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const pbe=/<script(?![^>]*\ssrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi;function mbe(e){return[[`script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'`,...[...e.matchAll(pbe)].map(e=>`'sha256-${Te(`sha256`).update(e[1]??``).digest(`base64`)}'`)].join(` `),`worker-src 'self' blob:`,`object-src 'none'`,`base-uri 'self'`].join(`; `)}mbe(``);function hbe(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Cd({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function fJ(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return O(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function pJ(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function gbe(e){let t=[],n=[[`maxBatchSize`,1,ru],[`maxBatchChars`,1,iu],[`docTimeoutMs`,1,au]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=pJ(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Cd({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function _be(e){let t=pJ(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=Ul.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Cd({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function vbe(e){let t=pJ(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=Gl.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Cd({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function mJ(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=du.parse({});if(!_(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=C(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,js.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?fJ(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=Od({value:c,file:t,source:o,doc:s}),u=l.length>0?Ad(c):c,d=[..._be({rawConfig:u,doc:s,source:o,absPath:t}),...vbe({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=du.safeParse(u);if(!f.success){let e=hbe(f,s,o,t),c=du.shape.git.safeParse(pJ(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?fJ(t,r,i):void 0,h=[...l,...d,...Yd(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...gbe({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}function hJ(e=_e()){return M(e,mt().userHomeDirName)}const gJ=`.tmp.`,_J=[8,4,4,4,12];function ybe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const bbe=_J.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),xbe=_J.map(e=>`[0-9a-f]{${e}}`).join(`-`);`${bbe}`,RegExp(`${ybe(gJ)}${xbe}$`);function Sbe(e){return`${e}${gJ}${Ee()}`}function Cbe(e){try{let t=A(e),n=`${ae(e)}${gJ}`,r=Date.now()-3e4;for(let e of T(t)){if(!e.startsWith(n))continue;let i=M(t,e);try{ne(i).mtimeMs<r&&re(i)}catch{}}}catch{}}function vJ(e,t,n={}){Cbe(e);let r=Sbe(e);try{k(r,t,{encoding:`utf-8`,mode:n.mode??420}),O(r,e)}catch(e){try{re(r)}catch{}throw e}}var yJ=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function wbe(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new yJ(e,r);s=!1;let c;try{c=x(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=ne(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{re(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new yJ(e,r);await yie(i);continue}try{return await t()}finally{try{f(c)}catch{}try{re(e)}catch{}}}}function Tbe(e){let t=Date.now()+e;for(;Date.now()<t;);}function bJ(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new yJ(e,r);s=!1;let c;try{c=x(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=ne(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{re(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new yJ(e,r);Tbe(i);continue}try{return t()}finally{try{f(c)}catch{}try{re(e)}catch{}}}}const xJ=`config.yml`;function SJ(e,t,n){if(e===`user`)return ce(hJ(n??_e()),`global.yml`);let r=oe(t)?t:ce(t);return e===`project-local`?ce(r,`.ok`,Pd,xJ):ce(r,`.ok`,xJ)}const Ebe=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function CJ(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:aP(t.replaceAll(`_`,`-`))}function Dbe(e){for(let t of Ebe){let n=e[t]?.trim();if(n!==void 0&&n!==``)return CJ(n)}return null}function Obe(e){let t=e.OK_LANG?.trim();if(t!==void 0&&t!==``)return aP(t)??void 0}function kbe(e=process.env){let t=Obe(e),n=Dbe(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=CJ(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}function wJ(){return zd(Id)}function TJ(){return mt().keyringService}function EJ(e){try{e()}catch{}}var Abe=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(TJ(),e).getPassword()}catch(t){return EJ(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return EJ(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return EJ(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(TJ(),e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(TJ(),e).deletePassword()}catch{}}},DJ=class{backend=`file`;authFile;constructor(e){this.authFile=e??M(hJ(),`auth.yml`)}read(){if(!_(this.authFile))return{};try{let e=C(this.authFile,`utf-8`);return(0,js.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=A(this.authFile);_(t)||y(t,{recursive:!0,mode:448}),vJ(this.authFile,(0,js.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},jbe=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ${wJ()} to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function OJ(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(TJ(),`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
|
|
430
430
|
`),EJ(()=>t?.onBackendSelected?.({backend:`keyring`})),new jbe(new Abe(t?.onKeychainRead),new DJ(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (${wJ()}) — OS keychain unavailable: ${r}\n`),EJ(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new DJ(e)}}function Mbe(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (${wJ()})\n`),r(new DJ(e))},n)});try{return await Promise.race([OJ(e),r])}catch{return new DJ(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function Nbe(e){let t=Mbe(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}
|
|
431
431
|
/*!
|
|
432
432
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
@@ -1109,11 +1109,11 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
1109
1109
|
`);try{return[...e.rescanInPlaceSkillDirs(a)].sort().join(`
|
|
1110
1110
|
`)}catch{return[...a].sort().join(`
|
|
1111
1111
|
`)}},async rebuildIgnorePatterns(){let t=e=>(O=e().finally(()=>{O=null}),O),o=async()=>{if(c.reset(),e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs(a)}catch(e){s8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=d,o=f,s=p,l=m,u=h,_=g,S=v,C=Date.now();return BAe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=y();b.clear(),i===void 0&&await Vje(n,x,b);let a=Date.now()-C;if(e.setAttributes({"ok.ignore.pattern_count":t.patternCount,"ok.ignore.nested_file_count":t.nestedFileCount,"ok.ignore.bytes":t.bytes}),s8.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a},`content-filter rebuild succeeded`),r)try{r()}catch(e){s8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter onAfterRebuild callback threw — derived views may be stale`)}return{ok:!0,patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a}}catch(e){d=t,f=o,p=s,m=l,h=u,g=_,v=S,b.clear();try{T()}catch(e){s8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter rollback dirCount re-walk failed — sibling-asset counts may be stale until next rebuild`)}let n=e instanceof Error?e.message:String(e);return s8.warn({err:e instanceof Error?e:Error(n)},`content-filter rebuild failed — rolled back to previous state`),{ok:!1,error:{message:n}}}})};return O===null?t(o):(ee===null&&(ee=O.catch(()=>null).then(()=>(ee=null,t(o)))),ee)}}}async function Vje(e,t,n){let r=[{dir:e,relPath:``}],i=0;for(;r.length>0;){let{dir:e,relPath:a}=r.pop();i+=1,i>=50&&(i=0,await new Promise(e=>setImmediate(e)));let o;try{o=T(e,{withFileTypes:!0})}catch(t){s8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);continue}for(let i of o){let o=a?`${a}/${i.name}`:i.name;if(i.isDirectory()){if(f8(i.name)||t(o)||t(`${o}/`))continue;r.push({dir:M(e,i.name),relPath:o})}else i.isFile()&&i8(i.name)&&!t(o)&&n.set(a,(n.get(a)??0)+1)}}}function D8(e,t,n,r){let i;try{i=T(e,{withFileTypes:!0})}catch(t){s8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);return}for(let a of i){let i=t?`${t}/${a.name}`:a.name;if(a.isDirectory()){if(f8(a.name)||n(i)||n(`${i}/`))continue;D8(M(e,a.name),i,n,r)}else a.isFile()&&i8(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function O8(e){return e.split(`
|
|
1112
|
-
`).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function k8(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function A8(e,t,n,r,i){let a;try{a=T(e,{withFileTypes:!0})}catch(t){return s8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||f8(s.name))continue;let a=M(e,s.name),c=a8(P(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of T8){let t=M(a,e);if(_(t))try{let a=C(t,`utf-8`);i.value+=a.length;let s=O8(a).map(e=>k8(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){s8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=A8(a,t,n,r,i)}}return o}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const Hje=/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/gu;function j8(e){return e.replace(Hje,``).normalize(`NFC`).toUpperCase().toLowerCase().normalize(`NFC`)}function M8(e){let t=j8(e);for(let e=0;e<4;e++){let e=j8(t);if(e===t)break;t=e}return t.replace(/[. ]+$/u,(e,t)=>t===0?e:``)}const Uje=new Set([`.ok`,`.open-knowledge`,`.openknowledge`,...Object.values(rt).map(({userHomeDirName:e})=>e)].map(M8));new Set([...Rd,...Fd,...bie].map(M8));function Wje(e){let t=new Set;for(let n of e){let e=n.replace(/^\.+/u,``);if(!/^[a-z0-9-]+$/u.test(e))throw Error(`cannot derive 8.3 short names for config dir "${n}"`);e.length<=2?t.add(`${e}[0-9a-f]{4}`):(t.add(e.slice(0,6)),t.add(`${e.slice(0,2)}[0-9a-f]{4}`))}return RegExp(`^(?:${[...t].join(`|`)})~\\d+$`,`u`)}Wje(Uje);const N8=L().min(1).refine(e=>!e.includes(`\0`)&&oe(e)&&se(e)===e);ha(`kind`,[H({kind:G(`file`),path:N8}),H({kind:G(`tree`),path:N8,excluded:V(N8)}).refine(({path:e,excluded:t})=>t.every(t=>P(e,t)!==``&&Gje(e,t)))]),H({server_instance_id:L().min(1),owner_token:Ii(),pid:R().int().positive(),lease_protocol:L().min(1),project_dir:N8,scope_json:L(),started_at:Di()});function Gje(e,t){let n=P(e,t);return n===``||n!==`..`&&!n.startsWith(`..${le}`)&&!oe(n)}RegExp(`<(${sJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const Kje=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,qje=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,P8=String.raw`([^\]\n]*)`,F8=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,I8=e=>RegExp(`(!?)${Kje}`,e),L8=(e,t)=>RegExp(`(!?)\\[${e}\\]${qje}`,t);I8(`y`),I8(`g`),L8(P8,`y`),L8(F8,`y`),L8(P8,`g`),L8(F8,`g`);const Jje=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(Jje,`y`),jX(`file-watcher`),jX(`conflict-authority`),jX(`parse-pool`),Math.max(1,Math.min(4,he()-1)),P6(()=>{}),jX(`bridge-watchdog`),P6(()=>{}),jX(`server-observers`),jX(`server-observers`),jX(`agent-sessions`),new class{writes=new WeakMap;record(e,t,n){let r=this.writes.get(e)??new Map;for(let[e,t]of r)Yje(t,n)||r.delete(e);r.set(t,n),this.writes.set(e,r)}hasRecentPeer(e,t,n){let r=this.writes.get(e);if(r===void 0)return!1;for(let[e,i]of r){let a=n-i;if(Math.abs(a)>=2e3){r.delete(e);continue}if(e!==t)return!0}return!1}};function Yje(e,t){return e!==void 0&&Math.abs(t-e)<2e3}const R8={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(R8));const Xje=Object.keys(R8),Zje={discovery:`user`,project:`project`,"write-skill":`user`},z8=Xje.filter(e=>Zje[e]===`user`);new Set(z8.map(e=>R8[e]));const B8=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function V8(e){return new URL(e).pathname.endsWith(`.ts`)}function Qje(e,t,n){let r=n.platform??process.platform,i=n.checkDesktop??!1,a=n.home??_e(),o=[],s=process.env.NODE_ENV===`test`;return i&&r===`darwin`&&(s||o.push(M(`/Applications`,B8,e)),(!s||n.home!==void 0)&&o.push(M(a,`Applications`,B8,e))),V8(t)?(o.push(F(new URL(`../assets/skills/${e}`,t))),o):(o.push(F(new URL(`../dist/assets/skills/${e}`,t))),o.push(F(new URL(`../assets/skills/${e}`,t))),o.push(F(new URL(`./assets/skills/${e}`,t))),o)}function $je(e,t,n){let r=V8(t)?`Running from source, only the source assets are read, so the bundle name is unknown or its directory under packages/server/assets/skills is missing.`:"This usually means the package build did not copy packages/server/assets into dist/assets. Run `pnpm run build` in the package that ships the skills before publishing.";return`Bundled skill asset directory not found for bundle '${e}'. Tried: ${n.join(`, `)}. ${r}`}function H8(e,t={}){let n=Qje(e,import.meta.url,t);for(let e of n)if(_(e))return e;throw Error($je(e,import.meta.url,n))}function eMe(e=ce(A(F(import.meta.url)),`..`,`package.json`)){try{let t=JSON.parse(C(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}eMe();function tMe(e,t,n){let[r,i,a,...o]=process.argv.slice(1);(r===void 0||i===void 0||a===void 0)&&(process.stderr.write(`ok-browser relay: missing the folder, files or command argument
|
|
1112
|
+
`).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function k8(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function A8(e,t,n,r,i){let a;try{a=T(e,{withFileTypes:!0})}catch(t){return s8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||f8(s.name))continue;let a=M(e,s.name),c=a8(P(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of T8){let t=M(a,e);if(_(t))try{let a=C(t,`utf-8`);i.value+=a.length;let s=O8(a).map(e=>k8(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){s8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=A8(a,t,n,r,i)}}return o}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const Hje=/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/gu;function j8(e){return e.replace(Hje,``).normalize(`NFC`).toUpperCase().toLowerCase().normalize(`NFC`)}function M8(e){let t=j8(e);for(let e=0;e<4;e++){let e=j8(t);if(e===t)break;t=e}return t.replace(/[. ]+$/u,(e,t)=>t===0?e:``)}const Uje=new Set([`.ok`,`.open-knowledge`,`.openknowledge`,...Object.values(rt).map(({userHomeDirName:e})=>e)].map(M8));new Set([...Rd,...Fd,...bie].map(M8));function Wje(e){let t=new Set;for(let n of e){let e=n.replace(/^\.+/u,``);if(!/^[a-z0-9-]+$/u.test(e))throw Error(`cannot derive 8.3 short names for config dir "${n}"`);e.length<=2?t.add(`${e}[0-9a-f]{4}`):(t.add(e.slice(0,6)),t.add(`${e.slice(0,2)}[0-9a-f]{4}`))}return RegExp(`^(?:${[...t].join(`|`)})~\\d+$`,`u`)}Wje(Uje);const N8=L().min(1).refine(e=>!e.includes(`\0`)&&oe(e)&&se(e)===e);ha(`kind`,[H({kind:G(`file`),path:N8}),H({kind:G(`tree`),path:N8,excluded:V(N8)}).refine(({path:e,excluded:t})=>t.every(t=>P(e,t)!==``&&Gje(e,t)))]),H({server_instance_id:L().min(1),owner_token:Ii(),pid:R().int().positive(),lease_protocol:L().min(1),project_dir:N8,scope_json:L(),started_at:Di()});function Gje(e,t){let n=P(e,t);return n===``||n!==`..`&&!n.startsWith(`..${le}`)&&!oe(n)}RegExp(`<(${sJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const Kje=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,qje=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,P8=String.raw`([^\]\n]*)`,F8=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,I8=e=>RegExp(`(!?)${Kje}`,e),L8=(e,t)=>RegExp(`(!?)\\[${e}\\]${qje}`,t);I8(`y`),I8(`g`),L8(P8,`y`),L8(F8,`y`),L8(P8,`g`),L8(F8,`g`);const Jje=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(Jje,`y`),jX(`watcher-freshness`),jX(`file-watcher`),jX(`conflict-authority`),jX(`parse-pool`),Math.max(1,Math.min(4,he()-1)),P6(()=>{}),jX(`bridge-watchdog`),P6(()=>{}),jX(`server-observers`),jX(`server-observers`),jX(`agent-sessions`),new class{writes=new WeakMap;record(e,t,n){let r=this.writes.get(e)??new Map;for(let[e,t]of r)Yje(t,n)||r.delete(e);r.set(t,n),this.writes.set(e,r)}hasRecentPeer(e,t,n){let r=this.writes.get(e);if(r===void 0)return!1;for(let[e,i]of r){let a=n-i;if(Math.abs(a)>=2e3){r.delete(e);continue}if(e!==t)return!0}return!1}};function Yje(e,t){return e!==void 0&&Math.abs(t-e)<2e3}const R8={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(R8));const Xje=Object.keys(R8),Zje={discovery:`user`,project:`project`,"write-skill":`user`},z8=Xje.filter(e=>Zje[e]===`user`);new Set(z8.map(e=>R8[e]));const B8=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function V8(e){return new URL(e).pathname.endsWith(`.ts`)}function Qje(e,t,n){let r=n.platform??process.platform,i=n.checkDesktop??!1,a=n.home??_e(),o=[],s=process.env.NODE_ENV===`test`;return i&&r===`darwin`&&(s||o.push(M(`/Applications`,B8,e)),(!s||n.home!==void 0)&&o.push(M(a,`Applications`,B8,e))),V8(t)?(o.push(F(new URL(`../assets/skills/${e}`,t))),o):(o.push(F(new URL(`../dist/assets/skills/${e}`,t))),o.push(F(new URL(`../assets/skills/${e}`,t))),o.push(F(new URL(`./assets/skills/${e}`,t))),o)}function $je(e,t,n){let r=V8(t)?`Running from source, only the source assets are read, so the bundle name is unknown or its directory under packages/server/assets/skills is missing.`:"This usually means the package build did not copy packages/server/assets into dist/assets. Run `pnpm run build` in the package that ships the skills before publishing.";return`Bundled skill asset directory not found for bundle '${e}'. Tried: ${n.join(`, `)}. ${r}`}function H8(e,t={}){let n=Qje(e,import.meta.url,t);for(let e of n)if(_(e))return e;throw Error($je(e,import.meta.url,n))}function eMe(e=ce(A(F(import.meta.url)),`..`,`package.json`)){try{let t=JSON.parse(C(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}eMe();function tMe(e,t,n){let[r,i,a,...o]=process.argv.slice(1);(r===void 0||i===void 0||a===void 0)&&(process.stderr.write(`ok-browser relay: missing the folder, files or command argument
|
|
1113
1113
|
`),process.exit(2));let s=new Set(n),c={roots:[{uri:t.pathToFileURL(i).href,name:`chat files`}]},l=e.spawn(a,o,{cwd:r,stdio:[`pipe`,`pipe`,`inherit`],windowsHide:!0}),u=l.stdin,d=l.stdout;(u===null||d===null)&&(process.stderr.write(`ok-browser relay: the browser server has no pipes
|
|
1114
1114
|
`),process.exit(1));let f=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:null,p=e=>{u.write(`${JSON.stringify(e)}\n`)},m=e=>{process.stdout.write(`${JSON.stringify(e)}\n`)},h=(e,t)=>{process.stderr.write(`ok-browser relay: dropped a ${e} line that ${t}\n`)},g=(e,t,n)=>{if(e.trim()===``)return null;let r;try{r=JSON.parse(e)}catch{return h(t,`is not JSON`),null}let i=f(r);if(i!==null)return i;if(Array.isArray(r))for(let e of r){let t=f(e);t?.method!==void 0&&t.id!==void 0&&n({jsonrpc:`2.0`,id:t.id,error:{code:-32600,message:`Batched messages are not supported`}})}return h(t,`is not a single JSON-RPC message`),null},_=e=>{let t=g(e,`client`,m);if(t===null||t.method===`notifications/roots/list_changed`)return null;let n=f(t.params),r=n?.name;return t.method===`tools/call`&&(typeof r!=`string`||!s.has(r))?(t.id!==void 0&&m({jsonrpc:`2.0`,id:t.id,error:{code:-32602,message:`Tool ${String(r)} is not available`}}),null):(t.method===`initialize`&&n!==null&&(n.capabilities={...f(n.capabilities),roots:{listChanged:!1}}),JSON.stringify(t))},v=e=>{let t=g(e,`server`,p);if(t===null)return null;if(t.method===`roots/list`)return t.id!==void 0&&p({jsonrpc:`2.0`,id:t.id,result:c}),null;let n=f(t.result),r=n?.tools;if(n===null||!Array.isArray(r))return e;let i=r.filter(e=>{let t=f(e)?.name;return typeof t==`string`&&s.has(t)});for(let e of i){let t=f(f(e)?.annotations);t!==null&&(t.readOnlyHint=!1)}return n.tools=i,JSON.stringify(t)},y=(e,t,n,r)=>{let i=``,a=e=>{let r=n(e);r!==null&&t.write(`${r}\n`)};e.setEncoding(`utf8`),e.on(`data`,e=>{i+=String(e);let t=i.indexOf(`
|
|
1115
1115
|
`);for(;t!==-1;)a(i.slice(0,t)),i=i.slice(t+1),t=i.indexOf(`
|
|
1116
|
-
`)}),e.on(`end`,()=>{i!==``&&a(i),r&&t.end()})};u.on(`error`,()=>{}),y(process.stdin,u,_,!0),y(d,process.stdout,v,!1);for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])process.on(e,()=>l.kill());l.on(`error`,e=>{process.stderr.write(`${e.message}\n`),process.exit(1)}),l.on(`close`,e=>{process.exitCode=e??1,process.stdin.destroy()})}const U8=H({name:L(),version:L().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)});ma([V(U8),U(L(),U8).transform(e=>Object.values(e))]).pipe(Une([U8])),`${tMe.toString()}${JSON.stringify([`browser_click`,`browser_close`,`browser_console_messages`,`browser_drag`,`browser_drop`,`browser_emulate_media`,`browser_evaluate`,`browser_file_upload`,`browser_fill_form`,`browser_find`,`browser_handle_dialog`,`browser_hover`,`browser_navigate`,`browser_navigate_back`,`browser_network_request`,`browser_network_requests`,`browser_press_key`,`browser_resize`,`browser_select_option`,`browser_snapshot`,`browser_tabs`,`browser_take_screenshot`,`browser_type`,`browser_wait_for`])}`;const nMe=String.raw`(?![\p{L}\p{M}\p{N}_])`;RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})${nMe}(?:[\\s,:;!.\\-–—]+|$)`,`iu`),Fe(S),jX(`agent-registry-apply`),jX(`local-op-security`),new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),ef.cursor,ef.codex,ef[`claude-desktop`],P6(()=>{}),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})}),jX(`external-change-attribution`),jX(`mermaid-validator`),jX(`rename-log`),jX(`history`);function W8(e){return Tt.filter(t=>_(M(e,t.hostDir)))}function G8(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}G8(bt,Wx),[...G8(xt,Wx)].sort((e,t)=>{let n=$2.indexOf(e.editor),r=$2.indexOf(t.editor);return(n===-1?$2.length:n)-(r===-1?$2.length:r)||e.editor.localeCompare(t.editor)}),jX(`installed-skills-marker`),jX(`skill-import`),jX(`backlinks`),jX(`local-target-inventory`),jX(`tag-index`),eP(),jX(`derived-document-index`);const K8={start:R().int().nonnegative().optional(),end:R().int().nonnegative().optional(),quote:L().min(1).optional(),prefix:L().max(1e3).optional(),suffix:L().max(1e3).optional()};H({docName:L().min(1),...K8,propertyKey:L().min(1).optional(),propertyPath:V(ma([L(),R().int().nonnegative()])).optional(),body:L(),queue:z().optional(),summary:L().optional()});const q8=Ii();ha(`action`,[H({action:G(`edit`),id:q8,body:L(),summary:L().optional()}),H({action:G(`resolve`),id:q8,summary:L().optional()}),H({action:G(`reopen`),id:q8,summary:L().optional()}),H({action:G(`replace`),id:q8,...K8,summary:L().optional()}),H({action:G(`queue`),id:q8,summary:L().optional()}),H({action:G(`unqueue`),id:q8,summary:L().optional()}),H({action:G(`dispatch-prepare`),id:q8,summary:L().optional()}),H({action:G(`dispatch-complete`),id:q8,summary:L().optional()}),H({action:G(`dispatch-prepare-batch`),ids:V(q8).min(1).max(200),summary:L().optional()}),H({action:G(`dispatch-complete-batch`),ids:V(q8).min(1).max(200),summary:L().optional()})]),jX(`embeddings`),jX(`embeddings`);function rMe(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}rMe($l),jX(`embeddings`),jX(`embeddings`),jX(`process-lock`);function iMe(e,t){return ce(e,`${t}.lock`)}nje({maxAgeMs:1e3});function aMe(e){let{processStart:t,...n}=e,r=Z6(t);return{...n,...r!==void 0&&{processStart:r}}}function oMe(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function sMe(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=oMe(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}jX(`asset-references`),jX(`file-ops`),jX(`upload-streaming`);const J8=`Absolute OK project/worktree path. Routed stdio: required until set unless one client root exists. Project-bound HTTP: optional, confined to its root.`,Y8=`Canonical ids: ${ube().map(e=>e.name).join(`, `)}. Call palette({components:[ids]}) before authoring for syntax/props, markdown-native forms, Mermaid and themed html preview for interactive charts/demos. Other JSX stays raw MDX when no canonical fits.`;L().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),L().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),L().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),L().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),L().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const cMe=H({value:L(),truncatedFrom:R().optional(),hint:L().optional()}).describe(`Normalized change-note summary, when one was recorded.`),lMe=V(U(L(),B()));U(L(),B()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),V(Tf).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves UNLESS `brokenLinkSuppression` is also present, in which case a project policy withheld findings, or `warnings` carries `link-check-deferred`, in which case the links were not checked because the server is still starting or busy with other writes. A withholding that arrives in a shape this build cannot validate is dropped rather than relayed, so `brokenLinkSuppression` stays absent even though findings were withheld. The `audit` tool is the surface that discloses that case, through its `warnings`. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" | "excluded" }`. `excluded` means the file exists on disk but a .gitignore or .okignore rule keeps it out of the project; a `!` rule in .okignore re-includes it or its folder. Report-only — the write landed regardless; fix in a follow-up edit.'),Df.optional().describe('Present ONLY when a project policy omitted detected broken links from `brokenLinks` — so an empty `brokenLinks` beside it does NOT mean every link resolves. `{ reason, count }`; `reason` today is `"reserved-log-policy"` (a reserved `log.md` records history whose links are expected not to resolve) and is an open token, so treat one you do not recognize as a withholding policy all the same. `count` is how many findings were withheld; the hrefs are deliberately not returned, because none of them is yours to repair.'),cMe.optional(),V(Cf).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit. `link-check-deferred` means links were not checked because the server is still starting or busy with other writes — that doc is re-checked only by a later write or edit of it, or an `audit`, which can time out until startup finishes."),V(H({name:L(),description:L().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const uMe=L().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function X8(e){return{text:uMe,...e}}function dMe(e){return`Machine-readable codes aligned 1:1 with \`warnings\` (\`warnings[i]\` is the display text for \`warningCodes[i]\`) — switch on these, never on the English. Absent when ${e} sent warning text it did not pair with codes, or paired one with a code this build does not recognise; \`warnings\` still carries the full text either way, so treat a missing field as unknown rather than as an all-clear.`}dMe(`the server`);function fMe(e){return`Always emitted, \`[]\` when there were none. \`warningCodes\` accompanies this list 1:1 whenever ${e} paired every warning it sent with a code this build recognises; otherwise \`warningCodes\` is absent and this list still carries the full text. \`content[0].text\` lists every warning either way. A \`warnings\` payload in a shape this build cannot read at all becomes one entry saying so, with \`warningCodes\` absent — \`[]\` never means "unreadable".`}fMe(`the server`),jX(`git-checkout`),jX(`git-worktree-status`),jX(`managed-artifact-persistence`),jX(`timeline`),jX(`suggest-links`),new Intl.Segmenter(`und`,{granularity:`word`}),jX(`git-context`),jX(`clone-flow`),Fe(o),R8.project,Object.fromEntries(Object.entries(Gx).map(([e,t])=>[t,e])),[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
|
|
1116
|
+
`)}),e.on(`end`,()=>{i!==``&&a(i),r&&t.end()})};u.on(`error`,()=>{}),y(process.stdin,u,_,!0),y(d,process.stdout,v,!1);for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])process.on(e,()=>l.kill());l.on(`error`,e=>{process.stderr.write(`${e.message}\n`),process.exit(1)}),l.on(`close`,e=>{process.exitCode=e??1,process.stdin.destroy()})}const U8=H({name:L(),version:L().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)});ma([V(U8),U(L(),U8).transform(e=>Object.values(e))]).pipe(Une([U8])),`${tMe.toString()}${JSON.stringify([`browser_click`,`browser_close`,`browser_console_messages`,`browser_drag`,`browser_drop`,`browser_emulate_media`,`browser_evaluate`,`browser_file_upload`,`browser_fill_form`,`browser_find`,`browser_handle_dialog`,`browser_hover`,`browser_navigate`,`browser_navigate_back`,`browser_network_request`,`browser_network_requests`,`browser_press_key`,`browser_resize`,`browser_select_option`,`browser_snapshot`,`browser_tabs`,`browser_take_screenshot`,`browser_type`,`browser_wait_for`])}`;const nMe=String.raw`(?![\p{L}\p{M}\p{N}_])`;RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})${nMe}(?:[\\s,:;!.\\-–—]+|$)`,`iu`),Fe(S),jX(`agent-registry-apply`),jX(`local-op-security`),new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),ef.cursor,ef.codex,ef[`claude-desktop`],P6(()=>{}),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})}),jX(`external-change-attribution`),jX(`mermaid-validator`),jX(`rename-log`),jX(`history`);function W8(e){return Tt.filter(t=>_(M(e,t.hostDir)))}function G8(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}G8(bt,Wx),[...G8(xt,Wx)].sort((e,t)=>{let n=$2.indexOf(e.editor),r=$2.indexOf(t.editor);return(n===-1?$2.length:n)-(r===-1?$2.length:r)||e.editor.localeCompare(t.editor)}),jX(`installed-skills-marker`),jX(`skill-import`),jX(`backlinks`),jX(`local-target-inventory`),jX(`tag-index`),eP(),jX(`derived-document-index`),jX(`disk-receipts`);const K8={start:R().int().nonnegative().optional(),end:R().int().nonnegative().optional(),quote:L().min(1).optional(),prefix:L().max(1e3).optional(),suffix:L().max(1e3).optional()};H({docName:L().min(1),...K8,propertyKey:L().min(1).optional(),propertyPath:V(ma([L(),R().int().nonnegative()])).optional(),body:L(),queue:z().optional(),summary:L().optional()});const q8=Ii();ha(`action`,[H({action:G(`edit`),id:q8,body:L(),summary:L().optional()}),H({action:G(`resolve`),id:q8,summary:L().optional()}),H({action:G(`reopen`),id:q8,summary:L().optional()}),H({action:G(`replace`),id:q8,...K8,summary:L().optional()}),H({action:G(`queue`),id:q8,summary:L().optional()}),H({action:G(`unqueue`),id:q8,summary:L().optional()}),H({action:G(`dispatch-prepare`),id:q8,summary:L().optional()}),H({action:G(`dispatch-complete`),id:q8,summary:L().optional()}),H({action:G(`dispatch-prepare-batch`),ids:V(q8).min(1).max(200),summary:L().optional()}),H({action:G(`dispatch-complete-batch`),ids:V(q8).min(1).max(200),summary:L().optional()})]),jX(`embeddings`),jX(`embeddings`);function rMe(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}rMe($l),jX(`embeddings`),jX(`embeddings`),jX(`process-lock`);function iMe(e,t){return ce(e,`${t}.lock`)}nje({maxAgeMs:1e3});function aMe(e){let{processStart:t,...n}=e,r=Z6(t);return{...n,...r!==void 0&&{processStart:r}}}function oMe(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function sMe(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=oMe(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}jX(`asset-references`),jX(`file-ops`),jX(`upload-streaming`);const J8=`Absolute OK project/worktree path. Routed stdio: required until set unless one client root exists. Project-bound HTTP: optional, confined to its root.`,Y8=`Canonical ids: ${ube().map(e=>e.name).join(`, `)}. Call palette({components:[ids]}) before authoring for syntax/props, markdown-native forms, Mermaid and themed html preview for interactive charts/demos. Other JSX stays raw MDX when no canonical fits.`;L().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),L().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),L().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),L().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),L().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const cMe=H({value:L(),truncatedFrom:R().optional(),hint:L().optional()}).describe(`Normalized change-note summary, when one was recorded.`),lMe=V(U(L(),B()));U(L(),B()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),V(Tf).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves UNLESS `brokenLinkSuppression` is also present, in which case a project policy withheld findings, or `warnings` carries `link-check-deferred`, in which case the links were not checked because the server is still starting or busy with other writes. A withholding that arrives in a shape this build cannot validate is dropped rather than relayed, so `brokenLinkSuppression` stays absent even though findings were withheld. The `audit` tool is the surface that discloses that case, through its `warnings`. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" | "excluded" }`. `excluded` means the file exists on disk but a .gitignore or .okignore rule keeps it out of the project; a `!` rule in .okignore re-includes it or its folder. Report-only — the write landed regardless; fix in a follow-up edit.'),Df.optional().describe('Present ONLY when a project policy omitted detected broken links from `brokenLinks` — so an empty `brokenLinks` beside it does NOT mean every link resolves. `{ reason, count }`; `reason` today is `"reserved-log-policy"` (a reserved `log.md` records history whose links are expected not to resolve) and is an open token, so treat one you do not recognize as a withholding policy all the same. `count` is how many findings were withheld; the hrefs are deliberately not returned, because none of them is yours to repair.'),cMe.optional(),V(Cf).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit. `link-check-deferred` means links were not checked because the server is still starting or busy with other writes — that doc is re-checked only by a later write or edit of it, or an `audit`, which can time out until startup finishes."),V(H({name:L(),description:L().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const uMe=L().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function X8(e){return{text:uMe,...e}}function dMe(e){return`Machine-readable codes aligned 1:1 with \`warnings\` (\`warnings[i]\` is the display text for \`warningCodes[i]\`) — switch on these, never on the English. Absent when ${e} sent warning text it did not pair with codes, or paired one with a code this build does not recognise; \`warnings\` still carries the full text either way, so treat a missing field as unknown rather than as an all-clear.`}dMe(`the server`);function fMe(e){return`Always emitted, \`[]\` when there were none. \`warningCodes\` accompanies this list 1:1 whenever ${e} paired every warning it sent with a code this build recognises; otherwise \`warningCodes\` is absent and this list still carries the full text. \`content[0].text\` lists every warning either way. A \`warnings\` payload in a shape this build cannot read at all becomes one entry saying so, with \`warningCodes\` absent — \`[]\` never means "unreadable".`}fMe(`the server`),jX(`git-checkout`),jX(`git-worktree-status`),jX(`managed-artifact-persistence`),jX(`timeline`),jX(`suggest-links`),new Intl.Segmenter(`und`,{granularity:`word`}),jX(`git-context`),jX(`clone-flow`),Fe(o),R8.project,Object.fromEntries(Object.entries(Gx).map(([e,t])=>[t,e])),[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
|
|
1117
1117
|
`),jX(`skills-leaderboard`),jX(`handoff-dispatch`),H({target:W(Object.keys({"claude-cowork":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},"claude-code":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},codex:{type:`app-bundle`,appName:`Codex`,urlScheme:`codex:`,probeScheme:`codex`,quitFirst:!0},cursor:{type:`cli-binary`,binaryName:`cursor`,urlScheme:`cursor:`}})),url:L().min(1).max(4096),workspacePath:L().optional()}),H({}).loose(),jX(`github-permissions`),jX(`github-reference`),jX(`github-reference`),jX(`link-preview.guarded-fetch`),jX(`link-preview.cache`),jX(`saved-themes`),H({enabled:z(),active:z(),git:H({state:W([`not-applicable`,`ready`,`missing`,`conflict`,`unavailable`]),ownership:W([`open-knowledge`,`existing`]).optional()}),applied:z().optional(),reason:W([`git-conflict`,`git-unavailable`,`config-write`]).optional()}),H({enabled:z()}).strict(),jX(`managed-rename`),jX(`reconcile`),Object.assign(BOe,{m4v:`video/mp4`,mkv:`video/x-matroska`,flac:`audio/flac`,toml:`application/toml`,lock:`text/plain`,"7z":`application/x-7z-compressed`,tar:`application/x-tar`,rar:`application/vnd.rar`,xls:`application/vnd.ms-excel`,ppt:`application/vnd.ms-powerpoint`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,odp:`application/vnd.oasis.opendocument.presentation`,pages:`application/vnd.apple.pages`,numbers:`application/vnd.apple.numbers`,key:`application/vnd.apple.keynote`,mobi:`application/x-mobipocket-ebook`}),jX(`search`),jX(`skill-install`),jX(`write-advisory`),jX(`api`),H({principalId:L().optional(),tabSessionId:L().optional(),expectedServerInstanceId:L().optional(),expectedBranch:L().optional(),expectedDocLineageEpoch:L().optional(),clientProtocolVersion:R().optional(),clientRuntimeVersion:L().optional(),clientKind:L().optional()}).loose(),new He,P6(()=>{}),[...iae],["Read-only validation of markdownlint, frontmatter, OKF and broken internal links. Requires the Hocuspocus server. No args scans all in-scope .md/.mdx; `path` narrows to file/folder. `links` is the navigation/graph tool.","ran names selected `markdownlint`, `frontmatter`, `okf`, `links`. A family absent from `ran` was not checked. A selected family remains in ran if degraded; warnings explain why and it may still have contributed findings. okf covers document and project-tree OKF checks here.",`Broken links are reported under the source doc. Default-on validation.suppressLogLinkAdvisories omits links inside lowercase log.md/log.mdx at any depth; LOG.md is ordinary. brokenLinkSuppression reports reason reserved-log-policy and count without paths/hrefs. Logs are append-only history: never rewrite old entries to clear links. links({kind:'dead'}) reads raw state.`,`Diagnostics carry source, code, message, 0-based LSP range (link columns approximate) and severity. Broken links default to warning; validation.links can raise/hide them. Only problematic files are listed; fileCount/errorCount/warningCount reflect full scan. Output is capped at 10 files × 10 diagnostics each and project-wide at 10 warnings; omittedWarningCount reports dropped warnings. Narrow path reduces competing files; per-file caps still apply. Follow runtime hints for document lint and raw dead links; project-tree OKF findings remain capped.`,`Nothing is modified. Auto-fix document lint with lint({document,fix:true}); fix broken links with edit/write.`].join(`
|
|
1118
1118
|
`),[`Save a project-wide checkpoint of every document. Requires the Hocuspocus server. Optional summary ≤80 chars defaults to "Checkpoint version"; avoid secrets or PII because it persists in git history. Returns version (40-char SHA). Find it with history and restore one doc with restore_version({document,version}).`].join(`
|
|
1119
1119
|
`),[`Read effective config merged defaults → user → project; no running OK server needed. Optional key is a dotted path (content, appearance.theme); omit for the full config. All fields are readable. Re-read after disk changes or before relying on an old value.`,"Removed server.*, mcp.*, github.*, preview.baseUrl and preview.scriptSrc return exists:false; appearance.preview.autoOpen remains live. This is a pure read. Use `install` skillFolders for folder topology."].join(`
|
|
@@ -1133,7 +1133,7 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
|
|
|
1133
1133
|
`),L().describe(`Search query — title, path, or body terms.`),W([`omnibar`,`full_text`]).optional().describe(`'omnibar' for title/path/folder only (fast); 'full_text' includes body content. Default 'full_text'.`),V(W([`page`,`folder`,`content`,`file`])).optional().describe(`Override the default scope set. Members: 'page', 'folder', 'file', 'content'. Defaults derive from intent.`),R().int().min(1).max(100).optional().describe(`Max rows; default 20, max 100.`),z().optional().describe(`Set false to force pure-lexical ranking for this call even when semantic search is enabled. Omit to use semantic when available.`),L().optional().describe(J8);const _Me=H({kind:W([`page`,`folder`,`file`]),path:L(),docName:L(),title:L().nullable(),score:R(),signals:H({lexical:R(),fullText:R(),recency:R(),vector:R().optional()}),snippet:L().optional(),previewUrl:L().nullable(),previewUrlSource:W(pMe).optional()});X8({cwd:L(),query:L(),intent:L(),resultCount:R().int(),results:V(_Me),elapsedMs:R().nullable(),semantic:$q.optional(),ready:G(!1).optional()}),[`Build a shareable GitHub-substrate URL for a teammate to receive a doc/folder subtree in OpenKnowledge, pinned to current branch. Requires the Hocuspocus server. Read-only, no commits/pushes/fetch. Publishing is a user act: agents do NOT publish; a missing remote returns Share-wizard guidance.`,"`path` is content-relative, docs accept .md/.mdx, empty string means root folder. `kind` doc/folder is optional for auto-probe (.mdx → .md → directory); REQUIRED when `path` is empty (use folder). Optional `cwd` selects project. Requires a named branch, GitHub/GH Enterprise origin, and branch already pushed."].join(`
|
|
1134
1134
|
`),X8({ok:z().describe(`Success discriminator.`),shareUrl:L().optional().describe(`Marketing share URL (success only).`),sharedUrl:L().optional().describe(`Unencoded GitHub blob/tree URL (success only).`),branch:L().optional().describe(`Branch the share URL pins to (success only).`),resolvedKind:W([`doc`,`folder`]).optional().describe(`Kind the target resolved to (success only).`),freshness:sf.optional().describe(`Whether the shared target matches origin (success only): current, stale (unpushed edits), absent (not on origin, a push fixes it), or empty (a folder holding nothing git can track, which no push fixes). Omitted when the probe could not run.`),error:W([...of.options,`target-not-found`,`kind-mismatch`,`unknown`]).optional().describe(`Failure code (error path only).`),message:L().optional().describe(`Agent-actionable error message (error path only).`),previewUrl:L().nullable().optional().describe("Route-only preview URL (no host:port): `/#/<doc>` for a doc, `/#/<folder>/` for a folder, `/#/` for the content root. `null` when no UI is running."),previewUrlSource:L().optional().describe(`Internal: preview-URL provenance.`)});const Z8="Which level the skill lives at. `project` = lives in this KB (wherever its folder is; shared via git); `global` = user-level under your home dir (available in every project on this machine, not shared).",vMe=H({id:L().describe("Location id — editor host id, `agents`, or a custom root path. Pass to `install`."),path:L().describe('Base-relative bundle dir (e.g. ".claude/skills/x"). INFORMATIONAL — for showing a user where a location lives. Skills are addressed by `name` + `scope`: pass `id` to `install`, and read bundle files with `skills({ name, file })`, never by handing this path to `exec` or a native file tool.'),role:W([`source`,`copy`,`symlink`]).describe(`source = the REAL folder (the skill itself); copy = independent folder, refreshed from the source on watcher/startup sync while unedited (hand edits fork it); symlink = live link to the source.`),audience:V(L()).optional().describe(`Folders that RESOLVE INTO this location (folder-level symlinks) — their agents read what lands here.`),drift:z().optional().describe(`Something outside OK rewrote this path since OK last wrote it.`)});H({name:L().describe("Skill name (its identity; pass to `edit`/`move`/`delete`/`install`)."),scope:W([`project`,`global`]).describe(Z8),description:L().optional().describe(`The skill's one-line description (when present).`),installed:z().describe('Always true for a managed skill — its source folder IS the skill, so it is never "not installed". Read `locations[]` for where it actually lives.'),hosts:V(L()).describe(`Flat location ids (locations[].id), SOURCE first — legacy projection.`),locations:V(vMe).describe("Everywhere the skill lives. Exactly one `source` (the skill's real folder); every other entry is a managed copy or symlink of it."),mode:W([`copy`,`link`]).describe("The form a NEW location would take, derived from the ones the skill already uses. Not a stored preference and not a claim about existing locations — read `locations[].role` for those."),conflicts:V(L()).optional().describe(`Host ids where a DIFFERENT skill with this name occupies the slot.`)});const yMe=H({path:L().describe(`Skill-relative path (e.g. "references/tiers.md").`),kind:W([`reference`,`script`]).describe("`script` for anything under scripts/; `reference` for every other bundle file.")});H({name:L().describe(`Skill name (its identity).`),scope:W([`project`,`global`]).describe(Z8),description:L().describe(`The skill's one-line description (empty if none).`),body:L().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:V(yMe).describe("Bundle files beside SKILL.md (path + kind, no inline text). Read one via `file`.")}),H({path:L().describe(`Skill-relative path read.`),kind:W([`reference`,`script`]).describe("`reference` or `script`."),text:L().describe(`Full text of the bundle file.`)}),H({name:L().describe("Skill name to pass as `skill` to `import`."),source:L().describe("Import-ready repository coordinates or website hostname. Pass this exact value to `import`."),description:L().describe(`Marketplace description for deciding whether the skill matches the task.`),installs:R().int().nonnegative().nullable().describe(`skills.sh install count, if known.`),publisher:L().nullable().describe(`Publisher, website, or GitHub owner, if known.`)}),[`Read-only skill discovery. Requires the Hocuspocus server. query searches the skills.sh marketplace and returns import-ready name/source/description/publisher/install-count rows. Import a chosen row with import({source,skill:name}); external rows are not managed or active editor content until imported/projected.`,`Omit name to list Project and Global managed skills with scope/description/hosts. name reads description/body plus a bundle files list (path/kind, no inline text); name+file reads one reference/script/bundle file. Optional scope; name-only prefers Project. Address skills by name/scope, never raw .ok/ paths or native cat.`,`Built-in open-knowledge* runtime skills are already in your skill list; do not fetch them here. Use write/edit/delete/move/install for changes.`].join(`
|
|
1135
1135
|
`),["Create/replace exactly one `document`, `folder`, `template`, `skill`, or `asset`; use `documents` for an ordered batch. Requires the Hocuspocus server.","Nested paths such as `guides/overview` can be documents; put all requested blocks in one `document.content`. Use `folder` only for separate pages.","`document: {path, content|template, frontmatter?, position?}`: content and template are exclusive. Existing docs require position: replace/append/prepend; new docs default replace. frontmatter with literal content forces replace, even with append/prepend. Recent edits by another writer can refuse replace; follow the recovery response; append/prepend/edit bypass this refusal. Peers are per MCP connection; own writes and writers sharing a connection do not refuse each other; connected editors can. No agentId is needed.","`folder: {path, frontmatter?}` creates NEW folders; edit existing ones. `template: {path: '<folder>/<name>', content, frontmatter: {title, description?, tags?}}` creates reusable doc templates.","`skill: {name, description, body, scope?}` writes agent guidance; lowercase letters/digits/hyphens name is identity, description is when to use it. New skills use the default skill home; existing ones keep their real folder. Use install for editors.","`asset: {path, content|source}` uploads binary image/file: base64 content or local source path. `documents` takes document specs and reports each result.",`Optional summary: one-line outcome ≤80 chars, persisted to git history; avoid secrets or PII. Batches need per-entry summary; top-level is ignored.`,`Read response warnings: content-divergence/disk-edit-reconciled means re-read; mermaid-parse-error means the write landed but fix the fence.`,Y8].join(`
|
|
1136
|
-
`),jX(`config-persistence`),jX(`generated-index-git-attributes`),jX(`doc-notices`),H({branch:L().min(1),notice:Nq}),H({version:G(1),notices:V(B())}),jX(`head-watcher`),jX(`shadow-gc`),jX(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),jX(`mermaid-persistence`),jX(`persistence`),jX(`persistence-staleness`),jX(`recovered-file-target`),jX(`removed-docs-journal`),jX(`server-observers`),jX(`github-account`),jX(`sync-engine`),Fe(o),new Set(qye);const Q8=[`no-push-permission`,`auth-error`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`unsafe-incoming-symlinks`];new Set(Q8),[...Q8],(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})(),(()=>{let e=Object.freeze({origin:`generated-index`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();let $8=null;P6(()=>{$8?.disable(),$8=null}),jX(`skill-migrate`);function e5(e){return[{host:`agents`,root:Wx},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=$2.indexOf(e.host),r=$2.indexOf(t.host);return(n===-1?$2.length:n)-(r===-1?$2.length:r)||e.host.localeCompare(t.host)})}e5(bt),e5(xt),Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const bMe=du;QY(),Fe(o),jX(`project-git`);var t5=i((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),n5=i((e=>{let{InvalidArgumentError:t}=t5();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),r5=i((e=>{let{humanReadableArgName:t}=n5();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
1136
|
+
`),jX(`config-persistence`),jX(`generated-index-git-attributes`),jX(`doc-notices`),H({branch:L().min(1),notice:Nq}),H({version:G(1),notices:V(B())}),jX(`document-refresh`),jX(`head-watcher`),jX(`shadow-gc`),jX(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),jX(`mermaid-persistence`),jX(`persistence`),jX(`store-compare`),jX(`persistence-staleness`),jX(`recovered-file-target`),jX(`removed-docs-journal`),jX(`server-observers`),jX(`github-account`),jX(`sync-engine`),Fe(o),new Set(qye);const Q8=[`no-push-permission`,`auth-error`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`unsafe-incoming-symlinks`];new Set(Q8),[...Q8],(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})(),(()=>{let e=Object.freeze({origin:`generated-index`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();let $8=null;P6(()=>{$8?.disable(),$8=null}),jX(`skill-migrate`);function e5(e){return[{host:`agents`,root:Wx},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=$2.indexOf(e.host),r=$2.indexOf(t.host);return(n===-1?$2.length:n)-(r===-1?$2.length:r)||e.host.localeCompare(t.host)})}e5(bt),e5(xt),Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const bMe=du;QY(),Fe(o),jX(`project-git`);var t5=i((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),n5=i((e=>{let{InvalidArgumentError:t}=t5();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),r5=i((e=>{let{humanReadableArgName:t}=n5();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
1137
1137
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
1138
1138
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
1139
1139
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),i5=i((e=>{let{InvalidArgumentError:t}=t5();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -1549,6 +1549,6 @@ GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){funct
|
|
|
1549
1549
|
`);k(e,o)}function M9(e,t){let n=C(e,`utf-8`);if(n.trim().length!==0)try{let r=A9(JSON.parse(n),t),i=n.endsWith(`
|
|
1550
1550
|
`)?`
|
|
1551
1551
|
`:``;k(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDirSpellings);r!==n&&k(e,r)}}function N9(e,t){let n=C(e,`utf-8`),r=k9(n,t.contentDirSpellings);r!==n&&k(e,r)}function P9(e){try{return T(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>M(e,t.name))}catch{return[]}}const OFe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function F9(e){return/\.log\.\d+$/.test(e)}function kFe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||F9(e)}const AFe=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function jFe(e){let t={contentDirSpellings:O9(e.contentDir)};for(let n of AFe)for(let r of P9(M(e.stagingDir,n)))kFe(r)?j9(r,t):r.endsWith(`.json`)?M9(r,t):N9(r,t);for(let n of P9(M(e.stagingDir,`state`))){let e=ae(n);n.endsWith(`.jsonl`)?j9(n,t):OFe.has(e)?M9(n,t):N9(n,t)}}const I9=[`.ok`,`local`,`telemetry`],L9=[`.ok`,`local`,`logs`],R9=[`.ok`,`local`,`loss-capture`],z9=`spans-current.jsonl`,B9=`spans-prev.jsonl`,V9=`server-current.jsonl`,H9=`server-prev.jsonl`,U9=`loss-current.jsonl`,W9=`loss-prev.jsonl`;function MFe(e){return M(e,...I9,z9)}function NFe(e){return M(e,...I9,B9)}function PFe(e){return M(e,...L9,V9)}function FFe(e){return M(e,...L9,H9)}function IFe(e){return M(e,...R9,U9)}function LFe(e){return M(e,...R9,W9)}const G9=1e3;async function RFe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function zFe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function BFe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}function VFe(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(`
|
|
1552
|
-
`)}\n`:null}catch{return null}}function HFe(e){let t=M(e,`.git`,`ok`);if(!_(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function UFe(e){let t=M(e,`.git`,`ok`);if(!_(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){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 WFe(){return{nodeVersion:process.version,platform:ye(),arch:me()}}function GFe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!_(e))return{};let t;try{t=(0,js.parse)(C(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(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function KFe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return KFe(e.maxBytes)}function qFe(e){let t=J9(SJ(`project`,e)),n=J9(SJ(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function JFe(e){return Te(`sha256`).update(e).digest(`hex`)}function YFe(e){let t=C(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const XFe=[`"doc.name"`,`"docName"`];function ZFe(e){let t=C(e,`utf-8`),n=0;for(let e of XFe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!_(e))return!1;try{return y(A(t),{recursive:!0}),e.endsWith(`.ips`)?k(t,Y5(C(e,`utf-8`))):h(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=T(e,{withFileTypes:!0});for(let i of r){let r=M(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const QFe=new Set([`.jsonl`]);function $Fe(e){let t=e.lastIndexOf(`.`);return t!==-1&&QFe.has(e.slice(t))}const eIe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function tIe(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&eIe.has(e.slice(t))}function nIe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!tIe(r))continue;let{redacted:i,patterns:a,lineCount:o}=mP(C(n,`utf-8`));a.length!==0&&(k(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 P(e,t).split(le).join(`/`)}async function rIe(e){let t=ce(e.contentDir),n=ce(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??RFe,a=r.fetchAgentEffects??zFe,o=r.fetchWatcherRecent??BFe,s=r.readShadowHead??HFe,c=r.readCheckpointRefs??UFe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.87.5-beta.
|
|
1552
|
+
`)}\n`:null}catch{return null}}function HFe(e){let t=M(e,`.git`,`ok`);if(!_(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function UFe(e){let t=M(e,`.git`,`ok`);if(!_(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){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 WFe(){return{nodeVersion:process.version,platform:ye(),arch:me()}}function GFe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!_(e))return{};let t;try{t=(0,js.parse)(C(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(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function KFe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return KFe(e.maxBytes)}function qFe(e){let t=J9(SJ(`project`,e)),n=J9(SJ(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function JFe(e){return Te(`sha256`).update(e).digest(`hex`)}function YFe(e){let t=C(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const XFe=[`"doc.name"`,`"docName"`];function ZFe(e){let t=C(e,`utf-8`),n=0;for(let e of XFe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!_(e))return!1;try{return y(A(t),{recursive:!0}),e.endsWith(`.ips`)?k(t,Y5(C(e,`utf-8`))):h(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=T(e,{withFileTypes:!0});for(let i of r){let r=M(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const QFe=new Set([`.jsonl`]);function $Fe(e){let t=e.lastIndexOf(`.`);return t!==-1&&QFe.has(e.slice(t))}const eIe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function tIe(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&eIe.has(e.slice(t))}function nIe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!tIe(r))continue;let{redacted:i,patterns:a,lineCount:o}=mP(C(n,`utf-8`));a.length!==0&&(k(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 P(e,t).split(le).join(`/`)}async function rIe(e){let t=ce(e.contentDir),n=ce(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??RFe,a=r.fetchAgentEffects??zFe,o=r.fetchWatcherRecent??BFe,s=r.readShadowHead??HFe,c=r.readCheckpointRefs??UFe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.87.5-beta.1`),d=r.readDesktopEnv??K9,f=r.readLanguage??D9,p=r.readRuntime??WFe,m=r.isOtlpPushEnabled??GFe,g=b(M(xe(),`ok-bundle-`));try{y(M(g,`telemetry`),{recursive:!0}),y(M(g,`logs`),{recursive:!0}),y(M(g,`state`),{recursive:!0}),Z9(MFe(n),M(g,`telemetry`,z9)),Z9(NFe(n),M(g,`telemetry`,B9)),Z9(PFe(n),M(g,`logs`,V9)),Z9(FFe(n),M(g,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,M(g,`logs`,ae(t)));for(let t of e.userStateFiles??[])Z9(t,M(g,nJ,ae(t)));let v=0;for(let t of e.diagnosticReports?.files??[])Z9(t,M(g,`diagnostic-reports`,ae(t)))&&(v+=1);let b=M(n,`.ok`,`local`),x=M(b,`server.lock`),S=`not-running`,w=`no server.lock`,T=null;if(_(x)){Z9(x,M(g,`state`,`server.lock`));try{let e=C(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(k(M(g,`state`,`agent-presence.json`),e),S=`running`,w=``);let t=await a(T);t!==null&&k(M(g,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=VFe(n);e!==null&&k(M(g,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&k(M(g,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&k(M(g,`state`,`checkpoint-refs.txt`),D),Z9(IFe(n),M(g,`state`,U9)),Z9(LFe(n),M(g,`state`,W9)),Z9(M(b,`last-spawn-error.log`),M(g,`state`,`last-spawn-error.log`)),Z9(M(b,Md),M(g,`state`,Md)),Z9(M(b,Nd),M(g,`state`,Nd)),Z9(M(b,jd),M(g,`state`,jd));let O=p(),te=d(),re=f(),ie={ok:{version:u(),nodeVersion:O.nodeVersion,platform:O.platform,arch:O.arch},host:{desktop:te,language:re}};k(M(g,`state`,`runtime.json`),`${JSON.stringify(ie,null,2)}\n`);let A=S===`running`?`running
|
|
1553
1553
|
`:`not-running (${w})\n`;k(M(g,`state`,`server-status.txt`),A);let j=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:J5(e.diagnosticReports,v);if(k(M(g,`state`,`diagnostic-reports-status.txt`),`${j}\n`),k(M(g,Q5),y7(e.osTerminationEvidence)),e.processDir&&_(e.processDir)){let t=M(g,`process`);y(t,{recursive:!0}),h(e.processDir,t,{recursive:!0})}let oe=e.redact===!0;oe&&jFe({stagingDir:g,contentDir:t}),e.note&&k(M(g,`note.txt`),e.note);let se=null;e.scrubSecrets===!0&&(se=nIe(g));for(let t of e.extraFiles??[]){let e=t.zipName??ae(t.sourcePath);if(!Z9(t.sourcePath,M(g,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=x7(t,`extra/${e}`);n!==null&&(se??={redactions:[],redactedLineCount:0},se.redactions.push(n),se.redactedLineCount+=n.lineCount)}let N=qFe(n),P=Q9(g),ce=[],le=0,ue=0;for(let e of P){let t=$9(g,e),n=ne(e).size,r=$Fe(t)?YFe(e):0;ce.push({path:t,bytes:n,lines:r}),le+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(ue+=ZFe(e))}let de={applied:oe};se!==null&&(de.secretScrub=se);let F={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:O.nodeVersion,platform:O.platform,arch:O.arch},host:{desktop:te,language:re},contentDir:{pathSha256:JFe(t),absolutePath:oe?`<CONTENT_DIR>`:t},telemetry:{localSink:N,otlpPushEnabled:m()},redaction:de,serverStatus:S,files:ce};k(M(g,`manifest.json`),`${JSON.stringify(F,null,2)}\n`);let fe=O9(t),pe=P.some(e=>{try{let t=C(e,`utf-8`);return fe.some(e=>t.includes(e))}catch{return!1}}),me={stagedDiagnosticReports:v,totalBytes:le,fileCount:ce.length,docNameCount:ue,contentDirVisible:pe,redacted:oe},he=!1;return{stagingDir:g,manifest:F,summary:me,cleanup:()=>{he||(he=!0,ee(g,{recursive:!0,force:!0}))}}}catch(e){throw ee(g,{recursive:!0,force:!0}),e}}async function iIe(e){let{collected:t,outputPath:n}=e,r=A(n);if(!_(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new $De.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=g(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 aIe(e,t){let n=M(e,`.ok`,`config.yml`);if(_(n))try{let t=(0,js.parse)(C(n,`utf-8`)),r=HJ(t)?t.content:void 0,i=HJ(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return ce(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 ce(e)}async function oIe(e,t,n,r,i,a){let o=S7(t,e.logger),s=await rIe({contentDir:aIe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...iPe(o,e.userLogsDir??M(hJ(),`logs`)),...w7(e.cachesDir??M(_e(),`Library`,`Caches`))],userStateFiles:T7(e.bugReportsDir??b7()),diagnosticReports:i,osTerminationEvidence:a,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{y(A(e.outputPath),{recursive:!0}),await iIe({collected:s,outputPath:e.outputPath});let t=s.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:o,files:s.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:s.manifest.createdAt}}}finally{s.cleanup()}}async function sIe(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??D9,i=()=>ANe(e.diagnosticReportsDir??M(_e(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return oIe(e,t,n,r,i(),await v7(e.osTerminationEvidenceDeps));let{zipPath:a,summary:o}=await lPe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:w7(e.cachesDir??M(_e(),`Library`,`Caches`)),bugReportLedgerFiles:T7(e.bugReportsDir??b7()),diagnosticReports:e.level===`full`?i():void 0,osTerminationEvidence:e.level===`full`?await v7(e.osTerminationEvidenceDeps):void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}export{ZJ as ALL_EDITOR_IDS,QJ as EDITOR_LABELS,MY as EDITOR_TARGETS,oxe as HOSTS_WITH_USER_SKILL_DIR,vNe as LAUNCH_CONFIG_NAME,uFe as PATH_SHIM_BEGIN,fFe as PATH_SHIM_BLOCK_RE,dFe as PATH_SHIM_END,l5 as ProjectPathSafetyError,YMe as addOkPathsToGitExclude,u5 as assertProjectPathSafe,pY as buildManagedServerEntry,KPe as buildMcpConfigDeclineEvent,qPe as buildMcpConfigMigrateEvent,CY as canonicalEntryFor,G5 as classifyExistingMcpEntry,sIe as collectReportBundle,_Fe as createCliProbeResolver,OJ as createTokenStore,tPe as defaultBugReportZipPath,Ke as detectGh,Ye as detectGhAccounts,SNe as detectInstalledEditors,SY as droppedManagedKeys,Dxe as editorConfigPathDisplay,Exe as editorEntryLocator,FPe as ensurePiBridge,INe as findJetsamKillSync,C5 as formatTrackedRemediation,QMe as getExcludedOkPaths,x5 as getInstalledSkillProjectionPaths,axe as getNativeTomlMcpEditor,b5 as getOkArtifactPaths,dY as isEntryUpToDate,mY as isOwnManagedEntry,sFe as loadConfig,Nbe as makeLazyProbeTokenStore,b7 as okBugReportsDir,y9 as parseGitHubBlobUrl,cFe as parseGitHubShareUrl,b9 as parseGitHubTreeUrl,v9 as parseGitUrl,pFe as pathInstallMarkerPath,PMe as previewContent,CNe as probeOwnManagedEditorMcpEntry,NPe as probePiBridgeState,S5 as probeTrackedOkPaths,U5 as readExistingMcpEntry,ZMe as readSharingMode,mP as redactContent,pPe as registerWindowsProcessStartReader,XMe as removeOkPathsFromGitExclude,HPe as removeOwnMcpEntry,GMe as removeProjectSkill,yFe as removeUserGlobalSkillBundle,TFe as removeUserSkill,zMe as resolveProjectRoot,tFe as runStop,f9 as truncatePriorEntry,T9 as userGlobalSkillBundleTargets,wFe as userSkillPresentAnywhere,lFe as validateLocalFolderForShare,H5 as writeEditorMcpConfig,SFe as writeProjectAiIntegrations,h5 as writeProjectSkill,xNe as writeUserMcpConfigs,CFe as writeUserSkill};
|
|
1554
1554
|
//# sourceMappingURL=index.mjs.map
|