@synthetic-ai/ae-mcp 2.8.0 → 2.8.3

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.
package/DISCLOSURE.md ADDED
@@ -0,0 +1,28 @@
1
+ # Disclosure: obfuscated code in this package
2
+
3
+ `dist/server.mjs`, `dist/bridge.mjs` and `dist/store.mjs` are shipped **obfuscated**
4
+ (via [javascript-obfuscator](https://github.com/javascript-obfuscator/javascript-obfuscator),
5
+ see `scripts/build.mjs`). This is intentional and not an attempt to hide malicious
6
+ behavior:
7
+
8
+ - **Why**: this package enforces a paid per-machine license (`AE_MCP_LICENSE`,
9
+ validated against `synthetic.com.ar`). The obfuscation protects that license
10
+ check and the commercial logic around it from casual bypass — it is not
11
+ applied to hide data collection, network exfiltration, or any behavior beyond
12
+ what's documented in `README.md`.
13
+ - **What it does over the network**: license validation (sends a machine id +
14
+ license key to `synthetic.com.ar`) and nothing else. It does not phone home
15
+ telemetry, does not read unrelated files, and does not execute arbitrary
16
+ remote code.
17
+ - **What stays unobfuscated on purpose**: `dist/psdBounds.mjs` is a thin
18
+ `ag-psd` wrapper with no license/business logic — it ships in plain JS so a
19
+ reviewer (human or automated) can read exactly what it does.
20
+ - **Source**: full, unobfuscated source for the obfuscated files lives in
21
+ `src/` in this same repository/tarball — nothing here is closed-source, only
22
+ minified/renamed for the published build.
23
+
24
+ If an automated scanner flagged this package: the obfuscation is limited to
25
+ `disableConsoleOutput: false` / `selfDefending: false` / `debugProtection: false`
26
+ (see `scripts/build.mjs` for the exact `OBFUSCATOR_OPTS`) — no anti-debugging,
27
+ no self-modifying code, no eval-based payload delivery. Happy to answer any
28
+ follow-up questions at hola@synthetic.com.ar.
package/dist/bridge.mjs CHANGED
@@ -1 +1 @@
1
- function _0x5329(){const _0x55f267=['DxrMltG','lIbsyxCGkgzPCNn0idmWmcbJAgfYCYK6ia','C3rYAw5NAwz5','mJa2oduZnxPvEw1hCq','B2jQzwn0','rMfPBgvKihrVihbHCNnLihbHBMvSihjLC3bVBNnLoIa','mJKYmdK0mxH4z2nmtG','C2XPy2u','kgz1BMn0Aw9UkcL7cIaGicb0CNKGEWOGicaGicbPzIaODhLWzw9MicqUz2XVyMfSlL9Fu1Lox0ffid09psaIDw5KzwzPBMvKiIb8Fcb0ExbLB2yGjc5NBg9IywWUx19twu5FquvB','ktSkicaGih0Gy2f0y2GGkguPihSkicaGicaGCMv0DxjUiePtt04UC3rYAw5NAwz5khSGC3vJy2vZCZOGzMfSC2uSigvYCM9YoIbtDhjPBMCOzsaMjIbLlM1LC3nHz2uGFhWGzsKGFsK7cIaGicb9cIaGFsKOktS','qNjPzgDLihrPBwvKig91DcbHzNrLCIa','C3rYAw5N','nJv2uezoAxq','BM93','zgf0yq','lMPZEa','DgLTzw91De1Z','ywuTBwnWlwjYAwrNzq','yM9VBgvHBG','BxmUievPDgHLCIb0AguGu3LUDgHLDgLJieffie1ducbWyw5LBcbPC24NDcbYDw5UAw5NicHxAw5KB3CGpIbfEhrLBNnPB25Zid4Gu3LUDgHLDgLJieffie1duca+ifn0yxj0iejYAwrNzsKSig9YihrOzsbfEhrLBMrty3jPChqGB3aGzxHJzwvKzwqGDgHLihbHBMvSj3mGCgvYlwnHBgWGDgLTzw91Dc4GrM9Yig9WCYbVBIbODw5KCMvKCYbVzIbJB21WCYWGywXZBYbYzs1PBNn0ywXSihrOzsbSyxrLC3qGC2LNBMvKic56EhaGzNjVBsbODhrWCZOVl3n5BNrOzxrPyY5JB20UyxiVzgfZAgjVyxjKl2rVD25SB2fKCYdIGjqGB2XKzxiGCgfUzwXZignHChbLzcbWzxiTy2fSBcbLEgvJDxrPB24GyxqGmJuGCYbYzwDHCMrSzxnZig9MihrOAxmGC2v0DgLUzY4','mJfkC0TnzMW','DgvTCerPCG','otm5mdm3nNPLEMLQwG','C3rHCNrZv2L0Aa','jYbUB3qGCMvNAxn0zxjLzcbVBIb0AguGquuGyNjPzgDLlIbjCYb0AguGCgfUzwWGC3rHCNrLzd8Iih0PoWOGicaGicb9cIaGicaGihjLDhvYBIaKlMDSB2jHBc5Fx1nztL9brvS','lMPZB24','mtq1ntCWmJnds0L6uu8','CMvZxW','nteZntmYyKflCKzc','mti4mZi4v2nqv0fl','Dg1WxW','xsaHpt0GiMz1BMn0Aw9UiIKGEWOGicaGicaGihjLDhvYBIbku09olNn0CMLUz2LMEsH7ihn1y2nLC3m6igzHBhnLlcbLCNjVCJOGiLrVB2WGjW','mtG3mZbetK1vuuO','qNjPzgDLihjLDhvYBMvKig5VBI1ku09ooIa','y21KxW'];_0x5329=function(){return _0x55f267;};return _0x5329();}(function(_0x52c7f3,_0x2d4ac5){const _0x1f00d5={_0xdc00a3:0x12f,_0x17c8db:0x130,_0xe0d4cb:0x1f5,_0x59befe:0x134,_0x359f31:0x1f2,_0x5f3eb7:0x1fb,_0x4db185:0x1e9,_0x15b3cc:0x1f8,_0x2b5b52:0x111,_0x4d3c6c:0x119,_0x1cf39f:0x205,_0x1efe87:0x119,_0x481cd0:0x113},_0x234639={_0x180806:0x1c4},_0x5941bf=_0x52c7f3();function _0x10ce30(_0x458452,_0x3e1dd4){return _0x3d96(_0x3e1dd4- -_0x234639._0x180806,_0x458452);}function _0xf46808(_0x59bf09,_0x53b286){return _0x3d96(_0x59bf09-0x158,_0x53b286);}while(!![]){try{const _0x1ad520=parseInt(_0xf46808(0x1fb,0x1f3))/0x1*(-parseInt(_0x10ce30(-_0x1f00d5._0xdc00a3,-_0x1f00d5._0x17c8db))/0x2)+-parseInt(_0xf46808(_0x1f00d5._0xe0d4cb,0x1f0))/0x3+-parseInt(_0x10ce30(-0x131,-_0x1f00d5._0x59befe))/0x4+-parseInt(_0xf46808(_0x1f00d5._0x359f31,_0x1f00d5._0x5f3eb7))/0x5+-parseInt(_0xf46808(_0x1f00d5._0x4db185,_0x1f00d5._0x15b3cc))/0x6*(parseInt(_0x10ce30(-_0x1f00d5._0x2b5b52,-_0x1f00d5._0x4d3c6c))/0x7)+parseInt(_0xf46808(_0x1f00d5._0x1cf39f,0x202))/0x8+parseInt(_0x10ce30(-_0x1f00d5._0x1efe87,-_0x1f00d5._0x481cd0))/0x9;if(_0x1ad520===_0x2d4ac5)break;else _0x5941bf['push'](_0x5941bf['shift']());}catch(_0x5b6e56){_0x5941bf['push'](_0x5941bf['shift']());}}}(_0x5329,0x931fa));import{mkdirSync,writeFileSync,readFileSync,unlinkSync,existsSync,readdirSync,renameSync}from'node:fs';import{join}from'node:path';function _0x3d96(_0x4b9d21,_0x58d616){_0x4b9d21=_0x4b9d21-0x8f;const _0x53292c=_0x5329();let _0x3d96ca=_0x53292c[_0x4b9d21];if(_0x3d96['BGCokE']===undefined){var _0x386368=function(_0x1fbe24){const _0x4a4dca='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2c23e3='',_0x5a26de='';for(let _0x5a0753=0x0,_0x29e1c2,_0x5f187d,_0x4d6a48=0x0;_0x5f187d=_0x1fbe24['charAt'](_0x4d6a48++);~_0x5f187d&&(_0x29e1c2=_0x5a0753%0x4?_0x29e1c2*0x40+_0x5f187d:_0x5f187d,_0x5a0753++%0x4)?_0x2c23e3+=String['fromCharCode'](0xff&_0x29e1c2>>(-0x2*_0x5a0753&0x6)):0x0){_0x5f187d=_0x4a4dca['indexOf'](_0x5f187d);}for(let _0x3c4ccf=0x0,_0x5c9a12=_0x2c23e3['length'];_0x3c4ccf<_0x5c9a12;_0x3c4ccf++){_0x5a26de+='%'+('00'+_0x2c23e3['charCodeAt'](_0x3c4ccf)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5a26de);};_0x3d96['YjafPI']=_0x386368,_0x3d96['HuHMlG']={},_0x3d96['BGCokE']=!![];}const _0x160d92=_0x53292c[0x0],_0x57200c=_0x4b9d21+_0x160d92,_0x38e382=_0x3d96['HuHMlG'][_0x57200c];return!_0x38e382?(_0x3d96ca=_0x3d96['YjafPI'](_0x3d96ca),_0x3d96['HuHMlG'][_0x57200c]=_0x3d96ca):_0x3d96ca=_0x38e382,_0x3d96ca;}import{tmpdir}from'node:os';const DEFAULT_TEMP_DIR=join(tmpdir(),_0x1586c0(0x2c6,0x2c2)),POLL_INTERVAL_MS=0x64,DEFAULT_TIMEOUT_MS=0x1d4c0,MAX_SCRIPT_SIZE=0x1f4*0x400;let _counter=0x0;function ensureDir(_0x2c23e3){if(!existsSync(_0x2c23e3))mkdirSync(_0x2c23e3,{'recursive':!![],'mode':0x1c0});}export function getTempDir(_0x5a26de){const _0x40f9d0={_0x4d480a:0x1eb};function _0x127890(_0x27f7e5,_0x2f5283){return _0x1586c0(_0x2f5283,_0x27f7e5- -0xdb);}return _0x5a26de&&_0x5a26de[_0x127890(_0x40f9d0._0x4d480a,0x1f3)]||process.env.AE_MCP_TEMP_DIR||DEFAULT_TEMP_DIR;}export async function sendCommand(_0x5a0753,_0x29e1c2){const _0x1e874f={_0x2d202f:0x19b,_0x500252:0x192,_0x4e3ac1:0x216,_0x1dfa5e:0x223,_0x271c7f:0x218,_0x31896c:0x220},_0x76a89c={_0x29311f:0x89},_0x4c0140={_0x2d6bc8:0x45c};if(Buffer['byteLength'](_0x5a0753,_0x9e14a5(-0x1ab,-0x1ae))>MAX_SCRIPT_SIZE)throw new Error('Script\x20exceeds\x20500KB\x20size\x20limit');const _0x5f187d=getTempDir(_0x29e1c2),_0x4d6a48=_0x29e1c2&&_0x29e1c2[_0x9e14a5(-_0x1e874f._0x2d202f,-_0x1e874f._0x500252)]||DEFAULT_TIMEOUT_MS;function _0x9e14a5(_0x13078b,_0x5ed0d5){return _0x1586c0(_0x5ed0d5,_0x13078b- -_0x4c0140._0x2d6bc8);}ensureDir(_0x5f187d);const _0x3c4ccf=Date[_0x9e14a5(-0x19e,-0x1a7)]()+'_'+ ++_counter,_0x5c9a12=join(_0x5f187d,_0x42e09c(_0x1e874f._0x4e3ac1,_0x1e874f._0x1dfa5e)+_0x3c4ccf+'.jsx'),_0x5b085e=_0x3c4ccf+'_t'+_0x4d6a48,_0x48f65b=join(_0x5f187d,_0x42e09c(0x238,0x227)+_0x5b085e+_0x42e09c(0x243,0x237));function _0x42e09c(_0x4043a9,_0x5446cd){return _0x1586c0(_0x4043a9,_0x5446cd- -_0x76a89c._0x29311f);}const _0x485327=join(_0x5f187d,_0x42e09c(_0x1e874f._0x271c7f,_0x1e874f._0x31896c)+_0x5b085e+_0x9e14a5(-0x192,-0x189));writeFileSync(_0x5c9a12,_0x5a0753,_0x42e09c(0x229,0x228)),renameSync(_0x5c9a12,_0x48f65b);const _0x376cdc=await poll(_0x485327,_0x4d6a48);return safeUnlink(_0x48f65b),safeUnlink(_0x485327),_0x376cdc;}function _0x1586c0(_0x22a936,_0x53d836){const _0x5cfe01={_0x1f82f3:0x21a};return _0x3d96(_0x53d836-_0x5cfe01._0x1f82f3,_0x22a936);}export async function callPanelTool(_0x4ea378,_0x41c938,_0x179486){const _0x2f6586={_0x317259:0x44f,_0x3c51ec:0x364,_0x4e7673:0x358,_0x480879:0x357,_0x3eb551:0x352,_0x321664:0x34e,_0x1f0692:0x340,_0x2a10f1:0x34e,_0x7dd8cf:0x34f,_0x174384:0x357},_0x491132={_0x14e9a9:0x19c},_0x358142={_0x3cc284:0x9f},_0x1c31be=JSON[_0x198d8c(_0x2f6586._0x317259,0x43f)](_0x41c938||{}),_0x1d2472=_0x509862(_0x2f6586._0x3c51ec,_0x2f6586._0x4e7673)+JSON['stringify'](_0x4ea378)+_0x198d8c(0x449,0x457)+_0x4ea378+_0x509862(_0x2f6586._0x480879,0x368)+JSON[_0x509862(0x35d,_0x2f6586._0x3eb551)](_0x4ea378)+']('+_0x1c31be+_0x198d8c(0x456,0x44a);function _0x509862(_0x4836d8,_0x1e02a1){return _0x1586c0(_0x4836d8,_0x1e02a1-_0x358142._0x3cc284);}const _0xb6d0ff=await sendCommand(_0x1d2472,_0x179486);function _0x198d8c(_0x398aba,_0x2ebb90){return _0x1586c0(_0x2ebb90,_0x398aba-_0x491132._0x14e9a9);}if(!_0xb6d0ff['success'])return _0xb6d0ff;try{if(typeof _0xb6d0ff[_0x198d8c(0x45b,0x469)]===_0x198d8c(0x458,0x457))return JSON['parse'](_0xb6d0ff[_0x509862(_0x2f6586._0x321664,0x35e)]);return _0xb6d0ff;}catch(_0x4ceb9c){return{'success':![],'error':_0x509862(_0x2f6586._0x1f0692,_0x2f6586._0x2a10f1)+String(_0xb6d0ff[_0x509862(_0x2f6586._0x7dd8cf,0x35e)])[_0x509862(0x367,_0x2f6586._0x174384)](0x0,0xc8)};}}function normalizeBridgeResponse(_0x4c4b1b){const _0x4badf4={_0x4a9dcc:0x1dc,_0x580722:0x1e6,_0x4f7312:0x1df,_0x57882b:0x82,_0x5e38a0:0x75},_0xcd92b9={_0x120be7:0xe4};if(_0x4c4b1b!==null&&typeof _0x4c4b1b===_0x393823(_0x4badf4._0x4a9dcc,0x1d1)&&typeof _0x4c4b1b['success']===_0x393823(_0x4badf4._0x580722,_0x4badf4._0x4f7312))return _0x4c4b1b;function _0xb4c058(_0x346d66,_0x208d9b){return _0x1586c0(_0x208d9b,_0x346d66- -0x231);}function _0x393823(_0x1650ff,_0x52f077){return _0x1586c0(_0x1650ff,_0x52f077- -_0xcd92b9._0x120be7);}return{'success':!![],'data':JSON[_0xb4c058(_0x4badf4._0x57882b,_0x4badf4._0x5e38a0)](_0x4c4b1b)};}function poll(_0xfd9b6,_0x13a060){const _0x18700e={_0x502dcb:0x1a3,_0x3f890b:0x1a7,_0x239305:0x1a1,_0x252c0f:0x1a4,_0x53a7d8:0x1fd,_0x3e1c5c:0x214};function _0x10b796(_0xbe88b0,_0x8c066a){return _0x1586c0(_0x8c066a,_0xbe88b0- -0x32c);}const _0x2b3cf5=Date[_0x10b796(-0x6e,-0x6e)]();return new Promise(_0x24c9c5=>{const _0x3fb2ab={_0x55d19f:0x23f},_0x5aeb49=()=>{if(existsSync(_0xfd9b6)){let _0x97c75f='';try{_0x97c75f=readFileSync(_0xfd9b6,_0x4857ac(-0x1a8,-0x197));const _0x212f04=JSON['parse'](_0x97c75f);_0x24c9c5(normalizeBridgeResponse(_0x212f04));}catch(_0x5c69b5){_0x24c9c5({'success':![],'error':_0x4857ac(-_0x18700e._0x502dcb,-0x195)+_0x5c69b5['message']+_0x4857ac(-_0x18700e._0x3f890b,-_0x18700e._0x239305)+String(_0x97c75f)[_0x4857ac(-_0x18700e._0x239305,-0x194)](0x0,0x12c)});}return;}function _0x4857ac(_0x13ae39,_0xfc6d13){return _0x3d96(_0x13ae39- -_0x3fb2ab._0x55d19f,_0xfc6d13);}if(Date[_0x4857ac(-0x19b,-_0x18700e._0x252c0f)]()-_0x2b3cf5>_0x13a060){_0x24c9c5({'success':![],'error':_0x205147(_0x18700e._0x53a7d8,0x207)+_0x13a060+_0x205147(_0x18700e._0x3e1c5c,0x210)});return;}function _0x205147(_0x504e6d,_0x2e743b){return _0x3d96(_0x2e743b-0x166,_0x504e6d);}setTimeout(_0x5aeb49,POLL_INTERVAL_MS);};_0x5aeb49();});}function safeUnlink(_0x2d5d02){try{if(existsSync(_0x2d5d02))unlinkSync(_0x2d5d02);}catch(_0x9ab717){}}export function cleanupTempDir(_0x2780e1){const _0x589f73={_0x44d92b:0x425,_0x38c36c:0xb2,_0x1599c5:0x421},_0x52815e={_0x4dbd78:0x175};function _0x35ad14(_0x5b46d3,_0x312b5e){return _0x1586c0(_0x312b5e,_0x5b46d3- -0x216);}function _0x4911dc(_0x15a07a,_0x524479){return _0x1586c0(_0x15a07a,_0x524479-_0x52815e._0x4dbd78);}const _0xeb43bb=getTempDir(_0x2780e1);if(!existsSync(_0xeb43bb))return;try{for(const _0xc18fbc of readdirSync(_0xeb43bb)){(_0xc18fbc['startsWith'](_0x4911dc(0x422,_0x589f73._0x44d92b))||_0xc18fbc[_0x35ad14(0xb2,0xb4)]('res_')||_0xc18fbc[_0x35ad14(_0x589f73._0x38c36c,0xb1)](_0x4911dc(_0x589f73._0x1599c5,0x421)))&&safeUnlink(join(_0xeb43bb,_0xc18fbc));}}catch(_0x4b90d2){}}
1
+ (function(_0x3003d7,_0x4f4aef){const _0x3687b7={_0x48d680:0xe8,_0x16ff24:0xd4,_0x576d6f:0x104,_0x7c7f0c:0xf8},_0x26e81d={_0x1e5884:0x208},_0x2a1241={_0x1ed865:0x2d9};function _0x59213d(_0x182068,_0x410d5f){return _0x173d(_0x182068-_0x2a1241._0x1ed865,_0x410d5f);}function _0x15ae6f(_0x500c26,_0x39f938){return _0x173d(_0x500c26- -_0x26e81d._0x1e5884,_0x39f938);}const _0x2d12b0=_0x3003d7();while(!![]){try{const _0x549c0b=parseInt(_0x15ae6f(-0xf5,-0xfa))/0x1+-parseInt(_0x15ae6f(-0xfe,-0x10d))/0x2*(parseInt(_0x15ae6f(-_0x3687b7._0x48d680,-_0x3687b7._0x16ff24))/0x3)+parseInt(_0x15ae6f(-0xf9,-_0x3687b7._0x576d6f))/0x4+-parseInt(_0x15ae6f(-_0x3687b7._0x7c7f0c,-0xff))/0x5*(-parseInt(_0x59213d(0x3e0,0x3df))/0x6)+-parseInt(_0x15ae6f(-0xef,-0xdd))/0x7+parseInt(_0x59213d(0x3ef,0x3f2))/0x8*(-parseInt(_0x59213d(0x3db,0x3df))/0x9)+parseInt(_0x15ae6f(-0xe9,-0xdd))/0xa*(-parseInt(_0x15ae6f(-0x103,-0x102))/0xb);if(_0x549c0b===_0x4f4aef)break;else _0x2d12b0['push'](_0x2d12b0['shift']());}catch(_0x1fb0e7){_0x2d12b0['push'](_0x2d12b0['shift']());}}}(_0x22bb,0x2d878));function _0x2ad5c1(_0x4a6e1d,_0x2ac749){const _0x57e9fa={_0xe1905b:0x79};return _0x173d(_0x4a6e1d-_0x57e9fa._0xe1905b,_0x2ac749);}import{mkdirSync,writeFileSync,readFileSync,unlinkSync,existsSync,readdirSync,renameSync}from'node:fs';import{join}from'node:path';import{tmpdir}from'node:os';const DEFAULT_TEMP_DIR=join(tmpdir(),_0x2ad5c1(0x17a,0x17c)),POLL_INTERVAL_MS=0x64,DEFAULT_TIMEOUT_MS=0x1d4c0,MAX_SCRIPT_SIZE=0x1f4*0x400;let _counter=0x0;function ensureDir(_0x28b8a5){if(!existsSync(_0x28b8a5))mkdirSync(_0x28b8a5,{'recursive':!![],'mode':0x1c0});}export function getTempDir(_0x1ffdda){const _0x17294c={_0x413561:0x5f,_0x4f1839:0x52},_0x16c805={_0x3296ed:0x1df};function _0x2c1618(_0x31c48f,_0x3753d2){return _0x2ad5c1(_0x3753d2- -_0x16c805._0x3296ed,_0x31c48f);}return _0x1ffdda&&_0x1ffdda[_0x2c1618(-_0x17294c._0x413561,-_0x17294c._0x4f1839)]||process.env.AE_MCP_TEMP_DIR||DEFAULT_TEMP_DIR;}export async function sendCommand(_0x365bb2,_0x14943e){const _0x311b00={_0x44073b:0x234,_0x87d5ca:0x210,_0x5c23b6:0x208,_0x2dc6a8:0x225,_0x59cb28:0x30b,_0x37c4f3:0x22a,_0x2f2a6c:0x222},_0x53130f={_0x2e9300:0x185};if(Buffer[_0x74e141(0x22e,_0x311b00._0x44073b)](_0x365bb2,_0x74e141(_0x311b00._0x87d5ca,_0x311b00._0x5c23b6))>MAX_SCRIPT_SIZE)throw new Error(_0x149d80(0x31b,0x31a));const _0x15628a=getTempDir(_0x14943e),_0x518164=_0x14943e&&_0x14943e['timeoutMs']||DEFAULT_TIMEOUT_MS;function _0x74e141(_0x1573a0,_0x4d5472){return _0x2ad5c1(_0x1573a0-0x93,_0x4d5472);}ensureDir(_0x15628a);const _0x10f88b=Date['now']()+'_'+ ++_counter,_0x46317e=join(_0x15628a,_0x74e141(0x223,_0x311b00._0x2dc6a8)+_0x10f88b+_0x149d80(0x30b,0x300)),_0x404099=_0x10f88b+'_t'+_0x518164,_0x3e55b5=join(_0x15628a,_0x149d80(0x309,_0x311b00._0x59cb28)+_0x404099+_0x74e141(0x219,0x216)),_0x53a617=join(_0x15628a,'res_'+_0x404099+_0x74e141(_0x311b00._0x37c4f3,_0x311b00._0x2f2a6c));writeFileSync(_0x46317e,_0x365bb2,'utf-8');function _0x149d80(_0x2ecc9f,_0x5a5589){return _0x2ad5c1(_0x2ecc9f-_0x53130f._0x2e9300,_0x5a5589);}renameSync(_0x46317e,_0x3e55b5);const _0xfaf607=await poll(_0x53a617,_0x518164);return safeUnlink(_0x3e55b5),safeUnlink(_0x53a617),_0xfaf607;}function _0x173d(_0x2510f3,_0x28e104){_0x2510f3=_0x2510f3-0x101;const _0x22bbc1=_0x22bb();let _0x173d88=_0x22bbc1[_0x2510f3];if(_0x173d['oBJuiE']===undefined){var _0x49060d=function(_0xc9022c){const _0x1e0836='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x28b8a5='',_0x1ffdda='';for(let _0x365bb2=0x0,_0x14943e,_0x15628a,_0x518164=0x0;_0x15628a=_0xc9022c['charAt'](_0x518164++);~_0x15628a&&(_0x14943e=_0x365bb2%0x4?_0x14943e*0x40+_0x15628a:_0x15628a,_0x365bb2++%0x4)?_0x28b8a5+=String['fromCharCode'](0xff&_0x14943e>>(-0x2*_0x365bb2&0x6)):0x0){_0x15628a=_0x1e0836['indexOf'](_0x15628a);}for(let _0x10f88b=0x0,_0x46317e=_0x28b8a5['length'];_0x10f88b<_0x46317e;_0x10f88b++){_0x1ffdda+='%'+('00'+_0x28b8a5['charCodeAt'](_0x10f88b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1ffdda);};_0x173d['fACzfn']=_0x49060d,_0x173d['lcPlGF']={},_0x173d['oBJuiE']=!![];}const _0x2f750d=_0x22bbc1[0x0],_0x5a0615=_0x2510f3+_0x2f750d,_0x40207f=_0x173d['lcPlGF'][_0x5a0615];return!_0x40207f?(_0x173d88=_0x173d['fACzfn'](_0x173d88),_0x173d['lcPlGF'][_0x5a0615]=_0x173d88):_0x173d88=_0x40207f,_0x173d88;}export async function callPanelTool(_0x32def9,_0x446169,_0x1231a6){const _0x4dc0a5={_0x113f04:0x289,_0x57897d:0x283,_0x18f426:0x28e,_0x1244d1:0x1fe,_0x48ddd8:0x1fd,_0x26d06b:0x20e,_0x546ef5:0x205,_0x3ede83:0x200,_0xc2748c:0x263},_0x1073c7={_0x4a5c8e:0x40a},_0x58f195=JSON['stringify'](_0x446169||{});function _0xa71a8(_0xac8e49,_0xe0e7a5){return _0x2ad5c1(_0xe0e7a5-0x72,_0xac8e49);}function _0x5ccd9c(_0x733d92,_0x1b2699){return _0x2ad5c1(_0x733d92- -_0x1073c7._0x4a5c8e,_0x1b2699);}const _0x1b599f=_0x5ccd9c(-_0x4dc0a5._0x113f04,-0x293)+JSON[_0x5ccd9c(-0x27c,-_0x4dc0a5._0x57897d)](_0x32def9)+_0x5ccd9c(-_0x4dc0a5._0x18f426,-0x29c)+_0x32def9+_0xa71a8(_0x4dc0a5._0x1244d1,0x206)+JSON['stringify'](_0x32def9)+']('+_0x58f195+_0xa71a8(0x21e,0x20f),_0x2cb457=await sendCommand(_0x1b599f,_0x1231a6);if(!_0x2cb457[_0xa71a8(0x20f,_0x4dc0a5._0x48ddd8)])return _0x2cb457;try{if(typeof _0x2cb457['data']===_0xa71a8(0x202,_0x4dc0a5._0x26d06b))return JSON[_0xa71a8(0x20c,_0x4dc0a5._0x546ef5)](_0x2cb457['data']);return _0x2cb457;}catch(_0x5aa28e){return{'success':![],'error':_0x5ccd9c(-0x26a,-0x26c)+String(_0x2cb457[_0xa71a8(_0x4dc0a5._0x3ede83,0x1f7)])[_0x5ccd9c(-0x26b,-_0x4dc0a5._0xc2748c)](0x0,0xc8)};}}function _0x22bb(){const _0x56d9d1=['C2XPy2u','qNjPzgDLihjLDhvYBMvKig5VBI1ku09ooIa','ywuTBwnWlwjYAwrNzq','mtHRr0vrDfa','xsaHpt0GiMz1BMn0Aw9UiIKGEWOGicaGicaGihjLDhvYBIbku09olNn0CMLUz2LMEsH7ihn1y2nLC3m6igzHBhnLlcbLCNjVCJOGiLrVB2WGjW','DxrMltG','oduWm0HZs1nuyq','qNjPzgDLihrPBwvKig91DcbHzNrLCIa','mtu1ntaYq0vVuefA','kgz1BMn0Aw9UkcL7cIaGicb0CNKGEWOGicaGicbPzIaODhLWzw9MicqUz2XVyMfSlL9Fu1Lox0ffid09psaIDw5KzwzPBMvKiIb8Fcb0ExbLB2yGjc5NBg9IywWUx19twu5FquvB','yM9VBgvHBG','odCWodHTAKvpDfu','y21KxW','zgf0yq','lMPZEa','rMfPBgvKihrVihbHCNnLihbHBMvSihjLC3bVBNnLoIa','mte1oti3mNHOv2v5Ca','ntvkBujIyMS','B2jQzwn0','C3vJy2vZCW','mZq5nZq5EevntND3','DgvTCerPCG','C3rYAw5NAwz5','mJa2ntuYD1v0yNrx','Dg1WxW','BwvZC2fNzq','mtCYnJKWn0DrAuXfAG','CgfYC2u','jYbUB3qGCMvNAxn0zxjLzcbVBIb0AguGquuGyNjPzgDLlIbjCYb0AguGCgfUzwWGC3rHCNrLzd8Iih0PoWOGicaGicb9cIaGicaGihjLDhvYBIaKlMDSB2jHBc5Fx1nztL9brvS','BxmUievPDgHLCIb0AguGu3LUDgHLDgLJieffie1ducbWyw5LBcbPC24NDcbYDw5UAw5NicHxAw5KB3CGpIbfEhrLBNnPB25Zid4Gu3LUDgHLDgLJieffie1duca+ifn0yxj0iejYAwrNzsKSig9YihrOzsbfEhrLBMrty3jPChqGB3aGzxHJzwvKzwqGDgHLihbHBMvSj3mGCgvYlwnHBgWGDgLTzw91Dc4GrM9Yig9WCYbVBIbODw5KCMvKCYbVzIbJB21WCYWGywXZBYbYzs1PBNn0ywXSihrOzsbSyxrLC3qGC2LNBMvKic56EhaGzNjVBsbODhrWCZOVl3n5BNrOzxrPyY5JB20UyxiVzgfZAgjVyxjKl2rVD25SB2fKCYdIGjqGB2XKzxiGCgfUzwXZignHChbLzcbWzxiTy2fSBcbLEgvJDxrPB24GyxqGmJuGCYbYzwDHCMrSzxnZig9MihrOAxmGC2v0DgLUzY4','u2nYAxb0igv4y2vLzhmGntaWs0iGC2L6zsbSAw1PDa','lMPZB24','mJmXmgH0zenADq','mtHSsLvksKC','C3rHCNrZv2L0Aa','yNL0zuXLBMD0Aa','C3rYAw5N','ktSkicaGih0Gy2f0y2GGkguPihSkicaGicaGCMv0DxjUiePtt04UC3rYAw5NAwz5khSGC3vJy2vZCZOGzMfSC2uSigvYCM9YoIbtDhjPBMCOzsaMjIbLlM1LC3nHz2uGFhWGzsKGFsK7cIaGicb9cIaGFsKOktS','BM93'];_0x22bb=function(){return _0x56d9d1;};return _0x22bb();}function normalizeBridgeResponse(_0x676384){const _0xb6669d={_0x16a049:0x2af,_0x20606f:0x2b0},_0x5bb845={_0x44cdd4:0x12};if(_0x676384!==null&&typeof _0x676384===_0x3c745f(_0xb6669d._0x16a049,0x2a1)&&typeof _0x676384[_0x3c745f(_0xb6669d._0x20606f,0x2b5)]===_0x3b358f(0x194,0x180))return _0x676384;function _0x3b358f(_0x2c2c04,_0x179889){return _0x2ad5c1(_0x2c2c04-_0x5bb845._0x44cdd4,_0x179889);}function _0x3c745f(_0x514e5a,_0x32c524){return _0x2ad5c1(_0x514e5a-0x125,_0x32c524);}return{'success':!![],'data':JSON[_0x3b358f(0x1a0,0x1a1)](_0x676384)};}function poll(_0x490e07,_0x1c6e30){const _0x5eac33={_0x1a6910:0x3e6},_0x37c049={_0x59adf2:0x12d,_0x4ae019:0x440,_0x51fb38:0x442,_0x4b0779:0x448},_0x42fa20={_0x538822:0x248};function _0xaa75e4(_0x14d8cf,_0x7280f5){return _0x2ad5c1(_0x14d8cf-_0x42fa20._0x538822,_0x7280f5);}const _0x2aa6d6=Date[_0xaa75e4(_0x5eac33._0x1a6910,0x3e1)]();return new Promise(_0x25396f=>{const _0x4254b7={_0x4e819f:0x23b},_0x2a6e88=()=>{const _0x3a2bb7={_0x5cd338:0x328};function _0x30e312(_0x54b80d,_0x4552dd){return _0x173d(_0x54b80d-_0x3a2bb7._0x5cd338,_0x4552dd);}if(existsSync(_0x490e07)){let _0x17832c='';try{_0x17832c=readFileSync(_0x490e07,_0x34700b(-0x123,-0x137));const _0x4485b2=JSON['parse'](_0x17832c);_0x25396f(normalizeBridgeResponse(_0x4485b2));}catch(_0x3b3bc8){_0x25396f({'success':![],'error':_0x34700b(-0x139,-_0x37c049._0x59adf2)+_0x3b3bc8[_0x30e312(_0x37c049._0x4ae019,0x435)]+'.\x20Raw\x20(first\x20300\x20chars):\x20'+String(_0x17832c)[_0x30e312(0x44e,_0x37c049._0x51fb38)](0x0,0x12c)});}return;}if(Date[_0x30e312(0x44d,_0x37c049._0x4b0779)]()-_0x2aa6d6>_0x1c6e30){_0x25396f({'success':![],'error':_0x34700b(-0x121,-0x135)+_0x1c6e30+_0x30e312(0x444,0x43a)});return;}function _0x34700b(_0x58fb2a,_0x45469c){return _0x173d(_0x45469c- -_0x4254b7._0x4e819f,_0x58fb2a);}setTimeout(_0x2a6e88,POLL_INTERVAL_MS);};_0x2a6e88();});}function safeUnlink(_0x2b2371){try{if(existsSync(_0x2b2371))unlinkSync(_0x2b2371);}catch(_0x486cc3){}}export function cleanupTempDir(_0x29e336){const _0x5cdb56={_0x5c1262:0x157,_0x45619b:0x174},_0x195f04={_0x5339bb:0x302};function _0x49b651(_0xe5ff2d,_0x38d20a){return _0x2ad5c1(_0xe5ff2d- -_0x195f04._0x5339bb,_0x38d20a);}const _0x2e00d7=getTempDir(_0x29e336);function _0x1c8788(_0x5e8406,_0x3f44b4){return _0x2ad5c1(_0x3f44b4- -0x2f3,_0x5e8406);}if(!existsSync(_0x2e00d7))return;try{for(const _0x1a4a3a of readdirSync(_0x2e00d7)){(_0x1a4a3a['startsWith'](_0x1c8788(-0x167,-0x16f))||_0x1a4a3a[_0x1c8788(-0x147,-0x159)]('res_')||_0x1a4a3a[_0x1c8788(-_0x5cdb56._0x5c1262,-0x159)](_0x1c8788(-_0x5cdb56._0x45619b,-0x163)))&&safeUnlink(join(_0x2e00d7,_0x1a4a3a));}}catch(_0x1a21f3){}}
@@ -0,0 +1,78 @@
1
+ // Real per-artboard/per-group bounds for a PSD, read directly from the file
2
+ // (never via After Effects). AE's own ImportOptions API only exposes a
3
+ // synthesized precomp per top-level layer group, always sized to the full
4
+ // document canvas — it does not preserve the group's original position/size
5
+ // within the document, so a multi-artboard PSD can't be split correctly using
6
+ // AE data alone. ag-psd reads the PSD's own layer records directly, including
7
+ // the "artb" artboard resource Photoshop writes for each artboard, which is
8
+ // the ground truth Photoshop itself uses when exporting that artboard.
9
+ import { createRequire } from "node:module";
10
+ import { readFileSync } from "node:fs";
11
+
12
+ const _require = createRequire(import.meta.url);
13
+
14
+ function isGroup(layer) {
15
+ return Array.isArray(layer.children);
16
+ }
17
+
18
+ function boundsOf(layer) {
19
+ if (layer.left == null) return null;
20
+ return { x: layer.left, y: layer.top, width: layer.right - layer.left, height: layer.bottom - layer.top };
21
+ }
22
+
23
+ // Bounding box of a group's own content, computed from its leaf descendants.
24
+ // Used as a fallback for groups that aren't real Photoshop artboards.
25
+ function contentBoundsOf(group) {
26
+ let x1 = Infinity, y1 = Infinity, x2 = -Infinity, y2 = -Infinity;
27
+ (function walk(node) {
28
+ if (!node.children) return;
29
+ for (const child of node.children) {
30
+ if (child.children) { walk(child); continue; }
31
+ const b = boundsOf(child);
32
+ if (!b || (b.width === 0 && b.height === 0)) continue;
33
+ x1 = Math.min(x1, b.x);
34
+ y1 = Math.min(y1, b.y);
35
+ x2 = Math.max(x2, b.x + b.width);
36
+ y2 = Math.max(y2, b.y + b.height);
37
+ }
38
+ })(group);
39
+ if (!isFinite(x1)) return null;
40
+ return { x: Math.round(x1), y: Math.round(y1), width: Math.round(x2 - x1), height: Math.round(y2 - y1) };
41
+ }
42
+
43
+ /**
44
+ * Returns the real, document-space bounds of every top-level layer group in
45
+ * a PSD: { name, x, y, width, height, isArtboard }[]. Prefers each group's
46
+ * own Photoshop artboard rect when present; otherwise falls back to the
47
+ * bounding box of its actual content (still document-space, unlike anything
48
+ * AE's importer exposes).
49
+ */
50
+ export function getPsdTopLevelGroupBounds(filePath) {
51
+ const { readPsd } = _require("ag-psd");
52
+ const buffer = readFileSync(filePath);
53
+ const psd = readPsd(buffer, {
54
+ skipCompositeImageData: true,
55
+ skipThumbnail: true,
56
+ skipLayerImageData: true,
57
+ });
58
+ const out = [];
59
+ for (const layer of psd.children || []) {
60
+ if (!isGroup(layer)) continue;
61
+ const name = (layer.name || "").trim();
62
+ const ab = layer.artboard && layer.artboard.rect;
63
+ if (ab && ab.right > ab.left && ab.bottom > ab.top) {
64
+ out.push({
65
+ name,
66
+ x: Math.round(ab.left),
67
+ y: Math.round(ab.top),
68
+ width: Math.round(ab.right - ab.left),
69
+ height: Math.round(ab.bottom - ab.top),
70
+ isArtboard: true,
71
+ });
72
+ continue;
73
+ }
74
+ const bounds = contentBoundsOf(layer);
75
+ if (bounds) out.push({ name, ...bounds, isArtboard: false });
76
+ }
77
+ return out;
78
+ }