@kmlckj/licos-bridge 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -46,10 +46,15 @@ licos-bridge service uninstall
46
46
 
47
47
  - `LICOS_BRIDGE_HOME`
48
48
  - `LICOS_BRIDGE_AGENTS_HOME`
49
+ - `LICOS_BRIDGE_HANDSHAKE_URL`
50
+ - `LICOS_PLATFORM_BASE_URL`
51
+ - `AIOS_PLATFORM_BASE_URL`
49
52
 
50
53
  ## 云端协议入口
51
54
 
52
- `--handshake-url` 可以是平台 base URL,也可以直接是 handshake endpoint
55
+ `--handshake-url` 可以是平台 base URL,也可以直接是 handshake endpoint。平台生成的连接命令会显式携带这个参数;如果手写命令,可以通过 `LICOS_BRIDGE_HANDSHAKE_URL`、`LICOS_PLATFORM_BASE_URL` 或 `AIOS_PLATFORM_BASE_URL` 提供。
56
+
57
+ 桥接工具不再内置固定平台地址。没有命令参数、没有本地已保存地址、也没有环境变量时会直接报错,避免 dev/prod 环境串连。历史版本保存的 `https://www.licos.com` 默认地址在自动重连时会被拒绝,需要从目标平台重新复制连接命令。
53
58
 
54
59
  默认 handshake path:
55
60
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const Y=h;(function(G,H){const W=h,I=G();while(!![]){try{const J=parseInt(W(0x1ec))/0x1+parseInt(W(0x1f1))/0x2*(parseInt(W(0x1f3))/0x3)+-parseInt(W(0x1e2))/0x4+parseInt(W(0x1e7))/0x5*(-parseInt(W(0x1de))/0x6)+-parseInt(W(0x1ef))/0x7+-parseInt(W(0x1df))/0x8*(-parseInt(W(0x1eb))/0x9)+-parseInt(W(0x1dc))/0xa*(-parseInt(W(0x1e6))/0xb);if(J===H)break;else I['push'](I['shift']());}catch(K){I['push'](I['shift']());}}}(b,0x3e375));function b(){const a0=['6HaGVEB','deprecated','error','mode','catch','stop','message','/refresh','reload','61670SFCXjH','help','1535538jgjylt','8PPiQCG','refresh','log','1493012YScvQq','/send','send','/pair','847PlHWnP','5MzTrQQ','slice','purge','stringify','906894kGTREC','194271esOfTN','version','status','1260847XRczkJ','connect','294238npZjEm','/reload'];b=function(){return a0;};return b();}function h(a,c){a=a-0x1d5;const d=b();let e=d[a];return e;}import{pathToFileURL as j}from'node:url';import{parseArgs as k,printHelp as q}from'./lib/cli.js';import{ensureDaemon as u,ipcRequest as v,readDaemonInfo as w,startDaemon as x}from'./lib/ipc.js';import{buildSendPayload as y,packageVersion as z,printLogs as A,purgeBridge as B,runUpdate as C,statusSnapshot as D}from'./lib/local-commands.js';import{installService as E,uninstallService as F}from'./lib/service.js';import.meta.url===j(process['argv'][0x1])['href']&&async function(G){const X=h,H=k(G);if(H[X(0x1f4)]&&console[X(0x1d5)]('Deprecated:\x20'+H['deprecated']),X(0x1dd)!==H['mode']){if(X(0x1ed)!==H['mode']){if('daemon'===H['mode']){const {startDaemonServer:I}=await import('./lib/daemon.js');return void await I();}if(X(0x1ee)===H['mode']){const J=await D();return void console['log'](JSON[X(0x1ea)](J,null,0x2));}if(X(0x1d8)===H[X(0x1d6)]){const K=await w();return K?(await v('/stop',{},K),void console[X(0x1e1)]('licos-bridge\x20daemon\x20stopped.')):void console['log']('licos-bridge\x20daemon\x20is\x20not\x20running.');}if(X(0x1e0)===H[X(0x1d6)]){const L=await u(),M=await v(X(0x1da),{},L);return void console['log'](JSON['stringify'](M,null,0x2));}if(X(0x1db)===H['mode']){const N=await u(),O=await v(X(0x1f2),{'agentId':H['agentId']},N);return void console[X(0x1e1)](JSON['stringify'](O,null,0x2));}if(X(0x1e1)!==H['mode']){if('update'!==H[X(0x1d6)]){if(X(0x1e9)===H[X(0x1d6)])return await B(),void console['log']('licos-bridge\x20bridge\x20data\x20purged.');if('service-install'!==H['mode']){if('service-uninstall'!==H['mode']){if('pair'===H[X(0x1d6)]){const P=await u(),Q=await v(X(0x1e5),H,P);return void console['log'](JSON[X(0x1ea)](Q,null,0x2));}if(X(0x1f0)===H['mode']){const R=await u(),S=await v('/connect',H,R);return void console['log'](JSON['stringify'](S,null,0x2));}if(X(0x1e4)===H['mode']){const T=await u(),U=await y(H),V=await v(X(0x1e3),U,T);return void console[X(0x1e1)](JSON[X(0x1ea)](V,null,0x2));}if('spawn-daemon'!==H[X(0x1d6)])throw new Error('unsupported\x20command\x20mode:\x20'+H['mode']);await x();}else await F();}else await E();}else await C();}else await A(H);}else console[X(0x1e1)](await z());}else q();}(process['argv'][Y(0x1e8)](0x2))[Y(0x1d7)](G=>{const Z=Y;console[Z(0x1d5)](G instanceof Error?G[Z(0x1d9)]:String(G)),process['exitCode']=0x1;});
2
+ (function(G,H){const W=h,I=G();while(!![]){try{const J=parseInt(W(0xfd))/0x1*(-parseInt(W(0xf1))/0x2)+parseInt(W(0xf7))/0x3*(-parseInt(W(0x100))/0x4)+-parseInt(W(0xf3))/0x5+parseInt(W(0xed))/0x6+-parseInt(W(0xf0))/0x7*(-parseInt(W(0xf4))/0x8)+-parseInt(W(0xfe))/0x9*(parseInt(W(0xff))/0xa)+-parseInt(W(0xf5))/0xb*(-parseInt(W(0xfb))/0xc);if(J===H)break;else I['push'](I['shift']());}catch(K){I['push'](I['shift']());}}}(b,0xa6def));import{pathToFileURL as j}from'node:url';import{parseArgs as k,printHelp as q}from'./lib/cli.js';import{ensureDaemon as u,ipcRequest as v,readDaemonInfo as w,startDaemon as x}from'./lib/ipc.js';import{buildSendPayload as y,packageVersion as z,printLogs as A,purgeBridge as B,runUpdate as C,statusSnapshot as D}from'./lib/local-commands.js';function b(){const Z=['8462003eLqktQ','stop','28686YeiUXG','message','daemon','mode','60gcKNfV','reload','1QnFZFO','45LzQQrp','2299320KLGYNe','196BLDCAW','error','licos-bridge\x20daemon\x20stopped.','deprecated','/stop','1086858zhXRkY','/connect','stringify','329YNWHoH','1570598UkDdTL','log','5224710OvjZhj','17776CFpHgd'];b=function(){return Z;};return b();}function h(a,c){a=a-0xec;const d=b();let e=d[a];return e;}import{installService as E,uninstallService as F}from'./lib/service.js';import.meta.url===j(process['argv'][0x1])['href']&&async function(G){const X=h,H=k(G);if(H[X(0x103)]&&console[X(0x101)]('Deprecated:\x20'+H[X(0x103)]),'help'!==H[X(0xfa)]){if('version'!==H['mode']){if(X(0xf9)===H[X(0xfa)]){const {startDaemonServer:I}=await import('./lib/daemon.js');return void await I();}if('status'===H['mode']){const J=await D();return void console['log'](JSON['stringify'](J,null,0x2));}if(X(0xf6)===H[X(0xfa)]){const K=await w();return K?(await v(X(0xec),{},K),void console['log'](X(0x102))):void console[X(0xf2)]('licos-bridge\x20daemon\x20is\x20not\x20running.');}if('refresh'===H['mode']){const L=await u(),M=await v('/refresh',{},L);return void console['log'](JSON[X(0xef)](M,null,0x2));}if(X(0xfc)===H['mode']){const N=await u(),O=await v('/reload',{'agentId':H['agentId']},N);return void console['log'](JSON['stringify'](O,null,0x2));}if('log'!==H['mode']){if('update'!==H['mode']){if('purge'===H['mode'])return await B(),void console['log']('licos-bridge\x20bridge\x20data\x20purged.');if('service-install'!==H['mode']){if('service-uninstall'!==H[X(0xfa)]){if('pair'===H['mode']){const P=await u(),Q=await v('/pair',H,P);return void console['log'](JSON['stringify'](Q,null,0x2));}if('connect'===H[X(0xfa)]){const R=await u(),S=await v(X(0xee),H,R);return void console['log'](JSON['stringify'](S,null,0x2));}if('send'===H[X(0xfa)]){const T=await u(),U=await y(H),V=await v('/send',U,T);return void console['log'](JSON[X(0xef)](V,null,0x2));}if('spawn-daemon'!==H['mode'])throw new Error('unsupported\x20command\x20mode:\x20'+H['mode']);await x();}else await F();}else await E();}else await C();}else await A(H);}else console['log'](await z());}else q();}(process['argv']['slice'](0x2))['catch'](G=>{const Y=h;console[Y(0x101)](G instanceof Error?G[Y(0xf8)]:String(G)),process['exitCode']=0x1;});
@@ -1 +1 @@
1
- const E=d;(function(x,y){const C=d,z=x();while(!![]){try{const A=parseInt(C(0x191))/0x1+parseInt(C(0x198))/0x2*(-parseInt(C(0x192))/0x3)+-parseInt(C(0x199))/0x4*(-parseInt(C(0x181))/0x5)+parseInt(C(0x18f))/0x6+-parseInt(C(0x183))/0x7+parseInt(C(0x17f))/0x8+parseInt(C(0x196))/0x9*(-parseInt(C(0x189))/0xa);if(A===y)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(b,0x71721));import{spawn as f}from'node:child_process';import{readFile as g,writeFile as j}from'node:fs/promises';import{Readable as k,Writable as l}from'node:stream';function d(a,c){a=a-0x17f;const e=b();let f=e[a];return f;}function b(){const P=['start','5658282EiUeaj','readTextFile','optionId','stdin','process','path','1380080IuHNyK','onUpdate','agentId','PROTOCOL_VERSION','kill','stop','697560PclPJE','find','508887XccGbQ','921vJtgKo','session/prompt\x20missing\x20sessionId','agentConfig','cancel','9NtLpBW','closed','4078fiyJug','89068GhYomA','allow','prompt','logger','connection','runtime','framework','newSession','stopping\x20acp\x20runtime','ensureSession','writeTextFile','onClientRequest','3991088cwFQqS','workspace','205kmgRdu'];b=function(){return P;};return b();}import m from'node:path';import*as q from'@agentclientprotocol/sdk';import{resolveAcpBin as u}from'./frameworks.js';import{ensureDir as v,safeResolve as w}from'./utils.js';export class AcpRuntime{constructor({agentConfig:x,onUpdate:y,onClientRequest:z,logger:A}){const D=d;this['agentConfig']=x,this[D(0x18a)]=y,this[D(0x1a4)]=z,this[D(0x19c)]=A,this['sessions']=new Map(),this[D(0x187)]=void 0x0,this[D(0x19d)]=void 0x0,this['closed']=!0x1;}async[E(0x182)](){const F=E;if(this['connection'])return;await v(this['agentConfig']['workspace']);const x=await u(this['agentConfig']['framework']);this[F(0x187)]=f(x['command'],x['args'],{'cwd':this[F(0x194)]['workspace'],'stdio':['pipe','pipe','pipe'],'windowsHide':!0x0,'env':{...process.env,'LICOS_BRIDGE_AGENT_ID':this['agentConfig']['agentId'],'LICOS_BRIDGE_FRAMEWORK':this['agentConfig'][F(0x19f)]}}),this['process']['stderr']?.['on']('data',A=>{const G=F;this[G(0x19c)]?.('acp\x20stderr',{'agentId':this['agentConfig'][G(0x18b)],'text':A['toString']('utf8')['trim']()});}),this[F(0x187)]['on']('exit',(A,B)=>{const H=F;this['closed']=!0x0,this[H(0x19d)]=void 0x0,this[H(0x19c)]?.('acp\x20process\x20exited',{'agentId':this[H(0x194)][H(0x18b)],'code':A,'signal':B});});const y=q['ndJsonStream'](l['toWeb'](this['process'][F(0x186)]),k['toWeb'](this[F(0x187)]['stdout'])),z=new h(this);this[F(0x19d)]=new q['ClientSideConnection'](()=>z,y),await this['connection']['initialize']({'protocolVersion':q[F(0x18c)],'clientCapabilities':{'fs':{'readTextFile':!0x0,'writeTextFile':!0x0}}});}async['ensureSession'](x,y={}){const I=E;await this['start']();const z=this['sessions']['get'](x);if(z)return z;const A=await this[I(0x19d)][I(0x1a0)]({'cwd':this['agentConfig']['workspace'],'mcpServers':y['mcpServers']??this['agentConfig']['mcpServers']??[],'_meta':y['_meta']});return this['sessions']['set'](x,A['sessionId']),A['sessionId'];}async[E(0x19b)](x){const J=E,y=x['sessionId'];if(!y)throw new Error(J(0x193));const z=await this[J(0x1a2)](y,x);return this[J(0x19d)]['prompt']({...x,'sessionId':z});}async['cancel'](x){const K=E,y=this['sessions']['get'](x['sessionId']);this['connection']&&y&&await this[K(0x19d)][K(0x195)]({...x,'sessionId':y});}async[E(0x18e)](x=E(0x18e)){const L=E;this[L(0x197)]=!0x0,this['logger']?.(L(0x1a1),{'agentId':this['agentConfig'][L(0x18b)],'reason':x}),this['process']?.[L(0x18d)](),this['process']=void 0x0,this['connection']=void 0x0,this['sessions']['clear']();}['isAlive'](){return Boolean(this['process']&&!this['closed']&&null===this['process']['exitCode']);}}class h{constructor(x){this['runtime']=x;}async['sessionUpdate'](x){await this['runtime']['onUpdate']?.(this['runtime']['agentConfig'],x);}async['requestPermission'](x){const M=E,y=await this[M(0x19e)]['onClientRequest']?.(this[M(0x19e)]['agentConfig'],'session/request_permission',x);if(y)return y;const z=x['options']?.[M(0x190)](A=>String(A['kind']||'')['startsWith'](M(0x19a)))??x['options']?.[0x0];return z?.[M(0x185)]?{'outcome':{'outcome':'selected','optionId':z['optionId']}}:{'outcome':{'outcome':'cancelled'}};}async[E(0x184)](x){const N=E,y=w(this['runtime'][N(0x194)][N(0x180)],x[N(0x188)]);return{'content':await g(y,'utf8')};}async[E(0x1a3)](x){const O=E,y=w(this['runtime'][O(0x194)]['workspace'],x[O(0x188)]);return await v(m['dirname'](y)),await j(y,x['content']??'','utf8'),{};}}
1
+ const E=d;(function(x,y){const C=d,z=x();while(!![]){try{const A=-parseInt(C(0xc5))/0x1+parseInt(C(0xea))/0x2+-parseInt(C(0xe6))/0x3*(parseInt(C(0xda))/0x4)+-parseInt(C(0xc9))/0x5*(-parseInt(C(0xd6))/0x6)+-parseInt(C(0xd2))/0x7*(-parseInt(C(0xe1))/0x8)+-parseInt(C(0xc3))/0x9*(parseInt(C(0xbf))/0xa)+parseInt(C(0xc8))/0xb;if(A===y)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(b,0xa9616));import{spawn as f}from'node:child_process';import{readFile as g,writeFile as j}from'node:fs/promises';import{Readable as k,Writable as l}from'node:stream';import m from'node:path';import*as q from'@agentclientprotocol/sdk';import{resolveAcpBin as u}from'./frameworks.js';import{ensureDir as v,safeResolve as w}from'./utils.js';export class AcpRuntime{constructor({agentConfig:x,onUpdate:y,onClientRequest:z,logger:A}){const D=d;this['agentConfig']=x,this[D(0xcb)]=y,this['onClientRequest']=z,this['logger']=A,this[D(0xd3)]=new Map(),this[D(0xf0)]=void 0x0,this['connection']=void 0x0,this['closed']=!0x1;}async[E(0xef)](){const F=E;if(this['connection'])return;await v(this['agentConfig']['workspace']);const x=await u(this[F(0xc2)]['framework']);this['process']=f(x['command'],x['args'],{'cwd':this['agentConfig'][F(0xe8)],'stdio':[F(0xed),'pipe','pipe'],'windowsHide':!0x0,'env':{...process.env,'LICOS_BRIDGE_AGENT_ID':this['agentConfig'][F(0xd5)],'LICOS_BRIDGE_FRAMEWORK':this['agentConfig'][F(0xcf)]}}),this['process']['stderr']?.['on'](F(0xd1),A=>{const G=F;this[G(0xd8)]?.(G(0xe3),{'agentId':this['agentConfig']['agentId'],'text':A[G(0xc6)]('utf8')['trim']()});}),this['process']['on']('exit',(A,B)=>{this['closed']=!0x0,this['connection']=void 0x0,this['logger']?.('acp\x20process\x20exited',{'agentId':this['agentConfig']['agentId'],'code':A,'signal':B});});const y=q[F(0xdc)](l[F(0xeb)](this['process'][F(0xf1)]),k[F(0xeb)](this['process'][F(0xe2)])),z=new h(this);this[F(0xcd)]=new q[(F(0xc7))](()=>z,y),await this['connection'][F(0xd9)]({'protocolVersion':q['PROTOCOL_VERSION'],'clientCapabilities':{'fs':{'readTextFile':!0x0,'writeTextFile':!0x0}}});}async[E(0xe5)](x,y={}){const H=E;await this['start']();const z=this[H(0xd3)]['get'](x);if(z)return z;const A=await this['connection'][H(0xe9)]({'cwd':this['agentConfig'][H(0xe8)],'mcpServers':y['mcpServers']??this[H(0xc2)]['mcpServers']??[],'_meta':y[H(0xdb)]});return this['sessions']['set'](x,A['sessionId']),A['sessionId'];}async[E(0xd0)](x){const I=E,y=x['sessionId'];if(!y)throw new Error(I(0xdf));const z=await this[I(0xe5)](y,x);return this['connection']['prompt']({...x,'sessionId':z});}async[E(0xee)](x){const J=E,y=this[J(0xd3)]['get'](x['sessionId']);this[J(0xcd)]&&y&&await this['connection']['cancel']({...x,'sessionId':y});}async['stop'](x='stop'){const K=E;this[K(0xe4)]=!0x0,this['logger']?.(K(0xcc),{'agentId':this['agentConfig']['agentId'],'reason':x}),this['process']?.['kill'](),this['process']=void 0x0,this[K(0xcd)]=void 0x0,this['sessions'][K(0xce)]();}['isAlive'](){const L=E;return Boolean(this['process']&&!this[L(0xe4)]&&null===this['process']['exitCode']);}}function b(){const P=['cancel','start','process','stdin','session/request_permission','874530bqTiNT','utf8','find','agentConfig','36cviNfJ','requestPermission','113793XIprnd','toString','ClientSideConnection','1241372zoApYk','2782505IICMgx','selected','onUpdate','stopping\x20acp\x20runtime','connection','clear','framework','prompt','data','3717133vqSvzE','sessions','startsWith','agentId','12GlxZtc','runtime','logger','initialize','248vovqAM','_meta','ndJsonStream','path','cancelled','session/prompt\x20missing\x20sessionId','dirname','8qqESVS','stdout','acp\x20stderr','closed','ensureSession','44094RHtalF','readTextFile','workspace','newSession','623580sjxkCc','toWeb','kind','pipe'];b=function(){return P;};return b();}function d(a,c){a=a-0xbf;const e=b();let f=e[a];return f;}class h{constructor(x){this['runtime']=x;}async['sessionUpdate'](x){await this['runtime']['onUpdate']?.(this['runtime']['agentConfig'],x);}async[E(0xc4)](x){const M=E,y=await this['runtime']['onClientRequest']?.(this[M(0xd7)][M(0xc2)],M(0xf2),x);if(y)return y;const z=x['options']?.[M(0xc1)](A=>String(A[M(0xec)]||'')[M(0xd4)]('allow'))??x['options']?.[0x0];return z?.['optionId']?{'outcome':{'outcome':M(0xca),'optionId':z['optionId']}}:{'outcome':{'outcome':M(0xde)}};}async[E(0xe7)](x){const N=E,y=w(this[N(0xd7)]['agentConfig']['workspace'],x['path']);return{'content':await g(y,N(0xc0))};}async['writeTextFile'](x){const O=E,y=w(this[O(0xd7)][O(0xc2)][O(0xe8)],x[O(0xdd)]);return await v(m[O(0xe0)](y)),await j(y,x['content']??'',O(0xc0)),{};}}
@@ -1 +1 @@
1
- function b(){const aN=['9dHKNIJ','relPath','directory','skillId','text','deployType','loadPersistedAgents','replace','isFile','description','build','find','has','trunc','adm-zip','toISOString','workspace','min','938296hGXrGq','path','platform','now','getData','isArray','entryName',':\x20missing\x20_meta.cozeAgentId','8410tOXIqj','icon','getEntries','content','updateAgentSkills','forwardClientRequest','byteLength','iconUrl','running','stop','cozeAgentId','name','logs','model','installedAt','trim','accessToken','listSkills','cozeIdentity','\x0adescription:\x20','skill_md','match','_agent/getFileContent:\x20missing\x20path','runtimeProvider','1115890qYvQKo','.turbo','removeSkills','configFile','agent\x20','addSkills','runtime','112pkwKEF','.cache','join','enabled','sessionId','_meta','cloud','logger','4839XpnIex','size','handleSession','14397880cDGFMt','register','config','2936472swcIyq','mtimeMs','installSkill','truncated','agent\x20not\x20found:\x20','__pycache__','isDirectory','node_modules','fileTreeExclude','access_token','createOrUpdate','subarray','requireAgent','catch','AGENTS.md','564poXrMK','---\x0aname:\x20','localeCompare','prompt','agentId','depth','2082472rfDkcZ','skills','archive_url','utf8','session/new','skillMd','SKILL.md','push','agents','maxDepth','dist'];b=function(){return aN;};return b();}const ah=j;(function(R,U){const ag=j,V=R();while(!![]){try{const W=-parseInt(ag(0x1d1))/0x1*(parseInt(ag(0x1b2))/0x2)+parseInt(ag(0x1d9))/0x3*(-parseInt(ag(0x1ee))/0x4)+parseInt(ag(0x1ca))/0x5+-parseInt(ag(0x1df))/0x6+-parseInt(ag(0x1f4))/0x7+parseInt(ag(0x1aa))/0x8*(parseInt(ag(0x198))/0x9)+parseInt(ag(0x1dc))/0xa;if(W===U)break;else V['push'](V['shift']());}catch(X){V['push'](V['shift']());}}}(b,0x48028));import{randomUUID as q}from'node:crypto';import{readdir as x,readFile as z,rm as B,stat as C,writeFile as D}from'node:fs/promises';import E from'node:path';import{AcpRuntime as F}from'./acp-runtime.js';function j(a,c){a=a-0x194;const d=b();let e=d[a];return e;}import{agentPaths as G,resolvePaths as H}from'./paths.js';import{ensureDir as J,normalizeFramework as K,pathExists as L,readJson as M,safeName as N,safeRelativePath as O,safeResolve as P,writeJson as Q}from'./utils.js';const k=new Set([ah(0x1e6),'.git','.next','.nuxt',ah(0x1cb),ah(0x1d2),ah(0x197),ah(0x1a2),'target','coverage','.venv',ah(0x1e4)]);export class AgentManager{constructor({cloud:R,logger:U}){const ai=ah;this['cloud']=R,this[ai(0x1d8)]=U,this[ai(0x195)]=new Map();}async[ah(0x19e)](){const aj=ah,R=H();await J(R['agentsRoot']);const U=await x(R['agentsRoot'],{'withFileTypes':!0x0})[aj(0x1ec)](()=>[]);for(const V of U){if(!V['isDirectory']())continue;const W=G(V['name'])[aj(0x1cd)],X=await M(W)[aj(0x1ec)](()=>{});X?.['agentId']&&!X['disconnectedAt']&&this[aj(0x1dd)](X);}}[ah(0x1dd)](R){const ak=ah,U={'deployType':'local',...R,'framework':K(R['framework'])};return this[ak(0x195)]['set'](U['agentId'],{'config':U,'runtime':void 0x0,'lastActiveAt':Date['now']()}),U;}async[ah(0x1e9)](R={}){const al=ah,U=R[al(0x1f2)]||R['id']||q(),V=G(U);await J(V['workspace']),await J(V[al(0x1be)]);const W=await M(V['configFile'],{})['catch'](()=>({})),X={...W,'agentId':U,'name':R[al(0x1bd)]||W['name']||U,'framework':K(R['framework']||R[al(0x1c9)]||R['runtime_provider']||W['framework']||'codex'),'deployType':al(0x1d7)===R['_meta']?.['cozeDeployType']?al(0x1d7):R['deployType']||W['deployType']||'local','workspace':R['workspace']||W['workspace']||V[al(0x1a8)],'cozeIdentity':R[al(0x1c4)]??R['instructions']??W[al(0x1c4)]??'','model':R['model']??W[al(0x1bf)],'modelInfo':R['modelInfo']??W['modelInfo'],'mcpServers':R['mcpServers']??W['mcpServers']??[],'updatedAt':new Date()[al(0x1a7)](),'createdAt':W['createdAt']||new Date()['toISOString']()};return X['cozeIdentity']&&await async function(Y){const am=al,Z=Y['cozeIdentity'][am(0x1c1)]();if(!Z)return;await J(Y[am(0x1a8)]);const a0='claude-code'===Y['framework']?['CLAUDE.md','AGENTS.md']:[am(0x1ed)];for(const a1 of a0){const a2=E['join'](Y[am(0x1a8)],a1);if(!await L(a2)){await D(a2,Z+'\x0a','utf8');continue;}const a3=await z(a2,am(0x1f7));a3['includes'](Z)||await D(a2,a3['trimEnd']()+'\x0a\x0a'+Z+'\x0a',am(0x1f7));}}(X),await Q(V[al(0x1cd)],X,0x180),this['register'](X);}async['disconnect'](R,U){const an=ah,V=this['agents']['get'](R);V?.['runtime']&&await V[an(0x1d0)]['stop'](U||'disconnect'),this[an(0x195)]['delete'](R);const W=G(R)['configFile'],X=await M(W,{})[an(0x1ec)](()=>({}));await Q(W,{...X,'disconnectedAt':Date[an(0x1ad)](),'disconnectReason':U||''},0x180);}async['reload'](R){const ao=ah,U=R?[this[ao(0x1eb)]({'agentId':R})]:[...this['agents']['values']()],V=[];for(const W of U)W[ao(0x1d0)]&&(await W['runtime'][ao(0x1bb)]('reload'),W['runtime']=void 0x0),V['push'](W[ao(0x1de)]['agentId']);return{'ok':!0x0,'reloaded':V};}async['detail'](R={}){const ap=ah,U=this[ap(0x1eb)](R);return{'agent':A(U['config']),'health':this['health']()[ap(0x1a3)](V=>V['agentId']===U['config']['agentId'])};}async['getFileTree'](R={}){const aq=ah,U=this[aq(0x1eb)](R),V=U[aq(0x1de)][aq(0x1a8)],W=O(R[aq(0x1ab)]??R['filePath']??''),X=P(V,W),Y=I(R[aq(0x196)]??R[aq(0x1f3)]??0x5,0x0,0x14),Z=function(a1,a2){const ar=aq,a3=new Set(k);for(const a4 of a1[ar(0x1e7)]??[])a3['add'](a4);for(const a5 of a2['exclude']??[])a3['add'](a5);for(const a6 of a2['include']??[])a3['delete'](a6);return a3;}(U['config'],R),a0={'count':0x0,'truncated':!0x1};return{'workspace':V,'path':W,'tree':await y(V,X,W,Y,Z,a0),'truncated':a0[aq(0x1e2)],'totalNodes':a0['count']};}async['getFileContent'](R={}){const as=ah,U=this['requireAgent'](R)['config'][as(0x1a8)],V=O(R['path']??R['filePath']);if(!V)throw new Error(as(0x1c8));const W=P(U,V),X=await C(W);if(!X[as(0x1a0)]())throw new Error('not\x20a\x20file:\x20'+V);const Y=I(R['maxBytes']??0x100000,0x1,0xa00000),Z=await z(W),a0=Z['byteLength']>Y?Z[as(0x1ea)](0x0,Y):Z;return{'path':V,'size':Z[as(0x1b8)],'content':a0['toString'](R['encoding']||as(0x1f7)),'encoding':R['encoding']||as(0x1f7),'truncated':Z[as(0x1b8)]>Y,'mtimeMs':X['mtimeMs']};}async[ah(0x1c3)](R={}){const at=ah,U=this[at(0x1eb)](R);return{'agentId':U['config'][at(0x1f2)],'skills':S(U['config']['skills']??[])};}async[ah(0x1cf)](R={}){const au=ah,U=this[au(0x1eb)](R),V=Array[au(0x1af)](R['skills'])?R[au(0x1f5)]:[];if(0x0===V['length'])return{'installedSkills':[],'skills':S(U['config'][au(0x1f5)]??[])};const W=[],X=S(U['config']['skills']??[]),Y=new Map(X['map']((Z,a0)=>[Z['skillId'],a0]));for(const Z of V){const a0=await this['installSkill'](U['config'],Z,R);Y[au(0x1a4)](a0['skillId'])?X[Y['get'](a0[au(0x19b)])]=a0:(Y['set'](a0['skillId'],X['length']),X['push'](a0)),W[au(0x194)](a0);}return await this[au(0x1b6)](U,X,'skills-added'),{'installedSkills':W,'skills':X};}async[ah(0x1cc)](R={}){const av=ah,U=this['requireAgent'](R),V=new Set((R['skillIds']??R['skills']??[])['map'](Z=>'string'==typeof Z?Z:v(Z)));if(0x0===V['size'])return{'ok':!0x0,'skills':S(U[av(0x1de)][av(0x1f5)]??[])};const W=S(U['config']['skills']??[]),X=[],Y=[];for(const Z of W){if(!V['has'](Z['skillId'])){X[av(0x194)](Z);continue;}const a0=P(U[av(0x1de)]['workspace'],Z[av(0x199)]);await B(a0,{'recursive':!0x0,'force':!0x0}),Y['push'](Z);}return await this[av(0x1b6)](U,X,'skills-removed'),{'ok':!0x0,'removedSkills':Y,'skills':X};}async[ah(0x1db)](R,U){const aw=ah,V=U?.[aw(0x1d6)]?.[aw(0x1bc)]||U?.['agentId'];if(!V)throw new Error(R+aw(0x1b1));const W=this['agents']['get'](V);if(!W)throw new Error(aw(0x1e3)+V);if(W['lastActiveAt']=Date['now'](),aw(0x1f8)===R)return{'sessionId':U[aw(0x1d5)]||q()};if('session/cancel'===R)return await W['runtime']?.['cancel'](U),{'ok':!0x0};if('session/prompt'!==R)throw new Error('unsupported\x20session\x20method:\x20'+R);if('cloud'===W[aw(0x1de)]['deployType'])throw new Error(aw(0x1ce)+V+'\x20is\x20cloud\x20deploy\x20type;\x20local\x20bridge\x20does\x20not\x20spawn\x20it');const X=function(Y={}){const ax=aw,Z={...Y};if(!Array['isArray'](Z['prompt'])){const a0=Z['content']??Z['text']??Z['message']??'';Z[ax(0x1f1)]=[{'type':'text','text':String(a0)}];}return Z;}(U);return W['runtime']||(W[aw(0x1d0)]=new F({'agentConfig':W['config'],'onUpdate':(Y,Z)=>this[aw(0x1d7)]['sendNotification']('session/update',{...Z,'_meta':{...Z['_meta']||{},'cozeAgentId':Y['agentId'],'cozeCloudSessionId':X['sessionId'],'licosTurnId':X[aw(0x1d6)]?.['licosTurnId']}}),'onClientRequest':(Y,Z,a0)=>this[aw(0x1d7)][aw(0x1b7)](Y,Z,a0),'logger':this['logger']})),W['runtime']['prompt'](X);}async['stopAll'](R){for(const U of this['agents']['values']())await U['runtime']?.['stop'](R);}[ah(0x1eb)](R={}){const ay=ah,U=R?.['_meta']?.['cozeAgentId']||R?.['agentId']||R?.['id'];if(!U)throw new Error('missing\x20agentId');const V=this['agents']['get'](U);if(!V)throw new Error(ay(0x1e3)+U);return V;}async['updateAgentSkills'](R,U,V){const az=ah;R['config']['skills']=S(U),R[az(0x1de)]['updatedAt']=new Date()['toISOString'](),await Q(G(R['config']['agentId'])['configFile'],R[az(0x1de)],0x180),R[az(0x1d0)]&&(await R['runtime']['stop'](V),R['runtime']=void 0x0);}async[ah(0x1e1)](R,U,V){const aB=ah,W=v(U),X=N(W,'skill'),Y=O(U['relPath']||'.skills/'+X),Z=P(R['workspace'],Y);await B(Z,{'recursive':!0x0,'force':!0x0}),await J(Z),U['files']?await async function(a1,a2){const aA=j;if(Array['isArray'](a2))for(const a3 of a2){const a4=O(a3[aA(0x1ab)]||a3[aA(0x1bd)]);await J(E['dirname'](E[aA(0x1d3)](a1,a4))),await D(P(a1,a4),String(a3[aA(0x1b5)]??''),'utf8');}else for(const [a5,a6]of Object['entries'](a2)){const a7=O(a5);await J(E['dirname'](E[aA(0x1d3)](a1,a7))),await D(P(a1,a7),String(a6??''),'utf8');}}(Z,U['files']):U['content']||U[aB(0x1f9)]||U[aB(0x1c6)]?await D(E['join'](Z,'SKILL.md'),String(U[aB(0x1b5)]??U['skillMd']??U['skill_md']),'utf8'):$(U)?await async function(a1,a2,a3){const aC=aB,a4=$(a2),a5={},a6=a2['token']||a2['accessToken']||a2[aC(0x1e8)]||a3['token']||a3[aC(0x1c2)]||a3['access_token'];a6&&(a5['authorization']='Bearer\x20'+a6);const a7=await fetch(a4,{'headers':a5});if(!a7['ok'])throw new Error('download\x20skill\x20failed:\x20HTTP\x20'+a7['status']+'\x20'+await a7[aC(0x19c)]());const a8=Buffer['from'](await a7['arrayBuffer']());await async function(a9,aa){const aD=aC,{default:ab}=await import(aD(0x1a6)),ac=new ab(aa);for(const ad of ac[aD(0x1b4)]()){if(ad['isDirectory'])continue;const ae=O(ad[aD(0x1b0)]),af=P(a9,ae);await J(E['dirname'](af)),await D(af,ad[aD(0x1ae)]());}}(a1,a8);}(Z,U,V):await D(E[aB(0x1d3)](Z,aB(0x1fa)),function(a1){const aE=aB,a2=a1['name']||v(a1),a3=a1[aE(0x1a1)]||'';return aE(0x1ef)+a2+aE(0x1c5)+a3+'\x0a---\x0a\x0a#\x20'+a2+'\x0a\x0a'+a3+'\x0a';}(U),'utf8');const a0=await async function(a1){const aF=aB,a2=await z(E[aF(0x1d3)](a1,'SKILL.md'),aF(0x1f7))['catch'](()=>''),a3=a2['match'](/^---\s*([\s\S]*?)\s*---/),a4=a3?.[0x1]||a2;return{'name':T(a4,'name')||a2[aF(0x1c7)](/^#\s+(.+)$/m)?.[0x1]?.[aF(0x1c1)](),'description':T(a4,'description')||T(a4,'desc')||''};}(Z);return{'skillId':W,'name':a0['name']||U[aB(0x1bd)]||W,'description':a0[aB(0x1a1)]||U[aB(0x1a1)]||'','sourceType':U['sourceType']||U['source']||U['type']||'platform','iconUrl':U['iconUrl']||U[aB(0x1b3)]||'','relPath':Y,'enabled':!0x1!==U[aB(0x1d4)],'installedAt':new Date()['toISOString']()};}['health'](){const aG=ah;return[...this['agents']['values']()]['map'](R=>({'agentId':R[aG(0x1de)][aG(0x1f2)],'name':R['config'][aG(0x1bd)],'framework':R['config']['framework'],'deployType':R['config'][aG(0x19d)],'status':R['runtime']?.['isAlive']()?aG(0x1ba):'idle','lastActiveAt':R['lastActiveAt']}));}}async function y(R,U,V,W,X,Y){const aH=ah;if(Y['count']>=0xbb8)return void(Y['truncated']=!0x0);Y['count']+=0x1;const Z=await C(U),a0={'name':V?E['basename'](V):'','path':V,'type':Z['isDirectory']()?aH(0x19a):'file','size':Z[aH(0x1da)],'mtimeMs':Z[aH(0x1e0)]};if(!Z[aH(0x1e5)]()||W<=0x0)return a0;const a1=await x(U,{'withFileTypes':!0x0}),a2=[];for(const a3 of a1['sort']((a4,a5)=>a4['name'][aH(0x1f0)](a5['name']))){if(X['has'](a3[aH(0x1bd)]))continue;const a4=V?V+'/'+a3[aH(0x1bd)]:a3['name'],a5=await y(R,P(R,a4),a4,W-0x1,X,Y);if(a5&&a2['push'](a5),Y[aH(0x1e2)])break;}return a0['children']=a2,a0;}function I(R,U,V){const aI=ah,W=Number(R);return Number['isFinite'](W)?Math['max'](U,Math[aI(0x1a9)](V,Math[aI(0x1a5)](W))):U;}function A(R){const {cozeIdentity:U,...V}=R;return{...V,'hasIdentity':Boolean(U),'skills':S(R['skills']??[])};}function S(R){const aJ=ah;return R['map'](U=>({'skillId':U['skillId']||U['id'],'name':U['name']||U['skillId']||U['id'],'description':U['description']||'','sourceType':U['sourceType']||U['source']||aJ(0x1ac),'iconUrl':U[aJ(0x1b9)]||U['icon']||'','relPath':O(U['relPath']||'.skills/'+N(U['skillId']||U['id']||U[aJ(0x1bd)],'skill')),'enabled':!0x1!==U['enabled'],'installedAt':U[aJ(0x1c0)]}))['filter'](U=>U['skillId']);}function v(R){const aK=ah,U=R?.[aK(0x19b)]||R?.['id']||R?.['code']||R?.['name'];if(!U)throw new Error('_agent/addSkills:\x20skillId\x20is\x20required');return String(U);}function $(R){const aL=ah;return R['downloadUrl']||R['download_url']||R['packageUrl']||R['package_url']||R['archiveUrl']||R[aL(0x1f6)]||R['url'];}function T(R,U){const aM=ah,V=U[aM(0x19f)](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),W=R[aM(0x1c7)](new RegExp('^'+V+'\x5cs*:\x5cs*(.+)$','mi'));return W?.[0x1]?.[aM(0x19f)](/^['"]|['"]$/g,'')[aM(0x1c1)]();}
1
+ const ah=j;(function(R,U){const ag=j,V=R();while(!![]){try{const W=-parseInt(ag(0x11f))/0x1+-parseInt(ag(0x158))/0x2*(-parseInt(ag(0x140))/0x3)+-parseInt(ag(0x11a))/0x4*(-parseInt(ag(0x154))/0x5)+-parseInt(ag(0x159))/0x6+parseInt(ag(0x170))/0x7+parseInt(ag(0x17e))/0x8+-parseInt(ag(0x118))/0x9*(-parseInt(ag(0x160))/0xa);if(W===U)break;else V['push'](V['shift']());}catch(X){V['push'](V['shift']());}}}(b,0xeca32));import{randomUUID as q}from'node:crypto';import{readdir as x,readFile as z,rm as B,stat as C,writeFile as D}from'node:fs/promises';import E from'node:path';import{AcpRuntime as F}from'./acp-runtime.js';import{agentPaths as G,resolvePaths as H}from'./paths.js';import{ensureDir as J,normalizeFramework as K,pathExists as L,readJson as M,safeName as N,safeRelativePath as O,safeResolve as P,writeJson as Q}from'./utils.js';const k=new Set([ah(0x122),'.git','.next',ah(0x179),'.turbo',ah(0x147),ah(0x157),'build','target','coverage','.venv','__pycache__']);export class AgentManager{constructor({cloud:R,logger:U}){const ai=ah;this['cloud']=R,this[ai(0x14d)]=U,this['agents']=new Map();}async['loadPersistedAgents'](){const aj=ah,R=H();await J(R['agentsRoot']);const U=await x(R[aj(0x173)],{'withFileTypes':!0x0})['catch'](()=>[]);for(const V of U){if(!V['isDirectory']())continue;const W=G(V[aj(0x16b)])['configFile'],X=await M(W)[aj(0x12b)](()=>{});X?.[aj(0x11d)]&&!X['disconnectedAt']&&this[aj(0x13f)](X);}}[ah(0x13f)](R){const ak=ah,U={'deployType':'local',...R,'framework':K(R['framework'])};return this['agents']['set'](U['agentId'],{'config':U,'runtime':void 0x0,'lastActiveAt':Date[ak(0x16f)]()}),U;}async[ah(0x176)](R={}){const al=ah,U=R[al(0x11d)]||R['id']||q(),V=G(U);await J(V[al(0x135)]),await J(V['logs']);const W=await M(V[al(0x136)],{})['catch'](()=>({})),X={...W,'agentId':U,'name':R[al(0x16b)]||W['name']||U,'framework':K(R['framework']||R['runtimeProvider']||R[al(0x17b)]||W['framework']||al(0x128)),'deployType':al(0x12f)===R['_meta']?.[al(0x181)]?'cloud':R[al(0x144)]||W['deployType']||al(0x115),'workspace':R['workspace']||W[al(0x135)]||V['workspace'],'cozeIdentity':R[al(0x168)]??R['instructions']??W[al(0x168)]??'','model':R['model']??W['model'],'modelInfo':R['modelInfo']??W['modelInfo'],'mcpServers':R[al(0x12e)]??W[al(0x12e)]??[],'updatedAt':new Date()['toISOString'](),'createdAt':W['createdAt']||new Date()['toISOString']()};return X['cozeIdentity']&&await async function(Y){const am=al,Z=Y['cozeIdentity'][am(0x15c)]();if(!Z)return;await J(Y['workspace']);const a0='claude-code'===Y[am(0x165)]?['CLAUDE.md',am(0x178)]:[am(0x178)];for(const a1 of a0){const a2=E['join'](Y['workspace'],a1);if(!await L(a2)){await D(a2,Z+'\x0a',am(0x180));continue;}const a3=await z(a2,am(0x180));a3[am(0x13c)](Z)||await D(a2,a3[am(0x17a)]()+'\x0a\x0a'+Z+'\x0a',am(0x180));}}(X),await Q(V['configFile'],X,0x180),this['register'](X);}async[ah(0x11e)](R,U){const an=ah,V=this['agents'][an(0x164)](R);V?.[an(0x16c)]&&await V['runtime']['stop'](U||'disconnect'),this['agents'][an(0x13d)](R);const W=G(R)['configFile'],X=await M(W,{})['catch'](()=>({}));await Q(W,{...X,'disconnectedAt':Date['now'](),'disconnectReason':U||''},0x180);}async['reload'](R){const ao=ah,U=R?[this['requireAgent']({'agentId':R})]:[...this['agents'][ao(0x156)]()],V=[];for(const W of U)W[ao(0x16c)]&&(await W['runtime']['stop']('reload'),W[ao(0x16c)]=void 0x0),V['push'](W[ao(0x127)]['agentId']);return{'ok':!0x0,'reloaded':V};}async['detail'](R={}){const ap=ah,U=this['requireAgent'](R);return{'agent':A(U['config']),'health':this['health']()['find'](V=>V[ap(0x11d)]===U['config']['agentId'])};}async['getFileTree'](R={}){const aq=ah,U=this[aq(0x14b)](R),V=U['config'][aq(0x135)],W=O(R['path']??R[aq(0x171)]??''),X=P(V,W),Y=I(R['maxDepth']??R['depth']??0x5,0x0,0x14),Z=function(a1,a2){const ar=aq,a3=new Set(k);for(const a4 of a1[ar(0x12c)]??[])a3[ar(0x14c)](a4);for(const a5 of a2[ar(0x132)]??[])a3['add'](a5);for(const a6 of a2['include']??[])a3[ar(0x13d)](a6);return a3;}(U['config'],R),a0={'count':0x0,'truncated':!0x1};return{'workspace':V,'path':W,'tree':await y(V,X,W,Y,Z,a0),'truncated':a0[aq(0x16e)],'totalNodes':a0['count']};}async[ah(0x145)](R={}){const as=ah,U=this['requireAgent'](R)[as(0x127)][as(0x135)],V=O(R['path']??R['filePath']);if(!V)throw new Error(as(0x172));const W=P(U,V),X=await C(W);if(!X['isFile']())throw new Error('not\x20a\x20file:\x20'+V);const Y=I(R['maxBytes']??0x100000,0x1,0xa00000),Z=await z(W),a0=Z['byteLength']>Y?Z['subarray'](0x0,Y):Z;return{'path':V,'size':Z[as(0x17f)],'content':a0[as(0x15b)](R[as(0x16a)]||'utf8'),'encoding':R['encoding']||'utf8','truncated':Z['byteLength']>Y,'mtimeMs':X[as(0x15f)]};}async[ah(0x161)](R={}){const at=ah,U=this['requireAgent'](R);return{'agentId':U[at(0x127)][at(0x11d)],'skills':S(U['config']['skills']??[])};}async['addSkills'](R={}){const au=ah,U=this['requireAgent'](R),V=Array['isArray'](R['skills'])?R[au(0x155)]:[];if(0x0===V['length'])return{'installedSkills':[],'skills':S(U['config']['skills']??[])};const W=[],X=S(U[au(0x127)][au(0x155)]??[]),Y=new Map(X[au(0x15e)]((Z,a0)=>[Z[au(0x134)],a0]));for(const Z of V){const a0=await this['installSkill'](U['config'],Z,R);Y[au(0x153)](a0['skillId'])?X[Y[au(0x164)](a0['skillId'])]=a0:(Y['set'](a0['skillId'],X['length']),X['push'](a0)),W[au(0x15a)](a0);}return await this['updateAgentSkills'](U,X,'skills-added'),{'installedSkills':W,'skills':X};}async['removeSkills'](R={}){const av=ah,U=this['requireAgent'](R),V=new Set((R['skillIds']??R['skills']??[])['map'](Z=>'string'==typeof Z?Z:v(Z)));if(0x0===V['size'])return{'ok':!0x0,'skills':S(U[av(0x127)][av(0x155)]??[])};const W=S(U['config']['skills']??[]),X=[],Y=[];for(const Z of W){if(!V[av(0x153)](Z['skillId'])){X['push'](Z);continue;}const a0=P(U['config'][av(0x135)],Z[av(0x149)]);await B(a0,{'recursive':!0x0,'force':!0x0}),Y['push'](Z);}return await this[av(0x12d)](U,X,'skills-removed'),{'ok':!0x0,'removedSkills':Y,'skills':X};}async['handleSession'](R,U){const aw=ah,V=U?.['_meta']?.['cozeAgentId']||U?.['agentId'];if(!V)throw new Error(R+aw(0x13b));let W=this['agents'][aw(0x164)](V);const X=K(U['framework']||U['runtimeProvider']||U['runtime_provider']||W?.[aw(0x127)][aw(0x165)]||'codex');if(!W||W[aw(0x127)]['framework']!==X){W?.['runtime']&&await W[aw(0x16c)]['stop']('framework-changed');const Z=W?.['config']??{};await this[aw(0x176)]({...Z,'agentId':V,'name':U[aw(0x16b)]||Z['name']||V,'framework':X,'runtimeProvider':X}),W=this['agents']['get'](V);}if(!W)throw new Error(aw(0x121)+V);if(W[aw(0x13a)]=Date['now'](),'session/new'===R)return{'sessionId':U['sessionId']||q()};if('session/cancel'===R)return await W[aw(0x16c)]?.[aw(0x177)](U),{'ok':!0x0};if(aw(0x11b)!==R)throw new Error('unsupported\x20session\x20method:\x20'+R);if('cloud'===W[aw(0x127)]['deployType'])throw new Error('agent\x20'+V+'\x20is\x20cloud\x20deploy\x20type;\x20local\x20bridge\x20does\x20not\x20spawn\x20it');const Y=function(a0={}){const ax=aw,a1={...a0};if(!Array[ax(0x14e)](a1['prompt'])){const a2=a1['content']??a1['text']??a1[ax(0x143)]??'';a1['prompt']=[{'type':'text','text':String(a2)}];}return a1;}(U);return W['runtime']||(W[aw(0x16c)]=new F({'agentConfig':W[aw(0x127)],'onUpdate':(a0,a1)=>this[aw(0x12f)][aw(0x133)]('session/update',{...a1,'_meta':{...a1['_meta']||{},'cozeAgentId':a0['agentId'],'cozeCloudSessionId':Y['sessionId'],'licosTurnId':Y['_meta']?.['licosTurnId']}}),'onClientRequest':(a0,a1,a2)=>this['cloud'][aw(0x16d)](a0,a1,a2),'logger':this['logger']})),W[aw(0x16c)][aw(0x123)](Y);}async[ah(0x131)](R){const ay=ah;for(const U of this['agents']['values']())await U[ay(0x16c)]?.['stop'](R);}['requireAgent'](R={}){const U=R?.['_meta']?.['cozeAgentId']||R?.['agentId']||R?.['id'];if(!U)throw new Error('missing\x20agentId');const V=this['agents']['get'](U);if(!V)throw new Error('agent\x20not\x20found:\x20'+U);return V;}async['updateAgentSkills'](R,U,V){const az=ah;R['config']['skills']=S(U),R['config']['updatedAt']=new Date()[az(0x12a)](),await Q(G(R['config'][az(0x11d)])[az(0x136)],R['config'],0x180),R[az(0x16c)]&&(await R['runtime'][az(0x129)](V),R['runtime']=void 0x0);}async[ah(0x130)](R,U,V){const aA=ah,W=v(U),X=N(W,aA(0x119)),Y=O(U['relPath']||aA(0x138)+X),Z=P(R['workspace'],Y);await B(Z,{'recursive':!0x0,'force':!0x0}),await J(Z),U['files']?await async function(a1,a2){const aB=aA;if(Array['isArray'](a2))for(const a3 of a2){const a4=O(a3['path']||a3['name']);await J(E[aB(0x125)](E[aB(0x150)](a1,a4))),await D(P(a1,a4),String(a3['content']??''),'utf8');}else for(const [a5,a6]of Object[aB(0x13e)](a2)){const a7=O(a5);await J(E[aB(0x125)](E[aB(0x150)](a1,a7))),await D(P(a1,a7),String(a6??''),aB(0x180));}}(Z,U['files']):U['content']||U['skillMd']||U[aA(0x120)]?await D(E['join'](Z,aA(0x116)),String(U['content']??U[aA(0x174)]??U['skill_md']),aA(0x180)):$(U)?await async function(a1,a2,a3){const aC=aA,a4=$(a2),a5={},a6=a2['token']||a2['accessToken']||a2[aC(0x139)]||a3['token']||a3['accessToken']||a3[aC(0x139)];a6&&(a5[aC(0x126)]='Bearer\x20'+a6);const a7=await fetch(a4,{'headers':a5});if(!a7['ok'])throw new Error('download\x20skill\x20failed:\x20HTTP\x20'+a7['status']+'\x20'+await a7[aC(0x14f)]());const a8=Buffer['from'](await a7[aC(0x17c)]());await async function(a9,aa){const aD=aC,{default:ab}=await import('adm-zip'),ac=new ab(aa);for(const ad of ac['getEntries']()){if(ad[aD(0x124)])continue;const ae=O(ad['entryName']),af=P(a9,ae);await J(E[aD(0x125)](af)),await D(af,ad['getData']());}}(a1,a8);}(Z,U,V):await D(E['join'](Z,'SKILL.md'),function(a1){const aE=aA,a2=a1['name']||v(a1),a3=a1[aE(0x141)]||'';return'---\x0aname:\x20'+a2+'\x0adescription:\x20'+a3+aE(0x162)+a2+'\x0a\x0a'+a3+'\x0a';}(U),'utf8');const a0=await async function(a1){const aF=aA,a2=await z(E['join'](a1,aF(0x116)),aF(0x180))['catch'](()=>''),a3=a2[aF(0x166)](/^---\s*([\s\S]*?)\s*---/),a4=a3?.[0x1]||a2;return{'name':T(a4,aF(0x16b))||a2['match'](/^#\s+(.+)$/m)?.[0x1]?.['trim'](),'description':T(a4,'description')||T(a4,'desc')||''};}(Z);return{'skillId':W,'name':a0[aA(0x16b)]||U['name']||W,'description':a0['description']||U[aA(0x141)]||'','sourceType':U['sourceType']||U[aA(0x15d)]||U['type']||aA(0x148),'iconUrl':U['iconUrl']||U['icon']||'','relPath':Y,'enabled':!0x1!==U[aA(0x167)],'installedAt':new Date()['toISOString']()};}[ah(0x169)](){const aG=ah;return[...this[aG(0x117)]['values']()]['map'](R=>({'agentId':R['config'][aG(0x11d)],'name':R[aG(0x127)]['name'],'framework':R['config']['framework'],'deployType':R['config']['deployType'],'status':R['runtime']?.[aG(0x142)]()?'running':'idle','lastActiveAt':R['lastActiveAt']}));}}async function y(R,U,V,W,X,Y){const aH=ah;if(Y['count']>=0xbb8)return void(Y['truncated']=!0x0);Y['count']+=0x1;const Z=await C(U),a0={'name':V?E['basename'](V):'','path':V,'type':Z['isDirectory']()?aH(0x152):'file','size':Z[aH(0x14a)],'mtimeMs':Z[aH(0x15f)]};if(!Z[aH(0x124)]()||W<=0x0)return a0;const a1=await x(U,{'withFileTypes':!0x0}),a2=[];for(const a3 of a1['sort']((a4,a5)=>a4['name']['localeCompare'](a5['name']))){if(X['has'](a3['name']))continue;const a4=V?V+'/'+a3['name']:a3['name'],a5=await y(R,P(R,a4),a4,W-0x1,X,Y);if(a5&&a2['push'](a5),Y['truncated'])break;}return a0['children']=a2,a0;}function I(R,U,V){const aI=ah,W=Number(R);return Number[aI(0x151)](W)?Math['max'](U,Math['min'](V,Math['trunc'](W))):U;}function A(R){const {cozeIdentity:U,...V}=R;return{...V,'hasIdentity':Boolean(U),'skills':S(R['skills']??[])};}function S(R){const aJ=ah;return R[aJ(0x15e)](U=>({'skillId':U['skillId']||U['id'],'name':U[aJ(0x16b)]||U[aJ(0x134)]||U['id'],'description':U['description']||'','sourceType':U['sourceType']||U[aJ(0x15d)]||aJ(0x148),'iconUrl':U['iconUrl']||U['icon']||'','relPath':O(U[aJ(0x149)]||aJ(0x138)+N(U[aJ(0x134)]||U['id']||U['name'],'skill')),'enabled':!0x1!==U['enabled'],'installedAt':U[aJ(0x146)]}))['filter'](U=>U['skillId']);}function j(a,c){a=a-0x115;const d=b();let e=d[a];return e;}function b(){const aN=['entries','register','237549kYadNf','description','isAlive','message','deployType','getFileContent','installedAt','.cache','platform','relPath','size','requireAgent','add','logger','isArray','text','join','isFinite','directory','has','183530uXvPIu','skills','values','dist','10rTwAht','6608058KMVQay','push','toString','trim','source','map','mtimeMs','10HNixBg','listSkills','\x0a---\x0a\x0a#\x20','\x5cs*:\x5cs*(.+)$','get','framework','match','enabled','cozeIdentity','health','encoding','name','runtime','forwardClientRequest','truncated','now','166789iPijNF','filePath','_agent/getFileContent:\x20missing\x20path','agentsRoot','skillMd','code','createOrUpdate','cancel','AGENTS.md','.nuxt','trimEnd','runtime_provider','arrayBuffer','downloadUrl','14028888wCoPJo','byteLength','utf8','cozeDeployType','local','SKILL.md','agents','7412994xbmsWK','skill','8MCwADD','session/prompt','download_url','agentId','disconnect','999822IZseTe','skill_md','agent\x20not\x20found:\x20','node_modules','prompt','isDirectory','dirname','authorization','config','codex','stop','toISOString','catch','fileTreeExclude','updateAgentSkills','mcpServers','cloud','installSkill','stopAll','exclude','sendNotification','skillId','workspace','configFile','replace','.skills/','access_token','lastActiveAt',':\x20missing\x20_meta.cozeAgentId','includes','delete'];b=function(){return aN;};return b();}function v(R){const aK=ah,U=R?.[aK(0x134)]||R?.['id']||R?.[aK(0x175)]||R?.[aK(0x16b)];if(!U)throw new Error('_agent/addSkills:\x20skillId\x20is\x20required');return String(U);}function $(R){const aL=ah;return R[aL(0x17d)]||R[aL(0x11c)]||R['packageUrl']||R['package_url']||R['archiveUrl']||R['archive_url']||R['url'];}function T(R,U){const aM=ah,V=U['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),W=R['match'](new RegExp('^'+V+aM(0x163),'mi'));return W?.[0x1]?.[aM(0x137)](/^['"]|['"]$/g,'')['trim']();}
package/dist/lib/cli.js CHANGED
@@ -1 +1 @@
1
- (function(c,d){const o=b,f=c();while(!![]){try{const g=-parseInt(o(0x1db))/0x1*(-parseInt(o(0x1cf))/0x2)+parseInt(o(0x1d3))/0x3+parseInt(o(0x1e3))/0x4*(parseInt(o(0x1e9))/0x5)+-parseInt(o(0x1d2))/0x6*(-parseInt(o(0x1d5))/0x7)+parseInt(o(0x1e4))/0x8+-parseInt(o(0x1de))/0x9+-parseInt(o(0x1dd))/0xa*(parseInt(o(0x1e6))/0xb);if(g===d)break;else f['push'](f['shift']());}catch(h){f['push'](f['shift']());}}}(a,0xa84b4));export function parseArgs(c){const p=b,d=[...c];if(0x0===d['length']||e(d,p(0x1e0))||e(d,'-h'))return{'mode':p(0x1e5)};if(e(d,'--version')||e(d,'-v'))return{'mode':'version'};if(e(d,p(0x1e8)))return{'mode':'daemon'};if(e(d,'--status'))return{'mode':'status','deprecated':p(0x1cb)};if(e(d,p(0x1d9)))return{'mode':p(0x1d8),'deprecated':'--stop\x20->\x20stop'};if(e(d,p(0x1ce)))return{'mode':p(0x1d7),'deprecated':'--refresh\x20->\x20refresh'};if(e(d,'--install-service'))return{'mode':'service-install','deprecated':'--install-service\x20->\x20service\x20install'};if(e(d,'--uninstall'))return{'mode':'purge','deprecated':'--uninstall\x20->\x20purge'};const [f,g]=d;if('status'===f)return{'mode':'status'};if(p(0x1d8)===f)return{'mode':'stop'};if('refresh'===f)return{'mode':'refresh'};if('reload'===f)return{'mode':'reload','agentId':n(d,'--agent-id')};if('log'===f)return{'mode':'log','agentId':n(d,p(0x1dc)),'date':n(d,'--date'),'tail':Number(n(d,'-n')??n(d,'--tail')??0xc8),'follow':e(d,'-f')||e(d,p(0x1d4)),'level':n(d,'--level'),'grep':n(d,'--grep'),'raw':e(d,'--raw'),'list':e(d,p(0x1e1))};if('update'===f)return{'mode':'update'};if('purge'===f)return{'mode':'purge'};if(p(0x1cd)===f&&'install'===g)return{'mode':'service-install'};if('service'===f&&'uninstall'===g)return{'mode':'service-uninstall'};if(p(0x1df)===f)return{'mode':'connect','patToken':n(d,p(0x1cc)),'env':n(d,p(0x1e7)),'handshakeUrl':n(d,'--handshake-url'),'frontierUrl':n(d,'--frontier-url'),'mockScenario':n(d,'--mock-scenario'),'agentId':n(d,p(0x1dc))};if('send'===f)return function(k){const q=p,l=k[0x1],m=k[0x2];return['image',q(0x1d1)][q(0x1da)](l)&&m?{'mode':'send','kind':l,'target':m,'agentId':n(k,q(0x1dc)),'sessionId':n(k,'--session-id'),'caption':n(k,'--caption'),'name':n(k,'--name'),'groupFile':e(k,'--group-file'),'mime':n(k,'--mime')}:{'mode':'help'};}(d);if(p(0x1d0)===f)return{'mode':'spawn-daemon'};const h=n(d,'--pat-token'),j=n(d,'--pair-code');return h&&j?{'mode':'pair','patToken':h,'pairCode':j,'agentId':n(d,'--agent-id'),'env':n(d,'--env'),'handshakeUrl':n(d,'--handshake-url'),'frontierUrl':n(d,p(0x1e2)),'mockScenario':n(d,'--mock-scenario')}:{'mode':p(0x1e5)};}function a(){const s=['--follow','2793553QAGSUn','log','refresh','stop','--stop','includes','1217FpZZOJ','--agent-id','1570hFRFwa','7395525wQEosv','connect','--help','--list','--frontier-url','148gfJpRK','2600832leYvch','help','7777wjZxMh','--env','--daemon','22325WkioHG','--status\x20->\x20status','--pat-token','service','--refresh','538UDOhlC','daemon','file','6uukuQd','1215885thqLKH'];a=function(){return s;};return a();}export function printHelp(){const r=b;console[r(0x1d6)]('licos-bridge\x20-\x20local\x20bridge\x20daemon\x20for\x20LICOS\x20Agent\x20Service\x0a\x0aPair\x20(paste\x20from\x20cloud\x20UI;\x20start/reuse\x20daemon\x20and\x20deliver\x20pair-code):\x0a\x20\x20npx\x20-y\x20--registry=https://registry.npmmirror.com\x20@kmlckj/licos-bridge@latest\x20--pat-token=<token>\x20--pair-code=<code>\x20--handshake-url=<url>\x0a\x0aDaemon\x20control:\x0a\x20\x20licos-bridge\x20status\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20show\x20daemon\x20status\x0a\x20\x20licos-bridge\x20stop\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20stop\x20daemon\x0a\x20\x20licos-bridge\x20refresh\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20re-detect\x20local\x20agent\x20binaries\x0a\x20\x20licos-bridge\x20reload\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20recycle\x20all\x20agent\x20subprocesses\x0a\x20\x20licos-bridge\x20reload\x20--agent-id\x20<id>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20recycle\x20one\x20agent\x20subprocess\x0a\x0aView\x20logs:\x0a\x20\x20licos-bridge\x20log\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20bridge\x20last\x20200\x20lines\x0a\x20\x20licos-bridge\x20log\x20--agent-id\x20<id>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20agent\x20related\x20logs\x0a\x20\x20licos-bridge\x20log\x20[--agent-id\x20<id>]\x20[--date\x20YYYY-MM-DD]\x20\x5c\x0a\x20\x20\x20\x20\x20\x20[-n\x20<N>]\x20[-f]\x20[--level\x20<l>]\x20[--grep\x20<s>]\x20[--raw]\x20[--list]\x0a\x0aUpdate:\x0a\x20\x20licos-bridge\x20update\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20stop\x20daemon\x20and\x20run\x20latest\x20package\x20connect\x0a\x20\x20licos-bridge\x20purge\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20stop\x20daemon\x20+\x20unregister\x20supervisor\x20+\x20remove\x20bridge\x20data\x0a\x0aOS\x20supervisor\x20(auto-start\x20on\x20login):\x0a\x20\x20licos-bridge\x20service\x20install\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20register\x20supervisor\x0a\x20\x20licos-bridge\x20service\x20uninstall\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unregister\x20supervisor\x0a\x0aReconnect:\x0a\x20\x20licos-bridge\x20connect\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reconnect\x20using\x20stored\x20PAT\x0a\x20\x20licos-bridge\x20connect\x20--pat-token\x20<token>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reconnect\x20using\x20specified\x20PAT\x0a\x20\x20licos-bridge\x20connect\x20--env=dev\x20--handshake-url=<url>\x20\x20\x20\x20\x20\x20\x20\x20\x20reconnect\x20with\x20route\x20override\x0a\x0aSend\x20file\x20/\x20image:\x0a\x20\x20licos-bridge\x20send\x20image\x20<path>\x20--agent-id\x20<id>\x20--session-id\x20<id>\x20[--caption\x20\x22...\x22]\x0a\x20\x20licos-bridge\x20send\x20file\x20\x20<path>\x20--agent-id\x20<id>\x20--session-id\x20<id>\x20[--caption\x20\x22...\x22]\x20[--name\x20\x22report.pdf\x22]\x0a\x20\x20licos-bridge\x20send\x20file\x20<uri>\x20--agent-id\x20<id>\x20--session-id\x20<id>\x20--group-file\x20--mime\x20<mimeType>\x20[--name\x20\x22...\x22]\x0a\x0aPair\x20flags:\x0a\x20\x20--env\x20<value>\x0a\x20\x20--handshake-url\x20<url>\x0a\x20\x20--frontier-url\x20<url>\x0a\x20\x20--mock-scenario\x20<name>\x0a\x0aInfo:\x0a\x20\x20licos-bridge\x20--version\x20|\x20-v\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20print\x20current\x20bridge\x20version\x0a\x20\x20licos-bridge\x20--help\x20\x20\x20\x20|\x20-h\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20show\x20this\x20help\x0a\x0aDeprecated\x20flags:\x0a\x20\x20--status\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20licos-bridge\x20status\x0a\x20\x20--stop\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20licos-bridge\x20stop\x0a\x20\x20--install-service\x20\x20\x20->\x20licos-bridge\x20service\x20install\x0a\x20\x20--uninstall\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20licos-bridge\x20purge\x0a\x0aCompatibility:\x0a\x20\x20coze-bridge\x20is\x20provided\x20as\x20a\x20bin\x20alias.\x0a\x0aInternal:\x0a\x20\x20<node>\x20<entry>\x20--daemon\x0a');}function e(c,d){return c['includes'](d);}function b(c,d){c=c-0x1cb;const e=a();let f=e[c];return f;}function n(c,d){const f=d+'=',g=c['find'](j=>j['startsWith'](f));if(g)return g['slice'](f['length']);const h=c['indexOf'](d);return h>=0x0&&c[h+0x1]&&!c[h+0x1]['startsWith']('--')?c[h+0x1]:void 0x0;}
1
+ function a(){const t=['--frontier-url','10937024NMsAXB','status','update','2623790fDawBY','3874576lYKhEy','--grep','pair','--raw','--pat-token','service','help','4367768ZnSsZa','length','--follow','service-install','image','1575237oNBsyT','service-uninstall','--caption','9yAhFCw','--status\x20->\x20status','--agent-id','--env','--tail','version','--session-id','reload','log','--level','--handshake-url','--mock-scenario','purge','daemon','5vtKWqv','597541wJKwOq','1657842dswAsO','--stop\x20->\x20stop'];a=function(){return t;};return a();}(function(c,d){const o=b,f=c();while(!![]){try{const g=-parseInt(o(0x111))/0x1+-parseInt(o(0xf2))/0x2+parseInt(o(0xff))/0x3+parseInt(o(0xf3))/0x4+-parseInt(o(0x110))/0x5*(-parseInt(o(0xec))/0x6)+parseInt(o(0xef))/0x7+parseInt(o(0xfa))/0x8*(-parseInt(o(0x102))/0x9);if(g===d)break;else f['push'](f['shift']());}catch(h){f['push'](f['shift']());}}}(a,0xd61ff));export function parseArgs(c){const p=b,d=[...c];if(0x0===d['length']||e(d,'--help')||e(d,'-h'))return{'mode':'help'};if(e(d,'--version')||e(d,'-v'))return{'mode':p(0x107)};if(e(d,'--daemon'))return{'mode':'daemon'};if(e(d,'--status'))return{'mode':'status','deprecated':p(0x103)};if(e(d,'--stop'))return{'mode':'stop','deprecated':p(0xed)};if(e(d,'--refresh'))return{'mode':'refresh','deprecated':'--refresh\x20->\x20refresh'};if(e(d,'--install-service'))return{'mode':p(0xfd),'deprecated':'--install-service\x20->\x20service\x20install'};if(e(d,'--uninstall'))return{'mode':p(0x10e),'deprecated':'--uninstall\x20->\x20purge'};const [f,g]=d;if('status'===f)return{'mode':p(0xf0)};if('stop'===f)return{'mode':'stop'};if('refresh'===f)return{'mode':'refresh'};if('reload'===f)return{'mode':p(0x109),'agentId':n(d,'--agent-id')};if('log'===f)return{'mode':p(0x10a),'agentId':n(d,p(0x104)),'date':n(d,'--date'),'tail':Number(n(d,'-n')??n(d,p(0x106))??0xc8),'follow':e(d,'-f')||e(d,p(0xfc)),'level':n(d,p(0x10b)),'grep':n(d,p(0xf4)),'raw':e(d,p(0xf6)),'list':e(d,'--list')};if(p(0xf1)===f)return{'mode':p(0xf1)};if('purge'===f)return{'mode':'purge'};if(p(0xf8)===f&&'install'===g)return{'mode':p(0xfd)};if(p(0xf8)===f&&'uninstall'===g)return{'mode':p(0x100)};if('connect'===f)return{'mode':'connect','patToken':n(d,'--pat-token'),'env':n(d,'--env'),'handshakeUrl':n(d,p(0x10c)),'frontierUrl':n(d,p(0xee)),'mockScenario':n(d,'--mock-scenario'),'agentId':n(d,'--agent-id')};if('send'===f)return function(k){const q=p,l=k[0x1],m=k[0x2];return[q(0xfe),'file']['includes'](l)&&m?{'mode':'send','kind':l,'target':m,'agentId':n(k,'--agent-id'),'sessionId':n(k,q(0x108)),'caption':n(k,q(0x101)),'name':n(k,'--name'),'groupFile':e(k,'--group-file'),'mime':n(k,'--mime')}:{'mode':'help'};}(d);if(p(0x10f)===f)return{'mode':'spawn-daemon'};const h=n(d,p(0xf7)),j=n(d,'--pair-code');return h&&j?{'mode':p(0xf5),'patToken':h,'pairCode':j,'agentId':n(d,'--agent-id'),'env':n(d,p(0x105)),'handshakeUrl':n(d,'--handshake-url'),'frontierUrl':n(d,'--frontier-url'),'mockScenario':n(d,p(0x10d))}:{'mode':p(0xf9)};}export function printHelp(){const r=b;console[r(0x10a)]('licos-bridge\x20-\x20local\x20bridge\x20daemon\x20for\x20LICOS\x20Agent\x20Service\x0a\x0aPair\x20(paste\x20from\x20cloud\x20UI;\x20start/reuse\x20daemon\x20and\x20deliver\x20pair-code):\x0a\x20\x20npx\x20-y\x20--registry=https://registry.npmmirror.com\x20@kmlckj/licos-bridge@latest\x20--pat-token=<token>\x20--pair-code=<code>\x20--handshake-url=<url>\x0a\x0aDaemon\x20control:\x0a\x20\x20licos-bridge\x20status\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20show\x20daemon\x20status\x0a\x20\x20licos-bridge\x20stop\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20stop\x20daemon\x0a\x20\x20licos-bridge\x20refresh\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20re-detect\x20local\x20agent\x20binaries\x0a\x20\x20licos-bridge\x20reload\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20recycle\x20all\x20agent\x20subprocesses\x0a\x20\x20licos-bridge\x20reload\x20--agent-id\x20<id>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20recycle\x20one\x20agent\x20subprocess\x0a\x0aView\x20logs:\x0a\x20\x20licos-bridge\x20log\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20bridge\x20last\x20200\x20lines\x0a\x20\x20licos-bridge\x20log\x20--agent-id\x20<id>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20agent\x20related\x20logs\x0a\x20\x20licos-bridge\x20log\x20[--agent-id\x20<id>]\x20[--date\x20YYYY-MM-DD]\x20\x5c\x0a\x20\x20\x20\x20\x20\x20[-n\x20<N>]\x20[-f]\x20[--level\x20<l>]\x20[--grep\x20<s>]\x20[--raw]\x20[--list]\x0a\x0aUpdate:\x0a\x20\x20licos-bridge\x20update\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20stop\x20daemon\x20and\x20run\x20latest\x20package\x20connect\x0a\x20\x20licos-bridge\x20purge\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20stop\x20daemon\x20+\x20unregister\x20supervisor\x20+\x20remove\x20bridge\x20data\x0a\x0aOS\x20supervisor\x20(auto-start\x20on\x20login):\x0a\x20\x20licos-bridge\x20service\x20install\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20register\x20supervisor\x0a\x20\x20licos-bridge\x20service\x20uninstall\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20unregister\x20supervisor\x0a\x0aReconnect:\x0a\x20\x20licos-bridge\x20connect\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reconnect\x20using\x20stored\x20PAT\x0a\x20\x20licos-bridge\x20connect\x20--pat-token\x20<token>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20reconnect\x20using\x20specified\x20PAT\x0a\x20\x20licos-bridge\x20connect\x20--env=dev\x20--handshake-url=<url>\x20\x20\x20\x20\x20\x20\x20\x20\x20reconnect\x20with\x20route\x20override\x0a\x0aSend\x20file\x20/\x20image:\x0a\x20\x20licos-bridge\x20send\x20image\x20<path>\x20--agent-id\x20<id>\x20--session-id\x20<id>\x20[--caption\x20\x22...\x22]\x0a\x20\x20licos-bridge\x20send\x20file\x20\x20<path>\x20--agent-id\x20<id>\x20--session-id\x20<id>\x20[--caption\x20\x22...\x22]\x20[--name\x20\x22report.pdf\x22]\x0a\x20\x20licos-bridge\x20send\x20file\x20<uri>\x20--agent-id\x20<id>\x20--session-id\x20<id>\x20--group-file\x20--mime\x20<mimeType>\x20[--name\x20\x22...\x22]\x0a\x0aPair\x20flags:\x0a\x20\x20--env\x20<value>\x0a\x20\x20--handshake-url\x20<url>\x20\x20\x20\x20\x20\x20\x20required\x20unless\x20LICOS_BRIDGE_HANDSHAKE_URL\x20is\x20set\x20or\x20a\x20saved\x20pairing\x20has\x20it\x0a\x20\x20--frontier-url\x20<url>\x0a\x20\x20env:\x20LICOS_BRIDGE_HANDSHAKE_URL,\x20LICOS_PLATFORM_BASE_URL,\x20AIOS_PLATFORM_BASE_URL\x0a\x20\x20--mock-scenario\x20<name>\x0a\x0aInfo:\x0a\x20\x20licos-bridge\x20--version\x20|\x20-v\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20print\x20current\x20bridge\x20version\x0a\x20\x20licos-bridge\x20--help\x20\x20\x20\x20|\x20-h\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20show\x20this\x20help\x0a\x0aDeprecated\x20flags:\x0a\x20\x20--status\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20licos-bridge\x20status\x0a\x20\x20--stop\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20licos-bridge\x20stop\x0a\x20\x20--install-service\x20\x20\x20->\x20licos-bridge\x20service\x20install\x0a\x20\x20--uninstall\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20licos-bridge\x20purge\x0a\x0aCompatibility:\x0a\x20\x20coze-bridge\x20is\x20provided\x20as\x20a\x20bin\x20alias.\x0a\x0aInternal:\x0a\x20\x20<node>\x20<entry>\x20--daemon\x0a');}function b(c,d){c=c-0xec;const e=a();let f=e[c];return f;}function e(c,d){return c['includes'](d);}function n(c,d){const s=b,f=d+'=',g=c['find'](j=>j['startsWith'](f));if(g)return g['slice'](f[s(0xfb)]);const h=c['indexOf'](d);return h>=0x0&&c[h+0x1]&&!c[h+0x1]['startsWith']('--')?c[h+0x1]:void 0x0;}
package/dist/lib/cloud.js CHANGED
@@ -1 +1 @@
1
- const A=c;(function(m,p){const z=c,q=m();while(!![]){try{const u=parseInt(z(0x100))/0x1+-parseInt(z(0xf8))/0x2*(parseInt(z(0x124))/0x3)+-parseInt(z(0x126))/0x4+parseInt(z(0xfa))/0x5*(parseInt(z(0x108))/0x6)+parseInt(z(0x127))/0x7+-parseInt(z(0x114))/0x8*(-parseInt(z(0x116))/0x9)+-parseInt(z(0x12b))/0xa;if(u===p)break;else q['push'](q['shift']());}catch(v){q['push'](q['shift']());}}}(b,0xdb0c9));function b(){const V=['68805gEXRSs','close','2.0','logger','mockScenario','env','toString','heartbeatTimer','handshakeUrl','pairing','bridgeClientId','agentId','now','content','3259527dgHPWz','connectStored','4014812qWdIbd','10145338TtobXh','startsWith','frontier\x20closed','isConnected','30711780QnEcCN','pair','json','sendFrame','forwardClientRequest','sendResponse','delete','get','2pMmGEJ','sendNotification','8920WNCZIt','\x20timed\x20out','pending','handshake\x20failed:\x20HTTP\x20','patToken','open','1618938RoEAea','_agent/pair','frontier\x20is\x20not\x20connected','accessToken','frontier\x20error','result','connect\x20requires\x20stored\x20pat-token\x20or\x20--pat-token','handlers','4632aXLerY','configFile','agentManager','sendRequest','frontierUrl','error','restored','catch','reconnect','https://www.licos.com','set','pairCode','1688CYsYea','device_id'];b=function(){return V;};return b();}import f from'ws';import{detectFrameworks as g}from'./frameworks.js';import{joinUrl as h,readJson as j,writeJson as k}from'./utils.js';import{resolvePaths as l}from'./paths.js';const a=A(0x111),o='/api/v1/workbench/local-agent-bridge/handshake';function c(a,d){a=a-0xf6;const e=b();let f=e[a];return f;}export class CloudConnector{constructor({logger:m}){const B=A;this[B(0x119)]=m,this['ws']=void 0x0,this['pairing']=void 0x0,this['handlers']=new Map(),this['pending']=new Map(),this[B(0x11d)]=void 0x0,this[B(0x10a)]=void 0x0;}['setAgentManager'](m){this['agentManager']=m;}['on'](m,p){const C=A;this['handlers'][C(0x112)](m,p);}async['restore'](){const D=A,m=await j(l()[D(0x109)],{})[D(0x10f)](()=>({}));m?.['pairing']?.['patToken']&&m?.['pairing']?.['pairCode']&&await this['pair'](m['pairing'],{'restored':!0x0})['catch'](p=>{const E=D;this[E(0x119)]?.('restore\x20pair\x20failed',{'error':String(p)});});}async[A(0x12c)](m,p={}){const F=A;this[F(0x11f)]={'handshakeUrl':m[F(0x11e)]||a,'frontierUrl':m[F(0x10c)],'env':m[F(0x11b)],'mockScenario':m['mockScenario'],'agentId':m['agentId'],'patToken':m[F(0xfe)],'pairCode':m['pairCode']},await k(l()['configFile'],{'pairing':this[F(0x11f)],'updatedAt':new Date()['toISOString']()},0x180);const q=await this['handshake'](),u=m['frontierUrl']||d(q,['frontierUrl','frontier_url']);return u&&await this['connect'](u,q),!p[F(0x10e)]&&m[F(0x121)]&&this[F(0xf9)](F(0x101),{'agentId':m[F(0x121)]})[F(0x10f)](()=>{}),{'ok':!0x0,'deviceId':d(q,['deviceId',F(0x115)]),'bridgeClientId':d(q,[F(0x120),'bridge_client_id']),'frontierConnected':Boolean(this['ws']&&this['ws']['readyState']===f['OPEN'])};}async[A(0x125)](m={}){const G=A,p=await j(l()['configFile'],{})['catch'](()=>({})),q=p?.['pairing']??{},u=m['patToken']||q['patToken'];if(!u)throw new Error(G(0x106));return this[G(0x12c)]({...q,...m,'patToken':u,'pairCode':m['pairCode']??q[G(0x113)]},{'connectOnly':!0x0});}async['handshake'](){const H=A,m=await g(),p=(q=this['pairing'][H(0x11e)])?/\/handshake\/?$/['test'](q)?q:h(q,o):h(a,o);var q;const u=await fetch(p,{'method':'POST','headers':{'content-type':'application/json','authorization':'Bearer\x20'+this[H(0x11f)][H(0xfe)],...this['pairing']['env']?{'x-licos-env':this['pairing']['env']}:{},...this['pairing'][H(0x11a)]?{'x-mock-scenario':this['pairing']['mockScenario']}:{}},'body':JSON['stringify']({'pairCode':this[H(0x11f)][H(0x113)],'pair_code':this[H(0x11f)]['pairCode'],'agentId':this['pairing']['agentId'],'agent_id':this['pairing']['agentId'],'mockScenario':this['pairing']['mockScenario'],'mock_scenario':this['pairing']['mockScenario'],'device':{'hostname':process.env.COMPUTERNAME||process.env.HOSTNAME||'','platform':process['platform'],'arch':process['arch'],'nodeVersion':process['version']},'frameworks':m})});if(!u['ok'])throw new Error(H(0xfd)+u['status']+'\x20'+await u['text']());const v=await u[H(0x12d)]();return v['data']??v;}async['connect'](m,p){const I=A;await this['stop'](I(0x110));const q=d(p,[I(0x103),'access_token','frontierToken','frontier_token'])||this['pairing']['patToken'];this['ws']=new f(m,{'headers':{'authorization':'Bearer\x20'+q,...this['pairing'][I(0x11b)]?{'x-licos-env':this['pairing'][I(0x11b)]}:{}}}),this['ws']['on'](I(0xff),()=>{const J=I;this[J(0x119)]?.('frontier\x20connected',{'frontierUrl':m}),this['sendHealth']()[J(0x10f)](()=>{}),this[J(0x11d)]=setInterval(()=>this['sendHealth']()['catch'](()=>{}),0x2710);}),this['ws']['on']('message',u=>{this['handleFrame'](u['toString']('utf8'))['catch'](v=>{this['logger']?.('frontier\x20frame\x20failed',{'error':String(v)});});}),this['ws']['on'](I(0x117),(u,v)=>{const K=I;this['logger']?.(K(0x129),{'code':u,'reason':v[K(0x11c)]()}),clearInterval(this[K(0x11d)]),this['heartbeatTimer']=void 0x0;}),this['ws']['on']('error',u=>{const L=I;this['logger']?.(L(0x104),{'error':String(u)});});}async['handleFrame'](m){const M=A,p=JSON['parse'](m);if(void 0x0!==p['id']&&(void 0x0!==p['result']||void 0x0!==p[M(0x10d)])){const v=this['pending'][M(0xf7)](p['id']);return void(v&&(this[M(0xfc)]['delete'](p['id']),p['error']?v['reject'](new Error(p['error']['message']||JSON['stringify'](p['error']))):v['resolve'](p[M(0x105)])));}const q=p['method']||p['type'],u=this[M(0x107)][M(0xf7)](q)||(q?.[M(0x128)]('session/')?this[M(0x107)]['get']('session/*'):void 0x0);if(u)try{const w=await u(p['params']??p[M(0x123)]??{});void 0x0!==p['id']&&await this['sendResponse'](p['id'],w);}catch(x){if(void 0x0===p['id'])throw x;await this[M(0x130)](p['id'],void 0x0,{'code':-0x7f5b,'message':x['message']||String(x)});}else void 0x0!==p['id']&&await this[M(0x130)](p['id'],void 0x0,{'code':-0x7f59,'message':'method\x20not\x20found:\x20'+q});}async['sendHealth'](){await this['sendNotification']('_agent/health',{'agents':this['agentManager']?.['health']()??[],'ts':Date['now']()});}async[A(0xf9)](m,p){const N=A;await this[N(0x12e)]({'jsonrpc':'2.0','method':m,'params':p});}async[A(0x130)](m,p,q){const O=A;await this['sendFrame'](q?{'jsonrpc':O(0x118),'id':m,'error':q}:{'jsonrpc':'2.0','id':m,'result':p});}async['sendRequest'](m,p,q=0x7530){const P=A,u=Date[P(0x122)]()+'-'+Math['random']()['toString'](0x10)['slice'](0x2);return await this[P(0x12e)]({'jsonrpc':P(0x118),'id':u,'method':m,'params':p}),new Promise((v,w)=>{const x=setTimeout(()=>{const Q=c;this['pending'][Q(0xf6)](u),w(new Error(m+Q(0xfb)));},q);this['pending']['set'](u,{'resolve':y=>{clearTimeout(x),v(y);},'reject':y=>{clearTimeout(x),w(y);}});});}async[A(0x12f)](m,p,q){const R=A;if(this[R(0x12a)]())return this[R(0x10b)]('_agent/client_request',{'agentId':m['agentId'],'method':p,'params':q})['catch'](()=>{});}async['sendBridgeFile'](m){const S=A;if(!this['isConnected']())throw new Error(S(0x102));return this[S(0x10b)]('_agent/sendFile',m,0x1d4c0);}async[A(0x12e)](m){const T=A;if(!this[T(0x12a)]())throw new Error('frontier\x20is\x20not\x20connected');this['ws']['send'](JSON['stringify'](m));}[A(0x12a)](){return Boolean(this['ws']&&this['ws']['readyState']===f['OPEN']);}async['stop'](m){const U=A;clearInterval(this['heartbeatTimer']),this[U(0x11d)]=void 0x0,this['ws']&&(this['logger']?.('closing\x20frontier',{'reason':m}),this['ws'][U(0x117)](),this['ws']=void 0x0);}}function d(m,p){for(const q of p)if(void 0x0!==m?.[q]&&null!==m[q]&&''!==m[q])return m[q];}
1
+ const E=f;function b(){const Z=['1592256hBdDKf','stop','application/json','method','10436CdSTCX','logger','handlers','120bhqzPD','platform','103662InWxZD','sendNotification','reject','accessToken','open','restore\x20pair\x20failed','pending','frontierUrl','session/*','frontier\x20error','delete','pairing','agentManager','set','data','resolve','patToken','version','handshake','1707525quVaAX','readyState','closing\x20frontier','restored','Bearer\x20','pairCode','pair','stringify','reconnect','now','2079760zYYCfe','https://www.licos.com','frontier\x20closed','_agent/client_request','handshakeUrl','2.0','get','sendBridgeFile','setAgentManager','59tLDoIj','catch','agentId','6uHvMKR','message','1713990mJZQQp','configFile','mockScenario','550543CIglXp','heartbeatTimer','env','close','handleFrame'];b=function(){return Z;};return b();}(function(v,w){const D=f,x=v();while(!![]){try{const y=-parseInt(D(0x108))/0x1*(parseInt(D(0x119))/0x2)+parseInt(D(0x115))/0x3+-parseInt(D(0xff))/0x4+parseInt(D(0xf5))/0x5+parseInt(D(0x10b))/0x6*(-parseInt(D(0x110))/0x7)+-parseInt(D(0x11c))/0x8*(-parseInt(D(0x11e))/0x9)+parseInt(D(0x10d))/0xa;if(y===w)break;else x['push'](x['shift']());}catch(z){x['push'](x['shift']());}}}(b,0x4bad7));import j from'ws';import{detectFrameworks as k}from'./frameworks.js';import{joinUrl as l,readJson as m,writeJson as q}from'./utils.js';import{resolvePaths as u}from'./paths.js';const s=E(0x100),a='/api/v1/workbench/local-agent-bridge/handshake',c=['LICOS_BRIDGE_HANDSHAKE_URL','LICOS_PLATFORM_BASE_URL','AIOS_PLATFORM_BASE_URL'];function f(a,c){a=a-0xe5;const d=b();let e=d[a];return e;}export class CloudConnector{constructor({logger:v}){const F=E;this['logger']=v,this['ws']=void 0x0,this['pairing']=void 0x0,this[F(0x11b)]=new Map(),this[F(0xe8)]=new Map(),this['heartbeatTimer']=void 0x0,this[F(0xee)]=void 0x0;}[E(0x107)](v){this['agentManager']=v;}['on'](v,w){const G=E;this[G(0x11b)][G(0xef)](v,w);}async['restore'](){const H=E,v=await m(u()[H(0x10e)],{})['catch'](()=>({}));v?.[H(0xed)]?.['patToken']&&v?.[H(0xed)]?.['pairCode']&&await this['pair'](v[H(0xed)],{'restored':!0x0})[H(0x109)](w=>{const I=H;this[I(0x11a)]?.(I(0xe7),{'error':String(w)});});}async[E(0xfb)](v,w={}){const J=E;this['pairing']={'handshakeUrl':h(v,w),'frontierUrl':v['frontierUrl'],'env':v['env'],'mockScenario':v[J(0x10f)],'agentId':v['agentId'],'patToken':v['patToken'],'pairCode':v['pairCode']},await q(u()[J(0x10e)],{'pairing':this['pairing'],'updatedAt':new Date()['toISOString']()},0x180);const x=await this[J(0xf4)](),y=v['frontierUrl']||g(x,[J(0xe9),'frontier_url']);return y&&await this['connect'](y,x),!w[J(0xf8)]&&v[J(0x10a)]&&this[J(0x11f)]('_agent/pair',{'agentId':v['agentId']})['catch'](()=>{}),{'ok':!0x0,'deviceId':g(x,['deviceId','device_id']),'bridgeClientId':g(x,['bridgeClientId','bridge_client_id']),'frontierConnected':Boolean(this['ws']&&this['ws'][J(0xf6)]===j['OPEN'])};}async['connectStored'](v={}){const K=E,w=await m(u()[K(0x10e)],{})['catch'](()=>({})),x=w?.[K(0xed)]??{},y=v['patToken']||x['patToken'];if(!y)throw new Error('connect\x20requires\x20stored\x20pat-token\x20or\x20--pat-token');return this['pair']({...x,...v,'patToken':y,'pairCode':v[K(0xfa)]??x['pairCode']},{'connectOnly':!0x0});}async[E(0xf4)](){const L=E,v=await k(),w=function(z){if(!z)throw new Error('handshake-url\x20is\x20required;\x20copy\x20the\x20connection\x20command\x20from\x20the\x20current\x20platform\x20or\x20set\x20LICOS_BRIDGE_HANDSHAKE_URL');return/\/handshake\/?$/['test'](z)?z:l(z,a);}(this['pairing'][L(0x103)]),x=await fetch(w,{'method':'POST','headers':{'content-type':L(0x117),'authorization':L(0xf9)+this[L(0xed)][L(0xf2)],...this[L(0xed)][L(0x112)]?{'x-licos-env':this['pairing']['env']}:{},...this['pairing'][L(0x10f)]?{'x-mock-scenario':this[L(0xed)]['mockScenario']}:{}},'body':JSON['stringify']({'pairCode':this[L(0xed)]['pairCode'],'pair_code':this[L(0xed)]['pairCode'],'agentId':this[L(0xed)]['agentId'],'agent_id':this[L(0xed)]['agentId'],'mockScenario':this[L(0xed)][L(0x10f)],'mock_scenario':this[L(0xed)][L(0x10f)],'device':{'hostname':process.env.COMPUTERNAME||process.env.HOSTNAME||'','platform':process[L(0x11d)],'arch':process['arch'],'nodeVersion':process[L(0xf3)]},'frameworks':v})});if(!x['ok'])throw new Error('handshake\x20failed:\x20HTTP\x20'+x['status']+'\x20'+await x['text']());const y=await x['json']();return y[L(0xf0)]??y;}async['connect'](v,w){const M=E;await this[M(0x116)](M(0xfd));const x=g(w,[M(0xe5),'access_token','frontierToken','frontier_token'])||this[M(0xed)]['patToken'];this['ws']=new j(v,{'headers':{'authorization':M(0xf9)+x,...this['pairing']['env']?{'x-licos-env':this['pairing']['env']}:{}}}),this['ws']['on'](M(0xe6),()=>{const N=M;this['logger']?.('frontier\x20connected',{'frontierUrl':v}),this['sendHealth']()[N(0x109)](()=>{}),this['heartbeatTimer']=setInterval(()=>this['sendHealth']()[N(0x109)](()=>{}),0x2710);}),this['ws']['on'](M(0x10c),y=>{const O=M;this[O(0x114)](y['toString']('utf8'))[O(0x109)](z=>{this['logger']?.('frontier\x20frame\x20failed',{'error':String(z)});});}),this['ws']['on']('close',(y,z)=>{const P=M;this['logger']?.(P(0x101),{'code':y,'reason':z['toString']()}),clearInterval(this['heartbeatTimer']),this['heartbeatTimer']=void 0x0;}),this['ws']['on']('error',y=>{const Q=M;this[Q(0x11a)]?.(Q(0xeb),{'error':String(y)});});}async[E(0x114)](v){const R=E,w=JSON['parse'](v);if(void 0x0!==w['id']&&(void 0x0!==w['result']||void 0x0!==w['error'])){const z=this['pending']['get'](w['id']);return void(z&&(this[R(0xe8)]['delete'](w['id']),w['error']?z[R(0x120)](new Error(w['error']['message']||JSON['stringify'](w['error']))):z[R(0xf1)](w['result'])));}const x=w[R(0x118)]||w['type'],y=this['handlers'][R(0x105)](x)||(x?.['startsWith']('session/')?this['handlers']['get'](R(0xea)):void 0x0);if(y)try{const A=await y(w['params']??w['content']??{});void 0x0!==w['id']&&await this['sendResponse'](w['id'],A);}catch(B){if(void 0x0===w['id'])throw B;await this['sendResponse'](w['id'],void 0x0,{'code':-0x7f5b,'message':B['message']||String(B)});}else void 0x0!==w['id']&&await this['sendResponse'](w['id'],void 0x0,{'code':-0x7f59,'message':'method\x20not\x20found:\x20'+x});}async['sendHealth'](){await this['sendNotification']('_agent/health',{'agents':this['agentManager']?.['health']()??[],'ts':Date['now']()});}async['sendNotification'](v,w){await this['sendFrame']({'jsonrpc':'2.0','method':v,'params':w});}async['sendResponse'](v,w,x){const S=E;await this['sendFrame'](x?{'jsonrpc':S(0x104),'id':v,'error':x}:{'jsonrpc':'2.0','id':v,'result':w});}async['sendRequest'](v,w,x=0x7530){const T=E,y=Date[T(0xfe)]()+'-'+Math['random']()['toString'](0x10)['slice'](0x2);return await this['sendFrame']({'jsonrpc':'2.0','id':y,'method':v,'params':w}),new Promise((z,A)=>{const B=setTimeout(()=>{const U=f;this['pending'][U(0xec)](y),A(new Error(v+'\x20timed\x20out'));},x);this['pending']['set'](y,{'resolve':C=>{clearTimeout(B),z(C);},'reject':C=>{clearTimeout(B),A(C);}});});}async['forwardClientRequest'](v,w,x){const V=E;if(this['isConnected']())return this['sendRequest'](V(0x102),{'agentId':v[V(0x10a)],'method':w,'params':x})['catch'](()=>{});}async[E(0x106)](v){if(!this['isConnected']())throw new Error('frontier\x20is\x20not\x20connected');return this['sendRequest']('_agent/sendFile',v,0x1d4c0);}async['sendFrame'](v){const W=E;if(!this['isConnected']())throw new Error('frontier\x20is\x20not\x20connected');this['ws']['send'](JSON[W(0xfc)](v));}['isConnected'](){const X=E;return Boolean(this['ws']&&this['ws'][X(0xf6)]===j['OPEN']);}async['stop'](v){const Y=E;clearInterval(this[Y(0x111)]),this[Y(0x111)]=void 0x0,this['ws']&&(this['logger']?.(Y(0xf7),{'reason':v}),this['ws'][Y(0x113)](),this['ws']=void 0x0);}}function h(v,w){const x=p(v?.['handshakeUrl']);if(x){if((w['restored']||w['connectOnly'])&&function(z){const A=z['replace'](/\/+$/,'');return A===s||A===''+s+a;}(x)){const z=d();if(z)return z;throw new Error('stored\x20handshake-url\x20points\x20to\x20legacy\x20default\x20https://www.licos.com;\x20copy\x20a\x20fresh\x20connection\x20command\x20from\x20the\x20target\x20platform\x20or\x20set\x20LICOS_BRIDGE_HANDSHAKE_URL');}return x;}const y=d();if(y)return y;throw new Error('handshake-url\x20is\x20required;\x20copy\x20the\x20connection\x20command\x20from\x20the\x20current\x20platform\x20or\x20set\x20LICOS_BRIDGE_HANDSHAKE_URL');}function d(){for(const v of c){const w=p(process.env[v]);if(w)return w;}}function p(v){if(null!=v)return String(v)['trim']()||void 0x0;}function g(v,w){for(const x of w)if(void 0x0!==v?.[x]&&null!==v[x]&&''!==v[x])return v[x];}
@@ -1 +1 @@
1
- (function(z,A){const N=f,B=z();while(!![]){try{const C=parseInt(N(0x135))/0x1+parseInt(N(0x125))/0x2+-parseInt(N(0x12d))/0x3+-parseInt(N(0x12a))/0x4+-parseInt(N(0x123))/0x5+parseInt(N(0x11c))/0x6*(parseInt(N(0x11f))/0x7)+-parseInt(N(0x11d))/0x8*(-parseInt(N(0x13b))/0x9);if(C===A)break;else B['push'](B['shift']());}catch(D){B['push'](B['shift']());}}}(b,0xc2c56));function b(){const U=['994734wzdYLL','agentId','reason','headers','listSkills','_agent/create','url','127.0.0.1','1042169gzkoRD','_agent/health','POST','health','/reload','_agent/addSkills','1222101osLReG','not\x20found','handleSession','toISOString','disconnect','pid','port','session/cancel','stringify','54ANBgVx','24HFgzJq','/send','47159sekytG','ipc\x20request\x20failed','session/new','/refresh','6705090PoDxHT','_agent/getFileContent','2556456iAQfhq','method','catch','_agent/listSkills','detail','1272076cEMTPm','isConnected','configFile'];b=function(){return U;};return b();}import{createServer as g}from'node:http';import{randomBytes as h}from'node:crypto';import{detectFrameworks as j}from'./frameworks.js';import{AgentManager as k}from'./agent-manager.js';import{CloudConnector as m}from'./cloud.js';import{resolvePaths as q}from'./paths.js';import{appendLog as u,ensureDir as v,readText as w,writeJson as x,writePrivateText as y}from'./utils.js';function f(a,c){a=a-0x115;const d=b();let e=d[a];return e;}export async function startDaemonServer(){const O=f,z=q();await v(z['bridgeRoot']),await v(z['agentsRoot']);const A=(F,G)=>u(z['logFile'],F,G)[O(0x127)](()=>{}),B=new m({'logger':A}),C=new k({'cloud':B,'logger':A});B['setAgentManager'](C),await C['loadPersistedAgents'](),B['on'](O(0x132),F=>C['createOrUpdate'](F)),B['on']('_agent/detail',F=>C[O(0x129)](F)),B['on']('_agent/update',F=>C['createOrUpdate'](F)),B['on']('_agent/disconnect',async F=>(await C[O(0x117)](F[O(0x12e)],F[O(0x12f)]),{'ok':!0x0})),B['on'](O(0x136),()=>({'agents':C[O(0x138)]()})),B['on']('_agent/getFileTree',F=>C['getFileTree'](F)),B['on'](O(0x124),F=>C['getFileContent'](F)),B['on'](O(0x128),F=>C[O(0x131)](F)),B['on'](O(0x13a),F=>C['addSkills'](F)),B['on']('_agent/removeSkills',F=>C['removeSkills'](F)),B['on']('session/*',F=>C['handleSession'](F[O(0x126)]||F['_method']||'session/prompt',F)),B['on']('session/new',F=>C['handleSession'](O(0x121),F)),B['on']('session/prompt',F=>C[O(0x115)]('session/prompt',F)),B['on']('session/cancel',F=>C['handleSession'](O(0x11a),F));const D=await async function(F){const P=O,G=await w(F['tokenFile']);if(G?.['trim']())return G['trim']();const H=h(0x18)['toString']('hex');return await y(F['tokenFile'],H),await x(F[P(0x12c)],{'createdAt':new Date()[P(0x116)]()},0x180),H;}(z),E=g(async(F,G)=>{const R=O;try{if(!function(I,J){const Q=f;return(I[Q(0x130)]['authorization']||'')==='Bearer\x20'+J;}(F,D))return p(G,0x191,{'ok':!0x1,'error':'unauthorized'});const H=await function(I){return new Promise((J,K)=>{const L=[];I['on']('data',M=>L['push'](M)),I['on']('error',K),I['on']('end',()=>{if(0x0===L['length'])return J({});const M=Buffer['concat'](L)['toString']('utf8');J(M?JSON['parse'](M):{});});});}(F);if('GET'===F['method']&&'/status'===F[R(0x133)])return p(G,0xc8,{'ok':!0x0,'pid':process[R(0x118)],'frontierConnected':B[R(0x12b)](),'frameworks':await j(),'agents':C['health']()});if(R(0x137)===F['method']&&'/pair'===F['url'])return p(G,0xc8,await B['pair'](H));if('POST'===F['method']&&'/connect'===F['url'])return p(G,0xc8,await B['connectStored'](H));if(R(0x137)===F['method']&&R(0x122)===F[R(0x133)])return p(G,0xc8,{'ok':!0x0,'frameworks':await j()});if('POST'===F[R(0x126)]&&R(0x139)===F['url'])return p(G,0xc8,await C['reload'](H[R(0x12e)]));if('POST'===F['method']&&R(0x11e)===F['url'])return p(G,0xc8,await B['sendBridgeFile'](H));if('POST'===F['method']&&'/stop'===F[R(0x133)])return p(G,0xc8,{'ok':!0x0}),await B['stop']('ipc\x20stop'),await C['stopAll']('ipc\x20stop'),void E['close'](()=>process['exit'](0x0));p(G,0x194,{'ok':!0x1,'error':R(0x13c)});}catch(I){await A(R(0x120),{'url':F['url'],'error':String(I)}),p(G,0x1f4,{'ok':!0x1,'error':I['message']||String(I)});}});E['listen'](0x0,O(0x134),async()=>{const S=O,F=E['address']();await y(z['portFile'],String(F[S(0x119)])),await y(z['pidFile'],String(process['pid'])),await A('daemon\x20started',{'pid':process['pid'],'port':F['port']}),await B['restore']();});}function p(z,A,B){const T=f;z['writeHead'](A,{'content-type':'application/json;\x20charset=utf-8'}),z['end'](JSON[T(0x11b)](B));}
1
+ (function(z,A){const N=f,B=z();while(!![]){try{const C=parseInt(N(0x123))/0x1+parseInt(N(0x127))/0x2*(parseInt(N(0x122))/0x3)+-parseInt(N(0x13b))/0x4*(-parseInt(N(0x149))/0x5)+-parseInt(N(0x128))/0x6+-parseInt(N(0x12f))/0x7*(parseInt(N(0x14c))/0x8)+parseInt(N(0x12e))/0x9+-parseInt(N(0x135))/0xa;if(C===A)break;else B['push'](B['shift']());}catch(D){B['push'](B['shift']());}}}(b,0xafcf7));import{createServer as g}from'node:http';function b(){const W=['68wonoEL','reason','close','_agent/getFileTree','/connect','end','authorization','utf8','connectStored','configFile','ipc\x20request\x20failed','listen','logFile','_agent/health','244905KIPVWw','ipc\x20stop','health','1544YQZTiQ','stopAll','toString','bridgeRoot','port','_agent/getFileContent','method','handleSession','GET','POST','717NodcYt','245043Hbxxwm','writeHead','/reload','session/new','9648dmpcEg','1311462XFVnQV','session/prompt','session/cancel','error','tokenFile','_agent/update','3821229tpCnsN','6587MdAaIY','not\x20found','restore','getFileContent','data','Bearer\x20','15349280ivRvTo','address','length','pid','isConnected','url'];b=function(){return W;};return b();}function f(a,c){a=a-0x11c;const d=b();let e=d[a];return e;}import{randomBytes as h}from'node:crypto';import{detectFrameworks as j}from'./frameworks.js';import{AgentManager as k}from'./agent-manager.js';import{CloudConnector as m}from'./cloud.js';import{resolvePaths as q}from'./paths.js';import{appendLog as u,ensureDir as v,readText as w,writeJson as x,writePrivateText as y}from'./utils.js';export async function startDaemonServer(){const O=f,z=q();await v(z[O(0x14f)]),await v(z['agentsRoot']);const A=(F,G)=>u(z[O(0x147)],F,G)['catch'](()=>{}),B=new m({'logger':A}),C=new k({'cloud':B,'logger':A});B['setAgentManager'](C),await C['loadPersistedAgents'](),B['on']('_agent/create',F=>C['createOrUpdate'](F)),B['on']('_agent/detail',F=>C['detail'](F)),B['on'](O(0x12d),F=>C['createOrUpdate'](F)),B['on']('_agent/disconnect',async F=>(await C['disconnect'](F['agentId'],F[O(0x13c)]),{'ok':!0x0})),B['on'](O(0x148),()=>({'agents':C['health']()})),B['on'](O(0x13e),F=>C['getFileTree'](F)),B['on'](O(0x11d),F=>C[O(0x132)](F)),B['on']('_agent/listSkills',F=>C['listSkills'](F)),B['on']('_agent/addSkills',F=>C['addSkills'](F)),B['on']('_agent/removeSkills',F=>C['removeSkills'](F)),B['on']('session/*',F=>C[O(0x11f)](F[O(0x11e)]||F['_method']||'session/prompt',F)),B['on'](O(0x126),F=>C[O(0x11f)]('session/new',F)),B['on'](O(0x129),F=>C['handleSession']('session/prompt',F)),B['on'](O(0x12a),F=>C[O(0x11f)](O(0x12a),F));const D=await async function(F){const P=O,G=await w(F[P(0x12c)]);if(G?.['trim']())return G['trim']();const H=h(0x18)[P(0x14e)]('hex');return await y(F['tokenFile'],H),await x(F[P(0x144)],{'createdAt':new Date()['toISOString']()},0x180),H;}(z),E=g(async(F,G)=>{const T=O;try{if(!function(I,J){const Q=f;return(I['headers'][Q(0x141)]||'')===Q(0x134)+J;}(F,D))return p(G,0x191,{'ok':!0x1,'error':'unauthorized'});const H=await function(I){return new Promise((J,K)=>{const R=f,L=[];I['on'](R(0x133),M=>L['push'](M)),I['on'](R(0x12b),K),I['on']('end',()=>{const S=R;if(0x0===L[S(0x137)])return J({});const M=Buffer['concat'](L)['toString'](S(0x142));J(M?JSON['parse'](M):{});});});}(F);if(T(0x120)===F['method']&&'/status'===F[T(0x13a)])return p(G,0xc8,{'ok':!0x0,'pid':process[T(0x138)],'frontierConnected':B[T(0x139)](),'frameworks':await j(),'agents':C[T(0x14b)]()});if('POST'===F[T(0x11e)]&&'/pair'===F['url'])return p(G,0xc8,await B['pair'](H));if(T(0x121)===F['method']&&T(0x13f)===F[T(0x13a)])return p(G,0xc8,await B[T(0x143)](H));if('POST'===F['method']&&'/refresh'===F[T(0x13a)])return p(G,0xc8,{'ok':!0x0,'frameworks':await j()});if('POST'===F[T(0x11e)]&&T(0x125)===F['url'])return p(G,0xc8,await C['reload'](H['agentId']));if(T(0x121)===F[T(0x11e)]&&'/send'===F[T(0x13a)])return p(G,0xc8,await B['sendBridgeFile'](H));if('POST'===F['method']&&'/stop'===F['url'])return p(G,0xc8,{'ok':!0x0}),await B['stop'](T(0x14a)),await C[T(0x14d)]('ipc\x20stop'),void E[T(0x13d)](()=>process['exit'](0x0));p(G,0x194,{'ok':!0x1,'error':T(0x130)});}catch(I){await A(T(0x145),{'url':F['url'],'error':String(I)}),p(G,0x1f4,{'ok':!0x1,'error':I['message']||String(I)});}});E[O(0x146)](0x0,'127.0.0.1',async()=>{const U=O,F=E[U(0x136)]();await y(z['portFile'],String(F[U(0x11c)])),await y(z['pidFile'],String(process['pid'])),await A('daemon\x20started',{'pid':process['pid'],'port':F[U(0x11c)]}),await B[U(0x131)]();});}function p(z,A,B){const V=f;z[V(0x124)](A,{'content-type':'application/json;\x20charset=utf-8'}),z[V(0x140)](JSON['stringify'](B));}
@@ -1 +1 @@
1
- (function(k,l){const y=d,m=k();while(!![]){try{const p=parseInt(y(0x1b2))/0x1*(-parseInt(y(0x1a7))/0x2)+parseInt(y(0x1aa))/0x3*(-parseInt(y(0x1a3))/0x4)+parseInt(y(0x1a6))/0x5*(parseInt(y(0x1ab))/0x6)+parseInt(y(0x1a9))/0x7*(parseInt(y(0x19b))/0x8)+-parseInt(y(0x19e))/0x9*(parseInt(y(0x1a8))/0xa)+parseInt(y(0x19d))/0xb+-parseInt(y(0x1af))/0xc;if(p===l)break;else m['push'](m['shift']());}catch(q){m['push'](m['shift']());}}}(b,0x2ea6c));import{fileURLToPath as f}from'node:url';function d(a,c){a=a-0x19b;const e=b();let f=e[a];return f;}import{readFile as g}from'node:fs/promises';import h from'node:path';import{commandVersion as i,findExecutable as j}from'./utils.js';export async function detectFrameworks(){const z=d,k=[],l=j(z(0x1a1)),m=j('codex'),p=j('openclaw');return k[z(0x1ae)]({'id':'claude-code','name':'Claude\x20Code','installed':Boolean(l),'command':l,'version':l?i(l):void 0x0,'acpPackage':'@agentclientprotocol/claude-agent-acp','acpBin':'claude-agent-acp'}),k['push']({'id':z(0x1b0),'name':'Codex','installed':Boolean(m||await r('@zed-industries/codex-acp/bin/codex-acp.js')),'command':m,'version':m?i(m):void 0x0,'acpPackage':z(0x19c),'acpBin':z(0x19f)}),k['push']({'id':'openclaw','name':'OpenClaw','installed':Boolean(p),'command':p,'version':p?i(p):void 0x0,'acpPackage':void 0x0,'acpBin':void 0x0}),k;}function b(){const C=['string','4NkXJoc','execPath','parse','10145ekldly','63638gjIYkO','10hpstNH','1393651yHnhcI','105423ItUnXP','996EjGUAV','@agentclientprotocol/claude-agent-acp','ACP\x20runtime\x20is\x20not\x20supported\x20for\x20framework:\x20','push','2887848gUVsNh','codex','claude-code','5IFZhBn','8HoYBPf','@zed-industries/codex-acp','4129752ohdjKf','2568285LPFUPR','codex-acp','utf8','claude'];b=function(){return C;};return b();}export async function resolveAcpBin(k){const A=d;if(A(0x1b0)===k){const l=import.meta.resolve('@zed-industries/codex-acp/bin/codex-acp.js');return{'command':process[A(0x1a4)],'args':[f(l)]};}if(A(0x1b1)===k)return async function(m,p){const B=A,q=import.meta.resolve(m+'/package.json'),u=f(q),v=h['dirname'](u),w=JSON[B(0x1a5)](await g(u,B(0x1a0))),x=B(0x1a2)==typeof w['bin']?w['bin']:w['bin']?.[p];if(!x)throw new Error(m+'\x20package.json\x20has\x20no\x20bin\x20'+p);return{'command':process['execPath'],'args':[h['join'](v,x)]};}(A(0x1ac),'claude-agent-acp');throw new Error(A(0x1ad)+k);}async function r(k){try{return import.meta.resolve(k),!0x0;}catch{return!0x1;}}
1
+ (function(k,l){const y=d,m=k();while(!![]){try{const p=-parseInt(y(0xc5))/0x1+parseInt(y(0xbd))/0x2*(-parseInt(y(0xc8))/0x3)+-parseInt(y(0xbe))/0x4+-parseInt(y(0xc2))/0x5*(-parseInt(y(0xcf))/0x6)+parseInt(y(0xc9))/0x7+parseInt(y(0xc1))/0x8*(parseInt(y(0xc6))/0x9)+parseInt(y(0xcd))/0xa*(parseInt(y(0xd0))/0xb);if(p===l)break;else m['push'](m['shift']());}catch(q){m['push'](m['shift']());}}}(b,0xbd3bb));import{fileURLToPath as f}from'node:url';import{readFile as g}from'node:fs/promises';import h from'node:path';import{commandVersion as i,findExecutable as j}from'./utils.js';function b(){const C=['utf8','2753874IwlZwV','8965QRKsBZ','3392ijPhUB','1319768sWlElu','execPath','@zed-industries/codex-acp/bin/codex-acp.js','32NiwTrG','10ibuClN','codex','parse','559529kFqkTS','2201751BgIkdg','bin','1785SdEWeh','1178597AsqJJD','@agentclientprotocol/claude-agent-acp','push','openclaw','7470HjLHBe'];b=function(){return C;};return b();}function d(a,c){a=a-0xbd;const e=b();let f=e[a];return f;}export async function detectFrameworks(){const z=d,k=[],l=j('claude'),m=j('codex'),p=j(z(0xcc));return k['push']({'id':'claude-code','name':'Claude\x20Code','installed':Boolean(l),'command':l,'version':l?i(l):void 0x0,'acpPackage':z(0xca),'acpBin':'claude-agent-acp'}),k['push']({'id':z(0xc3),'name':'Codex','installed':Boolean(m||await r(z(0xc0))),'command':m,'version':m?i(m):void 0x0,'acpPackage':'@zed-industries/codex-acp','acpBin':'codex-acp'}),k[z(0xcb)]({'id':'openclaw','name':'OpenClaw','installed':Boolean(p),'command':p,'version':p?i(p):void 0x0,'acpPackage':void 0x0,'acpBin':void 0x0}),k;}export async function resolveAcpBin(k){const B=d;if('codex'===k){const l=import.meta.resolve('@zed-industries/codex-acp/bin/codex-acp.js');return{'command':process['execPath'],'args':[f(l)]};}if('claude-code'===k)return async function(m,p){const A=d,q=import.meta.resolve(m+'/package.json'),u=f(q),v=h['dirname'](u),w=JSON[A(0xc4)](await g(u,A(0xce))),x='string'==typeof w['bin']?w[A(0xc7)]:w[A(0xc7)]?.[p];if(!x)throw new Error(m+'\x20package.json\x20has\x20no\x20bin\x20'+p);return{'command':process[A(0xbf)],'args':[h['join'](v,x)]};}(B(0xca),'claude-agent-acp');throw new Error('ACP\x20runtime\x20is\x20not\x20supported\x20for\x20framework:\x20'+k);}async function r(k){try{return import.meta.resolve(k),!0x0;}catch{return!0x1;}}
package/dist/lib/ipc.js CHANGED
@@ -1 +1 @@
1
- (function(m,p){const A=c,q=m();while(!![]){try{const s=parseInt(A(0x135))/0x1*(parseInt(A(0x132))/0x2)+parseInt(A(0x13c))/0x3*(parseInt(A(0x138))/0x4)+parseInt(A(0x12f))/0x5*(parseInt(A(0x139))/0x6)+parseInt(A(0x13e))/0x7+-parseInt(A(0x13b))/0x8*(parseInt(A(0x13f))/0x9)+-parseInt(A(0x12d))/0xa*(parseInt(A(0x134))/0xb)+-parseInt(A(0x12e))/0xc*(parseInt(A(0x130))/0xd);if(s===p)break;else q['push'](q['shift']());}catch(u){q['push'](q['shift']());}}}(b,0xe140a));import{fileURLToPath as d}from'node:url';function b(){const F=['483452unDUzU','8370baQFQC','licos-bridge\x20daemon\x20did\x20not\x20start\x20in\x20time','8AHMZMQ','39NFbFhe','Bearer\x20','10152233rKcDtU','10754793isuvCm','json','10ThxTwL','132hNaYkD','6430FpwtHF','2316821HBEonr','all','38BQdzbB','index.js','20149547qqYpHb','57593zhuMuf','\x20failed:\x20HTTP\x20','tokenFile'];b=function(){return F;};return b();}import f from'node:path';import{resolvePaths as g}from'./paths.js';import{isProcessAlive as h,readText as j,sleep as k,spawnDetached as l}from'./utils.js';export async function readDaemonInfo(){const B=c,q=g(),[u,v,w]=await Promise[B(0x131)]([j(q['pidFile']),j(q['portFile']),j(q[B(0x137)])]),x=Number(u),y=Number(v),z=w?.['trim']();if(x&&y&&z&&h(x))return{'pid':x,'port':y,'token':z};}function c(a,d){a=a-0x12d;const e=b();let f=e[a];return f;}export async function ensureDaemon(){const C=c,m=await readDaemonInfo();if(m)return m;await startDaemon();for(let p=0x0;p<0x50;p+=0x1){const q=await readDaemonInfo();if(q)return q;await k(0x64);}throw new Error(C(0x13a));}export async function startDaemon(){const D=c,m=f['resolve'](f['dirname'](d(import.meta.url)),'..',D(0x133));l(m,['--daemon']);}export async function ipcRequest(m,p,q){const E=c,s=await fetch('http://127.0.0.1:'+q['port']+m,{'method':'/status'===m?'GET':'POST','headers':{'authorization':E(0x13d)+q['token'],'content-type':'application/json'},'body':'/status'===m?void 0x0:JSON['stringify'](p??{})}),u=await s[E(0x140)]()['catch'](()=>({}));if(!s['ok'])throw new Error(u['error']||'IPC\x20'+m+E(0x136)+s['status']);return u;}
1
+ (function(m,p){const A=c,q=m();while(!![]){try{const s=-parseInt(A(0xd2))/0x1+parseInt(A(0xdc))/0x2*(-parseInt(A(0xd3))/0x3)+parseInt(A(0xcc))/0x4*(-parseInt(A(0xcb))/0x5)+-parseInt(A(0xd1))/0x6*(parseInt(A(0xd4))/0x7)+parseInt(A(0xd0))/0x8*(-parseInt(A(0xd9))/0x9)+-parseInt(A(0xcd))/0xa*(-parseInt(A(0xda))/0xb)+parseInt(A(0xdb))/0xc;if(s===p)break;else q['push'](q['shift']());}catch(u){q['push'](q['shift']());}}}(b,0xed90d));import{fileURLToPath as d}from'node:url';import f from'node:path';function c(a,d){a=a-0xcb;const e=b();let f=e[a];return f;}import{resolvePaths as g}from'./paths.js';import{isProcessAlive as h,readText as j,sleep as k,spawnDetached as l}from'./utils.js';export async function readDaemonInfo(){const B=c,q=g(),[u,v,w]=await Promise['all']([j(q['pidFile']),j(q[B(0xdd)]),j(q['tokenFile'])]),x=Number(u),y=Number(v),z=w?.[B(0xd8)]();if(x&&y&&z&&h(x))return{'pid':x,'port':y,'token':z};}export async function ensureDaemon(){const m=await readDaemonInfo();if(m)return m;await startDaemon();for(let p=0x0;p<0x50;p+=0x1){const q=await readDaemonInfo();if(q)return q;await k(0x64);}throw new Error('licos-bridge\x20daemon\x20did\x20not\x20start\x20in\x20time');}export async function startDaemon(){const C=c,m=f['resolve'](f[C(0xcf)](d(import.meta.url)),'..','index.js');l(m,[C(0xd6)]);}export async function ipcRequest(m,p,q){const D=c,s=await fetch('http://127.0.0.1:'+q[D(0xd5)]+m,{'method':'/status'===m?'GET':'POST','headers':{'authorization':'Bearer\x20'+q['token'],'content-type':D(0xd7)},'body':'/status'===m?void 0x0:JSON['stringify'](p??{})}),u=await s['json']()[D(0xce)](()=>({}));if(!s['ok'])throw new Error(u['error']||'IPC\x20'+m+'\x20failed:\x20HTTP\x20'+s['status']);return u;}function b(){const E=['port','--daemon','application/json','trim','631395eOBjEr','9694872GvAsiz','35159172RMuADQ','58omeSxq','portFile','250LoHhQx','104364CsSboz','20GiAyce','catch','dirname','24fUeuZm','7271874FXBrCA','135651hyzkel','88647sZaeos','7BFjtGU'];b=function(){return E;};return b();}
@@ -1 +1 @@
1
- (function(D,E){const V=h,F=D();while(!![]){try{const G=parseInt(V(0x1ad))/0x1+parseInt(V(0x19c))/0x2+-parseInt(V(0x1b5))/0x3*(-parseInt(V(0x195))/0x4)+parseInt(V(0x1a7))/0x5*(parseInt(V(0x19f))/0x6)+parseInt(V(0x1b1))/0x7+-parseInt(V(0x1b4))/0x8*(parseInt(V(0x1a1))/0x9)+parseInt(V(0x198))/0xa*(-parseInt(V(0x196))/0xb);if(G===E)break;else F['push'](F['shift']());}catch(H){F['push'](F['shift']());}}}(b,0x77589));import{spawnSync as j}from'node:child_process';import{readdir as k,readFile as m,stat as q}from'node:fs/promises';import{fileURLToPath as u}from'node:url';import v from'node:path';import{detectFrameworks as w}from'./frameworks.js';import{ipcRequest as x,readDaemonInfo as y}from'./ipc.js';import{resolvePaths as z}from'./paths.js';import{readJson as A,readText as B,removeDir as C}from'./utils.js';export async function statusSnapshot(){const W=h,D=await y();if(!D)return{'running':!0x1,'frameworks':await w()};const E=await x('/status',void 0x0,D)['catch'](F=>({'ok':!0x1,'error':F[W(0x1ae)]||String(F)}));return{'running':!0x0,'pid':D['pid'],...E};}export async function purgeBridge(){const X=h,D=await y();D&&await x('/stop',{},D)['catch'](()=>{});const {uninstallService:E}=await import(X(0x1a2));await E()[X(0x1b8)](()=>{}),await C(z()['bridgeRoot']);}export async function packageVersion(){const Y=h,D=await A(v['resolve'](v['dirname'](u(import.meta.url)),'..','..','package.json'),void 0x0)['catch'](()=>{});return D?.['version']||Y(0x18f);}export async function printLogs(D={}){const Z=h,E=z();if(D['list']){const J=await k(E['bridgeRoot'])['catch'](()=>[]);for(const K of J[Z(0x190)](L=>/^bridge(?:-\d{4}-\d{2}-\d{2})?\.log$/['test'](L))['sort']())console['log'](K);return;}const F=D['date']?v['join'](E['bridgeRoot'],'bridge-'+D[Z(0x1a0)]+Z(0x194)):E['logFile'],G=await B(F)??'';let H=G['split'](/\r?\n/)[Z(0x190)](Boolean);D[Z(0x1ac)]&&(H=H[Z(0x190)](L=>L[Z(0x1b7)](D[Z(0x1ac)]))),D[Z(0x19e)]&&(H=H['filter'](L=>L[Z(0x1b7)](D[Z(0x19e)]))),D[Z(0x1a3)]&&(H=H['filter'](L=>L['toLowerCase']()['includes'](String(D[Z(0x1a3)])['toLowerCase']())));const I=Number['isFinite'](D['tail'])?D['tail']:0xc8;I>0x0&&(H=H['slice'](-I));for(const L of H)console['log'](L);D[Z(0x18d)]&&await async function(M,N,O){let P=N;await new Promise(Q=>{const R=setInterval(async()=>{const a0=h,S=await B(M)??'';if(S['length']>P){let T=S[a0(0x1b9)](P)[a0(0x1a4)](/\r?\n/)['filter'](Boolean);P=S['length'],O['agentId']&&(T=T['filter'](U=>U['includes'](O['agentId']))),O['grep']&&(T=T[a0(0x190)](U=>U[a0(0x1b7)](O['grep'])));for(const U of T)console['log'](U);}},0x3e8);process['on']('SIGINT',()=>{clearInterval(R),Q();});});}(E[Z(0x1aa)],G['length'],D);}function b(){const a4=['grep','6LxJPML','date','36NaqMlU','./service.js','level','split','size','image/webp','1449655rpLXwv','kind','.jpg','logFile','.png','agentId','444613nehCIm','message','platform','.md','622972wWuoMI','update\x20failed:\x20','image','350904nPkBtO','3zaromK','target','includes','catch','slice','application/json','mime','application/octet-stream','inherit','follow','caption','0.0.0','filter','sessionId','toString','\x20bytes\x20(max\x2052428800)','.log','1383252bpCwNG','44nyFsqd','/stop','2538880WXKmpO','.json','name','npx','1020984uMXtao','text/markdown'];b=function(){return a4;};return b();}export async function runUpdate(){const a1=h,D=await y();D&&await x(a1(0x197),{},D)[a1(0x1b8)](()=>{});const E='win32'===process[a1(0x1af)]?'npx.cmd':a1(0x19b),F=['-y','--ignore-existing','@kmlckj/licos-bridge@latest','connect'];if(0x0!==j(E,F,{'stdio':a1(0x18c),'windowsHide':!0x0})['status'])throw new Error(a1(0x1b2)+E+'\x20'+F['join']('\x20'));}function h(a,c){a=a-0x18b;const d=b();let e=d[a];return e;}export async function buildSendPayload(D){const a2=h;if(!D[a2(0x1ac)])throw new Error('send\x20requires\x20--agent-id');if(!D['sessionId'])throw new Error('send\x20requires\x20--session-id');if(D['groupFile']){if(!D['mime'])throw new Error('send\x20--group-file\x20requires\x20--mime');return{'kind':D['kind'],'uri':D['target'],'agentId':D['agentId'],'sessionId':D['sessionId'],'caption':D[a2(0x18e)],'name':D[a2(0x19a)],'groupFile':!0x0,'mime':D['mime']};}const E=await q(D[a2(0x1b6)]);if(!E['isFile']())throw new Error('not\x20a\x20file:\x20'+D['target']);if(E[a2(0x1a5)]>0x3200000)throw new Error('file\x20too\x20large:\x20'+E[a2(0x1a5)]+a2(0x193));const F=await m(D['target']);return{'kind':D[a2(0x1a8)],'agentId':D[a2(0x1ac)],'sessionId':D[a2(0x191)],'caption':D[a2(0x18e)],'name':D['name']||v['basename'](D['target']),'mime':D[a2(0x1bb)]||f(D['target'],D['kind']),'size':F['byteLength'],'contentBase64':F[a2(0x192)]('base64')};}function f(D,E){const a3=h,F=v['extname'](D)['toLowerCase']();if(a3(0x1b3)===E){if(a3(0x1ab)===F)return'image/png';if([a3(0x1a9),'.jpeg']['includes'](F))return'image/jpeg';if('.gif'===F)return'image/gif';if('.webp'===F)return a3(0x1a6);}return'.pdf'===F?'application/pdf':'.txt'===F?'text/plain':a3(0x1b0)===F?a3(0x19d):a3(0x199)===F?a3(0x1ba):a3(0x18b);}
1
+ (function(D,E){const V=h,F=D();while(!![]){try{const G=-parseInt(V(0x1f4))/0x1+parseInt(V(0x1d8))/0x2+parseInt(V(0x1eb))/0x3+parseInt(V(0x1d3))/0x4*(-parseInt(V(0x1e2))/0x5)+parseInt(V(0x1fa))/0x6+-parseInt(V(0x1ef))/0x7+parseInt(V(0x1f3))/0x8*(parseInt(V(0x1f0))/0x9);if(G===E)break;else F['push'](F['shift']());}catch(H){F['push'](F['shift']());}}}(b,0x873df));import{spawnSync as j}from'node:child_process';import{readdir as k,readFile as m,stat as q}from'node:fs/promises';import{fileURLToPath as u}from'node:url';import v from'node:path';import{detectFrameworks as w}from'./frameworks.js';import{ipcRequest as x,readDaemonInfo as y}from'./ipc.js';import{resolvePaths as z}from'./paths.js';import{readJson as A,readText as B,removeDir as C}from'./utils.js';export async function statusSnapshot(){const W=h,D=await y();if(!D)return{'running':!0x1,'frameworks':await w()};const E=await x('/status',void 0x0,D)['catch'](F=>({'ok':!0x1,'error':F[W(0x1d2)]||String(F)}));return{'running':!0x0,'pid':D['pid'],...E};}export async function purgeBridge(){const X=h,D=await y();D&&await x(X(0x1fb),{},D)[X(0x1da)](()=>{});const {uninstallService:E}=await import('./service.js');await E()['catch'](()=>{}),await C(z()['bridgeRoot']);}export async function packageVersion(){const Y=h,D=await A(v['resolve'](v['dirname'](u(import.meta.url)),'..','..','package.json'),void 0x0)['catch'](()=>{});return D?.[Y(0x1e4)]||'0.0.0';}function b(){const a4=['date','toLowerCase','@kmlckj/licos-bridge@latest','.gif','send\x20--group-file\x20requires\x20--mime','1377639fZQyzi','application/pdf','npx.cmd','.webp','5126961UhvVYC','63EoQJlY','filter','bridgeRoot','930192Sddteq','504642LJtxtN','image','slice','caption','sessionId','text/plain','3539460YzvrrP','/stop','target','npx','log','--ignore-existing','image/gif','message','4fPSvLZ','join','includes','grep','.txt','749702NFIjae','basename','catch','tail','agentId','send\x20requires\x20--agent-id','list','application/json','\x20bytes\x20(max\x2052428800)','logFile','2234380yGfmek','.jpg','version','image/webp'];b=function(){return a4;};return b();}export async function printLogs(D={}){const Z=h,E=z();if(D[Z(0x1de)]){const J=await k(E['bridgeRoot'])['catch'](()=>[]);for(const K of J[Z(0x1f1)](L=>/^bridge(?:-\d{4}-\d{2}-\d{2})?\.log$/['test'](L))['sort']())console[Z(0x1cf)](K);return;}const F=D['date']?v[Z(0x1d4)](E[Z(0x1f2)],'bridge-'+D[Z(0x1e6)]+'.log'):E['logFile'],G=await B(F)??'';let H=G['split'](/\r?\n/)[Z(0x1f1)](Boolean);D[Z(0x1dc)]&&(H=H['filter'](L=>L[Z(0x1d5)](D[Z(0x1dc)]))),D[Z(0x1d6)]&&(H=H[Z(0x1f1)](L=>L['includes'](D[Z(0x1d6)]))),D['level']&&(H=H[Z(0x1f1)](L=>L['toLowerCase']()['includes'](String(D['level'])['toLowerCase']())));const I=Number['isFinite'](D['tail'])?D[Z(0x1db)]:0xc8;I>0x0&&(H=H['slice'](-I));for(const L of H)console['log'](L);D['follow']&&await async function(M,N,O){let P=N;await new Promise(Q=>{const R=setInterval(async()=>{const a0=h,S=await B(M)??'';if(S['length']>P){let T=S[a0(0x1f6)](P)['split'](/\r?\n/)['filter'](Boolean);P=S['length'],O['agentId']&&(T=T['filter'](U=>U[a0(0x1d5)](O['agentId']))),O['grep']&&(T=T[a0(0x1f1)](U=>U['includes'](O[a0(0x1d6)])));for(const U of T)console['log'](U);}},0x3e8);process['on']('SIGINT',()=>{clearInterval(R),Q();});});}(E[Z(0x1e1)],G['length'],D);}export async function runUpdate(){const a1=h,D=await y();D&&await x(a1(0x1fb),{},D)['catch'](()=>{});const E='win32'===process['platform']?a1(0x1ed):a1(0x1ce),F=['-y',a1(0x1d0),a1(0x1e8),'connect'];if(0x0!==j(E,F,{'stdio':'inherit','windowsHide':!0x0})['status'])throw new Error('update\x20failed:\x20'+E+'\x20'+F[a1(0x1d4)]('\x20'));}export async function buildSendPayload(D){const a2=h;if(!D[a2(0x1dc)])throw new Error(a2(0x1dd));if(!D['sessionId'])throw new Error('send\x20requires\x20--session-id');if(D['groupFile']){if(!D['mime'])throw new Error(a2(0x1ea));return{'kind':D['kind'],'uri':D['target'],'agentId':D['agentId'],'sessionId':D['sessionId'],'caption':D['caption'],'name':D['name'],'groupFile':!0x0,'mime':D['mime']};}const E=await q(D['target']);if(!E['isFile']())throw new Error('not\x20a\x20file:\x20'+D['target']);if(E['size']>0x3200000)throw new Error('file\x20too\x20large:\x20'+E['size']+a2(0x1e0));const F=await m(D[a2(0x1cd)]);return{'kind':D['kind'],'agentId':D[a2(0x1dc)],'sessionId':D[a2(0x1f8)],'caption':D[a2(0x1f7)],'name':D['name']||v[a2(0x1d9)](D[a2(0x1cd)]),'mime':D['mime']||f(D['target'],D['kind']),'size':F['byteLength'],'contentBase64':F['toString']('base64')};}function h(a,c){a=a-0x1cd;const d=b();let e=d[a];return e;}function f(D,E){const a3=h,F=v['extname'](D)[a3(0x1e7)]();if(a3(0x1f5)===E){if('.png'===F)return'image/png';if([a3(0x1e3),'.jpeg'][a3(0x1d5)](F))return'image/jpeg';if(a3(0x1e9)===F)return a3(0x1d1);if(a3(0x1ee)===F)return a3(0x1e5);}return'.pdf'===F?a3(0x1ec):a3(0x1d7)===F?a3(0x1f9):'.md'===F?'text/markdown':'.json'===F?a3(0x1df):'application/octet-stream';}
package/dist/lib/paths.js CHANGED
@@ -1 +1 @@
1
- (function(f,g){const k=b,h=f();while(!![]){try{const i=-parseInt(k(0x6e))/0x1*(parseInt(k(0x76))/0x2)+-parseInt(k(0x75))/0x3+parseInt(k(0x77))/0x4+parseInt(k(0x6f))/0x5+-parseInt(k(0x78))/0x6+-parseInt(k(0x72))/0x7+parseInt(k(0x73))/0x8*(parseInt(k(0x74))/0x9);if(i===g)break;else h['push'](h['shift']());}catch(j){h['push'](h['shift']());}}}(a,0xa12e2));function b(c,d){c=c-0x6e;const e=a();let f=e[c];return f;}import c from'node:os';import d from'node:path';function a(){const m=['4994496bwgdHR','join','config.json','resolve','235516AbudbP','4197580YcoLiw','service.log','.licos','1415694lCDWLx','32meMLmL','3667743kWZbfC','835047RPNaBi','10IAeDaj','2724628CkVOmL'];a=function(){return m;};return a();}export function resolvePaths(){const l=b,f=process.env.LICOS_BRIDGE_HOME?d[l(0x7b)](process.env.LICOS_BRIDGE_HOME):d['join'](c['homedir'](),l(0x71)),g=d['join'](f,'bridge');return{'root':f,'bridgeRoot':g,'agentsRoot':process.env.LICOS_BRIDGE_AGENTS_HOME?d['resolve'](process.env.LICOS_BRIDGE_AGENTS_HOME):d['join'](f,'agents'),'pidFile':d[l(0x79)](g,'bridge.pid'),'portFile':d['join'](g,'bridge.port'),'tokenFile':d['join'](g,'bridge.token'),'logFile':d['join'](g,'bridge.log'),'configFile':d['join'](g,l(0x7a)),'serviceLogFile':d[l(0x79)](g,l(0x70))};}export function agentPaths(f){const g=resolvePaths(),h=d['join'](g['agentsRoot'],f);return{'root':h,'configFile':d['join'](h,'config.json'),'workspace':d['join'](h,'workspace'),'logs':d['join'](h,'logs')};}
1
+ (function(f,g){const k=b,h=f();while(!![]){try{const i=-parseInt(k(0xb7))/0x1*(parseInt(k(0xbb))/0x2)+parseInt(k(0xb3))/0x3+parseInt(k(0xbe))/0x4*(-parseInt(k(0xc0))/0x5)+parseInt(k(0xb8))/0x6*(parseInt(k(0xba))/0x7)+-parseInt(k(0xbf))/0x8*(parseInt(k(0xb5))/0x9)+-parseInt(k(0xbd))/0xa+parseInt(k(0xb6))/0xb;if(i===g)break;else h['push'](h['shift']());}catch(j){h['push'](h['shift']());}}}(a,0x7a3e3));function a(){const n=['2779265vSdGpE','config.json','logs','495324rwRPRY','join','366723hGGDwx','21036730RFapqo','467909cGiuRH','12MjBnvU','agentsRoot','1639862MPfTgx','4HosMlz','resolve','4314510AoQcNl','4mMsYpg','24SVNLzk'];a=function(){return n;};return a();}import c from'node:os';import d from'node:path';function b(c,d){c=c-0xb1;const e=a();let f=e[c];return f;}export function resolvePaths(){const l=b,f=process.env.LICOS_BRIDGE_HOME?d[l(0xbc)](process.env.LICOS_BRIDGE_HOME):d['join'](c['homedir'](),'.licos'),g=d['join'](f,'bridge');return{'root':f,'bridgeRoot':g,'agentsRoot':process.env.LICOS_BRIDGE_AGENTS_HOME?d['resolve'](process.env.LICOS_BRIDGE_AGENTS_HOME):d[l(0xb4)](f,'agents'),'pidFile':d['join'](g,'bridge.pid'),'portFile':d['join'](g,'bridge.port'),'tokenFile':d['join'](g,'bridge.token'),'logFile':d[l(0xb4)](g,'bridge.log'),'configFile':d['join'](g,l(0xb1)),'serviceLogFile':d['join'](g,'service.log')};}export function agentPaths(f){const m=b,g=resolvePaths(),h=d['join'](g[m(0xb9)],f);return{'root':h,'configFile':d['join'](h,m(0xb1)),'workspace':d[m(0xb4)](h,'workspace'),'logs':d['join'](h,m(0xb2))};}
@@ -1 +1 @@
1
- (function(m,p){const y=c,q=m();while(!![]){try{const u=-parseInt(y(0x1c4))/0x1+-parseInt(y(0x1c1))/0x2+parseInt(y(0x1b3))/0x3+parseInt(y(0x1cb))/0x4*(-parseInt(y(0x1cc))/0x5)+-parseInt(y(0x1bb))/0x6+parseInt(y(0x1ab))/0x7*(-parseInt(y(0x1ba))/0x8)+parseInt(y(0x1c9))/0x9*(parseInt(y(0x1c7))/0xa);if(u===p)break;else q['push'](q['shift']());}catch(v){q['push'](q['shift']());}}}(b,0x391a7));function b(){const E=['\x20failed','load','/Library/LaunchAgents/com.licos.bridge.plist','enable','\x22\x20\x22','483622RObowP','launchctl','</string>\x0a</dict></plist>\x0a','45064CSSgQD','Windows\x20login\x20task\x20installed:\x20LICOS\x20Bridge','.service','125030UftdwU','execPath','828dIubct','</string><string>','59316QhNXbh','115xwhMPr','join','inherit','index.js','allowFailure','342321fnevGm','unload','platform','[Unit]\x0aDescription=LICOS\x20local\x20agent\x20bridge\x0a\x0a[Service]\x0aExecStart=','/TR','systemd\x20user\x20service\x20installed:\x20licos-bridge.service','dirname','win32','937758QkJGcY','launchd\x20service\x20installed:\x20com.licos.bridge','disable','\x22\x20--daemon','darwin','/TN','log','64cnDjwy','1258806yXyciQ'];b=function(){return E;};return b();}import{spawnSync as d}from'node:child_process';import{fileURLToPath as f}from'node:url';function c(a,d){a=a-0x1a9;const e=b();let f=e[a];return f;}import g from'node:path';import{ensureDir as h,writePrivateText as j}from'./utils.js';import{resolvePaths as k}from'./paths.js';const t='LICOS\x20Bridge',a='licos-bridge';export async function installService(){const z=c,m=g['resolve'](g['dirname'](f(import.meta.url)),'..',z(0x1a9));if(z(0x1b2)===process[z(0x1ad)]){const u='\x22'+process['execPath']+z(0x1c0)+m+z(0x1b6);return l('schtasks.exe',['/Create',z(0x1b8),t,'/SC','ONLOGON',z(0x1af),u,'/F']),void console['log'](z(0x1c5));}if('darwin'===process['platform']){const v=process.env.HOME+z(0x1be);return await h(g[z(0x1b1)](v)),await j(v,function(w){const A=z,x=k()['serviceLogFile'];return'<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<!DOCTYPE\x20plist\x20PUBLIC\x20\x22-//Apple//DTD\x20PLIST\x201.0//EN\x22\x20\x22http://www.apple.com/DTDs/PropertyList-1.0.dtd\x22>\x0a<plist\x20version=\x221.0\x22><dict>\x0a\x20\x20<key>Label</key><string>com.licos.bridge</string>\x0a\x20\x20<key>ProgramArguments</key><array><string>'+process[A(0x1c8)]+A(0x1ca)+w+'</string><string>--daemon</string></array>\x0a\x20\x20<key>RunAtLoad</key><true/>\x0a\x20\x20<key>KeepAlive</key><true/>\x0a\x20\x20<key>StandardOutPath</key><string>'+x+'</string>\x0a\x20\x20<key>StandardErrorPath</key><string>'+x+A(0x1c3);}(m)),l('launchctl',[z(0x1bd),'-w',v]),void console['log'](z(0x1b4));}const p=process.env.HOME+'/.config/systemd/user',q=g[z(0x1cd)](p,a+z(0x1c6));await h(p),await j(q,function(w){const B=z;return B(0x1ae)+process['execPath']+'\x20'+w+'\x20--daemon\x0aRestart=always\x0aRestartSec=3\x0a\x0a[Install]\x0aWantedBy=default.target\x0a';}(m)),l('systemctl',['--user','daemon-reload']),l('systemctl',['--user',z(0x1bf),'--now',a+'.service']),console[z(0x1b9)](z(0x1b0));}export async function uninstallService(){const C=c;return'win32'===process['platform']?(l('schtasks.exe',['/Delete','/TN',t,'/F'],{'allowFailure':!0x0}),void console['log']('Windows\x20login\x20task\x20removed:\x20LICOS\x20Bridge')):C(0x1b7)===process[C(0x1ad)]?(l(C(0x1c2),[C(0x1ac),'-w',process.env.HOME+'/Library/LaunchAgents/com.licos.bridge.plist'],{'allowFailure':!0x0}),void console['log']('launchd\x20service\x20removed:\x20com.licos.bridge')):(l('systemctl',['--user',C(0x1b5),'--now',a+C(0x1c6)],{'allowFailure':!0x0}),void console['log']('systemd\x20user\x20service\x20removed:\x20licos-bridge.service'));}function l(m,p,q={}){const D=c;if(0x0!==d(m,p,{'stdio':D(0x1ce),'windowsHide':!0x0})['status']&&!q[D(0x1aa)])throw new Error(m+'\x20'+p['join']('\x20')+D(0x1bc));}
1
+ (function(m,p){const y=c,q=m();while(!![]){try{const u=parseInt(y(0xf3))/0x1+-parseInt(y(0xee))/0x2*(-parseInt(y(0xfc))/0x3)+parseInt(y(0xf6))/0x4*(parseInt(y(0xf5))/0x5)+parseInt(y(0xec))/0x6+parseInt(y(0xf2))/0x7+-parseInt(y(0xfd))/0x8*(-parseInt(y(0xe8))/0x9)+parseInt(y(0x100))/0xa*(-parseInt(y(0xea))/0xb);if(u===p)break;else q['push'](q['shift']());}catch(v){q['push'](q['shift']());}}}(b,0x780a8));import{spawnSync as d}from'node:child_process';import{fileURLToPath as f}from'node:url';function c(a,d){a=a-0xe6;const e=b();let f=e[a];return f;}import g from'node:path';import{ensureDir as h,writePrivateText as j}from'./utils.js';import{resolvePaths as k}from'./paths.js';function b(){const C=['63296UGkjro','dirname','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<!DOCTYPE\x20plist\x20PUBLIC\x20\x22-//Apple//DTD\x20PLIST\x201.0//EN\x22\x20\x22http://www.apple.com/DTDs/PropertyList-1.0.dtd\x22>\x0a<plist\x20version=\x221.0\x22><dict>\x0a\x20\x20<key>Label</key><string>com.licos.bridge</string>\x0a\x20\x20<key>ProgramArguments</key><array><string>','/Library/LaunchAgents/com.licos.bridge.plist','\x22\x20--daemon','/Delete','3180FYKDxE','200424scCpjE','win32','systemctl','3884870bMaYgN','.service','log','/TN','resolve','/SC','unload','45dHqBMl','platform','55htUkhR','--user','3741522MHVpGb','serviceLogFile','1038LQdArQ','enable','darwin','daemon-reload','630HsgTBE','834385tePRzb','</string><string>','95FXzvMg'];b=function(){return C;};return b();}const t='LICOS\x20Bridge',a='licos-bridge';export async function installService(){const z=c,m=g[z(0x104)](g['dirname'](f(import.meta.url)),'..','index.js');if(z(0xfe)===process['platform']){const u='\x22'+process['execPath']+'\x22\x20\x22'+m+z(0xfa);return l('schtasks.exe',['/Create','/TN',t,z(0xe6),'ONLOGON','/TR',u,'/F']),void console['log']('Windows\x20login\x20task\x20installed:\x20LICOS\x20Bridge');}if('darwin'===process[z(0xe9)]){const v=process.env.HOME+z(0xf9);return await h(g[z(0xf7)](v)),await j(v,function(w){const A=z,x=k()[A(0xed)];return A(0xf8)+process['execPath']+A(0xf4)+w+'</string><string>--daemon</string></array>\x0a\x20\x20<key>RunAtLoad</key><true/>\x0a\x20\x20<key>KeepAlive</key><true/>\x0a\x20\x20<key>StandardOutPath</key><string>'+x+'</string>\x0a\x20\x20<key>StandardErrorPath</key><string>'+x+'</string>\x0a</dict></plist>\x0a';}(m)),l('launchctl',['load','-w',v]),void console['log']('launchd\x20service\x20installed:\x20com.licos.bridge');}const p=process.env.HOME+'/.config/systemd/user',q=g['join'](p,a+z(0x101));await h(p),await j(q,function(w){return'[Unit]\x0aDescription=LICOS\x20local\x20agent\x20bridge\x0a\x0a[Service]\x0aExecStart='+process['execPath']+'\x20'+w+'\x20--daemon\x0aRestart=always\x0aRestartSec=3\x0a\x0a[Install]\x0aWantedBy=default.target\x0a';}(m)),l('systemctl',[z(0xeb),z(0xf1)]),l(z(0xff),['--user',z(0xef),'--now',a+z(0x101)]),console[z(0x102)]('systemd\x20user\x20service\x20installed:\x20licos-bridge.service');}export async function uninstallService(){const B=c;return B(0xfe)===process['platform']?(l('schtasks.exe',[B(0xfb),B(0x103),t,'/F'],{'allowFailure':!0x0}),void console['log']('Windows\x20login\x20task\x20removed:\x20LICOS\x20Bridge')):B(0xf0)===process['platform']?(l('launchctl',[B(0xe7),'-w',process.env.HOME+'/Library/LaunchAgents/com.licos.bridge.plist'],{'allowFailure':!0x0}),void console['log']('launchd\x20service\x20removed:\x20com.licos.bridge')):(l(B(0xff),['--user','disable','--now',a+'.service'],{'allowFailure':!0x0}),void console['log']('systemd\x20user\x20service\x20removed:\x20licos-bridge.service'));}function l(m,p,q={}){if(0x0!==d(m,p,{'stdio':'inherit','windowsHide':!0x0})['status']&&!q['allowFailure'])throw new Error(m+'\x20'+p['join']('\x20')+'\x20failed');}
package/dist/lib/utils.js CHANGED
@@ -1 +1 @@
1
- const H=d;(function(w,x){const B=d,y=w();while(!![]){try{const z=-parseInt(B(0x159))/0x1+-parseInt(B(0x157))/0x2*(parseInt(B(0x154))/0x3)+parseInt(B(0x15f))/0x4*(parseInt(B(0x14f))/0x5)+-parseInt(B(0x162))/0x6*(-parseInt(B(0x152))/0x7)+-parseInt(B(0x15e))/0x8*(-parseInt(B(0x167))/0x9)+-parseInt(B(0x168))/0xa*(parseInt(B(0x166))/0xb)+parseInt(B(0x16d))/0xc*(parseInt(B(0x160))/0xd);if(z===x)break;else y['push'](y['shift']());}catch(A){y['push'](y['shift']());}}}(b,0x2baca));import{spawn as f,spawnSync as g}from'node:child_process';import{chmod as h,mkdir as j,readFile as k,rm as l,stat as m,writeFile as p}from'node:fs/promises';import{existsSync as q}from'node:fs';import v from'node:path';export function sleep(w){return new Promise(x=>setTimeout(x,w));}export async function ensureDir(w){await j(w,{'recursive':!0x0});}export async function readText(w){try{return await k(w,'utf8');}catch(x){if('ENOENT'===x?.['code'])return;throw x;}}export async function readJson(w,x=void 0x0){const y=await readText(w);return void 0x0===y?x:JSON['parse'](y);}export async function writeJson(w,x,y){const C=d;await ensureDir(v['dirname'](w)),await p(w,JSON['stringify'](x,null,0x2)+'\x0a','utf8'),y&&C(0x158)!==process[C(0x164)]&&await h(w,y);}export async function writePrivateText(w,x){const D=d;await ensureDir(v[D(0x161)](w)),await p(w,x,D(0x155)),'win32'!==process['platform']&&await h(w,0x180);}export async function removeDir(w){await l(w,{'recursive':!0x0,'force':!0x0});}export async function pathExists(w){try{return await m(w),!0x0;}catch(x){if('ENOENT'===x?.['code'])return!0x1;throw x;}}export function isProcessAlive(w){const E=d;if(!w||Number['isNaN'](w))return!0x1;try{return process[E(0x14d)](w,0x0),!0x0;}catch{return!0x1;}}export async function appendLog(w,x,y){const F=d,z='['+new Date()['toISOString']()+']\x20'+x+(y?'\x20'+JSON['stringify'](y):'')+'\x0a';await ensureDir(v[F(0x161)](w)),await p(w,z,{'encoding':'utf8','flag':'a'});}function d(a,c){a=a-0x14d;const e=b();let f=e[a];return f;}function b(){const N=['utf8','relative','6yaxFpY','win32','32709ucOZZa','where','openai-codex','claude-code','isAbsolute','8TNMEJQ','475428kADHmi','2514811OnuRLs','dirname','204PdoRNy','command','platform','path\x20escapes\x20workspace:\x20','303809TvHJjb','1217961ojEQjz','40BxbvSM','includes','status','startsWith','--version','12mCKziO','trim','kill','codex','5zTOEPB','string','unsafe\x20relative\x20path:\x20','34342MCtwqJ','execPath','292362zGgFuX'];b=function(){return N;};return b();}export function findExecutable(w){const G=d,x=G(0x158)===process['platform']?G(0x15a):G(0x163),y=G(0x158)===process['platform']?[w]:['-v',w],z=g(x,y,{'shell':'win32'!==process['platform'],'encoding':G(0x155),'windowsHide':!0x0});if(0x0===z[G(0x16a)])return z['stdout']['split'](/\r?\n/)['map'](A=>A['trim']())['find'](Boolean)||void 0x0;}export function commandVersion(w,x=[H(0x16c)]){const y=g(w,x,{'encoding':'utf8','windowsHide':!0x0,'timeout':0x1388});if(0x0===y['status'])return(y['stdout']||y['stderr'])['trim']()['split'](/\r?\n/)[0x0]?.['trim']()||void 0x0;}export function spawnDetached(w,x=[]){const I=H,y=f(process[I(0x153)],[w,...x],{'detached':!0x0,'stdio':'ignore','windowsHide':!0x0,'env':process.env});return y['unref'](),y['pid'];}export function safeResolve(w,x){const J=H,y=v['resolve'](w,x),z=v[J(0x156)](w,y);if(''===z||!z[J(0x16b)]('..')&&!v[J(0x15d)](z))return y;throw new Error(J(0x165)+x);}export function safeRelativePath(w){const K=H,x=String(w||'')['replace'](/\\/g,'/')['replace'](/^\/+/,'');if(!x||'.'===x)return'';const y=v['posix']['normalize'](x);if('.'===y||''===y)return'';if(y['startsWith']('../')||'..'===y||v['isAbsolute'](y))throw new Error(K(0x151)+w);return y;}export function safeName(w,x='item'){return String(w||'')['trim']()['replace'](/[<>:"/\\|?*\x00-\x1f]+/g,'-')['replace'](/^\.+$/,'')['slice'](0x0,0x78)||x;}export function joinUrl(w,x){if(!w)return;const y=w['replace'](/\/+$/,'');return y['endsWith'](x)?y:''+y+x;}export function normalizeFramework(w){const L=H,x=String(w||'')[L(0x16e)]()['toLowerCase']();return['claude','claude-code','claudecode']['includes'](x)?L(0x15c):[L(0x14e),L(0x15b)][L(0x169)](x)?L(0x14e):['openclaw','open-claw']['includes'](x)?'openclaw':x||L(0x14e);}export function isReadableFilePath(w){const M=H;return M(0x150)==typeof w&&w['length']>0x0&&q(w);}
1
+ const H=d;(function(w,x){const B=d,y=w();while(!![]){try{const z=parseInt(B(0xe6))/0x1+parseInt(B(0xdf))/0x2*(-parseInt(B(0xd2))/0x3)+-parseInt(B(0xde))/0x4+parseInt(B(0xd6))/0x5*(-parseInt(B(0xe3))/0x6)+parseInt(B(0xd1))/0x7+-parseInt(B(0xe1))/0x8+-parseInt(B(0xdb))/0x9*(-parseInt(B(0xda))/0xa);if(z===x)break;else y['push'](y['shift']());}catch(A){y['push'](y['shift']());}}}(b,0x79451));import{spawn as f,spawnSync as g}from'node:child_process';import{chmod as h,mkdir as j,readFile as k,rm as l,stat as m,writeFile as p}from'node:fs/promises';import{existsSync as q}from'node:fs';import v from'node:path';export function sleep(w){return new Promise(x=>setTimeout(x,w));}export async function ensureDir(w){await j(w,{'recursive':!0x0});}export async function readText(w){const C=d;try{return await k(w,C(0xec));}catch(x){if('ENOENT'===x?.[C(0xd0)])return;throw x;}}export async function readJson(w,x=void 0x0){const y=await readText(w);return void 0x0===y?x:JSON['parse'](y);}export async function writeJson(w,x,y){await ensureDir(v['dirname'](w)),await p(w,JSON['stringify'](x,null,0x2)+'\x0a','utf8'),y&&'win32'!==process['platform']&&await h(w,y);}function d(a,c){a=a-0xcf;const e=b();let f=e[a];return f;}function b(){const N=['ENOENT','openclaw','split','utf8','slice','includes','claudecode','relative','win32','claude','code','6713567RUlVrY','7395eLHxzT','open-claw','normalize','status','944575IMyPaX','stderr','startsWith','map','34150WzWgHi','2790ntBLfr','codex','--version','2085192PBqIKd','766MFGcMW','resolve','4685760ReqSsz','trim','6VDSOnK','find','dirname','719018jIANue','replace','platform'];b=function(){return N;};return b();}export async function writePrivateText(w,x){const D=d;await ensureDir(v[D(0xe5)](w)),await p(w,x,'utf8'),D(0xf1)!==process['platform']&&await h(w,0x180);}export async function removeDir(w){await l(w,{'recursive':!0x0,'force':!0x0});}export async function pathExists(w){const E=d;try{return await m(w),!0x0;}catch(x){if(E(0xe9)===x?.['code'])return!0x1;throw x;}}export function isProcessAlive(w){if(!w||Number['isNaN'](w))return!0x1;try{return process['kill'](w,0x0),!0x0;}catch{return!0x1;}}export async function appendLog(w,x,y){const F=d,z='['+new Date()['toISOString']()+']\x20'+x+(y?'\x20'+JSON['stringify'](y):'')+'\x0a';await ensureDir(v[F(0xe5)](w)),await p(w,z,{'encoding':F(0xec),'flag':'a'});}export function findExecutable(w){const G=d,x='win32'===process[G(0xe8)]?'where':'command',y='win32'===process['platform']?[w]:['-v',w],z=g(x,y,{'shell':'win32'!==process['platform'],'encoding':'utf8','windowsHide':!0x0});if(0x0===z[G(0xd5)])return z['stdout'][G(0xeb)](/\r?\n/)[G(0xd9)](A=>A['trim']())[G(0xe4)](Boolean)||void 0x0;}export function commandVersion(w,x=[H(0xdd)]){const I=H,y=g(w,x,{'encoding':I(0xec),'windowsHide':!0x0,'timeout':0x1388});if(0x0===y[I(0xd5)])return(y['stdout']||y[I(0xd7)])[I(0xe2)]()['split'](/\r?\n/)[0x0]?.['trim']()||void 0x0;}export function spawnDetached(w,x=[]){const y=f(process['execPath'],[w,...x],{'detached':!0x0,'stdio':'ignore','windowsHide':!0x0,'env':process.env});return y['unref'](),y['pid'];}export function safeResolve(w,x){const J=H,y=v[J(0xe0)](w,x),z=v[J(0xf0)](w,y);if(''===z||!z['startsWith']('..')&&!v['isAbsolute'](z))return y;throw new Error('path\x20escapes\x20workspace:\x20'+x);}export function safeRelativePath(w){const K=H,x=String(w||'')['replace'](/\\/g,'/')[K(0xe7)](/^\/+/,'');if(!x||'.'===x)return'';const y=v['posix'][K(0xd4)](x);if('.'===y||''===y)return'';if(y[K(0xd8)]('../')||'..'===y||v['isAbsolute'](y))throw new Error('unsafe\x20relative\x20path:\x20'+w);return y;}export function safeName(w,x='item'){const L=H;return String(w||'')[L(0xe2)]()['replace'](/[<>:"/\\|?*\x00-\x1f]+/g,'-')['replace'](/^\.+$/,'')[L(0xed)](0x0,0x78)||x;}export function joinUrl(w,x){if(!w)return;const y=w['replace'](/\/+$/,'');return y['endsWith'](x)?y:''+y+x;}export function normalizeFramework(w){const M=H,x=String(w||'')['trim']()['toLowerCase']();return[M(0xcf),'claude-code',M(0xef)]['includes'](x)?'claude-code':[M(0xdc),'openai-codex'][M(0xee)](x)?'codex':['openclaw',M(0xd3)]['includes'](x)?M(0xea):x||M(0xdc);}export function isReadableFilePath(w){return'string'==typeof w&&w['length']>0x0&&q(w);}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmlckj/licos-bridge",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "LICOS local agent bridge for Claude ACP and Codex ACP.",
5
5
  "type": "module",
6
6
  "bin": {