Lines 1-10javascript
1import{existsSync as X$}from"node:fs";import{join as f$}from"node:path";import{Type as D}from"@sinclair/typebox";import{getAgentDir as H1}from"@duckmind/dm-coding-agent";import{randomUUID as i}from"node:crypto";import{existsSync as w,mkdirSync as x,readFileSync as k,unlinkSync as J$,writeFileSync as o}from"node:fs";import{dirname as A,join as N,resolve as S}from"node:path";import{spawn as Q$,spawnSync as z$}from"node:child_process";import{homedir as u}from"node:os";import{getAgentDir as r}from"@duckmind/dm-coding-agent";var O$="https://chatgpt.com/backend-api/codex/responses",V$="https://openr ...
2`)}function x$($,j){let Y=F[j]??F[P];return[$,`Output in exactly ${Y.width}px x ${Y.height}px (${j}).`,"Prefer production-ready composition, grounded local detail when relevant, and the strongest final image_generation call."].join(`
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
extensions/dm-image2/index.jsView on unpkg · L1 3`)}function j$($,j){let Y=F[j]??F[P];return[$,`Target aspect ratio: ${j}.`,`Compose for roughly ${Y.width}x${Y.height} output.`,"Generate the final answer by calling the image_generation tool.","If the prompt is a portrait or public person, keep it respectful and presentation-ready."].join(`
4`)}function A$($){let j=String($??"").trim();if(!j)throw Error("Codex returned an empty image response.");let Y=j.match(/!\[[^\]]*]\((data:image\/svg\+xml[^)]+)\)/i);if(Y?.[1]){let X=Y[1],f=X.indexOf(",");if(f!==-1)return decodeURIComponent(X.slice(f+1)).trim()}let Z=j.match(/data:image\/svg\+xml[^,]*,(.+)$/is);if(Z?.[1])return decodeURIComponent(Z[1]).trim();let H=j.match(/```(?:svg)?\s*([\s\S]*?)```/i)?.[1]?.trim();if(H?.startsWith("<svg"))return H;let W=j.match(/<svg[\s\S]*<\/svg>/i);if(W?.[0])return W[0].trim();throw Error(`Expected SVG markup from Codex, received: ${j.slice(0,240)}`)}asyn ...
5`));if(f==="response.output_text.delta"&&typeof K.delta==="string")V+=K.delta;if(f==="response.output_item.done"&&K.item&&typeof K.item==="object")B.push(K.item);if(f==="response.completed"||f==="response.done")return z=K.response?.id??z,f
6`);if(_===-1)break;let J=X.slice(0,_);if(X=X.slice(_+1),J.endsWith("\r"))J=J.slice(0,-1);if(!J
7`),j}function Z$(){let $=[],j=new Set;for(let[Y,Z]of[["env:auth_file",process.env.auth_file],["env:M_AUTH_FILE",process.env.M_AUTH_FILE]]){if(typeof Z!=="string"||!Z.trim())continue;let G=S(Z);if(!w(G)||j.has(G))continue;j.add(G),$.push({kind:"file",authSource:Y,authFile:G})}return $}function G$(){let $=p(e("auth.json"));if(!$||typeof $!=="object")return[];return Object.keys($).filter((j)=>j==="openai-codex"||/^openai-codex-account-\d+$/.test(j)).sort((j,Y)=>{if(j==="openai-codex")return-1;if(Y==="openai-codex")return 1;return j.localeCompare(Y,void 0,{numeric:!0})}).map((j)=>{let Y=$[j],Z=typ ...
HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
extensions/dm-image2/index.jsView on unpkg · L1 8`);let z={...process.env,PYTHONPATH:a+(process.env.PYTHONPATH?`:${process.env.PYTHONPATH}`:""),auth_file:V,model:Y,quiet:"1",no_session_lock:"1",session:`new:${O}`},B=v;return await new Promise((U,K)=>{let Q=!1,_="",J="",q=Q$("python3",[y,x$($,j)],{cwd:G,env:z,stdio:["ignore","pipe","pipe"]}),T=setTimeout(()=>{q.kill("SIGTERM")},B),M=()=>{q.kill("SIGTERM")};H?.addEventListener("abort",M,{once:!0}),q.stdout.on("data",(L)=>{_+=L.toString("utf-8")}),q.stderr.on("data",(L)=>{J+=L.toString("utf-8")}),q.on("error",(L)=>{if(Q)return;Q=!0,clearTimeout(T),H?.removeEventListener("abort",M),K(L)}),q.on(" ...
9`)}function K1($){$.on("session_start",async(j,Y)=>{let Z=H1(),G=typeof Y.modelRegistry?.getProviderAuthStatus==="function"?Y.modelRegistry.getProviderAuthStatus("openrouter"):void 0;if(!(process.env.OPENROUTER_API_KEY||process.env.
Long lines were clipped for display.