@kmlckj/licos-bridge 0.0.3 → 0.0.5
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 +89 -91
- package/dist/index.js +1 -1
- package/dist/lib/acp-runtime.js +1 -1
- package/dist/lib/agent-manager.js +1 -1
- package/dist/lib/cli.js +1 -1
- package/dist/lib/cloud.js +1 -1
- package/dist/lib/daemon.js +1 -1
- package/dist/lib/frameworks.js +1 -1
- package/dist/lib/ipc.js +1 -1
- package/dist/lib/local-commands.js +1 -1
- package/dist/lib/paths.js +1 -1
- package/dist/lib/service.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/package.json +37 -38
package/README.md
CHANGED
|
@@ -1,91 +1,89 @@
|
|
|
1
|
-
# @kmlckj/licos-bridge
|
|
2
|
-
|
|
3
|
-
LICOS 本地 Agent 桥接 CLI。它在本机启动后台 daemon,把平台里的本地个人助手连接到本机的 Claude ACP / Codex ACP 运行时。
|
|
4
|
-
|
|
5
|
-
## 前置依赖
|
|
6
|
-
|
|
7
|
-
- Node.js >= 20
|
|
8
|
-
- 本机至少安装或可运行一种 ACP runtime:
|
|
9
|
-
- Claude:`@agentclientprotocol/claude-agent-acp`
|
|
10
|
-
- Codex:`@zed-industries/codex-acp`
|
|
11
|
-
|
|
12
|
-
## 使用
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npx -y @kmlckj/licos-bridge@latest --pat-token=<token> --pair-code=<pair-code> --handshake-url=<platform-url>
|
|
16
|
-
|
|
17
|
-
licos-bridge status
|
|
18
|
-
licos-bridge stop
|
|
19
|
-
licos-bridge refresh
|
|
20
|
-
licos-bridge purge
|
|
21
|
-
licos-bridge service install
|
|
22
|
-
licos-bridge service uninstall
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
├── bridge
|
|
34
|
-
│ ├── bridge.
|
|
35
|
-
│ ├── bridge.
|
|
36
|
-
│
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- `
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_agent/
|
|
71
|
-
_agent/
|
|
72
|
-
_agent/
|
|
73
|
-
_agent/
|
|
74
|
-
_agent/
|
|
75
|
-
_agent/
|
|
76
|
-
_agent/
|
|
77
|
-
_agent/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
session/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
`
|
|
88
|
-
|
|
89
|
-
- `
|
|
90
|
-
- `content/skillMd`:直接写成 `SKILL.md`。
|
|
91
|
-
- `files`:直接写入多文件技能目录。
|
|
1
|
+
# @kmlckj/licos-bridge
|
|
2
|
+
|
|
3
|
+
LICOS 本地 Agent 桥接 CLI。它在本机启动后台 daemon,把平台里的本地个人助手连接到本机的 Claude ACP / Codex ACP 运行时。
|
|
4
|
+
|
|
5
|
+
## 前置依赖
|
|
6
|
+
|
|
7
|
+
- Node.js >= 20
|
|
8
|
+
- 本机至少安装或可运行一种 ACP runtime:
|
|
9
|
+
- Claude:`@agentclientprotocol/claude-agent-acp`
|
|
10
|
+
- Codex:`@zed-industries/codex-acp`
|
|
11
|
+
|
|
12
|
+
## 使用
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx -y @kmlckj/licos-bridge@latest --pat-token=<token> --pair-code=<pair-code> --handshake-url=<platform-url>
|
|
16
|
+
|
|
17
|
+
licos-bridge status
|
|
18
|
+
licos-bridge stop
|
|
19
|
+
licos-bridge refresh
|
|
20
|
+
licos-bridge purge
|
|
21
|
+
licos-bridge service install
|
|
22
|
+
licos-bridge service uninstall
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 工作目录
|
|
26
|
+
|
|
27
|
+
默认使用:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
~/.licos/
|
|
31
|
+
├── bridge/
|
|
32
|
+
│ ├── bridge.pid
|
|
33
|
+
│ ├── bridge.port
|
|
34
|
+
│ ├── bridge.token
|
|
35
|
+
│ ├── bridge.log
|
|
36
|
+
│ └── config.json
|
|
37
|
+
└── agents/<agentId>/
|
|
38
|
+
├── config.json
|
|
39
|
+
├── workspace/
|
|
40
|
+
└── logs/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
可通过环境变量覆盖:
|
|
44
|
+
|
|
45
|
+
- `LICOS_BRIDGE_HOME`
|
|
46
|
+
- `LICOS_BRIDGE_AGENTS_HOME`
|
|
47
|
+
- `LICOS_BRIDGE_HANDSHAKE_URL`
|
|
48
|
+
- `LICOS_PLATFORM_BASE_URL`
|
|
49
|
+
- `AIOS_PLATFORM_BASE_URL`
|
|
50
|
+
|
|
51
|
+
## 云端协议入口
|
|
52
|
+
|
|
53
|
+
`--handshake-url` 可以是平台 base URL,也可以直接是 handshake endpoint。平台生成的连接命令会显式携带这个参数;如果手写命令,可以通过 `LICOS_BRIDGE_HANDSHAKE_URL`、`LICOS_PLATFORM_BASE_URL` 或 `AIOS_PLATFORM_BASE_URL` 提供。
|
|
54
|
+
|
|
55
|
+
桥接工具不再内置固定平台地址。没有命令参数、没有本地已保存地址、也没有环境变量时会直接报错,避免 dev/prod 环境串连。历史版本保存的 `https://www.licos.com` 默认地址在自动重连时会被拒绝,需要从目标平台重新复制连接命令。
|
|
56
|
+
|
|
57
|
+
默认 handshake path:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
/api/v1/workbench/local-agent-bridge/handshake
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
handshake 返回的 `frontierUrl` / `data.frontierUrl` 会用于 WebSocket 长连接;也可以用 `--frontier-url` 覆盖。
|
|
64
|
+
|
|
65
|
+
## 已支持的 bridge 控制帧
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
_agent/create
|
|
69
|
+
_agent/detail
|
|
70
|
+
_agent/update
|
|
71
|
+
_agent/disconnect
|
|
72
|
+
_agent/health
|
|
73
|
+
_agent/getFileTree
|
|
74
|
+
_agent/getFileContent
|
|
75
|
+
_agent/listSkills
|
|
76
|
+
_agent/addSkills
|
|
77
|
+
_agent/removeSkills
|
|
78
|
+
session/new
|
|
79
|
+
session/prompt
|
|
80
|
+
session/cancel
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
文件树和文件内容只读取本地 agent workspace,不会自动上传到平台。技能安装会写入本地 workspace 的 `.skills/<skillId>`,并更新 agent config;安装或移除后会停止当前 ACP runtime,下一轮对话重新加载。
|
|
84
|
+
|
|
85
|
+
`_agent/addSkills` 支持三种输入:
|
|
86
|
+
|
|
87
|
+
- `downloadUrl/packageUrl/archiveUrl/url`:下载 `.zip` / `.skill` 包并解压。
|
|
88
|
+
- `content/skillMd`:直接写成 `SKILL.md`。
|
|
89
|
+
- `files`:直接写入多文件技能目录。
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
function b(){const X=['pair','44imQUNm','/send','/pair','version','error','status','slice','stringify','123380grGJxv','/stop','connect','1778031jicDEz','mode','4635OIeuxl','4581600mZMFIv','7BLoWgt','5JSDukr','daemon','670386GhAWFh','send','licos-bridge\x20daemon\x20stopped.','argv','39544DdqDCI','30978xCfQRz','refresh','/reload','spawn-daemon','reload','log','112NpueHK','6ThfWON','deprecated'];b=function(){return X;};return b();}const W=h;(function(E,F){const U=h,G=E();while(!![]){try{const H=-parseInt(U(0x1df))/0x1*(parseInt(U(0x1e6))/0x2)+parseInt(U(0x1d5))/0x3*(-parseInt(U(0x1e5))/0x4)+parseInt(U(0x1d8))/0x5*(parseInt(U(0x1da))/0x6)+parseInt(U(0x1d7))/0x7*(-parseInt(U(0x1de))/0x8)+-parseInt(U(0x1d3))/0x9+-parseInt(U(0x1d0))/0xa*(parseInt(U(0x1e9))/0xb)+parseInt(U(0x1d6))/0xc;if(H===F)break;else G['push'](G['shift']());}catch(I){G['push'](G['shift']());}}}(b,0x19c0b));import{parseArgs as j,printHelp as k}from'./lib/cli.js';import{ensureDaemon as p,ipcRequest as q,readDaemonInfo as u,startDaemon as v}from'./lib/ipc.js';function h(a,c){a=a-0x1cd;const d=b();let e=d[a];return e;}import{buildSendPayload as w,packageVersion as x,printLogs as y,purgeBridge as z,runUpdate as A,statusSnapshot as B}from'./lib/local-commands.js';import{installService as C,uninstallService as D}from'./lib/service.js';(async function(E){const V=h,F=j(E);if(F[V(0x1e7)]&&console[V(0x1ed)]('Deprecated:\x20'+F[V(0x1e7)]),'help'!==F[V(0x1d4)]){if(V(0x1ec)!==F[V(0x1d4)]){if(V(0x1d9)===F[V(0x1d4)]){const {startDaemonServer:G}=await import('./lib/daemon.js');return void await G();}if(V(0x1cd)===F['mode']){const H=await B();return void console['log'](JSON[V(0x1cf)](H,null,0x2));}if('stop'===F['mode']){const I=await u();return I?(await q(V(0x1d1),{},I),void console[V(0x1e4)](V(0x1dc))):void console['log']('licos-bridge\x20daemon\x20is\x20not\x20running.');}if(V(0x1e0)===F['mode']){const J=await p(),K=await q('/refresh',{},J);return void console['log'](JSON[V(0x1cf)](K,null,0x2));}if(V(0x1e3)===F['mode']){const L=await p(),M=await q(V(0x1e1),{'agentId':F['agentId']},L);return void console[V(0x1e4)](JSON['stringify'](M,null,0x2));}if('log'!==F[V(0x1d4)]){if('update'!==F['mode']){if('purge'===F['mode'])return await z(),void console['log']('licos-bridge\x20bridge\x20data\x20purged.');if('service-install'!==F[V(0x1d4)]){if('service-uninstall'!==F['mode']){if(V(0x1e8)===F['mode']){const N=await p(),O=await q(V(0x1eb),F,N);return void console[V(0x1e4)](JSON[V(0x1cf)](O,null,0x2));}if(V(0x1d2)===F['mode']){const P=await p(),Q=await q('/connect',F,P);return void console['log'](JSON[V(0x1cf)](Q,null,0x2));}if(V(0x1db)===F[V(0x1d4)]){const R=await p(),S=await w(F),T=await q(V(0x1ea),S,R);return void console['log'](JSON['stringify'](T,null,0x2));}if(V(0x1e2)!==F[V(0x1d4)])throw new Error('unsupported\x20command\x20mode:\x20'+F['mode']);await v();}else await D();}else await C();}else await A();}else await y(F);}else console['log'](await x());}else k();}(process[W(0x1dd)][W(0x1ce)](0x2))['catch'](E=>{console['error'](E instanceof Error?E['message']:String(E)),process['exitCode']=0x1;}));
|
package/dist/lib/acp-runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const H=
|
|
1
|
+
const H=f;(function(x,y){const C=f,z=x();while(!![]){try{const A=parseInt(C(0x132))/0x1+parseInt(C(0x134))/0x2+parseInt(C(0x151))/0x3*(parseInt(C(0x135))/0x4)+-parseInt(C(0x12d))/0x5+parseInt(C(0x128))/0x6+parseInt(C(0x12c))/0x7+-parseInt(C(0x13b))/0x8;if(A===y)break;else z['push'](z['shift']());}catch(B){z['push'](z['shift']());}}}(b,0xab44b));import{spawn as g}from'node:child_process';import{readFile as h,writeFile as j}from'node:fs/promises';function b(){const Q=['13617536tcgTHS','get','stopping\x20acp\x20runtime','logger','workspace','ndJsonStream','dirname','ClientSideConnection','mcpServers','path','selected','update','sessionContexts','ensureSession','agentConfig','clear','start','agentId','onUpdate','onClientRequest','stdin','runtime','3813DKQUQu','optionId','trim','sessions','sessionId','2922900gZDxcK','stderr','data','closed','4498361GLvbYm','818250Gzdvwf','process','stop','connection','acp\x20stderr','86283LqUqUw','session_id','653750jFjywt','3224VPdWtC','options','set','command','kill','delete'];b=function(){return Q;};return b();}import{Readable as k,Writable as l}from'node:stream';import m from'node:path';import*as q from'@agentclientprotocol/sdk';function f(a,c){a=a-0x124;const d=b();let e=d[a];return e;}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=f;this[D(0x149)]=x,this[D(0x14d)]=y,this[D(0x14e)]=z,this[D(0x13e)]=A,this[D(0x126)]=new Map(),this[D(0x147)]=new Map(),this['process']=void 0x0,this['connection']=void 0x0,this[D(0x12b)]=!0x1;}async['start'](){const E=f;if(this['connection'])return;await v(this['agentConfig'][E(0x13f)]);const x=await u(this[E(0x149)]['framework']);this[E(0x12e)]=g(x[E(0x138)],x['args'],{'cwd':this['agentConfig']['workspace'],'stdio':['pipe','pipe','pipe'],'windowsHide':!0x0,'env':{...process.env,'LICOS_BRIDGE_AGENT_ID':this[E(0x149)]['agentId'],'LICOS_BRIDGE_FRAMEWORK':this[E(0x149)]['framework']}}),this['process'][E(0x129)]?.['on'](E(0x12a),A=>{const F=E;this['logger']?.(F(0x131),{'agentId':this['agentConfig']['agentId'],'text':A['toString']('utf8')[F(0x125)]()});}),this['process']['on']('exit',(A,B)=>{const G=E;this[G(0x12b)]=!0x0,this[G(0x130)]=void 0x0,this['logger']?.('acp\x20process\x20exited',{'agentId':this['agentConfig']['agentId'],'code':A,'signal':B});});const y=q[E(0x140)](l['toWeb'](this[E(0x12e)][E(0x14f)]),k['toWeb'](this['process']['stdout'])),z=new d(this);this['connection']=new q[(E(0x142))](()=>z,y),await this['connection']['initialize']({'protocolVersion':q['PROTOCOL_VERSION'],'clientCapabilities':{'fs':{'readTextFile':!0x0,'writeTextFile':!0x0}}});}async[H(0x148)](x,y={}){const I=H;await this[I(0x14b)]();const z=this['sessions']['get'](x);if(z)return z;const A=await this['connection']['newSession']({'cwd':this['agentConfig'][I(0x13f)],'mcpServers':y[I(0x143)]??this[I(0x149)]['mcpServers']??[],'_meta':y['_meta']});return this['sessions']['set'](x,A[I(0x127)]),A['sessionId'];}async['prompt'](x){const J=H,y=x['sessionId'];if(!y)throw new Error('session/prompt\x20missing\x20sessionId');const z=await this['ensureSession'](y,x);this[J(0x147)][J(0x137)](z,{'cloudSessionId':y,'meta':x['_meta']||{}});try{return await this['connection']['prompt']({...x,'sessionId':z});}finally{this['sessionContexts'][J(0x13a)](z);}}async['cancel'](x){const K=H,y=this['sessions']['get'](x['sessionId']);this[K(0x130)]&&y&&await this[K(0x130)]['cancel']({...x,'sessionId':y});}async[H(0x12f)](x=H(0x12f)){const L=H;this['closed']=!0x0,this['logger']?.(L(0x13d),{'agentId':this[L(0x149)][L(0x14c)],'reason':x}),this[L(0x12e)]?.[L(0x139)](),this['process']=void 0x0,this[L(0x130)]=void 0x0,this['sessions']['clear'](),this[L(0x147)][L(0x14a)]();}['isAlive'](){return Boolean(this['process']&&!this['closed']&&null===this['process']['exitCode']);}}class d{constructor(x){this['runtime']=x;}async['sessionUpdate'](x){const M=H,y=x?.['sessionId']||x?.[M(0x133)]||x?.[M(0x146)]?.[M(0x127)]||x?.[M(0x146)]?.['session_id'],z=y?this[M(0x150)][M(0x147)][M(0x13c)](y):void 0x0;await this['runtime'][M(0x14d)]?.(this['runtime']['agentConfig'],x,z);}async['requestPermission'](x){const N=H,y=await this['runtime'][N(0x14e)]?.(this['runtime']['agentConfig'],'session/request_permission',x);if(y)return y;const z=x['options']?.['find'](A=>String(A['kind']||'')['startsWith']('allow'))??x[N(0x136)]?.[0x0];return z?.['optionId']?{'outcome':{'outcome':N(0x145),'optionId':z[N(0x124)]}}:{'outcome':{'outcome':'cancelled'}};}async['readTextFile'](x){const O=H,y=w(this[O(0x150)]['agentConfig'][O(0x13f)],x[O(0x144)]);return{'content':await h(y,'utf8')};}async['writeTextFile'](x){const P=H,y=w(this[P(0x150)]['agentConfig']['workspace'],x[P(0x144)]);return await v(m[P(0x141)](y)),await j(y,x['content']??'','utf8'),{};}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const ah=j;(function(R,U){const ag=j,V=R();while(!![]){try{const W=parseInt(ag(0xd6))/0x1+-parseInt(ag(0xfc))/0x2+parseInt(ag(0xe9))/0x3+-parseInt(ag(0xa5))/0x4*(parseInt(ag(0xb4))/0x5)+parseInt(ag(0x102))/0x6*(-parseInt(ag(0x106))/0x7)+-parseInt(ag(0xf4))/0x8+parseInt(ag(0xa2))/0x9;if(W===U)break;else V['push'](V['shift']());}catch(X){V['push'](V['shift']());}}}(b,0x896a8));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';function j(a,c){a=a-0x97;const d=b();let e=d[a];return e;}function b(){const aO=['deployType','---\x0aname:\x20','AGENTS.md','url','cloud','3199113qfXVlq','logger','get','agent\x20','find','isArray','logs','match','catch','iconUrl','string','4586904bWlpvw','sendNotification','disconnect','now','workspace','path','directory','trimEnd','1738712VwFOwP','codex','join','access_token','entryName','map','6432306fFnwQk','coverage','agents','size','7DGszUh','max','session/prompt','requireAgent','\x0adescription:\x20','session/new','session/cancel','updateAgentSkills','values','skill_md','register','stop','skills','14511591esrPQA','\x0a---\x0a\x0a#\x20','licosTurnId','1168VvRrNQ','accessToken','downloadUrl','files','_meta','include','cozeIdentity','cozeDeployType','getFileContent','prompt','configFile','relPath','status','framework','utf8','2780ohIIfB','skills-removed','agentsRoot','claude-code','updatedAt','runtime','token','isDirectory','message','local','not\x20a\x20file:\x20','exclude','sourceType','entries','skillId','isAlive','agent\x20not\x20found:\x20','installSkill','.next','add','content','text','count','health','arrayBuffer','truncated','runtime_provider','description','filter','CLAUDE.md','platform','trunc','skillMd','agentId','561208broJTK','getData','name','mcpServers','config','push','forwardClientRequest','download\x20skill\x20failed:\x20HTTP\x20','maxBytes','has','from','SKILL.md','package_url','source'];b=function(){return aO;};return b();}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(['node_modules','.git',ah(0xc6),'.nuxt','.turbo','.cache','dist','build','target',ah(0x103),'.venv','__pycache__']);export class AgentManager{constructor({cloud:R,logger:U}){this['cloud']=R,this['logger']=U,this['agents']=new Map();}async['loadPersistedAgents'](){const ai=ah,R=H();await J(R['agentsRoot']);const U=await x(R[ai(0xb6)],{'withFileTypes':!0x0})[ai(0xf1)](()=>[]);for(const V of U){if(!V[ai(0xbb)]())continue;const W=G(V['name'])['configFile'],X=await M(W)[ai(0xf1)](()=>{});X?.['agentId']&&!X['disconnectedAt']&&this[ai(0x9f)](X);}}[ah(0x9f)](R){const aj=ah,U={'deployType':aj(0xbd),...R,'framework':K(R['framework'])};return this['agents']['set'](U['agentId'],{'config':U,'runtime':void 0x0,'lastActiveAt':Date['now']()}),U;}async['createOrUpdate'](R={}){const ak=ah,U=R[ak(0xd5)]||R['id']||q(),V=G(U);await J(V['workspace']),await J(V[ak(0xef)]);const W=await M(V[ak(0xaf)],{})[ak(0xf1)](()=>({})),X={...W,'agentId':U,'name':R['name']||W['name']||U,'framework':K(R['framework']||R['runtimeProvider']||R['runtime_provider']||W['framework']||ak(0xfd)),'deployType':ak(0xe8)===R['_meta']?.[ak(0xac)]?ak(0xe8):R[ak(0xe4)]||W['deployType']||'local','workspace':R['workspace']||W['workspace']||V['workspace'],'cozeIdentity':R['cozeIdentity']??R['instructions']??W[ak(0xab)]??'','model':R['model']??W['model'],'modelInfo':R['modelInfo']??W['modelInfo'],'mcpServers':R[ak(0xd9)]??W[ak(0xd9)]??[],'updatedAt':new Date()['toISOString'](),'createdAt':W['createdAt']||new Date()['toISOString']()};return X[ak(0xab)]&&await async function(Y){const al=ak,Z=Y['cozeIdentity']['trim']();if(!Z)return;await J(Y[al(0xf8)]);const a0=al(0xb7)===Y['framework']?[al(0xd1),al(0xe6)]:['AGENTS.md'];for(const a1 of a0){const a2=E['join'](Y[al(0xf8)],a1);if(!await L(a2)){await D(a2,Z+'\x0a','utf8');continue;}const a3=await z(a2,al(0xb3));a3['includes'](Z)||await D(a2,a3[al(0xfb)]()+'\x0a\x0a'+Z+'\x0a',al(0xb3));}}(X),await Q(V['configFile'],X,0x180),this[ak(0x9f)](X);}async[ah(0xf6)](R,U){const am=ah,V=this[am(0x104)][am(0xeb)](R);V?.['runtime']&&await V['runtime']['stop'](U||am(0xf6)),this[am(0x104)]['delete'](R);const W=G(R)[am(0xaf)],X=await M(W,{})[am(0xf1)](()=>({}));await Q(W,{...X,'disconnectedAt':Date['now'](),'disconnectReason':U||''},0x180);}async['reload'](R){const an=ah,U=R?[this['requireAgent']({'agentId':R})]:[...this['agents'][an(0x9d)]()],V=[];for(const W of U)W[an(0xb9)]&&(await W['runtime'][an(0xa0)]('reload'),W[an(0xb9)]=void 0x0),V[an(0xdb)](W['config'][an(0xd5)]);return{'ok':!0x0,'reloaded':V};}async['detail'](R={}){const ao=ah,U=this['requireAgent'](R);return{'agent':A(U['config']),'health':this[ao(0xcb)]()[ao(0xed)](V=>V[ao(0xd5)]===U['config'][ao(0xd5)])};}async['getFileTree'](R={}){const ap=ah,U=this['requireAgent'](R),V=U['config']['workspace'],W=O(R[ap(0xf9)]??R['filePath']??''),X=P(V,W),Y=I(R['maxDepth']??R['depth']??0x5,0x0,0x14),Z=function(a1,a2){const aq=ap,a3=new Set(k);for(const a4 of a1['fileTreeExclude']??[])a3[aq(0xc7)](a4);for(const a5 of a2[aq(0xbf)]??[])a3[aq(0xc7)](a5);for(const a6 of a2[aq(0xaa)]??[])a3['delete'](a6);return a3;}(U[ap(0xda)],R),a0={'count':0x0,'truncated':!0x1};return{'workspace':V,'path':W,'tree':await y(V,X,W,Y,Z,a0),'truncated':a0[ap(0xcd)],'totalNodes':a0['count']};}async[ah(0xad)](R={}){const ar=ah,U=this['requireAgent'](R)['config']['workspace'],V=O(R['path']??R['filePath']);if(!V)throw new Error('_agent/getFileContent:\x20missing\x20path');const W=P(U,V),X=await C(W);if(!X['isFile']())throw new Error(ar(0xbe)+V);const Y=I(R[ar(0xde)]??0x100000,0x1,0xa00000),Z=await z(W),a0=Z['byteLength']>Y?Z['subarray'](0x0,Y):Z;return{'path':V,'size':Z['byteLength'],'content':a0['toString'](R['encoding']||ar(0xb3)),'encoding':R['encoding']||'utf8','truncated':Z['byteLength']>Y,'mtimeMs':X['mtimeMs']};}async['listSkills'](R={}){const as=ah,U=this['requireAgent'](R);return{'agentId':U['config'][as(0xd5)],'skills':S(U['config']['skills']??[])};}async['addSkills'](R={}){const at=ah,U=this[at(0x98)](R),V=Array[at(0xee)](R['skills'])?R['skills']:[];if(0x0===V['length'])return{'installedSkills':[],'skills':S(U['config']['skills']??[])};const W=[],X=S(U['config'][at(0xa1)]??[]),Y=new Map(X[at(0x101)]((Z,a0)=>[Z['skillId'],a0]));for(const Z of V){const a0=await this[at(0xc5)](U['config'],Z,R);Y['has'](a0['skillId'])?X[Y['get'](a0[at(0xc2)])]=a0:(Y['set'](a0[at(0xc2)],X['length']),X[at(0xdb)](a0)),W['push'](a0);}return await this[at(0x9c)](U,X,'skills-added'),{'installedSkills':W,'skills':X};}async['removeSkills'](R={}){const au=ah,U=this['requireAgent'](R),V=new Set((R['skillIds']??R['skills']??[])['map'](Z=>au(0xf3)==typeof Z?Z:v(Z)));if(0x0===V[au(0x105)])return{'ok':!0x0,'skills':S(U['config']['skills']??[])};const W=S(U['config']['skills']??[]),X=[],Y=[];for(const Z of W){if(!V['has'](Z['skillId'])){X['push'](Z);continue;}const a0=P(U[au(0xda)]['workspace'],Z['relPath']);await B(a0,{'recursive':!0x0,'force':!0x0}),Y['push'](Z);}return await this['updateAgentSkills'](U,X,au(0xb5)),{'ok':!0x0,'removedSkills':Y,'skills':X};}async['handleSession'](R,U){const av=ah,V=U?.['_meta']?.['cozeAgentId']||U?.[av(0xd5)];if(!V)throw new Error(R+':\x20missing\x20_meta.cozeAgentId');let W=this[av(0x104)]['get'](V);const X=K(U['framework']||U['runtimeProvider']||U[av(0xce)]||W?.['config']['framework']||'codex');if(!W||W['config'][av(0xb2)]!==X){W?.['runtime']&&await W['runtime'][av(0xa0)]('framework-changed');const Z=W?.['config']??{};await this['createOrUpdate']({...Z,'agentId':V,'name':U['name']||Z['name']||V,'framework':X,'runtimeProvider':X}),W=this['agents']['get'](V);}if(!W)throw new Error('agent\x20not\x20found:\x20'+V);if(W['lastActiveAt']=Date[av(0xf7)](),av(0x9a)===R)return{'sessionId':U['sessionId']||q()};if(av(0x9b)===R)return await W[av(0xb9)]?.['cancel'](U),{'ok':!0x0};if(av(0x97)!==R)throw new Error('unsupported\x20session\x20method:\x20'+R);if('cloud'===W[av(0xda)]['deployType'])throw new Error(av(0xec)+V+'\x20is\x20cloud\x20deploy\x20type;\x20local\x20bridge\x20does\x20not\x20spawn\x20it');const Y=function(a0={}){const aw=av,a1={...a0};if(!Array[aw(0xee)](a1['prompt'])){const a2=a1['content']??a1[aw(0xc9)]??a1[aw(0xbc)]??'';a1[aw(0xae)]=[{'type':'text','text':String(a2)}];}return a1;}(U);return W['runtime']||(W[av(0xb9)]=new F({'agentConfig':W[av(0xda)],'onUpdate':(a0,a1)=>this['cloud'][av(0xf5)]('session/update',{...a1,'_meta':{...a1['_meta']||{},'cozeAgentId':a0['agentId'],'cozeCloudSessionId':Y['sessionId'],'licosTurnId':Y['_meta']?.[av(0xa4)]}}),'onClientRequest':(a0,a1,a2)=>this['cloud'][av(0xdc)](a0,a1,a2),'logger':this[av(0xea)]})),W['runtime']['prompt'](Y);}async['stopAll'](R){const ax=ah;for(const U of this[ax(0x104)]['values']())await U[ax(0xb9)]?.[ax(0xa0)](R);}[ah(0x98)](R={}){const ay=ah,U=R?.[ay(0xa9)]?.['cozeAgentId']||R?.[ay(0xd5)]||R?.['id'];if(!U)throw new Error('missing\x20agentId');const V=this['agents'][ay(0xeb)](U);if(!V)throw new Error(ay(0xc4)+U);return V;}async['updateAgentSkills'](R,U,V){const az=ah;R[az(0xda)]['skills']=S(U),R['config'][az(0xb8)]=new Date()['toISOString'](),await Q(G(R['config']['agentId'])['configFile'],R['config'],0x180),R['runtime']&&(await R[az(0xb9)]['stop'](V),R['runtime']=void 0x0);}async['installSkill'](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['path']||a3[aA(0xd8)]);await J(E['dirname'](E['join'](a1,a4))),await D(P(a1,a4),String(a3[aA(0xc8)]??''),aA(0xb3));}else for(const [a5,a6]of Object[aA(0xc1)](a2)){const a7=O(a5);await J(E['dirname'](E['join'](a1,a7))),await D(P(a1,a7),String(a6??''),'utf8');}}(Z,U[aB(0xa8)]):U[aB(0xc8)]||U[aB(0xd4)]||U['skill_md']?await D(E[aB(0xfe)](Z,'SKILL.md'),String(U[aB(0xc8)]??U['skillMd']??U[aB(0x9e)]),'utf8'):$(U)?await async function(a1,a2,a3){const aC=aB,a4=$(a2),a5={},a6=a2[aC(0xba)]||a2[aC(0xa6)]||a2['access_token']||a3['token']||a3['accessToken']||a3[aC(0xff)];a6&&(a5['authorization']='Bearer\x20'+a6);const a7=await fetch(a4,{'headers':a5});if(!a7['ok'])throw new Error(aC(0xdd)+a7[aC(0xb1)]+'\x20'+await a7[aC(0xc9)]());const a8=Buffer[aC(0xe0)](await a7[aC(0xcc)]());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['isDirectory'])continue;const ae=O(ad[aD(0x100)]),af=P(a9,ae);await J(E['dirname'](af)),await D(af,ad[aD(0xd7)]());}}(a1,a8);}(Z,U,V):await D(E['join'](Z,aB(0xe1)),function(a1){const aE=aB,a2=a1['name']||v(a1),a3=a1[aE(0xcf)]||'';return aE(0xe5)+a2+aE(0x99)+a3+aE(0xa3)+a2+'\x0a\x0a'+a3+'\x0a';}(U),aB(0xb3));const a0=await async function(a1){const aF=aB,a2=await z(E['join'](a1,'SKILL.md'),'utf8')[aF(0xf1)](()=>''),a3=a2[aF(0xf0)](/^---\s*([\s\S]*?)\s*---/),a4=a3?.[0x1]||a2;return{'name':T(a4,'name')||a2['match'](/^#\s+(.+)$/m)?.[0x1]?.['trim'](),'description':T(a4,'description')||T(a4,'desc')||''};}(Z);return{'skillId':W,'name':a0[aB(0xd8)]||U['name']||W,'description':a0['description']||U['description']||'','sourceType':U[aB(0xc0)]||U[aB(0xe3)]||U['type']||aB(0xd2),'iconUrl':U[aB(0xf2)]||U['icon']||'','relPath':Y,'enabled':!0x1!==U['enabled'],'installedAt':new Date()['toISOString']()};}['health'](){const aG=ah;return[...this[aG(0x104)]['values']()]['map'](R=>({'agentId':R[aG(0xda)][aG(0xd5)],'name':R['config'][aG(0xd8)],'framework':R['config']['framework'],'deployType':R['config']['deployType'],'status':R[aG(0xb9)]?.[aG(0xc3)]()?'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[aH(0xca)]+=0x1;const Z=await C(U),a0={'name':V?E['basename'](V):'','path':V,'type':Z['isDirectory']()?aH(0xfa):'file','size':Z['size'],'mtimeMs':Z['mtimeMs']};if(!Z[aH(0xbb)]()||W<=0x0)return a0;const a1=await x(U,{'withFileTypes':!0x0}),a2=[];for(const a3 of a1['sort']((a4,a5)=>a4[aH(0xd8)]['localeCompare'](a5['name']))){if(X[aH(0xdf)](a3['name']))continue;const a4=V?V+'/'+a3[aH(0xd8)]:a3['name'],a5=await y(R,P(R,a4),a4,W-0x1,X,Y);if(a5&&a2[aH(0xdb)](a5),Y[aH(0xcd)])break;}return a0['children']=a2,a0;}function I(R,U,V){const aI=ah,W=Number(R);return Number['isFinite'](W)?Math[aI(0x107)](U,Math['min'](V,Math[aI(0xd3)](W))):U;}function A(R){const aJ=ah,{cozeIdentity:U,...V}=R;return{...V,'hasIdentity':Boolean(U),'skills':S(R[aJ(0xa1)]??[])};}function S(R){const aK=ah;return R['map'](U=>({'skillId':U['skillId']||U['id'],'name':U[aK(0xd8)]||U[aK(0xc2)]||U['id'],'description':U['description']||'','sourceType':U['sourceType']||U['source']||aK(0xd2),'iconUrl':U['iconUrl']||U['icon']||'','relPath':O(U[aK(0xb0)]||'.skills/'+N(U[aK(0xc2)]||U['id']||U['name'],'skill')),'enabled':!0x1!==U['enabled'],'installedAt':U['installedAt']}))[aK(0xd0)](U=>U[aK(0xc2)]);}function v(R){const aL=ah,U=R?.['skillId']||R?.['id']||R?.['code']||R?.[aL(0xd8)];if(!U)throw new Error('_agent/addSkills:\x20skillId\x20is\x20required');return String(U);}function $(R){const aM=ah;return R[aM(0xa7)]||R['download_url']||R['packageUrl']||R[aM(0xe2)]||R['archiveUrl']||R['archive_url']||R[aM(0xe7)];}function T(R,U){const aN=ah,V=U['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),W=R[aN(0xf0)](new RegExp('^'+V+'\x5cs*:\x5cs*(.+)$','mi'));return W?.[0x1]?.['replace'](/^['"]|['"]$/g,'')['trim']();}
|
|
1
|
+
const al=q;(function(X,Y){const ak=q,Z=X();while(!![]){try{const a0=-parseInt(ak(0x12e))/0x1+-parseInt(ak(0x134))/0x2+-parseInt(ak(0x138))/0x3+parseInt(ak(0x149))/0x4*(-parseInt(ak(0x10c))/0x5)+parseInt(ak(0x109))/0x6+-parseInt(ak(0xf7))/0x7+-parseInt(ak(0x135))/0x8*(-parseInt(ak(0x14b))/0x9);if(a0===Y)break;else Z['push'](Z['shift']());}catch(a1){Z['push'](Z['shift']());}}}(j,0x7e2bc));import{randomUUID as z}from'node:crypto';import{readdir as B,readFile as C,rm as F,stat as G,writeFile as H}from'node:fs/promises';import J from'node:path';import{AcpRuntime as K}from'./acp-runtime.js';import{agentPaths as L,resolvePaths as M}from'./paths.js';import{ensureDir as N,normalizeFramework as O,pathExists as P,readJson as Q,safeName as R,safeRelativePath as U,safeResolve as V,writeJson as W}from'./utils.js';const y=new Set(['node_modules','.git',al(0x12a),'.nuxt',al(0x13e),al(0x143),al(0xdf),al(0x133),al(0xf6),al(0xe0),'.venv',al(0x129)]);export class AgentManager{constructor({cloud:X,logger:Y}){const am=al;this[am(0xcc)]=X,this['logger']=Y,this[am(0xdb)]=new Map(),this['responseBuffers']=new Map();}async['loadPersistedAgents'](){const an=al,X=M();await N(X[an(0xd7)]);const Y=await B(X['agentsRoot'],{'withFileTypes':!0x0})[an(0x137)](()=>[]);for(const Z of Y){if(!Z['isDirectory']())continue;const a0=L(Z[an(0xd0)])[an(0x110)],a1=await Q(a0)['catch'](()=>{});a1?.[an(0x11f)]&&!a1[an(0x14c)]&&this[an(0xde)](a1);}}['register'](X){const ao=al,Y={'deployType':'local',...X,'framework':O(X['framework'])};return this['agents'][ao(0xf9)](Y['agentId'],{'config':Y,'runtime':void 0x0,'lastActiveAt':Date['now']()}),Y;}async['createOrUpdate'](X={}){const ap=al,Y=X[ap(0x11f)]||X['id']||z(),Z=L(Y);await N(Z[ap(0x146)]),await N(Z['logs']);const a0=await Q(Z['configFile'],{})['catch'](()=>({})),a1={...a0,'agentId':Y,'name':X['name']||a0['name']||Y,'description':X['description']??a0['description']??'','framework':O(X[ap(0xf2)]||X['runtimeProvider']||X['runtime_provider']||a0[ap(0xf2)]||'codex'),'deployType':ap(0xcc)===X['_meta']?.['licosDeployType']?'cloud':X[ap(0x111)]||a0['deployType']||ap(0x12f),'workspace':X['workspace']||a0[ap(0x146)]||Z['workspace'],'licosIdentity':k(X)||a0[ap(0x131)]||'','model':X[ap(0xfe)]??a0[ap(0xfe)],'modelInfo':X['modelInfo']??a0['modelInfo'],'mcpServers':X['mcpServers']??a0[ap(0xff)]??[],'updatedAt':new Date()['toISOString'](),'createdAt':a0['createdAt']||new Date()['toISOString']()};return a1['licosIdentity']&&await D(a1),await W(Z['configFile'],a1,0x180),this['register'](a1);}async['disconnect'](X,Y){const aq=al,Z=this['agents']['get'](X);Z?.['runtime']&&await Z[aq(0x128)]['stop'](Y||aq(0x12d)),this['agents']['delete'](X);const a0=L(X)['configFile'],a1=await Q(a0,{})[aq(0x137)](()=>({}));await W(a0,{...a1,'disconnectedAt':Date['now'](),'disconnectReason':Y||''},0x180);}async[al(0xea)](X){const ar=al,Y=X?[this['requireAgent']({'agentId':X})]:[...this['agents']['values']()],Z=[];for(const a0 of Y)a0['runtime']&&(await a0[ar(0x128)][ar(0x113)](ar(0xea)),a0['runtime']=void 0x0),Z['push'](a0[ar(0x13c)][ar(0x11f)]);return{'ok':!0x0,'reloaded':Z};}async[al(0xf5)](X={}){const as=al,Y=this['requireAgent'](X);return{'agent':_(Y['config']),'health':this[as(0xef)]()['find'](Z=>Z[as(0x11f)]===Y[as(0x13c)]['agentId'])};}async['getFileTree'](X={}){const at=al,Y=this['requireAgent'](X),Z=Y['config']['workspace'],a0=U(X['path']??X[at(0x102)]??''),a1=V(Z,a0),a2=v(X['maxDepth']??X[at(0xe9)]??0x5,0x0,0x14),a3=function(a5,a6){const au=at,a7=new Set(y);for(const a8 of a5['fileTreeExclude']??[])a7[au(0xe6)](a8);for(const a9 of a6[au(0xe2)]??[])a7[au(0xe6)](a9);for(const aa of a6[au(0x11d)]??[])a7[au(0x11c)](aa);return a7;}(Y['config'],X),a4={'count':0x0,'truncated':!0x1};return{'workspace':Z,'path':a0,'tree':await $(Z,a1,a0,a2,a3,a4),'truncated':a4['truncated'],'totalNodes':a4['count']};}async['getFileContent'](X={}){const av=al,Y=this['requireAgent'](X)['config']['workspace'],Z=U(X['path']??X['filePath']);if(!Z)throw new Error(av(0x11b));const a0=V(Y,Z),a1=await G(a0);if(!a1['isFile']())throw new Error(av(0xce)+Z);const a2=v(X[av(0x108)]??0x100000,0x1,0xa00000),a3=await C(a0),a4=a3['byteLength']>a2?a3['subarray'](0x0,a2):a3;return{'path':Z,'size':a3[av(0x120)],'content':a4['toString'](X['encoding']||'utf8'),'encoding':X['encoding']||av(0x107),'truncated':a3['byteLength']>a2,'mtimeMs':a1['mtimeMs']};}async[al(0x10f)](X={}){const aw=al,Y=this['requireAgent'](X);return{'agentId':Y['config']['agentId'],'skills':T(Y['config'][aw(0x10d)]??[])};}async['addSkills'](X={}){const ax=al,Y=this[ax(0x118)](X),Z=Array[ax(0x145)](X['skills'])?X[ax(0x10d)]:[];if(0x0===Z['length'])return{'installedSkills':[],'skills':T(Y['config']['skills']??[])};const a0=[],a1=T(Y['config']['skills']??[]),a2=new Map(a1['map']((a3,a4)=>[a3['skillId'],a4]));for(const a3 of Z){const a4=await this[ax(0x114)](Y['config'],a3,X);a2['has'](a4[ax(0x105)])?a1[a2['get'](a4[ax(0x105)])]=a4:(a2['set'](a4[ax(0x105)],a1['length']),a1[ax(0x130)](a4)),a0[ax(0x130)](a4);}return await this[ax(0x147)](Y,a1,ax(0x124)),{'installedSkills':a0,'skills':a1};}async['removeSkills'](X={}){const ay=al,Y=this['requireAgent'](X),Z=new Set((X['skillIds']??X['skills']??[])['map'](a3=>'string'==typeof a3?a3:x(a3)));if(0x0===Z[ay(0x126)])return{'ok':!0x0,'skills':T(Y['config'][ay(0x10d)]??[])};const a0=T(Y[ay(0x13c)]['skills']??[]),a1=[],a2=[];for(const a3 of a0){if(!Z['has'](a3['skillId'])){a1['push'](a3);continue;}const a4=V(Y[ay(0x13c)]['workspace'],a3['relPath']);await F(a4,{'recursive':!0x0,'force':!0x0}),a2[ay(0x130)](a3);}return await this['updateAgentSkills'](Y,a1,ay(0xfd)),{'ok':!0x0,'removedSkills':a2,'skills':a1};}async['handleSession'](X,Y){const az=al,Z=Y?.['_meta']?.['licosAgentId']||Y?.['agentId'];if(!Z)throw new Error(X+':\x20missing\x20_meta.licosAgentId');let a0=this['agents'][az(0x11a)](Z);const a1=O(Y[az(0xf2)]||Y['runtimeProvider']||Y[az(0x121)]||a0?.[az(0x13c)][az(0xf2)]||az(0x13d));if(!a0||a0['config']['framework']!==a1){a0?.['runtime']&&await a0[az(0x128)]['stop']('framework-changed');const a4=a0?.['config']??{};await this['createOrUpdate']({...a4,'agentId':Z,'name':Y[az(0xd0)]||a4['name']||Z,'description':Y['description']??a4[az(0xdc)]??'','licosIdentity':k(Y)||a4['licosIdentity']||'','framework':a1,'runtimeProvider':a1}),a0=this['agents'][az(0x11a)](Z);}if(!a0)throw new Error(az(0x125)+Z);if(await this['updateAgentIdentity'](a0,Y),a0['lastActiveAt']=Date[az(0x13b)](),'session/new'===X)return{'sessionId':Y['sessionId']||z()};if('session/cancel'===X)return await a0['runtime']?.[az(0x10a)](Y),{'ok':!0x0};if(az(0x11e)!==X)throw new Error(az(0xf8)+X);if('cloud'===a0[az(0x13c)]['deployType'])throw new Error(az(0xe1)+Z+az(0xfb));const a2=function(a5={},a6={}){const aA=az,a7={...a5};if(!Array['isArray'](a7[aA(0x14a)])){const aa=a7['content']??a7[aA(0x142)]??a7[aA(0x117)]??'';a7['prompt']=[{'type':'text','text':String(aa)}];}const a8=function(ab={},ac={}){const aB=aA,ad=k(ab)||I(ac['licosIdentity']);return ad?'【平台助手身份】\x0a'+ad+aB(0x112):'';}(a5,a6);var a9;return!a8||(a9=a7['prompt'],Array['isArray'](a9)&&a9['some'](ab=>aA(0x142)===ab?.['type']&&String(ab[aA(0x142)]||'')['includes'](aA(0xd4))))||(a7['prompt']=[{'type':'text','text':a8},...a7['prompt']]),a7;}(Y,a0['config']),a3=A(Z,a2['sessionId']);this['responseBuffers'][az(0xf9)](a3,''),a0['runtime']||(a0['runtime']=new K({'agentConfig':a0['config'],'onUpdate':(a5,a6,a7)=>this['handleRuntimeUpdate'](a5,a6,a7),'onClientRequest':(a5,a6,a7)=>this['cloud'][az(0xf0)](a5,a6,a7),'logger':this['logger']}));try{const a5=await a0[az(0x128)]['prompt'](a2),a6=this[az(0x141)]['get'](a3)||'';return a6?{...a5,'text':a6,'answer':a6,'content':a6}:a5;}finally{this['responseBuffers'][az(0x11c)](a3);}}async[al(0xe4)](X){const aC=al;for(const Y of this['agents']['values']())await Y[aC(0x128)]?.['stop'](X);}async['handleRuntimeUpdate'](X,Y,Z={}){const aD=al,a0=Y?.['update']||Y,a1=Z['cloudSessionId']||Y?.['sessionId']||Y?.['session_id']||a0?.['sessionId']||a0?.['session_id'],a2={...Z[aD(0xec)]||{},...a0?.['_meta']||{},...Y?.['_meta']||{},'licosAgentId':X['agentId'],'licosSessionId':a1,'licosTurnId':Z[aD(0xec)]?.['licosTurnId']||a0?.['_meta']?.[aD(0xeb)]||Y?.['_meta']?.[aD(0xeb)]},a3=function(a4){const aE=aD,a5=a4?.['update']||a4;return aE(0x123)!==a5?.['sessionUpdate']?'':S(a5['content']);}(Y);if(a3&&a1){const a4=A(X[aD(0x11f)],a1);this[aD(0x141)]['set'](a4,''+(this[aD(0x141)][aD(0x11a)](a4)||'')+a3);}await this[aD(0xcc)]['sendNotification']('session/update',{...Y,'_meta':a2});}[al(0x118)](X={}){const aF=al,Y=X?.[aF(0x127)]?.[aF(0x106)]||X?.[aF(0x11f)]||X?.['id'];if(!Y)throw new Error('missing\x20agentId');const Z=this['agents']['get'](Y);if(!Z)throw new Error('agent\x20not\x20found:\x20'+Y);return Z;}async['updateAgentSkills'](X,Y,Z){const aG=al;X['config'][aG(0x10d)]=T(Y),X[aG(0x13c)][aG(0x13f)]=new Date()['toISOString'](),await W(L(X[aG(0x13c)]['agentId'])['configFile'],X['config'],0x180),X[aG(0x128)]&&(await X['runtime'][aG(0x113)](Z),X['runtime']=void 0x0);}async[al(0x10b)](X,Y={}){const aH=al,Z=k(Y),a0=I(Y['name'])||X[aH(0x13c)]['name'],a1=void 0x0===Y['description']?X['config'][aH(0xdc)]??'':String(Y[aH(0xdc)]??''),a2=Z||X['config']['licosIdentity']||'';(a0!==X[aH(0x13c)]['name']||a1!==(X['config']['description']??'')||a2!==(X['config']['licosIdentity']??''))&&(X['config']['name']=a0,X['config'][aH(0xdc)]=a1,X[aH(0x13c)][aH(0x131)]=a2,X[aH(0x13c)]['updatedAt']=new Date()[aH(0xf4)](),a2&&await D(X['config']),await W(L(X['config']['agentId'])['configFile'],X[aH(0x13c)],0x180));}async['installSkill'](X,Y,Z){const aI=al,a0=x(Y),a1=R(a0,'skill'),a2=U(Y['relPath']||'.skills/'+a1),a3=V(X[aI(0x146)],a2);await F(a3,{'recursive':!0x0,'force':!0x0}),await N(a3),Y['files']?await async function(a5,a6){const aJ=aI;if(Array['isArray'](a6))for(const a7 of a6){const a8=U(a7['path']||a7['name']);await N(J['dirname'](J[aJ(0xe8)](a5,a8))),await H(V(a5,a8),String(a7['content']??''),aJ(0x107));}else for(const [a9,aa]of Object['entries'](a6)){const ab=U(a9);await N(J['dirname'](J['join'](a5,ab))),await H(V(a5,ab),String(aa??''),'utf8');}}(a3,Y[aI(0x119)]):Y['content']||Y['skillMd']||Y['skill_md']?await H(J[aI(0xe8)](a3,aI(0x140)),String(Y['content']??Y[aI(0x148)]??Y[aI(0x132)]),'utf8'):E(Y)?await async function(a5,a6,a7){const aK=aI,a8=E(a6),a9={},aa=a6[aK(0xd6)]||a6['accessToken']||a6['access_token']||a7['token']||a7[aK(0x116)]||a7['access_token'];aa&&(a9['authorization']=aK(0xed)+aa);const ab=await fetch(a8,{'headers':a9});if(!ab['ok'])throw new Error('download\x20skill\x20failed:\x20HTTP\x20'+ab['status']+'\x20'+await ab['text']());const ac=Buffer[aK(0xd9)](await ab[aK(0x100)]());await async function(ad,ae){const aL=aK,{default:af}=await import('adm-zip'),ag=new af(ae);for(const ah of ag['getEntries']()){if(ah[aL(0x13a)])continue;const ai=U(ah['entryName']),aj=V(ad,ai);await N(J[aL(0xfc)](aj)),await H(aj,ah[aL(0xe5)]());}}(a5,ac);}(a3,Y,Z):await H(J['join'](a3,'SKILL.md'),function(a5){const aM=aI,a6=a5['name']||x(a5),a7=a5['description']||'';return aM(0xdd)+a6+'\x0adescription:\x20'+a7+'\x0a---\x0a\x0a#\x20'+a6+'\x0a\x0a'+a7+'\x0a';}(Y),'utf8');const a4=await async function(a5){const aN=aI,a6=await C(J['join'](a5,'SKILL.md'),aN(0x107))[aN(0x137)](()=>''),a7=a6['match'](/^---\s*([\s\S]*?)\s*---/),a8=a7?.[0x1]||a6;return{'name':b(a8,aN(0xd0))||a6[aN(0xf3)](/^#\s+(.+)$/m)?.[0x1]?.['trim'](),'description':b(a8,'description')||b(a8,aN(0xd8))||''};}(a3);return{'skillId':a0,'name':a4[aI(0xd0)]||Y['name']||a0,'description':a4[aI(0xdc)]||Y['description']||'','sourceType':Y['sourceType']||Y['source']||Y['type']||'platform','iconUrl':Y[aI(0x101)]||Y[aI(0x12b)]||'','relPath':a2,'enabled':!0x1!==Y['enabled'],'installedAt':new Date()[aI(0xf4)]()};}['health'](){const aO=al;return[...this[aO(0xdb)]['values']()][aO(0x139)](X=>({'agentId':X['config']['agentId'],'name':X['config']['name'],'framework':X[aO(0x13c)][aO(0xf2)],'deployType':X['config']['deployType'],'status':X[aO(0x128)]?.['isAlive']()?'running':'idle','lastActiveAt':X['lastActiveAt']}));}}function k(X={}){const aP=al,Y=I(X['licosIdentity']??X['instructions']);if(Y)return Y;const Z=I(X[aP(0xd0)]),a0=I(X['description']);return Z||a0?[Z?aP(0xd2)+Z+'」。':'',a0?aP(0xe3)+a0:'',aP(0xf1),'当用户询问“你是谁”“你是什么”“你能做什么”时,按助手名称和介绍回答。',aP(0xe7)][aP(0xcf)](Boolean)[aP(0xe8)]('\x0a'):'';}function I(X){const aQ=al;return null==X?'':String(X)[aQ(0x10e)]();}function A(X,Y){return(X||'')+':'+(Y||'');}function S(X){const aR=al;return X?aR(0xd1)==typeof X?X:'text'===X[aR(0x103)]?String(X['text']||''):Array['isArray'](X)?X['map'](S)['join'](''):'':'';}async function $(X,Y,Z,a0,a1,a2){const aS=al;if(a2['count']>=0xbb8)return void(a2[aS(0x122)]=!0x0);a2['count']+=0x1;const a3=await G(Y),a4={'name':Z?J['basename'](Z):'','path':Z,'type':a3[aS(0x13a)]()?'directory':'file','size':a3[aS(0x126)],'mtimeMs':a3[aS(0xfa)]};if(!a3['isDirectory']()||a0<=0x0)return a4;const a5=await B(Y,{'withFileTypes':!0x0}),a6=[];for(const a7 of a5['sort']((a8,a9)=>a8['name']['localeCompare'](a9['name']))){if(a1[aS(0xd3)](a7[aS(0xd0)]))continue;const a8=Z?Z+'/'+a7['name']:a7[aS(0xd0)],a9=await $(X,V(X,a8),a8,a0-0x1,a1,a2);if(a9&&a6[aS(0x130)](a9),a2['truncated'])break;}return a4['children']=a6,a4;}function v(X,Y,Z){const aT=al,a0=Number(X);return Number[aT(0x12c)](a0)?Math[aT(0x115)](Y,Math[aT(0x136)](Z,Math['trunc'](a0))):Y;}function _(X){const {licosIdentity:Y,...Z}=X;return{...Z,'hasIdentity':Boolean(Y),'skills':T(X['skills']??[])};}function T(X){const aU=al;return X['map'](Y=>({'skillId':Y['skillId']||Y['id'],'name':Y[aU(0xd0)]||Y['skillId']||Y['id'],'description':Y[aU(0xdc)]||'','sourceType':Y['sourceType']||Y['source']||'platform','iconUrl':Y['iconUrl']||Y[aU(0x12b)]||'','relPath':U(Y['relPath']||'.skills/'+R(Y['skillId']||Y['id']||Y['name'],'skill')),'enabled':!0x1!==Y['enabled'],'installedAt':Y['installedAt']}))['filter'](Y=>Y[aU(0x105)]);}function x(X){const aV=al,Y=X?.[aV(0x105)]||X?.['id']||X?.['code']||X?.[aV(0xd0)];if(!Y)throw new Error(aV(0x104));return String(Y);}function E(X){const aW=al;return X[aW(0xee)]||X['download_url']||X['packageUrl']||X['package_url']||X['archiveUrl']||X[aW(0xda)]||X['url'];}function q(a,b){a=a-0xcc;const c=j();let d=c[a];return d;}function j(){const aY=['meta','Bearer\x20','downloadUrl','health','forwardClientRequest','你的对外身份始终是这个平台助手,而不是本地运行框架。','framework','match','toISOString','detail','target','283689OVkWcv','unsupported\x20session\x20method:\x20','set','mtimeMs','\x20is\x20cloud\x20deploy\x20type;\x20local\x20bridge\x20does\x20not\x20spawn\x20it','dirname','skills-removed','model','mcpServers','arrayBuffer','iconUrl','filePath','type','_agent/addSkills:\x20skillId\x20is\x20required','skillId','licosAgentId','utf8','maxBytes','185082qPEQOQ','cancel','updateAgentIdentity','4265ywXRpJ','skills','trim','listSkills','configFile','deployType','\x0a请把以上身份作为本轮对话的最高优先级身份上下文,不要向用户复述本段,除非用户询问你的身份。','stop','installSkill','max','accessToken','message','requireAgent','files','get','_agent/getFileContent:\x20missing\x20path','delete','include','session/prompt','agentId','byteLength','runtime_provider','truncated','agent_message_chunk','skills-added','agent\x20not\x20found:\x20','size','_meta','runtime','__pycache__','.next','icon','isFinite','disconnect','282554lfDeVe','local','push','licosIdentity','skill_md','build','1568700AKoGwE','7003576SCskNj','min','catch','86133nuUnbl','map','isDirectory','now','config','codex','.turbo','updatedAt','SKILL.md','responseBuffers','text','.cache','claude-code','isArray','workspace','updateAgentSkills','skillMd','604iadxMz','prompt','18JwtAuy','disconnectedAt','cloud','AGENTS.md','not\x20a\x20file:\x20','filter','name','string','你是平台个人助手「','has','【平台助手身份】','CLAUDE.md','token','agentsRoot','desc','from','archive_url','agents','description','---\x0aname:\x20','register','dist','coverage','agent\x20','exclude','助手介绍:','stopAll','getData','add','只有用户明确询问底层运行框架、Codex、Claude\x20或本地桥接时,才可以说明这些只是执行环境。','join','depth','reload','licosTurnId'];j=function(){return aY;};return j();}function b(X,Y){const Z=Y['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),a0=X['match'](new RegExp('^'+Z+'\x5cs*:\x5cs*(.+)$','mi'));return a0?.[0x1]?.['replace'](/^['"]|['"]$/g,'')['trim']();}async function D(X){const aX=al,Y=X['licosIdentity'][aX(0x10e)]();if(!Y)return;await N(X['workspace']);const Z=aX(0x144)===X['framework']?[aX(0xd5),'AGENTS.md']:[aX(0xcd)];for(const a0 of Z){const a1=J['join'](X[aX(0x146)],a0);if(!await P(a1)){await H(a1,Y+'\x0a','utf8');continue;}const a2=await C(a1,'utf8');a2['includes'](Y)||await H(a1,a2['trimEnd']()+'\x0a\x0a'+Y+'\x0a','utf8');}}
|
package/dist/lib/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(c,d){const o=b,f=c();while(!![]){try{const g=-parseInt(o(0x1d8))/0x1+parseInt(o(0x1da))/0x2+parseInt(o(0x1dd))/0x3*(parseInt(o(0x1e2))/0x4)+-parseInt(o(0x1e5))/0x5*(parseInt(o(0x1d6))/0x6)+parseInt(o(0x1de))/0x7+-parseInt(o(0x1d9))/0x8+parseInt(o(0x1d4))/0x9*(parseInt(o(0x1db))/0xa);if(g===d)break;else f['push'](f['shift']());}catch(h){f['push'](f['shift']());}}}(a,0xd2a77));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(0x1c9)};if(e(d,'--daemon'))return{'mode':'daemon'};if(e(d,p(0x1c5)))return{'mode':'status','deprecated':'--status\x20->\x20status'};if(e(d,p(0x1c1)))return{'mode':'stop','deprecated':p(0x1c6)};if(e(d,'--refresh'))return{'mode':'refresh','deprecated':'--refresh\x20->\x20refresh'};if(e(d,'--install-service'))return{'mode':'service-install','deprecated':p(0x1d3)};if(e(d,p(0x1dc)))return{'mode':'purge','deprecated':'--uninstall\x20->\x20purge'};const [f,g]=d;if('status'===f)return{'mode':p(0x1ca)};if('stop'===f)return{'mode':'stop'};if(p(0x1c4)===f)return{'mode':'refresh'};if('reload'===f)return{'mode':p(0x1e6),'agentId':n(d,p(0x1e3))};if('log'===f)return{'mode':'log','agentId':n(d,'--agent-id'),'date':n(d,p(0x1c7)),'tail':Number(n(d,'-n')??n(d,'--tail')??0xc8),'follow':e(d,'-f')||e(d,'--follow'),'level':n(d,'--level'),'grep':n(d,'--grep'),'raw':e(d,'--raw'),'list':e(d,p(0x1d2))};if('update'===f)return{'mode':'update'};if('purge'===f)return{'mode':p(0x1e1)};if(p(0x1d5)===f&&'install'===g)return{'mode':'service-install'};if('service'===f&&'uninstall'===g)return{'mode':'service-uninstall'};if(p(0x1cf)===f)return{'mode':'connect','patToken':n(d,'--pat-token'),'env':n(d,p(0x1cd)),'handshakeUrl':n(d,'--handshake-url'),'frontierUrl':n(d,'--frontier-url'),'mockScenario':n(d,p(0x1ce)),'agentId':n(d,'--agent-id')};if('send'===f)return function(k){const q=p,l=k[0x1],m=k[0x2];return['image',q(0x1c2)]['includes'](l)&&m?{'mode':q(0x1cc),'kind':l,'target':m,'agentId':n(k,'--agent-id'),'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('daemon'===f)return{'mode':p(0x1d1)};const h=n(d,p(0x1d0)),j=n(d,'--pair-code');return h&&j?{'mode':'pair','patToken':h,'pairCode':j,'agentId':n(d,p(0x1e3)),'env':n(d,p(0x1cd)),'handshakeUrl':n(d,p(0x1df)),'frontierUrl':n(d,p(0x1e0)),'mockScenario':n(d,p(0x1ce))}:{'mode':p(0x1e4)};}export function printHelp(){const r=b;console[r(0x1c8)]('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\x0aInternal:\x0a\x20\x20<node>\x20<entry>\x20--daemon\x0a');}function e(c,d){return c['includes'](d);}function a(){const t=['status','find','send','--env','--mock-scenario','connect','--pat-token','spawn-daemon','--list','--install-service\x20->\x20service\x20install','18tNgLgf','service','3282IageBW','length','1468668TWXwqy','5292672xvhEyq','3420332xKHYgX','2775050HUtpwS','--uninstall','254934MtrScf','6365282dfQIEL','--handshake-url','--frontier-url','purge','4ySknBF','--agent-id','help','2435ajiJlr','reload','--stop','file','startsWith','refresh','--status','--stop\x20->\x20stop','--date','log','version'];a=function(){return t;};return a();}function b(c,d){c=c-0x1c1;const e=a();let f=e[c];return f;}function n(c,d){const s=b,f=d+'=',g=c[s(0x1cb)](j=>j['startsWith'](f));if(g)return g['slice'](f[s(0x1d7)]);const h=c['indexOf'](d);return h>=0x0&&c[h+0x1]&&!c[h+0x1][s(0x1c3)]('--')?c[h+0x1]:void 0x0;}
|
package/dist/lib/cloud.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function f(a,c){a=a-0x1a4;const d=b();let e=d[a];return e;}const E=f;(function(v,w){const D=f,x=v();while(!![]){try{const y=parseInt(D(0x1db))/0x1+parseInt(D(0x1a9))/0x2*(-parseInt(D(0x1bb))/0x3)+parseInt(D(0x1b0))/0x4+-parseInt(D(0x1b9))/0x5+parseInt(D(0x1ba))/0x6+parseInt(D(0x1b2))/0x7*(parseInt(D(0x1c4))/0x8)+-parseInt(D(0x1d2))/0x9*(-parseInt(D(0x1c1))/0xa);if(y===w)break;else x['push'](x['shift']());}catch(z){x['push'](x['shift']());}}}(b,0x1981b));import j from'ws';import{detectFrameworks as k}from'./frameworks.js';function b(){const a1=['configFile','restore','result','frontier\x20error','reconnect','895335WHoQmb','239130XTERba','30fExTCJ','error','handshake\x20failed:\x20HTTP\x20','env','pending','close','80nUjHIR','sendResponse','frontierToken','4184Gjfain','bridgeClientId','https://www.licos.com','frontier\x20frame\x20failed','health','access_token','text','catch','restored','OPEN','now','pair','utf8','2.0','48573NTHfcg','slice','LICOS_BRIDGE_HANDSHAKE_URL','stringify','sendBridgeFile','json','device_id','sendFrame','agentId','113627YajgFa','handlers','set','/api/v1/workbench/local-agent-bridge/handshake','pairing','frontier_token','session/','pairCode','closing\x20frontier','reject','startsWith','delete','arch','application/json','isConnected','sendHealth','patToken','handshake-url\x20is\x20required;\x20copy\x20the\x20connection\x20command\x20from\x20the\x20current\x20platform\x20or\x20set\x20LICOS_BRIDGE_HANDSHAKE_URL','connect','11084soLwUq','toISOString','message','logger','_agent/pair','get','heartbeatTimer','19020RJXFYM','handshake','1841zedYXz','connectStored'];b=function(){return a1;};return b();}import{joinUrl as l,readJson as m,writeJson as q}from'./utils.js';import{resolvePaths as u}from'./paths.js';const s=E(0x1c6),a=E(0x1de),c=[E(0x1d4),'LICOS_PLATFORM_BASE_URL','AIOS_PLATFORM_BASE_URL'];export class CloudConnector{constructor({logger:v}){const F=E;this['logger']=v,this['ws']=void 0x0,this['pairing']=void 0x0,this['handlers']=new Map(),this['pending']=new Map(),this[F(0x1af)]=void 0x0,this['agentManager']=void 0x0;}['setAgentManager'](v){this['agentManager']=v;}['on'](v,w){const G=E;this[G(0x1dc)][G(0x1dd)](v,w);}async[E(0x1b5)](){const H=E,v=await m(u()['configFile'],{})['catch'](()=>({}));v?.['pairing']?.[H(0x1a6)]&&v?.[H(0x1df)]?.['pairCode']&&await this['pair'](v['pairing'],{'restored':!0x0})['catch'](w=>{const I=H;this[I(0x1ac)]?.('restore\x20pair\x20failed',{'error':String(w)});});}async[E(0x1cf)](v,w={}){const J=E;this['pairing']={'handshakeUrl':h(v,w),'frontierUrl':v['frontierUrl'],'env':v['env'],'mockScenario':v['mockScenario'],'agentId':v[J(0x1da)],'patToken':v['patToken'],'pairCode':v[J(0x1e2)]},await q(u()[J(0x1b4)],{'pairing':this['pairing'],'updatedAt':new Date()[J(0x1aa)]()},0x180);const x=await this['handshake'](),y=v['frontierUrl']||g(x,['frontierUrl','frontier_url']);return y&&await this['connect'](y,x),!w[J(0x1cc)]&&v[J(0x1da)]&&this['sendNotification'](J(0x1ad),{'agentId':v['agentId']})['catch'](()=>{}),{'ok':!0x0,'deviceId':g(x,['deviceId',J(0x1d8)]),'bridgeClientId':g(x,[J(0x1c5),'bridge_client_id']),'frontierConnected':Boolean(this['ws']&&this['ws']['readyState']===j[J(0x1cd)])};}async[E(0x1b3)](v={}){const K=E,w=await m(u()['configFile'],{})['catch'](()=>({})),x=w?.[K(0x1df)]??{},y=v['patToken']||x[K(0x1a6)];if(!y)throw new Error('connect\x20requires\x20stored\x20pat-token\x20or\x20--pat-token');return this['pair']({...x,...v,'patToken':y,'pairCode':v[K(0x1e2)]??x['pairCode']},{'connectOnly':!0x0});}async[E(0x1b1)](){const M=E,v=await k(),w=function(z){const L=f;if(!z)throw new Error(L(0x1a7));return/\/handshake\/?$/['test'](z)?z:l(z,a);}(this['pairing']['handshakeUrl']),x=await fetch(w,{'method':'POST','headers':{'content-type':M(0x1e8),'authorization':'Bearer\x20'+this[M(0x1df)][M(0x1a6)],...this['pairing'][M(0x1be)]?{'x-licos-env':this['pairing'][M(0x1be)]}:{},...this[M(0x1df)]['mockScenario']?{'x-mock-scenario':this['pairing']['mockScenario']}:{}},'body':JSON['stringify']({'pairCode':this['pairing']['pairCode'],'pair_code':this['pairing'][M(0x1e2)],'agentId':this['pairing']['agentId'],'agent_id':this[M(0x1df)][M(0x1da)],'mockScenario':this['pairing']['mockScenario'],'mock_scenario':this['pairing']['mockScenario'],'device':{'hostname':process.env.COMPUTERNAME||process.env.HOSTNAME||'','platform':process['platform'],'arch':process[M(0x1e7)],'nodeVersion':process['version']},'frameworks':v})});if(!x['ok'])throw new Error(M(0x1bd)+x['status']+'\x20'+await x[M(0x1ca)]());const y=await x[M(0x1d7)]();return y['data']??y;}async[E(0x1a8)](v,w){const N=E;await this['stop'](N(0x1b8));const x=g(w,['accessToken',N(0x1c9),N(0x1c3),N(0x1e0)])||this['pairing'][N(0x1a6)];this['ws']=new j(v,{'headers':{'authorization':'Bearer\x20'+x,...this[N(0x1df)][N(0x1be)]?{'x-licos-env':this[N(0x1df)][N(0x1be)]}:{}}}),this['ws']['on']('open',()=>{const O=N;this['logger']?.('frontier\x20connected',{'frontierUrl':v}),this[O(0x1a5)]()['catch'](()=>{}),this['heartbeatTimer']=setInterval(()=>this[O(0x1a5)]()[O(0x1cb)](()=>{}),0x2710);}),this['ws']['on'](N(0x1ab),y=>{const P=N;this['handleFrame'](y['toString'](P(0x1d0)))['catch'](z=>{const Q=P;this['logger']?.(Q(0x1c7),{'error':String(z)});});}),this['ws']['on'](N(0x1c0),(y,z)=>{this['logger']?.('frontier\x20closed',{'code':y,'reason':z['toString']()}),clearInterval(this['heartbeatTimer']),this['heartbeatTimer']=void 0x0;}),this['ws']['on'](N(0x1bc),y=>{const R=N;this['logger']?.(R(0x1b7),{'error':String(y)});});}async['handleFrame'](v){const S=E,w=JSON['parse'](v);if(void 0x0!==w['id']&&(void 0x0!==w[S(0x1b6)]||void 0x0!==w['error'])){const z=this['pending'][S(0x1ae)](w['id']);return void(z&&(this[S(0x1bf)][S(0x1e6)](w['id']),w[S(0x1bc)]?z[S(0x1e4)](new Error(w['error']['message']||JSON['stringify'](w['error']))):z['resolve'](w['result'])));}const x=w['method']||w['type'],y=this[S(0x1dc)][S(0x1ae)](x)||(x?.[S(0x1e5)](S(0x1e1))?this['handlers'][S(0x1ae)]('session/*'):void 0x0);if(y)try{const A=await y(w['params']??w['content']??{});void 0x0!==w['id']&&await this[S(0x1c2)](w['id'],A);}catch(B){if(void 0x0===w['id'])throw B;await this[S(0x1c2)](w['id'],void 0x0,{'code':-0x7f5b,'message':B[S(0x1ab)]||String(B)});}else void 0x0!==w['id']&&await this[S(0x1c2)](w['id'],void 0x0,{'code':-0x7f59,'message':'method\x20not\x20found:\x20'+x});}async['sendHealth'](){const T=E;await this['sendNotification']('_agent/health',{'agents':this['agentManager']?.[T(0x1c8)]()??[],'ts':Date[T(0x1ce)]()});}async['sendNotification'](v,w){await this['sendFrame']({'jsonrpc':'2.0','method':v,'params':w});}async[E(0x1c2)](v,w,x){const U=E;await this[U(0x1d9)](x?{'jsonrpc':'2.0','id':v,'error':x}:{'jsonrpc':U(0x1d1),'id':v,'result':w});}async['sendRequest'](v,w,x=0x7530){const V=E,y=Date['now']()+'-'+Math['random']()['toString'](0x10)[V(0x1d3)](0x2);return await this['sendFrame']({'jsonrpc':V(0x1d1),'id':y,'method':v,'params':w}),new Promise((z,A)=>{const B=setTimeout(()=>{this['pending']['delete'](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 W=E;if(this[W(0x1a4)]())return this['sendRequest']('_agent/client_request',{'agentId':v['agentId'],'method':w,'params':x})['catch'](()=>{});}async[E(0x1d6)](v){if(!this['isConnected']())throw new Error('frontier\x20is\x20not\x20connected');return this['sendRequest']('_agent/sendFile',v,0x1d4c0);}async[E(0x1d9)](v){const X=E;if(!this['isConnected']())throw new Error('frontier\x20is\x20not\x20connected');this['ws']['send'](JSON[X(0x1d5)](v));}['isConnected'](){const Y=E;return Boolean(this['ws']&&this['ws']['readyState']===j[Y(0x1cd)]);}async['stop'](v){const Z=E;clearInterval(this[Z(0x1af)]),this[Z(0x1af)]=void 0x0,this['ws']&&(this['logger']?.(Z(0x1e3),{'reason':v}),this['ws']['close'](),this['ws']=void 0x0);}}function h(v,w){const a0=E,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(a0(0x1a7));}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
|
+
const E=f;(function(v,w){const D=f,x=v();while(!![]){try{const y=-parseInt(D(0x15b))/0x1+parseInt(D(0x166))/0x2+-parseInt(D(0x17b))/0x3*(parseInt(D(0x16d))/0x4)+parseInt(D(0x142))/0x5+-parseInt(D(0x139))/0x6*(parseInt(D(0x14c))/0x7)+-parseInt(D(0x16c))/0x8*(parseInt(D(0x134))/0x9)+parseInt(D(0x153))/0xa;if(y===w)break;else x['push'](x['shift']());}catch(z){x['push'](x['shift']());}}}(b,0x54f16));import g from'ws';import{detectFrameworks as j}from'./frameworks.js';function f(a,c){a=a-0x130;const d=b();let e=d[a];return e;}import{joinUrl as k,readJson as m,writeJson as q}from'./utils.js';import{resolvePaths as u}from'./paths.js';const s='https://www.licos.com',a='/api/v1/workbench/local-agent-bridge/handshake',c=[E(0x171),'LICOS_PLATFORM_BASE_URL','AIOS_PLATFORM_BASE_URL'];export class CloudConnector{constructor({logger:v}){const F=E;this['logger']=v,this['ws']=void 0x0,this[F(0x149)]=void 0x0,this['handlers']=new Map(),this['pending']=new Map(),this['heartbeatTimer']=void 0x0,this['reconnectTimer']=void 0x0,this['reconnectAttempt']=0x0,this[F(0x14f)]=void 0x0,this[F(0x13b)]=!0x1,this[F(0x14b)]=new WeakSet(),this['agentManager']=void 0x0;}['setAgentManager'](v){this['agentManager']=v;}['on'](v,w){const G=E;this[G(0x146)]['set'](v,w);}async['restore'](){const H=E,v=await m(u()[H(0x178)],{})['catch'](()=>({}));v?.['pairing']?.['patToken']&&v?.[H(0x149)]?.['pairCode']&&await this['pair'](v['pairing'],{'restored':!0x0})[H(0x13c)](w=>{const I=H;this[I(0x156)]?.('restore\x20pair\x20failed',{'error':String(w)});});}async['pair'](v,w={}){const J=E;this['pairing']={'handshakeUrl':h(v,w),'frontierUrl':v['frontierUrl'],'env':v['env'],'mockScenario':v['mockScenario'],'agentId':v['agentId'],'patToken':v['patToken'],'pairCode':v['pairCode']},await q(u()['configFile'],{'pairing':this['pairing'],'updatedAt':new Date()['toISOString']()},0x180);const x=await this['handshake'](),y=v[J(0x14f)]||p(x,[J(0x14f),J(0x164)]);return y&&await this['connect'](y,x),!w['restored']&&v['agentId']&&this['sendNotification'](J(0x135),{'agentId':v[J(0x15f)]})[J(0x13c)](()=>{}),{'ok':!0x0,'deviceId':p(x,['deviceId','device_id']),'bridgeClientId':p(x,['bridgeClientId','bridge_client_id']),'frontierConnected':Boolean(this['ws']&&this['ws']['readyState']===g['OPEN'])};}async['connectStored'](v={}){const K=E,w=await m(u()['configFile'],{})['catch'](()=>({})),x=w?.['pairing']??{},y=v['patToken']||x[K(0x132)];if(!y)throw new Error(K(0x143));return this[K(0x13f)]({...x,...v,'patToken':y,'pairCode':v['pairCode']??x[K(0x131)]},{'connectOnly':!0x0});}async['handshake'](){const M=E,v=await j(),w=function(z){const L=f;if(!z)throw new Error(L(0x145));return/\/handshake\/?$/[L(0x152)](z)?z:k(z,a);}(this['pairing']['handshakeUrl']),x=await fetch(w,{'method':M(0x148),'headers':{'content-type':M(0x170),'authorization':'Bearer\x20'+this['pairing']['patToken'],...this['pairing']['env']?{'x-licos-env':this['pairing'][M(0x15d)]}:{},...this['pairing']['mockScenario']?{'x-mock-scenario':this[M(0x149)][M(0x140)]}:{}},'body':JSON['stringify']({'pairCode':this['pairing']['pairCode'],'pair_code':this[M(0x149)]['pairCode'],'agentId':this['pairing']['agentId'],'agent_id':this[M(0x149)]['agentId'],'mockScenario':this[M(0x149)]['mockScenario'],'mock_scenario':this['pairing']['mockScenario'],'device':{'hostname':process.env.COMPUTERNAME||process.env.HOSTNAME||'','platform':process[M(0x159)],'arch':process['arch'],'nodeVersion':process['version']},'frameworks':v})});if(!x['ok'])throw new Error(M(0x14d)+x['status']+'\x20'+await x['text']());const y=await x['json']();return y[M(0x14e)]??y;}async[E(0x137)](v,w){const N=E;await this['stop'](N(0x177)),this['manualStop']=!0x1,this[N(0x14f)]=v;const x=p(w,['accessToken',N(0x13e),'frontierToken',N(0x174)])||this['pairing']['patToken'],y=new g(v,{'headers':{'authorization':'Bearer\x20'+x,...this[N(0x149)][N(0x15d)]?{'x-licos-env':this[N(0x149)]['env']}:{}}});this['ws']=y,y['on']('open',()=>{const O=N;this[O(0x156)]?.('frontier\x20connected',{'frontierUrl':v}),this['reconnectAttempt']=0x0,this['clearReconnectTimer'](),this[O(0x163)]()[O(0x13c)](()=>{}),this['heartbeatTimer']=setInterval(()=>this['sendHealth']()['catch'](()=>{}),0x2710);}),y['on']('message',z=>{this['handleFrame'](z['toString']('utf8'))['catch'](A=>{const P=f;this[P(0x156)]?.(P(0x161),{'error':String(A)});});}),y['on']('close',(z,A)=>{const Q=N;this['logger']?.(Q(0x16b),{'code':z,'reason':A[Q(0x150)]()});const B=this['closingSockets'][Q(0x136)](y);B&&this['closingSockets']['delete'](y),this['ws']===y&&(clearInterval(this['heartbeatTimer']),this['heartbeatTimer']=void 0x0,this['ws']=void 0x0,B||this[Q(0x13b)]||this[Q(0x151)](Q(0x179)));}),y['on']('error',z=>{this['logger']?.('frontier\x20error',{'error':String(z)});});}['scheduleReconnect'](v){const R=E;if(this[R(0x13b)]||this['reconnectTimer']||!this[R(0x149)])return;this['reconnectAttempt']+=0x1;const w=Math['min'](0x3e8*Math['pow'](0x2,this[R(0x162)]-0x1),0x7530);this[R(0x156)]?.(R(0x158),{'reason':v,'attempt':this[R(0x162)],'delay':w}),this[R(0x138)]=setTimeout(()=>{const S=R;this['reconnectTimer']=void 0x0,this[S(0x177)]()[S(0x13c)](x=>{const T=S;this[T(0x156)]?.('frontier\x20reconnect\x20failed',{'error':String(x)}),this[T(0x151)](T(0x15e));});},w);}async['reconnect'](){const U=E;if(this['manualStop']||this[U(0x157)]())return;this[U(0x156)]?.(U(0x16f),{'attempt':this['reconnectAttempt']});const v=await this[U(0x176)](),w=this['pairing']['frontierUrl']||p(v,['frontierUrl','frontier_url'])||this['frontierUrl'];if(!w)throw new Error(U(0x141));await this['connect'](w,v);}['clearReconnectTimer'](){this['reconnectTimer']&&(clearTimeout(this['reconnectTimer']),this['reconnectTimer']=void 0x0);}async['handleFrame'](v){const V=E,w=JSON[V(0x168)](v);if(void 0x0!==w['id']&&(void 0x0!==w['result']||void 0x0!==w['error'])){const z=this['pending'][V(0x13a)](w['id']);return void(z&&(this['pending']['delete'](w['id']),w[V(0x147)]?z['reject'](new Error(w['error']['message']||JSON[V(0x144)](w[V(0x147)]))):z['resolve'](w['result'])));}const x=w['method']||w['type'],y=this[V(0x146)]['get'](x)||(x?.['startsWith']('session/')?this['handlers']['get']('session/*'):void 0x0);if(y)try{const A=await y(w[V(0x16a)]??w[V(0x17a)]??{});void 0x0!==w['id']&&await this[V(0x14a)](w['id'],A);}catch(B){if(void 0x0===w['id'])throw B;await this[V(0x14a)](w['id'],void 0x0,{'code':-0x7f5b,'message':B['message']||String(B)});}else void 0x0!==w['id']&&await this[V(0x14a)](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){const W=E;await this[W(0x15c)]({'jsonrpc':'2.0','method':v,'params':w});}async['sendResponse'](v,w,x){const X=E;await this[X(0x15c)](x?{'jsonrpc':'2.0','id':v,'error':x}:{'jsonrpc':'2.0','id':v,'result':w});}async[E(0x169)](v,w,x=0x7530){const Y=E,y=Date['now']()+'-'+Math['random']()['toString'](0x10)[Y(0x173)](0x2);return await this['sendFrame']({'jsonrpc':Y(0x154),'id':y,'method':v,'params':w}),new Promise((z,A)=>{const B=setTimeout(()=>{const Z=f;this['pending'][Z(0x172)](y),A(new Error(v+Z(0x155)));},x);this['pending']['set'](y,{'resolve':C=>{clearTimeout(B),z(C);},'reject':C=>{clearTimeout(B),A(C);}});});}async['forwardClientRequest'](v,w,x){const a0=E;if(this[a0(0x157)]())return this[a0(0x169)](a0(0x167),{'agentId':v[a0(0x15f)],'method':w,'params':x})[a0(0x13c)](()=>{});}async['sendBridgeFile'](v){const a1=E;if(!this['isConnected']())throw new Error(a1(0x175));return this['sendRequest']('_agent/sendFile',v,0x1d4c0);}async['sendFrame'](v){const a2=E;if(!this['isConnected']())throw new Error('frontier\x20is\x20not\x20connected');this['ws']['send'](JSON[a2(0x144)](v));}['isConnected'](){const a3=E;return Boolean(this['ws']&&this['ws'][a3(0x130)]===g[a3(0x133)]);}async[E(0x16e)](v){const a4=E;a4(0x177)!==v&&(this['manualStop']=!0x0,this[a4(0x165)](),this['reconnectAttempt']=0x0),clearInterval(this[a4(0x13d)]),this['heartbeatTimer']=void 0x0,this['ws']&&(this['logger']?.('closing\x20frontier',{'reason':v}),this['closingSockets']['add'](this['ws']),this['ws']['close'](),this['ws']=void 0x0);}}function h(v,w){const a5=E,x=l(v?.['handshakeUrl']);if(x){if((w['restored']||w[a5(0x15a)])&&function(z){const A=z['replace'](/\/+$/,'');return A===s||A===''+s+a;}(x)){const z=d();if(z)return z;throw new Error(a5(0x160));}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=l(process.env[v]);if(w)return w;}}function b(){const a6=['136eEfoDt','463516IBrRvZ','stop','frontier\x20reconnecting','application/json','LICOS_BRIDGE_HANDSHAKE_URL','delete','slice','frontier_token','frontier\x20is\x20not\x20connected','handshake','reconnect','configFile','frontier\x20close','content','3mXeEER','readyState','pairCode','patToken','OPEN','214587oiBNDU','_agent/pair','has','connect','reconnectTimer','1386132uTgPLG','get','manualStop','catch','heartbeatTimer','access_token','pair','mockScenario','frontier_url\x20is\x20missing','3261580aUYXrs','connect\x20requires\x20stored\x20pat-token\x20or\x20--pat-token','stringify','handshake-url\x20is\x20required;\x20copy\x20the\x20connection\x20command\x20from\x20the\x20current\x20platform\x20or\x20set\x20LICOS_BRIDGE_HANDSHAKE_URL','handlers','error','POST','pairing','sendResponse','closingSockets','14AIrkzV','handshake\x20failed:\x20HTTP\x20','data','frontierUrl','toString','scheduleReconnect','test','5940860vBMgzg','2.0','\x20timed\x20out','logger','isConnected','frontier\x20reconnect\x20scheduled','platform','connectOnly','598782bepsJl','sendFrame','env','frontier\x20reconnect\x20failed','agentId','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','frontier\x20frame\x20failed','reconnectAttempt','sendHealth','frontier_url','clearReconnectTimer','1367120BgwlaB','_agent/client_request','parse','sendRequest','params','frontier\x20closed'];b=function(){return a6;};return b();}function l(v){if(null!=v)return String(v)['trim']()||void 0x0;}function p(v,w){for(const x of w)if(void 0x0!==v?.[x]&&null!==v[x]&&''!==v[x])return v[x];}
|
package/dist/lib/daemon.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(z,A){const N=f,B=z();while(!![]){try{const C=parseInt(N(
|
|
1
|
+
function b(){const T=['160sgUOJJ','close','/status','1719090tDlUvG','url','/reload','5773saiRpC','session/cancel','52140zaJziU','address','disconnect','1004047JctYWa','12aXoaXR','connectStored','listSkills','127.0.0.1','reload','_agent/health','24qMgzrW','2804130DSXqGX','bridgeRoot','_agent/detail','POST','session/*','_agent/listSkills','method','session/new','health','84858sCZofQ','logFile','daemon\x20started','createOrUpdate','stopAll','20vozLNi','session/prompt','14GJJDJt','stop','port','/pair','623224QlDtIe','_agent/getFileTree','toISOString','hex','concat','_agent/update','sendBridgeFile','tokenFile'];b=function(){return T;};return b();}function f(a,c){a=a-0x1c9;const d=b();let e=d[a];return e;}(function(z,A){const N=f,B=z();while(!![]){try{const C=parseInt(N(0x1f2))/0x1*(parseInt(N(0x1c9))/0x2)+parseInt(N(0x1d9))/0x3*(parseInt(N(0x1de))/0x4)+-parseInt(N(0x1ec))/0x5*(parseInt(N(0x1f4))/0x6)+-parseInt(N(0x1e0))/0x7*(-parseInt(N(0x1e4))/0x8)+parseInt(N(0x1ef))/0x9+-parseInt(N(0x1d0))/0xa+-parseInt(N(0x1f7))/0xb*(-parseInt(N(0x1cf))/0xc);if(C===A)break;else B['push'](B['shift']());}catch(D){B['push'](B['shift']());}}}(b,0x23e01));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';export async function startDaemonServer(){const O=f,z=q();await v(z[O(0x1d1)]),await v(z['agentsRoot']);const A=(F,G)=>u(z[O(0x1da)],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[O(0x1dc)](F)),B['on'](O(0x1d2),F=>C['detail'](F)),B['on'](O(0x1e9),F=>C['createOrUpdate'](F)),B['on']('_agent/disconnect',async F=>(await C[O(0x1f6)](F['agentId'],F['reason']),{'ok':!0x0})),B['on'](O(0x1ce),()=>({'agents':C['health']()})),B['on'](O(0x1e5),F=>C['getFileTree'](F)),B['on']('_agent/getFileContent',F=>C['getFileContent'](F)),B['on'](O(0x1d5),F=>C[O(0x1cb)](F)),B['on']('_agent/addSkills',F=>C['addSkills'](F)),B['on']('_agent/removeSkills',F=>C['removeSkills'](F)),B['on'](O(0x1d4),F=>C['handleSession'](F['method']||F['_method']||O(0x1df),F)),B['on'](O(0x1d7),F=>C['handleSession']('session/new',F)),B['on']('session/prompt',F=>C['handleSession']('session/prompt',F)),B['on'](O(0x1f3),F=>C['handleSession']('session/cancel',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'](P(0x1e7));return await y(F[P(0x1eb)],H),await x(F['configFile'],{'createdAt':new Date()[P(0x1e6)]()},0x180),H;}(z),E=g(async(F,G)=>{const R=O;try{if(!function(I,J){return(I['headers']['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',()=>{const Q=f;if(0x0===L['length'])return J({});const M=Buffer[Q(0x1e8)](L)['toString']('utf8');J(M?JSON['parse'](M):{});});});}(F);if('GET'===F['method']&&R(0x1ee)===F[R(0x1f0)])return p(G,0xc8,{'ok':!0x0,'pid':process['pid'],'frontierConnected':B['isConnected'](),'frameworks':await j(),'agents':C[R(0x1d8)]()});if('POST'===F['method']&&R(0x1e3)===F[R(0x1f0)])return p(G,0xc8,await B['pair'](H));if('POST'===F['method']&&'/connect'===F['url'])return p(G,0xc8,await B[R(0x1ca)](H));if('POST'===F[R(0x1d6)]&&'/refresh'===F[R(0x1f0)])return p(G,0xc8,{'ok':!0x0,'frameworks':await j()});if(R(0x1d3)===F['method']&&R(0x1f1)===F['url'])return p(G,0xc8,await C[R(0x1cd)](H['agentId']));if('POST'===F['method']&&'/send'===F['url'])return p(G,0xc8,await B[R(0x1ea)](H));if(R(0x1d3)===F['method']&&'/stop'===F[R(0x1f0)])return p(G,0xc8,{'ok':!0x0}),await B[R(0x1e1)]('ipc\x20stop'),await C[R(0x1dd)]('ipc\x20stop'),void E[R(0x1ed)](()=>process['exit'](0x0));p(G,0x194,{'ok':!0x1,'error':'not\x20found'});}catch(I){await A('ipc\x20request\x20failed',{'url':F[R(0x1f0)],'error':String(I)}),p(G,0x1f4,{'ok':!0x1,'error':I['message']||String(I)});}});E['listen'](0x0,O(0x1cc),async()=>{const S=O,F=E[S(0x1f5)]();await y(z['portFile'],String(F[S(0x1e2)])),await y(z['pidFile'],String(process['pid'])),await A(S(0x1db),{'pid':process['pid'],'port':F[S(0x1e2)]}),await B['restore']();});}function p(z,A,B){z['writeHead'](A,{'content-type':'application/json;\x20charset=utf-8'}),z['end'](JSON['stringify'](B));}
|
package/dist/lib/frameworks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k,l){const y=d,m=k();while(!![]){try{const p=-parseInt(y(
|
|
1
|
+
(function(k,l){const y=d,m=k();while(!![]){try{const p=-parseInt(y(0x121))/0x1+-parseInt(y(0x129))/0x2+-parseInt(y(0x12a))/0x3+parseInt(y(0x12b))/0x4+parseInt(y(0x124))/0x5+parseInt(y(0x11e))/0x6*(parseInt(y(0x12d))/0x7)+parseInt(y(0x12e))/0x8;if(p===l)break;else m['push'](m['shift']());}catch(q){m['push'](m['shift']());}}}(b,0x623e7));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 d(a,c){a=a-0x11e;const e=b();let f=e[a];return f;}export async function detectFrameworks(){const z=d,k=[],l=j(z(0x123)),m=j(z(0x11f)),p=j(z(0x125));return k['push']({'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':'codex','name':z(0x12c),'installed':Boolean(m||await r('@zed-industries/codex-acp/bin/codex-acp.js')),'command':m,'version':m?i(m):void 0x0,'acpPackage':'@zed-industries/codex-acp','acpBin':'codex-acp'}),k['push']({'id':z(0x125),'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 A=d;if('codex'===k){const l=import.meta.resolve('@zed-industries/codex-acp/bin/codex-acp.js');return{'command':process[A(0x128)],'args':[f(l)]};}if('claude-code'===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(0x126)](await g(u,'utf8')),x='string'==typeof w['bin']?w[B(0x127)]: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)]};}('@agentclientprotocol/claude-agent-acp',A(0x120));throw new Error(A(0x122)+k);}function b(){const C=['parse','bin','execPath','967038BfOEGc','474813hLUcgx','1509192AdffGf','Codex','16646TuiFiS','1104528atabhh','714oDslJN','codex','claude-agent-acp','494535wVwyhE','ACP\x20runtime\x20is\x20not\x20supported\x20for\x20framework:\x20','claude','3701930LSzfBI','openclaw'];b=function(){return C;};return b();}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
|
|
1
|
+
(function(m,p){const A=c,q=m();while(!![]){try{const s=parseInt(A(0x196))/0x1*(parseInt(A(0x18d))/0x2)+parseInt(A(0x19c))/0x3+parseInt(A(0x191))/0x4*(-parseInt(A(0x18b))/0x5)+parseInt(A(0x18e))/0x6*(-parseInt(A(0x195))/0x7)+-parseInt(A(0x197))/0x8+-parseInt(A(0x18f))/0x9*(parseInt(A(0x194))/0xa)+-parseInt(A(0x198))/0xb*(-parseInt(A(0x19b))/0xc);if(s===p)break;else q['push'](q['shift']());}catch(u){q['push'](q['shift']());}}}(b,0x4d442));import{fileURLToPath as d}from'node:url';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';function b(){const E=['2nAOVlx','1686vHNjRm','50823YRimCs','token','28608hbnBCX','/status','trim','640UEGAqO','13069XKfvdb','595277lBfVrQ','2789504ARjenf','22xXtFGP','GET','index.js','3730776tiLBUE','1860636YpQHQJ','200pPMdmK','--daemon'];b=function(){return E;};return b();}export async function readDaemonInfo(){const B=c,q=g(),[u,v,w]=await Promise['all']([j(q['pidFile']),j(q['portFile']),j(q['tokenFile'])]),x=Number(u),y=Number(v),z=w?.[B(0x193)]();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['dirname'](d(import.meta.url)),'..',C(0x19a));l(m,[C(0x18c)]);}function c(a,d){a=a-0x18b;const e=b();let f=e[a];return f;}export async function ipcRequest(m,p,q){const D=c,s=await fetch('http://127.0.0.1:'+q['port']+m,{'method':'/status'===m?D(0x199):'POST','headers':{'authorization':'Bearer\x20'+q[D(0x190)],'content-type':'application/json'},'body':D(0x192)===m?void 0x0:JSON['stringify'](p??{})}),u=await s['json']()['catch'](()=>({}));if(!s['ok'])throw new Error(u['error']||'IPC\x20'+m+'\x20failed:\x20HTTP\x20'+s['status']);return u;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(D,E){const V=h,F=D();while(!![]){try{const G=-parseInt(V(
|
|
1
|
+
(function(D,E){const V=h,F=D();while(!![]){try{const G=-parseInt(V(0xc8))/0x1+-parseInt(V(0xcd))/0x2*(-parseInt(V(0xb6))/0x3)+-parseInt(V(0xc9))/0x4*(parseInt(V(0xc4))/0x5)+-parseInt(V(0xc0))/0x6+parseInt(V(0xca))/0x7*(-parseInt(V(0xa6))/0x8)+-parseInt(V(0xab))/0x9*(parseInt(V(0xac))/0xa)+-parseInt(V(0xa4))/0xb*(-parseInt(V(0xa8))/0xc);if(G===E)break;else F['push'](F['shift']());}catch(H){F['push'](F['shift']());}}}(b,0x81122));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';function b(){const a3=['.gif','557042iehSTG','588sHUUPg','263578FxLARV','sessionId','date','18NEAtcY','name','target','update\x20failed:\x20','.txt','list','.json','catch','11LTzwgb','agentId','104MqsvLK','image/gif','28533204LRAgrI','sort','status','7029xrUwnW','4460GCgBZl','size','SIGINT','caption','follow','image/jpeg','version','application/json','log','toLowerCase','105750BnKIjO','@kmlckj/licos-bridge@latest','npx','bridgeRoot','length','send\x20requires\x20--session-id','isFile','mime','text/markdown','includes','319386mBWGZb','groupFile','connect','level','24430gHiVxr','filter','text/plain'];b=function(){return a3;};return b();}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 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['message']||String(F)}));return{'running':!0x0,'pid':D['pid'],...E};}export async function purgeBridge(){const D=await y();D&&await x('/stop',{},D)['catch'](()=>{});const {uninstallService:E}=await import('./service.js');await E()['catch'](()=>{}),await C(z()['bridgeRoot']);}export async function packageVersion(){const W=h,D=await A(v['resolve'](v['dirname'](u(import.meta.url)),'..','..','package.json'),void 0x0)[W(0xa3)](()=>{});return D?.[W(0xb2)]||'0.0.0';}export async function printLogs(D={}){const X=h,E=z();if(D[X(0xa1)]){const J=await k(E[X(0xb9)])['catch'](()=>[]);for(const K of J[X(0xc5)](L=>/^bridge(?:-\d{4}-\d{2}-\d{2})?\.log$/['test'](L))[X(0xa9)]())console[X(0xb4)](K);return;}const F=D['date']?v['join'](E['bridgeRoot'],'bridge-'+D[X(0xcc)]+'.log'):E['logFile'],G=await B(F)??'';let H=G['split'](/\r?\n/)['filter'](Boolean);D['agentId']&&(H=H[X(0xc5)](L=>L[X(0xbf)](D['agentId']))),D['grep']&&(H=H['filter'](L=>L[X(0xbf)](D['grep']))),D[X(0xc3)]&&(H=H['filter'](L=>L[X(0xb5)]()['includes'](String(D['level'])['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[X(0xb0)]&&await async function(M,N,O){let P=N;await new Promise(Q=>{const Z=h,R=setInterval(async()=>{const Y=h,S=await B(M)??'';if(S['length']>P){let T=S['slice'](P)['split'](/\r?\n/)['filter'](Boolean);P=S[Y(0xba)],O[Y(0xa5)]&&(T=T[Y(0xc5)](U=>U['includes'](O[Y(0xa5)]))),O['grep']&&(T=T[Y(0xc5)](U=>U['includes'](O['grep'])));for(const U of T)console['log'](U);}},0x3e8);process['on'](Z(0xae),()=>{clearInterval(R),Q();});});}(E['logFile'],G['length'],D);}export async function runUpdate(){const a0=h,D=await y();D&&await x('/stop',{},D)['catch'](()=>{});const E='win32'===process['platform']?'npx.cmd':a0(0xb8),F=['-y','--ignore-existing',a0(0xb7),a0(0xc2)];if(0x0!==j(E,F,{'stdio':'inherit','windowsHide':!0x0})[a0(0xaa)])throw new Error(a0(0x9f)+E+'\x20'+F['join']('\x20'));}export async function buildSendPayload(D){const a1=h;if(!D['agentId'])throw new Error('send\x20requires\x20--agent-id');if(!D['sessionId'])throw new Error(a1(0xbb));if(D[a1(0xc1)]){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[a1(0xaf)],'name':D[a1(0xce)],'groupFile':!0x0,'mime':D[a1(0xbd)]};}const E=await q(D['target']);if(!E[a1(0xbc)]())throw new Error('not\x20a\x20file:\x20'+D['target']);if(E['size']>0x3200000)throw new Error('file\x20too\x20large:\x20'+E[a1(0xad)]+'\x20bytes\x20(max\x2052428800)');const F=await m(D['target']);return{'kind':D['kind'],'agentId':D[a1(0xa5)],'sessionId':D[a1(0xcb)],'caption':D[a1(0xaf)],'name':D['name']||v['basename'](D['target']),'mime':D[a1(0xbd)]||f(D[a1(0x9e)],D['kind']),'size':F['byteLength'],'contentBase64':F['toString']('base64')};}function h(a,c){a=a-0x9e;const d=b();let e=d[a];return e;}function f(D,E){const a2=h,F=v['extname'](D)['toLowerCase']();if('image'===E){if('.png'===F)return'image/png';if(['.jpg','.jpeg']['includes'](F))return a2(0xb1);if(a2(0xc7)===F)return a2(0xa7);if('.webp'===F)return'image/webp';}return'.pdf'===F?'application/pdf':a2(0xa0)===F?a2(0xc6):'.md'===F?a2(0xbe):a2(0xa2)===F?a2(0xb3):'application/octet-stream';}
|
package/dist/lib/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(f,g){const k=b,h=f();while(!![]){try{const i=parseInt(k(0x1dc))/0x1+-parseInt(k(0x1d8))/0x2+-parseInt(k(0x1e1))/0x3*(parseInt(k(0x1da))/0x4)+parseInt(k(0x1e3))/0x5+parseInt(k(0x1e0))/0x6+parseInt(k(0x1df))/0x7+-parseInt(k(0x1d7))/0x8*(parseInt(k(0x1db))/0x9);if(i===g)break;else h['push'](h['shift']());}catch(j){h['push'](h['shift']());}}}(a,0x20909));import c from'node:os';import d from'node:path';function b(c,d){c=c-0x1d7;const e=a();let f=e[c];return f;}export function resolvePaths(){const l=b,f=process.env.LICOS_BRIDGE_HOME?d['resolve'](process.env.LICOS_BRIDGE_HOME):d['join'](c['homedir'](),'.licos'),g=d['join'](f,l(0x1d9));return{'root':f,'bridgeRoot':g,'agentsRoot':process.env.LICOS_BRIDGE_AGENTS_HOME?d['resolve'](process.env.LICOS_BRIDGE_AGENTS_HOME):d[l(0x1dd)](f,'agents'),'pidFile':d['join'](g,l(0x1de)),'portFile':d['join'](g,'bridge.port'),'tokenFile':d['join'](g,'bridge.token'),'logFile':d['join'](g,'bridge.log'),'configFile':d['join'](g,'config.json'),'serviceLogFile':d['join'](g,'service.log')};}function a(){const n=['880050GVsnah','619656BqyQmG','169446zeodHf','bridge','508iBytuU','9jWQhNH','48936zFFPjV','join','bridge.pid','1718318cxniPS','277512srGwxh','5223OvTQjG','logs'];a=function(){return n;};return a();}export function agentPaths(f){const m=b,g=resolvePaths(),h=d['join'](g['agentsRoot'],f);return{'root':h,'configFile':d[m(0x1dd)](h,'config.json'),'workspace':d['join'](h,'workspace'),'logs':d['join'](h,m(0x1e2))};}
|
package/dist/lib/service.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const z=c;(function(m,p){const y=c,q=m();while(!![]){try{const u=-parseInt(y(
|
|
1
|
+
const z=c;(function(m,p){const y=c,q=m();while(!![]){try{const u=-parseInt(y(0xc3))/0x1*(parseInt(y(0xac))/0x2)+parseInt(y(0xb5))/0x3+-parseInt(y(0xb3))/0x4*(-parseInt(y(0xc8))/0x5)+-parseInt(y(0xc1))/0x6+-parseInt(y(0xb9))/0x7*(-parseInt(y(0xc0))/0x8)+-parseInt(y(0xc7))/0x9+parseInt(y(0xa9))/0xa;if(u===p)break;else q['push'](q['shift']());}catch(v){q['push'](q['shift']());}}}(b,0x3c85b));import{spawnSync as d}from'node:child_process';import{fileURLToPath as f}from'node:url';function b(){const F=['</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>','1043270LwivWW','darwin','launchctl','361350TDNVvW','Windows\x20login\x20task\x20removed:\x20LICOS\x20Bridge','index.js','--user','platform','win32','/Library/LaunchAgents/com.licos.bridge.plist','1381036LqTaPe','log','1233240aRkSyR','licos-bridge','execPath','</string><string>','2779QAfyHX','dirname','launchd\x20service\x20installed:\x20com.licos.bridge','systemctl','allowFailure','[Unit]\x0aDescription=LICOS\x20local\x20agent\x20bridge\x0a\x0a[Service]\x0aExecStart=','/SC','8824MDzxPz','2809680aJSUij','status','1zAcBzM','serviceLogFile','systemd\x20user\x20service\x20removed:\x20licos-bridge.service','/Create','3615327MNausa','5mXrxAf'];b=function(){return F;};return b();}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=z(0xb6);function c(a,d){a=a-0xa9;const e=b();let f=e[a];return f;}export async function installService(){const A=z,m=g['resolve'](g[A(0xba)](f(import.meta.url)),'..',A(0xae));if('win32'===process[A(0xb0)]){const u='\x22'+process['execPath']+'\x22\x20\x22'+m+'\x22\x20--daemon';return l('schtasks.exe',[A(0xc6),'/TN',t,A(0xbf),'ONLOGON','/TR',u,'/F']),void console[A(0xb4)]('Windows\x20login\x20task\x20installed:\x20LICOS\x20Bridge');}if('darwin'===process['platform']){const v=process.env.HOME+A(0xb2);return await h(g['dirname'](v)),await j(v,function(w){const B=A,x=k()[B(0xc4)];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[B(0xb7)]+B(0xb8)+w+B(0xc9)+x+'</string>\x0a\x20\x20<key>StandardErrorPath</key><string>'+x+'</string>\x0a</dict></plist>\x0a';}(m)),l(A(0xab),['load','-w',v]),void console['log'](A(0xbb));}const p=process.env.HOME+'/.config/systemd/user',q=g['join'](p,a+'.service');await h(p),await j(q,function(w){const C=A;return C(0xbe)+process['execPath']+'\x20'+w+'\x20--daemon\x0aRestart=always\x0aRestartSec=3\x0a\x0a[Install]\x0aWantedBy=default.target\x0a';}(m)),l('systemctl',[A(0xaf),'daemon-reload']),l(A(0xbc),[A(0xaf),'enable','--now',a+'.service']),console['log']('systemd\x20user\x20service\x20installed:\x20licos-bridge.service');}export async function uninstallService(){const D=z;return D(0xb1)===process['platform']?(l('schtasks.exe',['/Delete','/TN',t,'/F'],{'allowFailure':!0x0}),void console['log'](D(0xad))):D(0xaa)===process['platform']?(l(D(0xab),['unload','-w',process.env.HOME+'/Library/LaunchAgents/com.licos.bridge.plist'],{'allowFailure':!0x0}),void console[D(0xb4)]('launchd\x20service\x20removed:\x20com.licos.bridge')):(l('systemctl',['--user','disable','--now',a+'.service'],{'allowFailure':!0x0}),void console[D(0xb4)](D(0xc5)));}function l(m,p,q={}){const E=z;if(0x0!==d(m,p,{'stdio':'inherit','windowsHide':!0x0})[E(0xc2)]&&!q[E(0xbd)])throw new Error(m+'\x20'+p['join']('\x20')+'\x20failed');}
|
package/dist/lib/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const J=d;(function(w,x){const B=d,y=w();while(!![]){try{const z=parseInt(B(0x11b))/0x1*(-parseInt(B(0x10c))/0x2)+-parseInt(B(0x110))/0x3*(parseInt(B(0x111))/0x4)+parseInt(B(0x118))/0x5*(parseInt(B(0x113))/0x6)+parseInt(B(0x10f))/0x7*(-parseInt(B(0x11a))/0x8)+-parseInt(B(0x103))/0x9+parseInt(B(0x106))/0xa+parseInt(B(0x116))/0xb;if(z===x)break;else y['push'](y['shift']());}catch(A){y['push'](y['shift']());}}}(b,0x382bb));function b(){const R=['code','toISOString','unref','split','replace','765936EdoRBT','relative','dirname','3437190mqOWTl','claude','claudecode','--version','execPath','length','892dxSxYw','open-claw','stderr','7BFfTxw','213yWFZgc','24272kPvaqz','trim','2238mzqHnq','win32','stringify','8673819QscNDP','platform','1315slZBwv','stdout','1523408dqLPqI','659VBmrik','utf8','isAbsolute','command','kill','openclaw','claude-code'];b=function(){return R;};return b();}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(0x11c));}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 D=d;await ensureDir(v['dirname'](w)),await p(w,JSON['stringify'](x,null,0x2)+'\x0a',D(0x11c)),y&&D(0x114)!==process[D(0x117)]&&await h(w,y);}function d(a,c){a=a-0xfa;const e=b();let f=e[a];return f;}export async function writePrivateText(w,x){const E=d;await ensureDir(v[E(0x105)](w)),await p(w,x,E(0x11c)),E(0x114)!==process[E(0x117)]&&await h(w,0x180);}export async function removeDir(w){await l(w,{'recursive':!0x0,'force':!0x0});}export async function pathExists(w){const F=d;try{return await m(w),!0x0;}catch(x){if('ENOENT'===x?.[F(0xfe)])return!0x1;throw x;}}export function isProcessAlive(w){const G=d;if(!w||Number['isNaN'](w))return!0x1;try{return process[G(0xfb)](w,0x0),!0x0;}catch{return!0x1;}}export async function appendLog(w,x,y){const H=d,z='['+new Date()[H(0xff)]()+']\x20'+x+(y?'\x20'+JSON[H(0x115)](y):'')+'\x0a';await ensureDir(v['dirname'](w)),await p(w,z,{'encoding':'utf8','flag':'a'});}export function findExecutable(w){const I=d,x='win32'===process['platform']?'where':I(0xfa),y='win32'===process['platform']?[w]:['-v',w],z=g(x,y,{'shell':'win32'!==process['platform'],'encoding':'utf8','windowsHide':!0x0});if(0x0===z['status'])return z[I(0x119)]['split'](/\r?\n/)['map'](A=>A[I(0x112)]())['find'](Boolean)||void 0x0;}export function commandVersion(w,x=[J(0x109)]){const K=J,y=g(w,x,{'encoding':'utf8','windowsHide':!0x0,'timeout':0x1388});if(0x0===y['status'])return(y[K(0x119)]||y[K(0x10e)])['trim']()[K(0x101)](/\r?\n/)[0x0]?.['trim']()||void 0x0;}export function spawnDetached(w,x=[]){const L=J,y=f(process[L(0x10a)],[w,...x],{'detached':!0x0,'stdio':'ignore','windowsHide':!0x0,'env':process.env});return y[L(0x100)](),y['pid'];}export function safeResolve(w,x){const M=J,y=v['resolve'](w,x),z=v[M(0x104)](w,y);if(''===z||!z['startsWith']('..')&&!v[M(0x11d)](z))return y;throw new Error('path\x20escapes\x20workspace:\x20'+x);}export function safeRelativePath(w){const N=J,x=String(w||'')['replace'](/\\/g,'/')[N(0x102)](/^\/+/,'');if(!x||'.'===x)return'';const y=v['posix']['normalize'](x);if('.'===y||''===y)return'';if(y['startsWith']('../')||'..'===y||v['isAbsolute'](y))throw new Error('unsafe\x20relative\x20path:\x20'+w);return y;}export function safeName(w,x='item'){const O=J;return String(w||'')['trim']()['replace'](/[<>:"/\\|?*\x00-\x1f]+/g,'-')[O(0x102)](/^\.+$/,'')['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 P=J,x=String(w||'')[P(0x112)]()['toLowerCase']();return[P(0x107),'claude-code',P(0x108)]['includes'](x)?P(0xfd):['codex','openai-codex']['includes'](x)?'codex':[P(0xfc),P(0x10d)]['includes'](x)?'openclaw':x||'codex';}export function isReadableFilePath(w){const Q=J;return'string'==typeof w&&w[Q(0x10b)]>0x0&&q(w);}
|
package/package.json
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kmlckj/licos-bridge",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "LICOS local agent bridge for Claude ACP and Codex ACP.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"licos-bridge": "dist/index.js"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"@agentclientprotocol/
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@kmlckj/licos-bridge",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "LICOS local agent bridge for Claude ACP and Codex ACP.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"licos-bridge": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "node build.mjs",
|
|
18
|
+
"prepack": "npm run build",
|
|
19
|
+
"smoke": "node dist/index.js --help && node dist/index.js status"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@agentclientprotocol/claude-agent-acp": "^0.39.0",
|
|
23
|
+
"@agentclientprotocol/sdk": "0.22.1",
|
|
24
|
+
"@zed-industries/codex-acp": "^0.15.0",
|
|
25
|
+
"adm-zip": "^0.5.17",
|
|
26
|
+
"ws": "^8.20.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"javascript-obfuscator": "5.4.2",
|
|
30
|
+
"terser": "5.48.0"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"registry": "https://registry.npmjs.org"
|
|
36
|
+
}
|
|
37
|
+
}
|