@inkeep/open-knowledge 0.6.0-beta.11 → 0.6.0-beta.13
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/THIRD_PARTY_NOTICES.md +35 -0
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +21 -19
- package/dist/cli.mjs +4 -4
- package/dist/config-schema.json +20 -0
- package/dist/config.project.schema.json +20 -0
- package/dist/constants-DMYn7coi.mjs +2 -0
- package/dist/{dist-7_PKsuCz.mjs → dist-BTk16yDE.mjs} +1 -1
- package/dist/{dist-soQLoIV1.mjs → dist-DVt5ImvV.mjs} +30 -29
- package/dist/index.mjs +1 -1
- package/dist/{init-CHCT8dp7.mjs → init-BVyOcRVl.mjs} +4 -4
- package/dist/init-hlHTTbBd.mjs +1 -0
- package/dist/{loader-BUx53gPt.mjs → loader-DlVJK5_j.mjs} +2 -2
- package/dist/loader-zlf-nKBp.mjs +1 -0
- package/dist/{preview-Dfnjbkm0.mjs → preview-D-yuPDgI.mjs} +2 -2
- package/dist/preview-OJnqomHA.mjs +1 -0
- package/dist/public/assets/ActivityModeContent-BTDXmmcF.js +2 -0
- package/dist/public/assets/{ConsentDialogBody-BB9hO7dl.js → ConsentDialogBody-CImrdpFX.js} +1 -1
- package/dist/public/assets/DocumentContext-BLVVzPxk.js +52 -0
- package/dist/public/assets/GraphPanel-MDxyn9iQ.js +46 -0
- package/dist/public/assets/{McpConsentDialogBody-BuE8FaKs.js → McpConsentDialogBody-Bh3i0mQ8.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-DcjK_PiT.js +7 -0
- package/dist/public/assets/{SourceEditor-CGS8M5hU.js → SourceEditor-wRLdKlEx.js} +2 -2
- package/dist/public/assets/config-validation-events-2g5Tn60q.js +11 -0
- package/dist/public/assets/{dist-DQ1oWohr.js → dist-CadHdAvi.js} +1 -1
- package/dist/public/assets/{dist-By89CQBy.js → dist-CdAufVHw.js} +1 -1
- package/dist/public/assets/{dist-DllAuqQQ.js → dist-Cwt7KtW7.js} +1 -1
- package/dist/public/assets/{dist-DpEGxZ9h.js → dist-DRBAXDc3.js} +1 -1
- package/dist/public/assets/{dist-D-oqC0-R.js → dist-DkR43q3h.js} +1 -1
- package/dist/public/assets/{dist-DXgyWuz5.js → dist-y5PvfJVO.js} +1 -1
- package/dist/public/assets/index-BG8pn9At.js +1915 -0
- package/dist/public/assets/index-Cr48lc4Y.css +1 -0
- package/dist/public/assets/{doc-hash-vTVhxqN8.js → prop-types-DgXoNo88.js} +46 -46
- package/dist/public/assets/target-navigation-intent-4pvac8Xe.js +1 -0
- package/dist/public/assets/toggle-group-KLnzY88z.js +1 -0
- package/dist/public/assets/{typing-burst-detector-C6igd2dt.js → typing-burst-detector-YLtKpRD8.js} +2 -2
- package/dist/public/index.html +17 -17
- package/dist/{repair-launch-json-BXfguHOE.mjs → repair-launch-json-DgXubyAt.mjs} +2 -2
- package/dist/{repair-mcp-configs-BfL2Boke.mjs → repair-mcp-configs-DNVytwh9.mjs} +2 -2
- package/dist/schemas/v0/config.project.schema.json +20 -0
- package/dist/{src-DDsYq8kU.mjs → src-DDVTc8a2.mjs} +2 -2
- package/dist/{start-WwujmtJB.mjs → start-CQhiQAVz.mjs} +2 -2
- package/dist/start-DYyrxo2Q.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-BvAlnoYp.mjs +0 -2
- package/dist/init-ByuOX5BB.mjs +0 -1
- package/dist/loader-DOKA2S8u.mjs +0 -1
- package/dist/preview-BgITM9P5.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-Dqizi1zs.js +0 -2
- package/dist/public/assets/DocumentContext-wUNU3WKC.js +0 -52
- package/dist/public/assets/GraphPanel-DJzqhM8Y.js +0 -46
- package/dist/public/assets/SettingsDialogBody-Dr1eemOR.js +0 -7
- package/dist/public/assets/config-validation-events-WvSp0ut5.js +0 -10
- package/dist/public/assets/index-CXzfIokG.css +0 -1
- package/dist/public/assets/index-D_MAZlga.js +0 -1916
- package/dist/public/assets/target-navigation-intent-DjrfS_EW.js +0 -1
- package/dist/public/assets/toggle-group-CLa7SVaF.js +0 -1
- package/dist/start-CoRGsU4v.mjs +0 -1
- /package/dist/public/assets/{dist-D3YXABda.js → dist-sw9fzKjM.js} +0 -0
- /package/dist/public/assets/{label-BGXy6Okv.js → label-DCMZaJ38.js} +0 -0
- /package/dist/public/assets/{mcp-consent-store-BPw6Zd40.js → mcp-consent-store-19Boxoxe.js} +0 -0
- /package/dist/public/assets/{project-paths-DKT5BePl.js → project-paths-eyh51nmQ.js} +0 -0
- /package/dist/public/assets/{stex-ChE_gMQ6.js → stex-DxnLy7rA.js} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,d as t,f as n,g as r,h as i,i as a,m as o,r as s,s as c,t as l,u,y as d}from"./init-
|
|
1
|
+
import{b as e,d as t,f as n,g as r,h as i,i as a,m as o,r as s,s as c,t as l,u,y as d}from"./init-BVyOcRVl.mjs";import{i as f,n as p,r as m,t as h}from"./src-DDVTc8a2.mjs";import{n as g}from"./loader-DlVJK5_j.mjs";import{n as _}from"./preview-D-yuPDgI.mjs";export{o as ALL_EDITOR_IDS,i as EDITOR_LABELS,r as EDITOR_TARGETS,l as LAUNCH_CONFIG_NAME,s as classifyExistingMcpEntry,a as detectInstalledEditors,e as initContent,g as loadConfig,m as parseGitHubBlobUrl,f as parseGitUrl,_ as previewContent,c as readExistingMcpEntry,d as resolveProjectRoot,u as scaffoldLaunchJson,p as validateLocalFolderForShare,t as writeEditorMcpConfig,h as writeProjectAiIntegrations,n as writeUserMcpConfigs};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,N as s,Nt as c,Qr as l,Un as u,ai as d,an as f,di as p,fn as m,gi as h,hi as g,ii as _,in as v,jt as y,ln as b,ri as x,rn as S,si as C}from"./dist-soQLoIV1.mjs";import{n as ee,t as te}from"./constants-BvAlnoYp.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-Dfnjbkm0.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},xe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Se={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ee=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===je?Ee(e.slice(p,n.lastIndex)):n===Ne?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,N as s,Nt as c,Qr as l,Un as u,ai as d,an as f,di as p,fn as m,gi as h,hi as g,ii as _,in as v,jt as y,ln as b,ri as x,rn as S,si as C}from"./dist-DVt5ImvV.mjs";import{n as ee,t as te}from"./constants-DMYn7coi.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-D-yuPDgI.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},xe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Se={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ee=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===je?Ee(e.slice(p,n.lastIndex)):n===Ne?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
|
|
2
2
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){Be.lastIndex=e+1;let t=Be.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
3
3
|
`){a&&(r+=Ue(``));let e=i?Ve(i):void 0;i&&e&&(r+=He(e))}else t===`
|
|
4
4
|
`&&(i&&Ve(i)&&(r+=He(i)),a&&(r+=Ue(a)))}return r},qe=/\r?\n/;function Je(e,t,n){return String(e).normalize().split(qe).map(e=>Ke(e,t,n)).join(`
|
|
@@ -401,9 +401,9 @@ last-spawn-error.log
|
|
|
401
401
|
# *.draft.md # exclude files matching a pattern
|
|
402
402
|
# !keep.md # re-include a file .gitignore excluded
|
|
403
403
|
`,`.okignore`)?r.push(`.okignore`):a.push(`.okignore`),{created:r,updated:i,skipped:a}}function $n(e,t){let n=N(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const er=e=>{try{let t=ie(`git`,[`rev-parse`,`--show-toplevel`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return t.length>0?t:null}catch{return null}};function tr(e,t={}){let n=t.homeDir??H(),r=t.gitTopLevel??er,i=P(e),a;try{a=le(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(m(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=k(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&$n(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function nr(e,t){let n;try{n=le(t)}catch{n=P(t)}let r;try{r=ce(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(r?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);let i=k(e);for(;i.length>1&&i!==F;){let t;try{t=le(i)}catch(e){if(e.code===`ENOENT`){i=k(i);continue}throw e}let r=N(n,t);if(r===``||!r.startsWith(`..`)&&!A(r))return;throw Error(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function rr(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=u(`project`,{checkDesktop:!0}),i=k(n);nr(i,t);let a=L(n)?`overwritten`:`written`;return ue(i,{recursive:!0,force:!0}),R(k(i),{recursive:!0}),se(r,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}const ir=l,ar=x,or=[`-y`,`@inkeep/open-knowledge@latest`,`mcp`],sr={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`};function cr(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=P(e);if(oe(t)===`cli.mjs`&&oe(k(t))===`dist`)return t;let n=t.split(F),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return j(i.length===0?F:i.join(F),`packages`,`cli`,`dist`,`cli.mjs`)}function lr(e={}){return e.cliPath?{command:e.cliPath,args:[`mcp`]}:e.mode===`dev`?{command:`node`,args:[cr(),`mcp`],env:{...sr}}:{command:`npx`,args:[...or]}}function ur(e){return e===`win32`?I:M}function dr(e={}){let t=e.platformName??process.platform,n=e.home??H();return ur(t).join(n,`.claude.json`)}function fr(e={}){let t=e.platformName??process.platform,n=e.home??H(),r=e.env??process.env;if(t===`darwin`)return M.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??I.join(n,`AppData`,`Roaming`);return I.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function pr(e={}){let t=e.platformName??process.platform,n=e.home??H();return ur(t).join(n,`.cursor`,`mcp.json`)}function mr(e={}){let t=e.platformName??process.platform,n=e.home??H();return(e.env??process.env).CODEX_HOME??ur(t).join(n,`.codex`)}function hr(e={}){return ur(e.platformName??process.platform).join(mr(e),`config.toml`)}function gr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>gr(e,t[n]));if(w(e)&&w(t)){let n=Object.keys(e).sort(),r=Object.keys(t).sort();return n.length===r.length&&n.every((e,t)=>e===r[t])&&n.every(n=>gr(e[n],t[n]))}return!1}function _r(e,t){return Object.entries(t).every(([t,n])=>gr(e[t],n))}function vr(e,t){return{...e,...t}}function yr(e){return{...e,isCompatible(t,n,r){return _r(t,e.buildEntry(n,r))},mergeManagedFields(t,n,r){return vr(t,e.buildEntry(n,r))}}}const Q={claude:yr({id:`claude`,label:ar.claude,configPath:(e,t)=>dr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>j(t??H(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)}),"claude-desktop":yr({id:`claude-desktop`,label:ar[`claude-desktop`],configPath:(e,t)=>fr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(fr({home:t}))}),cursor:yr({id:`cursor`,label:ar.cursor,configPath:(e,t)=>pr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(pr({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)}),codex:yr({id:`codex`,label:ar.codex,configPath:(e,t)=>hr({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>o,buildEntry:(e,t)=>lr(t),scope:`global`,detectPath:(e,t)=>k(hr({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.agents`,`skills`,`open-knowledge`,`SKILL.md`)})};function br(e){let t=e.filter(e=>!Object.hasOwn(Q,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${ir.join(`, `)}`);return e.map(e=>Q[e])}function $(e,t,n,r,i){let a=`urn:uuid:${he()}`;if(e.headersSent||e.writableEnded||e.destroyed){console.error(`[ok ui] emitProblem called after headers sent — suppressed`,{type:n,status:t,instance:a});return}let o={type:n,title:r,status:t,instance:a,...i===void 0?{}:{detail:i}},s=C.safeParse(o);if(!s.success){console.error(`[ok ui] emitProblem produced an invalid ProblemDetails body:`,{issues:s.error.issues,originalStatus:t,body:o}),e.writeHead(500,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify({type:`urn:ok:error:internal-server-error`,title:`Internal server error.`,status:500,instance:a}));return}e.writeHead(t,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify(o))}const xr=1e4;function Sr(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!b(n))return $(t,403,`urn:ok:error:loopback-required`,`Request must originate from a loopback address.`),!0;if(!f(e.headers.host))return $(t,403,`urn:ok:error:host-not-allowed`,`Host header is not in the loopback allowlist.`),!0;let r=e.headers.origin;return r!==void 0&&!v(r)?($(t,403,`urn:ok:error:invalid-origin`,`Origin header is not in the loopback allowlist.`),!0):!1}const Cr=3e4;function wr(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!b(n)||!f(e.headers.host))return t.destroy(),!0;let r=e.headers.origin;return typeof r==`string`&&!v(r)?(t.destroy(),!0):!1}function Tr(e,t,n,r,i,a){a.add(t),t.once(`close`,()=>a.delete(t));let o=ve({host:r,port:i,timeout:xr});a.add(o),o.once(`close`,()=>a.delete(o));let s=!1,c=n=>{if(!s){if(s=!0,n!==void 0){let t=n.err;console.warn(JSON.stringify({event:n.event,upstreamHost:r,upstreamPort:i,url:e.url,code:t instanceof Error?t.code:void 0,message:t instanceof Error?t.message:void 0}))}try{o.destroy()}catch{}try{t.destroy()}catch{}}};o.once(`connect`,()=>{o.setTimeout(0);let a=[`${e.method??`GET`} ${e.url??`/`} HTTP/1.1`,`host: ${r}:${i}`];for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()!==`host`&&n!==void 0)if(Array.isArray(n))for(let e of n)a.push(`${t}: ${e}`);else a.push(`${t}: ${n}`);try{o.write(`${a.join(`\r
|
|
404
|
-
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const Er=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function Dr(e){let t=e.upstreamTimeoutMs??xr,n=new Set,r=ge((n,r)=>{Sr(n,r)||kr(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{wr(t,r)||Tr(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function Or(e,t,n){kr(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??xr)}function kr(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of Er)delete a[e];e.setTimeout(Cr,()=>{if(t.headersSent)try{t.end()}catch{}else try{$(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${Cr/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=_e({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of Er)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)$(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)$(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}const Ar=39847,jr=39848;async function Mr(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}async function Nr(e){let{existsSync:t}=await import(`node:fs`),{createServer:n}=await import(`node:http`),{resolve:r}=await import(`node:path`),{acquireUiLock:i,createAssetServeMiddleware:o,createContentFilter:s,readServerLock:c,releaseUiLock:l,updateUiLockPort:u}=await import(`./dist-
|
|
404
|
+
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const Er=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function Dr(e){let t=e.upstreamTimeoutMs??xr,n=new Set,r=ge((n,r)=>{Sr(n,r)||kr(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{wr(t,r)||Tr(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function Or(e,t,n){kr(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??xr)}function kr(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of Er)delete a[e];e.setTimeout(Cr,()=>{if(t.headersSent)try{t.end()}catch{}else try{$(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${Cr/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=_e({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of Er)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)$(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)$(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}const Ar=39847,jr=39848;async function Mr(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}async function Nr(e){let{existsSync:t}=await import(`node:fs`),{createServer:n}=await import(`node:http`),{resolve:r}=await import(`node:path`),{acquireUiLock:i,createAssetServeMiddleware:o,createContentFilter:s,readServerLock:c,releaseUiLock:l,updateUiLockPort:u}=await import(`./dist-BTk16yDE.mjs`),{default:f}=await import(`./build-B4ZT2GMK.mjs`),{resolveContentDir:m,resolveLockDir:h}=await import(`./dist-BTk16yDE.mjs`),g=m(e.config,e.cwd),v=h(e.cwd);i(v,{port:0,worktreeRoot:e.cwd});let y=import.meta.dirname??new URL(`.`,import.meta.url).pathname,b=[r(y,`public`),r(y,`../../app/dist`),r(y,`../../../app/dist`)].find(e=>t(e)),x=b?f(b,{single:!0,gzip:!0,immutable:!0,extensions:[]}):null,S=t(g)?o({contentFilter:s({projectDir:e.cwd,contentDir:g}),contentSirv:f(g,{dotfiles:!1,dev:!0,extensions:[]}),inlineExtensions:d,assetExtensions:a,blocklistExtensions:_}):null,C=e.port,ee=null,te=(e,t)=>{let n=e.url?.split(`?`)[0];if((n===`/`||n===``)&&(e.url=`/index.html`),!(n?.startsWith(`/api/`)&&Sr(e,t))){if(n===`/api/config`&&(e.method===`GET`||e.method===`HEAD`)){ee?.();let n=c(v),r=e.headers.host??`localhost:${C}`,i=n&&n.port>0?`ws://${r}/collab`:null,a=JSON.stringify({collabUrl:i,previewUrl:null,port:C});t.setHeader(`Content-Type`,`application/json`),t.setHeader(`Cache-Control`,`no-store`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.statusCode=200,e.method===`HEAD`?t.end():t.end(a);return}if(n?.startsWith(`/api/`)){ee?.();let r=c(v);if(!r||r.port<=0){$(t,503,`urn:ok:error:collab-server-not-running`,"Collab server not running. Start `ok start` or run `ok status`.",`Path: ${n}`);return}Or(e,t,{upstreamHost:`localhost`,upstreamPort:r.port});return}if(x&&n?.startsWith(`/assets/`)){x(e,t,()=>{S?S(e,t,()=>Pr(t,n)):Pr(t,n)});return}if(S){S(e,t,()=>{x?x(e,t):Pr(t,n)});return}if(x){x(e,t);return}Pr(t,n)}},w=new Set,T=(e,t,n)=>{if(wr(e,t))return;let r=e.url?.split(`?`)[0]??``;if(r!==`/collab`&&!r.startsWith(`/collab/`)){t.destroy();return}let i=c(v);if(!i||i.port<=0){console.warn(JSON.stringify({event:`ok-ui-upgrade-no-collab-lock`,url:r,reason:"server.lock missing or port unbound — is `ok start` running?"})),t.destroy();return}Tr(e,t,n,`localhost`,i.port,w)},E=()=>{for(let e of w)try{e.destroy()}catch{}w.clear()},ne=e.host===void 0?[`::1`,`127.0.0.1`]:[e.host],D=[],O=e.port,re=e=>e instanceof Error&&e.code===`EADDRINUSE`,ie=async()=>{await Promise.all(D.splice(0).map(e=>new Promise(t=>{try{e.close(()=>t())}catch{t()}})))},ae=async e=>{O=e;for(let e of ne){let t=n(te);t.on(`upgrade`,T),D.push(t),await new Promise((n,r)=>{let i=e=>r(e);t.once(`error`,i),t.listen(O,e,()=>{t.off(`error`,i);let e=t.address();typeof e==`object`&&e&&(O=e.port),n()})})}};try{try{await ae(e.port)}catch(t){if(e.fallbackToKernel===!0&&re(t))await ie(),await ae(0);else throw t}}catch(e){await ie();try{l(v)}catch{}throw e}let oe=O;C=oe,u(v,oe);let k=e.scheduler??p,A=e.safetyNetMs??432e5,j=null,M=!1,N=!1,P=()=>{M||(M=!0,j!==null&&(k.clearTimeout(j),j=null))},F=()=>{if(P(),!N){N=!0;try{l(v)}catch{}}},I=()=>{M||A<=0||(j!==null&&(k.clearTimeout(j),j=null),j=k.setTimeout(()=>{j=null,console.warn(`[ui] safety-net (${A}ms) reached — shutting down (D-025 backstop)`);try{e.onSafetyNet?.()}catch{}E();for(let e of D)try{e.close()}catch{}F()},A))},se=()=>{M||A<=0||I()};return ee=se,I(),{httpServers:D,port:oe,release:F,detachSafetyNet:P,nudgeSafetyNet:se,drainUpgradeSockets:E}}function Pr(e,t){$(e,404,`urn:ok:error:not-found`,`Resource not found.`,t===void 0?void 0:`Path: ${t}`)}function Fr(e,t){if(e!==void 0){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<0||t>65535)throw Error(`Invalid --port value '${e}'`);return{port:t,fallbackToKernel:!1}}if(t!==void 0&&t!==``){let e=Number.parseInt(t,10);if(Number.isNaN(e)||e<0||e>65535)throw Error(`Invalid PORT env value '${t}'`);return{port:e,fallbackToKernel:!1}}return{port:Ar,fallbackToKernel:!0}}async function Ir(e){let t=e.readLock??(async()=>{let{readUiLock:t}=await import(`./dist-BTk16yDE.mjs`);return t(e.lockDir)}),n=await t();if(!n)throw Error(`UI lock collision reported but the lock disappeared before handling — retry acquiring.`);if(n.port===e.requestedPort&&n.port>0)return{mode:`already-running`,port:n.port};let r=n.port;if(r===0){let n=Date.now()+(e.pollDeadlineMs??2e3),i=e.pollIntervalMs??100;for(;Date.now()<n;){await new Promise(e=>{setTimeout(e,i)});let e=await t();if(e&&e.port>0){r=e.port;break}}if(r===0)throw Error("UI did not bind within 2s; run `ok clean`");if(r===e.requestedPort)return{mode:`already-running`,port:r}}return{mode:`proxy`,handle:await Dr({listenPort:e.requestedPort,host:e.host,upstreamHost:`localhost`,upstreamPort:r}),upstreamPort:r}}function Lr(e){return new i(`ui`).description(`Serve the Open Knowledge React editor UI`).option(`-p, --port <port>`,`UI port (default: $PORT env or ${Ar}, kernel-allocated fallback if busy)`).option(`-H, --host <host>`,"UI host. Default: two-socket loopback bind (`[::1]` + `127.0.0.1`) so cross-family collisions fail loud. Pass an explicit host (e.g. `127.0.0.1`, `0.0.0.0`) to bind a single socket on that host.").action(async t=>{let{dim:n}=await import(`./colors-BCE2jNgl.mjs`),{UiLockCollisionError:r}=await import(`./dist-BTk16yDE.mjs`),{resolveLockDir:i}=await import(`./dist-BTk16yDE.mjs`),a=e(),o=t.host,s;try{s=Fr(t.port,process.env.PORT)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1;return}let c=s.port;try{let e=await Nr({config:a,cwd:process.cwd(),port:c,fallbackToKernel:s.fallbackToKernel,host:o}),t=o===void 0||o===`::`||o===`0.0.0.0`?`localhost`:o;console.log(`${n(`[ui]`)} listening on http://${t}:${e.port}`);let r=!1,i=t=>{if(r)return;r=!0,console.log(n(`\n[ui] Shutting down (${t})`)),e.detachSafetyNet();let i=()=>{try{e.release()}finally{process.exit(process.exitCode??0)}};e.drainUpgradeSockets(),Mr(e.httpServers).then(i,i),setTimeout(i,2e3).unref()};process.once(`SIGINT`,()=>i(`SIGINT`)),process.once(`SIGTERM`,()=>i(`SIGTERM`));return}catch(e){if(!(e instanceof r))throw e;let t=i(process.cwd()),a=o??`localhost`,s;try{s=await Ir({requestedPort:c,host:a,lockDir:t})}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}if(s.mode===`already-running`){if(console.log(`UI already running at http://${a}:${s.port}`),Rr(process)){await new Promise(e=>{let t=t=>{console.log(n(`\n[ui-keepalive] Shutting down (${t})`)),e()};process.once(`SIGINT`,()=>t(`SIGINT`)),process.once(`SIGTERM`,()=>t(`SIGTERM`))});return}process.exit(0)}console.log(`UI running at http://${a}:${s.upstreamPort}; acting as HTTP proxy on port ${s.handle.port}`);let l=!1,u=e=>{l||(l=!0,console.log(n(`\n[ui-proxy] Shutting down (${e})`)),s.handle.close().finally(()=>process.exit(process.exitCode??0)),setTimeout(()=>process.exit(process.exitCode??0),2e3).unref())};process.once(`SIGINT`,()=>u(`SIGINT`)),process.once(`SIGTERM`,()=>u(`SIGTERM`))}})}function Rr(e){let t=e.stdout.isTTY===!0,n=typeof e.env.PORT==`string`&&e.env.PORT!==``;return!t||n}function zr(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=JSON.parse(t);if(w(n))return n;throw Error(`${e} root must be a JSON object`)}catch(t){throw t instanceof SyntaxError?Error(`${e} contains invalid JSON: ${t.message}`):t}}function Br(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=Fn(t);if(w(n))return n;throw Error(`${e} root must be a TOML table`)}catch(t){throw Error(`${e} contains invalid TOML: ${t instanceof Error?t.message:String(t)}`)}}function Vr(e,t){R(k(e),{recursive:!0}),B(e,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function Hr(e,t){R(k(e),{recursive:!0});let n=Gn(t);B(e,n.endsWith(`
|
|
405
405
|
`)?n:`${n}\n`,`utf-8`)}const Ur=e=>e!==`project`,Wr=e=>e!==`user`;async function Gr(){let e=await dn({message:`Where should the MCP server be configured?
|
|
406
406
|
`,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function Kr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Gr)():`both`}const qr=`0.0.1`,Jr=`open-knowledge-ui`,Yr=[`-y`,`@inkeep/open-knowledge@latest`,`ui`];function Xr(e,t={}){let n=j(e,`.claude`,`launch.json`),r=t.cliPath===void 0?t.mode===`dev`?{name:Jr,runtimeExecutable:`node`,runtimeArgs:[cr(),`ui`],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:`npx`,runtimeArgs:[...Yr],port:jr,autoPort:!0}:{name:Jr,runtimeExecutable:t.cliPath,runtimeArgs:[`ui`],port:jr,autoPort:!0};try{if(nr(n,e),!L(n))return R(k(n),{recursive:!0}),B(n,`${JSON.stringify({version:qr,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=z(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!w(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>w(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??qr,configurations:a};return B(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Zr(e,t,n){try{return L(e.detectPath?.(t,n)??k(e.configPath(t,n)))}catch{return!1}}function Qr(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}if(!i&&!n.skipAvailabilityCheck&&!Zr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{nr(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}let s;try{s=e.format===`toml`?Br(o):zr(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?Hr(o,d):Vr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function $r(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function ei(e){let t=br(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>Qr(t,``,n,e.home))}function ti(e,t,n,r){let i=ni(e,t,n,r);return i.kind===`present`?i.entry:null}function ni(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}if(a.trim()===``)return{kind:`corrupt`,error:`file is empty`};let o;try{o=e.format===`toml`?Br(i):zr(i)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}let s=o[e.topLevelKey];if(!w(s))return{kind:`no-entry`};let c=s[e.serverName(t)];return w(c)?{kind:`present`,entry:c}:{kind:`no-entry`}}async function ri(e={}){let t=P(e.cwd??process.cwd()),n=tr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(j(r,`.ok`));n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&console.log(`[ok] Initialized OK at ${r} — opened parent of ${N(r,t)} because it contains a .git folder`);let a={mode:e.devMcp?`dev`:`published`},o=await c(r),s;try{s=Qn(r,{contentDir:n.defaultContentDir})}catch(t){let n=Q.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:o.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:n,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`}}let l=await Kr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),u=e.editors??ai(r,e.home),d=e.editors??ir.filter(e=>Q[e].projectConfigPath!==void 0),f=br(u),p=br(d),m=e.mcp===!1||l===null,h=Array.from(new Map([...f,...m?[]:p].map(e=>[e.id,e])).values()),g=f.filter(t=>Zr(t,r,e.home)),_=[],v=[],b=new Set;for(let t of h){if(m){let n=``;try{n=t.configPath(r,e.home)}catch{}_.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Ur(l)&&f.includes(t)&&_.push(Qr(t,r,a,e.home)),Wr(l)&&p.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Qr(t,r,a,e.home,n);_.push(i),(i.action===`written`||i.action===`overwritten`)&&b.add(n)}}for(let e of p)e.projectSkillPath&&v.push(rr(e,r));let x=!m&&l!==null&&Wr(l)?p.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,C=m?[]:g.map(e=>$r(e,r)).filter(e=>e!==void 0).filter(e=>!b.has(e.path)),ee=g.some(e=>e.id===`claude`)&&!m?Xr(r,a):void 0,te=await(e.installUserSkill??S)({home:e.home}),w=y({home:e.home}),T=m?`skipped-flag`:`skipped-missing`,E=_.find(e=>e.editorId===`claude`)??_[0]??{action:T,configPath:Q.claude.configPath(r,e.home)};return{projectRoot:r,contentCreated:s.created,contentUpdated:s.updated,contentSkipped:s.skipped,editors:_,projectSkills:v,legacyProjectConfigs:C,launchJson:ee,skillInstall:te,didGitInit:o.didInit,claudeDesktopDetected:w,mcpAction:E.action,mcpPath:E.configPath,mcpError:`error`in E?E.error:void 0,projectScopeUnsupportedLabels:x}}function ii(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`),s=e=>{let n=e.configPath.startsWith(t)?N(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${c}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(O(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${E(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${E(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${ne(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(O(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${ne(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(O(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${E(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${D(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${O(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(re(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${E(`✓`)} ${O(`Next steps:`)}`),n.push(` 1. Open your editor (${T(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${T(`ok seed`)} — empty repo, Karpathy 3-layer`),n.push(` - ${T(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${T(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${T(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${T(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
|
|
407
407
|
`)}function ai(e,t){let n=[];for(let r of ir)Zr(Q[r],e,t)&&n.push(r);return n}function oi(){return new i(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).addOption(new r(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).action(async e=>{let t=process.cwd(),n;try{n=await ri({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope})}catch(e){if(e instanceof s){process.stderr.write(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.
|
|
408
|
-
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-
|
|
409
|
-
//# sourceMappingURL=init-
|
|
408
|
+
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-OJnqomHA.mjs`),{loadConfig:t}=await import(`./loader-zlf-nKBp.mjs`),{resolveContentDir:r}=await import(`./dist-BTk16yDE.mjs`),{config:i}=t(n.projectRoot),a=r(i,n.projectRoot);n.preview=e({projectDir:n.projectRoot,contentDir:a})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${ii(n,n.projectRoot)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{Te as A,ut as C,ot as D,ht as E,Ye as O,lt as S,dt as T,or as _,ii as a,Qn as b,Kr as c,Qr as d,ei as f,Q as g,ar as h,ai as i,W as j,Je as k,ri as l,ir as m,Yr as n,oi as o,Lr as p,ni as r,ti as s,Jr as t,Xr as u,rr as v,pt as w,ft as x,tr as y};
|
|
409
|
+
//# sourceMappingURL=init-BVyOcRVl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./init-BVyOcRVl.mjs";export{e as runInit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Jr as e,f as t,fi as n,ji as r,qr as i,vi as a}from"./dist-
|
|
1
|
+
import{Jr as e,f as t,fi as n,ji as r,qr as i,vi as a}from"./dist-DVt5ImvV.mjs";import{t as o}from"./constants-DMYn7coi.mjs";import{t as s}from"./is-object-C-4FJ0rP.mjs";import{resolve as c}from"node:path";import{existsSync as l,readFileSync as u}from"node:fs";import{realpath as d}from"node:fs/promises";async function f(e){let t=c(e);try{return await d(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}var p=r();function m(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];s(a)&&s(i)?n[r]=m(i,a):a!==void 0&&(n[r]=a)}return n}function h(e){if(!l(e))return{value:null,path:e,source:null,doc:null};let t;try{t=u(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,p.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return s(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const g=[`include`,`exclude`];function _(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function v(e){let t=e.value;if(!s(t))return[];let n=t.content;if(!s(n))return[];let r=[];for(let t of g)if(t in n){let n=[`content`,t],i;e.doc!==null&&e.source!==null&&(i=a({file:e.path,source:e.source,doc:e.doc,path:n})),r.push({code:`REMOVED_KEY`,path:n,redirect:_(t),...i===void 0?{}:{source:i}})}return r}function y(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=a({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function b(r){let a=r??process.cwd(),s=[],l=e(`user`,a),u=i({absPath:l}),d={};u.valid&&u.source!==void 0?(d=m(d,u.value),s.push(l)):u.valid;let f=c(a,`.ok`,o),p=h(f);if(p.value!==null){let e=v(p);if(e.length>0)throw Error(e.map(n).join(`
|
|
2
2
|
|
|
3
3
|
`));d=m(d,p.value),s.push(f)}x(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),x(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),x(d,[`server`,`host`],`use the --host flag or HOST env var instead`),x(d,[`server`,`openOnAgentEdit`]),x(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),x(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),x(d,[`mcp`,`tools`,`grep`,`maxResults`]),x(d,[`mcp`,`tools`,`search`,`maxResults`]),x(d,[`preview`,`baseUrl`],"preview URLs now resolve only to the running UI process — start one with `ok ui`");let g=t.safeParse(d);if(!g.success){let e={code:`SCHEMA_INVALID`,issues:y(g.error.issues,p)};throw Error(n(e))}return{config:g.data,sources:s}}function x(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){if(!s(r))return;r=r[t[e]]}if(!s(r))return;let i=t[t.length-1];if(r[i]===void 0)return;let a=t.join(`.`);console.warn(`[config] ${a} is no longer user-configurable; ${n??`the value is hardcoded in @inkeep/open-knowledge-core`}. Remove the key to silence this warning.`)}function S(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=f(e.startupCwd);return async o=>{let s=await f(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,S as t};
|
|
4
|
-
//# sourceMappingURL=loader-
|
|
4
|
+
//# sourceMappingURL=loader-DlVJK5_j.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-DlVJK5_j.mjs";export{e as loadConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{bt as e}from"./dist-
|
|
1
|
+
import{bt as e}from"./dist-DVt5ImvV.mjs";import"./constants-DMYn7coi.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
|
|
2
2
|
`)}export{c as n,l as t};
|
|
3
|
-
//# sourceMappingURL=preview-
|
|
3
|
+
//# sourceMappingURL=preview-D-yuPDgI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-D-yuPDgI.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-LNHry3BJ.js","./chunk-CFjPhJqf.js","./compiler-runtime-Cs91PcD2.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{a as n,i as r,o as i,r as a,t as o}from"./compiler-runtime-Cs91PcD2.js";import{$n as s,Mn as c,n as l,nt as u,r as d,tr as f}from"./DocumentContext-BLVVzPxk.js";import{Ht as p,O as m,et as h,j as g,k as _,pi as v,tt as y,v as b}from"./prop-types-DgXoNo88.js";import{C as x,t as S}from"./button-DenIdY-r.js";import{f as C,i as w,m as T,r as E,t as D}from"./agent-presence-DxGcS3q2.js";import{a as O,c as k,i as A,o as j,s as M,t as ee,x as N}from"./dialog-CoRJrIIb.js";import{a as te}from"./collapsible-BhpeB6tu.js";var ne=x(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),P=o(),F=e(n(),1),I=500,re=64;async function ie(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new u(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=p.safeParse(r);throw e.success?Error(e.data.title):new u(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=h.safeParse(r);if(!i.success)throw new u(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function L(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new u(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=p.safeParse(a);throw e.success?Error(e.data.title):new u(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=y.safeParse(a);if(!o.success)throw new u(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function ae(e){let t=(0,P.c)(23),{systemProvider:n}=l(),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(`idle`),[s,c]=(0,F.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new w(re),t[0]=u):u=t[0];let d=(0,F.useRef)(u),f=(0,F.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),c(null),ie(e).then(r=>{if(f.current!==t)return;let a=R(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(c(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),c(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=b(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},I))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let g;t[6]===e?g=t[7]:(g=[e],t[6]=e,t[7]=g),(0,F.useEffect)(h,g);let _,v;t[8]!==e||t[9]!==n?(_=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=R(n,e);i(e=>!e||oe(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},v=[e,n],t[8]=e,t[9]=n,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,F.useEffect)(_,v);let y;t[12]===e?y=t[13]:(y=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await L(e,t,n);return d.current.set(r,a),a},t[12]=e,t[13]=y);let x=y,S;t[14]!==e||t[15]!==m?(S=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=S):S=t[16];let C=S,T;return t[17]!==r||t[18]!==s||t[19]!==x||t[20]!==C||t[21]!==a?(T={data:r,status:a,error:s,reload:C,fetchBurstDiff:x},t[17]=r,t[18]=s,t[19]=x,t[20]=C,t[21]=a,t[22]=T):T=t[22],T}function oe(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function R(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!D(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var z=i(),se=(0,F.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function ce(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return v._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return v._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function le(e){let t=(0,P.c)(42),{burst:n,docName:i,fetchBurstDiff:o}=e,{_:s}=r(),[c,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)(null),[p,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(ue),y,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(e)},b=[],t[0]=y,t[1]=b):(y=t[0],b=t[1]),(0,F.useEffect)(y,b);let x;t[2]!==n.stackIndex||t[3]!==u||t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==h?(x=()=>{let e=!c;l(e),e&&u===null&&!h&&(g(!0),m(null),o(i,n.stackIndex).then(e=>{d(e),g(!1)}).catch(e=>{m(e instanceof Error?e.message:String(e)),g(!1)}))},t[2]=n.stackIndex,t[3]=u,t[4]=i,t[5]=c,t[6]=o,t[7]=h,t[8]=x):x=t[8];let S=x,C=n.stackIndex+1,w;t[9]!==s||t[10]!==C||t[11]!==c?(w=s(c?{id:`-i7ik4`,values:{burstNumber:C}}:{id:`EeRZnZ`,values:{burstNumber:C}}),t[9]=s,t[10]=C,t[11]=c,t[12]=w):w=t[12];let T;t[13]===c?T=t[14]:(T=c?(0,z.jsx)(f,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,z.jsx)(te,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[13]=c,t[14]=T);let E;t[15]!==n.ts||t[16]!==_?(E=ce(n.ts,_),t[15]=n.ts,t[16]=_,t[17]=E):E=t[17];let D;t[18]===E?D=t[19]:(D=(0,z.jsx)(`span`,{className:`font-mono`,children:E}),t[18]=E,t[19]=D);let O;t[20]===n.additions?O=t[21]:(O=(0,z.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[20]=n.additions,t[21]=O);let k;t[22]===n.deletions?k=t[23]:(k=(0,z.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[22]=n.deletions,t[23]=k);let A;t[24]!==O||t[25]!==k?(A=(0,z.jsxs)(`span`,{className:`ml-auto font-mono`,children:[O,` `,k]}),t[24]=O,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==c||t[28]!==A||t[29]!==w||t[30]!==T||t[31]!==D||t[32]!==S?(j=(0,z.jsxs)(`button`,{type:`button`,onClick:S,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":c,"aria-label":w,children:[T,D,A]}),t[27]=c,t[28]=A,t[29]=w,t[30]=T,t[31]=D,t[32]=S,t[33]=j):j=t[33];let M;t[34]!==u||t[35]!==c||t[36]!==p||t[37]!==h?(M=c?(0,z.jsx)(`div`,{className:`bg-muted/20`,children:h?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(a,{id:`38foVZ`})}):p?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:(0,z.jsx)(a,{id:`pmKdif`,values:{loadError:p}})}):u===null?(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(a,{id:`iNFKkm`})}):(0,z.jsx)(F.Suspense,{fallback:(0,z.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:(0,z.jsx)(a,{id:`38foVZ`})}),children:(0,z.jsx)(se,{diff:u})})}):null,t[34]=u,t[35]=c,t[36]=p,t[37]=h,t[38]=M):M=t[38];let ee;return t[39]!==j||t[40]!==M?(ee=(0,z.jsxs)(`div`,{className:`border-t border-border/50`,children:[j,M]}),t[39]=j,t[40]=M,t[41]=ee):ee=t[41],ee}function ue(){return Date.now()}function de(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return v._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return v._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return v._({id:`nYeBmY`,values:{hours:r}})}function fe(e){let t=(0,P.c)(118),{file:n,sessionAlive:i,isWriting:o,onNavigate:s,onUndoLast:c,onUndoAll:l,fetchBurstDiff:u}=e,{_:d}=r(),{docName:p}=n,[h,v]=(0,F.useState)(!1),[y,b]=(0,F.useState)(!1),[x,w]=(0,F.useState)(!1),[T,E]=(0,F.useState)(me),D,N;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>E(Date.now()),3e4);return()=>clearInterval(e)},N=[],t[0]=D,t[1]=N):(D=t[0],N=t[1]),(0,F.useEffect)(D,N),n.bursts.length===0)return null;let I=!i||n.bursts.length===0||x,re=n.bursts.length,ie;t[2]!==d||t[3]!==n.bursts.length||t[4]!==i?(ie=i?n.bursts.length===0?d({id:`2fkdnR`}):null:d({id:`NzFvyK`}),t[2]=d,t[3]=n.bursts.length,t[4]=i,t[5]=ie):ie=t[5];let L=ie,ae;t[6]!==I||t[7]!==n.docName||t[8]!==c?(ae=e=>{e.stopPropagation(),!I&&(w(!0),Promise.resolve(c(n.docName)).finally(()=>w(!1)))},t[6]=I,t[7]=n.docName,t[8]=c,t[9]=ae):ae=t[9];let oe=ae,R;t[10]===I?R=t[11]:(R=e=>{e.stopPropagation(),!I&&b(!0)},t[10]=I,t[11]=R);let se=R,ce;t[12]!==I||t[13]!==n.docName||t[14]!==l?(ce=()=>{b(!1),!I&&(w(!0),Promise.resolve(l(n.docName)).finally(()=>w(!1)))},t[12]=I,t[13]=n.docName,t[14]=l,t[15]=ce):ce=t[15];let ue=ce,fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>v(pe),t[16]=fe):fe=t[16];let B;t[17]!==d||t[18]!==p||t[19]!==h?(B=d(h?{id:`rVgSRB`,values:{docName:p}}:{id:`tW_yvQ`,values:{docName:p}}),t[17]=d,t[18]=p,t[19]=h,t[20]=B):B=t[20];let V;t[21]===h?V=t[22]:(V=h?(0,z.jsx)(f,{className:`size-4`,"aria-hidden":`true`}):(0,z.jsx)(te,{className:`size-4`,"aria-hidden":`true`}),t[21]=h,t[22]=V);let H;t[23]!==h||t[24]!==B||t[25]!==V?(H=(0,z.jsx)(`button`,{type:`button`,onClick:fe,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":h,"aria-label":B,"data-testid":`activity-panel-file-row-carrot`,children:V}),t[23]=h,t[24]=B,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==n.docName||t[28]!==s?(U=()=>s(n.docName),t[27]=n.docName,t[28]=s,t[29]=U):U=t[29];let W;t[30]!==d||t[31]!==p?(W=d({id:`QcpeeE`,values:{docName:p}}),t[30]=d,t[31]=p,t[32]=W):W=t[32];let G;t[33]!==n.docName||t[34]!==U||t[35]!==W?(G=(0,z.jsx)(`button`,{type:`button`,onClick:U,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":W,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[33]=n.docName,t[34]=U,t[35]=W,t[36]=G):G=t[36];let K;t[37]!==d||t[38]!==p?(K=d({id:`m4v3XT`,values:{docName:p}}),t[37]=d,t[38]=p,t[39]=K):K=t[39];let he;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,z.jsx)(C,{className:`size-3.5`,"aria-hidden":`true`}),t[40]=he):he=t[40];let q;t[41]!==I||t[42]!==oe||t[43]!==K?(q=(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:oe,disabled:I,"aria-label":K,"data-testid":`activity-panel-undo-last`,children:he})}),t[41]=I,t[42]=oe,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==d||t[46]!==L?(J=L??d({id:`ArBWJf`}),t[45]=d,t[46]=L,t[47]=J):J=t[47];let Y;t[48]===J?Y=t[49]:(Y=(0,z.jsx)(_,{side:`bottom`,children:J}),t[48]=J,t[49]=Y);let X;t[50]!==q||t[51]!==Y?(X=(0,z.jsxs)(m,{children:[q,Y]}),t[50]=q,t[51]=Y,t[52]=X):X=t[52];let Z;t[53]!==d||t[54]!==p?(Z=d({id:`J2MgzQ`,values:{docName:p}}),t[53]=d,t[54]=p,t[55]=Z):Z=t[55];let ge;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,z.jsx)(ne,{className:`size-3.5`,"aria-hidden":`true`}),t[56]=ge):ge=t[56];let _e;t[57]!==I||t[58]!==se||t[59]!==Z?(_e=(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:se,disabled:I,"aria-label":Z,"data-testid":`activity-panel-undo-all`,children:ge})}),t[57]=I,t[58]=se,t[59]=Z,t[60]=_e):_e=t[60];let ve;t[61]!==d||t[62]!==L?(ve=L??d({id:`mNY1G6`}),t[61]=d,t[62]=L,t[63]=ve):ve=t[63];let ye;t[64]===ve?ye=t[65]:(ye=(0,z.jsx)(_,{side:`bottom`,children:ve}),t[64]=ve,t[65]=ye);let be;t[66]!==_e||t[67]!==ye?(be=(0,z.jsxs)(m,{children:[_e,ye]}),t[66]=_e,t[67]=ye,t[68]=be):be=t[68];let xe;t[69]===n.additionsTotal?xe=t[70]:(xe=(0,z.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[69]=n.additionsTotal,t[70]=xe);let Se;t[71]===n.deletionsTotal?Se=t[72]:(Se=(0,z.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[71]=n.deletionsTotal,t[72]=Se);let Ce;t[73]!==xe||t[74]!==Se?(Ce=(0,z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[xe,` `,Se]}),t[73]=xe,t[74]=Se,t[75]=Ce):Ce=t[75];let we;t[76]!==n.lastTs||t[77]!==T?(we=de(n.lastTs,T),t[76]=n.lastTs,t[77]=T,t[78]=we):we=t[78];let Q;t[79]===we?Q=t[80]:(Q=(0,z.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:we}),t[79]=we,t[80]=Q);let Te;t[81]===o?Te=t[82]:(Te=o?(0,z.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,z.jsx)(a,{id:`6q0rnH`})}):null,t[81]=o,t[82]=Te);let Ee;t[83]!==H||t[84]!==G||t[85]!==X||t[86]!==be||t[87]!==Ce||t[88]!==Q||t[89]!==Te?(Ee=(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[H,G,X,be,Ce,Q,Te]}),t[83]=H,t[84]=G,t[85]=X,t[86]=be,t[87]=Ce,t[88]=Q,t[89]=Te,t[90]=Ee):Ee=t[90];let De;t[91]!==h||t[92]!==u||t[93]!==n.bursts||t[94]!==n.docName?(De=h?(0,z.jsx)(`div`,{children:n.bursts.map(e=>(0,z.jsx)(le,{burst:e,docName:n.docName,fetchBurstDiff:u},`${n.docName}:${e.stackIndex}`))}):null,t[91]=h,t[92]=u,t[93]=n.bursts,t[94]=n.docName,t[95]=De):De=t[95];let Oe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,z.jsx)(k,{children:(0,z.jsx)(a,{id:`SEYWYq`})}),t[96]=Oe):Oe=t[96];let ke;t[97]!==re||t[98]!==p?(ke={docName:p,burstCount:re},t[97]=re,t[98]=p,t[99]=ke):ke=t[99];let Ae;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={0:(0,z.jsx)(`span`,{className:`font-mono text-foreground`})},t[100]=Ae):Ae=t[100];let je;t[101]===ke?je=t[102]:(je=(0,z.jsxs)(M,{children:[Oe,(0,z.jsx)(O,{children:(0,z.jsx)(a,{id:`ZBYKxv`,values:ke,components:Ae})})]}),t[101]=ke,t[102]=je);let Me;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>b(!1),t[103]=Me):Me=t[103];let Ne;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,z.jsx)(S,{type:`button`,variant:`outline`,onClick:Me,"data-testid":`activity-panel-undo-all-cancel`,children:(0,z.jsx)(a,{id:`dEgA5A`})}),t[104]=Ne):Ne=t[104];let Pe;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,z.jsx)(a,{id:`MWrUEd`}),t[105]=Pe):Pe=t[105];let Fe;t[106]===ue?Fe=t[107]:(Fe=(0,z.jsxs)(j,{children:[Ne,(0,z.jsx)(S,{type:`button`,variant:`destructive`,onClick:ue,"data-testid":`activity-panel-undo-all-confirm`,children:Pe})]}),t[106]=ue,t[107]=Fe);let Ie;t[108]!==je||t[109]!==Fe?(Ie=(0,z.jsxs)(A,{className:`sm:max-w-md`,children:[je,Fe]}),t[108]=je,t[109]=Fe,t[110]=Ie):Ie=t[110];let $;t[111]!==y||t[112]!==Ie?($=(0,z.jsx)(ee,{open:y,onOpenChange:b,children:Ie}),t[111]=y,t[112]=Ie,t[113]=$):$=t[113];let Le;return t[114]!==Ee||t[115]!==De||t[116]!==$?(Le=(0,z.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Ee,De,$]}),t[114]=Ee,t[115]=De,t[116]=$,t[117]=Le):Le=t[117],Le}function pe(e){return!e}function me(){return Date.now()}async function B(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function V(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function H(e){typeof window>`u`||(window.location.hash=V(e))}function U(){let e=(0,P.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(c,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,z.jsx)(`span`,{className:`text-sm`,children:(0,z.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function W(e){let t=(0,P.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,z.jsx)(s,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,z.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let c;t[2]===n?c=t[3]:(c=(0,z.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,z.jsx)(S,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==c||t[8]!==u?(d=(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,c,u]}),t[7]=c,t[8]=u,t[9]=d):d=t[9],d}function G(){let e=(0,P.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,z.jsx)(`p`,{className:`text-sm italic`,children:(0,z.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function K(e){let t=(0,P.c)(12),{onExit:n,showBackButton:i}=e,{_:o}=r(),s;t[0]===o?s=t[1]:(s=o({id:`kYL1lH`}),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==i?(c=i?(0,z.jsx)(he,{onClick:n}):null,t[2]=n,t[3]=i,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,z.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,z.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,z.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function he(e){let t=(0,P.c)(9),{onClick:n}=e,{_:i}=r(),o;t[0]===i?o=t[1]:(o=i({id:`ogAuyr`}),t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,z.jsx)(T,{}),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==o?(c=(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(S,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":o,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(_,{side:`bottom`,children:(0,z.jsx)(a,{id:`ogAuyr`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,z.jsxs)(m,{children:[c,l]}),t[7]=c,t[8]=u),u}function q(e){let t=(0,P.c)(9),{lastTs:n}=e,[r]=(0,F.useState)(J),i;t[0]!==n||t[1]!==r?(i=n?Y(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,z.jsx)(`span`,{className:`font-medium`,children:(0,z.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,z.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,z.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,z.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function J(){return Date.now()}function Y(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return v._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return v._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return v._({id:`nYeBmY`,values:{hours:n}})}function X(e){let t=(0,P.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,z.jsx)(E,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,z.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Z(e){let t=(0,P.c)(26),{data:n,status:i,error:o,reload:s,fetchBurstDiff:c,onExit:l,onNavigate:u,onUndoLast:d,onUndoAll:f,showBackButton:p}=e,{_:m}=r(),h=n?.files?.[0]?.lastTs??null,g=n?.files?.length??0,_;t[0]===m?_=t[1]:(_=m({id:`kYL1lH`}),t[0]=m,t[1]=_);let v;t[2]!==l||t[3]!==p?(v=p?(0,z.jsx)(he,{onClick:l}):null,t[2]=l,t[3]=p,t[4]=v):v=t[4];let y;t[5]!==n||t[6]!==g||t[7]!==h?(y=n?.agent?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(X,{agent:n.agent}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,z.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,z.jsx)(a,{id:`F6pfE9`}):h===null?(0,z.jsx)(a,{id:`PMyJ9C`}):(0,z.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,z.jsxs)(z.Fragment,{children:[` · `,(0,z.jsx)(a,{id:`u3BOHd`,values:{fileCount:g}})]}):null]})]})]}):(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,z.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=g,t[7]=h,t[8]=y):y=t[8];let b;t[9]!==v||t[10]!==y?(b=(0,z.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[v,y]}),t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==n||t[13]!==o||t[14]!==c||t[15]!==h||t[16]!==u||t[17]!==f||t[18]!==d||t[19]!==s||t[20]!==i?(x=(0,z.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:i===`loading`&&n===null?(0,z.jsx)(U,{}):i===`error`&&o?(0,z.jsx)(W,{error:o,onRetry:s}):n===null?(0,z.jsx)(G,{}):(0,z.jsxs)(z.Fragment,{children:[!n.sessionAlive&&h!==null?(0,z.jsx)(q,{lastTs:h}):null,n.files.length===0?(0,z.jsx)(G,{}):n.files.map(e=>(0,z.jsx)(fe,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:u,onUndoLast:d,onUndoAll:f,fetchBurstDiff:c},e.docName))]})}),t[12]=n,t[13]=o,t[14]=c,t[15]=h,t[16]=u,t[17]=f,t[18]=d,t[19]=s,t[20]=i,t[21]=x):x=t[21];let S;return t[22]!==_||t[23]!==b||t[24]!==x?(S=(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":_,children:[b,x]}),t[22]=_,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function ge(e){let t=(0,P.c)(28),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:i}=n,a=i===void 0?!0:i,{_:o}=r(),{docPanelAgentId:s,closeActivityPanel:c}=l(),{openDocumentTransition:u}=d(),{data:f,status:p,error:m,reload:h,fetchBurstDiff:g}=ae(s);if(s===null){let e;return t[2]!==c||t[3]!==a?(e=(0,z.jsx)(K,{onExit:c,showBackButton:a}),t[2]=c,t[3]=a,t[4]=e):e=t[4],e}let _;t[5]===u?_=t[6]:(_=e=>{u(e),H(e)},t[5]=u,t[6]=_);let v=_,y;t[7]!==o||t[8]!==f||t[9]!==s||t[10]!==h?(y=async e=>{try{await B({connectionId:s,docName:e,scope:`last`,agentName:f?.agent?.displayName}),h()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`EqrC_R`,values:{message:n}})),h()}},t[7]=o,t[8]=f,t[9]=s,t[10]=h,t[11]=y):y=t[11];let b=y,x;t[12]!==o||t[13]!==f||t[14]!==s||t[15]!==h?(x=async e=>{try{await B({connectionId:s,docName:e,scope:`file`,agentName:f?.agent?.displayName}),N.success(o({id:`pRc-Im`,values:{docName:e}})),h()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);N.error(o({id:`7KeV5F`,values:{message:n}})),h()}},t[12]=o,t[13]=f,t[14]=s,t[15]=h,t[16]=x):x=t[16];let S=x,C;return t[17]!==c||t[18]!==f||t[19]!==m||t[20]!==g||t[21]!==v||t[22]!==S||t[23]!==b||t[24]!==h||t[25]!==a||t[26]!==p?(C=(0,z.jsx)(Z,{data:f,status:p,error:m,reload:h,fetchBurstDiff:g,onExit:c,onNavigate:v,onUndoLast:b,onUndoAll:S,showBackButton:a}),t[17]=c,t[18]=f,t[19]=m,t[20]=g,t[21]=v,t[22]=S,t[23]=b,t[24]=h,t[25]=a,t[26]=p,t[27]=C):C=t[27],C}export{ge as ActivityModeContent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{t as o}from"./button-DenIdY-r.js";import{a as s,c,i as l,n as u,o as d,s as f,t as p,x as m}from"./dialog-CoRJrIIb.js";import{a as h,i as g,n as _,r as v,t as ee}from"./collapsible-BhpeB6tu.js";import{t as y}from"./checkbox-BGXb5iL3.js";import{n as te,r as b,t as ne}from"./project-paths-
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{t as o}from"./button-DenIdY-r.js";import{a as s,c,i as l,n as u,o as d,s as f,t as p,x as m}from"./dialog-CoRJrIIb.js";import{a as h,i as g,n as _,r as v,t as ee}from"./collapsible-BhpeB6tu.js";import{t as y}from"./checkbox-BGXb5iL3.js";import{n as te,r as b,t as ne}from"./project-paths-eyh51nmQ.js";import{t as re}from"./textarea-C_bHQrXh.js";var ie=a(),x=e(t(),1),S=r(),ae=750,oe={root:{id:`ZWolSV`},home:{id:`GgQgML`},"home-documents":{id:`HRU-eL`},"home-desktop":{id:`mYLRjR`},"home-downloads":{id:`wlwXUk`},"volumes-mount":{id:`AMyJts`},"drive-root":{id:`M3ytY_`}},se={error:e=>m.error(e)};function C(e){let t=(0,ie.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:i,payload:a}=n,o=r===void 0?b:r,s=i===void 0?se:i,c;t[2]!==a||t[3]!==o?(c=a??o.getSnapshot(),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l=c;if(!l)return null;let u;return t[5]!==l||t[6]!==o||t[7]!==s?(u=(0,S.jsx)(w,{payload:l,store:o,toast:s}),t[5]=l,t[6]=o,t[7]=s,t[8]=u):u=t[8],u}function w(e){let t=(0,ie.c)(109),{payload:r,store:a,toast:m}=e,{_:h}=n(),_=(0,x.useId)(),[v,ee]=(0,x.useState)(r.defaultContentDir),[b,se]=(0,x.useState)(``),C;t[0]===r.editorOptions?C=t[1]:(C=()=>new Set(r.editorOptions.map(ce)),t[0]=r.editorOptions,t[1]=C);let[w,ue]=(0,x.useState)(C),[de,fe]=(0,x.useState)(null),[T,pe]=(0,x.useState)(!1),[me,he]=(0,x.useState)(null),ge,_e;t[2]!==h||t[3]!==v?(ge=()=>{if(!ne(v)){fe(null);return}let e=!1,t=setTimeout(()=>{let t=window.okDesktop;t&&t.onboarding.probeContent({contentDir:v}).then(t=>{e||fe(t)}).catch(t=>{e||fe({ok:!1,error:t instanceof Error?t.message:h({id:`snrVQ7`})})})},ae);return()=>{e=!0,clearTimeout(t)}},_e=[v,h],t[2]=h,t[3]=v,t[4]=ge,t[5]=_e):(ge=t[4],_e=t[5]),(0,x.useEffect)(ge,_e);let ve;t[6]===v?ve=t[7]:(ve=ne(v),t[6]=v,t[7]=ve);let E=ve,D=T||!E,ye=r.projectDir,be;t[8]!==r.pickedPath||t[9]!==r.projectDir?(be=te(r.projectDir,r.pickedPath)??r.pickedPath,t[8]=r.pickedPath,t[9]=r.projectDir,t[10]=be):be=t[10];let xe=be,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){ue(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[11]=O):O=t[11];let Se=O,k;t[12]!==h||t[13]!==r.projectDir?(k=async function(){let e=window.okDesktop;if(!e)return;let t;try{t=await e.dialog.openFolder({defaultPath:r.projectDir})}catch(e){let t=e;he(t instanceof Error?t.message:h({id:`P-ye9o`}));return}if(t===null)return;let n=te(r.projectDir,t);if(n===null){he(h({id:`UTZ97u`}));return}he(null),ee(n)},t[12]=h,t[13]=r.projectDir,t[14]=k):k=t[14];let Ce=k,A;t[15]!==b||t[16]!==v||t[17]!==w||t[18]!==a||t[19]!==m?(A=async function(){pe(!0);let e=await a.confirm({initGit:!0,contentDir:v,additionalIgnores:b,editorIds:Array.from(w)});e.ok||(m.error(e.error),pe(!1))},t[15]=b,t[16]=v,t[17]=w,t[18]=a,t[19]=m,t[20]=A):A=t[20];let we=A,j;t[21]!==we||t[22]!==D?(j=function(e){e.preventDefault(),!D&&we()},t[21]=we,t[22]=D,t[23]=j):j=t[23];let Te=j,M;t[24]!==a||t[25]!==m?(M=async function(){pe(!0);let e=await a.cancel();e.ok||(m.error(e.error),pe(!1))},t[24]=a,t[25]=m,t[26]=M):M=t[26];let N=M,Ee;t[27]!==T||t[28]!==N?(Ee=function(e){!e&&!T&&N()},t[27]=T,t[28]=N,t[29]=Ee):Ee=t[29];let De=Ee,Oe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,S.jsx)(c,{children:(0,S.jsx)(i,{id:`pAlxX6`})}),t[30]=Oe):Oe=t[30];let ke;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,S.jsxs)(f,{children:[Oe,(0,S.jsx)(s,{children:(0,S.jsx)(i,{id:`fX82Jn`,components:{0:(0,S.jsx)(`code`,{})}})})]}),t[31]=ke):ke=t[31];let P;t[32]!==r.gitRootPromoted||t[33]!==xe||t[34]!==ye?(P=r.gitRootPromoted?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,S.jsx)(i,{id:`zXZ0sB`,values:{projectDir:ye,pickedRelative:xe},components:{0:(0,S.jsx)(`code`,{}),1:(0,S.jsx)(`code`,{}),2:(0,S.jsx)(`code`,{}),3:(0,S.jsx)(`code`,{}),4:(0,S.jsx)(`code`,{})}})}):null,t[32]=r.gitRootPromoted,t[33]=xe,t[34]=ye,t[35]=P):P=t[35];let F;t[36]!==h||t[37]!==r.warnings?(F=r.warnings.length>0?(0,S.jsx)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:r.warnings.map(e=>(0,S.jsx)(`p`,{className:`mb-1 last:mb-0`,children:h(oe[e.kind])},e.kind))}):null,t[36]=h,t[37]=r.warnings,t[38]=F):F=t[38];let Ae;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,S.jsx)(`label`,{htmlFor:`consent-content-dir`,className:`text-sm font-medium`,children:(0,S.jsx)(i,{id:`ll2yNl`})}),t[39]=Ae):Ae=t[39];let je;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>{ee(e.target.value),he(null)},t[40]=je):je=t[40];let Me=!E,I;t[41]!==T||t[42]!==v||t[43]!==Me?(I=(0,S.jsx)(g,{id:`consent-content-dir`,value:v,onChange:je,disabled:T,"aria-invalid":Me,"data-testid":`consent-content-dir`,className:`flex-1`}),t[41]=T,t[42]=v,t[43]=Me,t[44]=I):I=t[44];let L;t[45]===Ce?L=t[46]:(L=()=>void Ce(),t[45]=Ce,t[46]=L);let Ne;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,S.jsx)(i,{id:`O2UpM1`}),t[47]=Ne):Ne=t[47];let R;t[48]!==T||t[49]!==L?(R=(0,S.jsx)(o,{type:`button`,variant:`outline`,disabled:T,onClick:L,"data-testid":`consent-content-dir-browse`,children:Ne}),t[48]=T,t[49]=L,t[50]=R):R=t[50];let z;t[51]!==I||t[52]!==R?(z=(0,S.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[I,R]}),t[51]=I,t[52]=R,t[53]=z):z=t[53];let B;t[54]!==me||t[55]!==E||t[56]!==de?(B=me===null?E?(0,S.jsx)(le,{probe:de}):(0,S.jsx)(`p`,{className:`text-1sm text-destructive`,"data-testid":`consent-content-dir-error`,children:(0,S.jsx)(i,{id:`U5Spo9`})}):(0,S.jsx)(`p`,{className:`text-1sm text-destructive`,"data-testid":`consent-content-dir-browse-error`,children:me}),t[54]=me,t[55]=E,t[56]=de,t[57]=B):B=t[57];let V;t[58]!==z||t[59]!==B?(V=(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ae,z,B]}),t[58]=z,t[59]=B,t[60]=V):V=t[60];let Pe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,S.jsx)(`label`,{htmlFor:`consent-additional-ignores`,className:`text-sm font-medium`,children:(0,S.jsx)(i,{id:`3zyg_A`})}),t[61]=Pe):Pe=t[61];let Fe;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>se(e.target.value),t[62]=Fe):Fe=t[62];let H;t[63]!==b||t[64]!==T?(H=(0,S.jsx)(re,{id:`consent-additional-ignores`,value:b,onChange:Fe,disabled:T,placeholder:`tmp/
|
|
2
2
|
*.draft.md`,rows:3,"data-testid":`consent-additional-ignores`}),t[63]=b,t[64]=T,t[65]=H):H=t[65];let Ie;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,S.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,S.jsx)(i,{id:`aE2_XM`,components:{0:(0,S.jsx)(`code`,{})}})}),t[66]=Ie):Ie=t[66];let U;t[67]===H?U=t[68]:(U=(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Pe,H,Ie]}),t[67]=H,t[68]=U);let W;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,S.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,S.jsx)(i,{id:`0YEbfk`})}),t[69]=W):W=t[69];let Le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,S.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,S.jsx)(i,{id:`eSu2Xn`,components:{0:(0,S.jsx)(`code`,{})}})}),t[70]=Le):Le=t[70];let G;if(t[71]!==T||t[72]!==w||t[73]!==r.editorOptions){let e;t[75]!==T||t[76]!==w?(e=e=>{let t=`consent-editor-${e.id}-cb`;return(0,S.jsxs)(`label`,{htmlFor:t,className:`flex items-center gap-2 text-sm`,children:[(0,S.jsx)(y,{id:t,checked:w.has(e.id),onCheckedChange:()=>Se(e.id),disabled:T,"data-testid":`consent-editor-${e.id}`}),(0,S.jsx)(`span`,{children:e.label}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`consent-editor-${e.id}-scope`,children:e.hasProjectConfig?(0,S.jsx)(i,{id:`cKjLuT`}):(0,S.jsx)(i,{id:`nYKerc`})})]},e.id)},t[75]=T,t[76]=w,t[77]=e):e=t[77],G=r.editorOptions.map(e),t[71]=T,t[72]=w,t[73]=r.editorOptions,t[74]=G}else G=t[74];let K;t[78]===G?K=t[79]:(K=(0,S.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[W,Le,G]}),t[78]=G,t[79]=K);let q;t[80]!==_||t[81]!==Te||t[82]!==V||t[83]!==U||t[84]!==K?(q=(0,S.jsxs)(`form`,{id:_,onSubmit:Te,"data-testid":`consent-form`,className:`space-y-4`,children:[V,U,K]}),t[80]=_,t[81]=Te,t[82]=V,t[83]=U,t[84]=K,t[85]=q):q=t[85];let J;t[86]!==P||t[87]!==F||t[88]!==q?(J=(0,S.jsxs)(u,{className:`space-y-4`,children:[P,F,q]}),t[86]=P,t[87]=F,t[88]=q,t[89]=J):J=t[89];let Y;t[90]===N?Y=t[91]:(Y=()=>void N(),t[90]=N,t[91]=Y);let Re;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,S.jsx)(i,{id:`dEgA5A`}),t[92]=Re):Re=t[92];let X;t[93]!==T||t[94]!==Y?(X=(0,S.jsx)(o,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Y,disabled:T,"data-testid":`consent-cancel`,children:Re}),t[93]=T,t[94]=Y,t[95]=X):X=t[95];let ze;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,S.jsx)(i,{id:`tXkhj_`}),t[96]=ze):ze=t[96];let Z;t[97]!==_||t[98]!==D?(Z=(0,S.jsx)(o,{type:`submit`,form:_,disabled:D,"data-testid":`consent-start`,children:ze}),t[97]=_,t[98]=D,t[99]=Z):Z=t[99];let Q;t[100]!==X||t[101]!==Z?(Q=(0,S.jsxs)(d,{children:[X,Z]}),t[100]=X,t[101]=Z,t[102]=Q):Q=t[102];let $;t[103]!==J||t[104]!==Q?($=(0,S.jsxs)(l,{className:`sm:max-w-lg`,children:[ke,J,Q]}),t[103]=J,t[104]=Q,t[105]=$):$=t[105];let Be;return t[106]!==De||t[107]!==$?(Be=(0,S.jsx)(p,{open:!0,onOpenChange:De,children:$}),t[106]=De,t[107]=$,t[108]=Be):Be=t[108],Be}function ce(e){return e.id}function le(e){let t=(0,ie.c)(24),{probe:r}=e,{_:a}=n();if(r===null){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,S.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:(0,S.jsx)(i,{id:`DiFKSL`})}),t[0]=e):e=t[0],e}if(!r.ok){let e=r.error,n;return t[1]===e?n=t[2]:(n=(0,S.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:(0,S.jsx)(i,{id:`9fvog2`,values:{errorDetail:e}})}),t[1]=e,t[2]=n),n}let o=r.truncated?`≥ 50,000`:String(r.count),s;t[3]!==a||t[4]!==o?(s=a({id:`MV-Dkb`,values:{countDisplay:o}}),t[3]=a,t[4]=o,t[5]=s):s=t[5];let c=s;if(r.sample.length===0){let e;return t[6]===c?e=t[7]:(e=(0,S.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:c}),t[6]=c,t[7]=e),e}let l=r.truncated?null:r.count-r.sample.length,u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,S.jsx)(h,{className:`size-3 transition-transform motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=u):u=t[8];let d;t[9]===c?d=t[10]:(d=(0,S.jsxs)(v,{className:`flex items-center gap-1 text-1sm text-muted-foreground hover:text-foreground [&[data-state=open]>svg]:rotate-90`,children:[u,(0,S.jsx)(`span`,{children:c})]}),t[9]=c,t[10]=d);let f;t[11]===r.sample?f=t[12]:(f=r.sample.map(ue),t[11]=r.sample,t[12]=f);let p;t[13]===f?p=t[14]:(p=(0,S.jsx)(`ul`,{className:`space-y-1.5 font-mono`,children:f}),t[13]=f,t[14]=p);let m;t[15]!==r.truncated||t[16]!==l?(m=r.truncated||l!==null&&l>0?(0,S.jsx)(`p`,{className:`mt-1 italic`,children:r.truncated?(0,S.jsx)(i,{id:`5wV2qQ`}):(0,S.jsx)(i,{id:`nNYV3Y`,values:{remaining:l}})}):null,t[15]=r.truncated,t[16]=l,t[17]=m):m=t[17];let g;t[18]!==p||t[19]!==m?(g=(0,S.jsxs)(_,{className:`pt-1 pl-4 text-1sm text-muted-foreground`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=g):g=t[20];let y;return t[21]!==d||t[22]!==g?(y=(0,S.jsxs)(ee,{"data-testid":`consent-preview`,children:[d,g]}),t[21]=d,t[22]=g,t[23]=y):y=t[23],y}function ue(e){return(0,S.jsx)(`li`,{children:e},e)}export{C as default};
|