openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.25 kB
JavaScript
import{t as captureResidentUserProfileAccess}from"./user-profile-list-DJsakwXy.mjs";
//!src/gateway/github-publication-inspect-reader.ts
function captureOwnGitHubPullRequestReader(e,t,n,r){const i=t();if(r){const assertCurrent=()=>{r();if(t()!==i)throw new Error(`The GitHub host changed; retry inspection.`)};assertCurrent();return{host:i,accountIds:[],publication:n,operatorWrite:true,identity:JSON.stringify([`operator.write`,e,i]),assertCurrent}}if(!e)throw new Error(`Inspecting your PR requires your verified linked GitHub account.`);const a=captureResidentUserProfileAccess(e);const accountIds=()=>{const e=a.readCurrentFacts();return i===`github.com`?[...e.githubAccountIds??[]]:(e.enterpriseGitHubAccounts??[]).flatMap(e=>e.host===i?[e.accountId]:[])};const o=accountIds();if(!o.length&&!n)throw new Error(`Link a verified GitHub account on the configured host before inspecting your PR.`);return{host:i,accountIds:o,publication:n,operatorWrite:false,identity:JSON.stringify([e,i,o.toSorted((e,t)=>e-t),...n?[n]:[]]),assertCurrent:()=>{const e=accountIds();if(t()!==i||!o.every(t=>e.includes(t)))throw new Error(`Your linked GitHub identity changed; retry inspection with your current account.`)}}}export{captureOwnGitHubPullRequestReader as t};