@inkeep/open-knowledge 0.48.0-beta.2 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-DgjLEALo.mjs → acp-harness-probe-ctlLmc6O.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-Bc6SmMHz.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BNMJDizk.mjs +1 -0
- package/dist/{init-DKGnIaVq.mjs → init-D7RfHtp_.mjs} +3 -3
- package/dist/{launch-json-removal-DaoUddem.mjs → launch-json-removal-DphNv7be.mjs} +2 -2
- package/dist/{loader-B5E-OO52.mjs → loader-BtbydYPt.mjs} +2 -2
- package/dist/loader-C5LD3Ds_.mjs +1 -0
- package/dist/{preview-CKl5PSpe.mjs → preview-CAWFRCJt.mjs} +2 -2
- package/dist/preview-CyyocNeQ.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-8B7wGd5y.js → ActivityModeContent-C3ip7dNC.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BeWRgbnA.js → AgentDiffPane-Wi29jCni.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-Bb-re-nG.js → ChangedOutsideBadge-C0FXh0Oi.js} +1 -1
- package/dist/public/assets/{DocumentContext-CcK-mNAi.js → DocumentContext-CP7yqH5z.js} +20 -20
- package/dist/public/assets/FeedbackForm-DVcz7TWB.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-CyLMLgQN.js → ImportSkillDialog-JqA7a0sU.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DwV7emUI.js → ManagedArtifactProperties-B0bIS4IP.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-d28y4KXb.js +1 -0
- package/dist/public/assets/{SessionsHost-DCZv6SXD.js → SessionsHost-CFGRv_pY.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-BegCUhJP.js → SettingsDialogBody-D_1DunuR.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-CKBT36Fc.js → SkillToolbarControls-DvoPtfHF.js} +1 -1
- package/dist/public/assets/{SourceEditor-OE-lSW6p.js → SourceEditor-CeQc0tTS.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BAn1bShz.js → TerminalWindowApp-CPjZ5xvY.js} +1 -1
- package/dist/public/assets/{ThreadView-CklwWwdl.js → ThreadView-CPLWVyZk.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-R2I1Oytb.js → TimelineDiffPane-CH9Paxeb.js} +1 -1
- package/dist/public/assets/{agent-diff-store-BABq_wfE.js → agent-diff-store-c2pI-IqS.js} +1 -1
- package/dist/public/assets/{auth-state-cache-B-pK5XlG.js → auth-state-cache-khzbb5gf.js} +1 -1
- package/dist/public/assets/{comment-chips-DhFlg6Lg.js → comment-chips-GFaq2hJN.js} +1 -1
- package/dist/public/assets/{follow-file-Ad0qyANw.js → follow-file-Dlt39wWC.js} +1 -1
- package/dist/public/assets/globals-C_5FVIC1.css +1 -0
- package/dist/public/assets/{globals-CGSd7dgM.js → globals-i3eL0jPG.js} +1 -1
- package/dist/public/assets/{index-D7Hnjtop.js → index-CUE-YCY2.js} +7 -7
- package/dist/public/assets/{selection-context-CojvRwo6.js → selection-context-BN5sWQOX.js} +1 -1
- package/dist/public/assets/{skill-actions-BVQGnmjM.js → skill-actions-gJbOdqsR.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DCq4EEJa.js → typing-burst-detector-CG82yzgN.js} +1 -1
- package/dist/public/assets/{uninstall-oyd1jRGx.js → uninstall-Baseq7_l.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BPsAzeX7.js → use-activity-panel-jx8Sg0rQ.js} +1 -1
- package/dist/public/assets/{use-open-skill-Ljj3_grf.js → use-open-skill-BH3vfRE3.js} +1 -1
- package/dist/public/assets/{use-skill-directory-Ie653N2P.js → use-skill-directory-DTKROB4o.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-s1PlK0BB.js → use-timeline-entry-diff-CdswgYxP.js} +1 -1
- package/dist/public/index.html +15 -15
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-D2WeY50Y.mjs → repair-launch-json-Bk6eqKiY.mjs} +2 -2
- package/dist/{repair-mcp-configs-BJ9v8T7k.mjs → repair-mcp-configs-fC8b4vo_.mjs} +2 -2
- package/dist/{src-CmzmL097.mjs → src-DRhXUMyd.mjs} +2 -2
- package/dist/start-DCnM5DfI.mjs +1 -0
- package/dist/{start-DT_8Fr-l.mjs → start-DKwEh9gC.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-uLxFyV1-.mjs +0 -2
- package/dist/init-mzZ0flqJ.mjs +0 -1
- package/dist/loader-BHzsvYfj.mjs +0 -1
- package/dist/preview-jJpFrlNd.mjs +0 -1
- package/dist/public/assets/FeedbackForm-1y4YvRvd.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CbgN40D5.js +0 -1
- package/dist/public/assets/globals-rA-7Xs6l.css +0 -1
- package/dist/start-BYT6GfDm.mjs +0 -1
package/dist/public/assets/{use-activity-panel-BPsAzeX7.js → use-activity-panel-jx8Sg0rQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{i as t}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{i as t}from"./DocumentContext-CP7yqH5z.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{A as i}from"./CodeMirrorPropInput-BQoCzCdy.js";import{i as a,mt as o,r as s}from"./dist-D0lKV18u2.js";import{d as c}from"./documents-events-CZXYlWJs.js";import{n as l}from"./agent-presence-C8KjkxgZ.js";import{t as u}from"./lru-string-cache-jJ5hyYK1.js";var d=r(),f=e(n(),1),p=500,m=64;async function h(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new i(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=o.safeParse(r);throw e.success?Error(e.data.title):new i(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let a=s.safeParse(r);if(!a.success)throw new i(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:a.error,status:n.status});return a.data}async function g(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&keptCount=${n}`,s=await fetch(r),c;try{c=await s.json()}catch(e){throw new i(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:s.status})}if(!s.ok){let e=o.safeParse(c);throw e.success?Error(e.data.title):new i(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:s.status})}let l=a.safeParse(c);if(!l.success)throw new i(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:l.error,status:s.status});let{diff:u,before:d,after:f}=l.data;return{diff:u,before:d,after:f}}function _(e){let n=(0,d.c)(23),{systemProvider:r}=t(),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(`idle`),[l,_]=(0,f.useState)(null),b;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new u(m),n[0]=b):b=n[0];let x=(0,f.useRef)(b),S=(0,f.useRef)(0),C;n[1]===r?C=n[2]:(C=e=>{let t=S.current+=1;s(`loading`),_(null),h(e).then(n=>{if(S.current!==t)return;let i=y(r,e);a({...n,writingDocs:i}),s(`ready`)}).catch(e=>{S.current===t&&(_(e instanceof Error?e.message:String(e)),s(`error`))})},n[1]=r,n[2]=C);let w=C,T;n[3]!==e||n[4]!==w?(T=()=>{if(!e){S.current+=1,a(null),s(`idle`),_(null),x.current.clear();return}x.current.clear(),w(e);let t=null,n=c(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,w(e)},p))});return()=>{t&&clearTimeout(t),n()}},n[3]=e,n[4]=w,n[5]=T):T=n[5];let E;n[6]===e?E=n[7]:(E=[e],n[6]=e,n[7]=E),(0,f.useEffect)(T,E);let D,O;n[8]!==e||n[9]!==r?(D=()=>{if(!e||!r)return;let t=()=>{if(!r.awareness)return;let t=y(r,e);a(e=>!e||v(e.writingDocs,t)?e:{...e,writingDocs:t})},n=r.awareness;if(!n||typeof n.on!=`function`){t();return}n.on(`update`,t),t();let i=setInterval(t,1e3);return()=>{clearInterval(i),typeof n.off==`function`&&n.off(`update`,t)}},O=[e,r],n[8]=e,n[9]=r,n[10]=D,n[11]=O):(D=n[10],O=n[11]),(0,f.useEffect)(D,O);let k;n[12]===e?k=n[13]:(k=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=x.current.get(r);if(i!==void 0)return i;let{diff:a}=await g(e,t,n);return x.current.set(r,a),a},n[12]=e,n[13]=k);let A=k,j;n[14]!==e||n[15]!==w?(j=()=>{e&&w(e)},n[14]=e,n[15]=w,n[16]=j):j=n[16];let M=j,N;return n[17]!==i||n[18]!==l||n[19]!==A||n[20]!==M||n[21]!==o?(N={data:i,status:o,error:l,reload:M,fetchBurstDiff:A},n[17]=i,n[18]=l,n[19]=A,n[20]=M,n[21]=o,n[22]=N):N=n[22],N}function v(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function y(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!l(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}export{_ as n,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./DocumentContext-
|
|
1
|
+
import{i as e}from"./DocumentContext-CP7yqH5z.js";import{t}from"./compiler-runtime-BfE3aGVn.js";import{Ua as n}from"./dist-D0lKV18u2.js";import{n as r}from"./dist-DmEZHXvB.js";import{t as i}from"./dist-CpRBr-Ct.js";import{b as a,f as o}from"./doc-paths-BuYvs-Sl.js";import{J as s}from"./navigation-targets-kcw1-114.js";import{h as c}from"./skills-api-BBaU5yMj.js";import{t as l}from"./use-skills-CtCsB6PZ.js";var u=t();function d(){let t=(0,u.c)(4),{openTarget:d}=e(),f=l(),p;return t[0]!==d||t[1]!==f.data||t[2]!==f.status?(p=(e,t,l)=>{let u=e=>{d({kind:`doc`,target:e,docName:e},l?.replaceActive?{tabBehavior:`replace-active`}:void 0),a(o(e))},p=f.status===`ready`?f.data.find(n=>n.scope===e&&n.name===t):void 0;if(p)return u(s(p));if(e===`project`&&l?.path)return u(l.path.replace(/\.mdx?$/i,``));if(e===`global`)return u(n(e,t));(async()=>{try{let n=await c(`project`);if(!n.ok){r.error(i._({id:`IO8REi`,values:{0:n.error,name:t}}));return}let a=n.skills.find(n=>n.scope===e&&n.name===t);if(!a){r.error(i._({id:`9uRLEH`,values:{name:t}}));return}u(s(a))}catch(e){let n=e;r.error(i._({id:`IO8REi`,values:{0:n instanceof Error?n.message:String(n),name:t}}))}})()},t[0]=d,t[1]=f.data,t[2]=f.status,t[3]=p):p=t[3],p}export{d as t};
|
package/dist/public/assets/{use-skill-directory-Ie653N2P.js → use-skill-directory-DTKROB4o.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./useQuery-ZeEDLtxh.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-RQ5o7P7w.js";import{t as c}from"./createLucideIcon-BbgVV4EV.js";import{t as l}from"./check-DLRoQSSY.js";import{t as u}from"./badge-CnYDYmI5.js";import{s as d}from"./skills-api-BBaU5yMj.js";import{t as f}from"./use-skills-CtCsB6PZ.js";import{t as p}from"./use-open-skill-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./useQuery-ZeEDLtxh.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-RQ5o7P7w.js";import{t as c}from"./createLucideIcon-BbgVV4EV.js";import{t as l}from"./check-DLRoQSSY.js";import{t as u}from"./badge-CnYDYmI5.js";import{s as d}from"./skills-api-BBaU5yMj.js";import{t as f}from"./use-skills-CtCsB6PZ.js";import{t as p}from"./use-open-skill-BH3vfRE3.js";import{n as m}from"./open-managed-artifact-tab-CRB-rvl-.js";var h=[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]],g=c(`package`,h),_=e(n(),1),v=o(),y=t();function b(e){let t=(0,v.c)(27),{name:n,description:r,onOpen:a,action:o,meta:c,leading:l}=e,{_:u}=i(),d;t[0]===n?d=t[1]:(d=(0,y.jsx)(`div`,{className:`truncate font-medium text-sm`,children:n}),t[0]=n,t[1]=d);let f=d,p;t[2]!==u||t[3]!==n?(p=u({id:`9_euHO`,values:{name:n}}),t[2]=u,t[3]=n,t[4]=p):p=t[4];let m;t[5]!==a||t[6]!==p?(m=(0,y.jsx)(s,{variant:`ghost`,"aria-label":p,onClick:a,className:`absolute inset-0 h-auto w-full rounded-xl p-0 opacity-0`}),t[5]=a,t[6]=p,t[7]=m):m=t[7];let h;t[8]===l?h=t[9]:(h=l?(0,y.jsx)(`div`,{className:`shrink-0`,children:l}):null,t[8]=l,t[9]=h);let g;t[10]!==c||t[11]!==f?(g=(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,c]}),t[10]=c,t[11]=f,t[12]=g):g=t[12];let _;t[13]===o?_=t[14]:(_=(0,y.jsx)(`div`,{className:`relative z-10 shrink-0`,children:o}),t[13]=o,t[14]=_);let b;t[15]!==h||t[16]!==g||t[17]!==_?(b=(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[h,g,_]}),t[15]=h,t[16]=g,t[17]=_,t[18]=b):b=t[18];let x;t[19]===r?x=t[20]:(x=r?(0,y.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground text-xs leading-relaxed`,children:r}):null,t[19]=r,t[20]=x);let S;t[21]!==b||t[22]!==x?(S=(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[b,x]}),t[21]=b,t[22]=x,t[23]=S):S=t[23];let C;return t[24]!==m||t[25]!==S?(C=(0,y.jsxs)(`li`,{className:`relative rounded-xl border border-border bg-card p-4 transition-colors hover:border-border/60 hover:bg-accent/40 focus-within:ring-2 focus-within:ring-ring`,children:[m,S]}),t[24]=m,t[25]=S,t[26]=C):C=t[26],C}function x(e,t){return new Intl.NumberFormat(t||void 0,{notation:`compact`,compactDisplay:`short`}).format(e)}function S(e){let t=(0,v.c)(4),{login:n}=e,[r,i]=(0,_.useState)(!0);if(n&&r){let e=`https://github.com/${encodeURIComponent(n)}.png?size=96`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>i(!1),t[0]=r):r=t[0];let a;return t[1]===e?a=t[2]:(a=(0,y.jsx)(`img`,{src:e,alt:``,loading:`lazy`,className:`size-10 rounded border border-border bg-background object-cover`,onError:r}),t[1]=e,t[2]=a),a}let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,y.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded border border-border bg-muted text-muted-foreground`,children:(0,y.jsx)(g,{className:`size-5`,"aria-hidden":!0})}),t[3]=a):a=t[3],a}function C(e){let t=(0,v.c)(22),{result:n,imported:a,onOpen:o}=e,{i18n:s}=i(),c;t[0]===n.publisher?c=t[1]:(c=(0,y.jsx)(S,{login:n.publisher}),t[0]=n.publisher,t[1]=c);let d;t[2]===a?d=t[3]:(d=a?(0,y.jsxs)(u,{variant:`primary`,className:`gap-1`,children:[(0,y.jsx)(l,{"aria-hidden":!0}),(0,y.jsx)(r,{id:`hp8OtS`})]}):null,t[2]=a,t[3]=d);let f=n.publisher??n.source,p;t[4]===f?p=t[5]:(p=(0,y.jsx)(`span`,{className:`truncate`,children:f}),t[4]=f,t[5]=p);let m;t[6]===n.publisher?m=t[7]:(m=n.publisher===`openknowledge`||n.publisher===`inkeep`?(0,y.jsx)(u,{variant:`secondary`,className:`h-4 px-1 text-[10px] uppercase tracking-wide`,children:(0,y.jsx)(r,{id:`o0bHtA`})}):null,t[6]=n.publisher,t[7]=m);let h;t[8]!==s||t[9]!==n.installs?(h=n.installs==null?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,y.jsxs)(`span`,{className:`shrink-0`,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,children:`↓ `}),(0,y.jsxs)(`span`,{className:`sr-only`,children:[(0,y.jsx)(r,{id:`7m3Ade`}),` `]}),x(n.installs,s.locale)]})]}),t[8]=s,t[9]=n.installs,t[10]=h):h=t[10];let g;t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[p,m,h]}),t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14];let _;return t[15]!==o||t[16]!==n.description||t[17]!==n.name||t[18]!==c||t[19]!==d||t[20]!==g?(_=(0,y.jsx)(b,{name:n.name,description:n.description,onOpen:o,leading:c,action:d,meta:g}),t[15]=o,t[16]=n.description,t[17]=n.name,t[18]=c,t[19]=d,t[20]=g,t[21]=_):_=t[21],_}function w(){let e=(0,v.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`skills`,`popular`],queryFn:T,staleTime:3e5},e[0]=t):t=e[0];let{data:n,isPending:r,isError:i}=a(t),o;e[1]===n?o=e[2]:(o=n??[],e[1]=n,e[2]=o);let s;return e[3]!==i||e[4]!==r||e[5]!==o?(s={skills:o,isPending:r,failed:i},e[3]=i,e[4]=r,e[5]=o,e[6]=s):s=e[6],s}async function T(){let e=await d();if(!e.ok)throw Error(e.error);return e.results}function E(e,t){return e.find(e=>e.origin?.source===t.source&&(e.name===t.name||e.name===`${t.name}-imported`||e.name.startsWith(`${t.name}-imported-`)))??null}function D(e){let t=(0,v.c)(15),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{scope:r,onNavigate:i}=n,a=p(),o=f(),s;t[2]!==o.data||t[3]!==o.status?(s=o.status===`ready`?o.data.filter(O):[],t[2]=o.data,t[3]=o.status,t[4]=s):s=t[4];let c=s,l;t[5]===c?l=t[6]:(l=e=>E(c,e),t[5]=c,t[6]=l);let u=l,d;t[7]!==u||t[8]!==i||t[9]!==a||t[10]!==r?(d=function(e){i?.();let t=u(e);if(t){a(t.scope,t.name);return}m({flavor:`explore`,source:e.source,name:e.name,subtitle:e.source,level:r})},t[7]=u,t[8]=i,t[9]=a,t[10]=r,t[11]=d):d=t[11];let h=d,g;return t[12]!==u||t[13]!==h?(g={importedEntry:u,openResult:h},t[12]=u,t[13]=h,t[14]=g):g=t[14],g}function O(e){return e.origin}export{h as a,g as i,w as n,C as r,D as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{h as r,i}from"./DocumentContext-CcK-mNAi.js";import{t as a}from"./react-f2sANaYj.js";import{t as o}from"./react-dom-DPxgxlDT.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{$ as c,K as l,k as u}from"./CodeMirrorPropInput-BQoCzCdy.js";import{$i as d,Ga as f,Ji as p,Ui as m,W as h,Wi as g,Yi as _,aa as v,ia as y,ji as b,ra as x,ta as S,vi as ee}from"./dist-D0lKV18u2.js";import{t as te}from"./libesm-Dcsy_--i.js";var C=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}()})),w=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}})),T=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=w();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}]}})),ne=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=C(),r=w(),i=T(),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)}})),re=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=C();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=ne(),r=T();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)}})),E=e(a(),1),ie=e(o(),1),D=s(),O=re();function k(){}k.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(ae(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 ae(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 A=new k;function oe(e,t,n){return A.diff(e,t,n)}var j=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,M=/\S/,N=new k;N.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!M.test(e)&&!M.test(t)},N.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]&&j.test(t[n])&&j.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function se(e,t,n){return N.diff(e,t,n)}var P=new k;P.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{h as r,i}from"./DocumentContext-CP7yqH5z.js";import{t as a}from"./react-f2sANaYj.js";import{t as o}from"./react-dom-DPxgxlDT.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{$ as c,K as l,k as u}from"./CodeMirrorPropInput-BQoCzCdy.js";import{$i as d,Ga as f,Ji as p,Ui as m,W as h,Wi as g,Yi as _,aa as v,ia as y,ji as b,ra as x,ta as S,vi as ee}from"./dist-D0lKV18u2.js";import{t as te}from"./libesm-Dcsy_--i.js";var C=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}()})),w=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}})),T=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=w();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}]}})),ne=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=C(),r=w(),i=T(),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)}})),re=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=C();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=ne(),r=T();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)}})),E=e(a(),1),ie=e(o(),1),D=s(),O=re();function k(){}k.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(ae(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 ae(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 A=new k;function oe(e,t,n){return A.diff(e,t,n)}var j=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,M=/\S/,N=new k;N.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!M.test(e)&&!M.test(t)},N.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]&&j.test(t[n])&&j.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function se(e,t,n){return N.diff(e,t,n)}var P=new k;P.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 F=new k;F.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var ce=new k;ce.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function I(e){"@babel/helpers - typeof";return I=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},I(e)}var le=Object.prototype.toString,L=new k;L.useLongestToken=!0,L.tokenize=P.tokenize,L.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(R(e,null,null,i),i,` `)},L.equals=function(e,t){return k.prototype.equals.call(L,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function R(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(le.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=R(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),I(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]=R(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var z=new k;z.tokenize=function(e){return e.slice()},z.join=z.removeEmpty=function(e){return e};function B(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 x(n,i,t.slice(n,r))}function V(e){if(!e.steps.length)return;let t=new y(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 x&&r instanceof x?B(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function H(e){let t=new y(e);return t.removeMark(0,e.nodeSize-2),t.doc}function U(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 W(e){return JSON.parse(JSON.stringify(e))}var ue=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 y(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=H(this.fromDoc).toJSON(),this.finalJSON=H(this.toDoc).toJSON(),this.ops=(0,O.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,O.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=V(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=W(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,O.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=H(this.tr.doc).toJSON(),this.ops=(0,O.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=B(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=W(this.currentJSON),a=W(this.currentJSON);(0,O.applyPatch)(i,[n]),(0,O.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=U(this.currentJSON,e.path),u=this.wordDiffs?se(l,c):oe(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 de(e,t,n={}){return new ue(e,t,n).init()}var G=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function K(e){let t=[];return e.forEach((e,n)=>{if(G.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 fe(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=fe(K(e),K(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 me=400;function q(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function he(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof d?`add`:t instanceof S?`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(),f=u.map(o.from),p=u.map(o.to);p<=f||r.push({fromA:f,toA:p,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function ge(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=q(r,n,e),a=q(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=de(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=pe(i,o),l=s?he(s,c):[];return c.length+l.length>me?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var _e=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function ve(e){return e.changes.length+2*e.markChanges.length}function J(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function ye(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 Y(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&&ye(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function be(e,t,n,r,i){let a=v.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(m.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(m.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(m.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(m.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return g.create(e,o)}var xe=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),X=r.filter(e=>!xe.has(e.name)).map(e=>e.name===`jsxComponent`?h:e),Z=n(),Q=b(X);function Se(e,t){return ge(e,t,Q,u())}var Ce=ee.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:g.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new p({key:new _(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function we(e){let t=(0,D.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=be(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,Q);o=c,a=!1,r=X,i=Ce.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 u;t[11]===n.afterDoc?u=t[12]:(u=n.afterDoc.toJSON(),t[11]=n.afterDoc,t[12]=u);let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d={attributes:{class:`pt-4`}},t[13]=d):d=t[13];let f;t[14]!==a||t[15]!==s||t[16]!==u?(f={editable:a,extensions:s,content:u,editorProps:d},t[14]=a,t[15]=s,t[16]=u,t[17]=f):f=t[17];let p;t[18]===n?p=t[19]:(p=[n],t[18]=n,t[19]=p);let m=o(f,p),[h]=(0,E.useState)(Te),g=(0,E.useRef)(null),_,v;t[20]===h?(_=t[21],v=t[22]):(_=()=>{let e=g.current;if(e)return e.appendChild(h),()=>{h.parentNode===e&&e.removeChild(h)}},v=[h],t[20]=h,t[21]=_,t[22]=v),(0,E.useLayoutEffect)(_,v);let y;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:g,style:{display:`contents`}})}),t[23]=y):y=t[23];let b;t[24]===m?b=t[25]:(b=(0,Z.jsx)(l,{editor:m,className:`tiptap-editor-portal-content`}),t[24]=m,t[25]=b);let x;t[26]!==h||t[27]!==b?(x=(0,ie.createPortal)(b,h),t[26]=h,t[27]=b,t[28]=x):x=t[28];let S;return t[29]===x?S=t[30]:(S=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[y,x]}),t[29]=x,t[30]=S),S}function Te(){let e=document.createElement(`div`);return e.style.display=`contents`,e}function Ee(e){let t=0,n=!1;for(let r of e.split(`
|
|
3
3
|
`)){let e=r.startsWith(`+`)&&!r.startsWith(`+++`)||r.startsWith(`-`)&&!r.startsWith(`---`);e&&!n&&(t+=1),n=e}return t}function De(e){let t=Array.from(e.querySelectorAll(`.diff-code-insert, .diff-code-delete`)),n=[],r=null;for(let e of t){let t=e.closest(`tr`);t&&((r===null||t.previousElementSibling!==r)&&n.push(e),r=t)}return n}function $(e){let t=0,n=0;for(let r of e.split(`
|
|
4
4
|
`))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function Oe(e,t){return`${e}\u0000${t}`}function ke(e,t,n){let r=f(e).body,i=f(t).body;return r===i?``:te(n,r,i,``,``,{context:Math.max(r.split(`
|
package/dist/public/index.html
CHANGED
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
-->
|
|
71
71
|
<script>(() => { const isMode = (v) => v === 'light' || v === 'dark' || v === 'system'; const isThemeId = (v) => typeof v === 'string' && /^[a-z0-9-]{1,32}$/.test(v); let pref = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (isMode(r)) pref = r; } catch {} let slots = null; try { const raw = localStorage.getItem('ok-color-theme-pair-v1'); if (raw) { const o = JSON.parse(raw); if (o?.light && o?.dark) { slots = o; if (isMode(o.pref)) pref = o.pref; } } } catch {} let dark = pref === 'dark'; if (pref === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } let ct = null; if (slots) { const slot = dark ? slots.dark : slots.light; if (isThemeId(slot?.id)) { dark = !!slot.dark; if (slot.id !== 'default') ct = slot.id; } } else { try { const c = localStorage.getItem('ok-color-theme-v1'); if (isThemeId(c) && c !== 'default') ct = c; } catch {} } let customCss = null; if (ct === 'custom') { try { const raw = localStorage.getItem('ok-custom-theme-v1'); if (raw) { const o = JSON.parse(raw); if (o?.css) { customCss = o.css; dark = !!o.dark; } } } catch {} if (!customCss) ct = null; } if (dark) document.documentElement.classList.add('dark'); if (ct) document.documentElement.setAttribute('data-color-theme', ct); if (customCss) { const s = document.createElement('style'); s.id = 'ok-custom-theme'; s.textContent = customCss; document.head.appendChild(s); } if (window.okDesktop) { document.documentElement.classList.add('electron-mode'); document.documentElement.classList.add(`electron-platform-${window.okDesktop.platform}`); } })();</script>
|
|
72
72
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
73
|
-
<script type="module" crossorigin src="./assets/index-
|
|
73
|
+
<script type="module" crossorigin src="./assets/index-CUE-YCY2.js"></script>
|
|
74
74
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="./assets/dist-CpRBr-Ct.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
|
|
78
|
-
<link rel="modulepreload" crossorigin href="./assets/globals-
|
|
78
|
+
<link rel="modulepreload" crossorigin href="./assets/globals-i3eL0jPG.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Chd9yIcd.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-hgmz1BF7.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="./assets/dist-zYQJXuRH.js">
|
|
@@ -164,27 +164,27 @@
|
|
|
164
164
|
<link rel="modulepreload" crossorigin href="./assets/input-CtKG6a5B.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="./assets/use-collab-url-oYOwLAYB.js">
|
|
166
166
|
<link rel="modulepreload" crossorigin href="./assets/skills-api-BBaU5yMj.js">
|
|
167
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
167
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-CP7yqH5z.js">
|
|
168
168
|
<link rel="modulepreload" crossorigin href="./assets/format-CFFWVvag.js">
|
|
169
169
|
<link rel="modulepreload" crossorigin href="./assets/braces-PuTG97X6.js">
|
|
170
170
|
<link rel="modulepreload" crossorigin href="./assets/folder-config-api-CkzVN79U.js">
|
|
171
|
-
<link rel="modulepreload" crossorigin href="./assets/comment-chips-
|
|
171
|
+
<link rel="modulepreload" crossorigin href="./assets/comment-chips-GFaq2hJN.js">
|
|
172
172
|
<link rel="modulepreload" crossorigin href="./assets/textarea-CUVLEZhx.js">
|
|
173
|
-
<link rel="modulepreload" crossorigin href="./assets/selection-context-
|
|
173
|
+
<link rel="modulepreload" crossorigin href="./assets/selection-context-BN5sWQOX.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/lint-config-client-CKLyoxWn.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/use-skills-CtCsB6PZ.js">
|
|
176
|
-
<link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-
|
|
176
|
+
<link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-B0bIS4IP.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/cursor-W0skD8YU.js">
|
|
178
178
|
<link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-CSZXCqwG.js">
|
|
179
179
|
<link rel="modulepreload" crossorigin href="./assets/folder-DxrU2PLH.js">
|
|
180
180
|
<link rel="modulepreload" crossorigin href="./assets/copilot-CuzHDCzI.js">
|
|
181
181
|
<link rel="modulepreload" crossorigin href="./assets/agent-visibility-p6xMSDdk.js">
|
|
182
182
|
<link rel="modulepreload" crossorigin href="./assets/use-workspace-3mjuTrTC.js">
|
|
183
|
-
<link rel="modulepreload" crossorigin href="./assets/ChangedOutsideBadge-
|
|
184
|
-
<link rel="modulepreload" crossorigin href="./assets/use-open-skill-
|
|
183
|
+
<link rel="modulepreload" crossorigin href="./assets/ChangedOutsideBadge-C0FXh0Oi.js">
|
|
184
|
+
<link rel="modulepreload" crossorigin href="./assets/use-open-skill-BH3vfRE3.js">
|
|
185
185
|
<link rel="modulepreload" crossorigin href="./assets/use-settings-route-B1Atzr9C.js">
|
|
186
186
|
<link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-DPkNOslT.js">
|
|
187
|
-
<link rel="modulepreload" crossorigin href="./assets/skill-actions-
|
|
187
|
+
<link rel="modulepreload" crossorigin href="./assets/skill-actions-gJbOdqsR.js">
|
|
188
188
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-CmCnommQ.js">
|
|
189
189
|
<link rel="modulepreload" crossorigin href="./assets/separator-C4EdGs_S.js">
|
|
190
190
|
<link rel="modulepreload" crossorigin href="./assets/toggle-group-DAYvcc1F.js">
|
|
@@ -198,27 +198,27 @@
|
|
|
198
198
|
<link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-BnniPb1r.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/panel-UxAkffLp.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/skeleton-DS8zjX9Q.js">
|
|
201
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-
|
|
201
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-CG82yzgN.js">
|
|
202
202
|
<link rel="modulepreload" crossorigin href="./assets/download-QOlmqXQ8.js">
|
|
203
203
|
<link rel="modulepreload" crossorigin href="./assets/field-iFofWrdC.js">
|
|
204
|
-
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-
|
|
204
|
+
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-khzbb5gf.js">
|
|
205
205
|
<link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-B3cHkf8G.js">
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-yAE2j52e.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-CIEJD8Ca.js">
|
|
208
208
|
<link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CRB-rvl-.js">
|
|
209
|
-
<link rel="modulepreload" crossorigin href="./assets/use-skill-directory-
|
|
209
|
+
<link rel="modulepreload" crossorigin href="./assets/use-skill-directory-DTKROB4o.js">
|
|
210
210
|
<link rel="modulepreload" crossorigin href="./assets/panel-right-open-Cc56I_GE.js">
|
|
211
211
|
<link rel="modulepreload" crossorigin href="./assets/square-pen-CEIus1aL.js">
|
|
212
212
|
<link rel="modulepreload" crossorigin href="./assets/undo-2-bYFSgQwb.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="./assets/form-CGbOgaUs.js">
|
|
214
|
-
<link rel="modulepreload" crossorigin href="./assets/follow-file-
|
|
214
|
+
<link rel="modulepreload" crossorigin href="./assets/follow-file-Dlt39wWC.js">
|
|
215
215
|
<link rel="modulepreload" crossorigin href="./assets/text-viewer-languages-DEjz8Rlz.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-NV902SqC.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/ConfigSharingInfoTooltip-BhNgrS2h.js">
|
|
218
218
|
<link rel="modulepreload" crossorigin href="./assets/project-paths--7l9Mqe-.js">
|
|
219
219
|
<link rel="modulepreload" crossorigin href="./assets/SkillModeBanner-DFgrdWyf.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-VPm5Cnie.js">
|
|
221
|
-
<link rel="modulepreload" crossorigin href="./assets/agent-diff-store-
|
|
221
|
+
<link rel="modulepreload" crossorigin href="./assets/agent-diff-store-c2pI-IqS.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-ur7EfH9N.js">
|
|
223
223
|
<link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-DEdN-vX3.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/input-group-BgDCDWUR.js">
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
<link rel="modulepreload" crossorigin href="./assets/overlay-layers-CBGNHxJK.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/receive-store-C3RyDFMU.js">
|
|
233
233
|
<link rel="modulepreload" crossorigin href="./assets/timeline-diff-store-sC1fl4YV.js">
|
|
234
|
-
<link rel="stylesheet" crossorigin href="./assets/globals-
|
|
234
|
+
<link rel="stylesheet" crossorigin href="./assets/globals-C_5FVIC1.css">
|
|
235
235
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
236
236
|
<link rel="stylesheet" crossorigin href="./assets/index-CDpJ2gXn.css">
|
|
237
237
|
</head>
|
|
@@ -32,12 +32,12 @@
|
|
|
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-Baseq7_l.js"></script>
|
|
36
36
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
|
|
37
37
|
<link rel="modulepreload" crossorigin href="./assets/dist-CpRBr-Ct.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
|
|
40
|
-
<link rel="modulepreload" crossorigin href="./assets/globals-
|
|
40
|
+
<link rel="modulepreload" crossorigin href="./assets/globals-i3eL0jPG.js">
|
|
41
41
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-Chd9yIcd.js">
|
|
42
42
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-DH580DYm.js">
|
|
43
43
|
<link rel="modulepreload" crossorigin href="./assets/lib-CtlgmvnR.js">
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<link rel="modulepreload" crossorigin href="./assets/badge-CnYDYmI5.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="./assets/input-CtKG6a5B.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="./assets/textarea-CUVLEZhx.js">
|
|
69
|
-
<link rel="stylesheet" crossorigin href="./assets/globals-
|
|
69
|
+
<link rel="stylesheet" crossorigin href="./assets/globals-C_5FVIC1.css">
|
|
70
70
|
</head>
|
|
71
71
|
|
|
72
72
|
<body class="antialiased">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./launch-json-removal-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{t as e}from"./launch-json-removal-DphNv7be.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`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-Bk6eqKiY.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,g as t,s as n}from"./write-project-skill-DQTCLDNM.mjs";import{d as r,v as i}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{a as e,g as t,s as n}from"./write-project-skill-DQTCLDNM.mjs";import{d as r,v as i}from"./init-D7RfHtp_.mjs";import{t as a}from"./mcp-migrate-event-B1gJf6bG.mjs";import{homedir as o}from"node:os";function s(t){let r=t.logger??u,i=t.home??o(),a=[];if(t.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of e){let e=n[o],s=c(()=>e.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:e,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),e.projectConfigPath){let n=e.projectConfigPath,i=c(()=>n(t.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:e,home:void 0,cwd:t.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let n={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=r(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...n,outcome:`no-entry`};if(t(o))return{...n,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=i(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let t=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:t}),{...n,outcome:`write-failed`,error:t}}return s.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:s.declineReason}),{...n,outcome:`declined`}):{...n,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-fC8b4vo_.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{Y as t}from"./sleep-ByqzSHar.mjs";import{Cs as n,Ss as r,X as i,Z as a,zo as o}from"./src-y-VpYk60.mjs";import{Hr as s,_n as c,at as l,ci as u,it as d,ot as f,rt as p,wa as m}from"./src-BTCvmkZK.mjs";import{O as h,P as g}from"./fs-traced-Cq61rC8q.mjs";import{S as _,u as v,v as y,x as b}from"./server-lock-DQJq-D9V.mjs";import{t as x}from"./yazl-BafwB467.mjs";import{_ as S,g as C,i as w,s as ee,x as te}from"./write-project-skill-DQTCLDNM.mjs";import{c as ne}from"./colors-BsmVIwfM.mjs";import"./acp-harness-probe-
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{Y as t}from"./sleep-ByqzSHar.mjs";import{Cs as n,Ss as r,X as i,Z as a,zo as o}from"./src-y-VpYk60.mjs";import{Hr as s,_n as c,at as l,ci as u,it as d,ot as f,rt as p,wa as m}from"./src-BTCvmkZK.mjs";import{O as h,P as g}from"./fs-traced-Cq61rC8q.mjs";import{S as _,u as v,v as y,x as b}from"./server-lock-DQJq-D9V.mjs";import{t as x}from"./yazl-BafwB467.mjs";import{_ as S,g as C,i as w,s as ee,x as te}from"./write-project-skill-DQTCLDNM.mjs";import{c as ne}from"./colors-BsmVIwfM.mjs";import"./acp-harness-probe-ctlLmc6O.mjs";import{D as T,E,S as re,T as D,_ as O,b as ie,o as ae,v as k}from"./init-D7RfHtp_.mjs";import{n as A}from"./constants-Bc6SmMHz.mjs";import{t as j}from"./is-object-ByG7RnjH.mjs";import"./loader-BtbydYPt.mjs";import"./skill-teardown-BQ0YQ9rO.mjs";import"./preview-CAWFRCJt.mjs";import{execSync as oe,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,isAbsolute as se,join as F,relative as ce,resolve as I,sep as le}from"node:path";import{cpSync as ue,createWriteStream as de,existsSync as L,lstatSync as fe,mkdirSync as R,mkdtempSync as pe,readFileSync as z,readdirSync as me,readlinkSync as he,rmSync as ge,statSync as _e,writeFileSync as B}from"node:fs";import{arch as ve,freemem as ye,homedir as V,hostname as be,platform as xe,release as Se,tmpdir as Ce,totalmem as we,type as Te,uptime as Ee}from"node:os";import{realpath as H}from"node:fs/promises";import{createHash as De}from"node:crypto";var U=t();const Oe=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function ke(e,t,n=c){if(e!==void 0&&!Oe.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ae=null;function je(e){Ae=e}function Me(){return Ae??process.cwd()}function Ne(){return F(V(),`.ok`,`bug-reports`)}function Pe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Ne(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Fe(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?De(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function Ie(){let e={timestamp:new Date().toISOString(),platform:xe(),osType:Te(),osRelease:Se(),hostname:`[redacted]`,uptime:Ee(),freeMem:ye(),totalMem:we(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=oe(`sw_vers -productVersion 2>/dev/null`,s({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}function Le(e,t){return Re(e,t).files}function Re(e,t){if(!L(t))return{files:[]};let n=me(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function ze(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,i].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Be(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ve(e){if(e.redact){let{redacted:t,patterns:r,lineCount:i}=n(e.content);e.zipfile.addBuffer(Buffer.from(t,`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(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{Ve({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function He(t){let{redact:n,outputPath:i,logger:a}=t,o=t.userLogsDir??F(V(),`.ok`,`logs`),s=t.projectDir?Fe(t.projectDir,a):null;R(P(i),{recursive:!0}),a?.info({projectSlug:s},`gathering diagnostic data`);let c=Ie();c.desktop=t.desktop??null;let{files:l}=Re(s,o),{files:u}=t.projectDir?ze(t.projectDir):{files:[]},{files:d}=t.projectDir?Be(t.projectDir):{files:[]};a?.info({logFileCount:l.length,lockFileCount:u.length,localSinkFileCount:d.length},`files collected`);let f=[],p=[],{ZipFile:m}=await import(`./yazl-vwTkB7U0.mjs`).then(t=>e(t.default,1)),h=new m;W({zipfile:h,files:l,prefix:`logs`,redact:n,bundleFiles:p,redactions:f,logger:a}),W({zipfile:h,files:u,prefix:`lockdir`,redact:n,bundleFiles:p,redactions:f,logger:a}),W({zipfile:h,files:d,prefix:`local-logs`,redact:n,bundleFiles:p,redactions:f,logger:a});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;h.addBuffer(t,n),p.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ve({zipfile:h,name:`note.txt`,content:t.note,redact:n,bundleFiles:p,redactions:f});let g=JSON.stringify(c,null,2);h.addBuffer(Buffer.from(g,`utf8`),`sysinfo.json`),p.push(`sysinfo.json`);let _={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:p,redactions:f,sysinfo:c};h.addBuffer(Buffer.from(JSON.stringify(_,null,2),`utf8`),`MANIFEST.json`);let v=f.reduce((e,t)=>e+t.lineCount,0),y=[`# Bug Report Bundle`,``,`Generated: ${_.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${_.disciplineVersion}`,``,`## Contents`,``,...p.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${r.join(`, `)}`,v>0?`${v} line(s) were scrubbed across ${f.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
2
2
|
`);h.addBuffer(Buffer.from(y,`utf8`),`README.md`),h.end();let b=de(i);return h.outputStream.pipe(b),await new Promise((e,t)=>{b.on(`close`,e),b.on(`error`,t)}),a?.info({bundlePath:i,fileCount:p.length,redactionCount:v},`bundle written`),{zipPath:i,summary:{projectSlug:s,files:p,redactions:f,redactedLineCount:v,generatedAt:_.generatedAt}}}var Ue=e(x(),1),G=e(ne(),1);function K(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function We(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e,t){if(typeof e==`string`)return K(e,t.contentDir);if(Array.isArray(e))return e.map(e=>q(e,t));if(!We(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=q(i,t);return n}function Ge(e,t){let n=z(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
3
|
`),i=n.split(`
|
|
4
4
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=q(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}B(e,r?`${a.join(`
|
|
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{Y as t}from"./sleep-ByqzSHar.mjs
|
|
|
17
17
|
`).replace(/\n/g,`\r
|
|
18
18
|
`));let u=`${i?``:``}${l}`;return u!==r&&g(e,u,{mode:D(e)}),{kind:`removed`}}function ln(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function un(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function dn(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:d(r),command:r,isDesktop:ln(r)}}function fn(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&fn(e)?`ui-orphan`:`stale`}const pn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function mn(e){switch(e){case`running`:return G.default.green(e);case`desktop`:return G.default.blue(e);case`foreign`:return G.default.cyan(e);case`ui-orphan`:return G.default.magenta(e);case`stale`:return G.default.yellow(e)}}function hn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function gn(e){return`${hn(e.server.usage)} | ${hn(e.ui?.usage??null)}`}function _n(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function vn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,_n(e),gn(e),t,String(n),un(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=mn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=G.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
19
19
|
`)}async function yn(e={}){let t=e.discover??p,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??l,a=e.resolveUsage??f,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=dn(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(vn(e.all?s:s.filter(e=>pn.has(Q(e)))))}function bn(){return new te(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await yn({all:t.all===!0||e===`all`,json:t.json===!0})})}function xn(e,t,n={}){let r=n.isAlive??b,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function Sn(e){let t=e.inspect??(t=>Z(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=xn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Cn(e,t=b){let n=await p(),r=null;for(let i of n){let n=Z(i,`server`),a=Z(i,`ui`);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function wn(e){let t=Sn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Tn(e){return new te(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=Sn({lockDir:u(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await yn({});return}if(n===`all`){let e=await p();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=Z(n,`server`),r=Z(n,`ui`);!$(e,b)&&!$(r,b)||(wn(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Cn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}wn(t);return}wn(u(I(Me(),n)))})}function En(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}async function Dn(e,t){let n,r;try{n=await H(I(e)),r=await H(I(P(e)))}catch{return{kind:`not-git`}}if(!On(n,r))return{kind:`symlink-escape`};let i=F(n,`.git`),a;try{a=_e(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await H(i)}catch{return{kind:`not-git`}}if(!On(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let s=m(n);if(s.kind!==`repository`)return{kind:`not-git`};let c=s.repository.readRemoteUrl(`origin`);if(c.kind===`unreadable`)return{kind:`not-git`};if(c.kind===`absent`)return c.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let l=c.url,u=Wt(l);if(u===null)return{kind:`non-github`};let d=o(u.hostname);if(d===null)return{kind:`non-github`};let f=d===t.host.toLowerCase(),p=u.owner.toLowerCase()===t.owner.toLowerCase(),h=u.name.toLowerCase()===t.repo.toLowerCase();return!f&&p&&h?{kind:`wrong-host`,actualHost:d}:!f||!p||!h?{kind:`wrong-repo`,actualOwner:u.owner,actualRepo:u.name}:{kind:`ok`,gitRemoteUrl:`https://${d}/${u.owner}/${u.name}.git`}}function On(e,t){if(e===t)return!0;let n=ce(t,e);return n.length>0&&!n.startsWith(`..`)&&!se(n)}const kn=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=k(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=w(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function An(e,t,n={},r=kn){let i=[];for(let a of t){let t=ee[a];for(let a of r)i.push(a.write(t,e,n))}return i}function jn(e,t,n={}){return{integrations:An(e,t,n)}}export{Pe as C,ke as D,je as E,zt as S,Me as T,Kt as _,Tn as a,Ht as b,Jt as c,tn as d,Zt as f,qt as g,Gt as h,Sn as i,Xt as l,en as m,Dn as n,bn as o,$t as p,En as r,an as s,jn as t,Yt as u,Wt as v,Ne as w,Rt as x,Z as y};
|
|
20
|
-
//# sourceMappingURL=src-
|
|
20
|
+
//# sourceMappingURL=src-DRhXUMyd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,r as t,v as n}from"./start-DKwEh9gC.mjs";export{t as bootStartServer,e as resolveHost,n as startCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Q as e,Y as t}from"./src-y-VpYk60.mjs";import{Hr as n,Yr as r,a as i,vn as a}from"./src-BTCvmkZK.mjs";import{S as o,x as s}from"./write-project-skill-DQTCLDNM.mjs";import{a as c,n as l,t as u}from"./acp-harness-probe-DgjLEALo.mjs";import{n as d}from"./constants-uLxFyV1-.mjs";import{spawn as f}from"node:child_process";import{basename as p,join as m,posix as h,resolve as g,win32 as _}from"node:path";import{closeSync as v,existsSync as y,mkdirSync as b,openSync as x,statSync as S}from"node:fs";import{homedir as C}from"node:os";import{rm as w}from"node:fs/promises";import{setTimeout as T}from"node:timers/promises";function E(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function D(e,t,r={}){let i=(r.spawn??f)(e,[...t],n({detached:!0,stdio:`ignore`,env:E(r.env??process.env)}));return i.unref(),i}const O=`OpenKnowledge.app`,k=`/Applications/${O}`;function A(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return S(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function j(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(M(e,k))return k;let t=m(e.homeDir??C(),`Applications`,O);return M(e,t)?t:null}function M(e,t){return N(e,m(t,`Contents`,`MacOS`,`OpenKnowledge`))}function N(e,t){try{let n=e.statSync(t);return n&&typeof n.isFile==`function`?n.isFile():!1}catch{return!1}}const ee=[`@inkeepopen-knowledge-desktop`,`OpenKnowledge`];function P(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 ee){let r=_.join(t,`Programs`,n,`OpenKnowledge.exe`);if(N(e,r))return r}return null}function F(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&e.execPath.endsWith(`/openknowledge`))return e.execPath;let t=`/opt/OpenKnowledge/openknowledge`;return N(e,t)?t:null}function I(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`?j(e):e.platform===`win32`?P(e):F(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 L(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`){D(`open`,[`-b`,`com.inkeep.open-knowledge`],{spawn:e.spawn});return}let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}D(i,[],{spawn:e.spawn})}function R(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it, 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 z(e){return h.join(h.dirname(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const te=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function ne(e){if(e.platform!==`darwin`||!te.test(e.execPath))return null;let t=z(e.execPath);return e.exists(t)?t:null}function B(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??y,a=r[1];return a?{command:ne({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function V(e,t){return e.host??t.HOST??`127.0.0.1`}function H(e,t){return t&&(e===`::`||e===`::1`||e===`[::1]`||e===`localhost`||e===`0.0.0.0`)?{host:`127.0.0.1`,coerced:!0}:{host:e,coerced:!1}}function U(e){let t=p(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var W=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}};function G(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function K(t){y(t.lockDir)||b(t.lockDir,{recursive:!0});let n=x(m(t.lockDir,e),`w`),r=t.spawn??f,{PORT:i,...a}=process.env,o=B();try{let e=r(o.command,[...o.prefixArgs,...t.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,n],windowsHide:!0,cwd:t.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return e.unref(),e}finally{try{v(n)}catch{}}}function q(e,t,n,r=!1){return e??(n!==void 0||r?void 0:t)}function J(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function Y(e,t,n){return e??+(t!=null&&!n)}async function X(e){let t=e.spawn??f,n=B(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,windowsHide:!0,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=Y(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function Z(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const re=t;function ie(e,t,n=e=>w(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{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`)}}}}function ae(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 Q(e){let t=e.sigtermGraceMs??re,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>T(e)),i=e.reason??`teardown`;try{let a=e.readUiLock(),o=e.spawnedUiPid();if(a&&e.isAlive(a.pid)&&a.pid!==o)e.log?.info({pid:a.pid,port:a.port,spawnedUiPid:o},`${i}: ui.lock holder is not our spawned sibling — leaving it alone`);else if(a&&e.isAlive(a.pid))try{e.killPid(a.pid,`SIGTERM`),e.log?.info({pid:a.pid,port:a.port},`${i}: SIGTERM UI sibling`);let o=Date.now()+t;for(;Date.now()<o&&e.isAlive(a.pid);)await r(n);if(e.isAlive(a.pid))try{e.killPid(a.pid,`SIGKILL`),e.log?.warn({pid:a.pid,graceMs:t},`${i}: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:a.pid,err:t},`${i}: SIGKILL failed`)}}catch(t){e.log?.warn({pid:a.pid,err:t},`${i}: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t},`${i}: UI lookup failed; proceeding`)}}function oe(e){let{destroy:t,...n}=e;return async()=>{await Q({...n,reason:`idle-shutdown`}),await t()}}async function se(e){let{config:t,cwd:n,host:o}=e,s=e.skipAutoInit??!1,d=e.skipUiAutoSpawn??!1,f=e.idleThresholdMs??18e5,{existsSync:p,mkdirSync:m}=await import(`node:fs`),{basename:h,dirname:g}=await import(`node:path`),{bootServer:_,getLogger:v,isProcessAlive:y,readUiLock:b,resolveContentDir:x,resolveLockDir:S,waitForServerLockDrain:C}=await import(`./src-BuZeH4bR.mjs`),w=e.log??v(`start`),E=e.singleFile!==void 0,D=e.projectDir??n,O=E?i(e.singleFile).canonicalFilePath:void 0,k=O?g(O):void 0,A=O?h(O):void 0;if(!E){if(!s&&!a(n))throw new W(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&w.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-BJ9v8T7k.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-D2WeY50Y.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-DT7FGT3w.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let j=k??x(t,n);!E&&!p(j)&&(m(j,{recursive:!0}),w.info({contentDir:j},`Created content directory`));let M=null,N=null,ee=async({lockDir:t})=>{if(M=G({uiLock:b(t),isAlive:y}),M.action===`spawn`&&!d)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];N=K({lockDir:t,cwd:n,spawn:e.spawn,args:r}).pid??null,w.info({reason:M.reason,uiPort:e.uiPort},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else M.action===`skip`&&w.info({port:M.port,pid:M.pid},`UI already running at port ${M.port}`)},P=e.reactShellDistDir===void 0,F=c(),I=r();{let e=S(E?D:n),t=Date.now(),r=await C(e);r!==`no-drain`&&w.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`)}let L=await _({config:t,contentDir:j,projectDir:E?D:n,contentRoot:E?void 0:t.content.dir,port:e.port,host:o,...e.enableRemote===!0?{enableRemote:!0}:{},quiet:!1,detectGh:l,tokenStore:F,embeddingsKeyStore:I,...E?{ephemeral:!0,singleDocRelPath:A,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>u(e,t),attachUiSibling:P,idleShutdownMs:f,skipAutoInit:!0,...P?{spawnUiSiblingFn:ee}:{},idleShutdownHandler:t=>{let n=oe({readUiLock:()=>b(L.lockDir),spawnedUiPid:()=>N,isAlive:y,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return ae(E?ie(n,D):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});M||={action:`skip`,reason:`alive`,pid:0,port:0};let R=M,z=null;if(R.action===`skip`)z=R.port>0?R.port:null;else if(!d){let t=e.uiBindTimeoutMs??3e3;z=await Z({readUiLock:()=>b(L.lockDir),now:Date.now,sleep:e=>T(e),timeoutMs:t,pollIntervalMs:50}),z===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:L.httpServer,destroy:L.destroy,lockDir:L.lockDir,contentDir:j,port:L.port,ready:L.ready,degraded:L.degraded,uiSpawnDecision:M,spawnedUiPid:N,resolvedUiPort:z}}function ce(e){if(e===`browser`||e===`app`)return e;throw new o(`--mode must be 'browser' or 'app'`)}function le(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new o(`--ui-port must be a port number between 1 and 65535`);return t}function ue(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function $(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 de(e,t){let n=ue(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-CIK2GwPx.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-MGDi6UGf.mjs`),c=process.cwd(),l=t.remote!==void 0&&t.remote!==!1,u=typeof t.remote==`string`?t.remote:void 0,f=u===void 0?e:{...e,remote:{...e.remote,url:u}};process.title=U(c),l&&(typeof f.remote?.url!=`string`||f.remote.url===``)&&(console.error(o("--remote requires a public tunnel URL — pass it (`ok start --remote https://<your-tunnel-host>`) or set remote.url in .ok/config.yml.")),process.exit(78)),l&&console.warn(s([``,`⚠ REMOTE ACCESS ENABLED — no server-side authentication.`,` Anyone who can reach ${f.remote?.url} has FULL control of this`,` knowledge base, including sync, publishing, credentials, and local operations.`,` Restrict who can reach it at the tunnel: ngrok OAuth, Cloudflare Access,`,` Tailscale ACLs, or equivalent edge auth.`,``].join(`
|
|
1
|
+
import{Q as e,Y as t}from"./src-y-VpYk60.mjs";import{Hr as n,Yr as r,a as i,vn as a}from"./src-BTCvmkZK.mjs";import{S as o,x as s}from"./write-project-skill-DQTCLDNM.mjs";import{a as c,n as l,t as u}from"./acp-harness-probe-ctlLmc6O.mjs";import{n as d}from"./constants-Bc6SmMHz.mjs";import{spawn as f}from"node:child_process";import{basename as p,join as m,posix as h,resolve as g,win32 as _}from"node:path";import{closeSync as v,existsSync as y,mkdirSync as b,openSync as x,statSync as S}from"node:fs";import{homedir as C}from"node:os";import{rm as w}from"node:fs/promises";import{setTimeout as T}from"node:timers/promises";function E(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function D(e,t,r={}){let i=(r.spawn??f)(e,[...t],n({detached:!0,stdio:`ignore`,env:E(r.env??process.env)}));return i.unref(),i}const O=`OpenKnowledge.app`,k=`/Applications/${O}`;function A(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return S(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function j(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(M(e,k))return k;let t=m(e.homeDir??C(),`Applications`,O);return M(e,t)?t:null}function M(e,t){return N(e,m(t,`Contents`,`MacOS`,`OpenKnowledge`))}function N(e,t){try{let n=e.statSync(t);return n&&typeof n.isFile==`function`?n.isFile():!1}catch{return!1}}const ee=[`@inkeepopen-knowledge-desktop`,`OpenKnowledge`];function P(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 ee){let r=_.join(t,`Programs`,n,`OpenKnowledge.exe`);if(N(e,r))return r}return null}function F(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&e.execPath.endsWith(`/openknowledge`))return e.execPath;let t=`/opt/OpenKnowledge/openknowledge`;return N(e,t)?t:null}function I(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`?j(e):e.platform===`win32`?P(e):F(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 L(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`){D(`open`,[`-b`,`com.inkeep.open-knowledge`],{spawn:e.spawn});return}let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}D(i,[],{spawn:e.spawn})}function R(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it, 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 z(e){return h.join(h.dirname(e),`..`,`Frameworks`,`OpenKnowledge Server.app`,`Contents`,`MacOS`,`OpenKnowledge Helper`)}const te=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function ne(e){if(e.platform!==`darwin`||!te.test(e.execPath))return null;let t=z(e.execPath);return e.exists(t)?t:null}function B(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??y,a=r[1];return a?{command:ne({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function V(e,t){return e.host??t.HOST??`127.0.0.1`}function H(e,t){return t&&(e===`::`||e===`::1`||e===`[::1]`||e===`localhost`||e===`0.0.0.0`)?{host:`127.0.0.1`,coerced:!0}:{host:e,coerced:!1}}function U(e){let t=p(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var W=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}};function G(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function K(t){y(t.lockDir)||b(t.lockDir,{recursive:!0});let n=x(m(t.lockDir,e),`w`),r=t.spawn??f,{PORT:i,...a}=process.env,o=B();try{let e=r(o.command,[...o.prefixArgs,...t.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,n],windowsHide:!0,cwd:t.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return e.unref(),e}finally{try{v(n)}catch{}}}function q(e,t,n,r=!1){return e??(n!==void 0||r?void 0:t)}function J(e,t){return e!==void 0&&t!==null&&t.port>0&&t.draining!==!0}function Y(e,t,n){return e??+(t!=null&&!n)}async function X(e){let t=e.spawn??f,n=B(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,windowsHide:!0,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=Y(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function Z(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const re=t;function ie(e,t,n=e=>w(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{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`)}}}}function ae(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 Q(e){let t=e.sigtermGraceMs??re,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>T(e)),i=e.reason??`teardown`;try{let a=e.readUiLock(),o=e.spawnedUiPid();if(a&&e.isAlive(a.pid)&&a.pid!==o)e.log?.info({pid:a.pid,port:a.port,spawnedUiPid:o},`${i}: ui.lock holder is not our spawned sibling — leaving it alone`);else if(a&&e.isAlive(a.pid))try{e.killPid(a.pid,`SIGTERM`),e.log?.info({pid:a.pid,port:a.port},`${i}: SIGTERM UI sibling`);let o=Date.now()+t;for(;Date.now()<o&&e.isAlive(a.pid);)await r(n);if(e.isAlive(a.pid))try{e.killPid(a.pid,`SIGKILL`),e.log?.warn({pid:a.pid,graceMs:t},`${i}: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:a.pid,err:t},`${i}: SIGKILL failed`)}}catch(t){e.log?.warn({pid:a.pid,err:t},`${i}: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t},`${i}: UI lookup failed; proceeding`)}}function oe(e){let{destroy:t,...n}=e;return async()=>{await Q({...n,reason:`idle-shutdown`}),await t()}}async function se(e){let{config:t,cwd:n,host:o}=e,s=e.skipAutoInit??!1,d=e.skipUiAutoSpawn??!1,f=e.idleThresholdMs??18e5,{existsSync:p,mkdirSync:m}=await import(`node:fs`),{basename:h,dirname:g}=await import(`node:path`),{bootServer:_,getLogger:v,isProcessAlive:y,readUiLock:b,resolveContentDir:x,resolveLockDir:S,waitForServerLockDrain:C}=await import(`./src-BuZeH4bR.mjs`),w=e.log??v(`start`),E=e.singleFile!==void 0,D=e.projectDir??n,O=E?i(e.singleFile).canonicalFilePath:void 0,k=O?g(O):void 0,A=O?h(O):void 0;if(!E){if(!s&&!a(n))throw new W(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&w.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-fC8b4vo_.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-Bk6eqKiY.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-DT7FGT3w.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){w.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let j=k??x(t,n);!E&&!p(j)&&(m(j,{recursive:!0}),w.info({contentDir:j},`Created content directory`));let M=null,N=null,ee=async({lockDir:t})=>{if(M=G({uiLock:b(t),isAlive:y}),M.action===`spawn`&&!d)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];N=K({lockDir:t,cwd:n,spawn:e.spawn,args:r}).pid??null,w.info({reason:M.reason,uiPort:e.uiPort},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else M.action===`skip`&&w.info({port:M.port,pid:M.pid},`UI already running at port ${M.port}`)},P=e.reactShellDistDir===void 0,F=c(),I=r();{let e=S(E?D:n),t=Date.now(),r=await C(e);r!==`no-drain`&&w.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`)}let L=await _({config:t,contentDir:j,projectDir:E?D:n,contentRoot:E?void 0:t.content.dir,port:e.port,host:o,...e.enableRemote===!0?{enableRemote:!0}:{},quiet:!1,detectGh:l,tokenStore:F,embeddingsKeyStore:I,...E?{ephemeral:!0,singleDocRelPath:A,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>u(e,t),attachUiSibling:P,idleShutdownMs:f,skipAutoInit:!0,...P?{spawnUiSiblingFn:ee}:{},idleShutdownHandler:t=>{let n=oe({readUiLock:()=>b(L.lockDir),spawnedUiPid:()=>N,isAlive:y,killPid:(e,t)=>{process.kill(e,t)},destroy:t,log:w});return ae(E?ie(n,D):n,{log:w,exit:e.idleExit})},log:w,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});M||={action:`skip`,reason:`alive`,pid:0,port:0};let R=M,z=null;if(R.action===`skip`)z=R.port>0?R.port:null;else if(!d){let t=e.uiBindTimeoutMs??3e3;z=await Z({readUiLock:()=>b(L.lockDir),now:Date.now,sleep:e=>T(e),timeoutMs:t,pollIntervalMs:50}),z===null&&w.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:L.httpServer,destroy:L.destroy,lockDir:L.lockDir,contentDir:j,port:L.port,ready:L.ready,degraded:L.degraded,uiSpawnDecision:M,spawnedUiPid:N,resolvedUiPort:z}}function ce(e){if(e===`browser`||e===`app`)return e;throw new o(`--mode must be 'browser' or 'app'`)}function le(e){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<1||t>65535)throw new o(`--ui-port must be a port number between 1 and 65535`);return t}function ue(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function $(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 de(e,t){let n=ue(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-CIK2GwPx.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-MGDi6UGf.mjs`),c=process.cwd(),l=t.remote!==void 0&&t.remote!==!1,u=typeof t.remote==`string`?t.remote:void 0,f=u===void 0?e:{...e,remote:{...e.remote,url:u}};process.title=U(c),l&&(typeof f.remote?.url!=`string`||f.remote.url===``)&&(console.error(o("--remote requires a public tunnel URL — pass it (`ok start --remote https://<your-tunnel-host>`) or set remote.url in .ok/config.yml.")),process.exit(78)),l&&console.warn(s([``,`⚠ REMOTE ACCESS ENABLED — no server-side authentication.`,` Anyone who can reach ${f.remote?.url} has FULL control of this`,` knowledge base, including sync, publishing, credentials, and local operations.`,` Restrict who can reach it at the tunnel: ngrok OAuth, Cloudflare Access,`,` Tailscale ACLs, or equivalent edge auth.`,``].join(`
|
|
2
2
|
`)));let p=V(t,process.env),m=H(p,l);m.coerced&&console.warn(`remote access is enabled and ${p} is not an IPv4 loopback bind — tunnels proxy to 127.0.0.1, so binding ${p} would leave the tunnel dialing a dead port. Using 127.0.0.1.`);let h=m.host,_=t.port===void 0?void 0:Number(t.port),v=process.env.PORT?Number(process.env.PORT):void 0,b=t.uiPort===void 0?void 0:Number(t.uiPort);l&&_===void 0&&v!==void 0&&console.warn(`remote access is enabled — ignoring env PORT=${process.env.PORT}; the tunnel's port mapping targets the stable remote port (${f.remote?.port}). Pass --port to override deliberately.`);let x=q(_,v,b,l)??(l?f.remote?.port:void 0);if(b!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./src-BuZeH4bR.mjs`);if(J(b,e(t(c)))){await X({cwd:c,uiPort:b});return}}let S=t.reactShellDistDir;if(l&&S===void 0){let e=import.meta.dirname??new URL(`.`,import.meta.url).pathname;S=[g(e,`public`),g(e,`../../app/dist`),g(e,`../../../app/dist`)].find(e=>y(e)),S===void 0&&console.warn(`remote access: bundled web UI not found — serving /mcp and /api only over the tunnel.`)}let C;try{C=await se({config:f,cwd:c,host:h,port:x,...b===void 0?{}:{uiPort:b},...t.serveContentAssets===void 0?{}:{serveContentAssets:t.serveContentAssets},...S?{reactShellDistDir:S}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{},...l?{enableRemote:!0}:{}})}catch(e){e instanceof W&&(console.error(o(e.message)),process.exit(1));let t=await import(`./src-BuZeH4bR.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),e instanceof t.RemoteConfigError&&(console.error(o(e.message)),process.exit(78)),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(o(e.message)),process.exit(1)),b!==void 0&&fe(e,t)){await X({cwd:c,uiPort:b});return}let n=pe(e,c,t);n!==null&&(console.error(o(n)),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let w=!1,T=async e=>{if(w)return;w=!0;let[t,...n]=$(e);console.log(i(`\n${t}`));for(let e of n)console.log(a(` ${e}`));if(C.spawnedUiPid!==null)try{let{getLogger:e,isProcessAlive:t,readUiLock:n}=await import(`./src-BuZeH4bR.mjs`);await Q({readUiLock:()=>n(C.lockDir),spawnedUiPid:()=>C.spawnedUiPid,isAlive:t,killPid:(e,t)=>process.kill(e,t),log:e(`start`),reason:`shutdown`})}catch(e){console.error(`${o(`ui sibling teardown failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`)}try{await C.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{T(`SIGINT`)}),process.once(`SIGTERM`,()=>{T(`SIGTERM`)});let E=`http://${h}:${C.port}`,D=h===`0.0.0.0`||h===`::`?`http://0.0.0.0:${C.port}`:void 0,O=C.resolvedUiPort,k=O!==null&&O>0?`http://${h}:${O}`:E;console.log(r({name:`open-knowledge`,version:d,localUrl:k,apiUrl:k===E?void 0:E,networkUrl:D,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let A={"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`};C.ready.then(async()=>{if(C.degraded.length>0){console.log();for(let e of C.degraded){let t=A[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${a(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-ifD987S6.mjs`);e(k)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function fe(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function pe(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=m(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`OpenKnowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.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`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function me(e){return new s(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`--ui-port <port>`,`Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path`,le).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,ce).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> (suppresses ok ui sibling)`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).option(`--remote [url]`,`Serve through a tunnel: admit requests carrying the tunnel Host with NO server-side auth (anyone who can reach the URL has full control — restrict access at the tunnel with edge auth). Bare --remote uses remote.url from .ok/config.yml; --remote <url> supplies it for this run.`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
3
3
|
`),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.uiPort!==void 0&&e.push(`--ui-port`),t.host!==void 0&&e.push(`--host`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=I(A());if(n.available){L({spawn:f},n);return}console.error(R(n.reason)),process.exit(1)}await de(n,t)})}export{B as C,D,L as E,ae as S,I as T,K as _,H as a,pe as b,G as c,fe as d,q as f,J as g,de as h,oe as i,U as l,ue as m,Z as n,Y as o,V as p,se as r,X as s,W as t,$ as u,me as v,A as w,ie as x,Q as y};
|
|
4
|
-
//# sourceMappingURL=start-
|
|
4
|
+
//# sourceMappingURL=start-DKwEh9gC.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/open-knowledge",
|
|
3
|
-
"version": "0.48.0
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"ajv-formats": "^3.0.1",
|
|
62
62
|
"tsdown": "^0.21.7",
|
|
63
63
|
"typescript": "^5.9.3",
|
|
64
|
-
"@inkeep/open-knowledge-app": "0.48.0
|
|
65
|
-
"@inkeep/open-knowledge-
|
|
66
|
-
"@inkeep/open-knowledge-
|
|
64
|
+
"@inkeep/open-knowledge-app": "0.48.0",
|
|
65
|
+
"@inkeep/open-knowledge-core": "0.48.0",
|
|
66
|
+
"@inkeep/open-knowledge-server": "0.48.0",
|
|
67
67
|
"@inkeep/open-knowledge-native-config": "0.0.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
package/dist/init-mzZ0flqJ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./init-DKGnIaVq.mjs";export{e as runInit};
|
package/dist/loader-BHzsvYfj.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-B5E-OO52.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-CKl5PSpe.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./index-D7Hnjtop.js";export{e as FeedbackForm};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./ManagedArtifactProperties-DwV7emUI.js";export{e as ManagedArtifactProperties};
|