@inkeep/open-knowledge 0.69.0-beta.5 → 0.69.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +6 -6
- package/dist/constants-DAaEKppY.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/init-DwykpnKC.mjs +1 -0
- package/dist/{init-Dir125F-.mjs → init-YoVVaWK0.mjs} +2 -2
- package/dist/{launch-json-removal-Cag08tw4.mjs → launch-json-removal-BaySWdca.mjs} +1 -1
- package/dist/loader-Crone-E4.mjs +1 -0
- package/dist/{loader-Bi3IQ4W8.mjs → loader-CsbLLAav.mjs} +1 -1
- package/dist/native/native-config.darwin-arm64.node +0 -0
- package/dist/native/native-config.darwin-x64.node +0 -0
- package/dist/native/native-config.linux-arm64-gnu.node +0 -0
- package/dist/native/native-config.linux-arm64-musl.node +0 -0
- package/dist/native/native-config.linux-x64-musl.node +0 -0
- package/dist/native/native-config.win32-arm64-msvc.node +0 -0
- package/dist/native/native-config.win32-x64-msvc.node +0 -0
- package/dist/{preview-CdAH75He.mjs → preview-C6QTJ0V1.mjs} +1 -1
- package/dist/preview-CeWz5LS0.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Dzlz-p9w.js → ActivityModeContent-BWxFxGGm.js} +1 -1
- package/dist/public/assets/AddPropertiesButton-BadjM61v.js +2 -0
- package/dist/public/assets/{AgentDiffPane-Badnd0z5.js → AgentDiffPane-BN45FrUF.js} +1 -1
- package/dist/public/assets/{AppMenubar-JLeMOJpz.js → AppMenubar-Ba248X6T.js} +1 -1
- package/dist/public/assets/{BugReportHistory-YsKDA8Wg.js → BugReportHistory-CW96wvko.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-Cm-lMz2-.js → BugReportHistoryDialog-fg844kz-.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-CvenaDDl.js → CodeMirrorPropInput-ZmCpFv-f.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-Lw_SJixc.js → ConsentDialogBody-DLKYsBGr.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-DuQPEMcv.js → DiffViewBoundary-BsDs3Cr8.js} +1 -1
- package/dist/public/assets/{DocumentContext-BWfYIGn-.js → DocumentContext-p9iubtSb.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-B8xOZgYr.js → EditorModeToggle-Bf9f_Cka.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-7Bq4UalT.js → EnableSyncConfirmDialog-BE-l5JaR.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-qHB2EWCE.js → ExcalidrawDocEditor-BUalQW1N.js} +1 -1
- package/dist/public/assets/FeedbackForm-C7zXglFh.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-DNsoaSWE.js → ImportSkillDialog-BUsdhD5G.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-Eajj_ona.js → LintConfigEditor-Chet4uSf.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-xmkjmIcU.js → ManagedArtifactProperties--dbkaZZS.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BtFB2kBJ.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-DbApv8jA.js → MermaidDocEditor-CVwp7Wkq.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BZXUua7I.js → PropertyDisplayRow-BnSF_nD0.js} +2 -2
- package/dist/public/assets/{ReportBugDialogBody-C275Hr72.js → ReportBugDialogBody-Dzr6g2wD.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-Ilx23iFu.js → ReportBugMenuTrigger-UUESg7vh.js} +2 -2
- package/dist/public/assets/{SchemaConfigEditor-DQcwju-H.js → SchemaConfigEditor-BlEpNNfc.js} +1 -1
- package/dist/public/assets/{SessionsHost-CqTpS39k.js → SessionsHost-BZQLiJFM.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-CRTA_WKg.js → SettingsDialogBody-BIC3dqR8.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-BNUxcUmo.js → ShareReceiveMissDialog-F6AN6RMT.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-DxF5MrWn.js → SkillEditBanner-BPuqCq4o.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-BSeeI8R-.js → SkillInstallMenu-DcpgYBfx.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-B00Qx11t.js → SkillOriginInline-BvwZtzy0.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-CJLv0nyi.js → SkillToolbarControls-ygJqOWDY.js} +1 -1
- package/dist/public/assets/{SourceEditor-ByNnsvQe.js → SourceEditor-DifRL8Lk.js} +1 -1
- package/dist/public/assets/{TerminalPanel-CzywxJp9.js → TerminalPanel-ADMpIanl.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-GeA2j10-.js → TerminalWindowApp-B_aTZooW.js} +1 -1
- package/dist/public/assets/{TextDocEditor-B7AzPtXW.js → TextDocEditor-BuRV3Akr.js} +1 -1
- package/dist/public/assets/ThreadView-CYJcuPjR.js +15 -0
- package/dist/public/assets/{TimelineDiffPane-BKQeyrX6.js → TimelineDiffPane-29zdxEjP.js} +1 -1
- package/dist/public/assets/{agent-diff-store-C92NIPau.js → agent-diff-store-Rb8akV6K.js} +1 -1
- package/dist/public/assets/{auth-state-cache-CXXOQdcM.js → auth-state-cache-Cop0NQF5.js} +1 -1
- package/dist/public/assets/{calendar-Cbe0GikB.js → calendar-OZUWiDsT.js} +1 -1
- package/dist/public/assets/{comment-chips-CdrJy7oX.js → comment-chips-BWKl9VbL.js} +1 -1
- package/dist/public/assets/{config-provider-DlzcUiYU.js → config-provider-Bobp4tNz.js} +3 -3
- package/dist/public/assets/{dist-yFrmqHNO2.js → dist-D_m2fuwc2.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-B2S3p7Kh.js → doc-undo-manager-BkpuyXL8.js} +1 -1
- package/dist/public/assets/globals-DVivVCS3.css +1 -0
- package/dist/public/assets/i18n-SN-8kqTh.js +1 -0
- package/dist/public/assets/index-BpD4iquV.js +2205 -0
- package/dist/public/assets/{input-group-BChLCb-V.js → input-group-cb7RyEsm.js} +1 -1
- package/dist/public/assets/launch-agent-thread-Big-LvLD.js +1 -0
- package/dist/public/assets/{markdownlint-rule-browser-CMXE3hvX.js → markdownlint-rule-browser-B_7f1Awf.js} +1 -1
- package/dist/public/assets/messages--WqeRw6M.js +1 -0
- package/dist/public/assets/messages--zDRXDo0.js +1 -0
- package/dist/public/assets/messages-BVlrnlqc.js +1 -0
- package/dist/public/assets/messages-BnR3EYKP.js +1 -0
- package/dist/public/assets/messages-CYl2uOxc.js +1 -0
- package/dist/public/assets/messages-Cr6C9Hnr.js +1 -0
- package/dist/public/assets/messages-CtXBW2rM.js +1 -0
- package/dist/public/assets/messages-Ct_698ZS.js +1 -0
- package/dist/public/assets/messages-D5gWjKGT.js +1 -0
- package/dist/public/assets/messages-DU7DEoSn.js +1 -0
- package/dist/public/assets/messages-PX4xpaZF.js +1 -0
- package/dist/public/assets/messages-qzoc5iXP.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-CJEI5S0U.js → pending-receive-nav-store-DjuEU1dx.js} +1 -1
- package/dist/public/assets/progress-BNLzMM8p.js +9 -0
- package/dist/public/assets/{selection-context-DJ_FIiJx.js → selection-context-CCdILpgG.js} +1 -1
- package/dist/public/assets/{src-BuzwpJZ-.js → src-DYP6p7XJ.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-4mFI7_nd.js → terminal-launch-events-9VXuYbO-.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-CyxGjpoW.js → typing-burst-detector-jlncpstJ.js} +1 -1
- package/dist/public/assets/{uninstall-BY4ebvpt.js → uninstall-DJEPJuYD.js} +1 -1
- package/dist/public/assets/{use-activity-panel-114XoWfq.js → use-activity-panel-BfeDPTx4.js} +1 -1
- package/dist/public/assets/{use-open-skill-DhmFoS02.js → use-open-skill-Df4qaz_1.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CqCHYTWh.js → use-terminal-enabled-BaXGNHQv.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-BY6jlhQ-.js → use-timeline-entry-diff-Bvz88F3c.js} +1 -1
- package/dist/public/index.html +40 -40
- package/dist/public/uninstall.html +6 -6
- package/dist/{registry-probes-DjyB1UXR.mjs → registry-probes-B_EoML_h.mjs} +1 -1
- package/dist/{repair-launch-json-C4xKPQnT.mjs → repair-launch-json-DcTw2dub.mjs} +1 -1
- package/dist/{repair-mcp-configs-D0p5PIEd.mjs → repair-mcp-configs-ngiQYYLV.mjs} +1 -1
- package/dist/src-BrwhU5af.mjs +1 -0
- package/dist/{src-DloZjtzc.mjs → src-Dfw-4H6Q.mjs} +1 -1
- package/dist/{start-BuUQgI9a.mjs → start-C201LWw_.mjs} +2 -2
- package/dist/start-CZAA0gtK.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-CDJe2LeZ.mjs +0 -1
- package/dist/init-KxZzkxxa.mjs +0 -1
- package/dist/loader-DDHdV7iu.mjs +0 -1
- package/dist/preview-DA2iUYSX.mjs +0 -1
- package/dist/public/assets/AddPropertiesButton-BzvWvVbw.js +0 -2
- package/dist/public/assets/FeedbackForm-BRzK37KA.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-yRhiyBSE.js +0 -1
- package/dist/public/assets/ThreadView-DUeOwoIP.js +0 -15
- package/dist/public/assets/globals-B99HAAhi.css +0 -1
- package/dist/public/assets/i18n-CRmWQMdd.js +0 -1
- package/dist/public/assets/index-vsKy3-tS.js +0 -2205
- package/dist/public/assets/launch-agent-thread-BKH-E3vQ.js +0 -1
- package/dist/public/assets/messages-B38DJ0BE.js +0 -1
- package/dist/public/assets/messages-Bgvh8HRb.js +0 -1
- package/dist/public/assets/messages-CH1lsr37.js +0 -1
- package/dist/public/assets/messages-CNGJq0Dc.js +0 -1
- package/dist/public/assets/messages-CR93thHz.js +0 -1
- package/dist/public/assets/messages-DEhJAmUT.js +0 -1
- package/dist/public/assets/messages-DVuZbxPa.js +0 -1
- package/dist/public/assets/messages-DY1HEckj.js +0 -1
- package/dist/public/assets/messages-DjKZXzIl.js +0 -1
- package/dist/public/assets/messages-DlTvWI3w.js +0 -1
- package/dist/public/assets/messages-DtvnLxcb.js +0 -1
- package/dist/public/assets/messages-cfb_wks8.js +0 -1
- package/dist/public/assets/progress-C3Z1B6MH.js +0 -9
- package/dist/src-C9ZPKdwo.mjs +0 -1
- package/dist/start-DI5DJ5KK.mjs +0 -1
- /package/dist/public/assets/{SkillCostValue-09FxLC0z.js → SkillCostValue-ZQq6hE5u.js} +0 -0
- /package/dist/public/assets/{SkillModeBanner-Ddqm42dL.js → SkillModeBanner-Dddk2HFX.js} +0 -0
- /package/dist/public/assets/{dist-BauSyrbN2.js → dist-zWrmTYco2.js} +0 -0
- /package/dist/public/assets/{file-tree-adapter-Co9sJppq.js → file-tree-adapter-VUzkO2kv.js} +0 -0
- /package/dist/public/assets/{format-CAWQmn3-.js → format-BSkuL3XD.js} +0 -0
- /package/dist/public/assets/{globals-DENhm9Ae.js → globals-2sss1K50.js} +0 -0
- /package/dist/public/assets/{lint-config-client-B61iX5QY.js → lint-config-client-D2qMETc6.js} +0 -0
- /package/dist/public/assets/{platform-labels-B5GR8Z3W.js → platform-labels-B3xX8Yyl.js} +0 -0
- /package/dist/public/assets/{skeleton-CuYI7n5h.js → skeleton-DIDidh7_.js} +0 -0
- /package/dist/public/assets/{sortable.esm-CicQhqQB.js → sortable.esm-HCgNojue.js} +0 -0
- /package/dist/public/assets/{text-viewer-languages-C-SOVufZ.js → text-viewer-languages-CSz-0bs7.js} +0 -0
- /package/dist/public/assets/{textarea-CcZScuQl.js → textarea-Cqj1jsXK.js} +0 -0
- /package/dist/public/assets/{timeline-diff-store-CtUeIujA.js → timeline-diff-store-hP7gGEyc.js} +0 -0
- /package/dist/public/assets/{use-conflicts-2jTGKNOt.js → use-conflicts-CMLH1ChX.js} +0 -0
- /package/dist/public/assets/{use-skill-origin-FAiHzQpH.js → use-skill-origin-CBguK4Xh.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{cr as r,g as i,i as a}from"./DocumentContext-BWfYIGn-.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./react-dom-DPxgxlDT.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{Ds as d,Ga as f,Ka as p,Na as m,Us as h,Xa as g,Y as _,Za as v,ao as y,ba as b,oo as x,ro as ee,so as te,to as ne,ur as re}from"./dist-CGNkoXKB.js";import{i as ie}from"./local-menu-action-bus-4I1Xm40D.js";import{i as ae,l as oe,m as S,n as se,t as ce}from"./PropertyDisplayRow-BZXUua7I.js";import{K as le,L as ue,W as de}from"./CodeMirrorPropInput-CvenaDDl.js";import{t as fe}from"./minus-cd1ERTPg.js";import{t as pe}from"./libesm-xGH0ua32.js";var C=u(),w=n(),T=200;function me(e){let t=(0,C.c)(27),{delta:n,open:r,onOpenChange:i}=e;if(n.unparseable!==null){let e;return t[0]===n.unparseable?e=t[1]:(e=(0,w.jsx)(ye,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,c,l,u,d,f,p,m;if(t[2]!==n.changes||t[3]!==i||t[4]!==r){let e=n.changes.slice(0,50);o=n.changes.length-e.length,a=se,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,w.jsx)(s,{id:`l_UFPv`}),t[14]=c):c=t[14],l=n.changes.length,u=`property-diff-block`,d=`border-b border-border py-3`,f=r,p=i,m=e.map(he),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else a=t[5],o=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h;t[15]===o?h=t[16]:(h=o>0&&(0,w.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,w.jsx)(s,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=h);let g;return t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,w.jsxs)(a,{title:c,count:l,testId:u,className:d,open:f,onOpenChange:p,children:[m,h]}),t[17]=a,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function he(e){return(0,w.jsx)(ge,{change:e},`${e.kind}-${e.key}`)}function ge(e){let t=(0,C.c)(22),{change:n}=e,{_:i}=c(),a=oe[d(n.kind===`removed`?n.before:n.after)],o;t[0]!==i||t[1]!==n.kind?(o=n.kind===`added`?{KindIcon:ie,kindLabel:i({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:fe,kindLabel:i({id:`eps54V`})}:{KindIcon:r,kindLabel:i({id:`cNsIJf`})},t[0]=i,t[1]=n.kind,t[2]=o):o=t[2];let{KindIcon:s,kindLabel:l}=o,u;t[3]===s?u=t[4]:(u=(0,w.jsx)(s,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=s,t[4]=u);let f;t[5]===l?f=t[6]:(f=(0,w.jsx)(`span`,{className:`sr-only`,children:l}),t[5]=l,t[6]=f);let p;t[7]!==u||t[8]!==f?(p=(0,w.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[u,f]}),t[7]=u,t[8]=f,t[9]=p):p=t[9];let m;t[10]===a?m=t[11]:(m=(0,w.jsx)(a,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=a,t[11]=m);let h;t[12]===n?h=t[13]:(h=(0,w.jsx)(_e,{change:n}),t[12]=n,t[13]=h);let g;t[14]!==n.key||t[15]!==m||t[16]!==h?(g=(0,w.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,w.jsx)(ce,{icon:m,label:n.key,dataKey:n.key,children:h})}),t[14]=n.key,t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==n.key||t[19]!==p||t[20]!==g?(_=(0,w.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[p,g]}),t[18]=n.key,t[19]=p,t[20]=g,t[21]=_):_=t[21],_}function _e(e){let t=(0,C.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,w.jsx)(E,{value:n.after,keyName:n.key}),t[0]=n.after,t[1]=n.key,t[2]=e):e=t[2],e}if(n.kind===`removed`){let e;return t[3]!==n.before||t[4]!==n.key?(e=(0,w.jsx)(E,{value:n.before,keyName:n.key,removed:!0}),t[3]=n.before,t[4]=n.key,t[5]=e):e=t[5],e}let r=S(n.before)||S(n.after)?`flex flex-col gap-1`:`flex flex-wrap items-center gap-1.5`,i;t[6]!==n.before||t[7]!==n.key?(i=(0,w.jsx)(E,{value:n.before,keyName:n.key,removed:!0}),t[6]=n.before,t[7]=n.key,t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`→`}),t[9]=a):a=t[9];let o;t[10]!==n.after||t[11]!==n.key?(o=(0,w.jsx)(E,{value:n.after,keyName:n.key}),t[10]=n.after,t[11]=n.key,t[12]=o):o=t[12];let s;return t[13]!==r||t[14]!==i||t[15]!==o?(s=(0,w.jsxs)(`div`,{className:r,"data-testid":`property-diff-change-pair`,children:[i,a,o]}),t[13]=r,t[14]=i,t[15]=o,t[16]=s):s=t[16],s}function E(e){let t=(0,C.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(S(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,w.jsx)(ae,{keyName:r,value:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o;return t[3]!==e||t[4]!==i?(o=(0,w.jsx)(`div`,{className:e,children:i}),t[3]=e,t[4]=i,t[5]=o):o=t[5],o}let o,s,c,l;if(t[6]!==a||t[7]!==n){let e=Array.isArray(n)?n.filter(ve).join(`, `):String(n),r=e.length>T;o=a?`px-1 text-sm break-words text-muted-foreground line-through`:`px-1 text-sm break-words`,s=r?e:void 0,c=`property-diff-value`,l=r?`${e.slice(0,T)}…`:e,t[6]=a,t[7]=n,t[8]=o,t[9]=s,t[10]=c,t[11]=l}else o=t[8],s=t[9],c=t[10],l=t[11];let u;return t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,w.jsx)(`span`,{className:o,title:s,"data-testid":c,children:l}),t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function ve(e){return typeof e==`string`}function ye(e){let t=(0,C.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,w.jsx)(s,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,w.jsx)(s,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,w.jsx)(D,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(s,{id:`NawEr2`}),t[4]=o):o=t[4];let c;t[5]===n.after?c=t[6]:(c=(0,w.jsx)(D,{label:o,text:n.after}),t[5]=n.after,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,w.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,w.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,c]})]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function D(e){let t=(0,C.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,w.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a=r===``?`—`:r,o;t[2]===a?o=t[3]:(o=(0,w.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-2 py-1.5 font-mono text-xs whitespace-pre-wrap`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,w.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var O=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),k=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),A=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=k();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),be=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=O(),r=k(),i=A(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),xe=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=O();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=be(),r=A();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),j=e(o(),1),M=e(l(),1),N=xe();function P(){}P.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(Se(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function Se(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var Ce=new P;function we(e,t,n){return Ce.diff(e,t,n)}var F=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,I=/\S/,L=new P;L.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!I.test(e)&&!I.test(t)},L.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&F.test(t[n])&&F.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function Te(e,t,n){return L.diff(e,t,n)}var R=new P;R.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
1
|
+
import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{cr as r,g as i,i as a}from"./DocumentContext-p9iubtSb.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./react-dom-DPxgxlDT.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{Ds as d,Ga as f,Ka as p,Na as m,Us as h,Xa as g,Y as _,Za as v,ao as y,ba as b,oo as x,ro as ee,so as te,to as ne,ur as re}from"./dist-CGNkoXKB.js";import{i as ie}from"./local-menu-action-bus-4I1Xm40D.js";import{i as ae,l as oe,m as S,n as se,t as ce}from"./PropertyDisplayRow-BnSF_nD0.js";import{K as le,L as ue,W as de}from"./CodeMirrorPropInput-ZmCpFv-f.js";import{t as fe}from"./minus-cd1ERTPg.js";import{t as pe}from"./libesm-xGH0ua32.js";var C=u(),w=n(),T=200;function me(e){let t=(0,C.c)(27),{delta:n,open:r,onOpenChange:i}=e;if(n.unparseable!==null){let e;return t[0]===n.unparseable?e=t[1]:(e=(0,w.jsx)(ye,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,c,l,u,d,f,p,m;if(t[2]!==n.changes||t[3]!==i||t[4]!==r){let e=n.changes.slice(0,50);o=n.changes.length-e.length,a=se,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,w.jsx)(s,{id:`l_UFPv`}),t[14]=c):c=t[14],l=n.changes.length,u=`property-diff-block`,d=`border-b border-border py-3`,f=r,p=i,m=e.map(he),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else a=t[5],o=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h;t[15]===o?h=t[16]:(h=o>0&&(0,w.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,w.jsx)(s,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=h);let g;return t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,w.jsxs)(a,{title:c,count:l,testId:u,className:d,open:f,onOpenChange:p,children:[m,h]}),t[17]=a,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function he(e){return(0,w.jsx)(ge,{change:e},`${e.kind}-${e.key}`)}function ge(e){let t=(0,C.c)(22),{change:n}=e,{_:i}=c(),a=oe[d(n.kind===`removed`?n.before:n.after)],o;t[0]!==i||t[1]!==n.kind?(o=n.kind===`added`?{KindIcon:ie,kindLabel:i({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:fe,kindLabel:i({id:`eps54V`})}:{KindIcon:r,kindLabel:i({id:`cNsIJf`})},t[0]=i,t[1]=n.kind,t[2]=o):o=t[2];let{KindIcon:s,kindLabel:l}=o,u;t[3]===s?u=t[4]:(u=(0,w.jsx)(s,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=s,t[4]=u);let f;t[5]===l?f=t[6]:(f=(0,w.jsx)(`span`,{className:`sr-only`,children:l}),t[5]=l,t[6]=f);let p;t[7]!==u||t[8]!==f?(p=(0,w.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[u,f]}),t[7]=u,t[8]=f,t[9]=p):p=t[9];let m;t[10]===a?m=t[11]:(m=(0,w.jsx)(a,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=a,t[11]=m);let h;t[12]===n?h=t[13]:(h=(0,w.jsx)(_e,{change:n}),t[12]=n,t[13]=h);let g;t[14]!==n.key||t[15]!==m||t[16]!==h?(g=(0,w.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,w.jsx)(ce,{icon:m,label:n.key,dataKey:n.key,children:h})}),t[14]=n.key,t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==n.key||t[19]!==p||t[20]!==g?(_=(0,w.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[p,g]}),t[18]=n.key,t[19]=p,t[20]=g,t[21]=_):_=t[21],_}function _e(e){let t=(0,C.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,w.jsx)(E,{value:n.after,keyName:n.key}),t[0]=n.after,t[1]=n.key,t[2]=e):e=t[2],e}if(n.kind===`removed`){let e;return t[3]!==n.before||t[4]!==n.key?(e=(0,w.jsx)(E,{value:n.before,keyName:n.key,removed:!0}),t[3]=n.before,t[4]=n.key,t[5]=e):e=t[5],e}let r=S(n.before)||S(n.after)?`flex flex-col gap-1`:`flex flex-wrap items-center gap-1.5`,i;t[6]!==n.before||t[7]!==n.key?(i=(0,w.jsx)(E,{value:n.before,keyName:n.key,removed:!0}),t[6]=n.before,t[7]=n.key,t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`→`}),t[9]=a):a=t[9];let o;t[10]!==n.after||t[11]!==n.key?(o=(0,w.jsx)(E,{value:n.after,keyName:n.key}),t[10]=n.after,t[11]=n.key,t[12]=o):o=t[12];let s;return t[13]!==r||t[14]!==i||t[15]!==o?(s=(0,w.jsxs)(`div`,{className:r,"data-testid":`property-diff-change-pair`,children:[i,a,o]}),t[13]=r,t[14]=i,t[15]=o,t[16]=s):s=t[16],s}function E(e){let t=(0,C.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(S(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,w.jsx)(ae,{keyName:r,value:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o;return t[3]!==e||t[4]!==i?(o=(0,w.jsx)(`div`,{className:e,children:i}),t[3]=e,t[4]=i,t[5]=o):o=t[5],o}let o,s,c,l;if(t[6]!==a||t[7]!==n){let e=Array.isArray(n)?n.filter(ve).join(`, `):String(n),r=e.length>T;o=a?`px-1 text-sm break-words text-muted-foreground line-through`:`px-1 text-sm break-words`,s=r?e:void 0,c=`property-diff-value`,l=r?`${e.slice(0,T)}…`:e,t[6]=a,t[7]=n,t[8]=o,t[9]=s,t[10]=c,t[11]=l}else o=t[8],s=t[9],c=t[10],l=t[11];let u;return t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,w.jsx)(`span`,{className:o,title:s,"data-testid":c,children:l}),t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function ve(e){return typeof e==`string`}function ye(e){let t=(0,C.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,w.jsx)(s,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,w.jsx)(s,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,w.jsx)(D,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,w.jsx)(s,{id:`NawEr2`}),t[4]=o):o=t[4];let c;t[5]===n.after?c=t[6]:(c=(0,w.jsx)(D,{label:o,text:n.after}),t[5]=n.after,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,w.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,w.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,c]})]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function D(e){let t=(0,C.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,w.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a=r===``?`—`:r,o;t[2]===a?o=t[3]:(o=(0,w.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-2 py-1.5 font-mono text-xs whitespace-pre-wrap`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,w.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var O=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),k=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),A=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=k();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),be=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=O(),r=k(),i=A(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),xe=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=O();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=be(),r=A();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),j=e(o(),1),M=e(l(),1),N=xe();function P(){}P.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(Se(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function Se(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var Ce=new P;function we(e,t,n){return Ce.diff(e,t,n)}var F=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,I=/\S/,L=new P;L.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!I.test(e)&&!I.test(t)},L.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&F.test(t[n])&&F.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function Te(e,t,n){return L.diff(e,t,n)}var R=new P;R.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
2
2
|
`));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var Ee=new P;Ee.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var De=new P;De.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function z(e){"@babel/helpers - typeof";return z=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},z(e)}var Oe=Object.prototype.toString,B=new P;B.useLongestToken=!0,B.tokenize=R.tokenize,B.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(V(e,null,null,i),i,` `)},B.equals=function(e,t){return P.prototype.equals.call(B,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function V(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(Oe.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=V(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),z(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=V(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var H=new P;H.tokenize=function(e){return e.slice()},H.join=H.removeEmpty=function(e){return e};function U(e,t){let n=t.content.findDiffStart(e.content);if(n===null)return!1;let{a:r,b:i}=t.content.findDiffEnd(e.content),a=n-Math.min(r,i);return a>0&&(e.resolve(n-a).depth<t.resolve(r+a).depth?n-=a:(r+=a,i+=a)),new y(n,i,t.slice(n,r))}function ke(e){if(!e.steps.length)return;let t=new x(e.docs[0]),n=e.steps.slice();for(;n.length;){let e=n.shift();for(;n.length&&e.merge(n[0]);){let r=n.shift();e=e instanceof y&&r instanceof y?U(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function W(e){let t=new x(e);return t.removeMark(0,e.nodeSize-2),t.doc}function Ae(e,t){let n=t.split(`/`);for(n.shift();n.length;){if(typeof e!=`object`)throw Error();let t=n.shift();e=e[t]}return e}function G(e){return JSON.parse(JSON.stringify(e))}var K=class{fromDoc;toDoc;complexSteps;wordDiffs;simplifyDiff;schema;tr;currentJSON;finalJSON;ops;constructor(e,t,n={}){let r={complexSteps:!0,wordDiffs:!1,simplifyDiff:!0,...n};this.fromDoc=e,this.toDoc=t,this.complexSteps=r.complexSteps,this.wordDiffs=r.wordDiffs,this.simplifyDiff=r.simplifyDiff,this.schema=e.type.schema,this.tr=new x(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=W(this.fromDoc).toJSON(),this.finalJSON=W(this.toDoc).toJSON(),this.ops=(0,N.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,N.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=ke(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=G(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,N.applyPatch)(r,[t]);try{n=this.schema.nodeFromJSON(r),n.check()}catch{if(n=null,this.ops.length>0)t=this.ops.shift(),e.push(t);else throw Error(`No valid diff possible applying ${t.path}`)}}this.complexSteps&&e.length===1&&(i.includes(`attrs`)||i.includes(`type`))?(this.addSetNodeMarkup(),e=[]):e.length===1&&t.op===`replace`&&i[i.length-1]===`text`?(this.addReplaceTextSteps(t,r),e=[]):this.addReplaceStep(n,r)&&(e=[])}}addSetNodeMarkup(){let e=this.schema.nodeFromJSON(this.currentJSON),t=this.schema.nodeFromJSON(this.finalJSON),n=t.content.findDiffStart(e.content),r=e.nodeAt(n),i=t.nodeAt(n);if(n!=null){let e=r.type===i.type?null:i.type;try{this.tr.setNodeMarkup(n,e,i.attrs,i.marks)}catch(t){if(e&&t.message.includes(`Invalid content`))this.tr.replaceWith(n,n+r.nodeSize,i);else throw t}return this.currentJSON=W(this.tr.doc).toJSON(),this.ops=(0,N.createPatch)(this.currentJSON,this.finalJSON),!0}return!1}recreateChangeMarkSteps(){this.toDoc.descendants((e,t)=>{if(!e.isInline)return!0;this.tr.doc.nodesBetween(t,t+e.nodeSize,(n,r)=>{if(!n.isInline)return!0;let i=Math.max(t,r),a=Math.min(t+e.nodeSize,r+n.nodeSize);n.marks.forEach(t=>{t.isInSet(e.marks)||this.tr.removeMark(i,a,t)}),e.marks.forEach(e=>{e.isInSet(n.marks)||this.tr.addMark(i,a,e)})})})}addReplaceStep(e,t){let n=U(this.schema.nodeFromJSON(this.currentJSON),e);if(!n)return!1;if(!this.tr.maybeStep(n).failed)return this.currentJSON=t,!0;throw Error(`No valid step found.`)}addReplaceTextSteps(e,t){let n={...e,value:`xx`},r={...e,value:`yy`},i=G(this.currentJSON),a=G(this.currentJSON);(0,N.applyPatch)(i,[n]),(0,N.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=Ae(this.currentJSON,e.path),u=this.wordDiffs?Te(l,c):we(l,c),d=o.content.findDiffStart(s.content),f=o.resolve(d+1).marks();for(;u.length;){let e=u.shift();if(e.added){let t=this.schema.nodeFromJSON({type:`text`,text:e.value}).mark(f);if(u.length&&u[0].removed){let e=u.shift();this.tr.replaceWith(d,d+e.value.length,t)}else this.tr.insert(d,t);d+=e.value.length}else if(e.removed)if(u.length&&u[0].added){let t=u.shift(),n=this.schema.nodeFromJSON({type:`text`,text:t.value}).mark(f);this.tr.replaceWith(d,d+e.value.length,n),d+=t.value.length}else this.tr.delete(d,d+e.value.length);else d+=e.value.length}this.currentJSON=t}};function je(e,t,n={}){return new K(e,t,n).init()}var Me=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function q(e){let t=[];return e.forEach((e,n)=>{if(Me.has(e.type.name)){let r=n+1,i=0;e.forEach(e=>{let n=r+i;t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`}),i+=e.nodeSize})}else t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`})}),t}function Ne(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a].key===t[n].key?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].key===t[s].key?(a.push({type:`same`,b:t[s]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,a:e[o]}),o++):(a.push({type:`ins`,b:t[s]}),s++);for(;o<n;)a.push({type:`del`,a:e[o++]});for(;s<r;)a.push({type:`ins`,b:t[s++]});return a}function Pe(e,t){let n=Ne(q(e),q(t)),r=[],i=0;for(let e of n)e.type===`same`?i=e.b.to:e.type===`ins`?(r.push({fromA:0,toA:0,fromB:e.b.from,toB:e.b.to}),i=e.b.to):r.push({fromA:e.a.from,toA:e.a.to,fromB:i,toB:i});return r}var Fe=400;function J(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function Ie(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof ne?`add`:t instanceof ee?`remove`:null;if(a===null)return;let o=t,s=e.mapping.slice(i+1),c=s.map(o.from,-1),l=s.map(o.to,1);if(l<=c||n.some(e=>e.fromB<=c&&l<=e.toB))return;let u=e.mapping.slice(0,i).invert(),d=u.map(o.from),f=u.map(o.to);f<=d||r.push({fromA:d,toA:f,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function Le(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=J(r,n,e),a=J(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=je(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=Pe(i,o),l=s?Ie(s,c):[];return c.length+l.length>Fe?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var Re=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function ze(e){return e.changes.length+2*e.markChanges.length}function Y(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function Be(e){if(e.childCount===0)return!1;let t=!0;return e.forEach(e=>{e.type.name!==`listItem`&&e.type.name!==`taskItem`&&(t=!1)}),t}function X(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=n?`ok-diff-del ok-diff-del-block`:`ok-diff-del`,r.setAttribute(`data-diff-deleted`,``);let i=e.serializeFragment(t);if(n&&Be(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function Ve(e,t,n,r,i){let a=te.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=Y(n.content);o.push(f.widget(e.fromB,()=>X(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(f.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(f.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=Y(n.content);o.push(f.widget(e.fromB,()=>X(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return p.create(e,o)}var He=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`trailingAffordance`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),Z=i.filter(e=>!He.has(e.name)).map(e=>e.name===`jsxComponent`?_:e),Q=m(Z);function Ue(e,t){return Le(e,t,Q,le())}var We=b.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:p.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new g({key:new v(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function Ge(e){let t=(0,C.c)(31),{diff:n}=e,r,i,a,o;if(t[0]!==n.afterDoc||t[1]!==n.beforeDoc||t[2]!==n.changes||t[3]!==n.markChanges){let e=Ve(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,Q);o=de,a=!1,r=Z,i=We.configure({decorations:e}),t[0]=n.afterDoc,t[1]=n.beforeDoc,t[2]=n.changes,t[3]=n.markChanges,t[4]=r,t[5]=i,t[6]=a,t[7]=o}else r=t[4],i=t[5],a=t[6],o=t[7];let s;t[8]!==r||t[9]!==i?(s=[...r,i],t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;t[11]===n.afterDoc?c=t[12]:(c=n.afterDoc.toJSON(),t[11]=n.afterDoc,t[12]=c);let l;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(l={attributes:{class:`pt-4`}},t[13]=l):l=t[13];let u;t[14]!==a||t[15]!==s||t[16]!==c?(u={editable:a,extensions:s,content:c,editorProps:l},t[14]=a,t[15]=s,t[16]=c,t[17]=u):u=t[17];let d;t[18]===n?d=t[19]:(d=[n],t[18]=n,t[19]=d);let f=o(u,d),[p]=(0,j.useState)(Ke),m=(0,j.useRef)(null),h,g;t[20]===p?(h=t[21],g=t[22]):(h=()=>{let e=m.current;if(e)return e.appendChild(p),()=>{p.parentNode===e&&e.removeChild(p)}},g=[p],t[20]=p,t[21]=h,t[22]=g),(0,j.useLayoutEffect)(h,g);let _;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,w.jsx)(`div`,{className:`tiptap-editor`,children:(0,w.jsx)(`div`,{ref:m,style:{display:`contents`}})}),t[23]=_):_=t[23];let v;t[24]===f?v=t[25]:(v=(0,w.jsx)(ue,{editor:f,className:`tiptap-editor-portal-content`}),t[24]=f,t[25]=v);let y;t[26]!==p||t[27]!==v?(y=(0,M.createPortal)(v,p),t[26]=p,t[27]=v,t[28]=y):y=t[28];let b;return t[29]===y?b=t[30]:(b=(0,w.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[_,y]}),t[29]=y,t[30]=b),b}function Ke(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var qe=`[data-property-change]`,Je=`[data-content] > [data-line-type="change-addition"], [data-content] > [data-line-type="change-deletion"]`;function Ye(e){let t=[];for(let n of e.querySelectorAll(`diffs-container`)){let e=n.shadowRoot;e&&t.push(...e.querySelectorAll(Je))}return t}function Xe(e,t){let n=new Map;return{sync(){for(let r of e.querySelectorAll(`diffs-container`)){let e=r.shadowRoot;if(e===null||n.has(e))continue;let i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0}),n.set(e,i)}},disconnect(){for(let e of n.values())e.disconnect();n.clear()}}}function Ze(e){let t=Ye(e),n=[],r=null;for(let e of t)(r===null||e.previousElementSibling!==r)&&n.push(e),r=e;return n}function $(e){let t=0,n=0;for(let r of e.split(`
|
|
3
3
|
`))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function Qe(e,t){return`${e}\u0000${t}`}function $e(e,t,n){let r=h(e).body,i=h(t).body;return r===i?``:pe(n,r,i,``,``,{context:Math.max(r.split(`
|
|
4
4
|
`).length,i.split(`
|
package/dist/public/index.html
CHANGED
|
@@ -94,13 +94,13 @@
|
|
|
94
94
|
-->
|
|
95
95
|
<script>(() => { try { const raw = localStorage.getItem('ok-language-v1'); if (!raw) return; const o = JSON.parse(raw); if (typeof o?.locale !== 'string' || !/^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{2,8})*$/.test(o.locale)) return; document.documentElement.lang = o.locale; document.documentElement.dir = o.dir === 'rtl' ? 'rtl' : 'ltr'; } catch {} })();</script>
|
|
96
96
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
97
|
-
<script type="module" crossorigin src="./assets/index-
|
|
97
|
+
<script type="module" crossorigin src="./assets/index-BpD4iquV.js"></script>
|
|
98
98
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
|
|
100
100
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
|
|
101
|
-
<link rel="modulepreload" crossorigin href="./assets/globals-
|
|
101
|
+
<link rel="modulepreload" crossorigin href="./assets/globals-2sss1K50.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Chd9yIcd.js">
|
|
103
|
-
<link rel="modulepreload" crossorigin href="./assets/sortable.esm-
|
|
103
|
+
<link rel="modulepreload" crossorigin href="./assets/sortable.esm-HCgNojue.js">
|
|
104
104
|
<link rel="modulepreload" crossorigin href="./assets/floating-ui.dom-BcZPrP06.js">
|
|
105
105
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-BP9dN1Hz.js">
|
|
106
106
|
<link rel="modulepreload" crossorigin href="./assets/html-void-elements-zEl0KGqf.js">
|
|
@@ -117,9 +117,9 @@
|
|
|
117
117
|
<link rel="modulepreload" crossorigin href="./assets/client-version-B48BbTkz.js">
|
|
118
118
|
<link rel="modulepreload" crossorigin href="./assets/use-apply-config-theme-DpLdjUDN.js">
|
|
119
119
|
<link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-sUvEkbPv.js">
|
|
120
|
-
<link rel="modulepreload" crossorigin href="./assets/messages-
|
|
121
|
-
<link rel="modulepreload" crossorigin href="./assets/i18n-
|
|
122
|
-
<link rel="modulepreload" crossorigin href="./assets/config-provider-
|
|
120
|
+
<link rel="modulepreload" crossorigin href="./assets/messages-Cr6C9Hnr.js">
|
|
121
|
+
<link rel="modulepreload" crossorigin href="./assets/i18n-SN-8kqTh.js">
|
|
122
|
+
<link rel="modulepreload" crossorigin href="./assets/config-provider-Bobp4tNz.js">
|
|
123
123
|
<link rel="modulepreload" crossorigin href="./assets/dist-Nvb76hAm.js">
|
|
124
124
|
<link rel="modulepreload" crossorigin href="./assets/dist-BHv-mziD.js">
|
|
125
125
|
<link rel="modulepreload" crossorigin href="./assets/dist-BcvirUWL.js">
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
<link rel="modulepreload" crossorigin href="./assets/doc-hash-CH3Kq7TA.js">
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/documents-fetch-CWhWyXwW.js">
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/note-window-mode-CsmLTxU_.js">
|
|
173
|
-
<link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-
|
|
173
|
+
<link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-ZmCpFv-f.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/git-branch-B_QTfwFA.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/maximize-2-DaY3HCwc.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-1CPkv6zu.js">
|
|
@@ -199,91 +199,91 @@
|
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/skill-scope-B1qEIboE.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/skills-api-NyR-fZMK.js">
|
|
201
201
|
<link rel="modulepreload" crossorigin href="./assets/use-workspace-CfpIXxMZ.js">
|
|
202
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
202
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-p9iubtSb.js">
|
|
203
|
+
<link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-VUzkO2kv.js">
|
|
203
204
|
<link rel="modulepreload" crossorigin href="./assets/workspace-paths-Dczkx4vn.js">
|
|
204
|
-
<link rel="modulepreload" crossorigin href="./assets/progress-
|
|
205
|
+
<link rel="modulepreload" crossorigin href="./assets/progress-BNLzMM8p.js">
|
|
205
206
|
<link rel="modulepreload" crossorigin href="./assets/dist-Dhtu02232.js">
|
|
206
207
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-npdxiS6E.js">
|
|
207
208
|
<link rel="modulepreload" crossorigin href="./assets/toggle-group-C2_37kV5.js">
|
|
208
209
|
<link rel="modulepreload" crossorigin href="./assets/useQuery-ZeEDLtxh.js">
|
|
209
|
-
<link rel="modulepreload" crossorigin href="./assets/format-
|
|
210
|
+
<link rel="modulepreload" crossorigin href="./assets/format-BSkuL3XD.js">
|
|
210
211
|
<link rel="modulepreload" crossorigin href="./assets/braces-OM56BU1Y.js">
|
|
211
212
|
<link rel="modulepreload" crossorigin href="./assets/dist-wcXwpuqG.js">
|
|
212
213
|
<link rel="modulepreload" crossorigin href="./assets/dist-BjJaywqn.js">
|
|
213
214
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu--ZF4igWe.js">
|
|
214
|
-
<link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-
|
|
215
|
+
<link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-BnSF_nD0.js">
|
|
215
216
|
<link rel="modulepreload" crossorigin href="./assets/folder-config-api-BF554VSQ.js">
|
|
216
|
-
<link rel="modulepreload" crossorigin href="./assets/comment-chips-
|
|
217
|
-
<link rel="modulepreload" crossorigin href="./assets/SkillCostValue-
|
|
218
|
-
<link rel="modulepreload" crossorigin href="./assets/textarea-
|
|
219
|
-
<link rel="modulepreload" crossorigin href="./assets/selection-context-
|
|
220
|
-
<link rel="modulepreload" crossorigin href="./assets/lint-config-client-
|
|
217
|
+
<link rel="modulepreload" crossorigin href="./assets/comment-chips-BWKl9VbL.js">
|
|
218
|
+
<link rel="modulepreload" crossorigin href="./assets/SkillCostValue-ZQq6hE5u.js">
|
|
219
|
+
<link rel="modulepreload" crossorigin href="./assets/textarea-Cqj1jsXK.js">
|
|
220
|
+
<link rel="modulepreload" crossorigin href="./assets/selection-context-CCdILpgG.js">
|
|
221
|
+
<link rel="modulepreload" crossorigin href="./assets/lint-config-client-D2qMETc6.js">
|
|
221
222
|
<link rel="modulepreload" crossorigin href="./assets/use-skills-CI07Z3HF.js">
|
|
222
|
-
<link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties
|
|
223
|
-
<link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-
|
|
223
|
+
<link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties--dbkaZZS.js">
|
|
224
|
+
<link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-BE-l5JaR.js">
|
|
224
225
|
<link rel="modulepreload" crossorigin href="./assets/arrow-up-right-B3B9a7te.js">
|
|
225
226
|
<link rel="modulepreload" crossorigin href="./assets/cursor-BVKD3ibX.js">
|
|
226
227
|
<link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-DU5Zkepy.js">
|
|
227
|
-
<link rel="modulepreload" crossorigin href="./assets/use-open-skill-
|
|
228
|
+
<link rel="modulepreload" crossorigin href="./assets/use-open-skill-Df4qaz_1.js">
|
|
228
229
|
<link rel="modulepreload" crossorigin href="./assets/dist-DBMXz-r_.js">
|
|
229
230
|
<link rel="modulepreload" crossorigin href="./assets/copilot-y4atlWX7.js">
|
|
230
231
|
<link rel="modulepreload" crossorigin href="./assets/terminal-cli-display-BrLCqbMd.js">
|
|
231
232
|
<link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-815RzzoI.js">
|
|
232
|
-
<link rel="modulepreload" crossorigin href="./assets/SkillInstallMenu-
|
|
233
|
+
<link rel="modulepreload" crossorigin href="./assets/SkillInstallMenu-DcpgYBfx.js">
|
|
233
234
|
<link rel="modulepreload" crossorigin href="./assets/list-plus-BmoxCvSM.js">
|
|
234
235
|
<link rel="modulepreload" crossorigin href="./assets/use-settings-route-hU5QNNlM.js">
|
|
235
|
-
<link rel="modulepreload" crossorigin href="./assets/platform-labels-
|
|
236
|
-
<link rel="modulepreload" crossorigin href="./assets/AddPropertiesButton-
|
|
236
|
+
<link rel="modulepreload" crossorigin href="./assets/platform-labels-B3xX8Yyl.js">
|
|
237
|
+
<link rel="modulepreload" crossorigin href="./assets/AddPropertiesButton-BadjM61v.js">
|
|
237
238
|
<link rel="modulepreload" crossorigin href="./assets/case-sensitive-B01mpdhT.js">
|
|
238
239
|
<link rel="modulepreload" crossorigin href="./assets/chevron-left-BTZYHMSf.js">
|
|
239
240
|
<link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-zA9wHIBR.js">
|
|
240
241
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-DgTHxKWl.js">
|
|
241
242
|
<link rel="modulepreload" crossorigin href="./assets/wrench-BFRDKz2A.js">
|
|
242
243
|
<link rel="modulepreload" crossorigin href="./assets/panel-CSN_wKuN.js">
|
|
243
|
-
<link rel="modulepreload" crossorigin href="./assets/skeleton-
|
|
244
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-
|
|
244
|
+
<link rel="modulepreload" crossorigin href="./assets/skeleton-DIDidh7_.js">
|
|
245
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-jlncpstJ.js">
|
|
245
246
|
<link rel="modulepreload" crossorigin href="./assets/terminal-WtPHPKhg.js">
|
|
246
247
|
<link rel="modulepreload" crossorigin href="./assets/terminal-command-events-CloL_dun.js">
|
|
247
248
|
<link rel="modulepreload" crossorigin href="./assets/field-6N9LOclS.js">
|
|
248
|
-
<link rel="modulepreload" crossorigin href="./assets/use-conflicts-
|
|
249
|
-
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-
|
|
249
|
+
<link rel="modulepreload" crossorigin href="./assets/use-conflicts-CMLH1ChX.js">
|
|
250
|
+
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-Cop0NQF5.js">
|
|
250
251
|
<link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-CNJRdTPE.js">
|
|
251
|
-
<link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-
|
|
252
|
+
<link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-DjuEU1dx.js">
|
|
252
253
|
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-Bf41Ns6y.js">
|
|
253
254
|
<link rel="modulepreload" crossorigin href="./assets/launcher-selection-C9GmEvOn.js">
|
|
254
255
|
<link rel="modulepreload" crossorigin href="./assets/contact-email-store-82vnOD-h.js">
|
|
255
256
|
<link rel="modulepreload" crossorigin href="./assets/bug-report-send-manager-BK30wBiV.js">
|
|
256
257
|
<link rel="modulepreload" crossorigin href="./assets/package-DCh1ji9x.js">
|
|
257
258
|
<link rel="modulepreload" crossorigin href="./assets/panel-right-open-Dx0ZAduW.js">
|
|
258
|
-
<link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-
|
|
259
|
+
<link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-9VXuYbO-.js">
|
|
259
260
|
<link rel="modulepreload" crossorigin href="./assets/square-pen-zPTA2xeB.js">
|
|
260
261
|
<link rel="modulepreload" crossorigin href="./assets/undo-2-Dg2S1Iz5.js">
|
|
261
262
|
<link rel="modulepreload" crossorigin href="./assets/form-Bmi-fWEr.js">
|
|
262
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
263
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
264
|
-
<link rel="modulepreload" crossorigin href="./assets/text-viewer-languages-
|
|
265
|
-
<link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-
|
|
263
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-zWrmTYco2.js">
|
|
264
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-D_m2fuwc2.js">
|
|
265
|
+
<link rel="modulepreload" crossorigin href="./assets/text-viewer-languages-CSz-0bs7.js">
|
|
266
|
+
<link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-Bf9f_Cka.js">
|
|
266
267
|
<link rel="modulepreload" crossorigin href="./assets/ImageAttachments-Dru1UxQV.js">
|
|
267
268
|
<link rel="modulepreload" crossorigin href="./assets/ConfigSharingInfoTooltip-CroYwQwo.js">
|
|
268
269
|
<link rel="modulepreload" crossorigin href="./assets/RowDisclosure-DIFddIWB.js">
|
|
269
270
|
<link rel="modulepreload" crossorigin href="./assets/tool-list-format-CDSiMc2f.js">
|
|
270
271
|
<link rel="modulepreload" crossorigin href="./assets/project-paths-Bzd32aJI.js">
|
|
271
|
-
<link rel="modulepreload" crossorigin href="./assets/ReportBugMenuTrigger-
|
|
272
|
-
<link rel="modulepreload" crossorigin href="./assets/SkillModeBanner-
|
|
272
|
+
<link rel="modulepreload" crossorigin href="./assets/ReportBugMenuTrigger-UUESg7vh.js">
|
|
273
|
+
<link rel="modulepreload" crossorigin href="./assets/SkillModeBanner-Dddk2HFX.js">
|
|
273
274
|
<link rel="modulepreload" crossorigin href="./assets/app-menubar-gate-CxxJfQzO.js">
|
|
274
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
275
|
-
<link rel="modulepreload" crossorigin href="./assets/agent-diff-store-C92NIPau.js">
|
|
275
|
+
<link rel="modulepreload" crossorigin href="./assets/agent-diff-store-Rb8akV6K.js">
|
|
276
276
|
<link rel="modulepreload" crossorigin href="./assets/ok-Cw0KQBUY.js">
|
|
277
277
|
<link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-BgQOsQLk.js">
|
|
278
|
-
<link rel="modulepreload" crossorigin href="./assets/input-group-
|
|
279
|
-
<link rel="modulepreload" crossorigin href="./assets/use-skill-origin-
|
|
278
|
+
<link rel="modulepreload" crossorigin href="./assets/input-group-cb7RyEsm.js">
|
|
279
|
+
<link rel="modulepreload" crossorigin href="./assets/use-skill-origin-CBguK4Xh.js">
|
|
280
280
|
<link rel="modulepreload" crossorigin href="./assets/terminal-telemetry-DBBf7dvq.js">
|
|
281
281
|
<link rel="modulepreload" crossorigin href="./assets/agent-presence-DWLDrXbV.js">
|
|
282
282
|
<link rel="modulepreload" crossorigin href="./assets/auth-prompt-store-BuIZ8nj2.js">
|
|
283
283
|
<link rel="modulepreload" crossorigin href="./assets/overlay-layers-Bj-TVfKw.js">
|
|
284
284
|
<link rel="modulepreload" crossorigin href="./assets/receive-store-BJw3I9N7.js">
|
|
285
|
-
<link rel="modulepreload" crossorigin href="./assets/timeline-diff-store-
|
|
286
|
-
<link rel="stylesheet" crossorigin href="./assets/globals-
|
|
285
|
+
<link rel="modulepreload" crossorigin href="./assets/timeline-diff-store-hP7gGEyc.js">
|
|
286
|
+
<link rel="stylesheet" crossorigin href="./assets/globals-DVivVCS3.css">
|
|
287
287
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
288
288
|
<link rel="stylesheet" crossorigin href="./assets/index-CDpJ2gXn.css">
|
|
289
289
|
</head>
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
script above.
|
|
33
33
|
-->
|
|
34
34
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
35
|
-
<script type="module" crossorigin src="./assets/uninstall-
|
|
35
|
+
<script type="module" crossorigin src="./assets/uninstall-DJEPJuYD.js"></script>
|
|
36
36
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
|
|
37
37
|
<link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
|
|
39
|
-
<link rel="modulepreload" crossorigin href="./assets/globals-
|
|
39
|
+
<link rel="modulepreload" crossorigin href="./assets/globals-2sss1K50.js">
|
|
40
40
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Chd9yIcd.js">
|
|
41
41
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-BP9dN1Hz.js">
|
|
42
42
|
<link rel="modulepreload" crossorigin href="./assets/html-void-elements-zEl0KGqf.js">
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
<link rel="modulepreload" crossorigin href="./assets/spinner-Bp2_BYkl.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="./assets/badge-C8hrUpuH.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="./assets/input-BJ0fEcsi.js">
|
|
70
|
-
<link rel="modulepreload" crossorigin href="./assets/textarea-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="./assets/messages-
|
|
72
|
-
<link rel="modulepreload" crossorigin href="./assets/i18n-
|
|
73
|
-
<link rel="stylesheet" crossorigin href="./assets/globals-
|
|
70
|
+
<link rel="modulepreload" crossorigin href="./assets/textarea-Cqj1jsXK.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="./assets/messages-Cr6C9Hnr.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="./assets/i18n-SN-8kqTh.js">
|
|
73
|
+
<link rel="stylesheet" crossorigin href="./assets/globals-DVivVCS3.css">
|
|
74
74
|
</head>
|
|
75
75
|
|
|
76
76
|
<body class="antialiased">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Gl as e,Gu as t,Uu as n,Vu as r,Wu as i,eu as a,qc as o,qu as s}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{Ao as c,Ki as l,Ln as u,go as ee,ko as te,m as d,to as ne,wo as f}from"./dist-BfGPmTI1.mjs";import{$ as p,A as m,C as re,D as h,K as g,O as _,P as ie,Q as ae,W as oe,Y as se,Z as ce,at as le,d as ue,et as v,f as de,it as y,k as fe,o as b,st as pe,tt as me,v as he,w as x,x as ge,y as _e}from"./init-
|
|
1
|
+
import{Gl as e,Gu as t,Uu as n,Vu as r,Wu as i,eu as a,qc as o,qu as s}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{Ao as c,Ki as l,Ln as u,go as ee,ko as te,m as d,to as ne,wo as f}from"./dist-BfGPmTI1.mjs";import{$ as p,A as m,C as re,D as h,K as g,O as _,P as ie,Q as ae,W as oe,Y as se,Z as ce,at as le,d as ue,et as v,f as de,it as y,k as fe,o as b,st as pe,tt as me,v as he,w as x,x as ge,y as _e}from"./init-YoVVaWK0.mjs";import{t as ve}from"./is-object-BGze3w87.mjs";import{spawn as S}from"node:child_process";import{basename as ye,dirname as C,join as w,resolve as be,win32 as xe}from"node:path";import{existsSync as T,mkdirSync as E,readFileSync as D,readdirSync as Se,rmSync as O,statSync as Ce,writeFileSync as we}from"node:fs";import{homedir as k}from"node:os";var A=e();const j=`open-knowledge`;function M(e){try{e()}catch{}}var N=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(j,e).getPassword()}catch(t){return M(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return M(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return M(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(j,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(j,e).deletePassword()}catch{}}},P=class{backend=`file`;authFile;constructor(e){this.authFile=e??w(k(),`.ok`,`auth.yml`)}read(){if(!T(this.authFile))return{};try{let e=D(this.authFile,`utf-8`);return(0,A.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=C(this.authFile);T(t)||E(t,{recursive:!0,mode:448}),we(this.authFile,(0,A.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},Te=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ~/.ok/auth.yml to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function F(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(j,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
|
|
2
2
|
`),M(()=>t?.onBackendSelected?.({backend:`keyring`})),new Te(new N(t?.onKeychainRead),new P(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (~/.ok/auth.yml) — OS keychain unavailable: ${r}\n`),M(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new P(e)}}function I(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (~/.ok/auth.yml)\n`),r(new P(e))},n)});try{return await Promise.race([F(e),r])}catch{return new P(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function Ee(e){let t=I(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}function De(e){let t=I(e);return{backend:`file`,async get(e){return(await t()).get(e)},async set(e,n,r,i){return(await t()).set(e,n,r,i)},async clear(e){return(await t()).clear(e)}}}async function Oe(e,t){let n=[],r=new P(t);await r.get(e)!=null&&(await r.clear(e),n.push(`file`));let i;try{let{Entry:t}=await import(`@napi-rs/keyring`);new t(j,`__probe__`);let r,a=await new N(e=>{e.kind===`read-error`&&(r=e.error??`read-error`)}).get(e);if(r!==void 0)i=r;else if(a!=null)try{new t(j,e).deletePassword(),n.push(`keychain`)}catch(e){i=e instanceof Error?e.name:`delete-error`}}catch{}return{touched:n,keychainError:i}}function ke(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function L(e){let t=e?.code;return t===`ENOENT`||t===`EACCES`||t===`EPERM`?{ok:!1,reason:`not-installed`}:{ok:!1,reason:`spawn-error`}}function R(e){return ne({detached:!0,stdio:`ignore`,shell:!1,env:ke(e)})}function z(e,t,n={}){let r=(n.spawn??S)(e,[...t],R(n.env??process.env));return r.unref(),r}function Ae(e,t,n={}){let r=n.spawn??S,i=n.timeoutMs??2e3;return new Promise(a=>{let o=!1,s=e=>{o||(o=!0,a(e))},c=setTimeout(()=>s({ok:!1,reason:`timeout`}),i);try{let i=r(e,[...t],R(n.env??process.env));i.once(`error`,e=>{clearTimeout(c),s(L(e))}),i.once(`spawn`,()=>{clearTimeout(c),s({ok:!0})});try{i.unref()}catch{}}catch(e){clearTimeout(c),s(L(e))}})}const B=`com.inkeep.open-knowledge`,V=`OpenKnowledge.app`,H=`/Applications/${V}`;function je(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return Ce(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function Me(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(U(e,H))return H;let t=e.homeDir??k(),n=w(t,`Applications`,V);return U(e,n)?n:null}function U(e,t){return W(e,w(t,`Contents`,`MacOS`,`OpenKnowledge`))}function W(e,t){try{let n=e.statSync(t);return n?typeof n.isFile==`function`&&n.isFile():!1}catch{return!1}}const Ne=[`@inkeepopen-knowledge-desktop`,`OpenKnowledge`];function Pe(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&/\\OpenKnowledge\.exe$/i.test(e.execPath))return e.execPath;let t=e.env.LOCALAPPDATA;if(t)for(let n of Ne){let r=xe.join(t,`Programs`,n,`OpenKnowledge.exe`);if(W(e,r))return r}return null}function Fe(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&e.execPath.endsWith(`/openknowledge`))return e.execPath;let t=`/opt/OpenKnowledge/openknowledge`;return W(e,t)?t:null}function Ie(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`};let t;try{t=e.platform===`darwin`?Me(e):e.platform===`win32`?Pe(e):Fe(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:!(e.isTTY===!0||e.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function Le(e,t){let n=e.log??(e=>console.error(e)),r=e.platform??process.platform;if(n("Launching OpenKnowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)"),r===`darwin`){z(`open`,[`-b`,B],{spawn:e.spawn});return}let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}z(i,[],{spawn:e.spawn})}function Re(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it from https://openknowledge.ai/download, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}function G(e,t){let n=be(e),r=t===void 0?y():y({home:t,env:{}});return{cwd:n,bridgePath:g.pi.projectConfigPath?.(n)??``,trustPath:w(r,`trust.json`)}}function K(e,t,n){let r=b(g.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return p(i)?{state:`own-current`,text:a}:x(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function q(e,t){let n;try{n=D(e,`utf-8`)}catch(e){let t=e.code;return t===`ENOENT`||t===`ENOTDIR`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,entries:null,trailingNewline:!1}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,entries:null,trailingNewline:!1}}return ve(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
|
|
3
3
|
`)}:{state:`unreadable`,entries:null,trailingNewline:!1}}function ze(e,t){let n=G(e,t),r=K(n.cwd,n.bridgePath,t).state,i=q(n.trustPath,n.cwd).state;return{...n,bridge:r,trust:i,bridgeLoadable:(r===`own-current`||r===`own-stale`)&&i===`trusted`,otherExtensions:J(n.bridgePath).names}}function J(e){let t=C(e),n=ye(e);try{return{names:Se(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort(),verified:!0}}catch(e){let t=e.code;return{names:[],verified:t===`ENOENT`||t===`ENOTDIR`}}}async function Be(e,t={mode:`published`},n){let r=G(e,n),i=K(r.cwd,r.bridgePath,n);if(i.state===`foreign`)return{...r,ok:!1,bridge:`refused-foreign`,trust:`skipped`};if(i.state===`unreadable`)return{...r,ok:!1,bridge:`refused-unreadable`,trust:`skipped`};let a;if(i.state===`absent`)a=`written`;else{let e;try{e=re(t)}catch{e=void 0}a=e!==void 0&&i.text===e?`unchanged`:`refreshed`}if(a!==`unchanged`){let e=_e(g.pi,r.cwd,t,n,r.bridgePath);if(e.action!==`written`&&e.action!==`overwritten`)return{...r,ok:!1,bridge:`failed`,trust:`skipped`,error:e.error??`bridge write ${e.action}`}}let o=await Ve(r.trustPath,r.cwd);return{...r,ok:o.action===`already-trusted`||o.action===`added`,bridge:a,trust:o.action,...o.error===void 0?{}:{error:o.error}}}async function Ve(e,t){try{E(C(e),{recursive:!0})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}let n={action:`added`};try{await te(`${e}.lock`,async()=>{let r=q(e,t);if(r.state===`trusted`){n.action=`already-trusted`;return}if(r.entries===null){n.action=`refused-unreadable`;return}let i={...r.entries,[t]:!0},a=JSON.stringify(i,null,2)+(r.trailingNewline?`
|
|
4
4
|
`:``),o=h(e);f(e,a,o===void 0?void 0:{mode:o}),n.action=`added`})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}return n.action===`refused-unreadable`?{action:`refused-unreadable`,error:`trust store is not a readable JSON object`}:{action:n.action}}function He(e,t){let n=G(e,t),r=J(n.bridgePath);if(!r.verified)return{action:`kept-unverified`,error:`could not read the Pi extensions folder`};if(r.names.length>0)return{action:`kept-shared`};if(!T(n.trustPath))return{action:`not-present`};let i={action:`removed`};try{c(`${n.trustPath}.lock`,()=>{let e=q(n.trustPath,n.cwd);if(e.entries===null){i.action=e.state===`unreadable`?`refused-unreadable`:`not-present`;return}if(!(n.cwd in e.entries)){i.action=`not-present`;return}let t={...e.entries};delete t[n.cwd];let r=JSON.stringify(t,null,2)+(e.trailingNewline?`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./launch-json-removal-
|
|
1
|
+
import{t as e}from"./launch-json-removal-BaySWdca.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,severity:`info`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=(n.removeOwnLaunchEntryFn??e)(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,severity:`warn`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`;return s&&i({event:`launch-json-repair-removed`,severity:`info`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ga as e}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{$ as t,K as n,W as r,X as i,f as a,y as o}from"./init-
|
|
1
|
+
import{ga as e}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{$ as t,K as n,W as r,X as i,f as a,y as o}from"./init-YoVVaWK0.mjs";import{homedir as s}from"node:os";function c(e){let{priorCommand:t,priorArgs:n}=l(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function l(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function u(e){let t=e.logger??m,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,severity:`info`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of r){let r=n[o],s=d(()=>r.configPath(``,i));if(s!==null&&a.push(f({scope:`user`,editorId:o,target:r,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),r.projectConfigPath){let n=r.projectConfigPath,i=d(()=>n(e.projectDir));i!==null&&a.push(f({scope:`project`,editorId:o,target:r,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function d(e){try{return e()}catch{return null}}function f(n){let r={scope:n.scope,editorId:n.editorId,configPath:n.configPath},s=a(n.target,n.cwd,n.home,n.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(n.target.format===`file`){if(t(s))return{...r,outcome:`canonical`}}else{let t=e(s);if(t.kind===`recognized`&&t.disposition===`keep`){let e=i(s,n.target.buildEntry(n.cwd,{}));if(e.length===0)return{...r,outcome:`canonical`};let t=p(n,r,o(n.target,n.cwd,{mode:`published`,skipAvailabilityCheck:!0,pruneOnly:!0},n.home,n.configPathOverride));return(t.outcome===`repaired`||t.outcome===`canonical`)&&n.logger({event:t.outcome===`repaired`?`mcp-config-repair-pruned`:`mcp-config-repair-prune-unchanged`,severity:t.outcome===`repaired`?`info`:`warn`,scope:n.scope,editorId:n.editorId,configPath:n.configPath,keys:e}),t.outcome===`canonical`?{...r,outcome:`prune-unchanged`}:t}if(t.kind===`declined`&&n.scope===`project`)return n.logger({event:`mcp-config-repair-skipped-foreign`,severity:`info`,scope:n.scope,editorId:n.editorId,configPath:n.configPath,reason:t.reason}),{...r,outcome:`foreign`,reason:t.reason}}return n.logger({...c({scope:n.scope,surface:`cli-repair`,editorId:n.editorId,configPath:n.configPath,priorEntry:s}),severity:`info`}),p(n,r,o(n.target,n.cwd,{mode:`published`,skipAvailabilityCheck:!0},n.home,n.configPathOverride))}function p(e,t,n){if(n.action===`failed`){let r=n.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:r}),{...t,outcome:`write-failed`,error:r}}return n.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:n.declineReason}),{...t,outcome:`declined`,reason:n.declineReason}):n.action===`skipped-flag`?{...t,outcome:`canonical`}:{...t,outcome:`repaired`}}function m(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as n,u as repairMcpConfigs,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import"./init-YoVVaWK0.mjs";import"./src-Dfw-4H6Q.mjs";import"./registry-probes-B_EoML_h.mjs";import"./start-C201LWw_.mjs";import{n as e}from"./loader-CsbLLAav.mjs";import"./preview-C6QTJ0V1.mjs";import"./cli.mjs";import"./repair-mcp-configs-ngiQYYLV.mjs";export{e as loadConfig};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{$u as t,Bs as n,Dn as r,Gl as i,In as a,On as o,ac as s,ic as c,lo as l,ns as u,ps as ee,sc as te}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{$i as d,Do as f,Eo as p,Hr as m,Jn as h,Jr as g,Oo as _,Qn as v,Rn as y,Tt as b,dr as x,ei as S,m as C,ni as w,ti as T,to as E,vi as D,wn as O,yi as k}from"./dist-BfGPmTI1.mjs";import{t as A}from"./yazl-BBz29IQN.mjs";import{ht as j,nt as M,rt as N}from"./init-Dir125F-.mjs";import{c as ne}from"./colors-r_owlCuY.mjs";import{l as P}from"./registry-probes-DjyB1UXR.mjs";import{t as re}from"./is-object-BGze3w87.mjs";import{n as ie}from"./constants-CDJe2LeZ.mjs";import"./loader-Bi3IQ4W8.mjs";import"./preview-CdAH75He.mjs";import{execSync as ae,spawnSync as oe}from"node:child_process";import{basename as F,dirname as I,isAbsolute as se,join as L,relative as R,resolve as z,sep as B}from"node:path";import{closeSync as ce,cpSync as le,createWriteStream as ue,existsSync as V,lstatSync as de,mkdirSync as H,mkdtempSync as fe,openSync as pe,readFileSync as U,readSync as me,readdirSync as W,rmSync as G,rmdirSync as he,statSync as ge,writeFileSync as K}from"node:fs";import{arch as _e,freemem as ve,homedir as q,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";let De;function Oe(){return De}function ke(e,t){if(t!==void 0&&t.length>0)return t;try{return v(e)?.rootPath}catch{return}}function Ae(e){let t=ke(e.cwd,e.configuredProjectName),n=O({name:`cli`,project:t});return De=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}const je=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Me(e,t,n=v){if(e!==void 0&&!je.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ne=null;function Pe(e){Ne=e}function Fe(){return Ne??process.cwd()}const Ie=`Open Knowledge`;function Le(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return M(t).join(N({...e,platformName:t}),n)}function Re(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=M(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function ze(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Be(e){let t=L(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return ze(n)??[]}function Ve(e){let t=L(e,`state.json`);if(!V(t))return!1;try{return ze(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const He=8192;function Ue(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function We(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Ge=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ke(e){return e.replace(Ge,`$1"[REDACTED-DEVICE-ID]"`)}function qe(e){return Ke(We(e))}const Je=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Ye(e){if(typeof e!=`string`)return null;let t=Je.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function Xe(e){let t=pe(e,`r`);try{let e=Buffer.alloc(He),n=0,r=!1;for(;n<He;){let i=me(t,e,n,He-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{ce(t)}}function Ze(e){try{let t=Xe(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:Ye(a)}}catch{return{kind:`unreadable`}}}function Qe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function $e(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=W(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=L(e,t.name),r;try{r=ge(n).mtimeMs}catch{continue}if(r<i)continue;let c=Ze(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!Qe(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}function J(){return L(q(),`.ok`,`bug-reports`)}function et(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=J(),r=`${t}-bugreport`,i=L(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=L(n,`${r}-${e}.zip`);return i}function tt(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let e=U(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return V(L(e,`.ok`))?Ee(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function nt(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ae(`sw_vers -productVersion 2>/dev/null`,E({encoding:`utf8`})).trim()}catch{}try{let t=L(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const rt=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function it(e){let t=F(e);return rt.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function at(e,t){return lt(e,t).files}const ot=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function st(e,t=P){let n=L(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return ot.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>L(n,e.entry)))}function ct(e){if(!V(e))return[];try{let t=new Map;for(let n of W(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-r.length):n.slice(0,-5),i=t.get(e);i===void 0?t.set(e,[n]):i.push(n)}return[...t.values()].slice(-25).flat().map(t=>L(e,t))}catch{return[]}}function lt(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>L(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(it),i=[],a=r.filter(t=>{try{return U(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!it(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function ut(e){let t=L(e,`.ok`,`local`);return V(t)?{files:[`server.lock`,`last-spawn-error.log`,c].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function dt(e){let t=L(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function ft(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Ee(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function pt(e){let t=e.revealDocNames?e.content:ft(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=u(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function Y(e){for(let t of e.files)try{let n=U(t,`utf8`);pt({zipfile:e.zipfile,name:`${e.prefix}/${F(t)}`,content:t.endsWith(`.ips`)?qe(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function mt(t){let{redact:n,outputPath:r,logger:i}=t,s=t.revealDocNames??!1,c=t.userLogsDir??L(q(),`.ok`,`logs`),l=t.projectDir?tt(t.projectDir,i):null;H(I(r),{recursive:!0}),i?.info({projectSlug:l},`gathering diagnostic data`);let u=nt();u.desktop=t.desktop??null,u.language=t.language??null;let{files:ee,excludedByProjectSlug:te}=lt(l,c),{files:d}=t.projectDir?ut(t.projectDir):{files:[]},{files:f}=t.projectDir?dt(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:ee.length,logFilesExcludedByProjectSlug:te,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let h=[],g=[],{ZipFile:_}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),v=new _;Y({zipfile:v,files:[...ee,...p],prefix:`logs`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:d,prefix:`lockdir`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:f,prefix:`local-logs`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:t.bugReportLedgerFiles??[],prefix:o,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??F(e.sourcePath)}`;v.addBuffer(t,n),g.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&pt({zipfile:v,name:`note.txt`,content:t.note,redact:n,revealDocNames:s,bundleFiles:g,redactions:h});let y=new Set(m.map(e=>`diagnostic-reports/${F(e)}`)),b=g.filter(e=>y.has(e)),x=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Ue(t.diagnosticReports,b.length);v.addBuffer(Buffer.from(`${x}\n`,`utf8`),`state/diagnostic-reports-status.txt`),g.push(`state/diagnostic-reports-status.txt`);let S=JSON.stringify(u,null,2);v.addBuffer(Buffer.from(S,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let C={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:l,files:g,redactions:h,sysinfo:u};v.addBuffer(Buffer.from(JSON.stringify(C,null,2),`utf8`),`MANIFEST.json`);let w=h.reduce((e,t)=>e+t.lineCount,0),T=new Set(p.map(e=>`logs/${F(e)}`)),E=g.filter(e=>T.has(e)),D=new Set((t.bugReportLedgerFiles??[]).map(e=>`${o}/${F(e)}`)),O=g.filter(e=>D.has(e)),k=l?g.filter(e=>e.startsWith(`logs/`)&&!it(e)&&!T.has(e)):[],A=b.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],j=A.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...A]:[`Redaction was disabled for this bundle; file contents are unmodified.`],M=[`# Bug Report Bundle`,``,`Generated: ${C.generatedAt}`,`Project: ${l??`(unscoped)`}`,`Discipline version: ${C.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...k.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...k.map(e=>`- ${e}`),``]:[],...E.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...E.map(e=>`- ${e}`),``]:[],...b.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...b.map(e=>`- ${e}`),``]:[],...O.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...O.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,w>0?`${w} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...A,``,`This bundle is safe to attach to a GitHub issue.`]:j].join(`
|
|
1
|
+
import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{$u as t,Bs as n,Dn as r,Gl as i,In as a,On as o,ac as s,ic as c,lo as l,ns as u,ps as ee,sc as te}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{$i as d,Do as f,Eo as p,Hr as m,Jn as h,Jr as g,Oo as _,Qn as v,Rn as y,Tt as b,dr as x,ei as S,m as C,ni as w,ti as T,to as E,vi as D,wn as O,yi as k}from"./dist-BfGPmTI1.mjs";import{t as A}from"./yazl-BBz29IQN.mjs";import{ht as j,nt as M,rt as N}from"./init-YoVVaWK0.mjs";import{c as ne}from"./colors-r_owlCuY.mjs";import{l as P}from"./registry-probes-B_EoML_h.mjs";import{t as re}from"./is-object-BGze3w87.mjs";import{n as ie}from"./constants-DAaEKppY.mjs";import"./loader-CsbLLAav.mjs";import"./preview-C6QTJ0V1.mjs";import{execSync as ae,spawnSync as oe}from"node:child_process";import{basename as F,dirname as I,isAbsolute as se,join as L,relative as R,resolve as z,sep as B}from"node:path";import{closeSync as ce,cpSync as le,createWriteStream as ue,existsSync as V,lstatSync as de,mkdirSync as H,mkdtempSync as fe,openSync as pe,readFileSync as U,readSync as me,readdirSync as W,rmSync as G,rmdirSync as he,statSync as ge,writeFileSync as K}from"node:fs";import{arch as _e,freemem as ve,homedir as q,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";let De;function Oe(){return De}function ke(e,t){if(t!==void 0&&t.length>0)return t;try{return v(e)?.rootPath}catch{return}}function Ae(e){let t=ke(e.cwd,e.configuredProjectName),n=O({name:`cli`,project:t});return De=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}const je=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Me(e,t,n=v){if(e!==void 0&&!je.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ne=null;function Pe(e){Ne=e}function Fe(){return Ne??process.cwd()}const Ie=`Open Knowledge`;function Le(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return M(t).join(N({...e,platformName:t}),n)}function Re(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=M(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function ze(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Be(e){let t=L(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return ze(n)??[]}function Ve(e){let t=L(e,`state.json`);if(!V(t))return!1;try{return ze(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const He=8192;function Ue(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function We(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Ge=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ke(e){return e.replace(Ge,`$1"[REDACTED-DEVICE-ID]"`)}function qe(e){return Ke(We(e))}const Je=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Ye(e){if(typeof e!=`string`)return null;let t=Je.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function Xe(e){let t=pe(e,`r`);try{let e=Buffer.alloc(He),n=0,r=!1;for(;n<He;){let i=me(t,e,n,He-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{ce(t)}}function Ze(e){try{let t=Xe(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:Ye(a)}}catch{return{kind:`unreadable`}}}function Qe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function $e(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=W(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=L(e,t.name),r;try{r=ge(n).mtimeMs}catch{continue}if(r<i)continue;let c=Ze(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!Qe(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}function J(){return L(q(),`.ok`,`bug-reports`)}function et(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=J(),r=`${t}-bugreport`,i=L(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=L(n,`${r}-${e}.zip`);return i}function tt(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let e=U(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return V(L(e,`.ok`))?Ee(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function nt(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ae(`sw_vers -productVersion 2>/dev/null`,E({encoding:`utf8`})).trim()}catch{}try{let t=L(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const rt=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function it(e){let t=F(e);return rt.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function at(e,t){return lt(e,t).files}const ot=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function st(e,t=P){let n=L(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return ot.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>L(n,e.entry)))}function ct(e){if(!V(e))return[];try{let t=new Map;for(let n of W(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-r.length):n.slice(0,-5),i=t.get(e);i===void 0?t.set(e,[n]):i.push(n)}return[...t.values()].slice(-25).flat().map(t=>L(e,t))}catch{return[]}}function lt(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>L(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(it),i=[],a=r.filter(t=>{try{return U(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!it(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function ut(e){let t=L(e,`.ok`,`local`);return V(t)?{files:[`server.lock`,`last-spawn-error.log`,c].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function dt(e){let t=L(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function ft(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Ee(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function pt(e){let t=e.revealDocNames?e.content:ft(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=u(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function Y(e){for(let t of e.files)try{let n=U(t,`utf8`);pt({zipfile:e.zipfile,name:`${e.prefix}/${F(t)}`,content:t.endsWith(`.ips`)?qe(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function mt(t){let{redact:n,outputPath:r,logger:i}=t,s=t.revealDocNames??!1,c=t.userLogsDir??L(q(),`.ok`,`logs`),l=t.projectDir?tt(t.projectDir,i):null;H(I(r),{recursive:!0}),i?.info({projectSlug:l},`gathering diagnostic data`);let u=nt();u.desktop=t.desktop??null,u.language=t.language??null;let{files:ee,excludedByProjectSlug:te}=lt(l,c),{files:d}=t.projectDir?ut(t.projectDir):{files:[]},{files:f}=t.projectDir?dt(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:ee.length,logFilesExcludedByProjectSlug:te,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let h=[],g=[],{ZipFile:_}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),v=new _;Y({zipfile:v,files:[...ee,...p],prefix:`logs`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:d,prefix:`lockdir`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:f,prefix:`local-logs`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:t.bugReportLedgerFiles??[],prefix:o,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i}),Y({zipfile:v,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:s,bundleFiles:g,redactions:h,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??F(e.sourcePath)}`;v.addBuffer(t,n),g.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&pt({zipfile:v,name:`note.txt`,content:t.note,redact:n,revealDocNames:s,bundleFiles:g,redactions:h});let y=new Set(m.map(e=>`diagnostic-reports/${F(e)}`)),b=g.filter(e=>y.has(e)),x=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Ue(t.diagnosticReports,b.length);v.addBuffer(Buffer.from(`${x}\n`,`utf8`),`state/diagnostic-reports-status.txt`),g.push(`state/diagnostic-reports-status.txt`);let S=JSON.stringify(u,null,2);v.addBuffer(Buffer.from(S,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let C={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:l,files:g,redactions:h,sysinfo:u};v.addBuffer(Buffer.from(JSON.stringify(C,null,2),`utf8`),`MANIFEST.json`);let w=h.reduce((e,t)=>e+t.lineCount,0),T=new Set(p.map(e=>`logs/${F(e)}`)),E=g.filter(e=>T.has(e)),D=new Set((t.bugReportLedgerFiles??[]).map(e=>`${o}/${F(e)}`)),O=g.filter(e=>D.has(e)),k=l?g.filter(e=>e.startsWith(`logs/`)&&!it(e)&&!T.has(e)):[],A=b.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],j=A.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...A]:[`Redaction was disabled for this bundle; file contents are unmodified.`],M=[`# Bug Report Bundle`,``,`Generated: ${C.generatedAt}`,`Project: ${l??`(unscoped)`}`,`Discipline version: ${C.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...k.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...k.map(e=>`- ${e}`),``]:[],...E.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...E.map(e=>`- ${e}`),``]:[],...b.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...b.map(e=>`- ${e}`),``]:[],...O.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...O.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,w>0?`${w} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...A,``,`This bundle is safe to attach to a GitHub issue.`]:j].join(`
|
|
2
2
|
`);v.addBuffer(Buffer.from(M,`utf8`),`README.md`),v.end();let N=ue(r);return v.outputStream.pipe(N),await new Promise((e,t)=>{N.on(`close`,e),N.on(`error`,t)}),i?.info({bundlePath:r,fileCount:g.length,redactionCount:w},`bundle written`),{zipPath:r,summary:{projectSlug:l,files:g,redactions:h,redactedLineCount:w,generatedAt:C.generatedAt}}}var ht=i(),gt=e(A(),1),X=e(ne(),1);function _t(e){let t=_(`user`,e,e);return p({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function vt({home:e=q(),env:t=process.env}={}){let r=_t(e),{override:i,preferenceList:a}=f(t),{locale:o,source:s}=ee({override:i,storedPreference:r,supportedLocales:te,preferenceList:a,autoDetectableLocales:n});return{preference:r,locale:o,source:s,systemLanguages:a}}function yt(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function bt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e,t){if(typeof e==`string`)return yt(e,t.contentDir);if(Array.isArray(e))return e.map(e=>Z(e,t));if(!bt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Z(i,t);return n}function xt(e,t){let n=U(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
3
|
`),i=n.split(`
|
|
4
4
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=Z(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Qs as e,Uu as t,Zi as n,ds as r,eu as i,ms as a,pt as o,vo as s}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{E as c,Eo as l,Oo as u,Ur as d,_i as f,ei as p,ii as m,zo as h}from"./dist-BfGPmTI1.mjs";import{F as g,K as _,N as v,_t as y,b,gt as x,ht as S,ot as C,y as w}from"./init-
|
|
2
|
-
`)){let e=r.replace(ge,``),i=pe.exec(e)?.[1];if(i){n={login:i,active:!1},t.push(n);continue}if(me.test(e)){n=void 0;continue}n&&he.test(e)&&(n.active=!0)}return t}const ve={mode:`published`,skipAvailabilityCheck:!0,replaceEntry:!0};function K(){return{action:`failed`,errorId:`write-failed`}}function q(){return{action:`skipped-missing`,errorId:`surface-missing`}}function J(e,t,n){h(`agent-integrations-apply`).warn({editor:e,path:t,reason:n},`skill write failed`)}function Y(){return{action:`skipped-unsupported`,errorId:`no-writer`}}function ye(e){switch(e){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`left-foreign`:return{action:`skipped-foreign`,errorId:`foreign-artifact`};case`declined`:return{action:`declined`,errorId:`write-declined`}}}async function be(e,t,n){if(_[e].scope!==`global`)return q();if(n===`absent`)return ye(A(_[e],``,t.home).kind);let r=(await b({editors:[e],home:t.home,replaceEntry:!0})).find(t=>t.editorId===e);if(r===void 0)return K();switch(r.action){case`written`:case`overwritten`:return{action:r.action};case`declined`:return{action:`declined`,errorId:`write-declined`};case`skipped-missing`:return q();case`skipped-flag`:return Y();default:return K()}}function xe(e,n,r){let i=t[e];if(i===null)return q();let a=re(n.cwd,i);if(r===`absent`)return ye(A(_[e],n.cwd,void 0,a).kind);let o=w(_[e],n.cwd,ve,void 0,a);switch(o.action){case`written`:case`overwritten`:return{action:o.action};case`declined`:return{action:`declined`,errorId:`write-declined`};default:return K()}}function Se(e,t,n){let r=t.home??ae();if(n===`absent`){let t=M(e,r);switch(t.action){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`skipped-unsupported`:return q();case`failed`:return J(e,t.path,t.error),K()}}let i=T(e,r);switch(i.action){case`written`:return{action:`written`};case`overwritten`:return{action:`overwritten`};case`skipped-unsupported`:return q();case`failed`:return J(e,i.path,i.error),K()}}function Ce(e,t,n){if(n===`absent`){let n=v(_[e],t.cwd);switch(n.action){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`skipped-unsupported`:return q();case`failed`:return J(e,n.path,n.error),K()}}let r=g(_[e],t.cwd);switch(r.action){case`written`:return{action:`written`};case`overwritten`:return{action:`overwritten`};case`skipped-unsupported`:return q();case`skipped-prerequisite`:return{action:`skipped-prerequisite`,errorId:`dependency-failed`};case`failed`:return J(e,r.path,r.error),K()}}function we(e){return t=>{if(t.pathId===void 0)return Y();let n=i(t.pathId);if(n===null||n.kind===`central-skill-store`)return Y();switch(n.kind){case`editor-user-config`:return be(n.editor,e,t.desired);case`editor-project-config`:return xe(n.editor,e,t.desired);case`editor-project-skill-root`:return Ce(n.editor,e,t.desired);case`editor-user-skill-root`:return Se(n.editor,e,t.desired)}}}function Te(e,t){return e.bind?.[0]??t.HOST??`127.0.0.1`}function Ee(e){if(e===`server`)return e;throw new x(`--only must be 'server'`)}function De(e=V){let t=import.meta.dirname??new URL(`.`,import.meta.url).pathname;return[B(t,`public`),B(t,`../../app/dist`),B(t,`../../../app/dist`)].find(t=>e(t))}function Oe(e){if(e.explicitDir!==void 0)return{dir:e.explicitDir,missingBundle:!1};if(e.only===`server`)return{dir:void 0,missingBundle:!1};let t=e.findBundledDir();return{dir:t,missingBundle:t===void 0}}function ke(t){if(t===`off`)return`off`;if(!e.test(t))throw new x(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return t}function Ae(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function je(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function Me(e){return!e.openBrowser||e.ephemeral||e.only===`server`||!e.servesUi?!1:(e.explicitOn||Ae(e.host))&&e.isTTY}function Ne(e,t){let n;try{n=new URL(t)}catch{throw new x(`${e} is not a valid URL: ${t}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new x(`${e} must be an http(s) origin (got: ${t})`);return t}function Pe(e){return Ne(`--external-url`,e)}function Fe(e){let t=R(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var X=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}},Z=class extends Error{projectDir;constructor(e){super(`--project-dir must be a throwaway ${c}* directory under the OS temp dir. Refusing to write ephemeral session state into ${e}. Omit --project-dir to let ok start create (and clean up) its own.`),this.name=`EphemeralProjectDirNotThrowawayError`,this.projectDir=e}};function Q(e,t={}){let n=t.tmpdirFn??oe,r=t.realpathFn??ie,i=e=>{try{return r(e)}catch(t){return t.code===`ENOENT`?B(e):null}},a=B(e),o;try{o=r(a)}catch(e){if(e.code===`ENOENT`){let e=i(z(a));o=e===null?null:B(e,R(a))}else o=null}if(o===null)return!1;let s=i(n());return s!==null&&z(o)===s&&R(o).startsWith(`ok-ephemeral-`)}function Ie(e,t,n=e=>se(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{if(Q(t))try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}else process.stderr.write(`[start] leaving ${t} in place: only ${c}* dirs under the OS temp dir are removed on ephemeral teardown\n`)}}}function Le(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function $(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:o,mkdirSync:s}=await import(`node:fs`),{basename:c,dirname:l,resolve:u}=await import(`node:path`),{bootServer:p,createEphemeralProjectDir:h,getLogger:g,resolveContentDir:_,resolveLockDir:v,seedEphemeralProjectDir:y,waitForServerLockDrain:b}=await import(`./dist-Ct3NR8HA.mjs`),x=e.log??g(`start`),S=e.singleFile!==void 0,w=S?f(e.singleFile).canonicalFilePath:void 0,T=w?l(w):void 0,D=w?c(w):void 0,O,A=!1;if(T!==void 0){if(e.projectDir!==void 0){if(O=e.projectDir,!Q(O))throw new Z(O);o(u(O,`.ok`,`config.yml`))||y(O,T)}else O=h(T),A=!0}let j=async()=>{if(!(!A||O===void 0)){if(!Q(O)){x.warn({ephemeralProjectDir:O},`[start] refusing to reap self-provisioned ephemeral dir: no longer resolves to an ok-ephemeral-* temp dir`);return}try{await se(O,{recursive:!0,force:!0})}catch(e){x.warn({err:e,ephemeralProjectDir:O},`[start] failed to reap self-provisioned ephemeral temp dir`)}}},M=O;if(!S){if(!i&&!d(n))throw new X(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{e.severity===`info`?x.debug({event:e},`[start] reclaim sweep event`):x.warn({event:e},`[start] reclaim sweep reported a problem`)};try{let i=(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-D0p5PIEd.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r}).outcomes.filter(e=>e.outcome!==`no-entry`&&e.outcome!==`canonical`&&e.outcome!==`repaired`&&e.outcome!==`foreign`);i.length>0&&x.warn({unhealed:i},`[start] reclaim sweep left entries it could not heal`)}catch(e){x.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-C4xKPQnT.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){x.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}}let P=T??_(t,n);!S&&!o(P)&&(s(P,{recursive:!0}),x.info({contentDir:P},`Created content directory`));let ne=F(),I=m(),L;try{{let e=v(O??n),t=Date.now(),r=await b(e);r!==`no-drain`&&x.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}L=await p({config:t,contentDir:P,projectDir:O??n,contentRoot:S?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:H,detectGhAccounts:de,tokenStore:ne,embeddingsKeyStore:I,mcpTomlEditor:C(),...S?{ephemeral:!0,singleDocRelPath:D,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>k(e,t),probePiAcpBridge:e=>E(e),ensurePiAcpBridge:e=>N(e),agentIntegrations:(()=>{let e={cwd:O??n,home:ae()};return{probe:te(e),execute:we(e),userSkillPresentAnywhere:ee}})(),idleShutdownMs:a,...e.serverRuntime===void 0?{}:{serverRuntime:e.serverRuntime},...e.bind===void 0?{}:{bind:e.bind},skipAutoInit:!0,idleShutdownHandler:t=>{let n=t;return Le(M===void 0?n:Ie(n,M),{log:x,exit:e.idleExit})},log:x,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}})}catch(e){throw await j(),e}let R=L.destroy,z=A?async()=>{try{await R()}finally{await j()}}:R;return{httpServer:L.httpServer,destroy:z,lockDir:L.lockDir,contentDir:P,port:L.port,ready:L.ready,degraded:L.degraded}}function Re(e,t,n=()=>l({absPath:u(`user`,process.cwd()),sideline:!1,warn:()=>{}}).value){return t===void 0?e:n()}function ze(e){if(e===`browser`||e===`app`)return e;throw new x(`--mode must be 'browser' or 'app'`)}function Be(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Ve(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function He(e,t){let i=Re(e,t.singleFile),c=Be(process.env);c!==null&&(process.env.OK_CONSOLE_LEVEL=c);let{renderBanner:l}=await import(`./banner-kywHhVaC.mjs`),{accent:u,dim:d,error:f,warning:p}=await import(`./colors-SgU3JHQu.mjs`),m=process.cwd();process.title=Fe(m);let h;try{h=r(process.env)}catch(e){throw e instanceof o&&(console.error(f(e.message)),process.exit(78)),e}for(let e of h.diagnostics)console.warn(p(`[config] ${e.message}`));let g=n(i,h.layer),_=h.overrides.some(e=>e.envVar===`OK_BIND`),v=t.bind!==void 0&&t.bind.length>0?t.bind:void 0,y=process.env.HOST,b=y!==void 0&&y.trim()!==``?y:void 0,x=a(g),S=v??(_||b===void 0?[...x.bind]:[b]);je({flagBindSet:v!==void 0,okBindSet:_,hostEnvSet:b!==void 0,fileBindCount:x.bind.length})&&console.warn(p(`[config] HOST=${b} overrides server.bind — dropping the file-configured addresses (${x.bind.join(`, `)}). Use OK_BIND with a space-separated list to keep multiple binds.`));let C=S[0]??`127.0.0.1`,w=S,T=t.externalUrl,E=a(n(g,{server:{bind:w,...T===void 0?{}:{externalUrl:T}}}));if(E.allowExternal&&(!E.loopbackOnly||E.externalUrl)){let e=E.externalUrl??E.bind.join(`, `);console.warn(p([``,`⚠ EXTERNAL ACCESS ENABLED (server.allowExternal) — no server-side authentication.`,` This server is reachable beyond this machine (${e}). Anyone who can`,` reach it has FULL control of this knowledge base — sync, publishing, GitHub`,` credentials, and local operations (clone, sign-in, repo spawn).`,` Restrict who can reach it at the edge: a Tailscale ACL, a reverse proxy with`,` auth (Cloudflare Access, oauth2-proxy), or a firewall.`,``].join(`
|
|
1
|
+
import{Qs as e,Uu as t,Zi as n,ds as r,eu as i,ms as a,pt as o,vo as s}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{E as c,Eo as l,Oo as u,Ur as d,_i as f,ei as p,ii as m,zo as h}from"./dist-BfGPmTI1.mjs";import{F as g,K as _,N as v,_t as y,b,gt as x,ht as S,ot as C,y as w}from"./init-YoVVaWK0.mjs";import{a as T,c as E,d as D,f as O,i as ee,n as k,o as A,p as j,r as M,s as N,t as te,u as P,v as F}from"./registry-probes-B_EoML_h.mjs";import{n as ne}from"./constants-DAaEKppY.mjs";import{execFileSync as I,spawn as L}from"node:child_process";import{basename as R,dirname as z,join as re,resolve as B}from"node:path";import{existsSync as V,realpathSync as ie}from"node:fs";import{homedir as ae,tmpdir as oe}from"node:os";import{rm as se}from"node:fs/promises";import{setTimeout as ce}from"node:timers/promises";const le=[`/opt/homebrew/bin/gh`,`/usr/local/bin/gh`,`/opt/local/bin/gh`,`/snap/bin/gh`,`/usr/bin/gh`],ue={encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`],timeout:5e3,windowsHide:!0};function H(e,t={}){let{login:n}=t,r=t._exec??I,i=U(t._fileExists??V),a=e?[`--hostname`,e]:[];if(n){let e=W(r,i,[`auth`,`token`,...a,`--user`,n]);if(e)return{available:!0,token:e,resolvedLogin:n,fallback:!1}}let o=W(r,i,[`auth`,`token`,...a]);return o?n?{available:!0,token:o,fallback:!0}:{available:!0,token:o}:{available:!1}}function U(e){return[`gh`,...le.filter(e)]}function W(e,t,n){for(let r of t)try{let t=e(r,n,ue).toString().trim();if(t.length>0)return t}catch{}}function de(e,t={}){let n=t._exec??I,r=U(t._fileExists??V),i=[`auth`,`status`,...e?[`--hostname`,e]:[]],a=W(n,r,[...i,`--json`,`hosts`]);if(a!==void 0){let t=fe(a,e);if(t)return t}let o=W(n,r,i);if(o!==void 0){let e=_e(o);if(e.length>0)return e}}function G(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function fe(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=G(G(n)?.hosts);if(!r||t!==void 0&&r[t]===void 0)return;let i=t===void 0?Object.values(r):[r[t]],a=[];for(let e of i){if(!Array.isArray(e))return;for(let t of e){let e=G(t);if(!e)continue;let n=e.login;typeof n==`string`&&n.length!==0&&a.push({login:n,active:e.active===!0})}}return a}const pe=/Logged in to \S+ account (\S+) \(/,me=/(?:Failed to log in to|Timeout trying to log in to) \S+/,he=/^\s*-\s*Active account:\s*true\s*$/,ge=/\u001b\[[0-9;]*m/g;function _e(e){let t=[],n;for(let r of e.split(`
|
|
2
|
+
`)){let e=r.replace(ge,``),i=pe.exec(e)?.[1];if(i){n={login:i,active:!1},t.push(n);continue}if(me.test(e)){n=void 0;continue}n&&he.test(e)&&(n.active=!0)}return t}const ve={mode:`published`,skipAvailabilityCheck:!0,replaceEntry:!0};function K(){return{action:`failed`,errorId:`write-failed`}}function q(){return{action:`skipped-missing`,errorId:`surface-missing`}}function J(e,t,n){h(`agent-integrations-apply`).warn({editor:e,path:t,reason:n},`skill write failed`)}function Y(){return{action:`skipped-unsupported`,errorId:`no-writer`}}function ye(e){switch(e){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`left-foreign`:return{action:`skipped-foreign`,errorId:`foreign-artifact`};case`declined`:return{action:`declined`,errorId:`write-declined`}}}async function be(e,t,n){if(_[e].scope!==`global`)return q();if(n===`absent`)return ye(A(_[e],``,t.home).kind);let r=(await b({editors:[e],home:t.home,replaceEntry:!0})).find(t=>t.editorId===e);if(r===void 0)return K();switch(r.action){case`written`:case`overwritten`:return{action:r.action};case`declined`:return{action:`declined`,errorId:`write-declined`};case`skipped-missing`:return q();case`skipped-flag`:return Y();default:return K()}}function xe(e,n,r){let i=t[e];if(i===null)return q();let a=re(n.cwd,i);if(r===`absent`)return ye(A(_[e],n.cwd,void 0,a).kind);let o=w(_[e],n.cwd,ve,void 0,a);switch(o.action){case`written`:case`overwritten`:return{action:o.action};case`declined`:return{action:`declined`,errorId:`write-declined`};default:return K()}}function Se(e,t,n){let r=t.home??ae();if(n===`absent`){let t=M(e,r);switch(t.action){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`skipped-unsupported`:return q();case`failed`:return J(e,t.path,t.error),K()}}let i=T(e,r);switch(i.action){case`written`:return{action:`written`};case`overwritten`:return{action:`overwritten`};case`skipped-unsupported`:return q();case`failed`:return J(e,i.path,i.error),K()}}function Ce(e,t,n){if(n===`absent`){let n=v(_[e],t.cwd);switch(n.action){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`skipped-unsupported`:return q();case`failed`:return J(e,n.path,n.error),K()}}let r=g(_[e],t.cwd);switch(r.action){case`written`:return{action:`written`};case`overwritten`:return{action:`overwritten`};case`skipped-unsupported`:return q();case`skipped-prerequisite`:return{action:`skipped-prerequisite`,errorId:`dependency-failed`};case`failed`:return J(e,r.path,r.error),K()}}function we(e){return t=>{if(t.pathId===void 0)return Y();let n=i(t.pathId);if(n===null||n.kind===`central-skill-store`)return Y();switch(n.kind){case`editor-user-config`:return be(n.editor,e,t.desired);case`editor-project-config`:return xe(n.editor,e,t.desired);case`editor-project-skill-root`:return Ce(n.editor,e,t.desired);case`editor-user-skill-root`:return Se(n.editor,e,t.desired)}}}function Te(e,t){return e.bind?.[0]??t.HOST??`127.0.0.1`}function Ee(e){if(e===`server`)return e;throw new x(`--only must be 'server'`)}function De(e=V){let t=import.meta.dirname??new URL(`.`,import.meta.url).pathname;return[B(t,`public`),B(t,`../../app/dist`),B(t,`../../../app/dist`)].find(t=>e(t))}function Oe(e){if(e.explicitDir!==void 0)return{dir:e.explicitDir,missingBundle:!1};if(e.only===`server`)return{dir:void 0,missingBundle:!1};let t=e.findBundledDir();return{dir:t,missingBundle:t===void 0}}function ke(t){if(t===`off`)return`off`;if(!e.test(t))throw new x(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return t}function Ae(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function je(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function Me(e){return!e.openBrowser||e.ephemeral||e.only===`server`||!e.servesUi?!1:(e.explicitOn||Ae(e.host))&&e.isTTY}function Ne(e,t){let n;try{n=new URL(t)}catch{throw new x(`${e} is not a valid URL: ${t}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new x(`${e} must be an http(s) origin (got: ${t})`);return t}function Pe(e){return Ne(`--external-url`,e)}function Fe(e){let t=R(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var X=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}},Z=class extends Error{projectDir;constructor(e){super(`--project-dir must be a throwaway ${c}* directory under the OS temp dir. Refusing to write ephemeral session state into ${e}. Omit --project-dir to let ok start create (and clean up) its own.`),this.name=`EphemeralProjectDirNotThrowawayError`,this.projectDir=e}};function Q(e,t={}){let n=t.tmpdirFn??oe,r=t.realpathFn??ie,i=e=>{try{return r(e)}catch(t){return t.code===`ENOENT`?B(e):null}},a=B(e),o;try{o=r(a)}catch(e){if(e.code===`ENOENT`){let e=i(z(a));o=e===null?null:B(e,R(a))}else o=null}if(o===null)return!1;let s=i(n());return s!==null&&z(o)===s&&R(o).startsWith(`ok-ephemeral-`)}function Ie(e,t,n=e=>se(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{if(Q(t))try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}else process.stderr.write(`[start] leaving ${t} in place: only ${c}* dirs under the OS temp dir are removed on ephemeral teardown\n`)}}}function Le(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function $(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:o,mkdirSync:s}=await import(`node:fs`),{basename:c,dirname:l,resolve:u}=await import(`node:path`),{bootServer:p,createEphemeralProjectDir:h,getLogger:g,resolveContentDir:_,resolveLockDir:v,seedEphemeralProjectDir:y,waitForServerLockDrain:b}=await import(`./dist-Ct3NR8HA.mjs`),x=e.log??g(`start`),S=e.singleFile!==void 0,w=S?f(e.singleFile).canonicalFilePath:void 0,T=w?l(w):void 0,D=w?c(w):void 0,O,A=!1;if(T!==void 0){if(e.projectDir!==void 0){if(O=e.projectDir,!Q(O))throw new Z(O);o(u(O,`.ok`,`config.yml`))||y(O,T)}else O=h(T),A=!0}let j=async()=>{if(!(!A||O===void 0)){if(!Q(O)){x.warn({ephemeralProjectDir:O},`[start] refusing to reap self-provisioned ephemeral dir: no longer resolves to an ok-ephemeral-* temp dir`);return}try{await se(O,{recursive:!0,force:!0})}catch(e){x.warn({err:e,ephemeralProjectDir:O},`[start] failed to reap self-provisioned ephemeral temp dir`)}}},M=O;if(!S){if(!i&&!d(n))throw new X(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{e.severity===`info`?x.debug({event:e},`[start] reclaim sweep event`):x.warn({event:e},`[start] reclaim sweep reported a problem`)};try{let i=(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-ngiQYYLV.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r}).outcomes.filter(e=>e.outcome!==`no-entry`&&e.outcome!==`canonical`&&e.outcome!==`repaired`&&e.outcome!==`foreign`);i.length>0&&x.warn({unhealed:i},`[start] reclaim sweep left entries it could not heal`)}catch(e){x.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-DcTw2dub.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){x.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}}let P=T??_(t,n);!S&&!o(P)&&(s(P,{recursive:!0}),x.info({contentDir:P},`Created content directory`));let ne=F(),I=m(),L;try{{let e=v(O??n),t=Date.now(),r=await b(e);r!==`no-drain`&&x.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}L=await p({config:t,contentDir:P,projectDir:O??n,contentRoot:S?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:H,detectGhAccounts:de,tokenStore:ne,embeddingsKeyStore:I,mcpTomlEditor:C(),...S?{ephemeral:!0,singleDocRelPath:D,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>k(e,t),probePiAcpBridge:e=>E(e),ensurePiAcpBridge:e=>N(e),agentIntegrations:(()=>{let e={cwd:O??n,home:ae()};return{probe:te(e),execute:we(e),userSkillPresentAnywhere:ee}})(),idleShutdownMs:a,...e.serverRuntime===void 0?{}:{serverRuntime:e.serverRuntime},...e.bind===void 0?{}:{bind:e.bind},skipAutoInit:!0,idleShutdownHandler:t=>{let n=t;return Le(M===void 0?n:Ie(n,M),{log:x,exit:e.idleExit})},log:x,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}})}catch(e){throw await j(),e}let R=L.destroy,z=A?async()=>{try{await R()}finally{await j()}}:R;return{httpServer:L.httpServer,destroy:z,lockDir:L.lockDir,contentDir:P,port:L.port,ready:L.ready,degraded:L.degraded}}function Re(e,t,n=()=>l({absPath:u(`user`,process.cwd()),sideline:!1,warn:()=>{}}).value){return t===void 0?e:n()}function ze(e){if(e===`browser`||e===`app`)return e;throw new x(`--mode must be 'browser' or 'app'`)}function Be(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Ve(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function He(e,t){let i=Re(e,t.singleFile),c=Be(process.env);c!==null&&(process.env.OK_CONSOLE_LEVEL=c);let{renderBanner:l}=await import(`./banner-kywHhVaC.mjs`),{accent:u,dim:d,error:f,warning:p}=await import(`./colors-SgU3JHQu.mjs`),m=process.cwd();process.title=Fe(m);let h;try{h=r(process.env)}catch(e){throw e instanceof o&&(console.error(f(e.message)),process.exit(78)),e}for(let e of h.diagnostics)console.warn(p(`[config] ${e.message}`));let g=n(i,h.layer),_=h.overrides.some(e=>e.envVar===`OK_BIND`),v=t.bind!==void 0&&t.bind.length>0?t.bind:void 0,y=process.env.HOST,b=y!==void 0&&y.trim()!==``?y:void 0,x=a(g),S=v??(_||b===void 0?[...x.bind]:[b]);je({flagBindSet:v!==void 0,okBindSet:_,hostEnvSet:b!==void 0,fileBindCount:x.bind.length})&&console.warn(p(`[config] HOST=${b} overrides server.bind — dropping the file-configured addresses (${x.bind.join(`, `)}). Use OK_BIND with a space-separated list to keep multiple binds.`));let C=S[0]??`127.0.0.1`,w=S,T=t.externalUrl,E=a(n(g,{server:{bind:w,...T===void 0?{}:{externalUrl:T}}}));if(E.allowExternal&&(!E.loopbackOnly||E.externalUrl)){let e=E.externalUrl??E.bind.join(`, `);console.warn(p([``,`⚠ EXTERNAL ACCESS ENABLED (server.allowExternal) — no server-side authentication.`,` This server is reachable beyond this machine (${e}). Anyone who can`,` reach it has FULL control of this knowledge base — sync, publishing, GitHub`,` credentials, and local operations (clone, sign-in, repo spawn).`,` Restrict who can reach it at the edge: a Tailscale ACL, a reverse proxy with`,` auth (Cloudflare Access, oauth2-proxy), or a firewall.`,``].join(`
|
|
3
3
|
`)))}let D=t.port===void 0?void 0:Number(t.port),O=h.overrides.find(e=>e.envVar===`PORT`)?.value,ee=D??O??i.server?.port,k=Oe({explicitDir:t.reactShellDistDir,only:t.only,findBundledDir:De}),A=k.dir;k.missingBundle&&console.warn(`bundled web UI not found — serving /api and /mcp only. Reinstall @inkeep/open-knowledge, or build packages/app in a source checkout.`);let j;try{j=await $({config:i,cwd:m,host:C,port:ee,bind:w,...t.serveContentAssets===void 0?{}:{serveContentAssets:t.serveContentAssets},...A?{reactShellDistDir:A}:{},idleThresholdMs:s(t.idleShutdown??E.idleShutdown),serverRuntime:E,...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof X&&(console.error(f(e.message)),process.exit(1)),e instanceof Z&&(console.error(f(e.message)),process.exit(1));let t=await import(`./dist-Ct3NR8HA.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),e instanceof t.ExposureConsentError&&(console.error(f(e.message)),process.exit(78)),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(f(e.message)),process.exit(1)),e instanceof t.MissingOkConfigError&&(console.error(f(e.message)),process.exit(1)),Ge(e,t)){let e=t.resolveLockDir(m),n=null;try{n=await Ue({readServerLock:()=>t.readServerLock(e),now:Date.now,sleep:e=>ce(e),timeoutMs:3e3,pollIntervalMs:50})}catch(e){process.stderr.write(`[start] spawn-or-reuse: lock poll failed (${e instanceof Error?e.message:String(e)}) — falling back to the collision message\n`)}if(n!==null){let[e,...t]=We(n);console.log(u(e));for(let e of t)console.log(d(e));process.exit(0)}}let n=Ke(e,m,t);n!==null&&(console.error(f(n)),process.exit(1)),console.error(`${f(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let M=!1,N=async e=>{if(M)return;M=!0;let[t,...n]=Ve(e);console.log(u(`\n${t}`));for(let e of n)console.log(d(` ${e}`));try{await j.destroy(`external-signal`)}catch(e){console.error(`${f(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{N(`SIGINT`)}),process.once(`SIGTERM`,()=>{N(`SIGTERM`)});let te=`http://${C.includes(`:`)&&!C.startsWith(`[`)?`[${C}]`:C}:${j.port}`,P=C===`0.0.0.0`||C===`::`?`http://0.0.0.0:${j.port}`:void 0,F=te;console.log(l({name:`open-knowledge`,version:ne,localUrl:F,networkUrl:P,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let I={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};j.ready.then(async()=>{if(j.degraded.length>0){console.log();for(let e of j.degraded){let t=I[e]??`${e} (check server logs for details)`;console.warn(` ${p(`⚠`)} ${p(e)}: ${d(t)}`)}console.log()}if(Me({openBrowser:t.openBrowser!==!1&&E.openBrowser,explicitOn:t.openBrowser!==!1&&g.server?.openBrowser===!0,host:C,isTTY:process.stdout.isTTY===!0,ephemeral:t.singleFile!==void 0,only:t.only,servesUi:A!==void 0})){let{openBrowser:e}=await import(`./open-browser-rcp8z_R5.mjs`);e(F)}}).catch(e=>{console.error(` ${f(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}async function Ue(e){let t=e.now()+e.timeoutMs,n=e.readServerLock();for(;n!==null&&n.draining!==!0&&n.port<=0&&e.now()<t;)await e.sleep(e.pollIntervalMs),n=e.readServerLock();return n===null||n.draining===!0||n.port<=0?null:p(n)&&n.url!==void 0?{url:n.url,kind:n.kind,pid:n.pid,servesUi:!0}:{url:n.url??`http://127.0.0.1:${n.port}`,kind:n.kind,pid:n.pid,servesUi:!1}}function We(e){return[`${e.kind===`mcp-spawned`?`An MCP-spawned OpenKnowledge server is already running on this project`:`OpenKnowledge is already running on this project`} (pid ${e.pid}).`,` ${e.url}`,"Leaving it running — run `ok stop` first if you want a fresh server."]}function Ge(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function Ke(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=n.readServerLock(n.resolveLockDir(t));return e&&e.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function qe(e){return new S(`start`).description(`Start the OpenKnowledge server (UI + API + MCP + collab on one port)`).option(`-p, --port <port>`,`Server port`,void 0).option(`--bind <address>`,`Bind address (repeatable; default 127.0.0.1 — loopback only)`,(e,t)=>[...t??[],e]).option(`--no-open-browser`,`Do not open the browser after start (interactive loopback starts open it by default)`).option(`--only <module>`,`Serve one module: 'server' (API + MCP only, no shell or browser)`,Ee).option(`--idle-shutdown <duration>`,`Shut the server down after this long with no connected clients ('off', or a duration like 90s, 30m, 2h; default 30m)`,ke).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,ze).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path>`).addOption(new y(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).hideHelp()).addOption(new y(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).hideHelp()).option(`--external-url <url>`,`Canonical external origin clients dial (sets server.externalUrl for this run) — its host joins the Host/Origin allowlists (CORS + external-Host admission). External exposure additionally requires consent (OK_ALLOW_EXTERNAL=1 or server.allowExternal).`,Pe).action(async t=>{let n=e();if(t.only===`server`&&t.reactShellDistDir!==void 0&&(process.stderr.write(`error: option '--only server' cannot be combined with '--react-shell-dist-dir'
|
|
4
4
|
`),process.exit(2)),t.projectDir!==void 0&&t.singleFile===void 0&&(process.stderr.write(`error: option '--project-dir' requires '--single-file'
|
|
5
5
|
`),process.exit(2)),t.mode===`app`){let e=[];if(t.port!==void 0&&e.push(`--port`),t.bind!==void 0&&e.push(`--bind`),t.only!==void 0&&e.push(`--only`),t.idleShutdown!==void 0&&e.push(`--idle-shutdown`),t.openBrowser===!1&&e.push(`--no-open-browser`),t.externalUrl!==void 0&&e.push(`--external-url`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=D(P());if(n.available){O({spawn:L},n);return}console.error(j(n.reason)),process.exit(1)}await He(n,t)})}export{Ke as C,de as D,H as E,qe as S,Le as T,Be as _,We as a,Me as b,Q as c,ke as d,Ee as f,Re as g,Ue as h,Fe as i,Ge as l,Te as m,X as n,Ve as o,De as p,$ as r,Ae as s,Z as t,Pe as u,Oe as v,Ie as w,je as x,He as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,m as t,p as n,r}from"./start-C201LWw_.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|