Lines 1-21javascript
1import{createRequire as U$}from"node:module";var w$=Object.defineProperty;var L$=($)=>$;function C$($,X){this[$]=L$.bind(null,X)}var A$=($,X)=>{for(var Y in X)w$($,Y,{get:X[Y],enumerable:!0,configurable:!0,set:C$.bind(X,Y)})};var N$=($,X)=>()=>($&&(X=$($=0)),X);var T0=U$(import.meta.url);var C2={};A$(C2,{runGit:()=>_,isGitRepo:()=>X0,gitIsAvailable:()=>E0,gitFetchUnshallow:()=>k0,gitFetchAndReset:()=>$0,commitAndPush:()=>s$,cloneProject:()=>b0,buildGitUrl:()=>t});import{spawn as a$,execFile as l$}from"node:child_process";import{existsSync as R0}from"node:fs";import{join as P0}from"node:path";i ...
2Shogo Worker — Preflight
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
dist/cli.mjsView on unpkg · L1 HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
dist/cli.mjsView on unpkg · L1 3`));let X=!1,Y=0;for(let Z of $){process.stdout.write(` ${M.dim("...")} ${Z.name}`);let z=await Z.run();if(process.stdout.write("\r"),z.ok)console.log(` ${M.green("✓")} ${Z.name}${z.detail?M.dim(` — ${z.detail}`):""}`);else if(Z.criticality==="graceful")console.log(` ${M.yellow("◦")} ${Z.name}${z.detail?M.
5`));else if(!X)console.log(M.yellow(`
6Starting with ${Y} optional host(s) blocked. See docs/my-machines-networking.md.
7`));else console.log(M.red(`
8Preflight failed — fix blocking issues before starting.
9`));return!X}import{accessSync as m$,constants as I$,existsSync as u$}from"node:fs";import{delimiter as f$,join as n$}from"node:path";function u($={}){let X=$.env??process.env,Y=d$($);for(let K of Y)if(H2(K.path))return K;let Z=$.systemBinName??Q2(),z=g$(Z,X.PATH);if(z)return{path:z,source:"path"};return null}function d$($){let X=$.env??process.env,Y=[];if($.flag&&$.flag.trim())Y.push({path:$.flag.trim(),source:"flag"});let Z=X.SHOGO_AGENT_RUNTIME_BIN?.trim();if(Z)Y.push({path:Z,source:"env"});return Y.push({path:R,source:"home"}),Y}function Q2(){return process.platform==="win32"?"shogo-agent- ...
10`)}import{spawn as J6,spawnSync as V6}from"node:child_process";import{createHmac as M2,randomBytes as q6}from"node:crypto";import{existsSync as v0,mkdirSync as N2,readdirSync as Q6}from"node:fs";import{createConnection as H6}from"node:net";import{tmpdir as W6}from"node:os";import{dirname as O6,join
11`)){let J=parseInt(K.trim(),10);if(Number.isFinite(J))Z+=J,z=!0}return z?Z:null}catch{return null}}class S0{timer=null;consecutive=0;fired=!1;pid;ceilingMB;platform;intervalMs;strikes;logger;onBreach;constructor($){this.pid=$.pid,this.ceilingMB=$.ceilingMB,this.platform=$.platform??process.platform,this.intervalMs=$.intervalMs??parseInt(process.env.RUNTIME_RSS_WATCHDOG_MS||"15000",10),this.strikes=$.strikes??parseInt(process.env.RUNTIME_RSS_WATCHDOG_STRIKES||"2",10),this.logger=$.logger,this.onBreach=$.onBreach}start(){if(this.timer)return;this.timer=setInterval(()=>this.sample(),Math.max(2000 ...
12`)}class f0{opts;log;runtimes=new Map;usedPorts=new Set;spawnCommand;resolved=null;stopped=!1;resolvedLimits=void 0;watchers=new Map;pulledProjects=new Set;syncModes=new Map;constructor($={}){this.opts=$,this
13`))if(k)this.log.log(`${W} ${k}`)}),H.stderr?.on("data",(O)=>{$.lastStdoutAt=Date.now();for(let k of O.toString().trimEnd().split(`
14`))if(k)this.log.error(`${W} ${k}`)});try{return await this.waitForHealth($,U6),$.status="running",$.lastUsedAt=Date.now(),this.armIdleTimer($),this.armGraceTimer($),$}catch(O){$.status="error",$.lastError=O
15Shogo Worker — Starting`)),console.log(w.dim(" name ")+X.name),console.log(w.dim(" worker-dir ")+X.workerDir),console.log(w.dim(" cloud ")+X.cloudUrl),console.log(w.dim(" runtime ")+`${Z.path} ${w.dim(`(via ${Z.source})`)}`),console.log(w.dim(" auto-pull ")+(z?w.green("on")+w.dim(` → ${X.projectsDir}`):w.yellow("off"))),console.log(w.dim(" sync mode ")+(K?w.green("git")+w.dim(" (falls back to file transport if git is missing)"):w.yellow("files-only"))),$.project)console.log(w.dim(" project ")+$.project);if(Y)console.log(w.dim(" proxy ")+`${Y.url} ${w.dim ...
16Received ${O} — shutting down...`));try{q.stop()}catch{}try{await Q.stopAll()}catch(k){console.warn(w.yellow(`stopAll: ${k?.message??k}`))}process.exit(0)};process.once("SIGINT",()=>void W("SIGINT")),process.once("SIGTERM",()=>void W("SIGTERM")),process.once("SIGHUP",()=>void W("SIGHUP")),q.start(),console.log(w.green("✓ Worker running. Ctrl-C to stop.")),await new Promise(()=>{})}function S6({cfg:$,proxy:X,flags:Y}){let{entry:Z,runner:z}=P6(),K=M0({...process.env,SHOGO_API_KEY:$.apiKey,SHOGO_CLOUD_URL:$.cloudUrl,SHOGO_INSTANCE_NAME:$.name,SHOGO_WORKER_DIR:$.workerDir,SHOGO_LOCAL_MODE:"true",P ...
17Shogo Worker — Started`)),console.log(w.dim(" pid: ")+V),console.log(w.dim(" name: ")+$.name),console.log(w.dim(" logs: ")+"~/.shogo/logs/worker.log"),console.log(w.dim(" stop: ")+"shogo worker stop")}function R6($){let X=["worker","start","--foreground"];if($.name)X.push("--name",$.name);if($.workerDir)X.push("--worker-dir",$.workerDir);if($.apiKey)X.push("--api-key",$.apiKey);if($.cloudUrl)X.push("--cloud-url",$.cloudUrl);if($.port)X.push("--port",$.port);
18 expected: ${H}
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
dist/cli.mjsView on unpkg · L1 19 actual: ${W}`);let O=A0(Q,"extract");c0(O,{recursive:!0}),await H1(q,O);let k=A0(O,"agent-runtime");if(!J0(k))throw Error(`Tarball ${V.assetName} did not contain ./agent-runtime`);W1(k,R);let C={version:K,target:z,installedAt:new Date().toISOString(),channel:Y,source:V.tarball,sha256:W};return t6(r,JSON.stringify(C,null,2)+`
20`,{mode:384}),X.log(`[runtime install] Installed agent-runtime ${K} (${z}) to ${R}`),{version:K,target:z,binPath:R,source:V.tarball,sha256:W,channel:Y}}finally{try{o0(Q,{recursive:!0,force:!0})}catch{}}}function l2(){return{runtimeDir:l,runtimeBin:R,versionFile:r}}async function a0($={}){let X=await a2({channel:$.channel,version:$.version,baseUrl:$.baseUrl,force:$.force});console.log(),console.log(U.green("✓"),`agent-runtime ${U.bold(X.version)} installed (${X.target})`),console.log(` ${U.dim("path: ")} ${X.binPath}`),console.log(` ${U.dim("source: ")} ${X.source}`),console.log(` ${U.di ...
21shogo project pull ${L.cyan($)}`)),console.log(L.dim(" cloud ")+Y.cloudUrl),console.log(L.dim(" into ")+Z),z?.length)console.log(L.dim(" include ")+z.join(", "));console.log("");let K=new w1({apiUrl:Y.cloudUrl,apiKey:Y.apiKey,projectId:$,localDir:Z,include:z,onProgress:L1()}),J=await K.downloadAll();if(C1("Pull",J),X.watch){console.log(L.bold(`
Long lines were clipped for display.