@cmmd-center/forge 0.13.82 → 0.13.83
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/bin.cjs +145 -134
- package/dist/bin.mjs +169 -158
- package/dist/client/assets/{DiffPanel-B47H2Ztq.js → DiffPanel-BzKkiaBf.js} +3 -3
- package/dist/client/assets/{DiffPanel.logic-DT4FolWZ.js → DiffPanel.logic-VfGGX1sz.js} +2 -2
- package/dist/client/assets/DiffPanelShell-JOSW9RYb.js +2537 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-BrgXjqS5.js → DiffWorkerPoolProvider-L5rgnah4.js} +30 -30
- package/dist/client/assets/{PullRequestCodePanel-3MHkasTp.js → PullRequestCodePanel-CE_QRZf2.js} +2 -2
- package/dist/client/assets/{Virtualizer-BF72qd4z.js → Virtualizer-BAVMak1h.js} +2 -2
- package/dist/client/assets/cmmdAuthRedirect-CbWPYc_g.js +3 -0
- package/dist/client/assets/{index-jjmPqZtL.js → index-DVBLRDej.js} +61 -61
- package/dist/client/index.html +5 -5
- package/dist/forge-build.json +1 -1
- package/dist/{open-2-reBrpv.mjs → open-yHTUkd2Y.mjs} +3 -3
- package/package.json +1 -1
- package/dist/client/assets/DiffPanelShell-DYfYdx6r.js +0 -2537
- package/dist/client/assets/cmmdAuthRedirect-lzr9SGGx.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{Wa as n}from"./Stream-mUTFnSY9.js";import{a as r,c as i,l as a,n as o,o as s,r as c,s as l}from"./atomRegistry-C1yW8tyM.js";import{B as ee,On as te}from"./src-IM0FnQax.js";var u=t(n(),1),d=new WeakMap;function ne(e,t){let n=d.get(e);n===void 0&&(n=new WeakMap,d.set(e,n));let i=n.get(t);if(i!==void 0)return i;let a={subscribe(n){return e.subscribe(t,n)},snapshot(){return e.get(t)},getServerSnapshot(){return r(t,e)}};return n.set(t,a),a}function f(e,t){let n=ne(e,t);return u.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var p=(e,t)=>{let n=u.useContext(c);return t?f(n,u.useMemo(()=>i(e,t),[e,t])):f(n,e)},re=(e,t,n)=>{let r=u.useContext(c);u.useEffect(()=>r.subscribe(e,t,n),[r,e,t,n?.immediate])},ie=new Set([`localhost`,`127.0.0.1`,`::1`]);function ae(e){return e.trim().toLowerCase().replace(/^\[(.*)\]$/,`$1`)}function m(e){let t=ae(e);return ie.has(t)||t.endsWith(`.localhost`)}function oe(e){try{return m(new URL(e).hostname)}catch{return!1}}function se(e){let t=e.split(`.`).map(e=>Number(e));if(t.length!==4||t.some(e=>!Number.isInteger(e)||e<0||e>255))return!1;let[n,r]=t;return n===10||n===172&&r>=16&&r<=31||n===192&&r===168}var ce=`/api/dev/local-web/bootstrap`,le=3e3,h=null,g=null,_=null;function ue(){return _!==null&&Date.now()-_<le}function de(e){try{return te(ee)(e)}catch{return null}}function fe(){return!1}function v(){return typeof window>`u`?null:window.desktopBridge?.getLocalEnvironmentBootstrap()??h}async function pe(){if(!fe()||window.desktopBridge)return h=null,v();let e;try{e=await fetch(new URL(ce,window.location.origin),{credentials:`include`})}catch{return h=null,_=Date.now(),null}if(e.status===204||e.status===404||!e.ok)return h=null,_=Date.now(),null;let t=de(await e.json().catch(()=>null));return h=t,_=null,t}async function me(){let e=typeof window>`u`?null:window.desktopBridge?.getLocalEnvironmentBootstrap();return e?(h=null,e):h||(ue()?null:g||(g=pe().finally(()=>{g=null}),g))}function y(){return v()}var b=`forge_backend_mode`,he=`forge_apex_url`;function x(){return y()}function S(e){return new URL(e,window.location.origin).toString()}function ge(e,t){let n=new URL(e);return`${n.pathname.endsWith(`/`)?n.pathname.slice(0,-1):n.pathname}${t.startsWith(`/`)?t:`/${t}`}`}function C(e){let t;try{t=new URL(window.location.href)}catch{return e}let n=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&t.port!==``&&n.port!==``&&t.origin!==n.origin&&m(t.hostname)&&m(n.hostname),e}function _e(){return null}function ve(){let e=S(window.location.origin),t=new URL(e);if(t.protocol===`http:`)t.protocol=`ws:`;else if(t.protocol===`https:`)t.protocol=`wss:`;else throw Error(`Unsupported HTTP base URL protocol: ${t.protocol}`);return t.pathname=`/ws`,{source:`window-origin`,target:{httpBaseUrl:e,wsBaseUrl:t.toString()}}}function ye(){try{if(localStorage.getItem(b)!==`apex`)return null;let e=localStorage.getItem(he)?.trim()??void 0??``;if(!e)return null;let t=S(e),n=new URL(t);return n.protocol=t.startsWith(`https:`)?`wss:`:`ws:`,{source:`configured`,target:{httpBaseUrl:t,wsBaseUrl:n.toString()}}}catch{return null}}function be(){let e=x();return!e||e.primaryMode!==`cloud`||!e.bearerToken?null:{source:`paired-bearer`,target:{httpBaseUrl:S(e.httpBaseUrl),wsBaseUrl:S(e.wsBaseUrl)},bearerToken:e.bearerToken}}function xe(){let e=x();if(!e||e.primaryMode===`cloud`||!e.httpBaseUrl&&!e.wsBaseUrl)return null;if(!e.httpBaseUrl||!e.wsBaseUrl)throw Error(`Desktop bootstrap must provide both httpBaseUrl and wsBaseUrl for the local environment.`);return{source:`desktop-managed`,target:{httpBaseUrl:S(e.httpBaseUrl),wsBaseUrl:S(e.wsBaseUrl)},...e.bearerToken?{bearerToken:e.bearerToken}:{}}}function w(e,t){let n=T();if(!n)throw Error(`Unable to resolve the primary environment HTTP base URL.`);let r=new URL(C(n.target.httpBaseUrl));return r.pathname=ge(r.toString(),e),t&&(r.search=new URLSearchParams(t).toString()),r.toString()}function T(){return be()??ye()??xe()??_e()??ve()}function E(e={}){let t=T(),n=t?.bearerToken;return!t||!n||!Se(t)?e:{...e,credentials:`omit`,headers:{...e.headers,Authorization:`Bearer ${n}`}}}function Se(e){if(e.source!==`desktop-managed`||typeof window>`u`)return!0;try{return new URL(C(e.target.httpBaseUrl)).origin!==window.location.origin}catch{return!0}}async function D(e,t){return await e.text()||t}async function O(){let e=w(`/api/auth/logout`),t=await fetch(e,E({credentials:`include`,method:`POST`}));if(!t.ok)throw Error(await D(t,`Failed to logout authenticated session (${t.status}).`))}var k=1e3,A=2,j=64e3,Ce=Object.freeze({attemptCount:0,closeCode:null,closeReason:null,connectedAt:null,disconnectedAt:null,hasConnected:!1,lastError:null,lastErrorAt:null,nextRetryAt:null,online:typeof navigator>`u`||navigator.onLine!==!1,phase:`idle`,reconnectAttemptCount:0,reconnectMaxAttempts:11,reconnectPhase:`idle`,socketUrl:null}),M=l(Ce).pipe(s,a(`ws-connection-status`)),N=Object.freeze({status:`ok`}),P=l(N).pipe(s,a(`cloud-auth-failure`));function we(e){o.get(P).status!==`expired`&&o.set(P,{status:`expired`,detectedAt:new Date().toISOString(),source:e})}function F(){o.set(P,N)}function Te(){return o.get(P)}function I(){return new Date().toISOString()}function L(e){let t=e(R());return o.set(M,t),t}function R(){return o.get(M)}function z(e){return e.phase===`connected`||e.hasConnected&&e.disconnectedAt===null&&e.phase===`connecting`?`connected`:!e.online&&(e.disconnectedAt!==null||e.phase===`disconnected`)?`offline`:e.hasConnected?`reconnecting`:e.phase===`disconnected`?`error`:`connecting`}function Ee(e){return L(t=>({...t,attemptCount:t.attemptCount+1,nextRetryAt:null,phase:`connecting`,reconnectAttemptCount:t.phase===`connected`?1:t.reconnectAttemptCount+1,reconnectPhase:`attempting`,socketUrl:e}))}function De(){return L(e=>({...e,closeCode:null,closeReason:null,connectedAt:I(),disconnectedAt:null,hasConnected:!0,nextRetryAt:null,phase:`connected`,reconnectAttemptCount:0,reconnectPhase:`idle`}))}function Oe(e){return L(t=>V(t,{lastError:e?.trim()?e:t.lastError,lastErrorAt:I()}))}function ke(e){return L(t=>t.hasConnected&&Ae(e)?t:V(t,{closeCode:e?.code??t.closeCode,closeReason:e?.reason?.trim()?e.reason:t.closeReason}))}function Ae(e){return(e?.reason?.trim()??``).length===0&&(e?.code===1e3||e?.code===1001)}function je(e){return L(t=>({...t,online:e}))}function Me(){return L(e=>({...e,nextRetryAt:null,reconnectAttemptCount:0,reconnectPhase:`idle`}))}function Ne(){return p(M)}function B(e){return!Number.isInteger(e)||e<0||e>=10?null:Math.min(Math.round(k*A**e),j)}function V(e,t){let n=e.disconnectedAt??I(),r=e.nextRetryAt!==null||e.reconnectPhase===`exhausted`?null:B(Math.max(0,e.reconnectAttemptCount-1));return{...e,...t,disconnectedAt:n,nextRetryAt:r===null?e.nextRetryAt:new Date(Date.now()+r).toISOString(),phase:`disconnected`,reconnectPhase:e.reconnectPhase===`waiting`||e.reconnectPhase===`exhausted`?e.reconnectPhase:r===null?`exhausted`:`waiting`}}var H=class extends Error{constructor(e=`Session has expired. Please re-login.`){super(e),this.name=`ForgeAuthExpiredError`}};function Pe(e){return e instanceof H||e instanceof Error&&e.name===`ForgeAuthExpiredError`}var U=`forge_auth_expired_reason`,Fe=`session-expired`,W=`reason`,G=`cmmd-auth-expired`,K={"session-expired":`Session has expired. Please re-login.`,"desktop-session-required":`Forge Desktop needs a CMMD sign-in before this device can host or control runtimes.`,"desktop-principal-mismatch":`Forge Desktop and the local Forge session are signed in to different CMMD accounts. Sign in again to reconcile them.`,"desktop-state-unavailable":`Forge Desktop could not verify its native CMMD session. Restart Forge or sign in again.`};function Ie(e){if(!(e===null||!(e in K)))return K[e]}function q(e){if(!(typeof window>`u`))try{window.sessionStorage.setItem(U,e)}catch{}}function Le(){if(typeof window>`u`)return null;try{return new URL(window.location.href).searchParams.getAll(W).includes(G)?Fe:null}catch{return null}}function J(){if(!(typeof window>`u`))try{let e=new URL(window.location.href),t=e.searchParams.getAll(W);if(!t.includes(G))return;e.searchParams.delete(W);for(let n of t)n!==G&&e.searchParams.append(W,n);window.history.replaceState({},typeof document>`u`?``:document.title,e.toString())}catch{}}function Y(){let e=Le();return e!==null&&J(),e}function Re(){if(!(typeof window>`u`)){try{window.sessionStorage.removeItem(U)}catch{}J()}}function ze(){if(typeof window>`u`)return null;try{let e=window.sessionStorage.getItem(U);return J(),e}catch{return J(),null}}function Be(){if(typeof window>`u`)return null;try{let e=window.sessionStorage.getItem(U);return e===null?Y():(window.sessionStorage.removeItem(U),J(),e)}catch{return Y()}}async function X(){try{let e=w(`/api/auth/session/renew`);return e.startsWith(`https://`)?(await fetch(e,{credentials:`include`,method:`POST`})).ok:!1}catch{return!1}}async function Z(){if(await X()){F(),window.location.reload();return}await O().catch(()=>void 0),F(),q(`session-expired`);let e=new URL(w(`/login`));window.location.assign(e.toString())}var Ve=e({handleCmmdAuthExpired:()=>$}),Q=null;async function $(e){if((e===void 0||e===401)&&!(typeof window>`u`))return Q||(Q=Z().finally(()=>{Q=null}),Q)}export{w as A,Me as C,O as D,Ne as E,se as F,re as I,p as L,me as M,m as N,E as O,oe as P,De as S,we as T,z as _,Re as a,ke as b,Z as c,q as d,Be as f,R as g,Te as h,H as i,y as j,T as k,X as l,P as m,$ as n,Pe as o,F as p,U as r,ze as s,Ve as t,Ie as u,B as v,je as w,Oe as x,Ee as y};
|
|
2
|
-
//# sourceMappingURL=cmmdAuthRedirect-lzr9SGGx.js.map
|