@wujie-shell/core 0.1.0
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 +237 -0
- package/dist/bin/wujie-shell.mjs +2 -0
- package/dist/src/bundled-agent-skills.mjs +1 -0
- package/dist/src/bundled-agents.mjs +1 -0
- package/dist/src/config-controller.mjs +1 -0
- package/dist/src/electron/main.mjs +1 -0
- package/dist/src/electron/preload.mjs +1 -0
- package/dist/src/gateway-controller.mjs +1 -0
- package/dist/src/gateway-ws.mjs +1 -0
- package/dist/src/index.mjs +1 -0
- package/dist/src/plugin-sync.mjs +1 -0
- package/dist/src/runtime.mjs +1 -0
- package/dist/src/utils.mjs +1 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# @wujie-shell/core
|
|
2
|
+
|
|
3
|
+
`@wujie-shell/core` is the runtime and desktop infrastructure layer for
|
|
4
|
+
`wujie-shell`. It prepares the OpenClaw runtime, generates/syncs OpenClaw
|
|
5
|
+
configuration, starts the gateway, bridges gateway events, and provides the
|
|
6
|
+
Electron main/preload implementation used by product UI projects.
|
|
7
|
+
|
|
8
|
+
## Responsibility
|
|
9
|
+
|
|
10
|
+
- Prepare `apps/<product>/.tmp/runtime` from a bootstrap runtime.
|
|
11
|
+
- Install or validate the configured OpenClaw version.
|
|
12
|
+
- Sync product Plugin, Agent, and Skill directories into the runtime.
|
|
13
|
+
- Generate and maintain `~/<dataDirName>/openclaw.json`.
|
|
14
|
+
- Start/stop/restart the OpenClaw gateway on product-specific ports.
|
|
15
|
+
- Maintain a gateway WebSocket client with device identity auth.
|
|
16
|
+
- Expose safe renderer APIs through Electron preload.
|
|
17
|
+
|
|
18
|
+
This package is shell infrastructure. It must not contain product UI business
|
|
19
|
+
logic or hard-coded product asset lists.
|
|
20
|
+
|
|
21
|
+
## Public Exports
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import {
|
|
25
|
+
createConfigController,
|
|
26
|
+
createGatewayController,
|
|
27
|
+
loadRuntimeInfo,
|
|
28
|
+
prepareRuntime,
|
|
29
|
+
runClawOnce,
|
|
30
|
+
spawnClaw,
|
|
31
|
+
} from '@wujie-shell/core'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Runtime helpers are also exported from `@wujie-shell/core/runtime`.
|
|
35
|
+
|
|
36
|
+
## Runtime Preparation
|
|
37
|
+
|
|
38
|
+
### `prepareRuntime(shellConfig, options?)`
|
|
39
|
+
|
|
40
|
+
Prepares the product runtime at:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
apps/<product>/.tmp/runtime
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Options:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
{
|
|
50
|
+
syncOnly?: boolean
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Behavior:
|
|
55
|
+
|
|
56
|
+
- Copies the bootstrap runtime when needed.
|
|
57
|
+
- Validates Node runtime version.
|
|
58
|
+
- Installs the configured OpenClaw version when `prepare` is used and versions
|
|
59
|
+
differ.
|
|
60
|
+
- Syncs runtime manifest plugin scope with `shell.config.mjs`.
|
|
61
|
+
- Copies product local plugins into `openclaw/dist/extensions`.
|
|
62
|
+
- Copies product agents into `openclaw/agents`.
|
|
63
|
+
- Copies product global skills into `openclaw/skills`.
|
|
64
|
+
- Writes `bin/wujieclaw` so OpenClaw uses the product data directory and config.
|
|
65
|
+
- Updates `runtime-manifest.json` with product metadata.
|
|
66
|
+
|
|
67
|
+
`syncOnly: true` does not install a new OpenClaw version; it validates that the
|
|
68
|
+
prepared runtime already matches the configured OpenClaw version.
|
|
69
|
+
|
|
70
|
+
### `loadRuntimeInfo(projectRoot)`
|
|
71
|
+
|
|
72
|
+
Reads and validates `runtime-manifest.json`, returning absolute paths:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
{
|
|
76
|
+
runtimeRoot,
|
|
77
|
+
manifest,
|
|
78
|
+
openclawVersion,
|
|
79
|
+
nodeExecutable,
|
|
80
|
+
npmCli,
|
|
81
|
+
openclawWorkingDir,
|
|
82
|
+
openclawBin,
|
|
83
|
+
plugins
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### `spawnClaw(projectRoot, args, options?)`
|
|
88
|
+
|
|
89
|
+
Spawns the prepared OpenClaw binary with runtime-aware env variables.
|
|
90
|
+
|
|
91
|
+
### `runClawOnce(projectRoot, args, timeoutMs?)`
|
|
92
|
+
|
|
93
|
+
Runs OpenClaw once and resolves with:
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
{
|
|
97
|
+
code,
|
|
98
|
+
signal,
|
|
99
|
+
stdout,
|
|
100
|
+
stderr
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Config Controller
|
|
105
|
+
|
|
106
|
+
`createConfigController(shellConfig)` owns product OpenClaw config at
|
|
107
|
+
`~/<dataDirName>/openclaw.json`.
|
|
108
|
+
|
|
109
|
+
Important methods:
|
|
110
|
+
|
|
111
|
+
- `ensureConfigPathEnv()`
|
|
112
|
+
- `ensureInitialConfig()`
|
|
113
|
+
- `ensureGatewaySettings()`
|
|
114
|
+
- `readConfig()`
|
|
115
|
+
- `writeConfig(config)`
|
|
116
|
+
- `syncRuntimePlugins()`
|
|
117
|
+
- `getModelSettings()`
|
|
118
|
+
- `setModelSettings(settings, options?)`
|
|
119
|
+
- `setSelfOperatedModels(params)`
|
|
120
|
+
- `ensureAskUserQuestionPluginConfig({ callbackUrl, secret })`
|
|
121
|
+
- `watchConfigChanges()`
|
|
122
|
+
- `dispose()`
|
|
123
|
+
|
|
124
|
+
The initial config includes:
|
|
125
|
+
|
|
126
|
+
- product model providers from `shell.config.mjs`
|
|
127
|
+
- `agents.defaults.workspace`
|
|
128
|
+
- memory and compaction defaults
|
|
129
|
+
- runtime plugin bootstrap entries
|
|
130
|
+
- `skills.load.extraDirs`
|
|
131
|
+
- session defaults
|
|
132
|
+
|
|
133
|
+
Model references must use `provider/modelId`. Display names must not be used as
|
|
134
|
+
request model IDs.
|
|
135
|
+
|
|
136
|
+
## Gateway Controller
|
|
137
|
+
|
|
138
|
+
`createGatewayController({ shellConfig, configController, appVersion })` owns
|
|
139
|
+
the OpenClaw gateway lifecycle.
|
|
140
|
+
|
|
141
|
+
Important methods:
|
|
142
|
+
|
|
143
|
+
- `start()`
|
|
144
|
+
- `stop()`
|
|
145
|
+
- `restart(reason?)`
|
|
146
|
+
- `runtimeInfo()`
|
|
147
|
+
- `getStatus()`
|
|
148
|
+
- `getRecentLogs(limit?)`
|
|
149
|
+
- `answerAskUserQuestion(payload)`
|
|
150
|
+
- `agents.list()`
|
|
151
|
+
- `skills.status(agentId?)`
|
|
152
|
+
- `sessions.create(payload?)`
|
|
153
|
+
- `sessions.list(payload?)`
|
|
154
|
+
- `sessions.delete(payload)`
|
|
155
|
+
- `chat.stream(payload)`
|
|
156
|
+
- `chat.abort(payload)`
|
|
157
|
+
- `chat.history(payload)`
|
|
158
|
+
|
|
159
|
+
Events:
|
|
160
|
+
|
|
161
|
+
- `gateway-status`
|
|
162
|
+
- `gateway-log`
|
|
163
|
+
- `chat-stream-event`
|
|
164
|
+
- `session-updated`
|
|
165
|
+
- `agent-event`
|
|
166
|
+
- `agents-updated`
|
|
167
|
+
- `ask-user-question`
|
|
168
|
+
|
|
169
|
+
Gateway ports are allocated from `shellConfig.ports.gatewayStart` through the
|
|
170
|
+
next 99 ports.
|
|
171
|
+
|
|
172
|
+
## Electron Integration
|
|
173
|
+
|
|
174
|
+
Electron main entry:
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
packages/shell-core/src/electron/main.mjs
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Preload entry:
|
|
181
|
+
|
|
182
|
+
```text
|
|
183
|
+
packages/shell-core/src/electron/preload.mjs
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Main process responsibilities:
|
|
187
|
+
|
|
188
|
+
- Load product config from `WUJIE_SHELL_PROJECT_ROOT`.
|
|
189
|
+
- Create config and gateway controllers.
|
|
190
|
+
- Register IPC handlers.
|
|
191
|
+
- Register shell-owned desktop shortcuts.
|
|
192
|
+
- Broadcast gateway events to renderer windows.
|
|
193
|
+
- Load Vite dev URL or product `dist/index.html`.
|
|
194
|
+
|
|
195
|
+
Renderer code should only use `window.wujieShell`, which is exposed by preload.
|
|
196
|
+
Do not import Electron IPC directly in UI code.
|
|
197
|
+
|
|
198
|
+
Shell-level DevTools ability:
|
|
199
|
+
|
|
200
|
+
- Shortcut: `CommandOrControl+Shift+I`
|
|
201
|
+
- Renderer API: `window.wujieShell.window.openDevTools()`
|
|
202
|
+
- Renderer event:
|
|
203
|
+
`window.wujieShell.window.onDevToolsShortcut(listener)`
|
|
204
|
+
|
|
205
|
+
## CLI
|
|
206
|
+
|
|
207
|
+
The package exposes `wujie-shell`:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
wujie-shell prepare --project apps/playground
|
|
211
|
+
wujie-shell sync --project apps/playground
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`prepare` can install/switch OpenClaw version. `sync` expects the prepared
|
|
215
|
+
runtime version to already match config and only syncs product assets/config
|
|
216
|
+
metadata.
|
|
217
|
+
|
|
218
|
+
## Product Runtime Files
|
|
219
|
+
|
|
220
|
+
Generated files should not be hand-edited:
|
|
221
|
+
|
|
222
|
+
- `apps/<product>/.tmp/runtime/**`
|
|
223
|
+
- `~/<dataDirName>/openclaw.json`
|
|
224
|
+
- `~/<dataDirName>/runtime-state/**`
|
|
225
|
+
- `~/<dataDirName>/identity/device.json`
|
|
226
|
+
|
|
227
|
+
Update the product config/assets, then run:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
./scripts/desktop.sh --sync-only
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
or restart:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
./scripts/desktop.sh
|
|
237
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
(function(_0x39ea56,_0x9fdf37){const _0x5bc448=_0x77c4,_0xb8dd66=_0x39ea56();while(!![]){try{const _0x4abf47=-parseInt(_0x5bc448(0x92))/0x1+parseInt(_0x5bc448(0x8f))/0x2+parseInt(_0x5bc448(0x9a))/0x3*(-parseInt(_0x5bc448(0x8d))/0x4)+-parseInt(_0x5bc448(0xa2))/0x5+-parseInt(_0x5bc448(0x96))/0x6+parseInt(_0x5bc448(0x9f))/0x7*(parseInt(_0x5bc448(0xab))/0x8)+-parseInt(_0x5bc448(0xa1))/0x9*(-parseInt(_0x5bc448(0x95))/0xa);if(_0x4abf47===_0x9fdf37)break;else _0xb8dd66['push'](_0xb8dd66['shift']());}catch(_0x4c4fd0){_0xb8dd66['push'](_0xb8dd66['shift']());}}}(_0x17f7,0x4479b));import{resolve}from'node:path';import{loadShellConfig}from'@wujie-shell/config';function _0x17f7(){const _0x2ab332=['error','help','325883qKDMgd','command:','isArray','3045040muQSqb','1378140ioxyIa','/.tmp/ru','ect\x20<ui-','plugins','88572FSVLvF','slice','--help','ell\x0a\x0aUsa','log','717493lkjWFG','t>\x0a','9cePoXu','1575865UOytPN','stringif','project>','-shell\x20s','message','ync\x20--pr','\x0a\x20\x20wujie','stack','unknown\x20','32sGfhui','length','Version','prepare','openclaw','wujie-sh','sync','exit','ntime','argv','jie-shel','i-projec','project','4SJYgea','shift','932490gazssZ'];_0x17f7=function(){return _0x2ab332;};return _0x17f7();}import{prepareRuntime}from'../src/runtime.mjs';function _0x77c4(_0x464390,_0x593c4f){_0x464390=_0x464390-0x8c;const _0x17f7db=_0x17f7();let _0x77c437=_0x17f7db[_0x464390];return _0x77c437;}function parseArgs(_0x5731c1){const _0x52884f=_0x77c4,_0x3004b2=[..._0x5731c1],_0x3c85e1=_0x3004b2[_0x52884f(0x8e)]()||'help',_0x2caa07={'project':process['cwd']()};for(let _0x411a55=0x0;_0x411a55<_0x3004b2[_0x52884f(0xac)];_0x411a55+=0x1){const _0x539150=_0x3004b2[_0x411a55];(_0x539150==='--projec'+'t'||_0x539150==='-p')&&(_0x2caa07[_0x52884f(0x8c)]=_0x3004b2[_0x411a55+0x1],_0x411a55+=0x1);}return{'command':_0x3c85e1,'options':_0x2caa07};}function usage(){const _0x217582=_0x77c4;console[_0x217582(0x9e)](_0x217582(0xb0)+_0x217582(0x9d)+'ge:\x0a\x20\x20wu'+_0x217582(0xb5)+'l\x20prepar'+'e\x20--proj'+_0x217582(0x98)+_0x217582(0xa4)+_0x217582(0xa8)+_0x217582(0xa5)+_0x217582(0xa7)+'oject\x20<u'+_0x217582(0xb6)+_0x217582(0xa0));}async function main(){const _0x4269f7=_0x77c4,{command:_0x2a89bb,options:_0x3f6f31}=parseArgs(process[_0x4269f7(0xb4)][_0x4269f7(0x9b)](0x2));if(_0x2a89bb===_0x4269f7(0x91)||_0x2a89bb===_0x4269f7(0x9c)||_0x2a89bb==='-h'){usage();return;}if(_0x2a89bb!==_0x4269f7(0xae)&&_0x2a89bb!==_0x4269f7(0xb1))throw new Error(_0x4269f7(0xaa)+_0x4269f7(0x93)+'\x20'+_0x2a89bb);const _0x1fbea9=resolve(_0x3f6f31[_0x4269f7(0x8c)]),_0x4b9940=await loadShellConfig(_0x1fbea9),_0x2a4755=await prepareRuntime(_0x4b9940,{'syncOnly':_0x2a89bb===_0x4269f7(0xb1)});console[_0x4269f7(0x9e)](JSON[_0x4269f7(0xa3)+'y']({'ok':!![],'command':_0x2a89bb,'projectRoot':_0x1fbea9,'runtimeRoot':_0x1fbea9+(_0x4269f7(0x97)+_0x4269f7(0xb3)),'openclawVersion':_0x2a4755[_0x4269f7(0xaf)+_0x4269f7(0xad)],'pluginCount':Array[_0x4269f7(0x94)](_0x2a4755[_0x4269f7(0x99)])?_0x2a4755[_0x4269f7(0x99)][_0x4269f7(0xac)]:0x0},null,0x2));}main()['catch'](_0x268788=>{const _0x60f514=_0x77c4;console[_0x60f514(0x90)](_0x268788 instanceof Error?_0x268788[_0x60f514(0xa9)]||_0x268788[_0x60f514(0xa6)]:String(_0x268788)),process[_0x60f514(0xb2)](0x1);});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x441eeb,_0x2e83e1){const _0x5ae24d=_0x42e3,_0x8f9013=_0x441eeb();while(!![]){try{const _0x4dbc01=-parseInt(_0x5ae24d(0x8e))/0x1+-parseInt(_0x5ae24d(0x9f))/0x2+-parseInt(_0x5ae24d(0x98))/0x3+-parseInt(_0x5ae24d(0x9b))/0x4*(-parseInt(_0x5ae24d(0xa3))/0x5)+parseInt(_0x5ae24d(0x97))/0x6*(-parseInt(_0x5ae24d(0x92))/0x7)+parseInt(_0x5ae24d(0x93))/0x8*(parseInt(_0x5ae24d(0x96))/0x9)+parseInt(_0x5ae24d(0x8c))/0xa;if(_0x4dbc01===_0x2e83e1)break;else _0x8f9013['push'](_0x8f9013['shift']());}catch(_0x13d1df){_0x8f9013['push'](_0x8f9013['shift']());}}}(_0x1ab8,0x5cd83));import{existsSync}from'node:fs';function _0x42e3(_0x293ace,_0xf906c2){_0x293ace=_0x293ace-0x88;const _0x1ab86f=_0x1ab8();let _0x42e3c3=_0x1ab86f[_0x293ace];return _0x42e3c3;}import{readdir}from'node:fs/promises';function _0x1ab8(){const _0x5b3265=['startsWi','lls]\x20fai','skills','map','10942020eJiqcm','object','160141BQfdKU','[wujie-s','main','entries','1368773VmafFW','16DcbseM','trim','agents','1220292FmLuUF','6tDuMBr','2155140EovaAp','length','find','92RgZeOh','hell:ski','isDirect','led\x20to\x20r','604100njcCGk','name','owlist','warn','85005dkOYVx','list','agentAll','stringif','utf8','isArray','gent=','SKILL.md','extraDir','push'];_0x1ab8=function(){return _0x5b3265;};return _0x1ab8();}import{join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'./utils.mjs';async function listValidSkillKeys(_0x2d1f14,_0x2c927b){const _0xe68d46=_0x42e3;if(!existsSync(_0x2d1f14))return[];let _0x58e848=[];try{_0x58e848=await readdir(_0x2d1f14,{'withFileTypes':!![],'encoding':_0xe68d46(0xa7)});}catch(_0x45529d){return console[_0xe68d46(0xa2)](_0xe68d46(0x8f)+_0xe68d46(0x9c)+_0xe68d46(0x89)+_0xe68d46(0x9e)+'ead\x20skil'+'ls\x20dir\x20a'+_0xe68d46(0xa9)+_0x2c927b,_0x45529d),[];}const _0x15447d=[];for(const _0x22e32d of _0x58e848){if(!_0x22e32d[_0xe68d46(0x9d)+'ory']())continue;const _0x244446=_0x22e32d[_0xe68d46(0xa0)][_0xe68d46(0x94)]();if(!_0x244446||_0x244446[_0xe68d46(0x88)+'th']('_'))continue;if(existsSync(join(_0x2d1f14,_0x244446,_0xe68d46(0xaa))))_0x15447d[_0xe68d46(0xac)](_0x244446);}return _0x15447d;}export async function discoverBundledAgentSkills(_0xc48acb,_0x2856b9){const _0x3cf01c=_0x42e3,_0x29cd20=[],_0x5e5a84={},_0x52ed79={};for(const _0x2672b5 of _0xc48acb){const _0x56ce7c=_0x2856b9(_0x2672b5),_0x27821a=await listValidSkillKeys(_0x56ce7c,_0x2672b5);_0x52ed79[_0x2672b5]=_0x27821a,_0x27821a[_0x3cf01c(0x99)]>0x0&&(_0x29cd20['push'](_0x56ce7c),_0x5e5a84[_0x2672b5]=_0x56ce7c);}return{'extraDirs':_0x29cd20,'extraDirByAgent':_0x5e5a84,'agentAllowlist':_0x52ed79};}export async function syncBundledAgentSkillsToConfig({agentIds:_0xe1c164,resolveSkillsDir:_0x2d54c3,readConfig:_0x210ff8,writeConfig:_0x22809e,markConfigWriteHandledInternally:_0x44c0d6}){const _0x53431a=_0x42e3,_0x4e3050=await discoverBundledAgentSkills(_0xe1c164,_0x2d54c3);if(_0xe1c164[_0x53431a(0x99)]===0x0)return{'discovery':_0x4e3050,'changed':![]};const _0x1ae5b9=await _0x210ff8();let _0x4e4f3f=![];const _0x2493fd=asRecord(_0x1ae5b9[_0x53431a(0x8a)]),_0xfc8e44=asRecord(_0x2493fd['load']),_0x780fc3=asStringArray(_0xfc8e44['extraDir'+'s']),_0x42618d=dedupeStrings([..._0x780fc3,..._0x4e3050[_0x53431a(0xab)+'s']]);JSON[_0x53431a(0xa6)+'y'](_0x780fc3)!==JSON[_0x53431a(0xa6)+'y'](_0x42618d)&&(_0xfc8e44[_0x53431a(0xab)+'s']=_0x42618d,_0x2493fd['load']=_0xfc8e44,_0x1ae5b9[_0x53431a(0x8a)]=_0x2493fd,_0x4e4f3f=!![]);const _0x2b03c1=asRecord(_0x1ae5b9[_0x53431a(0x95)]),_0x3070aa=Array[_0x53431a(0xa8)](_0x2b03c1['list'])?_0x2b03c1[_0x53431a(0xa4)]:[];if(_0x3070aa[_0x53431a(0x99)]>0x0){const _0x31112b=_0x3070aa[_0x53431a(0x8b)](_0xbd93d7=>_0xbd93d7&&typeof _0xbd93d7===_0x53431a(0x8d)?{..._0xbd93d7}:_0xbd93d7);let _0x105932=![];for(const [_0x8c6ce1,_0x3d2f52]of Object[_0x53431a(0x91)](_0x4e3050[_0x53431a(0xa5)+_0x53431a(0xa1)])){if(_0x8c6ce1===_0x53431a(0x90))continue;const _0x5e19d8=_0x31112b[_0x53431a(0x9a)](_0x5c2792=>asRecord(_0x5c2792)['id']===_0x8c6ce1);if(!_0x5e19d8)continue;const _0x30a790=Array[_0x53431a(0xa8)](_0x5e19d8[_0x53431a(0x8a)])?_0x5e19d8['skills']:null;(!_0x30a790||JSON[_0x53431a(0xa6)+'y'](_0x30a790)!==JSON[_0x53431a(0xa6)+'y'](_0x3d2f52))&&(_0x5e19d8[_0x53431a(0x8a)]=_0x3d2f52,_0x105932=!![]);}_0x105932&&(_0x2b03c1[_0x53431a(0xa4)]=_0x31112b,_0x1ae5b9[_0x53431a(0x95)]=_0x2b03c1,_0x4e4f3f=!![]);}return _0x4e4f3f&&(_0x44c0d6?.(),await _0x22809e(_0x1ae5b9)),{'discovery':_0x4e3050,'changed':_0x4e4f3f};}export function filterSkillsForAgent(_0x5c2cc0,_0x40f514,_0x3b25aa=''){const _0xb5e165=_0x42e3,_0x5ba8dc=Array['isArray'](asRecord(_0x5c2cc0)[_0xb5e165(0x8a)])?asRecord(_0x5c2cc0)['skills']:[],_0x1ad486=getTrimmedString(_0x3b25aa)||_0xb5e165(0x90),_0x34b623=Array['isArray'](asRecord(asRecord(_0x40f514)[_0xb5e165(0x95)])[_0xb5e165(0xa4)])?asRecord(asRecord(_0x40f514)['agents'])[_0xb5e165(0xa4)]:[],_0x68e267=_0x34b623[_0xb5e165(0x8b)](asRecord)['find'](_0x43f0c5=>getTrimmedString(_0x43f0c5['id'])===_0x1ad486),_0x1615b5=_0x68e267&&Array[_0xb5e165(0xa8)](_0x68e267[_0xb5e165(0x8a)])?new Set(asStringArray(_0x68e267[_0xb5e165(0x8a)])):null;if(!_0x1615b5)return _0x5c2cc0;return{...asRecord(_0x5c2cc0),'skills':_0x5ba8dc['filter'](_0x2737f5=>_0x1615b5['has'](getTrimmedString(asRecord(_0x2737f5)[_0xb5e165(0xa0)])))};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x262a87,_0x3f4cfc){const _0x236ffb=_0x3130,_0x207eb2=_0x262a87();while(!![]){try{const _0x47674d=-parseInt(_0x236ffb(0xa8))/0x1+parseInt(_0x236ffb(0xbd))/0x2*(-parseInt(_0x236ffb(0xb8))/0x3)+-parseInt(_0x236ffb(0xbe))/0x4+parseInt(_0x236ffb(0x9e))/0x5*(-parseInt(_0x236ffb(0x95))/0x6)+parseInt(_0x236ffb(0xba))/0x7*(-parseInt(_0x236ffb(0xb1))/0x8)+parseInt(_0x236ffb(0x99))/0x9*(parseInt(_0x236ffb(0xac))/0xa)+parseInt(_0x236ffb(0xa5))/0xb*(parseInt(_0x236ffb(0xa9))/0xc);if(_0x47674d===_0x3f4cfc)break;else _0x207eb2['push'](_0x207eb2['shift']());}catch(_0x3e404f){_0x207eb2['push'](_0x207eb2['shift']());}}}(_0x3d22,0x81a4c));import{existsSync}from'node:fs';function _0x3d22(){const _0x2b89b6=['name','138066UzvGsP','1776fKrttf','tyDomain','isArray','10QIpxcF','main','model','includes','trim','2309176SRoUzN','emoji','pped\x20uns','filter','absPath','t\x20\x22','find','15wJOsmw','workspac','14NqqbZI','agents','version','126172FBQzIO','741076Moalrz','startsWi','readme.j','parse','icon','capabili','nts]\x20fai','ory','hell:age','avatar','some','3830154VkjxOk','aths','isDirect','ins','4069026AMsnZZ','nts]\x20ski','utf8','gedPath:','error','5imKRPU','[wujie-s','led\x20to\x20s','cnName','son','warn','map','143693dWeDPT','all'];_0x3d22=function(){return _0x2b89b6;};return _0x3d22();}import{cp,mkdir,readFile,readdir,rm}from'node:fs/promises';import{dirname,join,resolve,sep}from'node:path';function _0x3130(_0x1c4444,_0x3f4c4d){_0x1c4444=_0x1c4444-0x8c;const _0x3d220f=_0x3d22();let _0x3130d2=_0x3d220f[_0x1c4444];return _0x3130d2;}import{asRecord,asStringArray,getTrimmedString,readJson}from'./utils.mjs';function toOptionalString(_0x30edba){const _0x37a563=getTrimmedString(_0x30edba);return _0x37a563||undefined;}export async function loadBundledAgents(_0x320c2e){const _0x4b69c8=_0x3130;let _0xe4e0c9=[];try{_0xe4e0c9=await readdir(_0x320c2e,{'withFileTypes':!![],'encoding':_0x4b69c8(0x9b)});}catch{return[];}const _0x3e8db7=await Promise[_0x4b69c8(0xa6)](_0xe4e0c9[_0x4b69c8(0xb4)](_0x52010f=>_0x52010f[_0x4b69c8(0x97)+_0x4b69c8(0x91)]())[_0x4b69c8(0xa4)](async _0x2463e4=>{const _0x51104a=_0x4b69c8,_0x50cd38=_0x2463e4['name'][_0x51104a(0xb0)]();if(!_0x50cd38)return null;const _0x18d165=await readJson(join(_0x320c2e,_0x50cd38,'readme.j'+_0x51104a(0xa2)),{}),_0x478f11=asRecord(_0x18d165),_0x15fb5b=toOptionalString(_0x478f11[_0x51104a(0xa7)])??_0x50cd38;if(!_0x15fb5b)return null;return{'name':_0x15fb5b,'cnName':toOptionalString(_0x478f11[_0x51104a(0xa1)]),'avatar':toOptionalString(_0x478f11[_0x51104a(0x93)]),'icon':toOptionalString(_0x478f11[_0x51104a(0x8e)]),'emoji':toOptionalString(_0x478f11[_0x51104a(0xb2)]),'model':toOptionalString(_0x478f11[_0x51104a(0xae)]),'version':toOptionalString(_0x478f11['version']),'capabilityDomains':asStringArray(_0x478f11[_0x51104a(0x8f)+_0x51104a(0xaa)+'s']??_0x478f11['toolDoma'+_0x51104a(0x98)]),'managedPaths':asStringArray(_0x478f11['managedP'+_0x51104a(0x96)])};}));return _0x3e8db7['filter'](Boolean);}async function readJsonVersion(_0x203b0e){const _0x2caec6=_0x3130;try{const _0x42c9ba=JSON[_0x2caec6(0x8d)](await readFile(_0x203b0e,'utf8'));return getTrimmedString(asRecord(_0x42c9ba)[_0x2caec6(0xbc)])||null;}catch{return null;}}function assertSafeManagedPath(_0x229170,_0x2eb686){const _0x48db68=_0x3130,_0x3646ad=getTrimmedString(_0x2eb686);if(!_0x3646ad||_0x3646ad[_0x48db68(0xbf)+'th']('/')||_0x3646ad[_0x48db68(0xaf)]('..'))return null;const _0x257b68=resolve(_0x229170),_0x36c37d=resolve(join(_0x229170,_0x3646ad));if(_0x36c37d!==_0x257b68&&!_0x36c37d[_0x48db68(0xbf)+'th'](_0x257b68+sep))return null;return{'relPath':_0x3646ad,'absPath':_0x36c37d};}async function copyManagedPaths(_0x46e72e,_0x37fd27,_0x6a6804){const _0x3464cc=_0x3130;if(_0x6a6804['length']===0x0){await cp(_0x46e72e,_0x37fd27,{'recursive':!![]});return;}for(const _0x11dac7 of _0x6a6804){const _0x505c19=assertSafeManagedPath(_0x37fd27,_0x11dac7);if(!_0x505c19){console[_0x3464cc(0xa3)](_0x3464cc(0x9f)+_0x3464cc(0x92)+_0x3464cc(0x9a)+_0x3464cc(0xb3)+'afe\x20mana'+_0x3464cc(0x9c)+'\x20'+_0x11dac7);continue;}const _0xc79b81=join(_0x46e72e,_0x505c19['relPath']);if(!existsSync(_0xc79b81)){await rm(_0x505c19[_0x3464cc(0xb5)],{'recursive':!![],'force':!![]});continue;}await rm(_0x505c19[_0x3464cc(0xb5)],{'recursive':!![],'force':!![]}),await mkdir(dirname(_0x505c19[_0x3464cc(0xb5)]),{'recursive':!![]}),await cp(_0xc79b81,_0x505c19['absPath'],{'recursive':!![]});}}export async function ensureBundledAgents({runtimeBundledAgentsDir:_0x5cf3ea,stateDir:_0x2c4ee3,listAgents:_0x1d75d8,createAgent:_0x538457,updateAgent:_0x647874,syncSkills:_0x327192}){const _0x1927b5=_0x3130;let _0x557cea=![];const _0x4b6201=await _0x1d75d8(),_0x5f3cf9=Array[_0x1927b5(0xab)](_0x4b6201[_0x1927b5(0xbb)])?_0x4b6201[_0x1927b5(0xbb)]:[],_0x56adcd=_0x5f3cf9[_0x1927b5(0xb7)](_0x18cb6b=>_0x18cb6b?.['id']===_0x1927b5(0xad)),_0x398167=getTrimmedString(_0x56adcd?.[_0x1927b5(0xb9)+'e'])||join(_0x2c4ee3,_0x1927b5(0xb9)+'e'),_0x4ac2dd=await loadBundledAgents(_0x5cf3ea);for(const _0x11f548 of _0x4ac2dd){const {name:_0x3bb58e,cnName:_0x212f0d,avatar:_0x3f26e8,emoji:_0x1b36ea,version:_0x3a7927,managedPaths:_0x2c4c2a}=_0x11f548,_0x283742=_0x3bb58e===_0x1927b5(0xad),_0x2a75cc=_0x283742?_0x398167:join(dirname(_0x398167),'workspac'+'e-'+_0x3bb58e),_0x526cd0=join(_0x5cf3ea,_0x3bb58e);if(!existsSync(_0x526cd0))continue;try{const _0x4c5c2d=_0x283742||_0x5f3cf9[_0x1927b5(0x94)](_0x150930=>_0x150930?.['id']===_0x3bb58e);if(_0x4c5c2d){const _0x404ba3=await readJsonVersion(join(_0x2a75cc,_0x1927b5(0x8c)+_0x1927b5(0xa2)));if(_0x3a7927&&_0x404ba3&&_0x3a7927===_0x404ba3)continue;await mkdir(_0x2a75cc,{'recursive':!![]}),await copyManagedPaths(_0x526cd0,_0x2a75cc,_0x2c4c2a);}else await rm(_0x2a75cc,{'recursive':!![],'force':!![]}),await mkdir(_0x2a75cc,{'recursive':!![]}),await cp(_0x526cd0,_0x2a75cc,{'recursive':!![]});_0x557cea=!![];if(_0x283742)continue;if(_0x4c5c2d){const _0x44ca4b={'agentId':_0x3bb58e,'workspace':_0x2a75cc};if(_0x212f0d)_0x44ca4b[_0x1927b5(0xa7)]=_0x212f0d;if(_0x3f26e8)_0x44ca4b[_0x1927b5(0x93)]=_0x3f26e8;if(_0x1b36ea)_0x44ca4b['emoji']=_0x1b36ea;await _0x647874(_0x44ca4b);}else{const _0x57395a={'name':_0x3bb58e,'workspace':_0x2a75cc};if(_0x3f26e8)_0x57395a[_0x1927b5(0x93)]=_0x3f26e8;if(_0x1b36ea)_0x57395a[_0x1927b5(0xb2)]=_0x1b36ea;const _0x236fb0=asRecord(await _0x538457(_0x57395a));_0x212f0d&&await _0x647874({'agentId':getTrimmedString(_0x236fb0['agentId'])||_0x3bb58e,'name':_0x212f0d});}}catch(_0x468360){console[_0x1927b5(0x9d)](_0x1927b5(0x9f)+'hell:age'+_0x1927b5(0x90)+_0x1927b5(0xa0)+'ync\x20bund'+'led\x20agen'+_0x1927b5(0xb6)+_0x3bb58e+'\x22',_0x468360);}}return await _0x327192?.({'agentIds':_0x4ac2dd[_0x1927b5(0xa4)](_0x5d8d1a=>_0x5d8d1a[_0x1927b5(0xa7)]),'mainWorkspace':_0x398167}),{'didUpdate':_0x557cea,'bundledAgents':_0x4ac2dd};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x26af65=_0x256a;(function(_0x36b379,_0x5243b3){const _0x463c3a=_0x256a,_0x1abcd7=_0x36b379();while(!![]){try{const _0x33a003=parseInt(_0x463c3a(0x143))/0x1+-parseInt(_0x463c3a(0x100))/0x2*(-parseInt(_0x463c3a(0x157))/0x3)+-parseInt(_0x463c3a(0x128))/0x4*(parseInt(_0x463c3a(0x146))/0x5)+-parseInt(_0x463c3a(0x120))/0x6*(-parseInt(_0x463c3a(0x12c))/0x7)+parseInt(_0x463c3a(0x11d))/0x8+parseInt(_0x463c3a(0x122))/0x9+-parseInt(_0x463c3a(0x134))/0xa*(parseInt(_0x463c3a(0x119))/0xb);if(_0x33a003===_0x5243b3)break;else _0x1abcd7['push'](_0x1abcd7['shift']());}catch(_0x7b9cc0){_0x1abcd7['push'](_0x1abcd7['shift']());}}}(_0x4260,0xe5cd6));import{randomBytes}from'node:crypto';import{existsSync,unwatchFile,watchFile}from'node:fs';import{mkdir,writeFile}from'node:fs/promises';import{dirname,join}from'node:path';import _0x4aa70e,{portNumbers}from'get-port';import{ensureShellStateDirs,getConfigPaths,readJsonFile,writeJsonFile}from'@wujie-shell/config';import{asRecord,dedupeStrings,getTrimmedString,writeJson}from'./utils.mjs';import{loadRuntimeInfo}from'./runtime.mjs';import{syncRuntimeManifestPlugins}from'./plugin-sync.mjs';const MEMORY_CORE_PLUGIN_ID=_0x26af65(0x113)+_0x26af65(0x149),ACTIVE_MEMORY_PLUGIN_ID=_0x26af65(0x110)+'emory',ASK_USER_QUESTION_PLUGIN_ID='ask-user'+_0x26af65(0x135)+'n';function _0x4260(){const _0x39c995=['merge','86631EPwhzy','34BsfaWe','deviceId','apiKey','openclaw','compat','oot','imageMod','per-chan','defaults','utf8','modelNam','tart','mode','eUrl','agents','length','active-m','dels\x20upd','nChange','memory-c','plugins','entries','odel','config\x20c','openai','27736247YgsDqc','nel-peer','Key','ttings\x20u','13323808NrUVUP','yName','gatewayS','6iuTWmY','c-messag','1632366yRQcde','onboard','model\x20co','rated\x20mo','idle','lastGood','190172KqKwde','ated','256kb','elPrimar','10220910xnMYqT','entityPa','local','models','restartO','configPa','image','map','10IImbkj','-questio','session','stateDir','dataDir','projectR','anthropi','skills','model','slice','auto','baseUrl','defaultM','hange','openai-c','92745fithfe','nfig\x20upd','config','45FegzPk','pdated','model\x20se','ore','changed','primary','toISOStr','allow','ompletio','ConfigPa','stringif','text','push','protocol','provider','full'];_0x4260=function(){return _0x39c995;};return _0x4260();}function createToken(){return randomBytes(0x18)['toString']('hex');}function createProviderModelConfig(_0x202ff2,_0x4febfe=![]){const _0xf9a982=_0x26af65;return{'id':_0x202ff2,'name':_0x202ff2,'reasoning':!![],'input':_0x4febfe?[_0xf9a982(0x151),_0xf9a982(0x132)]:[_0xf9a982(0x151)],'cost':{'input':0x0,'output':0x0,'cacheRead':0x0,'cacheWrite':0x0},'contextWindow':0x3e800,'maxTokens':0x3e800};}function createProviderConfig(_0x18cca0){const _0x173f52=_0x26af65;return{'apiKey':_0x18cca0['apiKey'],'api':_0x18cca0[_0x173f52(0x153)]===_0x173f52(0x13a)+'c'?_0x173f52(0x13a)+_0x173f52(0x121)+'es':_0x173f52(0x142)+'ompletio'+'ns',..._0x18cca0[_0x173f52(0x13f)]?{'baseUrl':_0x18cca0['baseUrl']}:{},'models':[createProviderModelConfig(_0x18cca0['modelNam'+'e'])]};}function createRuntimePluginBootstrap(_0x58ab75){const _0x1291ad=_0x26af65,_0x48af7e={},_0x352656=[];for(const _0x79e67d of _0x58ab75??[]){const _0x876c38=getTrimmedString(_0x79e67d['pluginId']);if(!_0x876c38)continue;_0x48af7e[_0x876c38]={'enabled':!![]},_0x352656[_0x1291ad(0x152)](_0x876c38);}return!_0x48af7e[MEMORY_CORE_PLUGIN_ID]&&(_0x48af7e[MEMORY_CORE_PLUGIN_ID]={'enabled':!![],'config':{'dreaming':{'enabled':!![]}}}),!_0x48af7e[ACTIVE_MEMORY_PLUGIN_ID]&&(_0x48af7e[ACTIVE_MEMORY_PLUGIN_ID]={'enabled':!![]}),{'entries':_0x48af7e,'allow':dedupeStrings([..._0x352656,MEMORY_CORE_PLUGIN_ID,ACTIVE_MEMORY_PLUGIN_ID]),'bundledDiscovery':_0x1291ad(0x104)};}function createInitialOpenClawConfig(_0x372131,_0x52c1c2){const _0xcf8561=_0x26af65,_0x168619=new Date()[_0xcf8561(0x14c)+'ing'](),_0x46356e=join(_0x372131[_0xcf8561(0x138)],'workspac'+'e'),_0x146267=asRecord(_0x372131[_0xcf8561(0x12f)]),_0x58758a=getTrimmedString(_0x146267[_0xcf8561(0x140)+_0xcf8561(0x116)]),_0x410ffb={'workspace':_0x46356e,'memorySearch':{'enabled':!![],'sources':['memory'],'provider':_0xcf8561(0x13e)},'compaction':{'memoryFlush':{'enabled':!![],'forceFlushTranscriptBytes':_0xcf8561(0x12a),'softThresholdTokens':0x30d40}}};return _0x58758a&&(_0x410ffb[_0xcf8561(0x13c)]={'primary':_0x58758a}),{'meta':{'lastTouchedVersion':_0x52c1c2[_0xcf8561(0x103)+'Version'],'lastTouchedAt':_0x168619},'wizard':{'lastRunAt':_0x168619,'lastRunVersion':_0x52c1c2[_0xcf8561(0x103)+'Version'],'lastRunCommand':_0xcf8561(0x123),'lastRunMode':_0xcf8561(0x12e)},'models':{'mode':'merge','providers':asRecord(_0x146267[_0xcf8561(0x154)+'s'])},'agents':{'defaults':_0x410ffb},'tools':{'profile':_0xcf8561(0x155)},'plugins':createRuntimePluginBootstrap(_0x52c1c2[_0xcf8561(0x114)]),'skills':{'load':{'extraDirs':[_0xcf8561(0x13b)]}},'session':{'dmScope':_0xcf8561(0x107)+_0xcf8561(0x11a),'reset':{'mode':_0xcf8561(0x126)}}};}function hasMeaningfulProductModels(_0x3b34ab){const _0x44fad4=_0x26af65,_0x2d8334=asRecord(_0x3b34ab['models']);return Object['keys'](asRecord(_0x2d8334[_0x44fad4(0x154)+'s']))[_0x44fad4(0x10f)]>0x0||Boolean(getTrimmedString(_0x2d8334[_0x44fad4(0x140)+_0x44fad4(0x116)]));}function syncProductModels(_0x5abee9,_0x2525f9){const _0x511d35=_0x26af65;if(!hasMeaningfulProductModels(_0x2525f9))return{'config':_0x5abee9,'changed':![]};let _0xf56211=![];const _0x4e899a=asRecord(_0x2525f9[_0x511d35(0x12f)]),_0x4f9aa7=asRecord(_0x4e899a['provider'+'s']),_0xe3192a=getTrimmedString(_0x4e899a[_0x511d35(0x140)+_0x511d35(0x116)]),_0x3e8de3=asRecord(_0x5abee9[_0x511d35(0x12f)]),_0x323475=asRecord(_0x3e8de3[_0x511d35(0x154)+'s']);for(const [_0x2e3e99,_0x1f5d2e]of Object['entries'](_0x4f9aa7)){const _0xfdc5ba=asRecord(_0x323475[_0x2e3e99]),_0x4d7fc4=asRecord(_0x1f5d2e);JSON[_0x511d35(0x150)+'y'](_0xfdc5ba)!==JSON[_0x511d35(0x150)+'y'](_0x4d7fc4)&&(_0x323475[_0x2e3e99]=_0x4d7fc4,_0xf56211=!![]);}_0x3e8de3[_0x511d35(0x10c)]!=='merge'&&(_0x3e8de3[_0x511d35(0x10c)]=_0x511d35(0x156),_0xf56211=!![]);_0x3e8de3[_0x511d35(0x154)+'s']!==_0x323475&&(_0x3e8de3[_0x511d35(0x154)+'s']=_0x323475,_0xf56211=!![]);_0x5abee9['models']!==_0x3e8de3&&(_0x5abee9[_0x511d35(0x12f)]=_0x3e8de3,_0xf56211=!![]);if(_0xe3192a){const _0x3827ac=asRecord(_0x5abee9[_0x511d35(0x10e)]),_0x3b88fe=asRecord(_0x3827ac['defaults']),_0x48caa6=asRecord(_0x3b88fe[_0x511d35(0x13c)]);_0x48caa6[_0x511d35(0x14b)]!==_0xe3192a&&(_0x3b88fe[_0x511d35(0x13c)]={..._0x48caa6,'primary':_0xe3192a},_0x3827ac[_0x511d35(0x108)]=_0x3b88fe,_0x5abee9[_0x511d35(0x10e)]=_0x3827ac,_0xf56211=!![]);}return{'config':_0x5abee9,'changed':_0xf56211};}function _0x256a(_0x4ce4a8,_0x5a6ec8){_0x4ce4a8=_0x4ce4a8-0x100;const _0x4260b9=_0x4260();let _0x256a26=_0x4260b9[_0x4ce4a8];return _0x256a26;}export function createConfigController(_0x299e61){const _0x2da857=getConfigPaths(_0x299e61);let _0x238577=![],_0x5e7b62=0x0,_0x12fad7=null,_0x57f6d7=null;function _0x205d0a(){return _0x2da857['configPa'+'th'];}function _0x534dd9(){return _0x2da857['stateDir'];}function _0x45970f(){const _0x37e3bd=_0x256a;return _0x2da857[_0x37e3bd(0x101)+_0x37e3bd(0x12d)+'th'];}async function _0x27b101(){const _0x4a44fc=_0x256a;await ensureShellStateDirs(_0x299e61),process.env.OPENCLAW_STATE_DIR=_0x2da857[_0x4a44fc(0x137)],process.env.OPENCLAW_CONFIG_PATH=_0x2da857[_0x4a44fc(0x131)+'th'];}async function _0x316082(){const _0x624915=_0x256a;await _0x27b101();const _0x42fcb5=await loadRuntimeInfo(_0x299e61[_0x624915(0x139)+'oot']);if(!existsSync(_0x2da857[_0x624915(0x131)+'th'])){const _0x3be01c=createInitialOpenClawConfig(_0x299e61,_0x42fcb5);_0x255cd3(),await _0x238711(_0x3be01c),await writeJson(_0x2da857[_0x624915(0x127)+_0x624915(0x14f)+'th'],_0x3be01c);}await _0x2eef27(),await _0x49b5aa();}async function _0x5c122f(){const _0x56acaa=_0x256a;return await _0x316082(),readJsonFile(_0x2da857[_0x56acaa(0x131)+'th'],{});}async function _0x2ff4f0(){const _0x4345b1=_0x256a;return readJsonFile(_0x2da857[_0x4345b1(0x131)+'th'],{});}async function _0x238711(_0x24c293){const _0x5d8c5c=_0x256a;await mkdir(dirname(_0x2da857['configPa'+'th']),{'recursive':!![]}),await writeFile(_0x2da857['configPa'+'th'],JSON[_0x5d8c5c(0x150)+'y'](_0x24c293,null,0x2)+'\x0a',_0x5d8c5c(0x109));}async function _0x49b5aa(){const _0x5d8b0c=_0x256a,_0x9940dc=await loadRuntimeInfo(_0x299e61[_0x5d8b0c(0x139)+_0x5d8b0c(0x105)]),_0x4ec51e=await _0x2ff4f0(),_0x3a2fab=syncRuntimeManifestPlugins(_0x4ec51e['plugins'],_0x9940dc['plugins']);(_0x3a2fab[_0x5d8b0c(0x14a)]||!_0x4ec51e['plugins'])&&(_0x4ec51e['plugins']=_0x3a2fab['plugins'],_0x255cd3(),await _0x238711(_0x4ec51e));}async function _0x2eef27(){const _0x19ee79=_0x256a,_0x5d1fb9=await _0x2ff4f0(),_0x5a929e=syncProductModels(_0x5d1fb9,_0x299e61);_0x5a929e[_0x19ee79(0x14a)]&&await _0x26a780(_0x5a929e['config'],'product\x20'+_0x19ee79(0x124)+_0x19ee79(0x144)+_0x19ee79(0x129));}async function _0x225ece(){const _0x34f95b=_0x256a;await _0x316082();const _0x4a268f=await _0x4aa70e({'port':portNumbers(_0x299e61['ports'][_0x34f95b(0x11f)+_0x34f95b(0x10b)],_0x299e61['ports'][_0x34f95b(0x11f)+_0x34f95b(0x10b)]+0x63)});return{'token':createToken(),'port':_0x4a268f};}async function _0x5a50b2(){const _0x58fa92=_0x256a,_0x3c531d=await _0x5c122f(),_0x9e2da9=asRecord(_0x3c531d['agents']),_0x5a216a=asRecord(_0x9e2da9['defaults']),_0x32b2b4=asRecord(_0x5a216a[_0x58fa92(0x13c)]),_0x31737e=getTrimmedString(_0x32b2b4[_0x58fa92(0x14b)]),_0x293832=_0x31737e['indexOf']('/'),_0x1b5e6d=_0x293832>0x0?_0x31737e['slice'](0x0,_0x293832):_0x31737e,_0x6eeb87=_0x293832>0x0?_0x31737e[_0x58fa92(0x13d)](_0x293832+0x1):'',_0x2cf711=asRecord(asRecord(_0x3c531d[_0x58fa92(0x12f)])[_0x58fa92(0x154)+'s']),_0x453504=asRecord(_0x2cf711[_0x1b5e6d]);return{'provider':_0x1b5e6d||'','apiKey':getTrimmedString(_0x453504[_0x58fa92(0x102)]),'modelName':_0x6eeb87,'modelBaseUrl':getTrimmedString(_0x453504[_0x58fa92(0x13f)])};}async function _0x384fb7(_0x5e416b,_0x43d058={}){const _0x5b5c36=_0x256a,_0x2ba9bf=await _0x5c122f(),_0x30339c=_0x5e416b['provider']||'default',_0x5285cf=_0x30339c+'/'+_0x5e416b[_0x5b5c36(0x10a)+'e'],_0x33da3e=asRecord(_0x2ba9bf[_0x5b5c36(0x12f)]),_0x22c785=asRecord(_0x33da3e[_0x5b5c36(0x154)+'s']);_0x22c785[_0x30339c]={...asRecord(_0x22c785[_0x30339c]),...createProviderConfig({'apiKey':_0x5e416b[_0x5b5c36(0x102)]||'','protocol':_0x5e416b[_0x5b5c36(0x153)]||_0x5b5c36(0x118),'baseUrl':_0x5e416b['modelBas'+_0x5b5c36(0x10d)]||_0x5e416b[_0x5b5c36(0x13f)]||'','modelName':_0x5e416b[_0x5b5c36(0x10a)+'e']})},_0x33da3e[_0x5b5c36(0x154)+'s']=_0x22c785,_0x2ba9bf[_0x5b5c36(0x12f)]=_0x33da3e;const _0x52aa43=asRecord(_0x2ba9bf[_0x5b5c36(0x10e)]),_0x121d44=asRecord(_0x52aa43[_0x5b5c36(0x108)]);return _0x121d44[_0x5b5c36(0x13c)]={...asRecord(_0x121d44[_0x5b5c36(0x13c)]),'primary':_0x5285cf},_0x121d44['models']={...asRecord(_0x121d44[_0x5b5c36(0x12f)]),[_0x5285cf]:asRecord(asRecord(_0x121d44[_0x5b5c36(0x12f)])[_0x5285cf])},_0x52aa43[_0x5b5c36(0x108)]=_0x121d44,_0x2ba9bf[_0x5b5c36(0x10e)]=_0x52aa43,_0x2ba9bf[_0x5b5c36(0x136)]={...asRecord(_0x2ba9bf[_0x5b5c36(0x136)]),'dmScope':_0x5b5c36(0x107)+_0x5b5c36(0x11a)},await _0x26a780(_0x2ba9bf,_0x43d058[_0x5b5c36(0x130)+_0x5b5c36(0x112)]?_0x5b5c36(0x148)+_0x5b5c36(0x11c)+_0x5b5c36(0x147):''),{'ok':!![]};}async function _0x546247(_0x333aca){const _0x5b3c89=_0x256a,_0x1dbe56=await _0x5c122f(),_0x90f132=_0x333aca['provider'+_0x5b3c89(0x11b)],_0x1502fe=asRecord(_0x1dbe56[_0x5b3c89(0x12f)]),_0x170487=asRecord(_0x1502fe[_0x5b3c89(0x154)+'s']);_0x170487[_0x90f132]={...asRecord(_0x170487[_0x90f132]),'apiKey':_0x333aca[_0x5b3c89(0x102)],'api':_0x5b3c89(0x142)+_0x5b3c89(0x14e)+'ns','baseUrl':_0x333aca[_0x5b3c89(0x13f)],'models':(_0x333aca[_0x5b3c89(0x10a)+'es']??[])[_0x5b3c89(0x133)](_0x4ec48d=>createProviderModelConfig(_0x4ec48d,_0x4ec48d===_0x333aca[_0x5b3c89(0x106)+_0x5b3c89(0x12b)+_0x5b3c89(0x11e)]))},_0x1502fe[_0x5b3c89(0x154)+'s']=_0x170487,_0x1dbe56[_0x5b3c89(0x12f)]=_0x1502fe;if(_0x333aca['imageMod'+'elPrimar'+_0x5b3c89(0x11e)]){const _0x48bab2=asRecord(_0x1dbe56[_0x5b3c89(0x10e)]),_0x307775=asRecord(_0x48bab2[_0x5b3c89(0x108)]);_0x307775['imageMod'+'el']={...asRecord(_0x307775[_0x5b3c89(0x106)+'el']),'primary':_0x90f132+'/'+_0x333aca[_0x5b3c89(0x106)+'elPrimar'+'yName']},_0x48bab2[_0x5b3c89(0x108)]=_0x307775,_0x1dbe56[_0x5b3c89(0x10e)]=_0x48bab2;}return await _0x26a780(_0x1dbe56,'self-ope'+_0x5b3c89(0x125)+_0x5b3c89(0x111)+'ated'),{'ok':!![]};}async function _0x354b02({callbackUrl:_0x2b5742,secret:_0x3ad822}){const _0x368cf1=_0x256a,_0x293ff8=await _0x5c122f(),_0x54d0d9=asRecord(_0x293ff8[_0x368cf1(0x114)]),_0x594351=asRecord(_0x54d0d9[_0x368cf1(0x115)]),_0x9cec1b=asRecord(_0x594351[ASK_USER_QUESTION_PLUGIN_ID]);return _0x594351[ASK_USER_QUESTION_PLUGIN_ID]={..._0x9cec1b,'enabled':!![],'config':{...asRecord(_0x9cec1b[_0x368cf1(0x145)]),'callbackUrl':_0x2b5742,'secret':_0x3ad822}},_0x54d0d9[_0x368cf1(0x115)]=_0x594351,_0x54d0d9[_0x368cf1(0x14d)]=dedupeStrings([...(Array['isArray'](_0x54d0d9[_0x368cf1(0x14d)])?_0x54d0d9[_0x368cf1(0x14d)]:[])['filter'](Boolean),ASK_USER_QUESTION_PLUGIN_ID]),_0x293ff8[_0x368cf1(0x114)]=_0x54d0d9,await _0x26a780(_0x293ff8,''),{'ok':!![]};}async function _0x26a780(_0x52ef27,_0x53b82e=''){const _0x5ddee4=_0x256a;_0x255cd3(),await _0x238711(_0x52ef27),await writeJsonFile(_0x2da857[_0x5ddee4(0x127)+_0x5ddee4(0x14f)+'th'],_0x52ef27);if(_0x53b82e)_0x344f3f(_0x53b82e);}function _0x255cd3(){if(_0x238577)_0x5e7b62+=0x1;}function _0x16eabb(_0x9b206e){_0x57f6d7=_0x9b206e;}function _0x344f3f(_0x544c46){if(!_0x57f6d7)return;if(_0x12fad7)clearTimeout(_0x12fad7);_0x12fad7=setTimeout(()=>_0x57f6d7(_0x544c46),0xfa);}function _0x36cdc0(){const _0x4db2fd=_0x256a;unwatchFile(_0x2da857['configPa'+'th']),_0x238577=!![],watchFile(_0x2da857[_0x4db2fd(0x131)+'th'],{'interval':0x3e8},(_0x1d2d2d,_0x147d6d)=>{const _0x36d878=_0x4db2fd;if(_0x1d2d2d['mtimeMs']===_0x147d6d['mtimeMs'])return;if(_0x5e7b62>0x0){_0x5e7b62-=0x1;return;}_0x344f3f(_0x36d878(0x117)+_0x36d878(0x141));});}function _0x1cd66c(){const _0x79793f=_0x256a;if(_0x12fad7)clearTimeout(_0x12fad7);unwatchFile(_0x2da857[_0x79793f(0x131)+'th']),_0x238577=![],_0x5e7b62=0x0;}return{'paths':_0x2da857,'resolveConfigPath':_0x205d0a,'resolveStateDir':_0x534dd9,'resolveDeviceIdentityPath':_0x45970f,'ensureConfigPathEnv':_0x27b101,'ensureInitialConfig':_0x316082,'ensureGatewaySettings':_0x225ece,'readConfig':_0x5c122f,'writeConfig':_0x238711,'syncRuntimePlugins':_0x49b5aa,'getModelSettings':_0x5a50b2,'setModelSettings':_0x384fb7,'setSelfOperatedModels':_0x546247,'ensureAskUserQuestionPluginConfig':_0x354b02,'markConfigWriteHandledInternally':_0x255cd3,'setGatewayRestartHandler':_0x16eabb,'watchConfigChanges':_0x36cdc0,'dispose':_0x1cd66c};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x3f1376=_0x47a1;(function(_0x48e146,_0x416511){const _0xdf1eb3=_0x47a1,_0x1d3677=_0x48e146();while(!![]){try{const _0x134b03=-parseInt(_0xdf1eb3(0x14c))/0x1*(parseInt(_0xdf1eb3(0x11e))/0x2)+parseInt(_0xdf1eb3(0x113))/0x3*(parseInt(_0xdf1eb3(0x179))/0x4)+-parseInt(_0xdf1eb3(0x117))/0x5+-parseInt(_0xdf1eb3(0x157))/0x6+parseInt(_0xdf1eb3(0x1a7))/0x7*(-parseInt(_0xdf1eb3(0x143))/0x8)+parseInt(_0xdf1eb3(0x104))/0x9+parseInt(_0xdf1eb3(0x133))/0xa;if(_0x134b03===_0x416511)break;else _0x1d3677['push'](_0x1d3677['shift']());}catch(_0x58e28e){_0x1d3677['push'](_0x1d3677['shift']());}}}(_0x2b8a,0x1b16e));import _0x46698a from'electron';import{fileURLToPath}from'node:url';import{dirname,join,resolve}from'node:path';import{readFile,writeFile}from'node:fs/promises';import{loadShellConfig}from'@wujie-shell/config';import{createConfigController}from'../config-controller.mjs';import{createGatewayController}from'../gateway-controller.mjs';const __dirname=dirname(fileURLToPath(import.meta.url)),preloadPath=join(__dirname,'preload.'+_0x3f1376(0x130)),{app,BrowserWindow,dialog,globalShortcut,ipcMain,shell}=_0x46698a,DEVTOOLS_ACCELERATOR=_0x3f1376(0x145)+_0x3f1376(0x18c)+_0x3f1376(0xdd);function _0x47a1(_0x56f4b5,_0x48a7e7){_0x56f4b5=_0x56f4b5-0xdb;const _0x2b8a59=_0x2b8a();let _0x47a13b=_0x2b8a59[_0x56f4b5];return _0x47a13b;}function _0x2b8a(){const _0xf76646=['abort','+Shift+I','ory-info','elected-','agents','title','\x20shortcu','webConte','stion','tatus','restart','send','nts','activate','-once','hell]\x20fa','config:r','appId','window-a','e:shared','history','then','files:re','ell:even','canceled','agent-ev','darwin','isMaximi','models','will-qui','ist','-context','quit','getVersi','runtimeI','content','way\x20is\x20n','lect-dir','minimize','rename','684585NnihHd','ections','ectory','elete','unmaximi','efault','kUserQue','t:\x20','lect-fil','ead','catch','ools','[wujie-s','-restart','\x20request','12KhGxjG','log','loadFile','unregist','947880jCYnjd','nfo','updated','sender','ll-close','chat','ite','66qQtuGw','iled\x20to\x20','dels','filePath','chat:his','preventD','sharedCo','e:write-','handle','openPath','customMo','-url','Dialog','chat:str','ntext','ite-bina','sessions','director','mjs',':delete','length','3262310kLhHfm',':runtime','eam','tLogs','filters','cwd','cron:run','openDire','nstall','-shortcu','default','ot\x20initi','ell\x20boot','skills','irectory','openExte','7136ZitwUN','hiddenIn','CommandO','ndows','#f8fafc','getRecen','register','create','utf8','512RVRajj','app:open','pinnedKe',':gateway','before-q','ame','shared-c','cron','runOnce','message','-logs','531972lHFGmr','boot\x20ele','ask-user','tory','files:se','uit',':pinned-','path','agents:l','ell\x20gate','agents-u','close','openDevT','index.ht','skills:u','delete','dataDir','openclaw','fromWebC','files:wr','ontents','cron:log','chat:abo','workspac','set','install','dist','window:m','ettings','ate','whenRead','logs','detach','yed','86752OkGRyq','ned-keys','setName',':answer-','read','gateway-','cron:lis','string','session-','-questio','devtools','multiSel',':list','lose','showOpen','platform','oot','wujie-sh','productN','rControl',':rename','zed','limit','ad-binar','settings','alized','status','ctron\x20ma','getAllWi','warn','-info','skills:d','ent','config','yInfo','maximize',':create','window:t','window:c','ustom-mo','isDestro','pdate','ximize','pen-devt','stop','remove','651cCsVvW','list','renderer','writeSha'];_0x2b8a=function(){return _0xf76646;};return _0x2b8a();}let mainWindow=null,shellConfig=null,configController=null,gatewayController=null,bootError=null;function resolveProjectRoot(){const _0x13ecc1=_0x3f1376;return resolve(process.env.WUJIE_SHELL_PROJECT_ROOT||process[_0x13ecc1(0x138)]());}function broadcast(_0x9c83c7,_0x117f83){const _0x169122=_0x3f1376;for(const _0x1865b9 of BrowserWindow[_0x169122(0x195)+'ndows']()){!_0x1865b9[_0x169122(0xe3)+_0x169122(0xe8)][_0x169122(0x1a1)+_0x169122(0x178)]()&&_0x1865b9[_0x169122(0xe3)+_0x169122(0xe8)][_0x169122(0xe7)](_0x169122(0x18a)+_0x169122(0xf3)+'t',{'name':_0x9c83c7,'payload':_0x117f83});}}function openDevToolsForActiveContext(){const _0x5a47f2=_0x3f1376,_0x2305be=BrowserWindow['getFocus'+'edWindow']()||mainWindow;if(!_0x2305be||_0x2305be[_0x5a47f2(0x1a1)+'yed']())return{'ok':![]};return _0x2305be[_0x5a47f2(0xe3)+_0x5a47f2(0xe8)][_0x5a47f2(0x163)+_0x5a47f2(0x10f)]({'mode':'detach'}),_0x2305be[_0x5a47f2(0xe3)+'nts']['send']('wujie-sh'+_0x5a47f2(0xf3)+'t',{'name':_0x5a47f2(0x183)+_0x5a47f2(0x13c)+'t','payload':{'accelerator':DEVTOOLS_ACCELERATOR}}),{'ok':!![]};}function registerShellShortcuts(){const _0x30a11c=_0x3f1376;globalShortcut[_0x30a11c(0x116)+'er'](DEVTOOLS_ACCELERATOR);const _0x46ac38=globalShortcut[_0x30a11c(0x149)](DEVTOOLS_ACCELERATOR,openDevToolsForActiveContext);!_0x46ac38&&console[_0x30a11c(0x196)](_0x30a11c(0x110)+'hell]\x20fa'+'iled\x20to\x20'+_0x30a11c(0x149)+_0x30a11c(0xe2)+_0x30a11c(0x10b)+DEVTOOLS_ACCELERATOR);}async function createWindow(){const _0x451fc2=_0x3f1376;mainWindow=new BrowserWindow({'width':0x49c,'height':0x30c,'minWidth':0x384,'minHeight':0x26c,'title':shellConfig[_0x451fc2(0x18b)+'ame'],'backgroundColor':_0x451fc2(0x147),'titleBarStyle':process[_0x451fc2(0x188)]===_0x451fc2(0xf6)?_0x451fc2(0x144)+_0x451fc2(0x16f):_0x451fc2(0x13d),'webPreferences':{'preload':preloadPath,'contextIsolation':!![],'nodeIntegration':![],'sandbox':![]}});const _0x4f68d2=process.env.VITE_DEV_SERVER_URL;_0x4f68d2?(await mainWindow['loadURL'](_0x4f68d2),process.env.WUJIE_SHELL_OPEN_DEVTOOLS==='1'&&mainWindow['webConte'+_0x451fc2(0xe8)][_0x451fc2(0x163)+_0x451fc2(0x10f)]({'mode':_0x451fc2(0x177)})):await mainWindow[_0x451fc2(0x115)](join(shellConfig['projectR'+_0x451fc2(0x189)],_0x451fc2(0x171),_0x451fc2(0x164)+'ml'));}function installIpcHandlers(){const _0x17c6d0=_0x3f1376,_0x11494b=(_0x2efecb,_0x58ae01)=>{const _0xc660b6=_0x47a1;ipcMain[_0xc660b6(0x126)](_0x2efecb,async(_0x5e5168,_0x1abb89)=>_0x58ae01(_0x5e5168,_0x1abb89));},_0x581f31=()=>{const _0x5daf43=_0x47a1;if(!gatewayController)throw new Error(bootError?_0x5daf43(0x18a)+_0x5daf43(0x13f)+'\x20failed:'+'\x20'+bootError:_0x5daf43(0x18a)+_0x5daf43(0x160)+_0x5daf43(0x100)+_0x5daf43(0x13e)+_0x5daf43(0x192));return gatewayController;};_0x11494b('app:info',async()=>({'name':shellConfig[_0x17c6d0(0x18b)+_0x17c6d0(0x151)],'version':app[_0x17c6d0(0xfd)+'on'](),'appId':shellConfig[_0x17c6d0(0xed)],'dataDir':shellConfig[_0x17c6d0(0x167)]})),_0x11494b(_0x17c6d0(0x14d)+_0x17c6d0(0x129),async(_0xb415b0,_0x1768f9)=>{const _0x5a7a3b=_0x17c6d0,_0x37a0db=typeof _0x1768f9===_0x5a7a3b(0x180)?_0x1768f9:'';if(!_0x37a0db)return{'ok':![]};return await shell[_0x5a7a3b(0x142)+'rnal'](_0x37a0db),{'ok':!![]};}),_0x11494b(_0x17c6d0(0x172)+'inimize',_0x355850=>{const _0x3039cb=_0x17c6d0;return BrowserWindow['fromWebC'+_0x3039cb(0x16b)](_0x355850['sender'])?.[_0x3039cb(0x102)](),{'ok':!![]};}),_0x11494b(_0x17c6d0(0x19e)+'oggle-ma'+_0x17c6d0(0x1a3),_0x19ee1f=>{const _0x36d0bf=_0x17c6d0,_0x4ed626=BrowserWindow[_0x36d0bf(0x169)+_0x36d0bf(0x16b)](_0x19ee1f[_0x36d0bf(0x11a)]);if(!_0x4ed626)return{'isMaximized':![]};if(_0x4ed626[_0x36d0bf(0xf7)+'zed']())_0x4ed626[_0x36d0bf(0x108)+'ze']();else _0x4ed626[_0x36d0bf(0x19c)]();return{'isMaximized':_0x4ed626['isMaximi'+_0x36d0bf(0x18e)]()};}),_0x11494b(_0x17c6d0(0x19f)+_0x17c6d0(0x186),_0x4d5ce9=>{const _0xe8e4cf=_0x17c6d0;return BrowserWindow[_0xe8e4cf(0x169)+_0xe8e4cf(0x16b)](_0x4d5ce9[_0xe8e4cf(0x11a)])?.[_0xe8e4cf(0x162)](),{'ok':!![]};}),_0x11494b('window:o'+_0x17c6d0(0x1a4)+_0x17c6d0(0x10f),()=>openDevToolsForActiveContext()),_0x11494b(_0x17c6d0(0x168)+_0x17c6d0(0x134)+_0x17c6d0(0x197),()=>_0x581f31()[_0x17c6d0(0xfe)+_0x17c6d0(0x118)]()),_0x11494b(_0x17c6d0(0x168)+_0x17c6d0(0x14f)+'-status',()=>_0x581f31()['getStatu'+'s']()),_0x11494b(_0x17c6d0(0x168)+_0x17c6d0(0x14f)+_0x17c6d0(0x111),()=>_0x581f31()[_0x17c6d0(0xe6)](_0x17c6d0(0x1a9)+_0x17c6d0(0x112))),_0x11494b(_0x17c6d0(0x168)+_0x17c6d0(0x14f)+_0x17c6d0(0x156),(_0x29e790,_0x3d06f3={})=>_0x581f31()[_0x17c6d0(0x148)+_0x17c6d0(0x136)](_0x3d06f3?.[_0x17c6d0(0x18f)]??0xc8)),_0x11494b(_0x17c6d0(0x168)+_0x17c6d0(0x17c)+_0x17c6d0(0x159)+_0x17c6d0(0x182)+'n',(_0x578744,_0x241ec9)=>_0x581f31()['answerAs'+_0x17c6d0(0x10a)+_0x17c6d0(0xe4)](_0x241ec9)),_0x11494b(_0x17c6d0(0x15f)+_0x17c6d0(0xfa),()=>_0x581f31()[_0x17c6d0(0xe0)][_0x17c6d0(0x1a8)]()),_0x11494b('skills:s'+_0x17c6d0(0xe5),(_0x1f0c15,_0x554bbf)=>_0x581f31()[_0x17c6d0(0x140)][_0x17c6d0(0x193)](_0x554bbf)),_0x11494b('sessions'+_0x17c6d0(0x19d),(_0x4df297,_0x52260f)=>_0x581f31()['sessions'][_0x17c6d0(0x14a)](_0x52260f)),_0x11494b(_0x17c6d0(0x12e)+_0x17c6d0(0x185),(_0x28d22a,_0x5a6015)=>_0x581f31()[_0x17c6d0(0x12e)][_0x17c6d0(0x1a8)](_0x5a6015)),_0x11494b(_0x17c6d0(0x12e)+_0x17c6d0(0x131),(_0x1bcf67,_0x2f6953)=>_0x581f31()[_0x17c6d0(0x12e)][_0x17c6d0(0x166)](_0x2f6953)),_0x11494b(_0x17c6d0(0x12b)+_0x17c6d0(0x135),(_0x4aa1bb,_0x3883fe)=>_0x581f31()[_0x17c6d0(0x11c)]['stream'](_0x3883fe)),_0x11494b(_0x17c6d0(0x16d)+'rt',(_0x2c9232,_0x215834)=>_0x581f31()[_0x17c6d0(0x11c)][_0x17c6d0(0xdc)](_0x215834)),_0x11494b(_0x17c6d0(0x122)+_0x17c6d0(0x15a),(_0x3b5fc9,_0x33f833)=>_0x581f31()['chat'][_0x17c6d0(0xf0)](_0x33f833)),_0x11494b('files:re'+'ad',(_0x428dea,_0x52e332)=>readFile(_0x52e332,_0x17c6d0(0x14b))),_0x11494b(_0x17c6d0(0xf2)+_0x17c6d0(0x190)+'y',async(_0x23254a,_0x19cac9)=>new Uint8Array(await readFile(_0x19cac9))),_0x11494b('files:wr'+_0x17c6d0(0x11d),async(_0x4b44f7,_0x31d344={})=>{const _0x5bf964=_0x17c6d0;return await writeFile(_0x31d344[_0x5bf964(0x15e)],_0x31d344[_0x5bf964(0xff)]??'',_0x5bf964(0x14b)),{'ok':!![]};}),_0x11494b(_0x17c6d0(0x16a)+_0x17c6d0(0x12d)+'ry',async(_0x502344,_0x4bf9ca={})=>{const _0x441ee0=_0x17c6d0;return await writeFile(_0x4bf9ca[_0x441ee0(0x15e)],Buffer['from'](_0x4bf9ca[_0x441ee0(0xff)]??[])),{'ok':!![]};}),_0x11494b(_0x17c6d0(0x15b)+_0x17c6d0(0x10c)+'e',async(_0x193c81,_0xfd858={})=>{const _0x10f4d2=_0x17c6d0,_0x443ba3=await dialog[_0x10f4d2(0x187)+_0x10f4d2(0x12a)](BrowserWindow[_0x10f4d2(0x169)+_0x10f4d2(0x16b)](_0x193c81['sender'])??mainWindow,{'title':typeof _0xfd858[_0x10f4d2(0xe1)]===_0x10f4d2(0x180)?_0xfd858[_0x10f4d2(0xe1)]:undefined,'properties':['openFile',..._0xfd858[_0x10f4d2(0x184)+_0x10f4d2(0x105)]?[_0x10f4d2(0x184)+_0x10f4d2(0x105)]:[]],'filters':Array['isArray'](_0xfd858[_0x10f4d2(0x137)])?_0xfd858[_0x10f4d2(0x137)]:undefined});return{'canceled':_0x443ba3['canceled'],'paths':_0x443ba3['filePath'+'s']};}),_0x11494b(_0x17c6d0(0x15b)+_0x17c6d0(0x101)+_0x17c6d0(0x106),async(_0x3961d5,_0x1ae0d2={})=>{const _0x27ecb8=_0x17c6d0,_0xe69a8d=await dialog[_0x27ecb8(0x187)+_0x27ecb8(0x12a)](BrowserWindow[_0x27ecb8(0x169)+_0x27ecb8(0x16b)](_0x3961d5[_0x27ecb8(0x11a)])??mainWindow,{'title':typeof _0x1ae0d2[_0x27ecb8(0xe1)]==='string'?_0x1ae0d2['title']:undefined,'properties':[_0x27ecb8(0x13a)+'ctory']});return{'canceled':_0xe69a8d[_0x27ecb8(0xf4)],'paths':_0xe69a8d[_0x27ecb8(0x121)+'s']};}),_0x11494b(_0x17c6d0(0x16e)+'e:direct'+_0x17c6d0(0xde),()=>_0x581f31()[_0x17c6d0(0x16e)+'e'][_0x17c6d0(0x12f)+_0x17c6d0(0x19b)]()),_0x11494b(_0x17c6d0(0x16e)+'e:open-d'+_0x17c6d0(0x141),async()=>{const _0xc50213=_0x17c6d0,_0x3bff8e=await _0x581f31()[_0xc50213(0x16e)+'e'][_0xc50213(0x12f)+'yInfo']();return await shell[_0xc50213(0x127)](_0x3bff8e[_0xc50213(0x15e)]),{'ok':!![],'path':_0x3bff8e[_0xc50213(0x15e)]};}),_0x11494b(_0x17c6d0(0x16e)+_0x17c6d0(0xef)+_0x17c6d0(0xfb),()=>_0x581f31()[_0x17c6d0(0x16e)+'e'][_0x17c6d0(0x124)+_0x17c6d0(0x12c)]()),_0x11494b(_0x17c6d0(0x16e)+_0x17c6d0(0x125)+_0x17c6d0(0x152)+'ontext',(_0x122858,_0x4b1c51)=>_0x581f31()['workspac'+'e'][_0x17c6d0(0xdb)+'redConte'+'xt'](_0x4b1c51)),_0x11494b('sessions'+_0x17c6d0(0x18d),(_0x555c4d,_0x4552a3)=>_0x581f31()[_0x17c6d0(0x12e)][_0x17c6d0(0x103)](_0x4552a3)),_0x11494b(_0x17c6d0(0x12e)+_0x17c6d0(0x15d)+'keys',()=>_0x581f31()[_0x17c6d0(0x12e)][_0x17c6d0(0x14e)+'ys']()),_0x11494b(_0x17c6d0(0x12e)+':set-pin'+_0x17c6d0(0x17a),(_0x14eff0,_0x3c9a68)=>_0x581f31()[_0x17c6d0(0x12e)]['setPinne'+'dKeys'](_0x3c9a68)),_0x11494b('skills:i'+_0x17c6d0(0x13b),(_0x331a44,_0x51312d)=>_0x581f31()[_0x17c6d0(0x140)][_0x17c6d0(0x170)](_0x51312d)),_0x11494b(_0x17c6d0(0x165)+_0x17c6d0(0x1a2),(_0xfcb24f,_0x4e436d)=>_0x581f31()[_0x17c6d0(0x140)]['update'](_0x4e436d)),_0x11494b(_0x17c6d0(0x198)+_0x17c6d0(0x107),(_0x53adab,_0x16ec64)=>_0x581f31()['skills'][_0x17c6d0(0x166)](_0x16ec64)),_0x11494b(_0x17c6d0(0x17f)+'t',(_0x4e529b,_0x4a4e31)=>_0x581f31()[_0x17c6d0(0x153)][_0x17c6d0(0x1a8)](_0x4a4e31)),_0x11494b('cron:cre'+_0x17c6d0(0x174),(_0x1603e0,_0x418266)=>_0x581f31()[_0x17c6d0(0x153)]['create'](_0x418266)),_0x11494b('cron:upd'+_0x17c6d0(0x174),(_0x42fb53,_0x50dbe0)=>_0x581f31()['cron']['update'](_0x50dbe0)),_0x11494b('cron:rem'+'ove',(_0x4e4a3f,_0x3b3686)=>_0x581f31()[_0x17c6d0(0x153)][_0x17c6d0(0x1a6)](_0x3b3686)),_0x11494b(_0x17c6d0(0x139)+_0x17c6d0(0xea),(_0x3cfd27,_0x29bf2f)=>_0x581f31()[_0x17c6d0(0x153)][_0x17c6d0(0x154)](_0x29bf2f)),_0x11494b(_0x17c6d0(0x16c)+'s',(_0x31df54,_0x45dcfa)=>_0x581f31()[_0x17c6d0(0x153)][_0x17c6d0(0x176)](_0x45dcfa)),_0x11494b('models:s'+_0x17c6d0(0x173),()=>_0x581f31()['models'][_0x17c6d0(0x191)]()),_0x11494b('models:s'+_0x17c6d0(0xdf)+'model-id',()=>_0x581f31()['models']['selected'+'ModelId']()),_0x11494b('models:c'+_0x17c6d0(0x1a0)+_0x17c6d0(0x120),()=>_0x581f31()[_0x17c6d0(0xf8)][_0x17c6d0(0x128)+_0x17c6d0(0x120)]()),_0x11494b(_0x17c6d0(0xec)+_0x17c6d0(0x10d),()=>_0x581f31()[_0x17c6d0(0x19a)][_0x17c6d0(0x17d)]());}async function boot(){const _0x3f9e89=_0x3f1376;shellConfig=await loadShellConfig(resolveProjectRoot()),app[_0x3f9e89(0x17b)](shellConfig[_0x3f9e89(0x18b)+_0x3f9e89(0x151)]),configController=createConfigController(shellConfig),gatewayController=createGatewayController({'shellConfig':shellConfig,'configController':configController,'appVersion':app['getVersi'+'on']()});for(const _0x4ae007 of[_0x3f9e89(0x17e)+_0x3f9e89(0x193),_0x3f9e89(0x17e)+_0x3f9e89(0x114),'chat-str'+'eam-even'+'t',_0x3f9e89(0x181)+_0x3f9e89(0x119),_0x3f9e89(0xf5)+_0x3f9e89(0x199),_0x3f9e89(0x161)+'pdated','ask-user'+_0x3f9e89(0x182)+'n']){gatewayController['on'](_0x4ae007,_0x5153d=>broadcast(_0x4ae007,_0x5153d));}installIpcHandlers(),registerShellShortcuts(),await createWindow(),await gatewayController['start']();}app['on'](_0x3f1376(0xee)+_0x3f1376(0x11b)+'d',()=>{const _0x3b25f6=_0x3f1376;if(process[_0x3b25f6(0x188)]!==_0x3b25f6(0xf6))app[_0x3b25f6(0xfc)]();}),app['on'](_0x3f1376(0xe9),async()=>{const _0x91ac24=_0x3f1376;BrowserWindow['getAllWi'+_0x91ac24(0x146)]()[_0x91ac24(0x132)]===0x0&&shellConfig&&await createWindow();}),app['on'](_0x3f1376(0x150)+_0x3f1376(0x15c),_0xf78535=>{const _0x48257d=_0x3f1376;if(!gatewayController)return;_0xf78535[_0x48257d(0x123)+_0x48257d(0x109)](),void gatewayController[_0x48257d(0x1a5)]()['finally'](()=>{const _0x4c8843=_0x48257d;gatewayController=null,app[_0x4c8843(0xfc)]();});}),app['on'](_0x3f1376(0xf9)+'t',()=>{globalShortcut['unregist'+'er'](DEVTOOLS_ACCELERATOR);}),app[_0x3f1376(0x175)+'y']()[_0x3f1376(0xf1)](boot)[_0x3f1376(0x10e)](_0x5521ea=>{const _0xaf9c24=_0x3f1376;bootError=_0x5521ea instanceof Error?_0x5521ea[_0xaf9c24(0x155)]:String(_0x5521ea),console['error'](_0xaf9c24(0x110)+_0xaf9c24(0xeb)+_0xaf9c24(0x11f)+_0xaf9c24(0x158)+_0xaf9c24(0x194)+'in',_0x5521ea);});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x49c22f=_0x4e74;(function(_0x441661,_0x51c18e){const _0xd1c086=_0x4e74,_0x2268b8=_0x441661();while(!![]){try{const _0x5547e4=-parseInt(_0xd1c086(0x102))/0x1*(-parseInt(_0xd1c086(0x13a))/0x2)+parseInt(_0xd1c086(0x10c))/0x3*(parseInt(_0xd1c086(0x129))/0x4)+parseInt(_0xd1c086(0x14b))/0x5*(-parseInt(_0xd1c086(0x115))/0x6)+parseInt(_0xd1c086(0x103))/0x7+parseInt(_0xd1c086(0x137))/0x8*(-parseInt(_0xd1c086(0xf6))/0x9)+-parseInt(_0xd1c086(0x145))/0xa*(-parseInt(_0xd1c086(0x106))/0xb)+-parseInt(_0xd1c086(0x127))/0xc;if(_0x5547e4===_0x51c18e)break;else _0x2268b8['push'](_0x2268b8['shift']());}catch(_0xb98531){_0x2268b8['push'](_0x2268b8['shift']());}}}(_0x15b0,0xb1f8f));import _0x4dd739 from'electron';function _0x4e74(_0x5ab0f9,_0x5b078a){_0x5ab0f9=_0x5ab0f9-0xf1;const _0x15b0af=_0x15b0();let _0x4e74e9=_0x15b0af[_0x5ab0f9];return _0x4e74e9;}const {contextBridge,ipcRenderer}=_0x4dd739,eventListeners=new Map();function invoke(_0x3cad89,_0x401db1){const _0x419186=_0x4e74;return ipcRenderer[_0x419186(0x13e)](_0x3cad89,_0x401db1);}function _0x15b0(){const _0x54007a=['keys',':pinned-','eam','-status','delete','cron:run','4439PgKkps','7167664YVdmwC','files:se','files:wr','341mdFvjO','function','-context','updated','files:re','ustom-mo','3487149FRDvZO','-url','ask-user','elete','ned-keys','oggle-ma','agents-u','wujieShe','window:o','1076766mhzGFP','skills:s','chat:abo',':runtime',':create','MainWorl','ate','-logs','agents:l','elected-','gateway-','e:write-','e:open-d','openclaw','dels','cron:log','ell:even','-restart','14484096Tzjtng','app:open','4ZNEnWu','shared-c','app:info','cron:rem',':rename','session-','cron:lis','exposeIn','ory-info','cron:upd','tory','models:s','window:m','chat:his','4719768jddyoM','sessions','wujie-sh','154GJnNMW','config:r','off','get','invoke','models:c','ite',':gateway','skills:d','-info','ead','404530Tinuqr','ettings','e:shared','status','devtools','pdated','35rPREJm','ectory','workspac','ad-binar','lect-fil','pen-devt','pdate','ent','payload','chat-str','9zehklj','window:c','lose','ools','ximize','agent-ev'];_0x15b0=function(){return _0x54007a;};return _0x15b0();}function subscribe(_0x1181ea,_0x490252){const _0x11eaa5=_0x4e74;if(typeof _0x490252!==_0x11eaa5(0x107))return()=>{};const _0x3db600=(_0x599bbb,_0x6e55a5)=>{const _0x4e5f1f=_0x11eaa5;if(_0x6e55a5?.['name']===_0x1181ea)_0x490252(_0x6e55a5[_0x4e5f1f(0xf4)]);};return ipcRenderer['on'](_0x11eaa5(0x139)+_0x11eaa5(0x125)+'t',_0x3db600),eventListeners['set'](_0x490252,_0x3db600),()=>{const _0x19a479=_0x11eaa5,_0x410d8c=eventListeners[_0x19a479(0x13d)](_0x490252)||_0x3db600;ipcRenderer[_0x19a479(0x13c)](_0x19a479(0x139)+_0x19a479(0x125)+'t',_0x410d8c),eventListeners[_0x19a479(0x100)](_0x490252);};}contextBridge[_0x49c22f(0x130)+_0x49c22f(0x11a)+'d'](_0x49c22f(0x113)+'ll',{'app':{'info':()=>invoke(_0x49c22f(0x12b)),'openUrl':_0x548c56=>invoke(_0x49c22f(0x128)+_0x49c22f(0x10d),_0x548c56)},'window':{'minimize':()=>invoke(_0x49c22f(0x135)+'inimize'),'toggleMaximize':()=>invoke('window:t'+_0x49c22f(0x111)+_0x49c22f(0xfa)),'close':()=>invoke(_0x49c22f(0xf7)+_0x49c22f(0xf8)),'openDevTools':()=>invoke(_0x49c22f(0x114)+_0x49c22f(0xf1)+_0x49c22f(0xf9)),'onDevToolsShortcut':_0x33d771=>subscribe(_0x49c22f(0x149)+'-shortcu'+'t',_0x33d771)},'files':{'read':_0x8f3d71=>invoke('files:re'+'ad',_0x8f3d71),'readBinary':_0x394d0c=>invoke(_0x49c22f(0x10a)+_0x49c22f(0x14e)+'y',_0x394d0c),'write':(_0x10bddb,_0x53ec18)=>invoke(_0x49c22f(0x105)+_0x49c22f(0x140),{'path':_0x10bddb,'content':_0x53ec18}),'writeBinary':(_0x376c20,_0x2a2ea6)=>invoke(_0x49c22f(0x105)+'ite-bina'+'ry',{'path':_0x376c20,'content':_0x2a2ea6}),'selectFile':_0x1da9cf=>invoke(_0x49c22f(0x104)+_0x49c22f(0x14f)+'e',_0x1da9cf),'selectDirectory':_0x202a4d=>invoke('files:se'+'lect-dir'+_0x49c22f(0x14c),_0x202a4d)},'workspace':{'directoryInfo':()=>invoke('workspac'+'e:direct'+_0x49c22f(0x131)),'openDirectory':()=>invoke('workspac'+_0x49c22f(0x121)+'irectory'),'sharedContext':()=>invoke(_0x49c22f(0x14d)+_0x49c22f(0x147)+_0x49c22f(0x108)),'writeSharedContext':_0x2185e3=>invoke(_0x49c22f(0x14d)+_0x49c22f(0x120)+_0x49c22f(0x12a)+'ontext',_0x2185e3)},'openclaw':{'runtimeInfo':()=>invoke(_0x49c22f(0x122)+_0x49c22f(0x118)+_0x49c22f(0x143)),'gatewayStatus':()=>invoke(_0x49c22f(0x122)+_0x49c22f(0x141)+_0x49c22f(0xff)),'gatewayRestart':()=>invoke(_0x49c22f(0x122)+_0x49c22f(0x141)+_0x49c22f(0x126)),'gatewayLogs':_0x27bbe0=>invoke(_0x49c22f(0x122)+_0x49c22f(0x141)+_0x49c22f(0x11c),_0x27bbe0),'onGatewayStatus':_0x5eadef=>subscribe(_0x49c22f(0x11f)+_0x49c22f(0x148),_0x5eadef),'onGatewayLog':_0x2e7483=>subscribe(_0x49c22f(0x11f)+'log',_0x2e7483),'onAgentEvent':_0x457a8b=>subscribe(_0x49c22f(0xfb)+_0x49c22f(0xf3),_0x457a8b),'onAgentsUpdated':_0x17417a=>subscribe(_0x49c22f(0x112)+_0x49c22f(0x14a),_0x17417a),'onAskUserQuestion':_0x1e862c=>subscribe(_0x49c22f(0x10e)+'-questio'+'n',_0x1e862c),'answerAskUserQuestion':_0x389063=>invoke('openclaw'+':answer-'+_0x49c22f(0x10e)+'-questio'+'n',_0x389063)},'agents':{'list':()=>invoke(_0x49c22f(0x11d)+'ist')},'skills':{'status':_0x36dab3=>invoke(_0x49c22f(0x116)+'tatus',_0x36dab3),'install':_0x4f9c60=>invoke('skills:i'+'nstall',_0x4f9c60),'update':_0x3deaf9=>invoke('skills:u'+_0x49c22f(0xf2),_0x3deaf9),'delete':_0x32ed84=>invoke(_0x49c22f(0x142)+_0x49c22f(0x10f),_0x32ed84)},'sessions':{'create':_0x25caf6=>invoke('sessions'+_0x49c22f(0x119),_0x25caf6),'list':_0x2c4fa0=>invoke(_0x49c22f(0x138)+':list',_0x2c4fa0),'delete':_0x419c6b=>invoke(_0x49c22f(0x138)+':delete',_0x419c6b),'rename':_0x16f214=>invoke('sessions'+_0x49c22f(0x12d),_0x16f214),'pinnedKeys':()=>invoke(_0x49c22f(0x138)+_0x49c22f(0xfd)+_0x49c22f(0xfc)),'setPinnedKeys':_0x3841b7=>invoke(_0x49c22f(0x138)+':set-pin'+_0x49c22f(0x110),_0x3841b7),'onUpdated':_0x1ca478=>subscribe(_0x49c22f(0x12e)+_0x49c22f(0x109),_0x1ca478)},'cron':{'list':_0x24222c=>invoke(_0x49c22f(0x12f)+'t',_0x24222c),'create':_0x4a359d=>invoke('cron:cre'+'ate',_0x4a359d),'update':_0x686c31=>invoke(_0x49c22f(0x132)+_0x49c22f(0x11b),_0x686c31),'remove':_0x2bccc7=>invoke(_0x49c22f(0x12c)+'ove',_0x2bccc7),'runOnce':_0x6ab7b9=>invoke(_0x49c22f(0x101)+'-once',_0x6ab7b9),'logs':_0x12bb41=>invoke(_0x49c22f(0x124)+'s',_0x12bb41)},'models':{'settings':()=>invoke(_0x49c22f(0x134)+_0x49c22f(0x146)),'selectedModelId':()=>invoke(_0x49c22f(0x134)+_0x49c22f(0x11e)+'model-id'),'customModels':()=>invoke(_0x49c22f(0x13f)+_0x49c22f(0x10b)+_0x49c22f(0x123))},'config':{'read':()=>invoke(_0x49c22f(0x13b)+_0x49c22f(0x144))},'chat':{'stream':_0x27926e=>invoke('chat:str'+_0x49c22f(0xfe),_0x27926e),'abort':_0x441759=>invoke(_0x49c22f(0x117)+'rt',_0x441759),'history':_0xdcbf2=>invoke(_0x49c22f(0x136)+_0x49c22f(0x133),_0xdcbf2),'onStreamEvent':_0x49c82c=>subscribe(_0x49c22f(0xf5)+'eam-even'+'t',_0x49c82c)}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x5ba860=_0x2d62;(function(_0x3c0540,_0x593fad){const _0x2daf5e=_0x2d62,_0x5783f6=_0x3c0540();while(!![]){try{const _0x37b39f=parseInt(_0x2daf5e(0x1ee))/0x1+parseInt(_0x2daf5e(0x194))/0x2+parseInt(_0x2daf5e(0x19e))/0x3+parseInt(_0x2daf5e(0x1f4))/0x4*(-parseInt(_0x2daf5e(0x174))/0x5)+parseInt(_0x2daf5e(0x171))/0x6+parseInt(_0x2daf5e(0x190))/0x7+-parseInt(_0x2daf5e(0x1e0))/0x8;if(_0x37b39f===_0x593fad)break;else _0x5783f6['push'](_0x5783f6['shift']());}catch(_0x431e71){_0x5783f6['push'](_0x5783f6['shift']());}}}(_0x1164,0x9c843));import{randomUUID}from'node:crypto';import{createServer}from'node:http';function _0x1164(){const _0x241553=['ensureAs','url','SOUL.md','stdout','client','defaultI','max','2189058TFzTLj','some','lifecycl','750990SgkuUD','/ask-use','.0.0.1:','stringif','key','ting:\x20','ents\x20syn','productN','projectR','127.0.0.','join','resolveC','res','data','nexpecte','openclaw','cron.add','error','USER.md','image/sv','names','stopped','writeHea','skills','sage','limit','getModel','get','7804209gNWViw','ing,\x20ple','label','ask-user','1322932hUkiKf','filePath','kUserQue','discover','deny','figChang','gateway','ion/octe','ndled\x20ag','terminal','89451NtIlyp','starting','IDENTITY','size','pop','onfigPat','renamed','has','workspac','keys','ensureGa','ssionKey','TOOLS.md','stop','skills.s','version','--allow-','nstall','skills.i','killed','desktop','toISOStr','chat.abo','not\x20foun','method','text/mar','requestI','floor','reconnec','resolve','agent-ev','source','r-questi','run','image/gi','n\x20callba','behavior','kill','system','plugins','kdown','status','image/we','ath','.json','entries','patch','ion/json','ase\x20retr','gateway-','image/','json','Timer','type','provider','t-stream','agents-r','tatus','itialCon','ted','ured','exited\x20u','main','aborted','igWriteH','sessionK','12430552WGblzk','catch','name','content','applicat','ternally','utf8','pluginId','T.md','close','reate','clear','isArray','ove','324293jOyesk','deleted','watchCon','http://1','--token','unknown','8BFwnpk','image/jp','toUpperC','session-','set','finally','text/pla','is\x20start','allow','ized','\x20for\x20WS','ayRestar','cron.rem','invalid\x20','then','is\x20requi','.md','eady','Settings','exited\x20c','answers','filter','textLeng','quired','slice','chat\x20fai','running','unauthor','ase','map','stderr','runtimeR','image/pn','led','pdate','state','readConf','agents.l','request','agentId','model','manual\x20r','Bin','markConf','ensureIn','once','end','fig','.list','off','errorMes','ate','jobId','unconfig','cron.lis','ync\x20fail','chat.his','sessions','runId','n\x20reques','final','emit','metadata','startsWi','eviceIde','configur','-questio',']\x20[','ck\x20disab','SIGKILL','now','x-ask-us','t\x20not\x20fo','nt\x20too\x20l','dly','eway]\x20bu','image','timeout','text/csv','ame','parse','tewaySet','WorkingD','string','tateDir','g+xml','listen','token','jobId\x20is','connecte','\x20require','random','done','anscript','isFile','delta','.create','Version','message','agents.u','pinnedKe','agents\x20s','led:\x20','c\x20failed','text','oot','cron.run','headers','toString','started','gateway\x20','chat.sen','[wujie-s','sessionI','ginConfi','message\x20','und','MEMORY.m','push','start','Fallback','red','27.0.0.1','bundled-','ey\x20is\x20re','HEARTBEA','\x20waiting','backend','started,','agents','task','andledIn','length','delete','restarti',':session','ntityPat','POST','values','hell:gat','tHandler','y\x20shortl','skills.u','updated','eys-upda','ion/pdf','resolveS','AGENTS.m','installP','log','stack','modelNam','null','title'];_0x1164=function(){return _0x241553;};return _0x1164();}import{EventEmitter}from'node:events';function _0x2d62(_0x379a06,_0x2cfe5d){_0x379a06=_0x379a06-0x101;const _0x1164e4=_0x1164();let _0x2d625f=_0x1164e4[_0x379a06];return _0x2d625f;}import{appendFile,mkdir,readFile,stat,writeFile}from'node:fs/promises';import{basename,dirname,join}from'node:path';import _0x18ea3d,{portNumbers}from'get-port';import{asRecord,getTrimmedString}from'./utils.mjs';import{loadRuntimeInfo,spawnClaw}from'./runtime.mjs';import{ClawGatewayWsClient}from'./gateway-ws.mjs';import{ensureBundledAgents}from'./bundled-agents.mjs';import{syncBundledAgentSkillsToConfig,filterSkillsForAgent}from'./bundled-agent-skills.mjs';const LOG_LIMIT=0x3e8,CLIENT_ID=_0x5ba860(0x1cf)+_0x5ba860(0x16e),CLIENT_MODE=_0x5ba860(0x14f),CLIENT_DEVICE_FAMILY=_0x5ba860(0x1b2),TERMINAL_STREAM_FALLBACK_DELAY_MS=0x4b0,ATTACHMENT_MAX_BYTES=0x19*0x400*0x400,SESSION_METADATA_FILE=_0x5ba860(0x1f7)+_0x5ba860(0x10e)+_0x5ba860(0x1ca),SHARED_CONTEXT_FILES=[_0x5ba860(0x163)+'d',_0x5ba860(0x14d)+_0x5ba860(0x1e8),_0x5ba860(0x1a0)+_0x5ba860(0x204),_0x5ba860(0x145)+'d',_0x5ba860(0x16c),_0x5ba860(0x1aa),_0x5ba860(0x186)];function nowIso(){const _0x3199e4=_0x5ba860;return new Date()[_0x3199e4(0x1b3)+'ing']();}function buildGatewayWsUrl(_0x4dd7a6){const _0x5e63c0=_0x5ba860;return'ws://127'+_0x5e63c0(0x176)+_0x4dd7a6;}function createInitialStatus(){const _0xa006b0=_0x5ba860;return{'lifecycle':_0xa006b0(0x189),'health':_0xa006b0(0x1f3),'port':null,'tokenPresent':![],'message':_0xa006b0(0x13e)+_0xa006b0(0x189),'updatedAt':nowIso()};}function extractGatewayMessageText(_0x47ca6a){const _0x57f192=_0x5ba860;if(typeof _0x47ca6a===_0x57f192(0x123))return _0x47ca6a;if(!Array[_0x57f192(0x1ec)](_0x47ca6a))return'';const _0x163324=[];for(const _0x221c3a of _0x47ca6a){if(typeof _0x221c3a===_0x57f192(0x123)){if(_0x221c3a)_0x163324['push'](_0x221c3a);continue;}const _0x2eebfd=asRecord(_0x221c3a);_0x2eebfd[_0x57f192(0x1d3)]==='text'&&typeof _0x2eebfd[_0x57f192(0x138)]===_0x57f192(0x123)&&_0x2eebfd[_0x57f192(0x138)]&&_0x163324[_0x57f192(0x146)](_0x2eebfd['text']);}return _0x163324[_0x57f192(0x17e)]('\x0a');}function extractGatewayChatText(_0x14a1a2){const _0x4cc59c=_0x5ba860,_0x5ebc97=asRecord(_0x14a1a2);if(typeof _0x5ebc97[_0x4cc59c(0x138)]===_0x4cc59c(0x123))return _0x5ebc97['text'];return extractGatewayMessageText(_0x5ebc97[_0x4cc59c(0x1e3)]);}function guessMimeType(_0x34275b){const _0xb576d8=_0x5ba860,_0x593c3f=_0x34275b['split']('.')[_0xb576d8(0x1a2)]()?.['toLowerC'+_0xb576d8(0x210)]()??'',_0x5dc904={'png':_0xb576d8(0x214)+'g','jpg':_0xb576d8(0x1f5)+'eg','jpeg':'image/jp'+'eg','webp':_0xb576d8(0x1c8)+'bp','gif':_0xb576d8(0x1c0)+'f','svg':_0xb576d8(0x187)+_0xb576d8(0x125),'pdf':_0xb576d8(0x1e4)+_0xb576d8(0x161),'txt':_0xb576d8(0x1fa)+'in','md':_0xb576d8(0x1b7)+_0xb576d8(0x1c6),'json':_0xb576d8(0x1e4)+_0xb576d8(0x1cd),'csv':_0xb576d8(0x11e)};return _0x5dc904[_0x593c3f]||_0xb576d8(0x1e4)+_0xb576d8(0x19b)+_0xb576d8(0x1d5);}async function buildAttachments(_0x45a42a=[]){const _0x471a80=_0x5ba860,_0x4c4a08=[];for(const _0x1135fc of _0x45a42a){const _0x3e49c6=getTrimmedString(_0x1135fc);if(!_0x3e49c6)continue;const _0x37ec9b=await stat(_0x3e49c6);if(!_0x37ec9b[_0x471a80(0x12e)]())continue;if(_0x37ec9b[_0x471a80(0x1a1)]>ATTACHMENT_MAX_BYTES)throw new Error('attachme'+_0x471a80(0x119)+'arge:\x20'+basename(_0x3e49c6));const _0x563e3f=guessMimeType(_0x3e49c6);_0x4c4a08[_0x471a80(0x146)]({'type':_0x563e3f[_0x471a80(0x10f)+'th'](_0x471a80(0x1d0))?_0x471a80(0x11c):'file','mimeType':_0x563e3f,'content':(await readFile(_0x3e49c6))[_0x471a80(0x13c)]('base64'),'fileName':basename(_0x3e49c6)});}return _0x4c4a08;}function buildSessionCreateRequestPayload(_0x3c1e22={}){const _0x57b6fe=_0x5ba860,_0x219102={},_0x22f1b8=Math[_0x57b6fe(0x12b)]()[_0x57b6fe(0x13c)](0x24)[_0x57b6fe(0x20c)](0x2,0xf),_0x28ff6c=getTrimmedString(_0x3c1e22[_0x57b6fe(0x21b)])||_0x57b6fe(0x1dc),_0x347dde=getTrimmedString(_0x3c1e22[_0x57b6fe(0x178)])||'agent:'+_0x28ff6c+(_0x57b6fe(0x157)+'-')+Date[_0x57b6fe(0x116)]();_0x219102['key']=_0x347dde+'-'+_0x22f1b8,_0x219102['agentId']=_0x28ff6c;const _0x2939f8=getTrimmedString(_0x3c1e22[_0x57b6fe(0x192)]);if(_0x2939f8)_0x219102[_0x57b6fe(0x192)]=_0x2939f8+'-'+_0x22f1b8;for(const _0x147728 of[_0x57b6fe(0x21c),'parentSe'+_0x57b6fe(0x1a9),_0x57b6fe(0x152),_0x57b6fe(0x132)]){const _0x3385a8=getTrimmedString(_0x3c1e22[_0x147728]);if(_0x3385a8)_0x219102[_0x147728]=_0x3385a8;}return _0x219102;}function parseSessionCreateResult(_0xd52921){const _0x509d3a=_0x5ba860,_0x5a2fd5=asRecord(_0xd52921),_0xfde3c7=asRecord(_0x5a2fd5['session']);return{'ok':!![],'key':getTrimmedString(_0x5a2fd5[_0x509d3a(0x178)])||getTrimmedString(_0x5a2fd5[_0x509d3a(0x1df)+'ey'])||getTrimmedString(_0xfde3c7[_0x509d3a(0x178)])||null,'sessionId':getTrimmedString(_0x5a2fd5[_0x509d3a(0x141)+'d'])||getTrimmedString(_0xfde3c7[_0x509d3a(0x141)+'d'])||null};}function getSessionKeyFromValue(_0x229baf){const _0x51b900=_0x5ba860,_0x39af18=asRecord(_0x229baf);return getTrimmedString(_0x39af18[_0x51b900(0x1df)+'ey']??_0x39af18[_0x51b900(0x178)]??_0x39af18['id']);}function createEmptySessionMetadata(){return{'names':{},'pinnedKeys':[]};}async function readSessionMetadata(_0x21ab92){const _0x5b2103=_0x5ba860;try{const _0x4e01fc=JSON[_0x5b2103(0x120)](await readFile(join(_0x21ab92,SESSION_METADATA_FILE),_0x5b2103(0x1e6))),_0xfd050e=asRecord(_0x4e01fc);return{'names':asRecord(_0xfd050e[_0x5b2103(0x188)]),'pinnedKeys':Array[_0x5b2103(0x1ec)](_0xfd050e['pinnedKe'+'ys'])?_0xfd050e[_0x5b2103(0x134)+'ys'][_0x5b2103(0x209)](_0x55f591=>typeof _0x55f591===_0x5b2103(0x123)&&_0x55f591['trim']()):[]};}catch{return createEmptySessionMetadata();}}async function writeSessionMetadata(_0x573301,_0x57e832){const _0x30114c=_0x5ba860;await mkdir(_0x573301,{'recursive':!![]}),await writeFile(join(_0x573301,SESSION_METADATA_FILE),JSON['stringif'+'y'](_0x57e832,null,0x2)+'\x0a',_0x30114c(0x1e6));}function applySessionMetadata(_0x2fb347,_0x5c8dfb){const _0x2fc28c=_0x5ba860,_0x3b0788=asRecord(_0x2fb347),_0x5835e2=Array[_0x2fc28c(0x1ec)](_0x3b0788['sessions'])?_0x3b0788['sessions']:[];return{..._0x3b0788,'pinnedKeys':_0x5c8dfb[_0x2fc28c(0x134)+'ys'],'sessions':_0x5835e2[_0x2fc28c(0x211)](_0x3a41fc=>{const _0x3363fd=_0x2fc28c,_0x30fcc6=asRecord(_0x3a41fc),_0x46067c=getSessionKeyFromValue(_0x30fcc6);if(!_0x46067c)return _0x3a41fc;const _0x219bfd=getTrimmedString(_0x5c8dfb[_0x3363fd(0x188)][_0x46067c]),_0x192645=_0x5c8dfb[_0x3363fd(0x134)+'ys']['includes'](_0x46067c);return{..._0x30fcc6,..._0x219bfd?{'name':_0x219bfd,'displayName':_0x219bfd,'label':_0x219bfd}:{},'pinned':_0x192645};})};}function sanitizeSharedContextPayload(_0x2d0a18){const _0x1bffcf=asRecord(_0x2d0a18),_0x19eb7d={};for(const _0x486ffb of SHARED_CONTEXT_FILES){if(typeof _0x1bffcf[_0x486ffb]==='string')_0x19eb7d[_0x486ffb]=_0x1bffcf[_0x486ffb];}return _0x19eb7d;}async function readSharedContext(_0x5cb1b0){const _0x340965=_0x5ba860,_0x2dbc69={};for(const _0x366a07 of SHARED_CONTEXT_FILES){try{_0x2dbc69[_0x366a07]=await readFile(join(_0x5cb1b0,_0x366a07),_0x340965(0x1e6));}catch{_0x2dbc69[_0x366a07]='';}}return _0x2dbc69;}async function writeSharedContext(_0x172b75,_0x9d867a){const _0x1bee0f=_0x5ba860,_0x216ea9=sanitizeSharedContextPayload(_0x9d867a);await mkdir(_0x172b75,{'recursive':!![]});for(const [_0x674420,_0x1317f2]of Object[_0x1bee0f(0x1cb)](_0x216ea9)){await writeFile(join(_0x172b75,_0x674420),_0x1317f2,_0x1bee0f(0x1e6));}return{'ok':!![],'files':Object[_0x1bee0f(0x1a7)](_0x216ea9)};}function createAskUserQuestionServer({configController:_0x5f348e,emit:_0x18e7c1}){const _0x20fc7e=new Map();let _0x91fefb=null,_0x50bc6e='',_0x1bb040='';async function _0x186699(){const _0x4636b9=_0x2d62;if(_0x91fefb)return{'callbackUrl':_0x50bc6e,'secret':_0x1bb040};_0x1bb040=randomUUID();const _0x1d4d08=await _0x18ea3d({'port':portNumbers(0x332c,0x338f)});return _0x50bc6e=_0x4636b9(0x1f1)+_0x4636b9(0x14a)+':'+_0x1d4d08+(_0x4636b9(0x175)+_0x4636b9(0x1be)+'on'),_0x91fefb=createServer(async(_0x119d39,_0x21c996)=>{const _0x1e3780=_0x4636b9;if(_0x119d39[_0x1e3780(0x1b6)]!==_0x1e3780(0x159)||_0x119d39[_0x1e3780(0x16b)]!=='/ask-use'+_0x1e3780(0x1be)+'on'){_0x21c996[_0x1e3780(0x18a)+'d'](0x194),_0x21c996[_0x1e3780(0x222)](_0x1e3780(0x1b5)+'d');return;}if(_0x119d39[_0x1e3780(0x13b)][_0x1e3780(0x117)+'er-secre'+'t']!==_0x1bb040){_0x21c996['writeHea'+'d'](0x191),_0x21c996[_0x1e3780(0x222)](_0x1e3780(0x20f)+_0x1e3780(0x1fd));return;}let _0x576ecb='';_0x119d39['on']('data',_0x359575=>{const _0x1cae2c=_0x1e3780;_0x576ecb+=_0x359575['toString']();if(_0x576ecb[_0x1cae2c(0x154)]>0x400*0x400)_0x119d39['destroy']();}),_0x119d39['on'](_0x1e3780(0x222),()=>{const _0x2d1a5b=_0x1e3780;let _0x3c4870={};try{_0x3c4870=JSON[_0x2d1a5b(0x120)](_0x576ecb||'{}');}catch{_0x21c996[_0x2d1a5b(0x18a)+'d'](0x190),_0x21c996[_0x2d1a5b(0x222)](_0x2d1a5b(0x201)+_0x2d1a5b(0x1d1));return;}const _0x250a1f=randomUUID(),_0x54fb17=setTimeout(()=>{const _0x27e6a9=_0x2d1a5b;if(!_0x20fc7e[_0x27e6a9(0x1a5)](_0x250a1f))return;_0x20fc7e['delete'](_0x250a1f),_0x21c996[_0x27e6a9(0x18a)+'d'](0xc8,{'content-type':'applicat'+'ion/json'}),_0x21c996['end'](JSON[_0x27e6a9(0x177)+'y']({'behavior':_0x27e6a9(0x198)}));},0x1d4c0);_0x20fc7e[_0x2d1a5b(0x1f8)](_0x250a1f,{'res':_0x21c996,'timeout':_0x54fb17}),_0x18e7c1(_0x2d1a5b(0x193)+_0x2d1a5b(0x112)+'n',{'requestId':_0x250a1f,...asRecord(_0x3c4870)});});}),await new Promise((_0x3a88a9,_0x2dee4b)=>{const _0x48abbc=_0x4636b9;_0x91fefb[_0x48abbc(0x221)](_0x48abbc(0x185),_0x2dee4b),_0x91fefb[_0x48abbc(0x126)](_0x1d4d08,_0x48abbc(0x17d)+'1',()=>{const _0x1d5d01=_0x48abbc;_0x91fefb[_0x1d5d01(0x101)]('error',_0x2dee4b),_0x3a88a9();});}),await _0x5f348e[_0x4636b9(0x16a)+_0x4636b9(0x196)+'stionPlu'+_0x4636b9(0x142)+'g']({'callbackUrl':_0x50bc6e,'secret':_0x1bb040}),{'callbackUrl':_0x50bc6e,'secret':_0x1bb040};}function _0x543fa8(_0x349a4c={}){const _0xc0eb7d=_0x2d62,_0x309acb=getTrimmedString(_0x349a4c[_0xc0eb7d(0x1b8)+'d']);if(!_0x309acb||!_0x20fc7e[_0xc0eb7d(0x1a5)](_0x309acb))throw new Error(_0xc0eb7d(0x193)+_0xc0eb7d(0x112)+_0xc0eb7d(0x10b)+_0xc0eb7d(0x118)+_0xc0eb7d(0x144));const _0x3440b2=_0x20fc7e[_0xc0eb7d(0x18f)](_0x309acb);return _0x20fc7e[_0xc0eb7d(0x155)](_0x309acb),clearTimeout(_0x3440b2[_0xc0eb7d(0x11d)]),_0x3440b2[_0xc0eb7d(0x180)][_0xc0eb7d(0x18a)+'d'](0xc8,{'content-type':'applicat'+_0xc0eb7d(0x1cd)}),_0x3440b2[_0xc0eb7d(0x180)]['end'](JSON[_0xc0eb7d(0x177)+'y']({'behavior':_0x349a4c[_0xc0eb7d(0x1c2)]===_0xc0eb7d(0x198)?_0xc0eb7d(0x198):_0xc0eb7d(0x1fc),'answers':asRecord(_0x349a4c[_0xc0eb7d(0x208)])})),{'ok':!![]};}async function _0x2e2282(){const _0xce5570=_0x2d62;for(const [_0xae2189,_0x1e2981]of _0x20fc7e){_0x20fc7e[_0xce5570(0x155)](_0xae2189),clearTimeout(_0x1e2981[_0xce5570(0x11d)]),_0x1e2981['res'][_0xce5570(0x18a)+'d'](0xc8,{'content-type':_0xce5570(0x1e4)+_0xce5570(0x1cd)}),_0x1e2981[_0xce5570(0x180)][_0xce5570(0x222)](JSON[_0xce5570(0x177)+'y']({'behavior':_0xce5570(0x198)}));}if(!_0x91fefb)return;await new Promise(_0x50ffa4=>_0x91fefb[_0xce5570(0x1e9)](_0x50ffa4)),_0x91fefb=null;}return{'start':_0x186699,'answer':_0x543fa8,'stop':_0x2e2282};}export function createGatewayController({shellConfig:_0x5123a1,configController:_0x3399f9,appVersion:appVersion='0.1.0'}){const _0x5d64ba=_0x5ba860,_0x1c6546=new EventEmitter(),_0x34a895=new ClawGatewayWsClient(),_0xc4e389=[],_0xd2c148=new Map(),_0x100f37=new Map(),_0x470763=createAskUserQuestionServer({'configController':_0x3399f9,'emit':(_0x28cf8c,_0x4745e9)=>_0x1c6546[_0x5d64ba(0x10d)](_0x28cf8c,_0x4745e9)});let _0x5822b9=createInitialStatus(),_0x28b97c=null,_0x29e12b=null,_0x2f574c=null,_0x32f7ac=![],_0x55d44e=![],_0x2afbc3=Promise[_0x5d64ba(0x1bb)](),_0x4fd411=null;const _0xc8bb84=join(_0x3399f9['paths']['logsDir'],'gateway.'+_0x5d64ba(0x165));function _0x18f61c(_0x13aa29,_0x115f9a){const _0x49954a=_0x5d64ba;_0x1c6546[_0x49954a(0x10d)](_0x13aa29,_0x115f9a);}function _0x1e4896(_0x3b1838,_0x5eefae){const _0x20c5ce=_0x5d64ba;return _0x1c6546['on'](_0x3b1838,_0x5eefae),()=>_0x1c6546[_0x20c5ce(0x101)](_0x3b1838,_0x5eefae);}function _0x192453(_0xe574d0){const _0x4aa478=_0x5d64ba;_0x5822b9={..._0x5822b9,..._0xe574d0,'updatedAt':nowIso()},_0x18f61c('gateway-'+_0x4aa478(0x1c7),_0x5822b9);}function _0x5c8929(_0x551d12,_0x26d3c6,_0x486d5c={}){const _0x4bdd26=_0x5d64ba;_0x192453({'lifecycle':_0x551d12,'message':_0x26d3c6,..._0x486d5c}),_0x4f3f28(_0x4bdd26(0x1c4),_0x551d12[_0x4bdd26(0x1f6)+'ase']()+'\x20'+_0x26d3c6);}function _0x4f3f28(_0x3771d1,_0x4eb51d){const _0x5dc1dd=_0x5d64ba,_0x2a07d4={'source':_0x3771d1,'text':_0x4eb51d,'timestamp':nowIso()};_0xc4e389[_0x5dc1dd(0x146)](_0x2a07d4);if(_0xc4e389[_0x5dc1dd(0x154)]>LOG_LIMIT)_0xc4e389['splice'](0x0,_0xc4e389[_0x5dc1dd(0x154)]-LOG_LIMIT);_0x18f61c(_0x5dc1dd(0x1cf)+_0x5dc1dd(0x165),_0x2a07d4),void mkdir(dirname(_0xc8bb84),{'recursive':!![]})[_0x5dc1dd(0x202)](()=>appendFile(_0xc8bb84,'['+_0x2a07d4['timestam'+'p']+_0x5dc1dd(0x113)+_0x3771d1+']\x20'+_0x4eb51d,_0x5dc1dd(0x1e6)))[_0x5dc1dd(0x1e1)](()=>{});}function _0x459670(_0x4a19b3=0xc8){const _0x3db137=_0x5d64ba;return _0xc4e389[_0x3db137(0x20c)](-Math[_0x3db137(0x170)](0x1,Math['floor'](_0x4a19b3)));}function _0x163df8(){const _0x11874e=_0x5d64ba;if(!_0x28b97c||_0x5822b9[_0x11874e(0x173)+'e']!==_0x11874e(0x20e))throw new Error(_0x11874e(0x13e)+_0x11874e(0x1fb)+_0x11874e(0x191)+_0x11874e(0x1ce)+_0x11874e(0x15d)+'y');}function _0x24b851(){const _0x195739=_0x5d64ba;return Boolean(_0x28b97c&&_0x5822b9[_0x195739(0x173)+'e']===_0x195739(0x20e));}function _0xb42f5d(_0x5eac8c){_0x18f61c('chat-str'+'eam-even'+'t',_0x5eac8c);}function _0x3a4e8f(_0x3277ca){const _0x23820d=_0x5d64ba,_0x46c4ab=_0xd2c148[_0x23820d(0x18f)](_0x3277ca);if(!_0x46c4ab)return null;_0xd2c148[_0x23820d(0x155)](_0x3277ca);if(_0x46c4ab[_0x23820d(0x19d)+_0x23820d(0x148)+'Timer'])clearTimeout(_0x46c4ab[_0x23820d(0x19d)+_0x23820d(0x148)+_0x23820d(0x1d2)]);return _0x100f37[_0x23820d(0x155)](_0x46c4ab[_0x23820d(0x1df)+'ey']),_0x46c4ab;}function _0x4433ce(_0x438941,_0x3a703c,_0x30316a=''){const _0x2e9aec=_0x5d64ba,_0x385dfb=_0x3a4e8f(_0x438941['runId']);if(!_0x385dfb)return;_0xb42f5d({'requestId':_0x385dfb[_0x2e9aec(0x1b8)+'d'],'sessionKey':_0x385dfb[_0x2e9aec(0x1df)+'ey'],'type':_0x3a703c,..._0x30316a?{'message':_0x30316a}:{}});}function _0x4915e6(_0x500233){const _0x576b57=_0x5d64ba;let _0x162667=null;for(const _0x219040 of _0xd2c148[_0x576b57(0x15a)]()){if(_0x219040[_0x576b57(0x1df)+'ey']===_0x500233)_0x162667=_0x219040;}return _0x162667;}function _0x591423(_0x54ef37){if(!_0x54ef37)return null;for(const _0x272da1 of _0xd2c148['values']()){if(_0x272da1['requestI'+'d']===_0x54ef37)return _0x272da1;}return null;}function _0x3ea4de(_0x4d8945,_0x2ffd8b){const _0x5af50d=_0x5d64ba;if(_0x2ffd8b[_0x5af50d(0x154)]<=_0x4d8945[_0x5af50d(0x20a)+'th'])return;const _0x37f28e=_0x2ffd8b[_0x5af50d(0x20c)](_0x4d8945[_0x5af50d(0x20a)+'th']);_0x4d8945[_0x5af50d(0x20a)+'th']=_0x2ffd8b['length'],_0x37f28e&&_0xb42f5d({'requestId':_0x4d8945['requestI'+'d'],'sessionKey':_0x4d8945[_0x5af50d(0x1df)+'ey'],'type':_0x5af50d(0x12f),'delta':_0x37f28e});}function _0x2ee08e(_0x5dd84f,_0x523428,_0x522996=''){const _0x173957=_0x5d64ba;if(_0x5dd84f[_0x173957(0x19d)+'Fallback'+'Timer'])clearTimeout(_0x5dd84f[_0x173957(0x19d)+_0x173957(0x148)+_0x173957(0x1d2)]);_0x5dd84f[_0x173957(0x19d)+_0x173957(0x148)+_0x173957(0x1d2)]=setTimeout(()=>{const _0x56e5c7=_0x173957,_0x45a96f=_0xd2c148[_0x56e5c7(0x18f)](_0x5dd84f[_0x56e5c7(0x10a)]);if(!_0x45a96f)return;_0x4433ce(_0x45a96f,_0x523428===_0x56e5c7(0x185)?_0x56e5c7(0x185):_0x56e5c7(0x12c),_0x522996);},TERMINAL_STREAM_FALLBACK_DELAY_MS);}function _0x21c770(_0x3693a4){const _0x600a78=_0x5d64ba;for(const _0x15fa78 of _0xd2c148[_0x600a78(0x15a)]()){_0xb42f5d({'requestId':_0x15fa78[_0x600a78(0x1b8)+'d'],'sessionKey':_0x15fa78[_0x600a78(0x1df)+'ey'],'type':_0x600a78(0x185),'message':_0x3693a4});if(_0x15fa78[_0x600a78(0x19d)+'Fallback'+_0x600a78(0x1d2)])clearTimeout(_0x15fa78['terminal'+_0x600a78(0x148)+_0x600a78(0x1d2)]);}_0xd2c148[_0x600a78(0x1eb)](),_0x100f37[_0x600a78(0x1eb)]();}function _0x18d974(_0x2ee2c4){const _0xc57786=_0x5d64ba,_0x33022b=getTrimmedString(_0x2ee2c4[_0xc57786(0x10a)]),_0xeb4d36=getTrimmedString(_0x2ee2c4[_0xc57786(0x217)])||_0xc57786(0x15f),_0x3f0309=getTrimmedString(_0x2ee2c4[_0xc57786(0x1df)+'ey']),_0x412de1=(_0x33022b?_0xd2c148[_0xc57786(0x18f)](_0x33022b):null)??(_0x3f0309?_0x4915e6(_0x3f0309):null);if(_0x33022b&&_0x3f0309)_0x100f37[_0xc57786(0x1f8)](_0x3f0309,_0x33022b);if(_0x3f0309)_0x18f61c('session-'+'updated',{'sessionKey':_0x3f0309,'state':_0xeb4d36});_0x412de1&&(_0xeb4d36===_0xc57786(0x10c)||_0xeb4d36===_0xc57786(0x1dd)||_0xeb4d36===_0xc57786(0x185))&&_0x2ee08e(_0x412de1,_0xeb4d36,typeof _0x2ee2c4['errorMes'+_0xc57786(0x18c)]===_0xc57786(0x123)?_0x2ee2c4[_0xc57786(0x102)+'sage']:_0xc57786(0x13e)+_0xc57786(0x20d)+_0xc57786(0x215));if(!_0x412de1)return;if(_0x3f0309&&_0x3f0309!==_0x412de1[_0xc57786(0x1df)+'ey'])return;if(_0xeb4d36===_0xc57786(0x12f)){_0x3ea4de(_0x412de1,extractGatewayChatText(_0x2ee2c4[_0xc57786(0x132)]));return;}if(_0xeb4d36===_0xc57786(0x10c)||_0xeb4d36==='aborted'){_0x3ea4de(_0x412de1,extractGatewayChatText(_0x2ee2c4[_0xc57786(0x132)])),_0x4433ce(_0x412de1,_0xc57786(0x12c));return;}_0xeb4d36==='error'&&_0x4433ce(_0x412de1,_0xc57786(0x185),typeof _0x2ee2c4[_0xc57786(0x102)+'sage']===_0xc57786(0x123)?_0x2ee2c4[_0xc57786(0x102)+_0xc57786(0x18c)]:_0xc57786(0x13e)+_0xc57786(0x20d)+_0xc57786(0x215));}async function _0x518ba6(_0x15a135,_0x516064){const _0xa0feb9=_0x5d64ba;_0x34a895[_0xa0feb9(0x111)+'e']({'url':buildGatewayWsUrl(_0x516064),'token':_0x15a135,'clientId':CLIENT_ID,'clientMode':CLIENT_MODE,'clientVersion':appVersion,'clientDisplayName':_0x5123a1[_0xa0feb9(0x17b)+_0xa0feb9(0x11f)],'clientDeviceFamily':CLIENT_DEVICE_FAMILY,'identityPath':_0x3399f9['resolveD'+_0xa0feb9(0x110)+_0xa0feb9(0x158)+'h'](),'onChatEvent':_0x18d974,'onAgentEvent':_0x46e800=>_0x18f61c(_0xa0feb9(0x1bc)+'ent',_0x46e800),'onConnected':async()=>{const _0xa5dca1=_0xa0feb9;if(!_0x28b97c||!_0x2f574c||!_0x29e12b)return;_0x5c8929('running',_0xa5dca1(0x13e)+_0xa5dca1(0x129)+'d',{'health':'healthy','port':_0x2f574c,'tokenPresent':!![]});try{await ensureBundledAgents({'runtimeBundledAgentsDir':join((await loadRuntimeInfo(_0x5123a1[_0xa5dca1(0x17c)+_0xa5dca1(0x139)]))[_0xa5dca1(0x213)+_0xa5dca1(0x139)],_0xa5dca1(0x183),_0xa5dca1(0x151)),'stateDir':_0x3399f9[_0xa5dca1(0x162)+_0xa5dca1(0x124)](),'listAgents':_0x266db2,'createAgent':_0x575809=>_0x34a895[_0xa5dca1(0x21a)]('agents.c'+_0xa5dca1(0x1ea),_0x575809),'updateAgent':_0x414074=>_0x34a895['request'](_0xa5dca1(0x133)+_0xa5dca1(0x216),_0x414074),'syncSkills':async({agentIds:_0x31af19,mainWorkspace:_0x1756a1})=>{const _0x2b584a=_0xa5dca1,_0xf15bd0=dirname(_0x1756a1),_0x5d3efe=await syncBundledAgentSkillsToConfig({'agentIds':_0x31af19,'resolveSkillsDir':_0x2277a0=>_0x2277a0===_0x2b584a(0x1dc)?join(_0x1756a1,_0x2b584a(0x18b)):join(_0xf15bd0,_0x2b584a(0x1a6)+'e-'+_0x2277a0,_0x2b584a(0x18b)),'readConfig':()=>_0x3399f9[_0x2b584a(0x218)+'ig'](),'writeConfig':_0x1d1cdd=>_0x3399f9['writeCon'+_0x2b584a(0x223)](_0x1d1cdd),'markConfigWriteHandledInternally':()=>_0x3399f9[_0x2b584a(0x21f)+_0x2b584a(0x1de)+_0x2b584a(0x153)+_0x2b584a(0x1e5)]()});_0x4fd411=_0x5d3efe[_0x2b584a(0x197)+'y'];}}),_0x18f61c('agents-u'+'pdated',{'reason':_0xa5dca1(0x14b)+_0xa5dca1(0x1d6)+_0xa5dca1(0x205)});}catch(_0x13686a){const _0x214a04=_0x13686a instanceof Error?_0x13686a[_0xa5dca1(0x166)]||_0x13686a[_0xa5dca1(0x132)]:String(_0x13686a);_0x4f3f28(_0xa5dca1(0x1c4),'bundled\x20'+_0xa5dca1(0x135)+_0xa5dca1(0x107)+'ed:\x20'+_0x214a04),console[_0xa5dca1(0x185)](_0xa5dca1(0x140)+_0xa5dca1(0x15b)+_0xa5dca1(0x11b)+_0xa5dca1(0x19c)+_0xa5dca1(0x17a)+_0xa5dca1(0x137),_0x13686a);}},'onDisconnected':_0x940349=>{const _0x6c7cca=_0xa0feb9;_0x21c770(_0x940349);if(_0x55d44e||!_0x28b97c)return;_0x192453({'health':_0x6c7cca(0x1f3),'message':'gateway\x20'+_0x6c7cca(0x1ba)+_0x6c7cca(0x179)+_0x940349});}});}async function _0x38dd09(_0x57339e,_0x4d0c9a){const _0x3da3f9=_0x5d64ba;if(_0x28b97c)return;_0x5c8929(_0x3da3f9(0x19f),_0x3da3f9(0x13e)+_0x3da3f9(0x19f),{'health':_0x3da3f9(0x1f3),'port':_0x4d0c9a,'tokenPresent':!![]});const _0x47e8d8=[_0x3da3f9(0x19a),_0x3da3f9(0x1bf),_0x3da3f9(0x1ae)+_0x3da3f9(0x105)+_0x3da3f9(0x1da),_0x3da3f9(0x1f2),_0x57339e,'--port',String(_0x4d0c9a)];_0x4f3f28(_0x3da3f9(0x1c4),'openclaw'+'\x20'+_0x47e8d8['join']('\x20')),_0x28b97c=await spawnClaw(_0x5123a1['projectR'+_0x3da3f9(0x139)],_0x47e8d8,{'env':{'OPENCLAW_STATE_DIR':_0x3399f9[_0x3da3f9(0x162)+_0x3da3f9(0x124)](),'OPENCLAW_CONFIG_PATH':_0x3399f9[_0x3da3f9(0x17f)+_0x3da3f9(0x1a3)+'h']()}}),_0x29e12b=_0x57339e,_0x2f574c=_0x4d0c9a,_0x192453({'health':'unknown','port':_0x2f574c,'tokenPresent':!![],'message':'gateway\x20'+'process\x20'+_0x3da3f9(0x150)+_0x3da3f9(0x14e)+_0x3da3f9(0x1fe)}),await _0x518ba6(_0x57339e,_0x4d0c9a),_0x28b97c[_0x3da3f9(0x16d)]['on'](_0x3da3f9(0x181),_0x138249=>{const _0x27f53b=_0x3da3f9,_0xebd8b4=_0x138249[_0x27f53b(0x13c)]();_0x4f3f28(_0x27f53b(0x16d),_0xebd8b4);}),_0x28b97c['stderr']['on']('data',_0x3be7fb=>{const _0x147659=_0x3da3f9,_0x3b94c7=_0x3be7fb[_0x147659(0x13c)]();_0x4f3f28(_0x147659(0x212),_0x3b94c7);}),_0x28b97c['on'](_0x3da3f9(0x185),_0x3f2ac3=>{const _0x40cf04=_0x3da3f9;_0x4f3f28(_0x40cf04(0x212),_0x3f2ac3 instanceof Error?_0x3f2ac3[_0x40cf04(0x166)]||_0x3f2ac3[_0x40cf04(0x132)]:String(_0x3f2ac3));}),_0x28b97c['on'](_0x3da3f9(0x1e9),(_0x1869a2,_0x2c8906)=>{const _0x37c90b=_0x3da3f9;_0x4f3f28(_0x37c90b(0x1c4),_0x37c90b(0x13e)+_0x37c90b(0x207)+'ode='+(_0x1869a2??_0x37c90b(0x168))+'\x20signal='+(_0x2c8906??_0x37c90b(0x168))),_0x28b97c=null,_0x29e12b=null,_0x2f574c=null,_0x34a895['configur'+'e'](null),_0x21c770(_0x37c90b(0x13e)+'process\x20'+'exited');if(_0x55d44e){_0x5c8929(_0x37c90b(0x189),_0x37c90b(0x13e)+_0x37c90b(0x189),{'health':_0x37c90b(0x1f3),'port':null,'tokenPresent':![]});return;}_0x5c8929('error','gateway\x20'+_0x37c90b(0x1db)+_0x37c90b(0x182)+_0x37c90b(0x11a),{'health':'unhealth'+'y','port':null,'tokenPresent':![]});});}async function _0x2f558e(){const _0x364f51=_0x5d64ba;if(_0x28b97c)return;_0x55d44e=![],await _0x470763[_0x364f51(0x147)]()[_0x364f51(0x1e1)](_0x43cd46=>{const _0x3b4d18=_0x364f51;_0x4f3f28(_0x3b4d18(0x1c4),_0x3b4d18(0x193)+_0x3b4d18(0x112)+_0x3b4d18(0x1c1)+_0x3b4d18(0x114)+_0x3b4d18(0x136)+(_0x43cd46 instanceof Error?_0x43cd46[_0x3b4d18(0x132)]:String(_0x43cd46)));}),await _0x3399f9[_0x364f51(0x220)+_0x364f51(0x1d8)+_0x364f51(0x223)](),_0x3399f9[_0x364f51(0x1f0)+_0x364f51(0x199)+'es'](),_0x3399f9['setGatew'+_0x364f51(0x1ff)+_0x364f51(0x15c)](_0x4e2830=>{void _0x3d1c3b(_0x4e2830);});const _0x47e4fe=await _0x3399f9[_0x364f51(0x1a8)+_0x364f51(0x121)+'tings']();await _0x38dd09(_0x47e4fe[_0x364f51(0x127)],_0x47e4fe['port']);}async function _0xea0dcc(){const _0x445f41=_0x5d64ba;_0x55d44e=!![],_0x34a895[_0x445f41(0x111)+'e'](null);if(_0x28b97c){const _0x177fdb=_0x28b97c;_0x28b97c=null;try{_0x177fdb[_0x445f41(0x1c3)]('SIGTERM');}catch{}await new Promise(_0x172838=>setTimeout(_0x172838,0x1f4));if(!_0x177fdb[_0x445f41(0x1b1)])try{_0x177fdb['kill'](_0x445f41(0x115));}catch{}}_0x29e12b=null,_0x2f574c=null,_0x21c770(_0x445f41(0x13e)+_0x445f41(0x189)),await _0x470763[_0x445f41(0x1ab)](),_0x3399f9['dispose'](),_0x5c8929(_0x445f41(0x189),'gateway\x20'+_0x445f41(0x189),{'health':_0x445f41(0x1f3),'port':null,'tokenPresent':![]}),_0x55d44e=![];}async function _0x3d1c3b(_0x220ddd=_0x5d64ba(0x21d)+'estart'){const _0x2c897e=_0x5d64ba;if(_0x32f7ac)return{'ok':!![]};return _0x32f7ac=!![],_0x2afbc3=_0x2afbc3[_0x2c897e(0x202)](async()=>{const _0x2629a1=_0x2c897e;_0x5c8929(_0x2629a1(0x156)+'ng',_0x2629a1(0x13e)+_0x2629a1(0x156)+'ng:\x20'+_0x220ddd,{'health':'unknown'}),await _0xea0dcc(),await _0x2f558e();})[_0x2c897e(0x1f9)](()=>{_0x32f7ac=![];}),await _0x2afbc3,{'ok':!![]};}async function _0x166faf(){const _0x2fe35e=_0x5d64ba,_0x3b3c7d=await loadRuntimeInfo(_0x5123a1['projectR'+_0x2fe35e(0x139)]);return{'runtimeRoot':_0x3b3c7d['runtimeR'+'oot'],'openclawVersion':_0x3b3c7d[_0x2fe35e(0x183)+_0x2fe35e(0x131)],'openclawWorkingDir':_0x3b3c7d['openclaw'+_0x2fe35e(0x122)+'ir'],'openclawBin':_0x3b3c7d['openclaw'+_0x2fe35e(0x21e)],'plugins':_0x3b3c7d[_0x2fe35e(0x1c5)][_0x2fe35e(0x211)](_0x62a530=>({'pluginId':_0x62a530[_0x2fe35e(0x1e7)],'source':_0x62a530[_0x2fe35e(0x1bd)],'version':_0x62a530[_0x2fe35e(0x1ad)],'installPath':_0x62a530[_0x2fe35e(0x164)+_0x2fe35e(0x1c9)]})),'configPath':_0x3399f9[_0x2fe35e(0x17f)+_0x2fe35e(0x1a3)+'h'](),'stateDir':_0x3399f9[_0x2fe35e(0x162)+_0x2fe35e(0x124)](),'bundledAgentSkillsDiscovery':_0x4fd411};}async function _0x266db2(){const _0x46414d=_0x5d64ba,_0x11eb78=asRecord(await _0x34a895[_0x46414d(0x21a)](_0x46414d(0x219)+'ist',{})),_0x12952a=getTrimmedString(_0x11eb78[_0x46414d(0x16f)+'d'])||_0x46414d(0x1dc),_0xb16981=Array[_0x46414d(0x1ec)](_0x11eb78[_0x46414d(0x151)])?[..._0x11eb78[_0x46414d(0x151)]]:[];return{..._0x11eb78,'defaultId':_0x12952a,'agents':_0xb16981};}async function _0x2aba4b(){const _0x12a923=_0x5d64ba;if(!_0x24b851())return{'defaultId':_0x12a923(0x1dc),'mainKey':'','scope':'','pending':!![],'agents':[{'id':_0x12a923(0x1dc),'name':_0x5123a1[_0x12a923(0x17b)+_0x12a923(0x11f)],'workspace':join(_0x3399f9['resolveS'+_0x12a923(0x124)](),_0x12a923(0x1a6)+'e')}]};const _0x51358d=await _0x266db2(),_0x433784=getTrimmedString(_0x51358d[_0x12a923(0x16f)+'d'])||'main',_0x865d3c=Array[_0x12a923(0x1ec)](_0x51358d[_0x12a923(0x151)])?[..._0x51358d[_0x12a923(0x151)]]:[];return!_0x865d3c[_0x12a923(0x172)](_0x3b3225=>asRecord(_0x3b3225)['id']===_0x12a923(0x1dc))&&_0x865d3c['unshift']({'id':'main','name':_0x5123a1[_0x12a923(0x17b)+_0x12a923(0x11f)],'workspace':join(_0x3399f9['resolveS'+_0x12a923(0x124)](),_0x12a923(0x1a6)+'e')}),{..._0x51358d,'defaultId':_0x433784,'agents':_0x865d3c};}async function _0x80e166(_0x31e46e={}){const _0x1f4536=_0x5d64ba;_0x163df8();const _0x2c5d33=await _0x34a895['request']('sessions'+_0x1f4536(0x130),buildSessionCreateRequestPayload(_0x31e46e));return parseSessionCreateResult(_0x2c5d33);}async function _0x219a1c(_0x4376f3={}){const _0x5c240e=_0x5d64ba,_0x5a298e=await readSessionMetadata(_0x3399f9[_0x5c240e(0x162)+'tateDir']());if(!_0x24b851())return{'pending':!![],'sessions':[],'pinnedKeys':_0x5a298e[_0x5c240e(0x134)+'ys']};const _0x4fd169=Math[_0x5c240e(0x170)](0x1,Math[_0x5c240e(0x1b9)](Number(_0x4376f3['limit'])||0x64)),_0x3e3821={'limit':_0x4fd169,'includeGlobal':!![],'includeUnknown':![]},_0x4b74e1=getTrimmedString(_0x4376f3[_0x5c240e(0x21b)]??'main');if(_0x4b74e1)_0x3e3821[_0x5c240e(0x21b)]=_0x4b74e1;return applySessionMetadata(await _0x34a895['request'](_0x5c240e(0x109)+_0x5c240e(0x224),_0x3e3821),_0x5a298e);}async function _0x13117f(_0x3f181e={}){const _0x1409d1=_0x5d64ba;_0x163df8();const _0x128e6a=getTrimmedString(_0x3f181e[_0x1409d1(0x1df)+'ey']??_0x3f181e[_0x1409d1(0x178)]);if(!_0x128e6a)throw new Error(_0x1409d1(0x1df)+_0x1409d1(0x14c)+_0x1409d1(0x20b));const _0x501b62=await _0x34a895[_0x1409d1(0x21a)](_0x1409d1(0x109)+'.delete',{'key':_0x128e6a,'deleteTranscript':_0x3f181e['deleteTr'+_0x1409d1(0x12d)]!==![],'emitLifecycleHooks':!![]}),_0x3c4ee5=await readSessionMetadata(_0x3399f9[_0x1409d1(0x162)+'tateDir']());return delete _0x3c4ee5[_0x1409d1(0x188)][_0x128e6a],_0x3c4ee5['pinnedKe'+'ys']=_0x3c4ee5[_0x1409d1(0x134)+'ys'][_0x1409d1(0x209)](_0x3a1858=>_0x3a1858!==_0x128e6a),await writeSessionMetadata(_0x3399f9['resolveS'+_0x1409d1(0x124)](),_0x3c4ee5),_0x18f61c(_0x1409d1(0x1f7)+_0x1409d1(0x15f),{'type':_0x1409d1(0x1ef),'sessionKey':_0x128e6a}),_0x501b62;}async function _0x23829b(_0x1534a2={}){const _0x3e697e=_0x5d64ba,_0x3214bd=getTrimmedString(_0x1534a2[_0x3e697e(0x1df)+'ey']??_0x1534a2['key']);if(!_0x3214bd)throw new Error('sessionK'+'ey\x20is\x20re'+_0x3e697e(0x20b));const _0x10b3e5=getTrimmedString(_0x1534a2[_0x3e697e(0x1e2)]??_0x1534a2['label']??_0x1534a2[_0x3e697e(0x169)]),_0x573975=await readSessionMetadata(_0x3399f9['resolveS'+_0x3e697e(0x124)]());if(_0x10b3e5)_0x573975[_0x3e697e(0x188)][_0x3214bd]=_0x10b3e5;else delete _0x573975[_0x3e697e(0x188)][_0x3214bd];return await writeSessionMetadata(_0x3399f9['resolveS'+'tateDir'](),_0x573975),_0x18f61c(_0x3e697e(0x1f7)+_0x3e697e(0x15f),{'type':_0x3e697e(0x1a4),'sessionKey':_0x3214bd,'name':_0x10b3e5}),{'ok':!![]};}async function _0x3c5a2a(){const _0x454bc1=_0x5d64ba,_0x51b9b1=await readSessionMetadata(_0x3399f9[_0x454bc1(0x162)+_0x454bc1(0x124)]());return _0x51b9b1['pinnedKe'+'ys'];}async function _0xd1d456(_0x1b8c42=[]){const _0x333d3d=_0x5d64ba,_0x4464f0=await readSessionMetadata(_0x3399f9[_0x333d3d(0x162)+_0x333d3d(0x124)]());return _0x4464f0[_0x333d3d(0x134)+'ys']=Array[_0x333d3d(0x1ec)](_0x1b8c42)?[...new Set(_0x1b8c42[_0x333d3d(0x211)](getTrimmedString)[_0x333d3d(0x209)](Boolean))]:[],await writeSessionMetadata(_0x3399f9[_0x333d3d(0x162)+_0x333d3d(0x124)](),_0x4464f0),_0x18f61c(_0x333d3d(0x1f7)+'updated',{'type':'pinned-k'+_0x333d3d(0x160)+_0x333d3d(0x1d9),'pinnedKeys':_0x4464f0['pinnedKe'+'ys']}),{'ok':!![],'pinnedKeys':_0x4464f0[_0x333d3d(0x134)+'ys']};}async function _0x55c7cd(){const _0x40897b=_0x5d64ba,_0x1171c7=join(_0x3399f9[_0x40897b(0x162)+_0x40897b(0x124)](),_0x40897b(0x1a6)+'e');return{'path':_0x1171c7,'exists':Boolean(await stat(_0x1171c7)[_0x40897b(0x1e1)](()=>null))};}async function _0x2a0344(){const _0x12fe9f=_0x5d64ba;return readSharedContext(join(_0x3399f9['resolveS'+_0x12fe9f(0x124)](),_0x12fe9f(0x1a6)+'e'));}async function _0x305a83(_0x2d2de2={}){const _0x437e8b=_0x5d64ba;return writeSharedContext(join(_0x3399f9[_0x437e8b(0x162)+_0x437e8b(0x124)](),'workspac'+'e'),_0x2d2de2);}async function _0x215985(_0x38ca5c={}){const _0xdd017d=_0x5d64ba;return _0x163df8(),await _0x34a895['request'](_0xdd017d(0x106)+'t',_0x38ca5c);}async function _0xbfe736(_0x1c265e={}){const _0xe4ab83=_0x5d64ba;return _0x163df8(),await _0x34a895[_0xe4ab83(0x21a)](_0xe4ab83(0x184),_0x1c265e);}async function _0x368c73(_0x4edde4={}){const _0x542f8f=_0x5d64ba;_0x163df8();const _0x428d29=getTrimmedString(_0x4edde4[_0x542f8f(0x104)]??_0x4edde4['id']);if(!_0x428d29)throw new Error(_0x542f8f(0x128)+'\x20require'+'d');const _0x332d32=asRecord(_0x4edde4[_0x542f8f(0x1cc)]),_0x2747cf=Object[_0x542f8f(0x1a7)](_0x332d32)[_0x542f8f(0x154)]>0x0?_0x332d32:{..._0x4edde4};return delete _0x2747cf['jobId'],delete _0x2747cf['id'],await _0x34a895[_0x542f8f(0x21a)]('cron.upd'+_0x542f8f(0x103),{'jobId':_0x428d29,'patch':_0x2747cf});}async function _0x30cb6d(_0x1d501e={}){const _0x40c9dc=_0x5d64ba;_0x163df8();const _0x69e52a=getTrimmedString(_0x1d501e[_0x40c9dc(0x104)]??_0x1d501e['id']);if(!_0x69e52a)throw new Error('jobId\x20is'+'\x20require'+'d');return await _0x34a895[_0x40c9dc(0x21a)](_0x40c9dc(0x200)+_0x40c9dc(0x1ed),{'jobId':_0x69e52a});}async function _0x4b080c(_0x59a96d={}){const _0x58eca8=_0x5d64ba;_0x163df8();const _0x5bfaf1=getTrimmedString(_0x59a96d[_0x58eca8(0x104)]??_0x59a96d['id']);if(!_0x5bfaf1)throw new Error(_0x58eca8(0x128)+_0x58eca8(0x12a)+'d');return await _0x34a895[_0x58eca8(0x21a)]('cron.run',{'jobId':_0x5bfaf1});}async function _0x14846a(_0x1344c={}){const _0x1882ba=_0x5d64ba;return _0x163df8(),await _0x34a895['request'](_0x1882ba(0x13a)+'s',_0x1344c);}async function _0xd35881(_0x43ba45={}){const _0x3bbce5=_0x5d64ba;return _0x163df8(),await _0x34a895[_0x3bbce5(0x21a)](_0x3bbce5(0x1b0)+_0x3bbce5(0x1af),_0x43ba45);}async function _0x4fc713(_0x23c303={}){const _0x1fa9f0=_0x5d64ba;return _0x163df8(),await _0x34a895['request'](_0x1fa9f0(0x15e)+_0x1fa9f0(0x216),_0x23c303);}async function _0x4d443e(_0x50060a={}){const _0x2862f5=_0x5d64ba;return _0x163df8(),await _0x34a895[_0x2862f5(0x21a)]('skills.d'+'elete',_0x50060a);}async function _0x1ebf2c(_0x2205db={}){const _0x345ffb=_0x5d64ba;_0x163df8();const _0x530075=getTrimmedString(_0x2205db['sessionK'+'ey']),_0x2af590=getTrimmedString(_0x2205db[_0x345ffb(0x132)]),_0x3feb0a=getTrimmedString(_0x2205db[_0x345ffb(0x1b8)+'d'])||randomUUID();if(!_0x530075)throw new Error(_0x345ffb(0x1df)+'ey\x20is\x20re'+_0x345ffb(0x20b));if(!_0x2af590)throw new Error(_0x345ffb(0x143)+_0x345ffb(0x203)+_0x345ffb(0x149));_0xb42f5d({'requestId':_0x3feb0a,'sessionKey':_0x530075,'type':_0x345ffb(0x13d)}),_0xd2c148['set'](_0x3feb0a,{'runId':_0x3feb0a,'requestId':_0x3feb0a,'sessionKey':_0x530075,'textLength':0x0}),_0x100f37[_0x345ffb(0x1f8)](_0x530075,_0x3feb0a);try{const _0x5884db=await buildAttachments(Array[_0x345ffb(0x1ec)](_0x2205db[_0x345ffb(0x195)+'s'])?_0x2205db[_0x345ffb(0x195)+'s']:[]),_0x377f5e=asRecord(await _0x34a895[_0x345ffb(0x21a)](_0x345ffb(0x13f)+'d',{'sessionKey':_0x530075,'message':_0x2af590,'deliver':![],'idempotencyKey':_0x3feb0a,..._0x5884db['length']>0x0?{'attachments':_0x5884db}:{}})),_0x1188e3=getTrimmedString(_0x377f5e[_0x345ffb(0x10a)])||_0x3feb0a,_0x52527b=_0xd2c148[_0x345ffb(0x18f)](_0x3feb0a);if(!_0x52527b)return{'ok':!![],'requestId':_0x3feb0a,'runId':_0x1188e3};return _0x1188e3!==_0x52527b[_0x345ffb(0x10a)]&&(_0xd2c148[_0x345ffb(0x155)](_0x52527b[_0x345ffb(0x10a)]),_0x52527b[_0x345ffb(0x10a)]=_0x1188e3,_0xd2c148[_0x345ffb(0x1f8)](_0x1188e3,_0x52527b)),_0x100f37[_0x345ffb(0x1f8)](_0x530075,_0x1188e3),_0x377f5e[_0x345ffb(0x1c7)]===_0x345ffb(0x185)&&_0x4433ce(_0x52527b,_0x345ffb(0x185),getTrimmedString(_0x377f5e['errorMes'+_0x345ffb(0x18c)])||'gateway\x20'+_0x345ffb(0x20d)+'led'),{'ok':!![],'requestId':_0x3feb0a,'runId':_0x1188e3,'response':_0x377f5e};}catch(_0xa45df6){const _0x162a89=_0x591423(_0x3feb0a),_0x4ad795=_0xa45df6 instanceof Error?_0xa45df6[_0x345ffb(0x132)]:String(_0xa45df6);if(_0x162a89)_0x4433ce(_0x162a89,_0x345ffb(0x185),_0x4ad795);else _0xb42f5d({'requestId':_0x3feb0a,'sessionKey':_0x530075,'type':_0x345ffb(0x185),'message':_0x4ad795});throw _0xa45df6;}}async function _0x2a67e7(_0x2c68bb={}){const _0x2b505a=_0x5d64ba;_0x163df8();const _0x23665a=getTrimmedString(_0x2c68bb[_0x2b505a(0x1df)+'ey']);if(!_0x23665a)throw new Error('sessionK'+_0x2b505a(0x14c)+_0x2b505a(0x20b));const _0x3e5990=_0x591423(getTrimmedString(_0x2c68bb[_0x2b505a(0x1b8)+'d']))??_0x4915e6(_0x23665a),_0x284351=_0x100f37[_0x2b505a(0x18f)](_0x23665a),_0x218d89={'sessionKey':_0x23665a};if(_0x3e5990?.[_0x2b505a(0x10a)])_0x218d89[_0x2b505a(0x10a)]=_0x3e5990[_0x2b505a(0x10a)];else{if(_0x284351)_0x218d89['runId']=_0x284351;}const _0x4a5d7f=await _0x34a895[_0x2b505a(0x21a)](_0x2b505a(0x1b4)+'rt',_0x218d89);if(_0x3e5990)_0x4433ce(_0x3e5990,'done');return _0x4a5d7f;}async function _0x1ac3bf(_0x55a94a={}){const _0x4b3097=_0x5d64ba;_0x163df8();const _0x2ed77f=getTrimmedString(_0x55a94a[_0x4b3097(0x1df)+'ey']);if(!_0x2ed77f)throw new Error(_0x4b3097(0x1df)+_0x4b3097(0x14c)+_0x4b3097(0x20b));return await _0x34a895[_0x4b3097(0x21a)](_0x4b3097(0x108)+'tory',{'sessionKey':_0x2ed77f,'limit':Math[_0x4b3097(0x170)](0x1,Math[_0x4b3097(0x1b9)](Number(_0x55a94a[_0x4b3097(0x18d)])||0xc8))});}async function _0x692cec(_0x5d68fc=''){const _0x16f6f8=_0x5d64ba;if(!_0x24b851())return{'pending':!![],'skills':[]};const _0x3ed7b1=getTrimmedString(_0x5d68fc),_0x331058=await _0x34a895[_0x16f6f8(0x21a)](_0x16f6f8(0x1ac)+_0x16f6f8(0x1d7),_0x3ed7b1?{'agentId':_0x3ed7b1}:{}),_0x3ca1f7=await _0x3399f9[_0x16f6f8(0x218)+'ig']()['catch'](()=>({}));return filterSkillsForAgent(_0x331058,_0x3ca1f7,_0x3ed7b1);}return{'on':_0x1e4896,'start':_0x2f558e,'stop':_0xea0dcc,'restart':_0x3d1c3b,'runtimeInfo':_0x166faf,'getStatus':()=>_0x5822b9,'getRecentLogs':_0x459670,'answerAskUserQuestion':_0x957cce=>_0x470763['answer'](_0x957cce),'agents':{'list':_0x2aba4b},'skills':{'status':_0x692cec,'install':_0xd35881,'update':_0x4fc713,'delete':_0x4d443e},'sessions':{'create':_0x80e166,'list':_0x219a1c,'delete':_0x13117f,'rename':_0x23829b,'pinnedKeys':_0x3c5a2a,'setPinnedKeys':_0xd1d456},'workspace':{'directoryInfo':_0x55c7cd,'sharedContext':_0x2a0344,'writeSharedContext':_0x305a83},'cron':{'list':_0x215985,'create':_0xbfe736,'update':_0x368c73,'remove':_0x30cb6d,'runOnce':_0x4b080c,'logs':_0x14846a},'models':{'settings':()=>_0x3399f9[_0x5d64ba(0x18e)+_0x5d64ba(0x206)](),'selectedModelId':async()=>{const _0x446f2e=_0x5d64ba,_0x6ff0b1=await _0x3399f9[_0x446f2e(0x18e)+_0x446f2e(0x206)]();return _0x6ff0b1[_0x446f2e(0x1d4)]&&_0x6ff0b1[_0x446f2e(0x167)+'e']?_0x6ff0b1[_0x446f2e(0x1d4)]+'/'+_0x6ff0b1[_0x446f2e(0x167)+'e']:'';},'customModels':async()=>[]},'config':{'read':()=>_0x3399f9[_0x5d64ba(0x218)+'ig']()},'chat':{'stream':_0x1ebf2c,'abort':_0x2a67e7,'history':_0x1ac3bf}};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x29cb61=_0x4b80;(function(_0x354e0f,_0x463347){const _0x465d10=_0x4b80,_0x2f91fd=_0x354e0f();while(!![]){try{const _0x2d818e=parseInt(_0x465d10(0x238))/0x1+-parseInt(_0x465d10(0x227))/0x2+-parseInt(_0x465d10(0x250))/0x3*(parseInt(_0x465d10(0x1fb))/0x4)+parseInt(_0x465d10(0x283))/0x5*(parseInt(_0x465d10(0x28c))/0x6)+parseInt(_0x465d10(0x231))/0x7+parseInt(_0x465d10(0x1dd))/0x8+parseInt(_0x465d10(0x205))/0x9*(-parseInt(_0x465d10(0x1f7))/0xa);if(_0x2d818e===_0x463347)break;else _0x2f91fd['push'](_0x2f91fd['shift']());}catch(_0x250b18){_0x2f91fd['push'](_0x2f91fd['shift']());}}}(_0x295c,0xbf3b3));import{Buffer}from'node:buffer';function _0x4b80(_0x9b2a5,_0x1f64a0){_0x9b2a5=_0x9b2a5-0x1d8;const _0x295cda=_0x295c();let _0x4b8033=_0x295cda[_0x9b2a5];return _0x4b8033;}import{createHash,createPrivateKey,createPublicKey,generateKeyPairSync,randomUUID,sign}from'node:crypto';import{chmodSync,existsSync,mkdirSync,readFileSync,writeFileSync}from'node:fs';import{dirname}from'node:path';import _0x3ec2e3 from'ws';const ED25519_SPKI_PREFIX=Buffer['from'](_0x29cb61(0x268)+_0x29cb61(0x24b)+_0x29cb61(0x229),_0x29cb61(0x254)),BASE64_PADDING_REGEX=/=+$/g,UPPERCASE_ASCII_REGEX=/[A-Z]/g;function isRecord(_0x40f4d5){const _0x1ed98c=_0x29cb61;return Boolean(_0x40f4d5)&&typeof _0x40f4d5==='object'&&!Array[_0x1ed98c(0x224)](_0x40f4d5);}function formatUnknownError(_0x360dd3){if(_0x360dd3 instanceof Error)return _0x360dd3['message'];return String(_0x360dd3??'');}function isLocalGatewayConnRefused(_0x4cabf3){const _0x3fc44f=formatUnknownError(_0x4cabf3);return/\bECONNREFUSED\b/i['test'](_0x3fc44f)&&/127\.0\.0\.1:\d+/['test'](_0x3fc44f);}function base64UrlEncode(_0x3f7b27){const _0x49af33=_0x29cb61;return _0x3f7b27[_0x49af33(0x286)]('base64')[_0x49af33(0x257)+'ll']('+','-')['replaceA'+'ll']('/','_')[_0x49af33(0x213)](BASE64_PADDING_REGEX,'');}function derivePublicKeyRaw(_0x268823){const _0x127faa=_0x29cb61,_0x19c6a6=createPublicKey(_0x268823)[_0x127faa(0x1f1)]({'type':_0x127faa(0x20f),'format':_0x127faa(0x291)}),_0x12ada5=Buffer[_0x127faa(0x203)](_0x19c6a6)?_0x19c6a6:Buffer[_0x127faa(0x269)](_0x19c6a6),_0x5094d4=_0x12ada5[_0x127faa(0x215)]===ED25519_SPKI_PREFIX['length']+0x20&&_0x12ada5[_0x127faa(0x1df)](0x0,ED25519_SPKI_PREFIX[_0x127faa(0x215)])[_0x127faa(0x1ee)](ED25519_SPKI_PREFIX);return _0x5094d4?_0x12ada5[_0x127faa(0x1df)](ED25519_SPKI_PREFIX['length']):_0x12ada5;}function fingerprintPublicKey(_0x3d22a0){const _0x26b8ba=_0x29cb61;return createHash(_0x26b8ba(0x21a))['update'](derivePublicKeyRaw(_0x3d22a0))[_0x26b8ba(0x265)](_0x26b8ba(0x254));}function publicKeyRawBase64UrlFromPem(_0x385ce5){return base64UrlEncode(derivePublicKeyRaw(_0x385ce5));}function signDevicePayload(_0x100d09,_0x4d0c49){const _0x36fff3=_0x29cb61,_0x3ef712=createPrivateKey(_0x100d09);return base64UrlEncode(sign(null,Buffer[_0x36fff3(0x269)](_0x4d0c49,'utf8'),_0x3ef712));}function normalizeDeviceMetadataForAuth(_0xe072d4){const _0x4bc8a4=_0x29cb61,_0x50dcd9=typeof _0xe072d4===_0x4bc8a4(0x1ed)?_0xe072d4[_0x4bc8a4(0x1f4)]():'';if(!_0x50dcd9)return'';return _0x50dcd9[_0x4bc8a4(0x213)](UPPERCASE_ASCII_REGEX,_0x240950=>String[_0x4bc8a4(0x28d)+_0x4bc8a4(0x237)](_0x240950['charCode'+'At'](0x0)+0x20));}function buildDeviceAuthPayloadV3(_0x63f207){const _0x5081e7=_0x29cb61;return['v3',_0x63f207['deviceId'],_0x63f207[_0x5081e7(0x221)],_0x63f207['clientMo'+'de'],_0x63f207[_0x5081e7(0x21b)],_0x63f207['scopes']['join'](','),String(_0x63f207[_0x5081e7(0x1e2)+'Ms']),_0x63f207[_0x5081e7(0x288)]??'',_0x63f207[_0x5081e7(0x23e)],normalizeDeviceMetadataForAuth(_0x63f207['platform']),normalizeDeviceMetadataForAuth(_0x63f207[_0x5081e7(0x28f)+_0x5081e7(0x234)])][_0x5081e7(0x225)]('|');}function writeIdentityFile(_0x281ea7,_0x1c43df,_0x1945b9){const _0x2e7361=_0x29cb61;mkdirSync(dirname(_0x281ea7),{'recursive':!![]}),writeFileSync(_0x281ea7,JSON[_0x2e7361(0x277)+'y']({'version':0x1,..._0x1c43df,'createdAtMs':_0x1945b9},null,0x2)+'\x0a',{'mode':0x180});try{chmodSync(_0x281ea7,0x180);}catch{}}function generateDeviceIdentity(){const _0xc0ff09=_0x29cb61,{publicKey:_0x128ec1,privateKey:_0xea7326}=generateKeyPairSync(_0xc0ff09(0x1f9)),_0x43da45=_0x128ec1[_0xc0ff09(0x1f1)]({'type':'spki','format':_0xc0ff09(0x260)})[_0xc0ff09(0x286)](),_0x1fe975=_0xea7326[_0xc0ff09(0x1f1)]({'type':_0xc0ff09(0x217),'format':'pem'})[_0xc0ff09(0x286)]();return{'deviceId':fingerprintPublicKey(_0x43da45),'publicKeyPem':_0x43da45,'privateKeyPem':_0x1fe975};}function loadOrCreateDeviceIdentity(_0x8811a8){const _0x58387c=_0x29cb61;if(existsSync(_0x8811a8))try{const _0x428ef3=JSON['parse'](readFileSync(_0x8811a8,'utf8')),_0x5e2bea=typeof _0x428ef3?.[_0x58387c(0x1f6)+_0x58387c(0x25d)]===_0x58387c(0x1ed)?_0x428ef3['publicKe'+'yPem']:'',_0x4b0d44=typeof _0x428ef3?.[_0x58387c(0x1f8)+'eyPem']===_0x58387c(0x1ed)?_0x428ef3[_0x58387c(0x1f8)+_0x58387c(0x274)]:'';if(_0x5e2bea&&_0x4b0d44){const _0x2defb7={'deviceId':fingerprintPublicKey(_0x5e2bea),'publicKeyPem':_0x5e2bea,'privateKeyPem':_0x4b0d44};return _0x428ef3?.[_0x58387c(0x266)]!==_0x2defb7[_0x58387c(0x266)]&&writeIdentityFile(_0x8811a8,_0x2defb7,Date[_0x58387c(0x1fa)]()),_0x2defb7;}}catch{}const _0x4029bd=generateDeviceIdentity();return writeIdentityFile(_0x8811a8,_0x4029bd,Date[_0x58387c(0x1fa)]()),_0x4029bd;}function _0x295c(){const _0x5aaf33=['connect.','device\x20i','string','equals','platform','handleDi','export','t\x20config','clearTim','trim','type','publicKe','7894070LMWpYm','privateK','ed25519','now','772DEoYyM','WS\x20clien','Timer','pending','terminat','nnected','reconnec','WS\x20hands','isBuffer','d\x20(','9FmKZSj','connectS','readyWai','open','handleMe','parse','Format','ble','lengeTim','rejectRe','spki','onChatEv','ters','adyWaite','replace','min','length','operator','pkcs8','entity','nected','sha256','role','DateTime','ting','nal','clientVe','ent','clientId','delete','removeAl','isArray','join','entries','2254768msomYt','dentity\x20','70032100','eout','.read','expectFi','e\x20missin','url','WS\x20error','onAgentE','9965102NCkcqX','connectC','agent','mily','queueCon','nectChal','Code','1223941FKKcOD','初始化\x20gate','timeoutM','t:\x20','t\x20connec','resolve','nonce','e\x20timeou','equest','readySta','reject','restart','status','get','ers','lReady','t\x20restar','send','.pairing','06032b65','ction\x20ti','\x20yet','filter','o\x20load\x20g','11859HGokHL','viceFami','failed\x20t','clientDe','hex','clientMo','once','replaceA','OPEN','connecte','resolveR','eadyWait','request','yPem','WS\x20is\x20no','is\x20not\x20l','pem','onDiscon','gateway\x20','failed:\x20','code=','digest','deviceId','splayNam','302a3005','from','payload','challeng','connect','stop','rsion','connect\x20','dentity','sconnect','ateway\x20r','set','eyPem','connectN','identity','stringif','config','hallenge','res','.admin','istening','yCheck','message','configur','Path','rejectPe','WS\x20close','354215mVHrpT','timed\x20ou','tBackoff','toString','error','token','WS\x20disco','vent','.approva','6IxbDfn','fromChar','close','deviceFa','ted','der','WS\x20conne','ect','request\x20','ed\x20out','event','5957064YujxZr','tTimer','subarray','sing\x20non','timeout','signedAt','ssage','waitUnti','hake\x20tim','skipRead','nding','t\x20stoppe','shouldRe','accepted'];_0x295c=function(){return _0x5aaf33;};return _0x295c();}export class ClawGatewayWsClient{['ws']=null;[_0x29cb61(0x278)]=null;[_0x29cb61(0x1fe)]=new Map();[_0x29cb61(0x207)+'ters']=[];['shouldRe'+_0x29cb61(0x26c)]=![];[_0x29cb61(0x201)+'tTimer']=null;[_0x29cb61(0x232)+_0x29cb61(0x279)+_0x29cb61(0x1fd)]=null;['connectN'+'once']=null;[_0x29cb61(0x206)+_0x29cb61(0x220)]=![];[_0x29cb61(0x259)+'d']=![];['reconnec'+_0x29cb61(0x285)+'Ms']=0x320;[_0x29cb61(0x266)+_0x29cb61(0x218)]=null;[_0x29cb61(0x27f)+'e'](_0x593f5f){const _0x229df4=_0x29cb61;if(!_0x593f5f){this[_0x229df4(0x26d)]();return;}const _0x5bebd5=this['config'];this[_0x229df4(0x278)]=_0x593f5f,this[_0x229df4(0x1e9)+'connect']=!![];try{this[_0x229df4(0x266)+'entity']=loadOrCreateDeviceIdentity(_0x593f5f['identity'+'Path']);}catch(_0x50d54b){const _0x58d374=_0x50d54b instanceof Error?_0x50d54b['message']:_0x229df4(0x239)+'way\x20设备身份'+'失败';this[_0x229df4(0x26d)](),_0x593f5f[_0x229df4(0x261)+_0x229df4(0x219)](_0x58d374);return;}const _0x555b86=!_0x5bebd5||_0x5bebd5['url']!==_0x593f5f[_0x229df4(0x22e)]||_0x5bebd5[_0x229df4(0x288)]!==_0x593f5f[_0x229df4(0x288)]||_0x5bebd5[_0x229df4(0x221)]!==_0x593f5f[_0x229df4(0x221)]||_0x5bebd5['clientMo'+'de']!==_0x593f5f[_0x229df4(0x255)+'de']||_0x5bebd5[_0x229df4(0x21f)+'rsion']!==_0x593f5f[_0x229df4(0x21f)+_0x229df4(0x26e)]||_0x5bebd5['identity'+_0x229df4(0x280)]!==_0x593f5f[_0x229df4(0x276)+'Path'];if(_0x555b86){this[_0x229df4(0x243)]();return;}if(!this['ws'])this['connect']();}[_0x29cb61(0x26d)](){const _0x58aebf=_0x29cb61;this[_0x58aebf(0x1e9)+_0x58aebf(0x26c)]=![],this[_0x58aebf(0x259)+'d']=![],this[_0x58aebf(0x275)+_0x58aebf(0x256)]=null,this[_0x58aebf(0x206)+'ent']=![],this['clearTim'+'ers'](),this[_0x58aebf(0x281)+_0x58aebf(0x1e7)](new Error(_0x58aebf(0x262)+_0x58aebf(0x1fc)+_0x58aebf(0x1e8)+'d')),this['rejectRe'+_0x58aebf(0x212)+'rs'](new Error(_0x58aebf(0x262)+_0x58aebf(0x1fc)+_0x58aebf(0x1e8)+'d'));if(this['ws']){try{this['ws']['close']();}catch{}this['ws']=null;}this[_0x58aebf(0x266)+_0x58aebf(0x218)]=null,this[_0x58aebf(0x278)]=null;}async[_0x29cb61(0x25c)](_0x526b0e,_0x232e74={},_0x25bb50={}){const _0x292bb9=_0x29cb61;if(!_0x25bb50[_0x292bb9(0x1e6)+_0x292bb9(0x27d)])await this['waitUnti'+_0x292bb9(0x247)]();const _0x31ab2b=this['ws'];if(!_0x31ab2b||_0x31ab2b[_0x292bb9(0x241)+'te']!==_0x3ec2e3[_0x292bb9(0x258)])throw new Error(_0x292bb9(0x262)+_0x292bb9(0x25e)+_0x292bb9(0x23c)+'ted');const _0x5d4990=randomUUID(),_0x15bc5e=_0x25bb50[_0x292bb9(0x23a)+'s']??0x7530;return await new Promise((_0x38a10a,_0x1453af)=>{const _0xff1297=_0x292bb9,_0x1a8150=setTimeout(()=>{const _0xc335e6=_0x4b80;this[_0xc335e6(0x1fe)][_0xc335e6(0x222)](_0x5d4990),_0x1453af(new Error(_0xc335e6(0x262)+_0xc335e6(0x1da)+_0xc335e6(0x284)+_0xc335e6(0x23b)+_0x526b0e));},_0x15bc5e);this[_0xff1297(0x1fe)][_0xff1297(0x273)](_0x5d4990,{'method':_0x526b0e,'resolve':_0x205a0e=>{clearTimeout(_0x1a8150),_0x38a10a(_0x205a0e);},'reject':_0x5d1817=>{clearTimeout(_0x1a8150),_0x1453af(_0x5d1817);},'expectFinal':_0x25bb50[_0xff1297(0x22c)+_0xff1297(0x21e)]===!![],'timeout':_0x1a8150});try{_0x31ab2b[_0xff1297(0x249)](JSON[_0xff1297(0x277)+'y']({'type':'req','id':_0x5d4990,'method':_0x526b0e,'params':_0x232e74}));}catch(_0x382395){this[_0xff1297(0x1fe)]['delete'](_0x5d4990),clearTimeout(_0x1a8150),_0x1453af(_0x382395 instanceof Error?_0x382395:new Error(_0xff1297(0x252)+'o\x20send\x20g'+_0xff1297(0x272)+_0xff1297(0x240)));}});}[_0x29cb61(0x243)](){const _0x1d2dac=_0x29cb61;this[_0x1d2dac(0x259)+'d']=![],this[_0x1d2dac(0x275)+'once']=null,this['connectS'+_0x1d2dac(0x220)]=![],this[_0x1d2dac(0x1f3)+_0x1d2dac(0x246)](),this[_0x1d2dac(0x281)+_0x1d2dac(0x1e7)](new Error('gateway\x20'+'WS\x20clien'+'t\x20restar'+'ting')),this[_0x1d2dac(0x20e)+_0x1d2dac(0x212)+'rs'](new Error(_0x1d2dac(0x262)+'WS\x20clien'+_0x1d2dac(0x248)+_0x1d2dac(0x21d)));if(this['ws']){try{this['ws'][_0x1d2dac(0x1ff)+'e']();}catch{}this['ws']=null;}this['connect']();}[_0x29cb61(0x26c)](){const _0x36693c=_0x29cb61;if(!this['config']||this['ws'])return;const _0x16e43f=new _0x3ec2e3(this['config']['url']);this['ws']=_0x16e43f,_0x16e43f['on'](_0x36693c(0x208),()=>this[_0x36693c(0x235)+'nectChal'+_0x36693c(0x20d)+_0x36693c(0x22a)]()),_0x16e43f['on'](_0x36693c(0x27e),_0x574890=>this[_0x36693c(0x209)+'ssage'](_0x574890['toString']())),_0x16e43f['on'](_0x36693c(0x28e),(_0x5b6ab5,_0x50df8c)=>{const _0x3dac71=_0x36693c;if(this[_0x3dac71(0x259)+'d']){const _0x1a6b1c=_0x50df8c[_0x3dac71(0x286)]()||_0x3dac71(0x264)+_0x5b6ab5;this['handleDi'+_0x3dac71(0x271)]('gateway\x20'+_0x3dac71(0x282)+_0x3dac71(0x204)+_0x1a6b1c+')');}else this[_0x3dac71(0x1f0)+_0x3dac71(0x271)]('');}),_0x16e43f['on']('error',_0x47e0aa=>{const _0x22f9e9=_0x36693c;if(isLocalGatewayConnRefused(_0x47e0aa)){this[_0x22f9e9(0x1f0)+'sconnect'](_0x22f9e9(0x262)+_0x22f9e9(0x25f)+_0x22f9e9(0x27c)+_0x22f9e9(0x24d));return;}const _0x287ff2=formatUnknownError(_0x47e0aa);this[_0x22f9e9(0x1f0)+_0x22f9e9(0x271)](_0x287ff2?'gateway\x20'+_0x22f9e9(0x22f)+':\x20'+_0x287ff2:_0x22f9e9(0x262)+'WS\x20error');});}[_0x29cb61(0x235)+_0x29cb61(0x236)+'lengeTim'+_0x29cb61(0x22a)](){const _0xd7be1c=_0x29cb61;this[_0xd7be1c(0x275)+'once']=null,this['connectS'+_0xd7be1c(0x220)]=![];if(this['connectC'+_0xd7be1c(0x279)+_0xd7be1c(0x1fd)])clearTimeout(this[_0xd7be1c(0x232)+'hallenge'+_0xd7be1c(0x1fd)]);this['connectC'+_0xd7be1c(0x279)+_0xd7be1c(0x1fd)]=setTimeout(()=>{const _0x5b10f4=_0xd7be1c;if(this[_0x5b10f4(0x206)+_0x5b10f4(0x220)]||!this['ws']||this['ws'][_0x5b10f4(0x241)+'te']!==_0x3ec2e3['OPEN'])return;this[_0x5b10f4(0x1f0)+'sconnect']('gateway\x20'+_0x5b10f4(0x202)+_0x5b10f4(0x1e5)+_0x5b10f4(0x1db)),this['ws']?.[_0x5b10f4(0x28e)](0x3f0,_0x5b10f4(0x26f)+'challeng'+_0x5b10f4(0x23f)+'t');},0x7d0);}async['sendConn'+_0x29cb61(0x1d9)](){const _0x23a475=_0x29cb61,_0x40b3dc=this[_0x23a475(0x278)];if(!_0x40b3dc||this[_0x23a475(0x206)+'ent'])return;const _0xa57e33=this[_0x23a475(0x275)+'once']?.[_0x23a475(0x1f4)]()??'';if(!_0xa57e33){this[_0x23a475(0x1f0)+_0x23a475(0x271)](_0x23a475(0x262)+'WS\x20hands'+'hake\x20mis'+_0x23a475(0x1e0)+'ce'),this['ws']?.['close'](0x3f0,_0x23a475(0x26f)+'challeng'+_0x23a475(0x22d)+'g\x20nonce');return;}this[_0x23a475(0x206)+_0x23a475(0x220)]=!![];this[_0x23a475(0x232)+_0x23a475(0x279)+_0x23a475(0x1fd)]&&(clearTimeout(this[_0x23a475(0x232)+_0x23a475(0x279)+_0x23a475(0x1fd)]),this[_0x23a475(0x232)+_0x23a475(0x279)+_0x23a475(0x1fd)]=null);if(!this[_0x23a475(0x266)+_0x23a475(0x218)])try{this[_0x23a475(0x266)+_0x23a475(0x218)]=loadOrCreateDeviceIdentity(_0x40b3dc['identity'+'Path']);}catch(_0x1746c7){this[_0x23a475(0x1f0)+'sconnect'](_0x1746c7 instanceof Error?_0x1746c7[_0x23a475(0x27e)]:'failed\x20t'+_0x23a475(0x24f)+'ateway\x20i'+_0x23a475(0x270)),this['ws']?.[_0x23a475(0x28e)](0x3f0,_0x23a475(0x1ec)+_0x23a475(0x228)+'unavaila'+_0x23a475(0x20c));return;}const _0x68c490=_0x23a475(0x216),_0x5397cc=[_0x23a475(0x216)+_0x23a475(0x22b),_0x23a475(0x216)+'.write',_0x23a475(0x216)+_0x23a475(0x27b),_0x23a475(0x216)+_0x23a475(0x28b)+'ls',_0x23a475(0x216)+_0x23a475(0x24a)],_0x13e0d5=_0x40b3dc[_0x23a475(0x288)]['trim'](),_0x14778f=Date[_0x23a475(0x1fa)](),_0x2c8d39=buildDeviceAuthPayloadV3({'deviceId':this[_0x23a475(0x266)+_0x23a475(0x218)][_0x23a475(0x266)],'clientId':_0x40b3dc['clientId'],'clientMode':_0x40b3dc[_0x23a475(0x255)+'de'],'role':_0x68c490,'scopes':_0x5397cc,'signedAtMs':_0x14778f,'token':_0x13e0d5||null,'nonce':_0xa57e33,'platform':process[_0x23a475(0x1ef)],'deviceFamily':_0x40b3dc[_0x23a475(0x253)+_0x23a475(0x251)+'ly']}),_0x37127f={'minProtocol':0x4,'maxProtocol':0x4,'client':{'id':_0x40b3dc[_0x23a475(0x221)],'displayName':_0x40b3dc['clientDi'+_0x23a475(0x267)+'e'],'version':_0x40b3dc[_0x23a475(0x21f)+_0x23a475(0x26e)],'platform':process[_0x23a475(0x1ef)],'deviceFamily':_0x40b3dc[_0x23a475(0x253)+_0x23a475(0x251)+'ly'],'mode':_0x40b3dc[_0x23a475(0x255)+'de']},'caps':[],'role':_0x68c490,'scopes':_0x5397cc,'auth':_0x13e0d5?{'token':_0x13e0d5}:undefined,'device':{'id':this[_0x23a475(0x266)+'entity'][_0x23a475(0x266)],'publicKey':publicKeyRawBase64UrlFromPem(this['deviceId'+_0x23a475(0x218)]['publicKe'+_0x23a475(0x25d)]),'signature':signDevicePayload(this[_0x23a475(0x266)+_0x23a475(0x218)]['privateK'+'eyPem'],_0x2c8d39),'signedAt':_0x14778f,'nonce':_0xa57e33},'locale':Intl[_0x23a475(0x21c)+_0x23a475(0x20b)]()['resolved'+'Options']()['locale'],'userAgent':'wujie-sh'+'ell/'+_0x40b3dc[_0x23a475(0x21f)+_0x23a475(0x26e)]};try{await this['request'](_0x23a475(0x26c),_0x37127f,{'timeoutMs':0x2710,'skipReadyCheck':!![]}),this[_0x23a475(0x259)+'d']=!![],this['reconnec'+_0x23a475(0x285)+'Ms']=0x320,this[_0x23a475(0x25a)+_0x23a475(0x25b)+_0x23a475(0x246)](),this[_0x23a475(0x278)]?.['onConnec'+_0x23a475(0x290)]?.();}catch(_0x50541a){this['handleDi'+'sconnect'](_0x50541a instanceof Error?_0x50541a[_0x23a475(0x27e)]:_0x23a475(0x262)+_0x23a475(0x1d8)+'ct\x20faile'+'d'),this['ws']?.['close'](0x3f0,_0x23a475(0x26f)+'failed');}}[_0x29cb61(0x209)+_0x29cb61(0x1e3)](_0xffccd){const _0x2a8772=_0x29cb61;let _0x1ebf95;try{_0x1ebf95=JSON[_0x2a8772(0x20a)](_0xffccd);}catch{return;}if(!isRecord(_0x1ebf95)||typeof _0x1ebf95[_0x2a8772(0x1f5)]!==_0x2a8772(0x1ed))return;if(_0x1ebf95[_0x2a8772(0x1f5)]==='event'){const _0x5860fa=typeof _0x1ebf95[_0x2a8772(0x1dc)]==='string'?_0x1ebf95[_0x2a8772(0x1dc)]:'';if(!_0x5860fa)return;const _0x493f2e=isRecord(_0x1ebf95[_0x2a8772(0x26a)])?_0x1ebf95[_0x2a8772(0x26a)]:{};if(_0x5860fa===_0x2a8772(0x1eb)+_0x2a8772(0x26b)+'e'){const _0x3ef15f=typeof _0x493f2e[_0x2a8772(0x23e)]==='string'?_0x493f2e['nonce'][_0x2a8772(0x1f4)]():'';if(!_0x3ef15f){this[_0x2a8772(0x1f0)+_0x2a8772(0x271)](_0x2a8772(0x262)+_0x2a8772(0x202)+'hake\x20mis'+'sing\x20non'+'ce'),this['ws']?.['close'](0x3f0,_0x2a8772(0x26f)+_0x2a8772(0x26b)+_0x2a8772(0x22d)+'g\x20nonce');return;}this[_0x2a8772(0x275)+_0x2a8772(0x256)]=_0x3ef15f,void this['sendConn'+_0x2a8772(0x1d9)]();return;}if(_0x5860fa==='chat')this[_0x2a8772(0x278)]?.[_0x2a8772(0x210)+_0x2a8772(0x220)]?.(_0x493f2e);if(_0x5860fa===_0x2a8772(0x233))this[_0x2a8772(0x278)]?.[_0x2a8772(0x230)+_0x2a8772(0x28a)]?.(_0x493f2e);return;}if(_0x1ebf95[_0x2a8772(0x1f5)]!==_0x2a8772(0x27a))return;const _0x127fcb=typeof _0x1ebf95['id']==='string'?_0x1ebf95['id']:'';if(!_0x127fcb)return;const _0xb400db=this['pending'][_0x2a8772(0x245)](_0x127fcb);if(!_0xb400db)return;const _0x240a25=isRecord(_0x1ebf95[_0x2a8772(0x26a)])?_0x1ebf95[_0x2a8772(0x26a)]:{},_0x4df6ee=typeof _0x240a25[_0x2a8772(0x244)]===_0x2a8772(0x1ed)?_0x240a25[_0x2a8772(0x244)]:'';if(_0xb400db['expectFi'+_0x2a8772(0x21e)]&&_0x4df6ee===_0x2a8772(0x1ea))return;this[_0x2a8772(0x1fe)]['delete'](_0x127fcb);_0xb400db['timeout']&&(clearTimeout(_0xb400db[_0x2a8772(0x1e1)]),_0xb400db['timeout']=null);if(_0x1ebf95['ok']===!![]){_0xb400db[_0x2a8772(0x23d)](_0x1ebf95[_0x2a8772(0x26a)]);return;}const _0xef38fe=isRecord(_0x1ebf95['error'])?_0x1ebf95[_0x2a8772(0x287)]:{},_0x3118f7=typeof _0xef38fe[_0x2a8772(0x27e)]===_0x2a8772(0x1ed)?_0xef38fe[_0x2a8772(0x27e)]:'gateway\x20'+_0x2a8772(0x1da)+_0x2a8772(0x263)+_0xb400db['method'];_0xb400db['reject'](new Error(_0x3118f7));}[_0x29cb61(0x1e4)+_0x29cb61(0x247)](_0x32a94f=0x2ee0){const _0x29b0c3=_0x29cb61;if(this[_0x29b0c3(0x259)+'d'])return Promise[_0x29b0c3(0x23d)]();if(!this[_0x29b0c3(0x278)])return Promise[_0x29b0c3(0x242)](new Error('gateway\x20'+_0x29b0c3(0x25e)+_0x29b0c3(0x1f2)+'ured'));if(!this['ws'])this[_0x29b0c3(0x26c)]();return new Promise((_0x57dd49,_0x28afdb)=>{const _0x55f263=setTimeout(()=>{const _0x2b0a70=_0x4b80;this[_0x2b0a70(0x207)+_0x2b0a70(0x211)]=this[_0x2b0a70(0x207)+'ters'][_0x2b0a70(0x24e)](_0x4728fd=>_0x4728fd[_0x2b0a70(0x23d)]!==_0x57dd49),_0x28afdb(new Error(_0x2b0a70(0x262)+_0x2b0a70(0x1d8)+_0x2b0a70(0x24c)+'med\x20out'));},_0x32a94f);this['readyWai'+'ters']['push']({'resolve':_0x57dd49,'reject':_0x28afdb,'timeout':_0x55f263});});}['resolveR'+_0x29cb61(0x25b)+_0x29cb61(0x246)](){const _0x1708f6=_0x29cb61,_0xd955ac=[...this[_0x1708f6(0x207)+_0x1708f6(0x211)]];this[_0x1708f6(0x207)+'ters']=[];for(const _0x4336ca of _0xd955ac){clearTimeout(_0x4336ca[_0x1708f6(0x1e1)]),_0x4336ca['resolve']();}}[_0x29cb61(0x20e)+'adyWaite'+'rs'](_0x35b83b){const _0x1ab73f=_0x29cb61,_0x312bf1=[...this[_0x1ab73f(0x207)+_0x1ab73f(0x211)]];this['readyWai'+_0x1ab73f(0x211)]=[];for(const _0x13ad05 of _0x312bf1){clearTimeout(_0x13ad05[_0x1ab73f(0x1e1)]),_0x13ad05['reject'](_0x35b83b);}}[_0x29cb61(0x281)+'nding'](_0x552891){const _0xe08402=_0x29cb61;for(const [_0x291b67,_0x37e7aa]of this[_0xe08402(0x1fe)][_0xe08402(0x226)]()){this[_0xe08402(0x1fe)][_0xe08402(0x222)](_0x291b67),_0x37e7aa['timeout']&&(clearTimeout(_0x37e7aa[_0xe08402(0x1e1)]),_0x37e7aa['timeout']=null),_0x37e7aa[_0xe08402(0x242)](_0x552891);}}[_0x29cb61(0x1f0)+'sconnect'](_0x27b49b){const _0x1df975=_0x29cb61;this['ws']&&(this['ws'][_0x1df975(0x223)+'lListene'+'rs'](),this['ws']=null);this[_0x1df975(0x259)+'d']=![],this[_0x1df975(0x275)+_0x1df975(0x256)]=null,this['connectS'+_0x1df975(0x220)]=![],this[_0x1df975(0x281)+_0x1df975(0x1e7)](new Error(_0x27b49b||_0x1df975(0x262)+'WS\x20disco'+'nnected')),this[_0x1df975(0x20e)+'adyWaite'+'rs'](new Error(_0x27b49b||_0x1df975(0x262)+_0x1df975(0x289)+_0x1df975(0x200))),this[_0x1df975(0x1f3)+_0x1df975(0x246)]();if(_0x27b49b)this[_0x1df975(0x278)]?.['onDiscon'+_0x1df975(0x219)]?.(_0x27b49b);if(!this['shouldRe'+_0x1df975(0x26c)]||!this['config'])return;const _0x9fa49d=this[_0x1df975(0x201)+_0x1df975(0x285)+'Ms'];this[_0x1df975(0x201)+'tBackoff'+'Ms']=Math[_0x1df975(0x214)](this[_0x1df975(0x201)+'tBackoff'+'Ms']*0x2,0x3a98),this['reconnec'+'tTimer']=setTimeout(()=>{const _0x5c254c=_0x1df975;this[_0x5c254c(0x201)+_0x5c254c(0x1de)]=null,this[_0x5c254c(0x26c)]();},_0x9fa49d);}[_0x29cb61(0x1f3)+_0x29cb61(0x246)](){const _0x533cbb=_0x29cb61;this[_0x533cbb(0x201)+_0x533cbb(0x1de)]&&(clearTimeout(this['reconnec'+_0x533cbb(0x1de)]),this['reconnec'+_0x533cbb(0x1de)]=null),this[_0x533cbb(0x232)+_0x533cbb(0x279)+_0x533cbb(0x1fd)]&&(clearTimeout(this[_0x533cbb(0x232)+_0x533cbb(0x279)+_0x533cbb(0x1fd)]),this[_0x533cbb(0x232)+_0x533cbb(0x279)+_0x533cbb(0x1fd)]=null);}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x856d12,_0x40589e){var _0x5de3e0=_0x383f,_0x4c8e70=_0x856d12();while(!![]){try{var _0x5acce3=-parseInt(_0x5de3e0(0x1f9))/0x1+-parseInt(_0x5de3e0(0x1f6))/0x2+-parseInt(_0x5de3e0(0x1f7))/0x3*(parseInt(_0x5de3e0(0x1f4))/0x4)+-parseInt(_0x5de3e0(0x1fa))/0x5+-parseInt(_0x5de3e0(0x1f8))/0x6*(parseInt(_0x5de3e0(0x1f5))/0x7)+-parseInt(_0x5de3e0(0x1f2))/0x8+parseInt(_0x5de3e0(0x1f3))/0x9;if(_0x5acce3===_0x40589e)break;else _0x4c8e70['push'](_0x4c8e70['shift']());}catch(_0x521bab){_0x4c8e70['push'](_0x4c8e70['shift']());}}}(_0x4df9,0x53d97));export{prepareRuntime,loadRuntimeInfo,spawnClaw,runClawOnce}from'./runtime.mjs';export{createConfigController}from'./config-controller.mjs';function _0x383f(_0x300cf2,_0x3840ef){_0x300cf2=_0x300cf2-0x1f2;var _0x4df9a2=_0x4df9();var _0x383f00=_0x4df9a2[_0x300cf2];return _0x383f00;}export{createGatewayController}from'./gateway-controller.mjs';function _0x4df9(){var _0x238843=['863928kNkAWG','16320456xtpGcm','4456YXPUAy','21cfkWEw','140086truZon','642cmCPVU','770142MPfFYf','59933qeOAwd','3042515PCBnrh'];_0x4df9=function(){return _0x238843;};return _0x4df9();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x4610(_0x1447a1,_0x2c1b26){_0x1447a1=_0x1447a1-0x127;const _0x5bbe38=_0x5bbe();let _0x4610ef=_0x5bbe38[_0x1447a1];return _0x4610ef;}(function(_0xd4d524,_0x2fd120){const _0x5dc713=_0x4610,_0x4f9f43=_0xd4d524();while(!![]){try{const _0x188a9d=-parseInt(_0x5dc713(0x136))/0x1+parseInt(_0x5dc713(0x137))/0x2*(-parseInt(_0x5dc713(0x13a))/0x3)+parseInt(_0x5dc713(0x127))/0x4*(-parseInt(_0x5dc713(0x132))/0x5)+parseInt(_0x5dc713(0x12e))/0x6+-parseInt(_0x5dc713(0x128))/0x7+-parseInt(_0x5dc713(0x135))/0x8*(-parseInt(_0x5dc713(0x134))/0x9)+parseInt(_0x5dc713(0x138))/0xa;if(_0x188a9d===_0x2fd120)break;else _0x4f9f43['push'](_0x4f9f43['shift']());}catch(_0x4d50d7){_0x4f9f43['push'](_0x4f9f43['shift']());}}}(_0x5bbe,0xe557d));import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'./utils.mjs';function _0x5bbe(){const _0x4add98=['378EOvElW','36603040KqvBsj','local','26895VclwEd','382952XPrJWl','1339632EoNwPa','disabled','allow','source','has','installs','1891584lGHvOw','entries','ByDefaul','pluginId','25rujbwz','length','1287baxXIC','9664ondZKt','844472VlDNwy'];_0x5bbe=function(){return _0x4add98;};return _0x5bbe();}export function syncRuntimeManifestPlugins(_0x4edb86,_0xc0336f,_0xb044c4={}){const _0xe1b7d6=_0x4610,_0x3d8149=new Set(_0xb044c4[_0xe1b7d6(0x129)+_0xe1b7d6(0x130)+'tPluginI'+'ds']??[]),_0x20a4dd={...asRecord(_0x4edb86)},_0x3d96c9={...asRecord(_0x20a4dd['entries'])},_0x2aa29a={...asRecord(_0x20a4dd[_0xe1b7d6(0x12d)])};let _0x4ed593=asStringArray(_0x20a4dd[_0xe1b7d6(0x12a)]),_0xdd47a2=![];for(const _0x3c3238 of _0xc0336f??[]){const _0x7c0141=getTrimmedString(_0x3c3238[_0xe1b7d6(0x131)]);if(!_0x7c0141)continue;!(_0x7c0141 in _0x3d96c9)&&(_0x3d96c9[_0x7c0141]={'enabled':!_0x3d8149[_0xe1b7d6(0x12c)](_0x7c0141)},_0xdd47a2=!![]);if(asRecord(_0x3d96c9[_0x7c0141])['enabled']!==![]){const _0xf676ce=dedupeStrings([..._0x4ed593,_0x7c0141]);_0xf676ce[_0xe1b7d6(0x133)]!==_0x4ed593[_0xe1b7d6(0x133)]&&(_0x4ed593=_0xf676ce,_0xdd47a2=!![]);}getTrimmedString(_0x3c3238[_0xe1b7d6(0x12b)])===_0xe1b7d6(0x139)&&_0x7c0141 in _0x2aa29a&&(delete _0x2aa29a[_0x7c0141],_0xdd47a2=!![]);}_0x20a4dd[_0xe1b7d6(0x12f)]=_0x3d96c9,_0x20a4dd['allow']=_0x4ed593;if(Object['keys'](_0x2aa29a)['length']>0x0)_0x20a4dd['installs']=_0x2aa29a;else delete _0x20a4dd['installs'];return{'plugins':_0x20a4dd,'changed':_0xdd47a2};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x30eb08=_0x1abf;(function(_0x5bbb6b,_0x39e2c2){const _0x21678c=_0x1abf,_0x3cacce=_0x5bbb6b();while(!![]){try{const _0x141723=parseInt(_0x21678c(0x16b))/0x1*(-parseInt(_0x21678c(0x1a6))/0x2)+-parseInt(_0x21678c(0x217))/0x3+parseInt(_0x21678c(0x223))/0x4+-parseInt(_0x21678c(0x227))/0x5*(-parseInt(_0x21678c(0x15b))/0x6)+-parseInt(_0x21678c(0x1a1))/0x7*(parseInt(_0x21678c(0x215))/0x8)+parseInt(_0x21678c(0x1c2))/0x9*(parseInt(_0x21678c(0x22d))/0xa)+parseInt(_0x21678c(0x16c))/0xb*(parseInt(_0x21678c(0x209))/0xc);if(_0x141723===_0x39e2c2)break;else _0x3cacce['push'](_0x3cacce['shift']());}catch(_0x161aaa){_0x3cacce['push'](_0x3cacce['shift']());}}}(_0x5833,0x719a1));import{existsSync}from'node:fs';function _0x1abf(_0x229dcc,_0x3e9c28){_0x229dcc=_0x229dcc-0x157;const _0x583360=_0x5833();let _0x1abf02=_0x583360[_0x229dcc];return _0x1abf02;}import{chmod,cp,mkdir,rename,rm,writeFile}from'node:fs/promises';import{delimiter,dirname,join,relative,resolve}from'node:path';import{spawn}from'node:child_process';function _0x5833(){const _0x33047e=['ion','_HOME:-','tarball:','path:\x20','nodeExec','ut\x20after','\x22\x20so\x20the','slice','error','\x20install','@echo\x20of','spec','.opencla','\x20return\x20','eparing\x20','close','red\x20Open','6SQyjad','exec\x20\x22$S','ATE_DIR:','Name','map','-ai\x20runt','IR=$(CDP','und:\x20','w.json\x22','npm\x20pack','parse','claw-run','%USERPRO','\x20signal=','ie-shell','skills','1191reJwdh','143Qgtcpa','ell.','\x22\x20\x22$SCRI','--omit=d','.json','log','wujie-sh','NCLAW_ST','Dir','hell:run','missing\x20','E_DIR=','filename','openclaw','trim','\x20failed\x20','stdout','config=','ame','LocalPlu','\x22\x20at\x20','\x20set\x20\x22OP','JSON:\x20','wujiecla','pid','name','\x20can\x20ins','ecs','null','ATE_DIR%','runtimeR',',\x20shell.','env','\x20resolve','SCRIPT_D','-xzf','stalling','Bin','\x20runtime','e\x20not\x20fo','generate','\x22\x20\x22$@\x22','plugins','\x20returne','extract\x20','time]\x20in','onfigure','startsWi','CRIPT_DI','mismatch','bootstra','skillsDi','NCLAW_HO','99778TvaKgm','w-extrac','Spec','time-too','object','860IjuoAg','installP','has','cwd','\x20did\x20not','extensio','p\x20runtim','tall\x20the','#!/bin/s','SIGTERM','t\x20\x22OPENC','\x20bin\x20was','replaceA','rg/','HOME=\x22${','push','ntime\x20wi','ATH:-','--json','WorkingD','IPT_DIR=','--omit=p','filter','ATH=\x20cd\x20','FILE%\x5c','bin','local','\x20depende','111987oBiJGg','/opencla','ion\x20mism','OME=','Version','load:\x20','source','data','&&\x20pwd)','isArray','ignore','nd\x20after','OPENCLAW','kill','PT_DIR%','toISOStr','d\x20Node\x20v','ENCLAW_H','version','pipe','nodeVers','NFIG_PAT','law\x20','P,\x20prepa','pRuntime','\x20not\x20fou','time','toString','$HOME/','dataDirN','registry','\x20prepare','.\x20For\x20MV','ME%\x22==\x22\x22','runtime-','re\x20wujie','ersion\x20b','R=\x22${OPE','tar','ing\x20\x22','ncies','ime\x20firs','package','product','atch:\x20ma','timeoutM','PENCLAW_','the\x20boot','\x20\x22$0\x22)\x22\x20','CONFIG_P','OpenClaw','manifest','sion.','agents','string','STATE_DI','d\x20to\x20','.npmjs.o','oot','pluginId','projectR','npm\x20inst','[wujie-s','join','productN','w.cmd','appId','--no-fun','runtime\x20','ath','eer','530904BVlayk','split','all\x20','H%\x22==\x22\x22\x20','.cache','pack','if\x20\x22%OPE','unknown','\x22\x20\x22%SCRI','dist','_DIR%','wBin','152QIiYBM','npmCli','2075931qcrXcb','ing','resolved','ginPaths','stderr','utf8','pluginSp','export\x20O','indexOf','utable','npm-glob','https://','2371144HqdjxU','now','Rebuild\x20','PT_DIR/','66455cDTLDw','local:','-peer-de','\x22==\x22\x22\x20se','Configur','.next-','610PfWVEG'];_0x5833=function(){return _0x33047e;};return _0x5833();}import{copyDirFresh,getPackageMetadata,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'./utils.mjs';const RUNTIME_DIR='.tmp/run'+_0x30eb08(0x1dc),MANIFEST_NAME=_0x30eb08(0x1e4)+'manifest'+_0x30eb08(0x170),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x1ca3fa){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x1ca3fa,RUNTIME_DIR);}export function resolveManifestPath(_0x6ea8dd){return join(_0x6ea8dd,MANIFEST_NAME);}export async function prepareRuntime(_0x598021,{syncOnly:syncOnly=![]}={}){const _0x420d65=_0x30eb08,_0x58d803=resolveRuntimeRoot(_0x598021[_0x420d65(0x1fe)+_0x420d65(0x1fc)]),_0x42eaf0=_0x598021[_0x420d65(0x179)][_0x420d65(0x19e)+_0x420d65(0x1da)+_0x420d65(0x174)];if(!existsSync(join(_0x42eaf0,MANIFEST_NAME)))throw new Error(_0x420d65(0x19e)+_0x420d65(0x1ac)+_0x420d65(0x193)+_0x420d65(0x162)+_0x42eaf0+(_0x420d65(0x1e2)+_0x420d65(0x1d9)+_0x420d65(0x1e5)+_0x420d65(0x160)+_0x420d65(0x1eb)+'t.'));(!syncOnly||!existsSync(resolveManifestPath(_0x58d803)))&&await replaceRuntimeFromBootstrap(_0x42eaf0,_0x58d803);const _0x966cc3=await readRuntimeManifest(_0x58d803);validateRuntimeNodeVersion(_0x966cc3,_0x598021);if(syncOnly)validateRuntimeOpenClawVersion(_0x966cc3,_0x598021);else{if(_0x966cc3[_0x420d65(0x179)+_0x420d65(0x1c6)]!==_0x598021['openclaw'][_0x420d65(0x179)+_0x420d65(0x1c6)]){const _0x16a6db=await loadRuntimeInfo(_0x598021[_0x420d65(0x1fe)+_0x420d65(0x1fc)]);await installOpenClawPackage(_0x16a6db,_0x598021[_0x420d65(0x179)][_0x420d65(0x179)+_0x420d65(0x1c6)]),_0x966cc3[_0x420d65(0x179)+_0x420d65(0x1c6)]=_0x598021[_0x420d65(0x179)][_0x420d65(0x179)+_0x420d65(0x1c6)];}}return _0x966cc3[_0x420d65(0x194)+'dAt']=new Date()['toISOStr'+_0x420d65(0x218)](),_0x966cc3[_0x420d65(0x1d6)+_0x420d65(0x22e)]=_0x598021[_0x420d65(0x179)][_0x420d65(0x1d6)+_0x420d65(0x22e)],_0x966cc3[_0x420d65(0x1ed)]={'appId':_0x598021[_0x420d65(0x204)],'productName':_0x598021[_0x420d65(0x202)+_0x420d65(0x17e)],'dataDirName':_0x598021[_0x420d65(0x1df)+_0x420d65(0x17e)]},await syncManifestPluginScope(_0x598021,_0x58d803,_0x966cc3),await syncProductPlugins(_0x598021,_0x58d803,_0x966cc3),await syncProductAgents(_0x598021,_0x58d803,_0x966cc3),await syncProductSkills(_0x598021,_0x58d803,_0x966cc3),await syncRuntimeWrapper(_0x598021,_0x58d803,_0x966cc3),await writeJson(resolveManifestPath(_0x58d803),_0x966cc3),_0x966cc3;}async function syncRuntimeWrapper(_0x9f332d,_0x52dc56,_0x304fca){const _0x2b0fc5=_0x30eb08,_0x1f8137=join(_0x52dc56,_0x2b0fc5(0x1bf),_0x2b0fc5(0x183)+'w'),_0x144ce8=join(_0x52dc56,_0x2b0fc5(0x1bf),_0x2b0fc5(0x183)+_0x2b0fc5(0x203)),_0x5c6ae2=normalizeRuntimeRelativePath(relative(dirname(_0x1f8137),resolve(_0x52dc56,_0x304fca[_0x2b0fc5(0x232)+_0x2b0fc5(0x220)]))),_0x46bb45=normalizeRuntimeRelativePath(relative(dirname(_0x1f8137),resolve(_0x52dc56,_0x304fca[_0x2b0fc5(0x179)+_0x2b0fc5(0x191)]))),_0x21cfc2=_0x2b0fc5(0x1de)+_0x9f332d[_0x2b0fc5(0x1df)+_0x2b0fc5(0x17e)],_0x15a72a=_0x2b0fc5(0x167)+_0x2b0fc5(0x1be)+_0x9f332d[_0x2b0fc5(0x1df)+_0x2b0fc5(0x17e)];await mkdir(dirname(_0x1f8137),{'recursive':!![]}),await writeFile(_0x1f8137,[_0x2b0fc5(0x1ae)+'h','export\x20O'+_0x2b0fc5(0x1f0)+_0x2b0fc5(0x1b4)+_0x2b0fc5(0x1ce)+_0x2b0fc5(0x22f)+_0x21cfc2+'}\x22',_0x2b0fc5(0x21e)+_0x2b0fc5(0x1f0)+_0x2b0fc5(0x1f9)+_0x2b0fc5(0x1e7)+_0x2b0fc5(0x173)+_0x2b0fc5(0x15d)+'-'+_0x21cfc2+'}\x22',_0x2b0fc5(0x21e)+'PENCLAW_'+_0x2b0fc5(0x1f3)+'ATH=\x22${O'+'PENCLAW_'+_0x2b0fc5(0x1f3)+_0x2b0fc5(0x1b7)+_0x21cfc2+(_0x2b0fc5(0x1c3)+'w.json}\x22'),_0x2b0fc5(0x18e)+_0x2b0fc5(0x161)+_0x2b0fc5(0x1bd)+'--\x20\x22$(di'+'rname\x20--'+_0x2b0fc5(0x1f2)+_0x2b0fc5(0x1ca),_0x2b0fc5(0x15c)+_0x2b0fc5(0x19c)+'R/'+_0x5c6ae2+(_0x2b0fc5(0x16e)+_0x2b0fc5(0x226))+_0x46bb45+_0x2b0fc5(0x195),''][_0x2b0fc5(0x201)]('\x0a'),_0x2b0fc5(0x21c)),await chmod(_0x1f8137,0x1ed),await writeFile(_0x144ce8,[_0x2b0fc5(0x238)+'f',_0x2b0fc5(0x20f)+_0x2b0fc5(0x1a0)+_0x2b0fc5(0x1e3)+_0x2b0fc5(0x181)+_0x2b0fc5(0x1d3)+_0x2b0fc5(0x1c5)+_0x15a72a+'\x22',_0x2b0fc5(0x20f)+_0x2b0fc5(0x173)+_0x2b0fc5(0x189)+_0x2b0fc5(0x22a)+_0x2b0fc5(0x1b0)+'LAW_STAT'+_0x2b0fc5(0x177)+_0x15a72a+'\x22','if\x20\x22%OPE'+'NCLAW_CO'+_0x2b0fc5(0x1d7)+_0x2b0fc5(0x20c)+'set\x20\x22OPE'+'NCLAW_CO'+_0x2b0fc5(0x1d7)+'H='+_0x15a72a+('\x5copencla'+_0x2b0fc5(0x163)),'set\x20\x22SCR'+_0x2b0fc5(0x1ba)+'%~dp0\x22','\x22%SCRIPT'+_0x2b0fc5(0x213)+toWindowsPath(_0x5c6ae2)+(_0x2b0fc5(0x211)+_0x2b0fc5(0x1d0))+toWindowsPath(_0x46bb45)+'\x22\x20%*',''][_0x2b0fc5(0x201)]('\x0d\x0a'),_0x2b0fc5(0x21c)),_0x304fca[_0x2b0fc5(0x183)+_0x2b0fc5(0x214)]=toRuntimeRelative(_0x52dc56,process['platform']==='win32'?_0x144ce8:_0x1f8137);}function normalizeRuntimeRelativePath(_0xc3cab7){return _0xc3cab7['replaceA'+'ll']('\x5c','/');}function toWindowsPath(_0x15ff8d){const _0x2e8154=_0x30eb08;return _0x15ff8d[_0x2e8154(0x1b2)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x58d55d,_0x34e9c0){const _0x5db5bc=_0x30eb08;if(_0x58d55d[_0x5db5bc(0x1d6)+_0x5db5bc(0x22e)]===_0x34e9c0[_0x5db5bc(0x179)][_0x5db5bc(0x1d6)+_0x5db5bc(0x22e)])return;throw new Error(_0x5db5bc(0x206)+_0x5db5bc(0x1d6)+_0x5db5bc(0x1c4)+_0x5db5bc(0x1ee)+'nifest='+(_0x58d55d['nodeVers'+'ion']||'unknown')+(_0x5db5bc(0x18b)+'config=')+_0x34e9c0[_0x5db5bc(0x179)][_0x5db5bc(0x1d6)+_0x5db5bc(0x22e)]+'.\x20'+(_0x5db5bc(0x225)+_0x5db5bc(0x1f1)+'strap\x20ru'+_0x5db5bc(0x1b6)+'th\x20the\x20c'+_0x5db5bc(0x19a)+_0x5db5bc(0x1d2)+_0x5db5bc(0x1e6)+'efore\x20pr'+_0x5db5bc(0x158)+_0x5db5bc(0x172)+_0x5db5bc(0x16d)));}function validateRuntimeOpenClawVersion(_0x4067f6,_0x226de0){const _0x447dc5=_0x30eb08;if(_0x4067f6[_0x447dc5(0x179)+'Version']===_0x226de0['openclaw']['openclaw'+'Version'])return;throw new Error(_0x447dc5(0x206)+_0x447dc5(0x179)+'Version\x20'+_0x447dc5(0x19d)+':\x20manife'+'st='+(_0x4067f6['openclaw'+'Version']||'unknown')+(_0x447dc5(0x18b)+_0x447dc5(0x17d))+_0x226de0[_0x447dc5(0x179)][_0x447dc5(0x179)+_0x447dc5(0x1c6)]+'.\x20'+('Run\x20\x22wuj'+_0x447dc5(0x169)+_0x447dc5(0x1e1)+_0x447dc5(0x234)+_0x447dc5(0x192)+_0x447dc5(0x186)+_0x447dc5(0x1ad)+'\x20configu'+_0x447dc5(0x15a)+'Claw\x20ver'+_0x447dc5(0x1f6)));}function parseNpmPackJson(_0x3c7cd6){const _0x35955f=_0x30eb08,_0x44b6bb=_0x3c7cd6[_0x35955f(0x17a)](),_0x2fabb7=_0x44b6bb[_0x35955f(0x21f)]('[');if(_0x2fabb7<0x0)throw new Error(_0x35955f(0x164)+_0x35955f(0x1aa)+_0x35955f(0x157)+_0x35955f(0x182)+_0x44b6bb[_0x35955f(0x235)](0x0,0x1f4));const _0x1c26de=JSON[_0x35955f(0x165)](_0x44b6bb[_0x35955f(0x235)](_0x2fabb7)),_0x3161e1=Array[_0x35955f(0x1cb)](_0x1c26de)?_0x1c26de[0x0]:_0x1c26de;if(!_0x3161e1||typeof _0x3161e1!==_0x35955f(0x1a5))throw new Error(_0x35955f(0x164)+_0x35955f(0x197)+'d\x20an\x20inv'+'alid\x20pay'+_0x35955f(0x1c7)+_0x44b6bb[_0x35955f(0x235)](0x0,0x1f4));return _0x3161e1;}async function runProcess(_0x50b729,_0x31f5a8,_0xf3e2f4={}){const _0x450717=_0x30eb08,_0x31376d=_0xf3e2f4['label']||[_0x50b729,..._0x31f5a8]['join']('\x20'),_0x2ad346=_0xf3e2f4[_0x450717(0x1ef)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x775971=spawn(_0x50b729,_0x31f5a8,{'cwd':_0xf3e2f4[_0x450717(0x1a9)],'env':_0xf3e2f4[_0x450717(0x18c)],'stdio':[_0x450717(0x1cc),'pipe',_0x450717(0x1d5)]});return await new Promise((_0x409e6f,_0xbfb432)=>{const _0x309347=_0x450717;let _0x498de3='',_0x3c49d1='',_0x475304=![];const _0x4dd470=setTimeout(()=>{const _0x86181e=_0x1abf;if(_0x475304)return;_0x475304=!![],_0x775971['kill'](_0x86181e(0x1af)),_0xbfb432(new Error(_0x31376d+('\x20timed\x20o'+_0x86181e(0x233)+'\x20')+_0x2ad346+'ms'));},_0x2ad346);_0x775971[_0x309347(0x17c)]['on'](_0x309347(0x1c9),_0x27c9ed=>{const _0x496976=_0x309347;_0x498de3+=_0x27c9ed[_0x496976(0x1dd)]();}),_0x775971[_0x309347(0x21b)]['on']('data',_0x47920a=>{const _0x1c7187=_0x309347;_0x3c49d1+=_0x47920a[_0x1c7187(0x1dd)]();}),_0x775971['on'](_0x309347(0x236),_0x2d4984=>{if(_0x475304)return;_0x475304=!![],clearTimeout(_0x4dd470),_0xbfb432(_0x2d4984);}),_0x775971['on'](_0x309347(0x159),(_0x2bc968,_0x458efd)=>{const _0x4febb6=_0x309347;if(_0x475304)return;_0x475304=!![],clearTimeout(_0x4dd470);if(_0x2bc968===0x0){_0x409e6f({'stdout':_0x498de3,'stderr':_0x3c49d1});return;}_0xbfb432(new Error(_0x31376d+(_0x4febb6(0x17b)+'with\x20cod'+'e=')+(_0x2bc968??_0x4febb6(0x188))+_0x4febb6(0x168)+(_0x458efd??_0x4febb6(0x188))+'\x0a'+(''+(_0x3c49d1||_0x498de3))['trim']()));});});}async function installOpenClawPackage(_0xeedaae,_0x4811ce){const _0xfa1204=_0x30eb08,_0x20bf09=join(_0xeedaae[_0xfa1204(0x18a)+_0xfa1204(0x1fc)],_0xfa1204(0x20d)),_0x13f69f=join(_0xeedaae[_0xfa1204(0x18a)+_0xfa1204(0x1fc)],_0xfa1204(0x23a)+_0xfa1204(0x1a2)+'t');await mkdir(_0x20bf09,{'recursive':!![]}),await rm(_0x13f69f,{'recursive':!![],'force':!![]}),await mkdir(_0x13f69f,{'recursive':!![]});const _0x5902bc=await createRuntimeEnv(_0xeedaae),_0x32a2f6='openclaw'+'@'+_0x4811ce;console[_0xfa1204(0x171)](_0xfa1204(0x200)+_0xfa1204(0x175)+_0xfa1204(0x199)+_0xfa1204(0x190)+'\x20'+_0x32a2f6);const _0x7c2ac6=await runProcess(_0xeedaae[_0xfa1204(0x232)+'utable'],[_0xeedaae[_0xfa1204(0x216)],_0xfa1204(0x20e),_0x32a2f6,_0xfa1204(0x1b8)],{'cwd':_0x20bf09,'env':_0x5902bc,'label':'npm\x20pack'+'\x20'+_0x32a2f6}),_0x4d4cec=parseNpmPackJson(_0x7c2ac6[_0xfa1204(0x17c)]);if(_0x4d4cec[_0xfa1204(0x1d4)]!==_0x4811ce)throw new Error(_0xfa1204(0x22b)+'ed\x20OpenC'+_0xfa1204(0x1d8)+_0x4811ce+(_0xfa1204(0x18d)+_0xfa1204(0x1fa))+_0x4d4cec[_0xfa1204(0x1d4)]);const _0x293814=resolve(_0x20bf09,_0x4d4cec[_0xfa1204(0x178)]);if(!existsSync(_0x293814))throw new Error(_0xfa1204(0x164)+_0xfa1204(0x1aa)+'\x20create\x20'+_0xfa1204(0x230)+'\x20'+_0x293814);await runProcess(_0xfa1204(0x1e8),[_0xfa1204(0x18f),_0x293814,'-C',_0x13f69f],{'label':_0xfa1204(0x198)+_0x4d4cec[_0xfa1204(0x178)]}),await rm(_0xeedaae[_0xfa1204(0x179)+'WorkingD'+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x13f69f,_0xfa1204(0x1ec)),_0xeedaae[_0xfa1204(0x179)+_0xfa1204(0x1b9)+'ir']),await rm(_0x13f69f,{'recursive':!![],'force':!![]}),await runProcess(_0xeedaae['nodeExec'+_0xfa1204(0x220)],[_0xeedaae['npmCli'],'install',_0xfa1204(0x16f)+'ev',_0xfa1204(0x1bb)+_0xfa1204(0x208),'--no-aud'+'it',_0xfa1204(0x205)+'d','--legacy'+_0xfa1204(0x229)+'ps'],{'cwd':_0xeedaae[_0xfa1204(0x179)+_0xfa1204(0x1b9)+'ir'],'env':_0x5902bc,'label':_0xfa1204(0x1ff)+_0xfa1204(0x20b)+_0x32a2f6+(_0xfa1204(0x192)+_0xfa1204(0x1c1)+_0xfa1204(0x1ea))});if(!existsSync(_0xeedaae['openclaw'+_0xfa1204(0x191)]))throw new Error(_0xfa1204(0x1f4)+_0xfa1204(0x1b1)+_0xfa1204(0x1db)+_0xfa1204(0x1cd)+_0xfa1204(0x237)+':\x20'+_0xeedaae[_0xfa1204(0x179)+_0xfa1204(0x191)]);}async function replaceRuntimeFromBootstrap(_0x4533dd,_0x3e7059){const _0x17adfb=_0x30eb08;await mkdir(dirname(_0x3e7059),{'recursive':!![]});const _0x10ae68=_0x3e7059+_0x17adfb(0x22c)+process['pid']+'-'+Date['now'](),_0x339ff9=_0x3e7059+'.old-'+process[_0x17adfb(0x184)]+'-'+Date[_0x17adfb(0x224)]();await rm(_0x10ae68,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await rm(_0x339ff9,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await cp(_0x4533dd,_0x10ae68,{'recursive':!![],'force':!![]}),existsSync(_0x3e7059)&&(await rm(_0x339ff9,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await rename(_0x3e7059,_0x339ff9)),await rename(_0x10ae68,_0x3e7059),await rm(_0x339ff9,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});}export async function readRuntimeManifest(_0x30b1a8){return await readJson(resolveManifestPath(_0x30b1a8),{});}export async function loadRuntimeInfo(_0x38b430){const _0x6f727=_0x30eb08,_0x1fede7=resolveRuntimeRoot(_0x38b430),_0x17c5f5=await readRuntimeManifest(_0x1fede7);for(const _0x3c8a4a of[_0x6f727(0x232)+_0x6f727(0x220),_0x6f727(0x216),_0x6f727(0x179)+_0x6f727(0x1b9)+'ir','openclaw'+'Bin']){if(typeof _0x17c5f5[_0x3c8a4a]!==_0x6f727(0x1f8)||!_0x17c5f5[_0x3c8a4a][_0x6f727(0x17a)]())throw new Error(_0x6f727(0x206)+_0x6f727(0x1f5)+'\x20is\x20miss'+_0x6f727(0x1e9)+_0x3c8a4a+_0x6f727(0x180)+resolveManifestPath(_0x1fede7)+(';\x20run\x20wu'+'jie-shel'+'l\x20prepar'+'e'));}const _0x38ff8e=resolve(_0x1fede7,_0x17c5f5[_0x6f727(0x232)+_0x6f727(0x220)]),_0x81f381=resolve(_0x1fede7,_0x17c5f5['npmCli']),_0x17d271=resolve(_0x1fede7,_0x17c5f5[_0x6f727(0x179)+'WorkingD'+'ir']),_0xc96379=resolve(_0x1fede7,_0x17c5f5[_0x6f727(0x179)+'Bin']),_0x3bc4b0=Array[_0x6f727(0x1cb)](_0x17c5f5['plugins'])?_0x17c5f5[_0x6f727(0x196)]['map'](_0x1b5807=>({..._0x1b5807,'installPath':resolve(_0x1fede7,_0x1b5807['installP'+_0x6f727(0x207)])})):[];for(const _0x8b7ea1 of[_0x38ff8e,_0x81f381,_0x17d271,_0xc96379]){if(!existsSync(_0x8b7ea1))throw new Error(_0x6f727(0x206)+_0x6f727(0x176)+_0x6f727(0x231)+_0x8b7ea1);}return{'runtimeRoot':_0x1fede7,'manifest':_0x17c5f5,'openclawVersion':_0x17c5f5[_0x6f727(0x179)+'Version']||_0x6f727(0x210),'nodeExecutable':_0x38ff8e,'npmCli':_0x81f381,'openclawWorkingDir':_0x17d271,'openclawBin':_0xc96379,'plugins':_0x3bc4b0};}export async function spawnClaw(_0x328e0c,_0x867c10=[],_0x1804ad={}){const _0x40b3ac=_0x30eb08,_0x16dde4=await loadRuntimeInfo(_0x328e0c),_0x44cd85=await createRuntimeEnv(_0x16dde4,_0x1804ad[_0x40b3ac(0x18c)]??{});return spawn(_0x16dde4[_0x40b3ac(0x232)+_0x40b3ac(0x220)],[_0x16dde4[_0x40b3ac(0x179)+'Bin'],..._0x867c10],{'cwd':_0x16dde4[_0x40b3ac(0x179)+_0x40b3ac(0x1b9)+'ir'],'stdio':'pipe',..._0x1804ad,'env':_0x44cd85});}export async function runClawOnce(_0x20a4e9,_0x9ddaed=[],_0x50c1ea=0x15f90){const _0xce7671=await spawnClaw(_0x20a4e9,_0x9ddaed);return await new Promise((_0x2d38b7,_0x506e70)=>{const _0x33c8d3=_0x1abf;let _0x51ce05='',_0x510ef7='',_0x20316e=![];const _0x3a104e=setTimeout(()=>{const _0x5521ea=_0x1abf;if(_0x20316e)return;_0x20316e=!![],_0xce7671[_0x5521ea(0x1cf)](_0x5521ea(0x1af)),_0x506e70(new Error('openclaw'+'\x20timed\x20o'+'ut\x20after'+'\x20'+_0x50c1ea+'ms'));},_0x50c1ea);_0xce7671['stdout']['on'](_0x33c8d3(0x1c9),_0x2c6040=>{_0x51ce05+=_0x2c6040['toString']();}),_0xce7671[_0x33c8d3(0x21b)]['on'](_0x33c8d3(0x1c9),_0x524220=>{const _0x310d46=_0x33c8d3;_0x510ef7+=_0x524220[_0x310d46(0x1dd)]();}),_0xce7671['on'](_0x33c8d3(0x236),_0x2e97f8=>{if(_0x20316e)return;_0x20316e=!![],clearTimeout(_0x3a104e),_0x506e70(_0x2e97f8);}),_0xce7671['on'](_0x33c8d3(0x159),(_0x5785ae,_0x497ad8)=>{if(_0x20316e)return;_0x20316e=!![],clearTimeout(_0x3a104e),_0x2d38b7({'code':_0x5785ae,'signal':_0x497ad8,'stdout':_0x51ce05,'stderr':_0x510ef7});});});}async function createRuntimeEnv(_0x230d10,_0x123672={}){const _0x20b4c3=_0x30eb08,_0x316ac1=process.env.OPENCLAW_STATE_DIR||'',_0x59f9c1=_0x316ac1?join(_0x316ac1,_0x20b4c3(0x166)+_0x20b4c3(0x1a4)+'ls'):join(_0x230d10[_0x20b4c3(0x18a)+_0x20b4c3(0x1fc)],'.tools'),_0xa22594=join(_0x59f9c1,_0x20b4c3(0x221)+'al'),_0x58102f=join(_0x59f9c1,'npm-cach'+'e'),_0x4995ab=join(_0xa22594,_0x20b4c3(0x1bf));await mkdir(_0x4995ab,{'recursive':!![]}),await mkdir(_0x58102f,{'recursive':!![]});const _0x1719ad=[_0x4995ab,dirname(_0x230d10[_0x20b4c3(0x232)+_0x20b4c3(0x220)]),process.env.PATH||''];return{...process.env,..._0x123672,'PATH':_0x1719ad[_0x20b4c3(0x1bc)](Boolean)[_0x20b4c3(0x201)](delimiter),'npm_config_prefix':_0xa22594,'NPM_CONFIG_PREFIX':_0xa22594,'npm_config_cache':_0x58102f,'NPM_CONFIG_CACHE':_0x58102f,'npm_config_registry':'https://'+_0x20b4c3(0x1e0)+'.npmjs.o'+_0x20b4c3(0x1b3),'NPM_CONFIG_REGISTRY':_0x20b4c3(0x222)+_0x20b4c3(0x1e0)+_0x20b4c3(0x1fb)+_0x20b4c3(0x1b3),'npm_execpath':_0x230d10['npmCli'],'npm_node_execpath':_0x230d10['nodeExec'+_0x20b4c3(0x220)],'OPENCLAW_RUNTIME_NPM_PREFIX':_0xa22594,'OPENCLAW_RUNTIME_NPM_BIN':_0x4995ab,'OPENCLAW_RUNTIME_NPM_REGISTRY':'https://'+_0x20b4c3(0x1e0)+_0x20b4c3(0x1fb)+'rg/'};}async function syncProductPlugins(_0x23e1fa,_0x2522e2,_0x361c7e){const _0x21948a=_0x30eb08,_0x4f54ad=join(_0x2522e2,'openclaw',_0x21948a(0x212),'extensio'+'ns'),_0x4561bd=[];for(const _0x34dcfa of _0x23e1fa[_0x21948a(0x179)]['resolved'+_0x21948a(0x17f)+_0x21948a(0x21a)]){const _0x45a572=await getPackageMetadata(_0x34dcfa),_0x5ac15a=await readPluginManifest(_0x34dcfa),_0x3412db=join(_0x4f54ad,_0x45a572[_0x21948a(0x1fd)]);await copyDirFresh(_0x34dcfa,_0x3412db),_0x4561bd[_0x21948a(0x1b5)]({'pluginId':_0x45a572['pluginId'],'source':_0x21948a(0x1c0),'spec':_0x21948a(0x228)+_0x34dcfa,'installPath':toRuntimeRelative(_0x2522e2,_0x3412db),'version':_0x45a572['version'],'resolvedName':_0x45a572[_0x21948a(0x185)],'resolvedVersion':_0x45a572[_0x21948a(0x1d4)],'resolvedSpec':'local:'+_0x34dcfa,'integrity':'','shasum':'','resolvedAt':new Date()[_0x21948a(0x1d1)+_0x21948a(0x218)](),'installedAt':new Date()[_0x21948a(0x1d1)+_0x21948a(0x218)](),'agentScope':_0x5ac15a['agentSco'+'pe'],'skills':_0x5ac15a['skills']});}const _0x256be8=new Set(_0x4561bd[_0x21948a(0x15f)](_0x38045e=>_0x38045e[_0x21948a(0x1fd)])),_0x16a73f=Array[_0x21948a(0x1cb)](_0x361c7e['plugins'])?_0x361c7e[_0x21948a(0x196)][_0x21948a(0x1bc)](_0x951705=>!_0x256be8['has'](_0x951705['pluginId'])):[];_0x361c7e['plugins']=[..._0x16a73f,..._0x4561bd];}async function syncManifestPluginScope(_0x58b829,_0x331ba6,_0x4f534a){const _0x12e006=_0x30eb08,_0x1efa23=join(_0x331ba6,_0x12e006(0x179),_0x12e006(0x212),_0x12e006(0x1ab)+'ns'),_0x33f68f=new Set(_0x58b829[_0x12e006(0x179)]['pluginSp'+_0x12e006(0x187)]??[]),_0x2b2681=new Set([..._0x33f68f][_0x12e006(0x15f)](_0x377ac6=>_0x377ac6['replace'](/^npm:/,''))['map'](_0x556270=>{const _0x271148=_0x12e006;if(_0x556270[_0x271148(0x19b)+'th']('@')){const _0x533302=_0x556270[_0x271148(0x20a)]('@');return _0x533302['length']>=0x3?'@'+_0x533302[0x1]:_0x556270;}return _0x556270[_0x271148(0x20a)]('@')[0x0];})['filter'](Boolean)),_0x2ff878=new Set();for(const _0x117653 of _0x58b829[_0x12e006(0x179)][_0x12e006(0x219)+_0x12e006(0x17f)+'ginPaths']){const _0x574617=await getPackageMetadata(_0x117653);if(_0x574617[_0x12e006(0x1fd)])_0x2ff878['add'](_0x574617[_0x12e006(0x1fd)]);}const _0x59a3b7=Array[_0x12e006(0x1cb)](_0x4f534a[_0x12e006(0x196)])?_0x4f534a[_0x12e006(0x196)]:[];_0x4f534a[_0x12e006(0x21d)+_0x12e006(0x187)]=[..._0x58b829[_0x12e006(0x179)]['pluginSp'+'ecs'],..._0x58b829[_0x12e006(0x179)][_0x12e006(0x219)+_0x12e006(0x17f)+_0x12e006(0x21a)][_0x12e006(0x15f)](_0x369569=>_0x12e006(0x228)+_0x369569)],_0x4f534a[_0x12e006(0x196)]=_0x59a3b7[_0x12e006(0x1bc)](_0x417741=>{const _0x36aa6d=_0x12e006;if(!_0x417741||typeof _0x417741!==_0x36aa6d(0x1a5))return![];if(_0x417741[_0x36aa6d(0x1c8)]===_0x36aa6d(0x1c0))return _0x2ff878[_0x36aa6d(0x1a8)](_0x417741[_0x36aa6d(0x1fd)]);if(_0x417741[_0x36aa6d(0x1c8)]==='npm')return _0x33f68f[_0x36aa6d(0x1a8)](_0x417741[_0x36aa6d(0x239)])||_0x33f68f[_0x36aa6d(0x1a8)](_0x417741[_0x36aa6d(0x219)+_0x36aa6d(0x1a3)])||_0x2b2681['has'](_0x417741[_0x36aa6d(0x219)+_0x36aa6d(0x15e)]);return![];});const _0xeedbb=new Set(_0x4f534a[_0x12e006(0x196)]['map'](_0x64e4a1=>_0x64e4a1['pluginId']));for(const _0x54a3a1 of _0x59a3b7){if(!_0x54a3a1[_0x12e006(0x1fd)]||_0xeedbb[_0x12e006(0x1a8)](_0x54a3a1[_0x12e006(0x1fd)]))continue;const _0x461400=typeof _0x54a3a1[_0x12e006(0x1a7)+_0x12e006(0x207)]===_0x12e006(0x1f8)&&_0x54a3a1[_0x12e006(0x1a7)+_0x12e006(0x207)][_0x12e006(0x17a)]()?resolve(_0x331ba6,_0x54a3a1[_0x12e006(0x1a7)+_0x12e006(0x207)]):join(_0x1efa23,_0x54a3a1[_0x12e006(0x1fd)]),_0x5ed49c=relative(_0x1efa23,_0x461400);if(_0x5ed49c[_0x12e006(0x19b)+'th']('..')||_0x5ed49c==='')continue;await rm(_0x461400,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x42a9c8,_0x4da7be,_0x3a3fe0){const _0x334587=_0x30eb08,_0x1311b4=join(_0x4da7be,_0x334587(0x179),'agents');await copyDirFresh(_0x42a9c8[_0x334587(0x179)]['agentsDi'+'r'],_0x1311b4),_0x3a3fe0[_0x334587(0x1f7)]={'source':_0x334587(0x1ed),'installPath':toRuntimeRelative(_0x4da7be,_0x1311b4)};}async function syncProductSkills(_0x17698e,_0x26988a,_0x4a3a6a){const _0x5162ac=_0x30eb08,_0x534a84=join(_0x26988a,_0x5162ac(0x179),_0x5162ac(0x16a));await copyDirFresh(_0x17698e[_0x5162ac(0x179)][_0x5162ac(0x19f)+'r'],_0x534a84),_0x4a3a6a['skills']={'source':_0x5162ac(0x1ed),'installPath':toRuntimeRelative(_0x26988a,_0x534a84)};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x3c0718,_0x1996d9){const _0xe57436=_0x2d96,_0x5b4fe9=_0x3c0718();while(!![]){try{const _0x36a931=parseInt(_0xe57436(0x197))/0x1+parseInt(_0xe57436(0x198))/0x2*(-parseInt(_0xe57436(0x1a1))/0x3)+parseInt(_0xe57436(0x191))/0x4*(parseInt(_0xe57436(0x19f))/0x5)+-parseInt(_0xe57436(0x1a3))/0x6+-parseInt(_0xe57436(0x194))/0x7+parseInt(_0xe57436(0x1a0))/0x8+-parseInt(_0xe57436(0x1a2))/0x9*(-parseInt(_0xe57436(0x193))/0xa);if(_0x36a931===_0x1996d9)break;else _0x5b4fe9['push'](_0x5b4fe9['shift']());}catch(_0x4e124b){_0x5b4fe9['push'](_0x5b4fe9['shift']());}}}(_0x3f78,0x3ee46));import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';import{basename,dirname,join,relative}from'node:path';function _0x2d96(_0x2acbf9,_0x21741c){_0x2acbf9=_0x2acbf9-0x18e;const _0x3f78c7=_0x3f78();let _0x2d9662=_0x3f78c7[_0x2acbf9];return _0x2d9662;}export function asRecord(_0x467348){const _0x37934b=_0x2d96;return _0x467348&&typeof _0x467348===_0x37934b(0x1a4)&&!Array[_0x37934b(0x1a6)](_0x467348)?_0x467348:{};}export function asStringArray(_0x180383){const _0xcbf41f=_0x2d96;return Array[_0xcbf41f(0x1a6)](_0x180383)?_0x180383[_0xcbf41f(0x18f)](_0x1a9c0e=>typeof _0x1a9c0e==='string'&&_0x1a9c0e[_0xcbf41f(0x1a7)]())['map'](_0x2b8687=>_0x2b8687[_0xcbf41f(0x1a7)]()):[];}export function dedupeStrings(_0x51668d){const _0x242b65=_0x2d96;return[...new Set(_0x51668d[_0x242b65(0x18f)](Boolean))];}export function getTrimmedString(_0x435701){const _0x2301a7=_0x2d96;return typeof _0x435701==='string'?_0x435701[_0x2301a7(0x1a7)]():'';}export async function readJson(_0x422ef3,_0x3bf230={}){const _0x143411=_0x2d96;try{return JSON[_0x143411(0x195)](await readFile(_0x422ef3,_0x143411(0x192)));}catch{return _0x3bf230;}}export async function writeJson(_0x4947d7,_0x41c535){await mkdir(dirname(_0x4947d7),{'recursive':!![]}),await writeFile(_0x4947d7,JSON['stringif'+'y'](_0x41c535,null,0x2)+'\x0a','utf8');}export async function copyDirFresh(_0x2b88c1,_0x460daf){await rm(_0x460daf,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x460daf),{'recursive':!![]}),await cp(_0x2b88c1,_0x460daf,{'recursive':!![]});}export async function ensureDir(_0x299f7e){await mkdir(_0x299f7e,{'recursive':!![]});}export function pathExists(_0x4c614b){return existsSync(_0x4c614b);}export async function listDirs(_0xa33145){const _0x27ca5d=_0x2d96;try{const _0x3f24a1=await readdir(_0xa33145,{'withFileTypes':!![],'encoding':'utf8'});return _0x3f24a1[_0x27ca5d(0x18f)](_0x88b97b=>_0x88b97b[_0x27ca5d(0x190)+_0x27ca5d(0x19a)]())[_0x27ca5d(0x199)](_0x268917=>_0x268917[_0x27ca5d(0x19b)]);}catch{return[];}}export async function getPackageMetadata(_0x3127a7){const _0x34f99f=_0x2d96,_0x31b04c=await readJson(join(_0x3127a7,_0x34f99f(0x19d)+_0x34f99f(0x1a5)),{}),_0x7173c7=asRecord(_0x31b04c[_0x34f99f(0x196)]);return{'name':getTrimmedString(_0x31b04c[_0x34f99f(0x19b)])||basename(_0x3127a7),'version':getTrimmedString(_0x31b04c[_0x34f99f(0x1a8)])||_0x34f99f(0x18e),'pluginId':getTrimmedString(_0x7173c7['id'])||getTrimmedString(_0x31b04c[_0x34f99f(0x196)+'Id'])||basename(_0x3127a7)};}export async function readPluginManifest(_0x1c8b99){const _0x1cdfdc=_0x2d96,_0x45c970=join(_0x1c8b99,_0x1cdfdc(0x196)+'.plugin.'+'json'),_0x5268b4=await readJson(_0x45c970,{});return asRecord(_0x5268b4);}export async function hasFile(_0x299793){const _0x567fa3=_0x2d96;try{const _0x28a2b6=await stat(_0x299793);return _0x28a2b6[_0x567fa3(0x19c)]();}catch{return![];}}function _0x3f78(){const _0x471946=['1640484Fhiovk','234438ATmjRL','object','json','isArray','trim','version','0.0.0','filter','isDirect','324DyCUcu','utf8','30IqNgUF','2846599zMhbIm','parse','openclaw','370203qCGzDS','2xOzJAI','map','ory','name','isFile','package.','replaceA','7765hIsock','65104AsTTdg','1042878VgkQVY'];_0x3f78=function(){return _0x471946;};return _0x3f78();}export function toRuntimeRelative(_0xc5b6bd,_0x557a62){const _0x3ba03d=_0x2d96;return relative(_0xc5b6bd,_0x557a62)[_0x3ba03d(0x19e)+'ll']('\x5c','/');}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wujie-shell/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/src/index.mjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"wujie-source": "./src/index.mjs",
|
|
9
|
+
"default": "./dist/src/index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"./electron": {
|
|
12
|
+
"wujie-source": "./src/electron/main.mjs",
|
|
13
|
+
"default": "./dist/src/electron/main.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./runtime": {
|
|
16
|
+
"wujie-source": "./src/runtime.mjs",
|
|
17
|
+
"default": "./dist/src/runtime.mjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"wujie-shell": "dist/bin/wujie-shell.mjs"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"get-port": "^7.2.0",
|
|
29
|
+
"ws": "^8.20.0",
|
|
30
|
+
"@wujie-shell/config": "0.1.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "node ../../scripts/build-packages.mjs --package @wujie-shell/core"
|
|
34
|
+
}
|
|
35
|
+
}
|