Lines 184-224javascript
185 - "\${PROD_DATABASE_URL}"
187 - "api.hackathonat.com"
190 # - "my-prod-uploads"
191 # contexts: # k8s contexts, droplet ids, cluster names
194# Production-only rules beyond the catalog:
196`,ua=`# Per-agent override for coder-agent. Top-level rules here are auto-scoped to
197# this agent (the filename names it). coder agents never touch production.
201 target_in: production
204 message: "coder-agent is not permitted to run commands against production."
205`,ci=[{relPath:"policy.yaml",content:ma},{relPath:"environments/production.yaml",content:pa},{relPath:"agents/coder-agent.yaml",content:ua}];var Ze=new fa().name("guard").description("destructive-action guardrails \u2014 policy, checks, audit");function hn(e){return e==="deny"?ee.red:e==="escalate"||e==="ask"?ee.yellow:e==="warn"?ee.magenta:ee.green}function jt(e){return e.root?di(e.root):Ms()}Ze.command("check").description("PreToolUse hook entrypoint: read a tool-call payload on stdin, emit a Claude Code decision").option("--agent <id>","agent id this workspace belongs to").option("--root <d ...
206`)),{path:t,changed:d,events:a,guardInstalled:c}}function fi(e={}){let o=e.path??et();if(!At(o))return{path:o,changed:!1,events:[],guardInstalled:!1};let t;try{t=JSON
207`),{path:o,changed:r,events:i,guardInstalled:!1}}function Ct(e=et()){if(!At(e))return!1;try{return!!JSON.parse(Ot(e,"utf-8"))?.hooks?.Stop?.some?.(t=>It(t,wn))}catch{return!1}}var fo=new Ea().name("attach").description("wear an agentx agent identity in this Claude Code session"),bn=process.env.AGENTX_DAEMON_URL||`http://127.0.0.1:${$n()}`;function kn(e){return e||process.env.CLAUDE_CODE_SESSION_ID||void 0}async function vn(e,o,t){let n=await fetch(`${e}${o}`,{method:t?"POST":"GET",headers:{"Content-Type":"application/json"},body:t?JSON.stringify(t):void 0}),s=await n.text(),i=null;try{i=s?JSON ...
208 ${i} registered session(s) with no binding.`)),console.log()}catch(t){console.error(C.red(`Could not read attach state: ${xn(t)}`)),process.exit(1)}});fo.command("install").description("wire the attach hooks into ~/.claude/settings.json (one time, all sessions)").option("--port <n>","daemon port the hooks should call (default: node.bind in agentx.json)").option("--path <file>","settings file to patch (default: ~/.claude/settings.json)").option("--no-guard","skip the PreToolUse guard hook (not recommended)").action(e=>{try{let o=String(e.port||$n()),t=ui(o,{path:e.path,withGuard:e.guard});con ...
209 settings \u2014 without this an attached production identity would be less
210 guarded than a spawned one.)`))):console.log(C.yellow(" ! Guard hook skipped. An attached production identity will run unguarded.")),console.log(),console.log(`Next: ${C.cyan("agentx attach <agent>")} inside a Claude Code session.`)}catch(o){console.error(C.red(`Install failed: ${o
212`}function yo(e,o,t=".env"){let n=xi(t),s=Si(n),i=s.findIndex(r=>r.kind==="kv"&&r.key===e);i>=0?s[i]={kind:"kv",key:e,value:o,raw:`${e}=${An(o)}`}:(s.length&&s[s.length-1].kind!=="blank"&&s.push({kind:"blank",raw:""}),s.push({kind:"kv",key:e,value:o,raw:`${e}=${An(o)}`})),Va(n,ec(s))}function On(e,o=".env"){return Si(o).find(s=>s.kind==="kv"&&s.key===e)?.value}var ji="https://t.me/BotFather";async function oc(e){try{let o=await fetch(`https://api.telegram.org/bot${e}/getMe`,{signal:AbortSignal.timeout(8e3)});if(!o.ok)return null;let t=await o.json();return t?.ok?t.result:null}catch{return null ...
213`)),{node:{id:"setup",name:"Setup",bind:"127.0.0.1:18800"},providers:{},agents:{},channels:{},crons:{},mesh:{enabled:!1,peers:[],discovery:"static",healthCheck:{interval:60,timeout:10}},boards:[],dashboard:{enabled:!0,port:e?parseInt(e,10):4202,bind:o||"127.0.0.1",daemonUrl:"http://localhost:18800",daemons:[]},business:void 0,session:{staleMinutes:120}}}}oo.command("list").description("list configured boards").action(()=>{try{let e=L();if(!e.boards?.length){console.log(re.dim(`
CriticalCommand Output Exfiltration
Source executes local commands and sends command output to an external endpoint.
dist/chunk-UHE5FCPB.jsView on unpkg · L204 214 No boards configured.
215`));return}console.log();for(let o of e.boards){console.log(` ${re.cyan(o.id)} \u2014 ${o.name}`);let t=o.source;console.log(re.dim(` source: ${t.type}${t.projects?" ("+t.projects.join(", ")+")":""}`)),o.primaryToolLabel&&console.log(re.dim(` primary label: ${o.primaryToolLabel}`)),console.log(re.dim(` window: ${o.timeRangeDays} days`))}console.log()}catch(e){console.log(re.red(` ${e.message}`)),process.exit(1)}});oo.command("add <id>").description("add a GitLab board to agentx.json").requiredOption("--name <name>","human-readable board name").requiredOption("--projects <paths>","c ...
217`)),t&&console.log(re.dim(` Backup: ${t}`)),console.log(re.dim(` Restart the dashboard to pick up the change if not auto-reloading.
218`))}import{Command as Sc}from"commander";import p from"chalk";import{resolve as N,relative as Pi,dirname as Mi}from"path";import{execSync as bo}from"child_process";import{writeFileSync as ko,mkdirSync as Je,readFileSync as it,readdirSync as jc,renameSync as Pt,rmSync as Ec,existsSync as Re}from"fs";function ve(e,o){return new Zt(e||N(process.cwd(),".agentx/wiki"),void 0,o||"graph")}function _n(e){return e==="graph"?"Knowledge Graph":e==="flat"?"Karpathy Flat":"Unified"}var ae=new Sc().
220--- END ENTRY ---`).join(`
222`),v=As(o,l,y,f.articles,$,u.length);console.log(p.dim(` Mode: ${_n(o)}`));let b=N(m.baseDir,"_tmp");Je(b,{recursive:!0});let S=N(b,"absorb-prompt.txt");ko(S,v),console.log(p.dim(" Compiling with Claude..."));try{let x;try{x=bo(`cat '${S}' | claude -p - --output-format json --max-turns 3 --model sonnet --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,{encoding:"utf-8",timeout:9e5,maxBuffer:10*1024*1024})}catch(O){if(x=O.stdout||"",!x)throw O}let k=x;try{let O=JSON.parse(x);k=O.result||O.content||"",k||(console.log(p.dim(`
223`)||"_(none returned)_",x;try{let k=await o(v.message,d,c,{selectorModel:e.selectorModel,synthModel:e.synthModel});if(k.status!=="ok")x=`_(status: ${k.status}${k.error?" \u2014 "+k.error:""})_`;else{let A=k.citations.map(I=>`\`${I.title}\` [${I.type||"?"}]`).join(", ");x=`**Answer:**
Long lines were clipped for display.