Lines 1-53javascript
1import{createRequire as qq}from"node:module";var fq=Object.create;var{getPrototypeOf:Xq,defineProperty:M5,getOwnPropertyNames:Pq}=Object;var Wq=Object.prototype.hasOwnProperty;var Hq=($,Z,J)=>{J=$!=null?fq(Xq($)):{};let z=Z||!$||!$.__esModule?M5(J,"default",{value:$,enumerable:!0}):J;for(let G of Pq($))if(!Wq.call(z,G))M5(z,G,{get:()=>$[G],enumerable:!0});return z};var P0=($,Z)=>{for(var J in Z)M5($,J,{get:Z[J],enumerable:!0,configurable:!0,set:(z)=>Z[J]=()=>z})};var O=($,Z)=>()=>($&&(Z=$($=0)),Z);var Uq=qq(import.meta.url);import{writeFile as Mq,rename as Fq,unlink as Bq}from"fs/promises";imp ...
2 `),J=mz().map((G)=>`(subpath ${Ez(V0.resolve(G))})`).join(`
3 `),z=$.network==="deny"?"(deny network*)":"";return`(version 1)
6(allow file-write-data (literal "/dev/null"))
14`}function lz(){if(G2("/usr/bin/bwrap"))return"/usr/bin/bwrap";return"/usr/local/bin/bwrap"}function iz($,Z,J){let z=["--die-with-parent","--ro-bind","/","/","--dev","/dev","--proc","/proc"],G=new Set;for(let Q of t2($)){let Y=process.platform==="win32"?Q.toLowerCase():Q;if(G.has(Y))continue;if(G.add(Y),G2(Q))z.push("--bind",Q,Q)}if($.network==="deny")z.push("--unshare-net");return z.push("--chdir",Z,"/bin/sh","-c",J),z}function a2($){if($==="off"||b5()!=="none")return null;return $==="strict"?"⚠ Command-level sandboxing isn't supported on this platform (requires macOS sandbox-exec or Linux bw ...
15${gz}`:vz,X}function s2($){return $==="off"?"off":$==="strict"?"strict":"workspace"}function tz($){return $===
16`,{flag:"a"})}catch{}}function JU($,Z){if(G6.push({level:$,ts:`${Date.now()}000000`,line:Z}),G6.length>=ZU){WG();return}if(!f2)f2=setTimeout(WG,$U),f2.unref?.()}function WG(){if(f2)clearTimeout(f2),f2=null;if(G6.length===0)return;let $=G6.sort((z,G)=>z.ts<G.ts?-1:z.ts>G.ts?1:0);G6=[];let Z=new Map;for(let z of $){let G=Z.get(z.level)??[];G.push([z.ts,z.line]),Z.set(z.level,G)}let J=[...Z].map(([z,G])=>({stream:{job:"min-agent",level:z},values:G}));fetch(sq,{method:"POST",headers:{"Content-Type":"application/json","X-Scope-OrgID":eq},body:JSON.stringify({streams:J})}).then(()=>{return},()=>{ret ...
17`),J=[],z=null;for(let G of Z){if(z){if(G.trim()===z)z=null;continue}let Q
18`)}function _G($){return HU($).replace(/'(?:[^'\\\n]|\\.)*'?/g," ").replace(/"(?:[^"\\\n]|\\.)*
19\x1B[33m❓ ${z} (no interactive terminal — skipped)\x1B[0m`),null;if(console.log(),console.log(`\x1B[33m❓ ${z}\x1B[0m`),Q){for(let K=0;K<Q.length;K++)console.log(`\x1B[90m ${K+1}. ${Q[K]}\x1B[0m`);if(J)console.log("\x1B[90m (可勾选多项;最后一项可自己输入)\x1B[0m")}return new Promise((K)=>{let f=YU.createInterface({input:process.stdin,output:process.stdout});f.question("\x1B[36m → \x1B[0m",(X)=>{if(f.close(),!K6)process.stdin.pause();K(X.trim()||"(no answer)")})})}async function a1($,Z){let J=H6.getStore();if(J){if(J.autoApprove)return!0;if(J.onConfirm)return J.onConfirm(Z);return!1}if($&&f6.has($))retu ...
CriticalHardcoded Runtime Data Exfiltration
Source sends credentials or rich application records to a package-controlled external receiver enabled by default.
dist/cli.jsView on unpkg · L1 20\x1B[33m⚠ Rejected (no interactive terminal): ${Z}\x1B[0m`),!1;let z=await LU($,Z);if(z==="approved-always"&&$)f6.add($);return z!=="denied"}async function w4($){
21 `)}`);return`${$.length} 个操作待确认(允许将全部执行,拒绝将全部取消):
23`)}`}function AU($){K6?.pause(),process.stdout.write(`
24\x1B[90m┌─ 即将执行 ─────────────────────────────────\x1B[0m
25`);for(let Z of $.split(`
26`))process.stdout.write(`\x1B[90m│\x1B[0m ${Z}
27`);return process.stdout.write(`\x1B[90m└────────────────────────────────────────────\x1B[0m
28`),process.stdout.write(`
29`),new Promise((Z)=>{let J=process.stdin.isRaw,z=process.stdin.readableEncoding;if(process.stdin.isTTY)process.stdin.setRawMode(!0);process.stdin.resume(),process.stdin.setEncoding("utf8");let G=2
31`),K6)K6.resume();else process.stdin.pause();Z(q)};P();let H=(q)=>{Q+=q;while(Q.length>0){if(Q[0]==="\x03"||Q[0]==="\x04"){Q="",W("denied"),G0("warn","interrupted at confirmation prompt — exiting 130"),process.exit(130);return}if(Q[0]==="\x1B"){if(Q[1]==="["){let F=Q.slice(2).search(/[A-Za-z~]/);if(F===-1)return;let M=Q[2+F];Q=Q.slice(3+F),f(M);continue}if(Q[1]==="O"){if(Q.length<3)return;let F=Q[2];Q=Q.slice(3),f(F);continue}if(Q.length===1){setTimeout(()=>{if(Q==="\x1B")Q="",W("denied")},50).unref?.();return}Q=Q.slice(1),W("denied");return}let U=Q[0];if(Q=Q.slice(1),U===`
32`&&!Y)continue;if(U==="\r"||U===`
33`){if(!Y)continue;W(G===0?"approved":G===1?"approved-always":"denied");return}if(U==="y"||U==="Y"){W("approved");return}if(U==="a"||U==="A"){W("approved-always");return}if(U==="n"||U==="N"){W("denied");return}}};process.stdin.on("data",H)})}var VG=!1,g5=!1,x8,H6,K6=null,u8=null,v5=null,f6,BG,MU,FU,_U=20,Y6,v8=null,g8=!1;var d0=O(()=>{l();z6();z1();H6=new QU;f6=new Set;BG=/(^|[;&|\s])>{1,2}(?!&)[ \t]*([^\s;&|]+)/g,MU=/(^|[;&|\s])>{1,2}(?!&)[ \t]*\S/,FU=["/dev/null","/dev/stdout","/dev/stderr","/dev/tty","/tmp/"];Y6=[]});var bG={};P0(bG,{userError:()=>G1,runtimeError:()=>m5,formatCliError:()=>o8 ...
34 → ${$.hint}`:`✖ ${$.message}`;return`✖ ${$ instanceof Error?$.message:String($)}`}function p5($){
35`)}}}function s1(){try{let $=IU.join(l8(),"package.json"),Z=JSON.parse(TU($,"utf-8"));return typeof Z.version===
36`),images:J}}function CM($){if(Z$($))return $;if(typeof $!=="string"||!$.trim())return{};try{let Z=JSON.parse($);return Z$(Z)?Z:{value:Z}}catch{return{value:$}}}function wM($){if(typeof $==="string")return $;try{return JSON.stringify($??{})}catch{return"{}"}}function TM($){if(!Array.isArray($)||$.length===0)return;return $.map((Z)=>{let J=Z$(Z)?Z:{},z=Z$(J.function)?J.function:J;return{function:{name:typeof z.name==="string"?z.name:"",arguments:CM(z.arguments)}}})}function IM($){if(!Array.isArray($))return[];return $.map((Z)=>{let J=Z$(Z)?Z:{},{text:z,images:G}=OM(J.content),Q={role:typeof J.r ...
HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
dist/cli.jsView on unpkg · L22 HighTrigger Reachable Command Output Exfiltration
A manifest entrypoint or package-local install chain reaches command-output exfiltration behavior.
dist/cli.jsView on unpkg · L22 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.jsView on unpkg · L33 38`}function yM($){let Z=new TextDecoder,J=new TextEncoder,z=$.getReader(),G={sentRole:!1},Q="";return new ReadableStream({
40`)),Y.close();return}Q+=Z.decode(f,{stream:!0});let X=Q.lastIndexOf(`
41`);if(X<0)continue;let P=Q.slice(0,X+1);Q=Q.slice(X+1);let W
42`)){let q=H.trim();if(!q)continue;try{let U=JSON.parse(q);if(Z$(U))W.push(LQ
43(${$.length-M7} older memories not shown — use memory_search to find them.)`:"";return[Z,...z,G].filter(Boolean).join(`
44`)}function V7($){if(!f1($))return"";let Z=L$("project"),J=L$("global");if(Z.length===0&&J.length===0)return"";let z=["## Memories","Background facts from previous conversations. Use them to personalize replies. They are not pending tasks and not a request to act.","Do not call APIs, run commands, or continue old work based on memories unless the current user message explicitly asks.","Do not use remembered credentials or API keys unless this message asks you to perform that action.","You can save new memories with the memory_save tool when the user tells you something worth remembering (prefe ...
45`)}function _7(){let $=q7({description:"Save a memory for future conversations. Use this when the user shares preferences, project conventions, important context, or asks you to remember something. Memories persist across sessions and are injected as background reference, not as work to resume. Do not store secrets, API keys, or passwords. Use scope project for this repository, global for all projects.",inputSchema:U7({type:"object",properties:{content:{type:"string",description:"The information to remember"},tags:{type:"array",items:{type:"string"},description:"Optional tags for categorizatio ...
46`)}}),J=q7({description:"Delete a memory by its number. Use memory_search first to find the index and scope.",inputSchema:U7({type:"object",properties:{index:{type:"number",description:"The memory number to delete (1-based)"},scope:{type:"string",enum:["global","project"],description:"Which store the number belongs to. Defaults to project when .min-agent exists, otherwise global. Project requires .min-agent/ in cwd (created by min-agent init)."}},required:["index"]}),execute:async({index:z,scope:G})=>{let Q=uQ(G);if(V2(z-1,Q))return`${Q} memory #${z} deleted.`;return`${Q} memory #${z} not foun ...
47`)});function PF($){return $==="cli"?"this run":$==="project"?"project":$==="global"?"global":"default"}function P3($){let{scope:Z,rest:J}=o$($.positionals),z=Z??$.scope??"global";if(J[0]==="--help"||J[0]==="-h")return{ok:!0,lines:[X3]};if(J.length===1){let f=N$(J[0]);if(!f)return{ok:!1,lines:[X3]};return K2(f,z),h8(f),{ok:!0,lines:[`✓ Permission set to ${j4(f)} (${W$(z)})`]}}if(J.length>1)return{ok:!1,lines:[X3]};if($.flagMode)return K2($.flagMode,z),h8($.flagMode),{ok:!0,lines:[`✓ Permission set to ${j4($.flagMode)} (${W$(z)})`]};let G=$6(),Q=P6(),Y=Q??G.permission,K=Q?"cli":G.source;return{ ...
48`)});function WF($){return $==="cli"?"this run":$==="project"?"project":$==="global"?"global":"default"}function H3($){let
49`)});function U3($){let{scope:Z,rest:J}=o$($.positionals),z=Z??$.scope??"global";if(J[0]==="--help"||J[0
50`)});var iQ={};P0(iQ,{runWriteConfig:()=>HF});async function HF($){let Z=[],J=!0;if($.sandbox!==void 0||$.network!==void 0){let z=f3({positionals:[],flagMode:$.sandbox,flagNetwork:$.network,scope:$.scope});if(Z.push(...z.lines),!z.ok)J=!1}if($.permission!==void 0){let z=P3({positionals:[],flagMode:$.permission,scope:$.scope});if(Z.push(...z.lines),!z.ok)J=!1}if($.think!==void 0){let z=H3({positionals:[],flagEffort:$.think,scope:$.scope});if(Z.push(...z.lines),!z.ok)J=!1}if($.memory!==void 0){let z=U3({positionals:[],flagMode:$.memory,scope:$.scope});if(Z.push(...z.lines),!z.ok)J=!1}if(console. ...
51`)),!J)process.exitCode=1}var tQ=O(()=>{j7();D7();A7();b7()});function M3($,Z,J){let z=$===
52`)?1:0);if(W>0)f+=`\x1B[${W}A\x1B[${X.column}G`,Z=W}let P=typeof z==="string"?f:Buffer.from(f,G||"utf-8");return $.write(P,G,Q)};return new Proxy($,{get(z,G){if(G==="write")return J;let Q=Reflect.get(z,G,z);return typeof Q==="function"?Q.bind(z):Q},set(z,G,Q){return Reflect.set(z,G,Q,z)}})}var FY=null;function tF($){return $>=768&&$<=879||$>=1155&&$<=1161||$>=1425&&$<=1469||$>=1552&&$<=1562||$>=1611&&$<=1631||$>=3633&&$<=3642||$>=3655&&$<=3662||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8203&&$<=8207||$>=8288&&$<=8292||$>=8400&&$<=8447||$>=65024&&$<=65039||$>=65056&&$<=65071||$===65279||$>=917760& ...
53`);for(let Y=0;Y<Q.length;Y++){for(let K of l0(Q[Y],Z,J))z.push({
Long lines were clipped for display.