just-bash 2.12.8 → 2.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +332 -260
  2. package/dist/AGENTS.md +1 -1
  3. package/dist/Bash.d.ts +17 -0
  4. package/dist/bin/chunks/{awk2-J2PNSA7C.js → awk2-VTJMI54B.js} +1 -1
  5. package/dist/bin/chunks/{chunk-O5B6WWQQ.js → chunk-A3HQTYHR.js} +1 -1
  6. package/dist/bin/chunks/chunk-AAW7UMPO.js +9 -0
  7. package/dist/bin/chunks/{chunk-2V53PP6G.js → chunk-B3RU2PUI.js} +27 -27
  8. package/dist/bin/chunks/chunk-CQG2HEAL.js +5 -0
  9. package/dist/bin/chunks/chunk-DOXYBGNA.js +12 -0
  10. package/dist/bin/chunks/chunk-FBJJY4ZV.js +14 -0
  11. package/dist/bin/{shell/chunks/chunk-YAEF6X2N.js → chunks/chunk-GR23MPTT.js} +1 -1
  12. package/dist/bin/{shell/chunks/chunk-35JD7YEM.js → chunks/chunk-HJEHIH4P.js} +13 -13
  13. package/dist/bin/chunks/{chunk-UG4GMDQL.js → chunk-LGF54XJQ.js} +1 -1
  14. package/dist/bin/chunks/chunk-LIYVQA3X.js +2 -0
  15. package/dist/bin/chunks/{chunk-2BC3N3L2.js → chunk-ORUYSLP4.js} +4 -4
  16. package/dist/bin/chunks/{chunk-REGSV3X5.js → chunk-SDLWFYVT.js} +1 -1
  17. package/dist/bin/chunks/{chunk-STOAUD75.js → chunk-THNL3XFF.js} +8 -8
  18. package/dist/bin/chunks/chunk-TKTKRRAL.js +11 -0
  19. package/dist/bin/chunks/{chunk-ZJGIBTWD.js → chunk-V7ZOPVQS.js} +1 -1
  20. package/dist/bin/chunks/{chunk-ZYQQ6B7B.js → chunk-ZO5PSLKR.js} +2 -2
  21. package/dist/bin/chunks/curl-SRTMGOVV.js +26 -0
  22. package/dist/bin/chunks/env-NTPN5QYM.js +2 -0
  23. package/dist/bin/{shell/chunks/expansion-JBCP2CHQ.js → chunks/expansion-2RO5M3QC.js} +1 -1
  24. package/dist/bin/{shell/chunks/find-MTLF23HX.js → chunks/find-GAYRV4IF.js} +1 -1
  25. package/dist/bin/{shell/chunks/flag-coverage-CFWN3JJN.js → chunks/flag-coverage-A4G6STMS.js} +1 -1
  26. package/dist/bin/chunks/{help-4H52JYYC.js → help-DVG4AAGE.js} +1 -1
  27. package/dist/bin/{shell/chunks/jq-JFXEKNLN.js → chunks/jq-V7FYGIKO.js} +1 -1
  28. package/dist/bin/chunks/js-exec-JORCTVUT.js +97 -0
  29. package/dist/bin/chunks/js-exec-worker.js +4369 -0
  30. package/dist/bin/chunks/python3-PF7AHNQM.js +12 -0
  31. package/dist/bin/chunks/rg-C6KMBFNG.js +2 -0
  32. package/dist/bin/chunks/time-DDS6JJ23.js +2 -0
  33. package/dist/bin/chunks/{timeout-JJWIFL7W.js → timeout-Z24MNWOP.js} +1 -1
  34. package/dist/bin/chunks/worker.js +88 -33
  35. package/dist/bin/chunks/{xan-M6MLWZCU.js → xan-MOZFJGMY.js} +1 -1
  36. package/dist/bin/chunks/xargs-SCYIFXOW.js +2 -0
  37. package/dist/bin/chunks/{yq-YWUQUXJJ.js → yq-JJLSDDST.js} +1 -1
  38. package/dist/bin/just-bash.js +212 -211
  39. package/dist/bin/shell/chunks/{awk2-J2PNSA7C.js → awk2-VTJMI54B.js} +1 -1
  40. package/dist/bin/shell/chunks/{chunk-O5B6WWQQ.js → chunk-A3HQTYHR.js} +1 -1
  41. package/dist/bin/shell/chunks/chunk-AAW7UMPO.js +9 -0
  42. package/dist/bin/shell/chunks/{chunk-2V53PP6G.js → chunk-B3RU2PUI.js} +27 -27
  43. package/dist/bin/shell/chunks/chunk-CQG2HEAL.js +5 -0
  44. package/dist/bin/shell/chunks/chunk-DOXYBGNA.js +12 -0
  45. package/dist/bin/shell/chunks/chunk-FBJJY4ZV.js +14 -0
  46. package/dist/bin/{chunks/chunk-YAEF6X2N.js → shell/chunks/chunk-GR23MPTT.js} +1 -1
  47. package/dist/bin/{chunks/chunk-35JD7YEM.js → shell/chunks/chunk-HJEHIH4P.js} +13 -13
  48. package/dist/bin/shell/chunks/{chunk-UG4GMDQL.js → chunk-LGF54XJQ.js} +1 -1
  49. package/dist/bin/shell/chunks/chunk-LIYVQA3X.js +2 -0
  50. package/dist/bin/shell/chunks/{chunk-2BC3N3L2.js → chunk-ORUYSLP4.js} +4 -4
  51. package/dist/bin/shell/chunks/{chunk-REGSV3X5.js → chunk-SDLWFYVT.js} +1 -1
  52. package/dist/bin/shell/chunks/{chunk-STOAUD75.js → chunk-THNL3XFF.js} +8 -8
  53. package/dist/bin/shell/chunks/chunk-TKTKRRAL.js +11 -0
  54. package/dist/bin/shell/chunks/{chunk-ZJGIBTWD.js → chunk-V7ZOPVQS.js} +1 -1
  55. package/dist/bin/shell/chunks/{chunk-ZYQQ6B7B.js → chunk-ZO5PSLKR.js} +2 -2
  56. package/dist/bin/shell/chunks/curl-SRTMGOVV.js +26 -0
  57. package/dist/bin/shell/chunks/env-NTPN5QYM.js +2 -0
  58. package/dist/bin/{chunks/expansion-JBCP2CHQ.js → shell/chunks/expansion-2RO5M3QC.js} +1 -1
  59. package/dist/bin/{chunks/find-MTLF23HX.js → shell/chunks/find-GAYRV4IF.js} +1 -1
  60. package/dist/bin/{chunks/flag-coverage-CFWN3JJN.js → shell/chunks/flag-coverage-A4G6STMS.js} +1 -1
  61. package/dist/bin/shell/chunks/{help-4H52JYYC.js → help-DVG4AAGE.js} +1 -1
  62. package/dist/bin/{chunks/jq-JFXEKNLN.js → shell/chunks/jq-V7FYGIKO.js} +1 -1
  63. package/dist/bin/shell/chunks/js-exec-B6QNYHUL.js +97 -0
  64. package/dist/bin/shell/chunks/python3-J7DP4JBQ.js +12 -0
  65. package/dist/bin/shell/chunks/rg-C6KMBFNG.js +2 -0
  66. package/dist/bin/shell/chunks/time-DDS6JJ23.js +2 -0
  67. package/dist/bin/shell/chunks/{timeout-JJWIFL7W.js → timeout-Z24MNWOP.js} +1 -1
  68. package/dist/bin/shell/chunks/{xan-M6MLWZCU.js → xan-MOZFJGMY.js} +1 -1
  69. package/dist/bin/shell/chunks/xargs-SCYIFXOW.js +2 -0
  70. package/dist/bin/shell/chunks/{yq-YWUQUXJJ.js → yq-JJLSDDST.js} +1 -1
  71. package/dist/bin/shell/shell.js +212 -212
  72. package/dist/bundle/browser.js +600 -600
  73. package/dist/bundle/chunks/{awk2-FUVZGMX2.js → awk2-POPGKRAI.js} +1 -1
  74. package/dist/bundle/chunks/{chunk-DZZS6SJP.js → chunk-7TSDKFEO.js} +1 -1
  75. package/dist/bundle/chunks/{chunk-D4QDMGEB.js → chunk-BBXLRYSX.js} +2 -2
  76. package/dist/bundle/chunks/chunk-CWQS3NFK.js +1 -0
  77. package/dist/bundle/chunks/chunk-F5CMUULS.js +13 -0
  78. package/dist/bundle/chunks/{chunk-TRD56HID.js → chunk-FEIOJCZD.js} +1 -1
  79. package/dist/bundle/chunks/chunk-H2WXJGD7.js +10 -0
  80. package/dist/bundle/chunks/{chunk-D2FZX7A2.js → chunk-LPQPILI2.js} +8 -8
  81. package/dist/bundle/chunks/{chunk-2GOYXRRP.js → chunk-MLXIYONF.js} +4 -4
  82. package/dist/bundle/chunks/chunk-NAERJDUW.js +8 -0
  83. package/dist/bundle/chunks/{chunk-OKEHYWBE.js → chunk-NYQYO467.js} +13 -13
  84. package/dist/bundle/chunks/{chunk-JKLUDNMU.js → chunk-O2DBFL6Z.js} +1 -1
  85. package/dist/bundle/chunks/{chunk-JDMQDJYE.js → chunk-OARHFVLG.js} +1 -1
  86. package/dist/bundle/chunks/{chunk-AKVMAONP.js → chunk-RUF7WQ7U.js} +1 -1
  87. package/dist/bundle/chunks/chunk-TOMNU26N.js +4 -0
  88. package/dist/bundle/chunks/{chunk-ZLJ5TCLC.js → chunk-UNYNJIFU.js} +27 -27
  89. package/dist/bundle/chunks/chunk-YTNYSM6T.js +11 -0
  90. package/dist/bundle/chunks/curl-COE4TZE6.js +25 -0
  91. package/dist/bundle/chunks/env-5EPCWSXR.js +1 -0
  92. package/dist/bundle/chunks/{expansion-XG7G47TX.js → expansion-ENLSRCXJ.js} +1 -1
  93. package/dist/bundle/chunks/{find-DOIVMX6X.js → find-TPUOAIUQ.js} +1 -1
  94. package/dist/bundle/chunks/{flag-coverage-VML3BMJT.js → flag-coverage-G2R7PMYU.js} +1 -1
  95. package/dist/bundle/chunks/{help-IA5CMGR4.js → help-VVWX7SA5.js} +1 -1
  96. package/dist/bundle/chunks/{jq-SSCW4AAA.js → jq-DIRZBOTX.js} +1 -1
  97. package/dist/bundle/chunks/js-exec-YJSMH5AG.js +96 -0
  98. package/dist/bundle/chunks/js-exec-worker.js +4369 -0
  99. package/dist/bundle/chunks/python3-6HF56IYI.js +11 -0
  100. package/dist/bundle/chunks/rg-FOQSCCX3.js +1 -0
  101. package/dist/bundle/chunks/{time-XL42Z4U5.js → time-YG5BMRIQ.js} +1 -1
  102. package/dist/bundle/chunks/{timeout-QCU4INQT.js → timeout-VRKMCG72.js} +1 -1
  103. package/dist/bundle/chunks/worker.js +88 -33
  104. package/dist/bundle/chunks/{xan-K7XYDHFV.js → xan-BXDXYEIB.js} +1 -1
  105. package/dist/bundle/chunks/xargs-I6EZUCYF.js +1 -0
  106. package/dist/bundle/chunks/{yq-WTK3HUOR.js → yq-XMVSIL6Z.js} +1 -1
  107. package/dist/bundle/index.cjs +969 -870
  108. package/dist/bundle/index.js +151 -151
  109. package/dist/commands/curl/types.d.ts +1 -1
  110. package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
  111. package/dist/commands/js-exec/js-exec.d.ts +11 -0
  112. package/dist/commands/js-exec/module-shims.d.ts +29 -0
  113. package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
  114. package/dist/commands/js-exec/worker.d.ts +30 -0
  115. package/dist/commands/python3/worker.d.ts +1 -0
  116. package/dist/commands/query-engine/safe-object.d.ts +11 -0
  117. package/dist/commands/registry.d.ts +13 -2
  118. package/dist/commands/{python3/fs-bridge-handler.d.ts → worker-bridge/bridge-handler.d.ts} +25 -8
  119. package/dist/commands/{python3 → worker-bridge}/protocol.d.ts +6 -3
  120. package/dist/commands/{python3/sync-fs-backend.d.ts → worker-bridge/sync-backend.d.ts} +25 -4
  121. package/dist/index.d.cts +4 -4
  122. package/dist/index.d.ts +4 -4
  123. package/dist/interpreter/interpreter.d.ts +3 -0
  124. package/dist/interpreter/types.d.ts +8 -0
  125. package/dist/limits.d.ts +3 -1
  126. package/dist/network/allow-list.d.ts +5 -3
  127. package/dist/network/fetch.d.ts +1 -1
  128. package/dist/network/index.d.ts +1 -1
  129. package/dist/network/types.d.ts +32 -1
  130. package/dist/types.d.ts +12 -0
  131. package/package.json +13 -12
  132. package/dist/bin/chunks/chunk-47HZU3SY.js +0 -5
  133. package/dist/bin/chunks/chunk-CZFRRDQC.js +0 -12
  134. package/dist/bin/chunks/chunk-N4EU64Y4.js +0 -9
  135. package/dist/bin/chunks/chunk-QZNF3Y3J.js +0 -2
  136. package/dist/bin/chunks/chunk-VIYJJTN2.js +0 -14
  137. package/dist/bin/chunks/curl-3GMIPMCI.js +0 -26
  138. package/dist/bin/chunks/env-HOVBNLUR.js +0 -2
  139. package/dist/bin/chunks/python3-KI2FQWSN.js +0 -17
  140. package/dist/bin/chunks/rg-34GE6REQ.js +0 -2
  141. package/dist/bin/chunks/time-GZSHCM77.js +0 -2
  142. package/dist/bin/chunks/xargs-GBL6PZ2K.js +0 -2
  143. package/dist/bin/shell/chunks/chunk-47HZU3SY.js +0 -5
  144. package/dist/bin/shell/chunks/chunk-CZFRRDQC.js +0 -12
  145. package/dist/bin/shell/chunks/chunk-N4EU64Y4.js +0 -9
  146. package/dist/bin/shell/chunks/chunk-QZNF3Y3J.js +0 -2
  147. package/dist/bin/shell/chunks/chunk-VIYJJTN2.js +0 -14
  148. package/dist/bin/shell/chunks/curl-3GMIPMCI.js +0 -26
  149. package/dist/bin/shell/chunks/env-HOVBNLUR.js +0 -2
  150. package/dist/bin/shell/chunks/python3-E5X6WBBU.js +0 -17
  151. package/dist/bin/shell/chunks/rg-34GE6REQ.js +0 -2
  152. package/dist/bin/shell/chunks/time-GZSHCM77.js +0 -2
  153. package/dist/bin/shell/chunks/xargs-GBL6PZ2K.js +0 -2
  154. package/dist/bundle/chunks/chunk-3RA5L262.js +0 -8
  155. package/dist/bundle/chunks/chunk-EX62JIX3.js +0 -13
  156. package/dist/bundle/chunks/chunk-RH6GWZAJ.js +0 -1
  157. package/dist/bundle/chunks/chunk-WECLUBEQ.js +0 -11
  158. package/dist/bundle/chunks/chunk-ZSJYNBAF.js +0 -4
  159. package/dist/bundle/chunks/curl-KM2ZAUR6.js +0 -25
  160. package/dist/bundle/chunks/env-XZY4LKEO.js +0 -1
  161. package/dist/bundle/chunks/python3-2OHR6PZU.js +0 -16
  162. package/dist/bundle/chunks/rg-RAICUFGG.js +0 -1
  163. package/dist/bundle/chunks/xargs-2BBAQDTC.js +0 -1
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import{a as M,b as D}from"./chunk-TKTKRRAL.js";import"./chunk-4OALHZXB.js";import"./chunk-MY5PY2PL.js";import"./chunk-LIYVQA3X.js";import{a as C,b as v}from"./chunk-OOJCYVYF.js";import{a as b}from"./chunk-4PRVMER6.js";import{c as h}from"./chunk-MO4RPBN2.js";import{b as k}from"./chunk-YU6OGPZR.js";import{a as c}from"./chunk-SYG3IW7P.js";import{a as T,b as P}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{randomBytes as F}from"node:crypto";import{fileURLToPath as W}from"node:url";import{Worker as $}from"node:worker_threads";var Q=1e4,R=6e4,U={name:"python3",summary:"Execute Python code via CPython Emscripten",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using CPython compiled to WebAssembly via Emscripten.","","This command runs Python in an isolated environment with access to","the virtual filesystem. Standard library modules are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["CPython runs in WebAssembly, so execution may be slower than native Python.","Standard library modules are available (no pip install).","Maximum execution time is 30 seconds by default."]};function I(r){let e={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(r.length===0)return e;let t=r.findIndex(o=>!o.startsWith("-")||o==="-"||o==="--");for(let o=0;o<(t===-1?r.length:t);o++){let s=r[o];if(s==="-c")return o+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
3
+ `,exitCode:2}:(e.code=r[o+1],e.scriptArgs=r.slice(o+2),e);if(s==="-m")return o+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
4
+ `,exitCode:2}:(e.module=r[o+1],e.scriptArgs=r.slice(o+2),e);if(s==="--version"||s==="-V")return e.showVersion=!0,e;if(s.startsWith("-")&&s!=="-")return{stdout:"",stderr:`python3: unrecognized option '${s}'
5
+ `,exitCode:2}}if(t!==-1){let o=r[t];o==="--"?t+1<r.length&&(e.scriptFile=r[t+1],e.scriptArgs=r.slice(t+2)):(e.scriptFile=o,e.scriptArgs=r.slice(t+1))}return e}var w=new WeakMap;function L(r){let e=w.get(r);return e||(e={executionQueue:[],isExecuting:!1},w.set(r,e)),e}function oe(){w=new WeakMap}var H=W(new URL("./worker.js",import.meta.url));function N(){return F(16).toString("hex")}function z(r,e){if(!r||typeof r!="object")return{success:!1,error:"Malformed worker response"};let t=r;return typeof t.protocolToken!="string"||t.protocolToken!==e?{success:!1,error:"Malformed worker response: invalid protocol token"}:t.type==="security-violation"?{success:!1,error:`Security violation: ${typeof t.violation?.type=="string"?t.violation.type:"unknown"}`}:typeof t.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:t.success?{success:!0}:{success:!1,error:typeof t.error=="string"&&t.error.length>0?t.error:"Worker execution failed"}}function a(r){if(r.isExecuting||r.executionQueue.length===0)return;for(;r.executionQueue.length>0&&r.executionQueue[0].canceled;)r.executionQueue.shift();if(r.executionQueue.length===0)return;let e=r.executionQueue.shift();if(!e)return;r.isExecuting=!0;let t;try{t=k.runTrusted(()=>new $(H,{workerData:e.input}))}catch(n){let i=n instanceof Error?n.message:String(n);e.resolve({success:!1,error:c(i)}),r.isExecuting=!1,a(r);return}e.workerRef&&(e.workerRef.current=t);let o=h(e.requireDefenseContext,"python3","worker message callback",n=>{e.resolve(z(n,e.input.protocolToken)),r.isExecuting=!1,t.terminate(),a(r)}),s=h(e.requireDefenseContext,"python3","worker error callback",n=>{e.resolve({success:!1,error:c(n.message)}),r.isExecuting=!1,a(r)}),p=h(e.requireDefenseContext,"python3","worker exit callback",()=>{r.isExecuting&&(e.resolve({success:!1,error:"Worker exited unexpectedly"}),r.isExecuting=!1,a(r))}),f=n=>{try{o(n)}catch(i){let m=i instanceof Error?i.message:String(i);e.resolve({success:!1,error:c(m)}),r.isExecuting=!1,t.terminate(),a(r)}},l=n=>{try{s(n)}catch(i){let m=i instanceof Error?i.message:String(i);e.resolve({success:!1,error:c(m)}),r.isExecuting=!1,a(r)}},y=()=>{try{p()}catch(n){let i=n instanceof Error?n.message:String(n);e.resolve({success:!1,error:c(i)}),r.isExecuting=!1,a(r)}};t.on("message",f),t.on("error",l),t.on("exit",y)}async function B(r,e,t,o=[]){let s=M(),p=new D(s,e.fs,e.cwd,"python3",e.fetch,e.limits?.maxOutputSize??0),f=e.limits?.maxPythonTimeoutMs??Q,l=e.fetch?Math.max(f,R):f,y=L(e.fs),n={protocolToken:N(),sharedBuffer:s,pythonCode:r,cwd:e.cwd,env:b(e.env),args:o,scriptPath:t,timeoutMs:l},i={current:null},m=new Promise(u=>{let E={input:n,resolve:()=>{},workerRef:i,requireDefenseContext:e.requireDefenseContext},_=h(e.requireDefenseContext,"python3","worker timeout callback",()=>{i.current?i.current.terminate():E.canceled=!0,u({success:!1,error:`Execution timeout: exceeded ${l}ms limit`})}),O=C(()=>{try{_()}catch(d){let A=d instanceof Error?d.message:String(d);u({success:!1,error:c(A)})}},l);E.resolve=d=>{v(O),u(d)},y.executionQueue.push(E),a(y)}),[g,x]=await Promise.all([p.run(l).catch(u=>({stdout:"",stderr:`python3: bridge error: ${c(u.message)}
6
+ `,exitCode:1})),m.catch(u=>({success:!1,error:c(u.message)}))]);if(!x.success&&x.error){let u=c(x.error);return{stdout:g.stdout,stderr:`${g.stderr}python3: ${u}
7
+ `,exitCode:g.exitCode||1}}return g}var V={name:"python3",async execute(r,e){if(P(r))return T(U);let t=I(r);if("exitCode"in t)return t;if(t.showVersion)return{stdout:`Python 3.13.2 (Emscripten)
8
+ `,stderr:"",exitCode:0};let o,s;if(t.code!==null)o=t.code,s="-c";else if(t.module!==null){if(!/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(t.module))return{stdout:"",stderr:`python3: No module named '${t.module.slice(0,200)}'
9
+ `,exitCode:1};o=`import runpy; runpy.run_module('${t.module}', run_name='__main__')`,s=t.module}else if(t.scriptFile!==null){let p=e.fs.resolvePath(e.cwd,t.scriptFile);if(!await e.fs.exists(p))return{stdout:"",stderr:`python3: can't open file '${t.scriptFile}': [Errno 2] No such file or directory
10
+ `,exitCode:2};try{o=await e.fs.readFile(p),s=t.scriptFile}catch(f){let l=c(f.message);return{stdout:"",stderr:`python3: can't open file '${t.scriptFile}': ${l}
11
+ `,exitCode:2}}}else if(e.stdin.trim())o=e.stdin,s="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
12
+ `,exitCode:2};return B(o,e,s,t.scriptArgs)}},se={name:"python",async execute(r,e){return V.execute(r,e)}};export{oe as _resetExecutionQueue,V as python3Command,se as pythonCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a,b}from"./chunk-HJEHIH4P.js";import"./chunk-V7ZOPVQS.js";import"./chunk-4OALHZXB.js";import"./chunk-G43H2WGH.js";import"./chunk-SE4C7FJY.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as rgCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a,b}from"./chunk-FBJJY4ZV.js";import"./chunk-4OALHZXB.js";import"./chunk-LIYVQA3X.js";import"./chunk-4PRVMER6.js";import"./chunk-SYG3IW7P.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as timeCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-CZFRRDQC.js";import"./chunk-YTIURC67.js";import"./chunk-4OALHZXB.js";import"./chunk-OOJCYVYF.js";import"./chunk-YU6OGPZR.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as timeoutCommand};
2
+ import{a,b}from"./chunk-DOXYBGNA.js";import"./chunk-YTIURC67.js";import"./chunk-4OALHZXB.js";import"./chunk-OOJCYVYF.js";import"./chunk-YU6OGPZR.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as timeoutCommand};
@@ -647,7 +647,6 @@ var WorkerDefenseInDepth = class {
647
647
  * Create a blocking proxy for a function.
648
648
  * In worker context, always blocks (no context check needed).
649
649
  */
650
- // @banned-pattern-ignore: intentional use of Function type for security proxy
651
650
  createBlockingProxy(original, path, violationType) {
652
651
  const self = this;
653
652
  const auditMode = this.config.auditMode;
@@ -673,7 +672,7 @@ var WorkerDefenseInDepth = class {
673
672
  /**
674
673
  * Create a blocking proxy for an object (blocks all property access).
675
674
  */
676
- createBlockingObjectProxy(original, path, violationType) {
675
+ createBlockingObjectProxy(original, path, violationType, allowedKeys) {
677
676
  const self = this;
678
677
  const auditMode = this.config.auditMode;
679
678
  return new this.originalProxy(original, {
@@ -681,6 +680,9 @@ var WorkerDefenseInDepth = class {
681
680
  if (self.inTrap) {
682
681
  return Reflect.get(target, prop, receiver);
683
682
  }
683
+ if (allowedKeys && typeof prop === "string" && allowedKeys.has(prop)) {
684
+ return Reflect.get(target, prop, receiver);
685
+ }
684
686
  self.inTrap = true;
685
687
  try {
686
688
  const fullPath = `${path}.${String(prop)}`;
@@ -1477,7 +1479,8 @@ var WorkerDefenseInDepth = class {
1477
1479
  ) : this.createBlockingObjectProxy(
1478
1480
  original,
1479
1481
  path,
1480
- violationType
1482
+ violationType,
1483
+ blocked.allowedKeys
1481
1484
  );
1482
1485
  Object.defineProperty(target, prop, {
1483
1486
  value: proxy,
@@ -1527,8 +1530,9 @@ function wrapWasmCallback(component, phase, callback) {
1527
1530
  var _SharedArrayBuffer = globalThis.SharedArrayBuffer;
1528
1531
  var _Atomics = globalThis.Atomics;
1529
1532
  var _performanceNow = performance.now.bind(performance);
1533
+ var _Headers = globalThis.Headers;
1530
1534
 
1531
- // src/commands/python3/protocol.ts
1535
+ // src/commands/worker-bridge/protocol.ts
1532
1536
  var OpCode = {
1533
1537
  NOOP: 0,
1534
1538
  READ_FILE: 1,
@@ -1544,12 +1548,16 @@ var OpCode = {
1544
1548
  LSTAT: 11,
1545
1549
  CHMOD: 12,
1546
1550
  REALPATH: 13,
1547
- // Special operations for Python I/O
1551
+ RENAME: 14,
1552
+ COPY_FILE: 15,
1553
+ // Special operations for I/O
1548
1554
  WRITE_STDOUT: 100,
1549
1555
  WRITE_STDERR: 101,
1550
1556
  EXIT: 102,
1551
1557
  // HTTP operations
1552
- HTTP_REQUEST: 200
1558
+ HTTP_REQUEST: 200,
1559
+ // Sub-shell execution
1560
+ EXEC_COMMAND: 300
1553
1561
  };
1554
1562
  var Status = {
1555
1563
  PENDING: 0,
@@ -1586,8 +1594,10 @@ var Offset = {
1586
1594
  var Size = {
1587
1595
  CONTROL_REGION: 32,
1588
1596
  PATH_BUFFER: 4096,
1597
+ // 1MB limit applies to all FS read/write operations through the bridge.
1598
+ // Files larger than this will be truncated. This is tight — consider
1599
+ // increasing if real workloads hit the cap. Reduced from 16MB for faster tests.
1589
1600
  DATA_BUFFER: 1048576,
1590
- // 1MB (reduced from 16MB for faster tests)
1591
1601
  TOTAL: 1052704
1592
1602
  // 32 + 4096 + 1MB
1593
1603
  };
@@ -1828,11 +1838,13 @@ var ProtocolBuffer = class {
1828
1838
  }
1829
1839
  };
1830
1840
 
1831
- // src/commands/python3/sync-fs-backend.ts
1832
- var SyncFsBackend = class {
1841
+ // src/commands/worker-bridge/sync-backend.ts
1842
+ var SyncBackend = class {
1833
1843
  protocol;
1834
- constructor(sharedBuffer) {
1844
+ operationTimeoutMs;
1845
+ constructor(sharedBuffer, operationTimeoutMs = 3e4) {
1835
1846
  this.protocol = new ProtocolBuffer(sharedBuffer);
1847
+ this.operationTimeoutMs = operationTimeoutMs;
1836
1848
  }
1837
1849
  execSync(opCode, path, data, flags = 0, mode = 0) {
1838
1850
  this.protocol.reset();
@@ -1845,7 +1857,7 @@ var SyncFsBackend = class {
1845
1857
  }
1846
1858
  this.protocol.setStatus(Status.READY);
1847
1859
  this.protocol.notify();
1848
- const waitResult = this.protocol.waitForResult(5e3);
1860
+ const waitResult = this.protocol.waitForResult(this.operationTimeoutMs);
1849
1861
  if (waitResult === "timed-out") {
1850
1862
  return { success: false, error: "Operation timed out" };
1851
1863
  }
@@ -1948,6 +1960,20 @@ var SyncFsBackend = class {
1948
1960
  }
1949
1961
  return this.protocol.getResultAsString();
1950
1962
  }
1963
+ rename(oldPath, newPath) {
1964
+ const newPathData = new TextEncoder().encode(newPath);
1965
+ const result = this.execSync(OpCode.RENAME, oldPath, newPathData);
1966
+ if (!result.success) {
1967
+ throw new Error(result.error || "Failed to rename");
1968
+ }
1969
+ }
1970
+ copyFile(src, dest) {
1971
+ const destData = new TextEncoder().encode(dest);
1972
+ const result = this.execSync(OpCode.COPY_FILE, src, destData);
1973
+ if (!result.success) {
1974
+ throw new Error(result.error || "Failed to copyFile");
1975
+ }
1976
+ }
1951
1977
  writeStdout(data) {
1952
1978
  const encoded = new TextEncoder().encode(data);
1953
1979
  const result = this.execSync(OpCode.WRITE_STDOUT, "", encoded);
@@ -1978,6 +2004,32 @@ var SyncFsBackend = class {
1978
2004
  const responseJson = new TextDecoder().decode(result.result);
1979
2005
  return JSON.parse(responseJson);
1980
2006
  }
2007
+ /**
2008
+ * Execute a shell command through the main thread's exec function.
2009
+ * Returns the result as { stdout, stderr, exitCode }.
2010
+ */
2011
+ execCommand(command, stdin) {
2012
+ const requestData = stdin ? new TextEncoder().encode(JSON.stringify({ stdin })) : void 0;
2013
+ const result = this.execSync(OpCode.EXEC_COMMAND, command, requestData);
2014
+ if (!result.success) {
2015
+ throw new Error(result.error || "Command execution failed");
2016
+ }
2017
+ const responseJson = new TextDecoder().decode(result.result);
2018
+ return JSON.parse(responseJson);
2019
+ }
2020
+ /**
2021
+ * Execute a shell command with structured args (shell-escaped on the main thread).
2022
+ * Prevents command injection from unsanitized args.
2023
+ */
2024
+ execCommandArgs(command, args) {
2025
+ const requestData = new TextEncoder().encode(JSON.stringify({ args }));
2026
+ const result = this.execSync(OpCode.EXEC_COMMAND, command, requestData);
2027
+ if (!result.success) {
2028
+ throw new Error(result.error || "Command execution failed");
2029
+ }
2030
+ const responseJson = new TextDecoder().decode(result.result);
2031
+ return JSON.parse(responseJson);
2032
+ }
1981
2033
  };
1982
2034
 
1983
2035
  // src/commands/python3/worker.ts
@@ -2060,27 +2112,30 @@ var cpythonDir = dirname(cpythonEntryPath);
2060
2112
  var stdlibZipPath = `${cpythonDir}/python313.zip`;
2061
2113
  assertApprovedPath(stdlibZipPath, "cpython-stdlib");
2062
2114
  function createHOSTFS(backend, FS, PATH) {
2063
- const ERRNO_CODES = {
2064
- EPERM: 63,
2065
- ENOENT: 44,
2066
- EIO: 29,
2067
- EBADF: 8,
2068
- EAGAIN: 6,
2069
- EACCES: 2,
2070
- EBUSY: 10,
2071
- EEXIST: 20,
2072
- ENOTDIR: 54,
2073
- EISDIR: 31,
2074
- EINVAL: 28,
2075
- EMFILE: 33,
2076
- ENOSPC: 51,
2077
- ESPIPE: 70,
2078
- EROFS: 69,
2079
- ENOTEMPTY: 55,
2080
- ENOSYS: 52,
2081
- ENOTSUP: 138,
2082
- ENODATA: 42
2083
- };
2115
+ const ERRNO_CODES = Object.assign(
2116
+ /* @__PURE__ */ Object.create(null),
2117
+ {
2118
+ EPERM: 63,
2119
+ ENOENT: 44,
2120
+ EIO: 29,
2121
+ EBADF: 8,
2122
+ EAGAIN: 6,
2123
+ EACCES: 2,
2124
+ EBUSY: 10,
2125
+ EEXIST: 20,
2126
+ ENOTDIR: 54,
2127
+ EISDIR: 31,
2128
+ EINVAL: 28,
2129
+ EMFILE: 33,
2130
+ ENOSPC: 51,
2131
+ ESPIPE: 70,
2132
+ EROFS: 69,
2133
+ ENOTEMPTY: 55,
2134
+ ENOSYS: 52,
2135
+ ENOTSUP: 138,
2136
+ ENODATA: 42
2137
+ }
2138
+ );
2084
2139
  function realPath(node) {
2085
2140
  const parts = [];
2086
2141
  while (node.parent !== node) {
@@ -2864,7 +2919,7 @@ async function runPython(input) {
2864
2919
  error: "Defense-in-depth module-loader guard failed to initialize; refusing to execute Python worker"
2865
2920
  };
2866
2921
  }
2867
- const backend = new SyncFsBackend(input.sharedBuffer);
2922
+ const backend = new SyncBackend(input.sharedBuffer, input.timeoutMs);
2868
2923
  assertApprovedPath(cpythonEntryPath, "cpython-entry");
2869
2924
  const createPythonModule = require2(cpythonEntryPath);
2870
2925
  let moduleReady = false;
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-2V53PP6G.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import"./chunk-ZYQQ6B7B.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as xanCommand};
2
+ import{a,b}from"./chunk-B3RU2PUI.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import"./chunk-ZO5PSLKR.js";import"./chunk-V7ZOPVQS.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as xanCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a,b}from"./chunk-CQG2HEAL.js";import"./chunk-4OALHZXB.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as xargsCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-UG4GMDQL.js";import"./chunk-QSDVMMYI.js";import"./chunk-ZYQQ6B7B.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as yqCommand};
2
+ import{a,b}from"./chunk-LGF54XJQ.js";import"./chunk-QSDVMMYI.js";import"./chunk-ZO5PSLKR.js";import"./chunk-V7ZOPVQS.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as yqCommand};