@north-light/cli 0.3.536 → 0.3.537
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
var J=Object.defineProperty;var a=(e,t)=>J(e,"name",{value:t,configurable:!0});import{createHash as V,randomBytes as T,randomUUID as K}from"node:crypto";import{createServer as X}from"node:http";import{RunError as u}from"../runs/operations.js";import{ANTHROPIC_PROVIDER_ID as w,OPENAI_CHATGPT_PROVIDER_ID as m,OPENAI_CODEX_PROVIDER_ID as k,commitManagedLogin as Y,openAIDeviceId as Z,readSubscriptionPool as W}from"../subscription-state.js";const R=900,L="9d1c250a-e61b-44d9-88ed-5944d1962f5e",Q="https://claude.ai/oauth/authorize",ee="https://console.anthropic.com/oauth/code/callback",N={port:53692,path:"/callback",redirect:"http://localhost:53692/callback"},te="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload",I="app_EMoamEEZ73f0CkXaXp7hrann",ne="https://auth.openai.com/codex/device",U="https://auth.openai.com/deviceauth/callback",D={port:1455,path:"/auth/callback",redirect:"http://localhost:1455/auth/callback"},re="openid profile email offline_access",ie=900,G="https://api.openai.com/auth",oe="dynamic_agent_client",ae="crtr",se="https://auth.openai.com/api/accounts/authorize",H="https://api.openai.com/v1",b={port:1455,path:"/auth/callback",redirect:"http://127.0.0.1:1455/auth/callback"},E="chatgpt.tokens.use.direct",ce=`openid profile email offline_access resource.invoke ${E}`,de=180*1e3,ue=a(()=>process.env.CRTR_MODEL_AUTH_ANTHROPIC_TOKEN_URL||"https://platform.claude.com/v1/oauth/token","anthropicTokenUrl"),P=a(()=>(process.env.CRTR_MODEL_AUTH_OPENAI_BASE||"https://auth.openai.com").replace(/\/$/,""),"openaiBase"),_=new Map,y=new Map;function C(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}a(C,"base64url");function he(){const e=C(T(32));return{verifier:e,challenge:C(V("sha256").update(e).digest())}}a(he,"pkce");const M="openai-chatgpt";function $(e){if(e==="openai")return k;if(e===M)return m;if(e===w||e===k)return e;throw new u(400,"invalid_request","provider must be anthropic, openai-codex, or openai-chatgpt","provider")}a($,"managedProvider");function Ie(e){return e===m?M:e}a(Ie,"modelAuthApiProvider");function Ee(e){return $(e)}a(Ee,"modelAuthProvider");function f(e,t,n){if(e.status==="pending"){e.status=t,n!==void 0&&(e.message=n),clearTimeout(e.timer),e.abort.abort(),e.server?.close(),e.server?.closeIdleConnections(),y.get(e.provider)===e.id&&y.delete(e.provider);for(const i of e.waiters)i();e.waiters.clear(),setTimeout(()=>{_.get(e.id)===e&&_.delete(e.id)},6e4).unref()}}a(f,"settle");async function S(e,t){if(e.status!=="pending")throw new Error("the sign-in ended before the credential was written");await Y(e.provider,e.label,{access:t.access,refresh:t.refresh,expires:t.expires,...t.accountId?{accountId:t.accountId}:{},...t.clientId?{clientId:t.clientId}:{},...t.email?{email:t.email}:{},lastRateLimitedAt:e.lastRateLimitedAt,autoLabel:e.label===void 0})}a(S,"writeCredential");async function j(e,t,n){const i=await fetch(ue(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"authorization_code",client_id:L,code:t,state:n,redirect_uri:e.redirectUri,code_verifier:e.verifier}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(!i.ok)throw new Error(`Anthropic token exchange failed (${i.status})`);const r=await i.json();if(typeof r.access_token!="string"||typeof r.refresh_token!="string"||typeof r.expires_in!="number"||!Number.isFinite(r.expires_in))throw new Error("Anthropic token exchange returned no credential");await S(e,{access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1e3-300*1e3})}a(j,"exchangeAnthropic");function pe(e){const t=e.split(".")[1];let n;try{n=JSON.parse(Buffer.from(t??"","base64url").toString("utf8"))[G]?.chatgpt_account_id}catch{n=void 0}if(typeof n!="string"||n==="")throw new Error("OpenAI token carries no ChatGPT account id");return n}a(pe,"openaiAccountId");async function q(e,t,n,i){const r=await fetch(`${P()}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:I,code:t,code_verifier:n,redirect_uri:i}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(!r.ok)throw new Error(`OpenAI token exchange failed (${r.status})`);const o=await r.json();if(typeof o.access_token!="string"||typeof o.refresh_token!="string"||typeof o.expires_in!="number")throw new Error("OpenAI token exchange returned no credential");await S(e,{access:o.access_token,refresh:o.refresh_token,expires:Date.now()+o.expires_in*1e3,accountId:pe(o.access_token)})}a(q,"exchangeOpenAI");function F(e){try{const t=JSON.parse(Buffer.from(e?.split(".")[1]??"","base64url").toString("utf8"));return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:void 0}catch{return}}a(F,"jwtPayload");function le(...e){for(const t of e){const n=F(t)?.[G];if(typeof n?.chatgpt_account_id=="string"&&n.chatgpt_account_id)return n.chatgpt_account_id}}a(le,"chatgptAccountId");function z(e,t){const n=e.searchParams.get("error");if(n)throw new u(400,"invalid_request",`ChatGPT authorization failed: ${n}`,"input");const i=e.searchParams.get("code");if(!i)throw new u(400,"invalid_request","the redirect URL has no authorization code","input");if(e.searchParams.get("state")!==t)throw new u(400,"invalid_request","the pasted redirect URL belongs to a different sign-in","state");const r=e.searchParams.get("client_id")?.trim();if(!r)throw new u(400,"invalid_request","the redirect URL carries no issued client id","input");return{code:i,clientId:r}}a(z,"chatgptCallback");async function B(e,t,n){const i=await fetch(`${P()}/api/accounts/oauth/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:n,code:t,code_verifier:e.verifier,redirect_uri:e.redirectUri,resource:H}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(!i.ok)throw new Error(`ChatGPT token exchange failed (${i.status})`);const r=await i.json();if(typeof r.access_token!="string"||!r.access_token||typeof r.refresh_token!="string"||!r.refresh_token||typeof r.expires_in!="number"||!Number.isFinite(r.expires_in)||r.expires_in<=0||typeof r.id_token!="string"||!r.id_token)throw new Error("ChatGPT token exchange returned no credential");if(!(typeof r.scope=="string"?r.scope.trim().split(/\s+/):[]).includes(E))throw new Error(`ChatGPT sign-in did not grant ${E}`);const s=le(r.access_token,r.id_token),h=F(r.id_token)?.email;await S(e,{access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1e3-de,clientId:n,...s?{accountId:s}:{},...typeof h=="string"&&h?{email:h}:{}})}a(B,"exchangeChatGPT");function fe(e,t){return new Promise((n,i)=>{if(t.aborted){i(new Error("flow ended"));return}const r=a(()=>{clearTimeout(o),i(new Error("flow ended"))},"onAbort"),o=setTimeout(()=>{t.removeEventListener("abort",r),n()},e);t.addEventListener("abort",r,{once:!0})})}a(fe,"sleep");async function _e(e,t){const n=Math.min(e.expiresAt,Date.now()+ie*1e3);let i=Math.max(1e3,Math.floor(t.intervalS*1e3));try{for(;Date.now()<n&&(await fe(Math.min(i,Math.max(0,n-Date.now())),e.abort.signal),!(Date.now()>=n));){const r=await fetch(`${P()}/api/accounts/deviceauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:t.deviceAuthId,user_code:t.userCode}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(r.ok){const h=await r.json();if(typeof h.authorization_code!="string"||typeof h.code_verifier!="string")throw new Error("OpenAI device approval returned no code");await q(e,h.authorization_code,h.code_verifier,U),f(e,"connected");return}if(r.status===403||r.status===404)continue;const o=await r.text().catch(()=>"");let s;try{const h=JSON.parse(o).error;s=typeof h=="object"&&h!==null?h.code:h}catch{s=void 0}if(s!=="deviceauth_authorization_pending"){if(s==="slow_down"){i+=5e3;continue}throw new Error(`OpenAI device sign-in failed (${r.status})`)}}f(e,"expired","the OpenAI code expired")}catch(r){e.status==="pending"&&f(e,"failed",r instanceof Error?r.message:String(r))}}a(_e,"pollDevice");function O(e,t){const n=X((i,r)=>{const o=new URL(i.url??"/","http://localhost"),s=a((l,p)=>{r.writeHead(l,{"Content-Type":"text/plain; charset=utf-8",Connection:"close"}),r.end(p)},"reply");if(o.pathname!==t.path){s(404,"Not found.");return}const h=o.searchParams.get("code");if(o.searchParams.get("state")!==e.state||!h){s(400,"Sign-in could not be completed: state mismatch or missing code.");return}let d="";if(e.provider===m)try{d=z(o,e.state).clientId}catch(l){s(400,`Sign-in could not be completed: ${l instanceof Error?l.message:String(l)}.`);return}if(e.status!=="pending"||e.exchanging){s(409,"This sign-in has already finished.");return}e.exchanging=!0,(e.provider===w?j(e,h,e.state):e.provider===m?B(e,h,d):q(e,h,e.verifier,e.redirectUri)).then(()=>{s(200,"Signed in. You can close this window."),f(e,"connected")},l=>{s(502,"The vendor refused the sign-in."),f(e,"failed",l instanceof Error?l.message:String(l))})});return e.server=n,new Promise((i,r)=>{n.once("error",o=>r(new u(409,"conflict",`cannot listen on localhost:${t.port} for the vendor redirect (${o.code??o.message})`,"redirect"))),n.listen(t.port,"127.0.0.1",()=>i())})}a(O,"listenLoopback");async function Ce(e){const t=$(e.provider);if(e.redirect!==void 0&&e.redirect!=="loopback")throw new u(400,"invalid_request",'redirect must be "loopback" when present',"redirect");if(e.label!==void 0&&typeof e.label!="string")throw new u(400,"invalid_request","label must be a string when present","label");const n=typeof e.label=="string"&&e.label.trim()?e.label.trim():void 0,i=y.get(t);if(i!==void 0){const p=_.get(i);p&&f(p,"failed","replaced by a newer sign-in")}const{verifier:r,challenge:o}=he(),s=e.redirect==="loopback",h=Date.now()+R*1e3,d={id:K(),provider:t,kind:s?"loopback":t===w?"code_page":t===m?"redirect_paste":"device",state:t===w?r:T(16).toString("hex"),verifier:r,redirectUri:t===w?s?N.redirect:ee:t===m?b.redirect:s?D.redirect:U,expiresAt:h,status:"pending",...e.jti?{jti:e.jti}:{},...n?{label:n}:{},lastRateLimitedAt:Math.max(0,...W(t).map(p=>p.lastRateLimitedAt)),abort:new AbortController,timer:setTimeout(()=>f(d,"expired","the sign-in expired"),R*1e3),waiters:new Set,exchanging:!1};d.timer.unref(),ge(d);const A=a(()=>new u(409,"conflict","a newer sign-in for this provider replaced this one","provider"),"replacedDuringStart"),l={flow_id:d.id,provider:t,expires_at:new Date(h).toISOString()};try{if(t===w){const c=new URLSearchParams;if(c.set("code","true"),c.set("client_id",L),c.set("response_type","code"),c.set("redirect_uri",d.redirectUri),c.set("scope",te),c.set("code_challenge",o),c.set("code_challenge_method","S256"),c.set("state",d.state),s&&await O(d,N),d.status!=="pending")throw A();return{...l,url:`${Q}?${c.toString()}`,instructions:s?"Sign in to Claude in your browser; this finishes by itself.":"Sign in to Claude, then copy the code Claude shows and paste it here."}}if(t===m){const c=new URL(se);if(c.search=new URLSearchParams({client_id:oe,agent_name_hint:ae,ext_agent_host_id:`urn:uuid:${Z()}`,response_type:"code",redirect_uri:d.redirectUri,resource:H,scope:ce,state:d.state,code_challenge:o,code_challenge_method:"S256",nonce:C(T(32))}).toString(),s&&await O(d,b),d.status!=="pending")throw A();return{...l,url:c.toString(),instructions:s?"Sign in with ChatGPT in your browser; this finishes by itself. If it does not, paste the final redirect URL here.":`Sign in with ChatGPT, then copy the full URL your browser lands on (it starts with ${b.redirect} and may show a connection error) and paste it here.`}}if(s){const c=new URL("https://auth.openai.com/oauth/authorize");if(c.searchParams.set("response_type","code"),c.searchParams.set("client_id",I),c.searchParams.set("redirect_uri",d.redirectUri),c.searchParams.set("scope",re),c.searchParams.set("code_challenge",o),c.searchParams.set("code_challenge_method","S256"),c.searchParams.set("state",d.state),c.searchParams.set("id_token_add_organizations","true"),c.searchParams.set("codex_cli_simplified_flow","true"),c.searchParams.set("originator","pi"),await O(d,D),d.status!=="pending")throw A();return{...l,url:c.toString(),instructions:"Sign in to ChatGPT in your browser; this finishes by itself."}}const p=await fetch(`${P()}/api/accounts/deviceauth/usercode`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:I}),signal:AbortSignal.timeout(3e4)});if(!p.ok)throw new u(502,"upstream_refused",`OpenAI refused to issue a device code (${p.status})`);const g=await p.json(),v=typeof g.interval=="string"?Number(g.interval.trim()):g.interval;if(typeof g.device_auth_id!="string"||typeof g.user_code!="string"||typeof v!="number"||!Number.isFinite(v)||v<0)throw new u(502,"upstream_refused","OpenAI returned an invalid device code");if(d.status!=="pending")throw A();return _e(d,{deviceAuthId:g.device_auth_id,userCode:g.user_code,intervalS:v}),{...l,url:ne,user_code:g.user_code,instructions:"Open the link, sign in to ChatGPT, and enter the code. The code expires in 15 minutes."}}catch(p){throw f(d,"failed",p instanceof Error?p.message:String(p)),_.delete(d.id),p instanceof u?p:new u(502,"upstream_refused",`vendor sign-in could not start: ${p instanceof Error?p.message:String(p)}`)}}a(Ce,"startModelAuthFlow");function ge(e){_.set(e.id,e),y.set(e.provider,e.id)}a(ge,"register");function Se(e){const t=_.get(e);if(t)return f(t,"failed","cancelled"),x(t)}a(Se,"cancelModelAuthFlow");function me(e){const t=e.trim();if(!t)return{};try{const n=new URL(t);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){const[n,i]=t.split("#",2);return{code:n,state:i}}if(t.includes("code=")){const n=new URLSearchParams(t);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:t}}a(me,"parseCodeInput");function we(e){const t=typeof e=="string"?_.get(e):void 0;if(!t||t.status!=="pending"||Date.now()>=t.expiresAt)throw new u(400,"invalid_request","no in-flight sign-in has this flow_id","flow_id");return t}a(we,"pendingFlow");async function Oe(e,t){const n=we(e);if(n.provider===m)return Ae(n,t);if(n.kind!=="code_page")throw new u(400,"invalid_request","this sign-in completes without a pasted code","flow_id");if(n.exchanging)throw new u(400,"invalid_request","this sign-in is already being completed","flow_id");if(typeof t!="string")throw new u(400,"invalid_request","input must be the code Claude shows","input");const{code:i,state:r}=me(t);if(!i)throw new u(400,"invalid_request","input must be the code Claude shows","input");if(r!==void 0&&r!==n.state)throw new u(400,"invalid_request","the pasted code belongs to a different sign-in","state");n.exchanging=!0;try{await j(n,i,r??n.state)}catch(o){throw f(n,"failed",o instanceof Error?o.message:String(o)),new u(502,"upstream_refused","Anthropic refused the code")}return f(n,"connected"),{flow_id:n.id,provider:n.provider,status:"connected"}}a(Oe,"completeModelAuthFlow");async function Ae(e,t){if(e.exchanging)throw new u(400,"invalid_request","this sign-in is already being completed","flow_id");const n=new URL(b.redirect);let i;try{i=typeof t=="string"?new URL(t.trim()):void 0}catch{i=void 0}if(!i||i.origin!==n.origin||i.pathname!==n.pathname)throw new u(400,"invalid_request",`input must be the full redirect URL starting with ${b.redirect}`,"input");const{code:r,clientId:o}=z(i,e.state);e.exchanging=!0;try{await B(e,r,o)}catch(s){throw f(e,"failed",s instanceof Error?s.message:String(s)),new u(502,"upstream_refused","OpenAI refused the ChatGPT sign-in")}return f(e,"connected"),{flow_id:e.id,provider:e.provider,status:"connected"}}a(Ae,"completeChatGPTFlow");function x(e){return{flow_id:e.id,provider:e.provider,status:e.status,...e.message?{message:e.message}:{},...e.jti?{jti:e.jti}:{}}}a(x,"view");function xe(e){const t=_.get(e);return t?x(t):void 0}a(xe,"readModelAuthFlow");async function ke(e,t,n){const i=_.get(e);if(i)return i.status==="pending"&&t>0&&!n?.aborted&&await new Promise(r=>{const o=a(()=>{clearTimeout(s),n?.removeEventListener("abort",o),i.waiters.delete(o),r()},"done"),s=setTimeout(o,t);n?.addEventListener("abort",o,{once:!0}),i.waiters.add(o)}),x(i)}a(ke,"waitModelAuthFlow");function Re(){for(const e of _.values())f(e,"failed","reset");_.clear(),y.clear()}a(Re,"resetModelAuthFlowsForTest");export{R as MODEL_AUTH_FLOW_TTL_S,M as OPENAI_CHATGPT_API_PROVIDER,Se as cancelModelAuthFlow,Oe as completeModelAuthFlow,Ie as modelAuthApiProvider,Ee as modelAuthProvider,xe as readModelAuthFlow,Re as resetModelAuthFlowsForTest,Ce as startModelAuthFlow,ke as waitModelAuthFlow};
|
|
1
|
+
var J=Object.defineProperty;var a=(e,t)=>J(e,"name",{value:t,configurable:!0});import{createHash as V,randomBytes as T,randomUUID as K}from"node:crypto";import{createServer as X}from"node:http";import{RunError as u}from"../runs/operations.js";import{ANTHROPIC_PROVIDER_ID as w,OPENAI_CHATGPT_PROVIDER_ID as m,OPENAI_CODEX_PROVIDER_ID as k,commitManagedLogin as Y,openAIDeviceId as Z,readSubscriptionPool as W}from"../subscription-state.js";const R=900,L="9d1c250a-e61b-44d9-88ed-5944d1962f5e",Q="https://claude.ai/oauth/authorize",ee="https://console.anthropic.com/oauth/code/callback",N={port:53692,path:"/callback",redirect:"http://localhost:53692/callback"},te="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload",I="app_EMoamEEZ73f0CkXaXp7hrann",ne="https://auth.openai.com/codex/device",U="https://auth.openai.com/deviceauth/callback",D={port:1455,path:"/auth/callback",redirect:"http://localhost:1455/auth/callback"},re="openid profile email offline_access",ie=900,G="https://api.openai.com/auth",oe="dynamic_agent_client",ae="crtr",se="https://auth.openai.com/api/accounts/authorize",H="https://api.openai.com/v1",b={port:1455,path:"/auth/callback",redirect:"http://127.0.0.1:1455/auth/callback"},E="chatgpt.tokens.use.direct",ce=`openid profile email offline_access resource.invoke ${E}`,de=180*1e3,ue=a(()=>process.env.CRTR_MODEL_AUTH_ANTHROPIC_TOKEN_URL||"https://platform.claude.com/v1/oauth/token","anthropicTokenUrl"),P=a(()=>(process.env.CRTR_MODEL_AUTH_OPENAI_BASE||"https://auth.openai.com").replace(/\/$/,""),"openaiBase"),_=new Map,y=new Map;function C(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}a(C,"base64url");function he(){const e=C(T(32));return{verifier:e,challenge:C(V("sha256").update(e).digest())}}a(he,"pkce");const M="openai-chatgpt";function $(e){if(e==="openai")return k;if(e===M)return m;if(e===w||e===k)return e;throw new u(400,"invalid_request","provider must be anthropic, openai-codex, or openai-chatgpt","provider")}a($,"managedProvider");function Ie(e){return e===m?M:e}a(Ie,"modelAuthApiProvider");function Ee(e){return $(e)}a(Ee,"modelAuthProvider");function f(e,t,n){if(e.status==="pending"){e.status=t,n!==void 0&&(e.message=n),clearTimeout(e.timer),e.abort.abort(),e.server?.close(),e.server?.closeIdleConnections(),y.get(e.provider)===e.id&&y.delete(e.provider);for(const i of e.waiters)i();e.waiters.clear(),setTimeout(()=>{_.get(e.id)===e&&_.delete(e.id)},6e4).unref()}}a(f,"settle");async function S(e,t){if(e.status!=="pending")throw new Error("the sign-in ended before the credential was written");await Y(e.provider,e.label,{access:t.access,refresh:t.refresh,expires:t.expires,...t.accountId?{accountId:t.accountId}:{},...t.clientId?{clientId:t.clientId}:{},...t.email?{email:t.email}:{},lastRateLimitedAt:e.lastRateLimitedAt,autoLabel:e.label===void 0})}a(S,"writeCredential");async function j(e,t,n){const i=await fetch(ue(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"authorization_code",client_id:L,code:t,state:n,redirect_uri:e.redirectUri,code_verifier:e.verifier}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(!i.ok)throw new Error(`Anthropic token exchange failed (${i.status})`);const r=await i.json();if(typeof r.access_token!="string"||typeof r.refresh_token!="string"||typeof r.expires_in!="number"||!Number.isFinite(r.expires_in))throw new Error("Anthropic token exchange returned no credential");await S(e,{access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1e3-300*1e3})}a(j,"exchangeAnthropic");function pe(e){const t=e.split(".")[1];let n;try{n=JSON.parse(Buffer.from(t??"","base64url").toString("utf8"))[G]?.chatgpt_account_id}catch{n=void 0}if(typeof n!="string"||n==="")throw new Error("OpenAI token carries no ChatGPT account id");return n}a(pe,"openaiAccountId");async function q(e,t,n,i){const r=await fetch(`${P()}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:I,code:t,code_verifier:n,redirect_uri:i}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(!r.ok)throw new Error(`OpenAI token exchange failed (${r.status})`);const o=await r.json();if(typeof o.access_token!="string"||typeof o.refresh_token!="string"||typeof o.expires_in!="number")throw new Error("OpenAI token exchange returned no credential");await S(e,{access:o.access_token,refresh:o.refresh_token,expires:Date.now()+o.expires_in*1e3,accountId:pe(o.access_token)})}a(q,"exchangeOpenAI");function F(e){try{const t=JSON.parse(Buffer.from(e?.split(".")[1]??"","base64url").toString("utf8"));return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:void 0}catch{return}}a(F,"jwtPayload");function le(...e){for(const t of e){const n=F(t)?.[G];if(typeof n?.chatgpt_account_id=="string"&&n.chatgpt_account_id)return n.chatgpt_account_id}}a(le,"chatgptAccountId");function z(e,t){const n=e.searchParams.get("error");if(n)throw new u(400,"invalid_request",`ChatGPT authorization failed: ${n}`,"input");const i=e.searchParams.get("code");if(!i)throw new u(400,"invalid_request","the redirect URL has no authorization code","input");if(e.searchParams.get("state")!==t)throw new u(400,"invalid_request","the pasted redirect URL belongs to a different sign-in","state");const r=e.searchParams.get("client_id")?.trim();if(!r)throw new u(400,"invalid_request","the redirect URL carries no issued client id","input");return{code:i,clientId:r}}a(z,"chatgptCallback");async function B(e,t,n){const i=await fetch(`${P()}/api/accounts/oauth/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:n,code:t,code_verifier:e.verifier,redirect_uri:e.redirectUri,resource:H}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(!i.ok)throw new Error(`ChatGPT token exchange failed (${i.status})`);const r=await i.json();if(typeof r.access_token!="string"||!r.access_token||typeof r.refresh_token!="string"||!r.refresh_token||typeof r.expires_in!="number"||!Number.isFinite(r.expires_in)||r.expires_in<=0||typeof r.id_token!="string"||!r.id_token)throw new Error("ChatGPT token exchange returned no credential");if(!(typeof r.scope=="string"?r.scope.trim().split(/\s+/):[]).includes(E))throw new Error(`ChatGPT sign-in did not grant ${E}`);const s=le(r.access_token,r.id_token),h=F(r.id_token)?.email;await S(e,{access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1e3-de,clientId:n,...s?{accountId:s}:{},...typeof h=="string"&&h?{email:h}:{}})}a(B,"exchangeChatGPT");function fe(e,t){return new Promise((n,i)=>{if(t.aborted){i(new Error("flow ended"));return}const r=a(()=>{clearTimeout(o),i(new Error("flow ended"))},"onAbort"),o=setTimeout(()=>{t.removeEventListener("abort",r),n()},e);t.addEventListener("abort",r,{once:!0})})}a(fe,"sleep");async function _e(e,t){const n=Math.min(e.expiresAt,Date.now()+ie*1e3);let i=Math.max(1e3,Math.floor(t.intervalS*1e3));try{for(;Date.now()<n&&(await fe(Math.min(i,Math.max(0,n-Date.now())),e.abort.signal),!(Date.now()>=n));){const r=await fetch(`${P()}/api/accounts/deviceauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:t.deviceAuthId,user_code:t.userCode}),signal:AbortSignal.any([e.abort.signal,AbortSignal.timeout(3e4)])});if(r.ok){const h=await r.json();if(typeof h.authorization_code!="string"||typeof h.code_verifier!="string")throw new Error("OpenAI device approval returned no code");await q(e,h.authorization_code,h.code_verifier,U),f(e,"connected");return}if(r.status===403||r.status===404)continue;const o=await r.text().catch(()=>"");let s;try{const h=JSON.parse(o).error;s=typeof h=="object"&&h!==null?h.code:h}catch{s=void 0}if(s!=="deviceauth_authorization_pending"){if(s==="slow_down"){i+=5e3;continue}throw new Error(`OpenAI device sign-in failed (${r.status})`)}}f(e,"expired","the OpenAI code expired")}catch(r){e.status==="pending"&&f(e,"failed",r instanceof Error?r.message:String(r))}}a(_e,"pollDevice");function O(e,t){const n=X((i,r)=>{const o=new URL(i.url??"/","http://localhost"),s=a((l,p)=>{r.writeHead(l,{"Content-Type":"text/plain; charset=utf-8",Connection:"close"}),r.end(p)},"reply");if(o.pathname!==t.path){s(404,"Not found.");return}const h=o.searchParams.get("code");if(o.searchParams.get("state")!==e.state||!h){s(400,"Sign-in could not be completed: state mismatch or missing code.");return}let d="";if(e.provider===m)try{d=z(o,e.state).clientId}catch(l){s(400,`Sign-in could not be completed: ${l instanceof Error?l.message:String(l)}.`);return}if(e.status!=="pending"||e.exchanging){s(409,"This sign-in has already finished.");return}e.exchanging=!0,(e.provider===w?j(e,h,e.state):e.provider===m?B(e,h,d):q(e,h,e.verifier,e.redirectUri)).then(()=>{s(200,"Signed in. You can close this window."),f(e,"connected")},l=>{s(502,"The vendor refused the sign-in."),f(e,"failed",l instanceof Error?l.message:String(l))})});return e.server=n,new Promise((i,r)=>{n.once("error",o=>r(new u(409,"conflict",`cannot listen on localhost:${t.port} for the vendor redirect (${o.code??o.message})`,"redirect"))),n.listen(t.port,"127.0.0.1",()=>i())})}a(O,"listenLoopback");async function Ce(e){const t=$(e.provider);if(e.redirect!==void 0&&e.redirect!=="loopback")throw new u(400,"invalid_request",'redirect must be "loopback" when present',"redirect");if(e.label!==void 0&&typeof e.label!="string")throw new u(400,"invalid_request","label must be a string when present","label");const n=typeof e.label=="string"&&e.label.trim()?e.label.trim():void 0,i=y.get(t);if(i!==void 0){const p=_.get(i);p&&f(p,"failed","replaced by a newer sign-in")}const{verifier:r,challenge:o}=he(),s=e.redirect==="loopback",h=Date.now()+R*1e3,d={id:K(),provider:t,kind:s?"loopback":t===w?"code_page":t===m?"redirect_paste":"device",state:t===w?r:T(16).toString("hex"),verifier:r,redirectUri:t===w?s?N.redirect:ee:t===m?b.redirect:s?D.redirect:U,expiresAt:h,status:"pending",...e.jti?{jti:e.jti}:{},...n?{label:n}:{},lastRateLimitedAt:Math.max(0,...W(t).map(p=>p.lastRateLimitedAt)),abort:new AbortController,timer:setTimeout(()=>f(d,"expired","the sign-in expired"),R*1e3),waiters:new Set,exchanging:!1};d.timer.unref(),ge(d);const A=a(()=>new u(409,"conflict","a newer sign-in for this provider replaced this one","provider"),"replacedDuringStart"),l={flow_id:d.id,provider:t,expires_at:new Date(h).toISOString()};try{if(t===w){const c=new URLSearchParams;if(c.set("code","true"),c.set("client_id",L),c.set("response_type","code"),c.set("redirect_uri",d.redirectUri),c.set("scope",te),c.set("code_challenge",o),c.set("code_challenge_method","S256"),c.set("state",d.state),s&&await O(d,N),d.status!=="pending")throw A();return{...l,url:`${Q}?${c.toString()}`,instructions:s?"Sign in to Claude in your browser; this finishes by itself.":"Sign in to Claude, then copy the code Claude shows and paste it here."}}if(t===m){const c=new URL(se);if(c.search=new URLSearchParams({client_id:oe,agent_name_hint:ae,ext_agent_host_id:`urn:uuid:${Z()}`,response_type:"code",redirect_uri:d.redirectUri,resource:H,scope:ce,state:d.state,code_challenge:o,code_challenge_method:"S256",nonce:C(T(32))}).toString(),s&&await O(d,b),d.status!=="pending")throw A();return{...l,url:c.toString(),instructions:s?"Sign in with ChatGPT in your browser; this finishes by itself. If it does not, paste the final redirect URL here.":`Sign in with ChatGPT, then copy the full URL your browser lands on (it starts with ${b.redirect} and may show a connection error) and paste it here.`}}if(s){const c=new URL("https://auth.openai.com/oauth/authorize");if(c.searchParams.set("response_type","code"),c.searchParams.set("client_id",I),c.searchParams.set("redirect_uri",d.redirectUri),c.searchParams.set("scope",re),c.searchParams.set("code_challenge",o),c.searchParams.set("code_challenge_method","S256"),c.searchParams.set("state",d.state),c.searchParams.set("id_token_add_organizations","true"),c.searchParams.set("codex_cli_simplified_flow","true"),c.searchParams.set("originator","pi"),await O(d,D),d.status!=="pending")throw A();return{...l,url:c.toString(),instructions:"Sign in to ChatGPT in your browser; this finishes by itself."}}const p=await fetch(`${P()}/api/accounts/deviceauth/usercode`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:I}),signal:AbortSignal.timeout(3e4)});if(!p.ok)throw new u(502,"upstream_refused",`OpenAI refused to issue a device code (${p.status})`);const g=await p.json(),v=typeof g.interval=="string"?Number(g.interval.trim()):g.interval;if(typeof g.device_auth_id!="string"||typeof g.user_code!="string"||typeof v!="number"||!Number.isFinite(v)||v<0)throw new u(502,"upstream_refused","OpenAI returned an invalid device code");if(d.status!=="pending")throw A();return _e(d,{deviceAuthId:g.device_auth_id,userCode:g.user_code,intervalS:v}),{...l,url:ne,user_code:g.user_code,instructions:"Open the link, sign in to ChatGPT, and enter the code. The code expires in 15 minutes."}}catch(p){throw f(d,"failed",p instanceof Error?p.message:String(p)),_.delete(d.id),p instanceof u?p:new u(502,"upstream_refused",`vendor sign-in could not start: ${p instanceof Error?p.message:String(p)}`)}}a(Ce,"startModelAuthFlow");function ge(e){_.set(e.id,e),y.set(e.provider,e.id)}a(ge,"register");function Se(e){const t=_.get(e);if(t)return f(t,"failed","cancelled"),x(t)}a(Se,"cancelModelAuthFlow");function me(e){const t=e.trim();if(!t)return{};try{const n=new URL(t);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){const[n,i]=t.split("#",2);return{code:n,state:i}}if(t.includes("code=")){const n=new URLSearchParams(t);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:t}}a(me,"parseCodeInput");function we(e){const t=typeof e=="string"?_.get(e):void 0;if(!t||t.status!=="pending")throw new u(400,"invalid_request","no in-flight sign-in has this flow_id","flow_id");return t}a(we,"pendingFlow");async function Oe(e,t){const n=we(e);if(n.provider===m)return Ae(n,t);if(n.kind!=="code_page")throw new u(400,"invalid_request","this sign-in completes without a pasted code","flow_id");if(n.exchanging)throw new u(400,"invalid_request","this sign-in is already being completed","flow_id");if(typeof t!="string")throw new u(400,"invalid_request","input must be the code Claude shows","input");const{code:i,state:r}=me(t);if(!i)throw new u(400,"invalid_request","input must be the code Claude shows","input");if(r!==void 0&&r!==n.state)throw new u(400,"invalid_request","the pasted code belongs to a different sign-in","state");n.exchanging=!0;try{await j(n,i,r??n.state)}catch(o){throw f(n,"failed",o instanceof Error?o.message:String(o)),new u(502,"upstream_refused","Anthropic refused the code")}return f(n,"connected"),{flow_id:n.id,provider:n.provider,status:"connected"}}a(Oe,"completeModelAuthFlow");async function Ae(e,t){if(e.exchanging)throw new u(400,"invalid_request","this sign-in is already being completed","flow_id");const n=new URL(b.redirect);let i;try{i=typeof t=="string"?new URL(t.trim()):void 0}catch{i=void 0}if(!i||i.origin!==n.origin||i.pathname!==n.pathname)throw new u(400,"invalid_request",`input must be the full redirect URL starting with ${b.redirect}`,"input");const{code:r,clientId:o}=z(i,e.state);e.exchanging=!0;try{await B(e,r,o)}catch(s){throw f(e,"failed",s instanceof Error?s.message:String(s)),new u(502,"upstream_refused","OpenAI refused the ChatGPT sign-in")}return f(e,"connected"),{flow_id:e.id,provider:e.provider,status:"connected"}}a(Ae,"completeChatGPTFlow");function x(e){return{flow_id:e.id,provider:e.provider,status:e.status,...e.message?{message:e.message}:{},...e.jti?{jti:e.jti}:{}}}a(x,"view");function xe(e){const t=_.get(e);return t?x(t):void 0}a(xe,"readModelAuthFlow");async function ke(e,t,n){const i=_.get(e);if(i)return i.status==="pending"&&t>0&&!n?.aborted&&await new Promise(r=>{const o=a(()=>{clearTimeout(s),n?.removeEventListener("abort",o),i.waiters.delete(o),r()},"done"),s=setTimeout(o,t);n?.addEventListener("abort",o,{once:!0}),i.waiters.add(o)}),x(i)}a(ke,"waitModelAuthFlow");function Re(){for(const e of _.values())f(e,"failed","reset");_.clear(),y.clear()}a(Re,"resetModelAuthFlowsForTest");export{R as MODEL_AUTH_FLOW_TTL_S,M as OPENAI_CHATGPT_API_PROVIDER,Se as cancelModelAuthFlow,Oe as completeModelAuthFlow,Ie as modelAuthApiProvider,Ee as modelAuthProvider,xe as readModelAuthFlow,Re as resetModelAuthFlowsForTest,Ce as startModelAuthFlow,ke as waitModelAuthFlow};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A=Object.defineProperty;var o=(e,t)=>A(e,"name",{value:t,configurable:!0});import{randomBytes as E}from"node:crypto";import{joinedOwner as O}from"../../core/directory/join.js";import{consumeHandoffJti as j,handoffJtiConsumed as C}from"../../core/model-auth/handoff-jti.js";import{completeModelAuthFlow as P,modelAuthProvider as N,readModelAuthFlow as y,startModelAuthFlow as R,waitModelAuthFlow as H}from"../../core/model-auth/flows.js";import{RunError as d}from"../../core/runs/operations.js";import{LONG_POLL_MAX_WAIT_SECONDS as I}from"../../api/long-poll.js";const c="/signin/vendor",M=900,V=I*1e3,D="https://chatgpt.com/#settings/Security";function d1(e){return e===c||e.startsWith(`${c}/`)}o(d1,"isVendorSignInPath");function f(){return new d(401,"unauthorized","invalid vendor sign-in handoff")}o(f,"unauthorized");async function z(e,t){const n=await e.verifyHandoff(t);let r;try{r=O()}catch{r=null}if(n.sub!==r)throw f();return n}o(z,"verifyOwnerHandoff");function B(e){const t=e.headers.authorization;return t?.startsWith("Bearer ")&&t.length>7?t.slice(7):void 0}o(B,"bearer");function w(e,t){const n=e.getAll(t);return n.length===1?n[0]:void 0}o(w,"single");function F(e,t,n){const r=new URL(e);return r.searchParams.set("status",t),n&&r.searchParams.set("reason",n.slice(0,200)),r.toString()}o(F,"returnUrl");function u(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}o(u,"escapeHtml");function x(e,t,n){e.writeHead(t,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),e.end(JSON.stringify(n))}o(x,"sendJson");async function G(e){const t=[];let n=0;for await(const i of e){if(n+=i.length,n>64*1024)throw new d(400,"invalid_request","request body too large");t.push(i)}let r;try{r=JSON.parse(Buffer.concat(t).toString("utf8"))}catch{throw new d(400,"invalid_request","invalid JSON body")}if(typeof r!="object"||r===null||Array.isArray(r))throw new d(400,"invalid_request","request body must be a JSON object");return r}o(G,"jsonBody");const U=`
|
|
2
2
|
:root{color-scheme:light dark;
|
|
3
3
|
--canvas:#f0f2f4;--surface:#fff;--sunken:#e5e7ea;--zone:#e5e7ea;--neutral:#e5e7ea;--neutral-hover:#d7d9dc;--neutral-pressed:#cbcdd0;
|
|
4
4
|
--accent:#217f51;--accent-hover:#1e6e46;--accent-pressed:#1a5e3c;--accent-border:#217f51;--accent-subtle:#d5f7e1;--accent-fg:#1e6e46;--on-accent:#fff;
|
|
@@ -84,12 +84,12 @@ form{display:flex;flex-direction:column;gap:.75rem}
|
|
|
84
84
|
@keyframes spin{to{transform:rotate(360deg)}}
|
|
85
85
|
@media (min-width:40rem){.top{padding:0 1.5rem}main{padding:3.5rem 1rem}}
|
|
86
86
|
@media (max-width:30rem){.card{padding:1.25rem}.btn{padding-left:.875rem;padding-right:.875rem}#device-link{font-size:.84375rem}.steps>li{gap:.75rem}.alert .act{margin-left:1.875rem}}
|
|
87
|
-
`,
|
|
87
|
+
`,J=`
|
|
88
88
|
(function(){
|
|
89
89
|
var cfg=JSON.parse(document.getElementById('cfg').textContent);
|
|
90
90
|
history.replaceState(null,'',location.pathname);
|
|
91
91
|
var auth={'Authorization':'Bearer '+cfg.handoff};
|
|
92
|
-
function back(status){var u=new URL(cfg.returnTo);u.searchParams.set('status',status);location.assign(u.toString());}
|
|
92
|
+
function back(status,reason){var u=new URL(cfg.returnTo);u.searchParams.set('status',status);if(reason)u.searchParams.set('reason',String(reason).slice(0,200));location.assign(u.toString());}
|
|
93
93
|
function $(id){return document.getElementById(id);}
|
|
94
94
|
var error=$('error'),errorText=$('error-text');
|
|
95
95
|
function setError(msg){errorText.textContent=msg;error.className=msg?'err on':'err';}
|
|
@@ -106,8 +106,8 @@ if(cfg.kind==='anthropic'){
|
|
|
106
106
|
fetch(cfg.base,{method:'POST',headers:Object.assign({'Content-Type':'application/json'},auth),body:JSON.stringify({input:input.value})})
|
|
107
107
|
.then(function(r){return r.json().then(function(b){return {ok:r.ok,s:r.status,b:b};});})
|
|
108
108
|
.then(function(x){
|
|
109
|
-
if(x.ok){
|
|
110
|
-
if(x.s===401||x.s===404){back('failed');return;}
|
|
109
|
+
if(x.ok){if(x.b.status==='connected')back('connected');else back('failed',x.b.reason);return;}
|
|
110
|
+
if(x.s===401||x.s===404){back('failed',x.s===401?'unauthorized':'not_found');return;}
|
|
111
111
|
reject((x.b&&x.b.error&&x.b.error.message)||'That code was not accepted.');
|
|
112
112
|
})
|
|
113
113
|
.catch(function(){reject('Could not reach your runtime. Try again.');});
|
|
@@ -119,7 +119,7 @@ if(cfg.kind==='anthropic'){
|
|
|
119
119
|
if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(cfg.userCode).then(done,function(){});return;}
|
|
120
120
|
var r=document.createRange();r.selectNodeContents($('user-code'));var s=getSelection();s.removeAllRanges();s.addRange(r);
|
|
121
121
|
});
|
|
122
|
-
$('renew').addEventListener('click',function(){back('failed');});
|
|
122
|
+
$('renew').addEventListener('click',function(){back('failed','code_expired');});
|
|
123
123
|
var deadline=Date.now()+cfg.remainingSeconds*1000,left=$('left'),said=-1,timer;
|
|
124
124
|
function tick(){
|
|
125
125
|
var s=Math.max(0,Math.ceil((deadline-Date.now())/1000));
|
|
@@ -136,29 +136,29 @@ if(cfg.kind==='anthropic'){
|
|
|
136
136
|
}
|
|
137
137
|
(function poll(){
|
|
138
138
|
fetch(cfg.base+'/wait',{headers:auth})
|
|
139
|
-
.then(function(r){if(r.status===401||r.status===404)return {status:'failed'};if(!r.ok)throw new Error(String(r.status));return r.json();})
|
|
139
|
+
.then(function(r){if(r.status===401||r.status===404)return {status:'failed',reason:r.status===401?'unauthorized':'not_found'};if(!r.ok)throw new Error(String(r.status));return r.json();})
|
|
140
140
|
.then(function(b){
|
|
141
141
|
if(b.status==='pending'){poll();return;}
|
|
142
142
|
if(b.status==='connected'){back('connected');return;}
|
|
143
143
|
if(b.status==='expired'){expire();return;}
|
|
144
|
-
back('failed');
|
|
144
|
+
back('failed',b.reason);
|
|
145
145
|
})
|
|
146
146
|
.catch(function(){setTimeout(poll,3000);});
|
|
147
147
|
})();
|
|
148
148
|
}
|
|
149
149
|
})();
|
|
150
|
-
`,J={arrow:'<path d="M7 7h10v10"/><path d="M7 17 17 7"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clock:'<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',warn:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',alert:'<circle cx="12" cy="12" r="10"/><path d="M12 8v4"/><path d="M12 16h.01"/>',check:'<path d="M20 6 9 18l-5-5"/>'};function s(e,t=""){return`<svg class="ic${t}" viewBox="0 0 24 24" aria-hidden="true" focusable="false">${J[e]}</svg>`}a(s,"icon");const Z='<svg viewBox="-77.5 12 931 931" aria-hidden="true" focusable="false"><path fill="currentColor" d="M234 294m0 0h2l-1 5-6 16-5 15-6 25-4 23-2 22-1 5v47l5 38 5 26 6 22 10 24 8 16 9 14 14 19 13 16 11 13 9 11 11 12 7 8 13 16 11 14 14 19 12 19 12 23 7 17 6 23 3 14 3-1 5-15 20-84 6-24 6-21 10-33 10-25 8-16 8-15 8-12 9-12 8-10 9-10 7-8 6-7 20-20h2l2-4 17-17 7-8 10-13 14-21 8-16 8-18 5-15 2-7 2 1 6 36 2 18v41l-4 28-5 19-7 19-10 21-8 13-10 15-13 17-11 13-12 14-9 10-7 8-9 11h-2l-2 4-9 11-14 19-8 12-15 25-11 21-12 26-9 23-5 12-13 38-12 39-5 18-5 17h-2l-9-29-9-27-14-38-13-29-8-16-11-18-10-13-7-9-25-25-3-2v-2l-3-1v-2l-4-2-10-9-8-7-14-12-20-18-13-13-9-11-12-16-12-20-12-25-7-19-6-23-4-24-1-11-1-3v-39l3-23 6-27 7-23 5-11 11-23 9-16 10-14 8-11 9-11 10-11zM430 22m0 0h2v2h2l7 8 10 11 9 11 12 16 9 15 8 16 6 15 5 19 2 11 1 12v18l-1 16-5 24-5 16-7 15-9 17-7 11-10 15-10 13-9 11-13 14-7 8-11 12-7 8-13 16-11 15-13 20-10 18-8 16-7 18-5 15-4 18-2 14-1 27 2 24 3 17 5 23 8 30 12 36 9 28 3 8 4 12v2l-4-2-68-102-13-22-11-23-9-24-7-26-4-23-2-16v-31l3-25 6-27 7-21 7-15 8-16 14-21 11-14 26-30 12-13 8-10h2l2-4 10-11 7-9 14-19 7-10 13-24 7-19 4-15 3-14 3-22 2-24v-20l-2-31zM615 384m0 0 2 1 6 36 2 18v41l-4 28-5 19-7 19-10 21-8 13-10 15-13 17-11 13-12 14-9 10-7 8-9 11h-2l-2 4-9 11-14 19-8 12-15 25-11 21-2 5h-3l-2 2h-13l-6-5-11-6 1-9h-2l2-14-2 3 1-8 9-36 6-21 10-33 10-25 8-16 8-15 8-12 9-12 8-10 9-10 7-8 6-7 20-20h2l2-4 17-17 7-8 10-13 14-21 8-16 8-18 5-15zM557 254m0 0 2 1 4 16 2 16v34l-2 18-5 20-8 24-14 28-10 16-11 16-13 15-12 14-11 13-11 14-14 19-12 20-8 16-7 19-6 20-4 20-4 35-3 41-3 52-4 28-1 3h-2l-8-42-10-52-7-33-7-43v-54l4-24 5-17 8-20 10-19 7-10 10-13 9-11 19-19 8-7 16-15 8-7 9-9 8-7 11-11 1-2h2l2-4 11-13 10-14 11-17 9-19 8-21zM185 615m0 0 4 5 6 10 9 12 2 1 3 5 5-2 1-1h8l5 5 2 3 7 3 6 3 4 5 8 6 5 3v2h2v2h6l4 3 6 1 1 8 10 3 4 2 9 2 5 6 6 1h6l8 8 7 1 9 7h5l1-4-4-6-10-13-7-9-1-3h-2l-7-9v-3l7 6 7 9 11 14 14 19 12 19 12 23 7 17 6 23 3 14 3-1 5-15 10-42 5-22h2l1-4 1 4-1 8h-2l3 4-1 8 11 6 5 4h13l4-3-1 6-8 17-9 23-5 12-13 38-12 39-5 18-5 17h-2l-9-29-9-27-14-38-13-29-8-16-11-18-10-13-7-9-25-25-3-2v-2l-3-1v-2l-4-2-10-9-8-7-14-12-20-18-13-13-9-11-12-16-9-15zM369 553m0 0h1l1 43 2 3 3 4-1 6-1 1v7l1 2 1 15 7 1 5-2 5 1v-2l3-1 4 1 1-2h-3l1-3 6-2 2 11-1 8-3 12h2v2l3-1 2-12h-2l1-4 1-1 3-21 4-21h1v10l-4 30-3 34-4 69-4 28-1 3h-2l-8-42-10-52-7-33-6-37zM430 22m0 0h2v2h2l7 8 10 11 9 11 4 5 1 5 2 4 1 7 2 2-1 3-5-1h-7l-8-2-5 1v7l-1 1h-5l-2-8-1-2-1-15h-2l-2-31zM417 598m0 0h1v10l-4 30-3 34-4 69-4 28-1 3h-2l-7-37-1-16h8l2 1v-2h2l1-2 2-35v-13l-2-3-3-5-1-8 1-9-1-4-5-2v-2l-3-1v-2l3-1 4 1 1-2h-3l1-3 6-2 2 11-1 8-3 12h2v2l3-1 2-12h-2l1-4 1-1 3-21zM417 598m0 0h1v10l-4 30-3 34-1 17h-2v15l-1 12h-1v-18l1-17v-13l-2-3-3-5-1-8 1-9-1-4-5-2v-2l-3-1v-2l3-1 4 1 1-2h-3l1-3 6-2 2 11-1 8-3 12h2v2l3-1 2-12h-2l1-4 1-1 3-21zM310 619m0 0 4 2 4 6 5 8 7 9 3 5 2-1 2 1 2 10 6-1 2 1v2h-5l3 7 9 13 6 9 3 1v-2l-4-14h3l5 16 3 8 4 12v2l-4-2-60-90zM255 597m0 0 5 3 12 16 9 11 11 13 9 11 11 12 4 5-1 3-7-7-4-1-7-4v-2l-4-2-4-4 4 1 3-1v-3l-5-2-3-5v-2h-2l-6-8v-2l-3-1-1-2-8-1 1-2-2-8-3-4v-2h-2l-4-6-3-4zM425 181m0 0 7 1 1 3 12 2 2 3 3 1v-2h3l1 3-6 2-1 3h-2v2h-2l-1 7-5 1-2-5 2-3h3l1-5-3 1-3 3-1-4-5-2v-5h-6l-3-3zM369 553m0 0h1l1 43 2 3 3 4-1 6-1 1v7l1 2 1 15 2 1h-2l3 13 2 10v5l-3-4-5-25-4-26zM340 614m0 0 1 2h2l6 20 6 18 3 15-2-1-5-15-2-4v-5h-6l-3-2-9-2 2-3v2l5-4h4 2l-1-5-3-12zM296 649m0 0 5 2 11 12 4 5-1 3-7-7-4-1-7-4v-2l-4-2-4-4 4 1 3-1zM403 625m0 0h2l2 11-1 8-2 7-2 1v-9l-1-4-5-2v-2l-3-1v-2l3-1 4 1 1-2h-3l1-3zM417 598m0 0h1v10l-4 30-2 24h-1l-1-17h-2l1-4 1-1 3-21zM163 561m0 0 2 3 5 16 2 6 2 1 3 9 2 4 4-1 1-2 1 3h-2l-2 5 3 6-1 2-3-3-11-24-4-11-2-10zM439 685m0 0 1 2h9l3 4v6l7 2 3 7-4-1-6-4-5-4v-7h-9l-2-2zM369 553m0 0h1l1 43 2 3 3 4-1 6-1 1-1 7-2-2v-7h-2zM434 687m0 0h1v6l-3 9-7 29-4 5 1-8 9-36zM317 672m0 0 6 4 9 11 11 14 6 8v2l-4-2-10-13-7-9-1-3h-2l-7-9zM276 622m0 0 5 5 11 13 7 8-1 2-7-4-3-5v-2h-2l-6-8v-2l-3-1-2-4zM310 619m0 0 4 2 4 6 5 8 7 9-1 4-4-5-8-11-7-11zM416 172m0 0 2 1-1 7h-2v5l4-1-1 3-5 2-3-1v-7l4-8zM381 664m0 0 2 4 6 27v5l-1-2h-2l-5-24zM443 655m0 0 1 4-7 25-1 2h-2l1-7 6-22h2zM163 561m0 0 2 3 5 16 2 6 2 1v5l-2 1-7-18-2-10zM490 702m0 0 1 3-10 15-3 5-4 3v-5l5-5 7-11zM387 698m0 0 1 2h2l3 16v14h-1l-5-26zM426 139m0 0 1 3-1 5-7 22-2-1 2-9 5-18h2zM466 739m0 0h2l-1 6-8 15-3 1 2-7 7-12zM411 636m0 0h2v12l-1 14h-1l-1-17h-2l1-4zM349 645m0 0h3l3 9 3 15-2-1-5-15-2-4zM335 694m0 0 5 3 9 12v2l-4-2-10-13zM386 633m0 0 7 1-3 2-4 1-2 4h-4l-2-6h5zM547 287m0 0 3 2-3 7-1 5h-2l-1 4-2-1 1-5zM557 254m0 0 2 1 3 13-4-1 1-2h-2l-1 3-1-3zM560 311m0 0 3 1-2 5-3 6-9-3v-1l9-1zM409 664m0 0h1v25h-1l-2-24zM340 614m0 0 1 2h2l4 16-4-2-3-12zM438 705m0 0 10 2 1 7-3-1-4-4h-5zM502 685m0 0 1 3-8 11-3 1 2-5zM422 191m0 0 4 1 3 4-2 4-5-3zM359 675m0 0h3l4 13-1 4-4-9zM225 599m0 0 5 2 12 6-3 1-9-4-6-3zM255 597m0 0 5 3 6 8-1 2-3-1-4-6-3-4zM414 180m0 0h1v5l4-1-1 3-5 2-3-1 1-5zM341 665m0 0 3 1 6 9-1 4-8-12zM370 608m0 0h1l1 9 3 1-2 10h-1l-2-12zM439 671m0 0 1 2-4 13h-2l1-7 3-7zM341 658m0 0 6 1v2h-5l-1 5-3-3 1-4zM373 625m0 0h2l1 9 2 1h-2l-1 5h-1l-1-6zM185 615m0 0 4 5 5 8-1 3-4-5-4-7zM434 687m0 0h1v6l-3 9-2 3 1-13zM385 686m0 0h2l2 9v5l-1-2h-2l-1-5zM390 711m0 0h2l1 8v11h-1l-2-10zM355 657m0 0 2 3 4 12v3l-3-1-2-10zM413 624m0 0h1v14l-1-2h-2l1-11zM494 120m0 0h2l2 6v10l-2-3-2-9zM163 561m0 0 2 3 4 13-1 3v-2h-2l-3-13zM489 106m0 0h2l4 10-2 4-4-11zM230 609m0 0 5 1 4 5 3 2-6-1-3-3v-2l-3-1zM392 660m0 0h2v2h2l5 5 2 1-1 4-10-10zM254 615m0 0 8 1 1 1v5l-2-1v-2l-6-2zM190 587m0 0 6 1 2-1 4 2 1 3-13-2zM417 598m0 0h1v10l-1 5-2-1 1-9zM273 545m0 0 2 3 3 8v3h-2l-3-8z"/></svg>',q={claude:'<svg viewBox="0 0 48 48" aria-hidden="true" focusable="false"><rect width="48" height="48" fill="#F3E9D7"/><path transform="translate(24 24) scale(.13) translate(-124 -124)" fill="#D97757" d="M52.4285 162.873L98.7844 136.879L99.5485 134.602L98.7844 133.334H96.4921L88.7237 132.862L62.2346 132.153L39.3113 131.207L17.0249 130.026L11.4214 128.844L6.2 121.873L6.7094 118.447L11.4214 115.257L18.171 115.847L33.0711 116.911L55.485 118.447L71.6586 119.392L95.728 121.873H99.5485L100.058 120.337L98.7844 119.392L97.7656 118.447L74.5877 102.732L49.4995 86.1905L36.3823 76.62L29.3779 71.7757L25.8121 67.2858L24.2839 57.3608L30.6515 50.2716L39.3113 50.8623L41.4763 51.4531L50.2636 58.1879L68.9842 72.7209L93.4357 90.6804L97.0015 93.6343L98.4374 92.6652L98.6571 91.9801L97.0015 89.2625L83.757 65.2772L69.621 40.8192L63.2534 30.6579L61.5978 24.632C60.9565 22.1032 60.579 20.0111 60.579 17.4246L67.8381 7.49965L71.9133 6.19995L81.7193 7.49965L85.7946 11.0443L91.9074 24.9865L101.714 46.8451L116.996 76.62L121.453 85.4816L123.873 93.6343L124.764 96.1155H126.292V94.6976L127.566 77.9197L129.858 57.3608L132.15 30.8942L132.915 23.4505L136.608 14.4708L143.994 9.62643L149.725 12.344L154.437 19.0788L153.8 23.4505L150.998 41.6463L145.522 70.1215L141.957 89.2625H143.994L146.414 86.7813L156.093 74.0206L172.266 53.698L179.398 45.6635L187.803 36.802L193.152 32.5484H203.34L210.726 43.6549L207.415 55.1159L196.972 68.3492L188.312 79.5739L175.896 96.2095L168.191 109.585L168.882 110.689L170.738 110.53L198.755 104.504L213.91 101.787L231.994 98.7149L240.144 102.496L241.036 106.395L237.852 114.311L218.495 119.037L195.826 123.645L162.07 131.592L161.696 131.893L162.137 132.547L177.36 133.925L183.855 134.279H199.774L229.447 136.524L237.215 141.605L241.8 147.867L241.036 152.711L229.065 158.737L213.019 154.956L175.45 145.977L162.587 142.787H160.805V143.85L171.502 154.366L191.242 172.089L215.82 195.011L217.094 200.682L213.91 205.172L210.599 204.699L188.949 188.394L180.544 181.069L161.696 165.118H160.422V166.772L164.752 173.152L187.803 207.771L188.949 218.405L187.294 221.832L181.308 223.959L174.813 222.777L161.187 203.754L147.305 182.486L136.098 163.345L134.745 164.2L128.075 235.42L125.019 239.082L117.887 241.8L111.902 237.31L108.718 229.984L111.902 215.452L115.722 196.547L118.779 181.541L121.58 162.873L123.291 156.636L123.14 156.219L121.773 156.449L107.699 175.752L86.304 204.699L69.3663 222.777L65.291 224.431L58.2867 220.768L58.9235 214.27L62.8713 208.48L86.304 178.705L100.44 160.155L109.551 149.507L109.462 147.967L108.959 147.924L46.6977 188.512L35.6182 189.93L30.7788 185.44L31.4156 178.115L33.7079 175.752L52.4285 162.873Z"/></svg>',chatgpt:'<svg viewBox="0 0 48 48" aria-hidden="true" focusable="false"><rect width="48" height="48" fill="#0D0D0D"/><path transform="translate(24 24) scale(2.35) translate(-7.98 -8)" fill="#FFF" d="M12.9851 6.93777C13.1163 6.54364 13.1618 6.12607 13.1186 5.71295C13.0754 5.29983 12.9444 4.90072 12.7344 4.54231C12.4232 4.00021 11.9478 3.57101 11.3768 3.31664C10.8058 3.06227 10.1687 2.99589 9.55751 3.12706C9.28184 2.81639 8.943 2.56818 8.56362 2.39905C8.18425 2.22993 7.77314 2.14379 7.3578 2.1464C6.73292 2.1449 6.1237 2.34187 5.61797 2.70892C5.11225 3.07598 4.73616 3.59415 4.54391 4.18873C4.13684 4.27206 3.75225 4.44139 3.41591 4.68539C3.07957 4.92938 2.79924 5.24241 2.59368 5.60352C2.27994 6.14413 2.14602 6.77039 2.21123 7.39205C2.27644 8.01367 2.5374 8.59851 2.95649 9.06224C2.82527 9.45637 2.77975 9.87394 2.82297 10.2871C2.8662 10.7002 2.99718 11.0993 3.20713 11.4577C3.51841 11.9998 3.99385 12.4289 4.56484 12.6833C5.13584 12.9377 5.77289 13.0041 6.38407 12.8729C6.65975 13.1836 6.99862 13.4318 7.37796 13.601C7.75734 13.7701 8.16844 13.8562 8.58379 13.8536C9.20899 13.8552 9.81853 13.6582 10.3244 13.2909C10.8304 12.9236 11.2065 12.4051 11.3986 11.8101C11.8057 11.7268 12.1903 11.5575 12.5266 11.3135C12.8629 11.0695 13.1433 10.7564 13.3488 10.3953C13.6622 9.85477 13.7958 9.22866 13.7304 8.60726C13.6651 7.98587 13.4041 7.40129 12.9851 6.93777ZM8.58472 13.0883C8.0715 13.089 7.57441 12.9093 7.18031 12.5805C7.19808 12.5708 7.22925 12.5537 7.24956 12.5413L9.58061 11.1948C9.63911 11.1615 9.6877 11.1133 9.72136 11.055C9.75505 10.9967 9.77258 10.9305 9.77217 10.8632V7.57684L10.7575 8.14576C10.7626 8.14834 10.7671 8.15214 10.7704 8.15685C10.7738 8.16157 10.7759 8.16704 10.7766 8.17275V10.8943C10.7759 11.4756 10.5448 12.0329 10.1339 12.4441C9.72308 12.8554 9.16599 13.087 8.58472 13.0883ZM3.87091 11.075C3.61385 10.6309 3.5212 10.1105 3.60918 9.60485C3.62649 9.61524 3.65673 9.6337 3.67842 9.64617L6.00947 10.9926C6.06756 11.0266 6.13365 11.0445 6.20094 11.0445C6.2682 11.0445 6.33428 11.0266 6.39238 10.9926L9.23834 9.34936V10.4872C9.23867 10.493 9.23755 10.4988 9.23509 10.5041C9.23264 10.5094 9.22892 10.5139 9.22427 10.5174L6.86782 11.878C6.36379 12.1683 5.76516 12.2467 5.20333 12.0962C4.64148 11.9457 4.1623 11.5784 3.87091 11.075ZM3.25768 5.98617C3.51363 5.54141 3.91789 5.2009 4.39966 5.02421C4.39966 5.04429 4.39851 5.07985 4.39851 5.10452V7.79747C4.3981 7.86473 4.41561 7.93087 4.44924 7.98915C4.48287 8.04739 4.5314 8.09563 4.58984 8.1289L7.4358 9.77197L6.45054 10.3409C6.44568 10.3441 6.44009 10.346 6.43429 10.3465C6.4285 10.3471 6.42265 10.3462 6.41729 10.3439L4.06062 8.98216C3.55747 8.69077 3.19039 8.21176 3.03987 7.65013C2.88935 7.08853 2.96768 6.49014 3.25768 5.98617ZM11.3527 7.86994L8.50669 6.22667L9.49198 5.65799C9.49684 5.6548 9.50243 5.65283 9.50823 5.65231C9.51402 5.65178 9.51985 5.65272 9.5252 5.655L11.8819 7.01554C12.2429 7.2241 12.5371 7.53119 12.7299 7.90087C12.9228 8.27056 13.0063 8.68752 12.9707 9.10295C12.9351 9.51839 12.7819 9.91509 12.5291 10.2466C12.2762 10.5781 11.9341 10.8307 11.5428 10.9749C11.5428 10.9546 11.5428 10.919 11.5428 10.8943V8.20137C11.5434 8.13423 11.5261 8.06814 11.4926 8.0099C11.4592 7.95165 11.4109 7.90336 11.3527 7.86994ZM12.3333 6.394C12.316 6.38337 12.2858 6.36514 12.2641 6.3527L9.93303 5.00621C9.87493 4.97232 9.80887 4.95444 9.74158 4.95444C9.67432 4.95444 9.60824 4.97232 9.55014 5.00621L6.70418 6.64951V5.51167C6.70386 5.50585 6.70497 5.50005 6.70743 5.49479C6.70988 5.48952 6.7136 5.48492 6.71826 5.48144L9.0747 4.12203C9.4357 3.91387 9.84853 3.81281 10.2649 3.83068C10.6812 3.84856 11.0838 3.98462 11.4257 4.22296C11.7675 4.46129 12.0344 4.79204 12.1951 5.17652C12.3559 5.56099 12.4038 5.98327 12.3333 6.394ZM6.16851 8.42203L5.18299 7.85311C5.17784 7.85053 5.17336 7.84673 5.17002 7.84202C5.16668 7.8373 5.16455 7.83183 5.16385 7.82609V5.10452C5.16411 4.6877 5.28311 4.27956 5.5069 3.9279C5.73071 3.57623 6.05006 3.29559 6.42756 3.11883C6.80507 2.94206 7.22509 2.87649 7.63851 2.92977C8.05195 2.98306 8.44163 3.153 8.76197 3.41971C8.74421 3.42941 8.71327 3.44649 8.69272 3.45895L6.36168 4.80542C6.30317 4.83867 6.25462 4.8869 6.22093 4.94516C6.18727 5.0034 6.16974 5.06958 6.17012 5.13683L6.16851 8.42203ZM6.70371 7.26803L7.97126 6.53595L9.23878 7.26757V8.73127L7.97126 9.46292L6.70371 8.73127V7.26803Z"/></svg>'},z="team@northlight.ai";function k(e){const t=JSON.stringify(e.config).replace(/</g,"\\u003c");return`<!doctype html>
|
|
150
|
+
`,Z={arrow:'<path d="M7 7h10v10"/><path d="M7 17 17 7"/>',copy:'<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',clock:'<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',warn:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',alert:'<circle cx="12" cy="12" r="10"/><path d="M12 8v4"/><path d="M12 16h.01"/>',check:'<path d="M20 6 9 18l-5-5"/>'};function s(e,t=""){return`<svg class="ic${t}" viewBox="0 0 24 24" aria-hidden="true" focusable="false">${Z[e]}</svg>`}o(s,"icon");const q='<svg viewBox="-77.5 12 931 931" aria-hidden="true" focusable="false"><path fill="currentColor" d="M234 294m0 0h2l-1 5-6 16-5 15-6 25-4 23-2 22-1 5v47l5 38 5 26 6 22 10 24 8 16 9 14 14 19 13 16 11 13 9 11 11 12 7 8 13 16 11 14 14 19 12 19 12 23 7 17 6 23 3 14 3-1 5-15 20-84 6-24 6-21 10-33 10-25 8-16 8-15 8-12 9-12 8-10 9-10 7-8 6-7 20-20h2l2-4 17-17 7-8 10-13 14-21 8-16 8-18 5-15 2-7 2 1 6 36 2 18v41l-4 28-5 19-7 19-10 21-8 13-10 15-13 17-11 13-12 14-9 10-7 8-9 11h-2l-2 4-9 11-14 19-8 12-15 25-11 21-12 26-9 23-5 12-13 38-12 39-5 18-5 17h-2l-9-29-9-27-14-38-13-29-8-16-11-18-10-13-7-9-25-25-3-2v-2l-3-1v-2l-4-2-10-9-8-7-14-12-20-18-13-13-9-11-12-16-12-20-12-25-7-19-6-23-4-24-1-11-1-3v-39l3-23 6-27 7-23 5-11 11-23 9-16 10-14 8-11 9-11 10-11zM430 22m0 0h2v2h2l7 8 10 11 9 11 12 16 9 15 8 16 6 15 5 19 2 11 1 12v18l-1 16-5 24-5 16-7 15-9 17-7 11-10 15-10 13-9 11-13 14-7 8-11 12-7 8-13 16-11 15-13 20-10 18-8 16-7 18-5 15-4 18-2 14-1 27 2 24 3 17 5 23 8 30 12 36 9 28 3 8 4 12v2l-4-2-68-102-13-22-11-23-9-24-7-26-4-23-2-16v-31l3-25 6-27 7-21 7-15 8-16 14-21 11-14 26-30 12-13 8-10h2l2-4 10-11 7-9 14-19 7-10 13-24 7-19 4-15 3-14 3-22 2-24v-20l-2-31zM615 384m0 0 2 1 6 36 2 18v41l-4 28-5 19-7 19-10 21-8 13-10 15-13 17-11 13-12 14-9 10-7 8-9 11h-2l-2 4-9 11-14 19-8 12-15 25-11 21-2 5h-3l-2 2h-13l-6-5-11-6 1-9h-2l2-14-2 3 1-8 9-36 6-21 10-33 10-25 8-16 8-15 8-12 9-12 8-10 9-10 7-8 6-7 20-20h2l2-4 17-17 7-8 10-13 14-21 8-16 8-18 5-15zM557 254m0 0 2 1 4 16 2 16v34l-2 18-5 20-8 24-14 28-10 16-11 16-13 15-12 14-11 13-11 14-14 19-12 20-8 16-7 19-6 20-4 20-4 35-3 41-3 52-4 28-1 3h-2l-8-42-10-52-7-33-7-43v-54l4-24 5-17 8-20 10-19 7-10 10-13 9-11 19-19 8-7 16-15 8-7 9-9 8-7 11-11 1-2h2l2-4 11-13 10-14 11-17 9-19 8-21zM185 615m0 0 4 5 6 10 9 12 2 1 3 5 5-2 1-1h8l5 5 2 3 7 3 6 3 4 5 8 6 5 3v2h2v2h6l4 3 6 1 1 8 10 3 4 2 9 2 5 6 6 1h6l8 8 7 1 9 7h5l1-4-4-6-10-13-7-9-1-3h-2l-7-9v-3l7 6 7 9 11 14 14 19 12 19 12 23 7 17 6 23 3 14 3-1 5-15 10-42 5-22h2l1-4 1 4-1 8h-2l3 4-1 8 11 6 5 4h13l4-3-1 6-8 17-9 23-5 12-13 38-12 39-5 18-5 17h-2l-9-29-9-27-14-38-13-29-8-16-11-18-10-13-7-9-25-25-3-2v-2l-3-1v-2l-4-2-10-9-8-7-14-12-20-18-13-13-9-11-12-16-9-15zM369 553m0 0h1l1 43 2 3 3 4-1 6-1 1v7l1 2 1 15 7 1 5-2 5 1v-2l3-1 4 1 1-2h-3l1-3 6-2 2 11-1 8-3 12h2v2l3-1 2-12h-2l1-4 1-1 3-21 4-21h1v10l-4 30-3 34-4 69-4 28-1 3h-2l-8-42-10-52-7-33-6-37zM430 22m0 0h2v2h2l7 8 10 11 9 11 4 5 1 5 2 4 1 7 2 2-1 3-5-1h-7l-8-2-5 1v7l-1 1h-5l-2-8-1-2-1-15h-2l-2-31zM417 598m0 0h1v10l-4 30-3 34-4 69-4 28-1 3h-2l-7-37-1-16h8l2 1v-2h2l1-2 2-35v-13l-2-3-3-5-1-8 1-9-1-4-5-2v-2l-3-1v-2l3-1 4 1 1-2h-3l1-3 6-2 2 11-1 8-3 12h2v2l3-1 2-12h-2l1-4 1-1 3-21zM417 598m0 0h1v10l-4 30-3 34-1 17h-2v15l-1 12h-1v-18l1-17v-13l-2-3-3-5-1-8 1-9-1-4-5-2v-2l-3-1v-2l3-1 4 1 1-2h-3l1-3 6-2 2 11-1 8-3 12h2v2l3-1 2-12h-2l1-4 1-1 3-21zM310 619m0 0 4 2 4 6 5 8 7 9 3 5 2-1 2 1 2 10 6-1 2 1v2h-5l3 7 9 13 6 9 3 1v-2l-4-14h3l5 16 3 8 4 12v2l-4-2-60-90zM255 597m0 0 5 3 12 16 9 11 11 13 9 11 11 12 4 5-1 3-7-7-4-1-7-4v-2l-4-2-4-4 4 1 3-1v-3l-5-2-3-5v-2h-2l-6-8v-2l-3-1-1-2-8-1 1-2-2-8-3-4v-2h-2l-4-6-3-4zM425 181m0 0 7 1 1 3 12 2 2 3 3 1v-2h3l1 3-6 2-1 3h-2v2h-2l-1 7-5 1-2-5 2-3h3l1-5-3 1-3 3-1-4-5-2v-5h-6l-3-3zM369 553m0 0h1l1 43 2 3 3 4-1 6-1 1v7l1 2 1 15 2 1h-2l3 13 2 10v5l-3-4-5-25-4-26zM340 614m0 0 1 2h2l6 20 6 18 3 15-2-1-5-15-2-4v-5h-6l-3-2-9-2 2-3v2l5-4h4 2l-1-5-3-12zM296 649m0 0 5 2 11 12 4 5-1 3-7-7-4-1-7-4v-2l-4-2-4-4 4 1 3-1zM403 625m0 0h2l2 11-1 8-2 7-2 1v-9l-1-4-5-2v-2l-3-1v-2l3-1 4 1 1-2h-3l1-3zM417 598m0 0h1v10l-4 30-2 24h-1l-1-17h-2l1-4 1-1 3-21zM163 561m0 0 2 3 5 16 2 6 2 1 3 9 2 4 4-1 1-2 1 3h-2l-2 5 3 6-1 2-3-3-11-24-4-11-2-10zM439 685m0 0 1 2h9l3 4v6l7 2 3 7-4-1-6-4-5-4v-7h-9l-2-2zM369 553m0 0h1l1 43 2 3 3 4-1 6-1 1-1 7-2-2v-7h-2zM434 687m0 0h1v6l-3 9-7 29-4 5 1-8 9-36zM317 672m0 0 6 4 9 11 11 14 6 8v2l-4-2-10-13-7-9-1-3h-2l-7-9zM276 622m0 0 5 5 11 13 7 8-1 2-7-4-3-5v-2h-2l-6-8v-2l-3-1-2-4zM310 619m0 0 4 2 4 6 5 8 7 9-1 4-4-5-8-11-7-11zM416 172m0 0 2 1-1 7h-2v5l4-1-1 3-5 2-3-1v-7l4-8zM381 664m0 0 2 4 6 27v5l-1-2h-2l-5-24zM443 655m0 0 1 4-7 25-1 2h-2l1-7 6-22h2zM163 561m0 0 2 3 5 16 2 6 2 1v5l-2 1-7-18-2-10zM490 702m0 0 1 3-10 15-3 5-4 3v-5l5-5 7-11zM387 698m0 0 1 2h2l3 16v14h-1l-5-26zM426 139m0 0 1 3-1 5-7 22-2-1 2-9 5-18h2zM466 739m0 0h2l-1 6-8 15-3 1 2-7 7-12zM411 636m0 0h2v12l-1 14h-1l-1-17h-2l1-4zM349 645m0 0h3l3 9 3 15-2-1-5-15-2-4zM335 694m0 0 5 3 9 12v2l-4-2-10-13zM386 633m0 0 7 1-3 2-4 1-2 4h-4l-2-6h5zM547 287m0 0 3 2-3 7-1 5h-2l-1 4-2-1 1-5zM557 254m0 0 2 1 3 13-4-1 1-2h-2l-1 3-1-3zM560 311m0 0 3 1-2 5-3 6-9-3v-1l9-1zM409 664m0 0h1v25h-1l-2-24zM340 614m0 0 1 2h2l4 16-4-2-3-12zM438 705m0 0 10 2 1 7-3-1-4-4h-5zM502 685m0 0 1 3-8 11-3 1 2-5zM422 191m0 0 4 1 3 4-2 4-5-3zM359 675m0 0h3l4 13-1 4-4-9zM225 599m0 0 5 2 12 6-3 1-9-4-6-3zM255 597m0 0 5 3 6 8-1 2-3-1-4-6-3-4zM414 180m0 0h1v5l4-1-1 3-5 2-3-1 1-5zM341 665m0 0 3 1 6 9-1 4-8-12zM370 608m0 0h1l1 9 3 1-2 10h-1l-2-12zM439 671m0 0 1 2-4 13h-2l1-7 3-7zM341 658m0 0 6 1v2h-5l-1 5-3-3 1-4zM373 625m0 0h2l1 9 2 1h-2l-1 5h-1l-1-6zM185 615m0 0 4 5 5 8-1 3-4-5-4-7zM434 687m0 0h1v6l-3 9-2 3 1-13zM385 686m0 0h2l2 9v5l-1-2h-2l-1-5zM390 711m0 0h2l1 8v11h-1l-2-10zM355 657m0 0 2 3 4 12v3l-3-1-2-10zM413 624m0 0h1v14l-1-2h-2l1-11zM494 120m0 0h2l2 6v10l-2-3-2-9zM163 561m0 0 2 3 4 13-1 3v-2h-2l-3-13zM489 106m0 0h2l4 10-2 4-4-11zM230 609m0 0 5 1 4 5 3 2-6-1-3-3v-2l-3-1zM392 660m0 0h2v2h2l5 5 2 1-1 4-10-10zM254 615m0 0 8 1 1 1v5l-2-1v-2l-6-2zM190 587m0 0 6 1 2-1 4 2 1 3-13-2zM417 598m0 0h1v10l-1 5-2-1 1-9zM273 545m0 0 2 3 3 8v3h-2l-3-8z"/></svg>',W={claude:'<svg viewBox="0 0 48 48" aria-hidden="true" focusable="false"><rect width="48" height="48" fill="#F3E9D7"/><path transform="translate(24 24) scale(.13) translate(-124 -124)" fill="#D97757" d="M52.4285 162.873L98.7844 136.879L99.5485 134.602L98.7844 133.334H96.4921L88.7237 132.862L62.2346 132.153L39.3113 131.207L17.0249 130.026L11.4214 128.844L6.2 121.873L6.7094 118.447L11.4214 115.257L18.171 115.847L33.0711 116.911L55.485 118.447L71.6586 119.392L95.728 121.873H99.5485L100.058 120.337L98.7844 119.392L97.7656 118.447L74.5877 102.732L49.4995 86.1905L36.3823 76.62L29.3779 71.7757L25.8121 67.2858L24.2839 57.3608L30.6515 50.2716L39.3113 50.8623L41.4763 51.4531L50.2636 58.1879L68.9842 72.7209L93.4357 90.6804L97.0015 93.6343L98.4374 92.6652L98.6571 91.9801L97.0015 89.2625L83.757 65.2772L69.621 40.8192L63.2534 30.6579L61.5978 24.632C60.9565 22.1032 60.579 20.0111 60.579 17.4246L67.8381 7.49965L71.9133 6.19995L81.7193 7.49965L85.7946 11.0443L91.9074 24.9865L101.714 46.8451L116.996 76.62L121.453 85.4816L123.873 93.6343L124.764 96.1155H126.292V94.6976L127.566 77.9197L129.858 57.3608L132.15 30.8942L132.915 23.4505L136.608 14.4708L143.994 9.62643L149.725 12.344L154.437 19.0788L153.8 23.4505L150.998 41.6463L145.522 70.1215L141.957 89.2625H143.994L146.414 86.7813L156.093 74.0206L172.266 53.698L179.398 45.6635L187.803 36.802L193.152 32.5484H203.34L210.726 43.6549L207.415 55.1159L196.972 68.3492L188.312 79.5739L175.896 96.2095L168.191 109.585L168.882 110.689L170.738 110.53L198.755 104.504L213.91 101.787L231.994 98.7149L240.144 102.496L241.036 106.395L237.852 114.311L218.495 119.037L195.826 123.645L162.07 131.592L161.696 131.893L162.137 132.547L177.36 133.925L183.855 134.279H199.774L229.447 136.524L237.215 141.605L241.8 147.867L241.036 152.711L229.065 158.737L213.019 154.956L175.45 145.977L162.587 142.787H160.805V143.85L171.502 154.366L191.242 172.089L215.82 195.011L217.094 200.682L213.91 205.172L210.599 204.699L188.949 188.394L180.544 181.069L161.696 165.118H160.422V166.772L164.752 173.152L187.803 207.771L188.949 218.405L187.294 221.832L181.308 223.959L174.813 222.777L161.187 203.754L147.305 182.486L136.098 163.345L134.745 164.2L128.075 235.42L125.019 239.082L117.887 241.8L111.902 237.31L108.718 229.984L111.902 215.452L115.722 196.547L118.779 181.541L121.58 162.873L123.291 156.636L123.14 156.219L121.773 156.449L107.699 175.752L86.304 204.699L69.3663 222.777L65.291 224.431L58.2867 220.768L58.9235 214.27L62.8713 208.48L86.304 178.705L100.44 160.155L109.551 149.507L109.462 147.967L108.959 147.924L46.6977 188.512L35.6182 189.93L30.7788 185.44L31.4156 178.115L33.7079 175.752L52.4285 162.873Z"/></svg>',chatgpt:'<svg viewBox="0 0 48 48" aria-hidden="true" focusable="false"><rect width="48" height="48" fill="#0D0D0D"/><path transform="translate(24 24) scale(2.35) translate(-7.98 -8)" fill="#FFF" d="M12.9851 6.93777C13.1163 6.54364 13.1618 6.12607 13.1186 5.71295C13.0754 5.29983 12.9444 4.90072 12.7344 4.54231C12.4232 4.00021 11.9478 3.57101 11.3768 3.31664C10.8058 3.06227 10.1687 2.99589 9.55751 3.12706C9.28184 2.81639 8.943 2.56818 8.56362 2.39905C8.18425 2.22993 7.77314 2.14379 7.3578 2.1464C6.73292 2.1449 6.1237 2.34187 5.61797 2.70892C5.11225 3.07598 4.73616 3.59415 4.54391 4.18873C4.13684 4.27206 3.75225 4.44139 3.41591 4.68539C3.07957 4.92938 2.79924 5.24241 2.59368 5.60352C2.27994 6.14413 2.14602 6.77039 2.21123 7.39205C2.27644 8.01367 2.5374 8.59851 2.95649 9.06224C2.82527 9.45637 2.77975 9.87394 2.82297 10.2871C2.8662 10.7002 2.99718 11.0993 3.20713 11.4577C3.51841 11.9998 3.99385 12.4289 4.56484 12.6833C5.13584 12.9377 5.77289 13.0041 6.38407 12.8729C6.65975 13.1836 6.99862 13.4318 7.37796 13.601C7.75734 13.7701 8.16844 13.8562 8.58379 13.8536C9.20899 13.8552 9.81853 13.6582 10.3244 13.2909C10.8304 12.9236 11.2065 12.4051 11.3986 11.8101C11.8057 11.7268 12.1903 11.5575 12.5266 11.3135C12.8629 11.0695 13.1433 10.7564 13.3488 10.3953C13.6622 9.85477 13.7958 9.22866 13.7304 8.60726C13.6651 7.98587 13.4041 7.40129 12.9851 6.93777ZM8.58472 13.0883C8.0715 13.089 7.57441 12.9093 7.18031 12.5805C7.19808 12.5708 7.22925 12.5537 7.24956 12.5413L9.58061 11.1948C9.63911 11.1615 9.6877 11.1133 9.72136 11.055C9.75505 10.9967 9.77258 10.9305 9.77217 10.8632V7.57684L10.7575 8.14576C10.7626 8.14834 10.7671 8.15214 10.7704 8.15685C10.7738 8.16157 10.7759 8.16704 10.7766 8.17275V10.8943C10.7759 11.4756 10.5448 12.0329 10.1339 12.4441C9.72308 12.8554 9.16599 13.087 8.58472 13.0883ZM3.87091 11.075C3.61385 10.6309 3.5212 10.1105 3.60918 9.60485C3.62649 9.61524 3.65673 9.6337 3.67842 9.64617L6.00947 10.9926C6.06756 11.0266 6.13365 11.0445 6.20094 11.0445C6.2682 11.0445 6.33428 11.0266 6.39238 10.9926L9.23834 9.34936V10.4872C9.23867 10.493 9.23755 10.4988 9.23509 10.5041C9.23264 10.5094 9.22892 10.5139 9.22427 10.5174L6.86782 11.878C6.36379 12.1683 5.76516 12.2467 5.20333 12.0962C4.64148 11.9457 4.1623 11.5784 3.87091 11.075ZM3.25768 5.98617C3.51363 5.54141 3.91789 5.2009 4.39966 5.02421C4.39966 5.04429 4.39851 5.07985 4.39851 5.10452V7.79747C4.3981 7.86473 4.41561 7.93087 4.44924 7.98915C4.48287 8.04739 4.5314 8.09563 4.58984 8.1289L7.4358 9.77197L6.45054 10.3409C6.44568 10.3441 6.44009 10.346 6.43429 10.3465C6.4285 10.3471 6.42265 10.3462 6.41729 10.3439L4.06062 8.98216C3.55747 8.69077 3.19039 8.21176 3.03987 7.65013C2.88935 7.08853 2.96768 6.49014 3.25768 5.98617ZM11.3527 7.86994L8.50669 6.22667L9.49198 5.65799C9.49684 5.6548 9.50243 5.65283 9.50823 5.65231C9.51402 5.65178 9.51985 5.65272 9.5252 5.655L11.8819 7.01554C12.2429 7.2241 12.5371 7.53119 12.7299 7.90087C12.9228 8.27056 13.0063 8.68752 12.9707 9.10295C12.9351 9.51839 12.7819 9.91509 12.5291 10.2466C12.2762 10.5781 11.9341 10.8307 11.5428 10.9749C11.5428 10.9546 11.5428 10.919 11.5428 10.8943V8.20137C11.5434 8.13423 11.5261 8.06814 11.4926 8.0099C11.4592 7.95165 11.4109 7.90336 11.3527 7.86994ZM12.3333 6.394C12.316 6.38337 12.2858 6.36514 12.2641 6.3527L9.93303 5.00621C9.87493 4.97232 9.80887 4.95444 9.74158 4.95444C9.67432 4.95444 9.60824 4.97232 9.55014 5.00621L6.70418 6.64951V5.51167C6.70386 5.50585 6.70497 5.50005 6.70743 5.49479C6.70988 5.48952 6.7136 5.48492 6.71826 5.48144L9.0747 4.12203C9.4357 3.91387 9.84853 3.81281 10.2649 3.83068C10.6812 3.84856 11.0838 3.98462 11.4257 4.22296C11.7675 4.46129 12.0344 4.79204 12.1951 5.17652C12.3559 5.56099 12.4038 5.98327 12.3333 6.394ZM6.16851 8.42203L5.18299 7.85311C5.17784 7.85053 5.17336 7.84673 5.17002 7.84202C5.16668 7.8373 5.16455 7.83183 5.16385 7.82609V5.10452C5.16411 4.6877 5.28311 4.27956 5.5069 3.9279C5.73071 3.57623 6.05006 3.29559 6.42756 3.11883C6.80507 2.94206 7.22509 2.87649 7.63851 2.92977C8.05195 2.98306 8.44163 3.153 8.76197 3.41971C8.74421 3.42941 8.71327 3.44649 8.69272 3.45895L6.36168 4.80542C6.30317 4.83867 6.25462 4.8869 6.22093 4.94516C6.18727 5.0034 6.16974 5.06958 6.17012 5.13683L6.16851 8.42203ZM6.70371 7.26803L7.97126 6.53595L9.23878 7.26757V8.73127L7.97126 9.46292L6.70371 8.73127V7.26803Z"/></svg>'},k="team@northlight.ai";function $(e){const t=JSON.stringify(e.config).replace(/</g,"\\u003c");return`<!doctype html>
|
|
151
151
|
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
152
152
|
<meta name="color-scheme" content="light dark">
|
|
153
|
-
<title>${u(e.title)}</title><style nonce="${e.nonce}">${
|
|
153
|
+
<title>${u(e.title)}</title><style nonce="${e.nonce}">${U}</style></head>
|
|
154
154
|
<body>
|
|
155
|
-
<header class="top">${
|
|
155
|
+
<header class="top">${q}<span>Northlight</span></header>
|
|
156
156
|
<main><div class="col">${e.body}</div></main>
|
|
157
|
-
<footer class="foot"><span>Need help? Email <a href="mailto:${
|
|
157
|
+
<footer class="foot"><span>Need help? Email <a href="mailto:${k}">${k}</a></span></footer>
|
|
158
158
|
<script type="application/json" id="cfg">${t}<\/script>
|
|
159
|
-
<script nonce="${e.nonce}">${
|
|
160
|
-
</body></html>`}
|
|
161
|
-
${
|
|
159
|
+
<script nonce="${e.nonce}">${J}<\/script>
|
|
160
|
+
</body></html>`}o($,"page");function S(e,t){return`<div class="head"><div class="logo">${W[e]}</div><div><span class="eyebrow">AI subscription</span><h1>Connect your ${t} account</h1></div></div>`}o(S,"header");function h(e,t,n="",r=""){return`<li${r}><span class="n"><span>${e}</span>${s("check")}</span><div class="body"><span class="title">${t}</span>${n}</div></li>`}o(h,"step");function X(e,t,n,r){return $({nonce:t,title:"Connect Claude",body:`<div class="card">
|
|
161
|
+
${S("claude","Claude")}
|
|
162
162
|
<ol class="steps">
|
|
163
163
|
${h(1,"Sign in to Claude in a new tab",`<div><a class="btn" href="${u(e.url)}" target="_blank" rel="noopener noreferrer">Open claude.ai${s("arrow")}</a></div>`," data-pre")}
|
|
164
164
|
${h(2,"Copy the code Claude shows you",""," data-pre")}
|
|
@@ -169,14 +169,14 @@ ${h(3,"Paste it here",`<form id="paste" autocomplete="off">
|
|
|
169
169
|
<button class="btn primary lg wide" type="submit">Connect Claude</button>
|
|
170
170
|
</form>`)}
|
|
171
171
|
</ol>
|
|
172
|
-
</div>`,config:{kind:"anthropic",base:`${c}/${encodeURIComponent(e.flow_id)}`,returnTo:n,handoff:r}})}
|
|
173
|
-
${
|
|
172
|
+
</div>`,config:{kind:"anthropic",base:`${c}/${encodeURIComponent(e.flow_id)}`,returnTo:n,handoff:r}})}o(X,"anthropicPage");function Y(e,t){const n=Date.parse(e.expires_at)-t;return Math.max(0,Math.floor(Math.min(Number.isNaN(n)?M*1e3:n,M*1e3)/1e3))}o(Y,"codeSecondsLeft");function K(e,t,n,r,i=Date.now()){const a=e.user_code??"";return $({nonce:t,title:"Connect ChatGPT",body:`<div class="card">
|
|
173
|
+
${S("chatgpt","ChatGPT")}
|
|
174
174
|
<div class="alert" id="settings" role="alert">${s("warn")}
|
|
175
175
|
<div class="text"><strong>Turn on device code sign-in first</strong>OpenAI refuses this sign-in unless device code authorization for Codex is on in ChatGPT's Security settings.</div>
|
|
176
|
-
<div class="act"><a class="btn sm" href="${
|
|
176
|
+
<div class="act"><a class="btn sm" href="${D}" target="_blank" rel="noopener noreferrer">Open settings${s("arrow")}</a></div></div>
|
|
177
177
|
<ol class="steps" id="device">
|
|
178
178
|
${h(1,"Open the OpenAI device page",`<div><a class="btn" id="device-link" href="${u(e.url)}" target="_blank" rel="noopener noreferrer">${u(e.url.replace(/^https:\/\//,""))}${s("arrow")}</a></div>`)}
|
|
179
|
-
${h(2,"Enter this code",`<div class="codebox"><span class="code" id="user-code">${u(
|
|
179
|
+
${h(2,"Enter this code",`<div class="codebox"><span class="code" id="user-code">${u(a)}</span>
|
|
180
180
|
<span class="badge" id="expired-badge" hidden>Expired</span>
|
|
181
181
|
<button class="btn sm" type="button" id="copy">${s("copy")}<span id="copy-label">Copy</span></button></div>`)}
|
|
182
182
|
${h(3,"Approve the sign-in",`<span class="small">When OpenAI shows an account email, check it's the account you want to use: approving connects that account.</span>`)}
|
|
@@ -189,4 +189,4 @@ ${h(3,"Approve the sign-in",`<span class="small">When OpenAI shows an account em
|
|
|
189
189
|
<div class="alert" id="expired" role="alert" hidden>${s("warn")}
|
|
190
190
|
<div class="text"><strong>The code expired before it was approved</strong>Codes last 15 minutes. Getting a new one starts the sign-in over.</div>
|
|
191
191
|
<div class="act"><button class="btn primary sm" type="button" id="renew">Get a new code</button></div></div>
|
|
192
|
-
</div>`,config:{kind:"openai",base:`${c}/${encodeURIComponent(e.flow_id)}`,returnTo:n,handoff:r,userCode:
|
|
192
|
+
</div>`,config:{kind:"openai",base:`${c}/${encodeURIComponent(e.flow_id)}`,returnTo:n,handoff:r,userCode:a,expiresAt:e.expires_at,remainingSeconds:Y(e,i)}})}o(K,"openaiPage");async function Q(e,t,n,r){const i=w(n.searchParams,"handoff"),a=await z(r,i);if(C(a.jti))throw f();const l=w(n.searchParams,"return_to");let v;try{v=l===void 0?void 0:new URL(l).origin}catch{v=void 0}if(l===void 0||v!==new URL(r.issuer).origin)throw new d(400,"invalid_request","return_to must be an absolute URL on the directory origin","return_to");const p=w(n.searchParams,"vendor");if(p!=="anthropic"&&p!=="openai")throw new d(400,"invalid_request","vendor must be anthropic or openai","vendor");if(!j(a.jti,a.exp))throw f();let b;try{b=await R({provider:N(p),jti:a.jti})}catch(L){console.error("[vendor-signin] start failed:",L instanceof Error?L.message:L),t.writeHead(303,{Location:F(l,"failed","start_failed"),"Cache-Control":"no-store","Referrer-Policy":"no-referrer"}),t.end();return}const g=E(16).toString("base64"),T=p==="anthropic"?X(b,g,l,i):K(b,g,l,i);t.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store","Referrer-Policy":"no-referrer","X-Content-Type-Options":"nosniff","Content-Security-Policy":`default-src 'none'; script-src 'nonce-${g}'; style-src 'nonce-${g}'; connect-src 'self'; form-action 'none'; base-uri 'none'; frame-ancestors 'none'`}),t.end(T)}o(Q,"startPage");function m(e,t,n){console.error(`[vendor-signin] failed flow=${t} reason=${n}`),x(e,200,{status:"failed",reason:n})}o(m,"sendFailed");async function _(e,t,n){let r;try{r=await z(t,B(e))}catch(a){throw console.error(`[vendor-signin] handoff rejected flow=${n} reason=${a instanceof Error?a.message:String(a)}`),a}const i=y(n);if(!i){if(C(r.jti))return!1;throw console.error(`[vendor-signin] unauthorized flow=${n} reason=unknown flow, handoff never started one`),f()}if(i.jti===void 0||i.jti!==r.jti)throw console.error(`[vendor-signin] unauthorized flow=${n} reason=handoff did not start this flow`),f();return!0}o(_,"followUpFlow");async function e1(e,t,n,r){if(!await _(e,n,r)){m(t,r,"flow_gone");return}const i=await G(e);try{await P(r,i.input),x(t,200,{status:"connected"})}catch(a){const l=y(r);if(l&&l.status!=="pending"){m(t,r,l.message??l.status);return}throw a}}o(e1,"submitCode");async function t1(e,t,n,r){if(!await _(e,n,r)){m(t,r,"flow_gone");return}const i=new AbortController;t.once("close",()=>i.abort());const a=await H(r,V,i.signal);if(!a){m(t,r,"flow_gone");return}if(a.status==="failed"){m(t,r,a.message??"failed");return}x(t,200,{status:a.status})}o(t1,"waitFlow");async function c1(e,t,n,r){const i=e.method??"GET";if(n.pathname===c&&i==="GET"){await Q(e,t,n,r);return}const a=n.pathname.slice(c.length+1).split("/");let l="";try{l=a[0]?decodeURIComponent(a[0]):""}catch{throw new d(404,"not_found","unknown operation")}if(l&&a.length===1&&i==="POST"){await e1(e,t,r,l);return}if(l&&a.length===2&&a[1]==="wait"&&i==="GET"){await t1(e,t,r,l);return}throw new d(404,"not_found","unknown operation")}o(c1,"handleVendorSignIn");export{c as VENDOR_SIGNIN_PATH,X as anthropicPage,u as escapeHtml,c1 as handleVendorSignIn,d1 as isVendorSignInPath,K as openaiPage};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.537",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
},
|
|
141
141
|
"license": "UNLICENSED",
|
|
142
142
|
"dependencies": {
|
|
143
|
-
"@north-light/identity": "0.3.
|
|
143
|
+
"@north-light/identity": "0.3.537",
|
|
144
144
|
"@earendil-works/pi-agent-core": "1.1.0",
|
|
145
145
|
"@earendil-works/pi-ai": "1.1.0",
|
|
146
146
|
"@earendil-works/pi-coding-agent": "1.1.0",
|
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.537",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/cli",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.537",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "UNLICENSED",
|
|
12
12
|
"workspaces": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@milkdown/preset-gfm": "^7.22.3",
|
|
25
25
|
"@milkdown/prose": "^7.22.3",
|
|
26
26
|
"@milkdown/utils": "^7.22.3",
|
|
27
|
-
"@north-light/identity": "0.3.
|
|
27
|
+
"@north-light/identity": "0.3.537",
|
|
28
28
|
"cron-parser": "^5.6.0",
|
|
29
29
|
"esbuild": "^0.27.7",
|
|
30
30
|
"jose": "^6.2.12",
|
|
@@ -12455,17 +12455,17 @@
|
|
|
12455
12455
|
},
|
|
12456
12456
|
"packages/crouter-api": {
|
|
12457
12457
|
"name": "@north-light/api",
|
|
12458
|
-
"version": "0.3.
|
|
12458
|
+
"version": "0.3.537",
|
|
12459
12459
|
"license": "UNLICENSED"
|
|
12460
12460
|
},
|
|
12461
12461
|
"packages/crouter-env-docker": {
|
|
12462
12462
|
"name": "@north-light/env-docker",
|
|
12463
|
-
"version": "0.3.
|
|
12463
|
+
"version": "0.3.537",
|
|
12464
12464
|
"license": "UNLICENSED"
|
|
12465
12465
|
},
|
|
12466
12466
|
"packages/crouter-identity": {
|
|
12467
12467
|
"name": "@north-light/identity",
|
|
12468
|
-
"version": "0.3.
|
|
12468
|
+
"version": "0.3.537",
|
|
12469
12469
|
"license": "UNLICENSED",
|
|
12470
12470
|
"dependencies": {
|
|
12471
12471
|
"jose": "^6.2.1"
|
|
@@ -12473,20 +12473,20 @@
|
|
|
12473
12473
|
},
|
|
12474
12474
|
"packages/crouter-plugin": {
|
|
12475
12475
|
"name": "@north-light/plugin",
|
|
12476
|
-
"version": "0.3.
|
|
12476
|
+
"version": "0.3.537",
|
|
12477
12477
|
"license": "UNLICENSED",
|
|
12478
12478
|
"dependencies": {
|
|
12479
|
-
"@north-light/api": "0.3.
|
|
12480
|
-
"@north-light/identity": "0.3.
|
|
12479
|
+
"@north-light/api": "0.3.537",
|
|
12480
|
+
"@north-light/identity": "0.3.537"
|
|
12481
12481
|
}
|
|
12482
12482
|
},
|
|
12483
12483
|
"packages/crouter-sdk": {
|
|
12484
12484
|
"name": "@north-light/sdk",
|
|
12485
|
-
"version": "0.3.
|
|
12485
|
+
"version": "0.3.537",
|
|
12486
12486
|
"license": "UNLICENSED",
|
|
12487
12487
|
"dependencies": {
|
|
12488
|
-
"@north-light/api": "0.3.
|
|
12489
|
-
"@north-light/identity": "0.3.
|
|
12488
|
+
"@north-light/api": "0.3.537",
|
|
12489
|
+
"@north-light/identity": "0.3.537",
|
|
12490
12490
|
"jose": "^6.2.1"
|
|
12491
12491
|
},
|
|
12492
12492
|
"bin": {
|