@wujie-shell/core 0.1.4 → 1.0.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/dist/assets/wujie-logo.mjs +258 -0
- package/dist/bin/wujie-shell.mjs +1 -1
- package/dist/src/bundled-agent-skills.mjs +1 -1
- package/dist/src/bundled-agents.mjs +1 -1
- package/dist/src/config-controller.mjs +1 -1
- package/dist/src/electron/main.mjs +1 -1
- package/dist/src/electron/preload.mjs +1 -1
- package/dist/src/gateway-controller.mjs +1 -1
- package/dist/src/gateway-ws.mjs +1 -1
- package/dist/src/index.mjs +1 -1
- package/dist/src/logging.mjs +1 -1
- package/dist/src/plugin-sync.mjs +1 -1
- package/dist/src/runtime-logger.mjs +1 -1
- package/dist/src/runtime.mjs +1 -1
- package/dist/src/utils.mjs +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wujie Shell terminal startup logo - the 无界 door morphs into a ">".
|
|
3
|
+
*
|
|
4
|
+
* Zero-dependency Node module. Renders the animation at the cursor position
|
|
5
|
+
* using half-block characters and truecolor ANSI (dark backgrounds).
|
|
6
|
+
*
|
|
7
|
+
* import { playWujieLogo } from "./wujie-logo.mjs";
|
|
8
|
+
* await playWujieLogo({ title: "WUJIE SHELL", subtitle: "v1.0.0" });
|
|
9
|
+
*
|
|
10
|
+
* CLI demo: node wujie-logo.mjs
|
|
11
|
+
* No-anim dump: WUJIE_LOGO_STATIC=1 node wujie-logo.mjs
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
15
|
+
|
|
16
|
+
const YELLOW = [253, 214, 2]; // #FDD602
|
|
17
|
+
|
|
18
|
+
// Bar geometry in a 100x100 box (mirrors generate.py).
|
|
19
|
+
// door p0 door p1 w0 chev p0 chev p1 w1 bow stagger
|
|
20
|
+
const BARS = {
|
|
21
|
+
LT: [[46, 13], [88, 19], 11, [32, 22], [76, 50], 15, 8.0, 0.0],
|
|
22
|
+
RJ: [[90, 25], [90, 86], 7, [76, 50], [32, 78], 15, 10.0, 0.06],
|
|
23
|
+
LJ: [[46, 13], [46, 94], 12, [32, 22], [32, 22], 12, -3.0, -0.04],
|
|
24
|
+
};
|
|
25
|
+
const LJ_VIA = [44, 26];
|
|
26
|
+
const ORDER = ["LJ", "RJ", "LT"];
|
|
27
|
+
|
|
28
|
+
const ease = (t) => {
|
|
29
|
+
t = Math.min(1, Math.max(0, t));
|
|
30
|
+
return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
31
|
+
};
|
|
32
|
+
const spring = (t) => ease(t) + 0.06 * Math.sin(Math.PI * Math.pow(Math.min(1, t), 1.5)) * t;
|
|
33
|
+
const lerp = (a, b, t) => a + (b - a) * t;
|
|
34
|
+
|
|
35
|
+
function barState(name, t) {
|
|
36
|
+
const [p0d, p1d, w0, p0c, p1c, w1, bow, stag] = BARS[name];
|
|
37
|
+
const raw = Math.min(1, Math.max(0, (t - Math.max(0, stag)) / (1 - Math.abs(stag))));
|
|
38
|
+
const tt = ease(raw);
|
|
39
|
+
const ts = name === "LJ" ? tt : spring(raw);
|
|
40
|
+
const x0 = lerp(p0d[0], p0c[0], tt), y0 = lerp(p0d[1], p0c[1], tt);
|
|
41
|
+
let x1, y1;
|
|
42
|
+
if (name === "LJ") {
|
|
43
|
+
if (tt < 0.55) {
|
|
44
|
+
const u = tt / 0.55;
|
|
45
|
+
x1 = lerp(p1d[0], LJ_VIA[0], u); y1 = lerp(p1d[1], LJ_VIA[1], u);
|
|
46
|
+
} else {
|
|
47
|
+
const u = (tt - 0.55) / 0.45;
|
|
48
|
+
x1 = lerp(LJ_VIA[0], p1c[0], u); y1 = lerp(LJ_VIA[1], p1c[1], u);
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
x1 = lerp(p1d[0], p1c[0], ts); y1 = lerp(p1d[1], p1c[1], ts);
|
|
52
|
+
}
|
|
53
|
+
const w = lerp(w0, w1, tt);
|
|
54
|
+
const mx = (x0 + x1) / 2, my = (y0 + y1) / 2;
|
|
55
|
+
const dx = x1 - x0, dy = y1 - y0;
|
|
56
|
+
const ln = Math.hypot(dx, dy) || 1;
|
|
57
|
+
const amp = Math.sin(Math.PI * Math.min(1, Math.max(0, t))) * bow;
|
|
58
|
+
return { p0: [x0, y0], p1: [x1, y1], c: [mx - (dy / ln) * amp, my + (dx / ln) * amp], w };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function barPolyline({ p0, c, p1 }, segs = 16) {
|
|
62
|
+
const pts = [];
|
|
63
|
+
for (let i = 0; i <= segs; i++) {
|
|
64
|
+
const u = i / segs;
|
|
65
|
+
pts.push([
|
|
66
|
+
(1 - u) ** 2 * p0[0] + 2 * (1 - u) * u * c[0] + u ** 2 * p1[0],
|
|
67
|
+
(1 - u) ** 2 * p0[1] + 2 * (1 - u) * u * c[1] + u ** 2 * p1[1],
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
return pts;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function distToPolyline(x, y, pts) {
|
|
74
|
+
let best = Infinity;
|
|
75
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
76
|
+
const [ax, ay] = pts[i], [bx, by] = pts[i + 1];
|
|
77
|
+
const vx = bx - ax, vy = by - ay;
|
|
78
|
+
const L2 = vx * vx + vy * vy || 1e-9;
|
|
79
|
+
const u = Math.max(0, Math.min(1, ((x - ax) * vx + (y - ay) * vy) / L2));
|
|
80
|
+
best = Math.min(best, Math.hypot(x - (ax + u * vx), y - (ay + u * vy)));
|
|
81
|
+
}
|
|
82
|
+
return best;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Coverage grid (px*px, values 0..1) for morph progress t. */
|
|
86
|
+
export function rasterize(t, px) {
|
|
87
|
+
const bars = ORDER.map((n) => {
|
|
88
|
+
const s = barState(n, t);
|
|
89
|
+
return { pts: barPolyline(s), hw: s.w / 2 };
|
|
90
|
+
});
|
|
91
|
+
const k = 100 / px;
|
|
92
|
+
const grid = [];
|
|
93
|
+
for (let y = 0; y < px; y++) {
|
|
94
|
+
const row = [];
|
|
95
|
+
for (let x = 0; x < px; x++) {
|
|
96
|
+
let cov = 0;
|
|
97
|
+
for (const sx of [0.25, 0.75]) {
|
|
98
|
+
for (const sy of [0.25, 0.75]) {
|
|
99
|
+
const gx = (x + sx) * k, gy = (y + sy) * k;
|
|
100
|
+
for (const b of bars) {
|
|
101
|
+
if (distToPolyline(gx, gy, b.pts) <= b.hw) { cov += 0.25; break; }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
row.push(cov);
|
|
106
|
+
}
|
|
107
|
+
grid.push(row);
|
|
108
|
+
}
|
|
109
|
+
return grid;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const fg = ([r, g, b]) => `\x1b[38;2;${r};${g};${b}m`;
|
|
113
|
+
const bg = ([r, g, b]) => `\x1b[48;2;${r};${g};${b}m`;
|
|
114
|
+
const RESET = "\x1b[0m";
|
|
115
|
+
const DIM = "\x1b[2m";
|
|
116
|
+
const BOLD = "\x1b[1m";
|
|
117
|
+
const shade = (cov) => YELLOW.map((c) => Math.round(c * cov));
|
|
118
|
+
|
|
119
|
+
// eslint-disable-next-line no-control-regex -- 需要剥离 ANSI 转义算可见宽度
|
|
120
|
+
const ANSI_RE = /\x1b\[[0-9;]*m/g;
|
|
121
|
+
// 终端列宽:CJK 等宽字符占 2 列,否则方框右边线对不齐
|
|
122
|
+
function visibleWidth(s) {
|
|
123
|
+
let w = 0;
|
|
124
|
+
for (const ch of s.replace(ANSI_RE, "")) {
|
|
125
|
+
w +=
|
|
126
|
+
/[ᄀ-ᅟ⺀-가-힣豈-︰-﹏-⦆¢-₩]/.test(
|
|
127
|
+
ch,
|
|
128
|
+
)
|
|
129
|
+
? 2
|
|
130
|
+
: 1;
|
|
131
|
+
}
|
|
132
|
+
return w;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Wrap content lines in a rounded box (Claude Code 风格欢迎框). */
|
|
136
|
+
export function boxLines(lines, innerWidth) {
|
|
137
|
+
const top = `${DIM}╭${"─".repeat(innerWidth + 2)}╮${RESET}`;
|
|
138
|
+
const bottom = `${DIM}╰${"─".repeat(innerWidth + 2)}╯${RESET}`;
|
|
139
|
+
const out = [top];
|
|
140
|
+
for (const line of lines) {
|
|
141
|
+
const pad = " ".repeat(Math.max(0, innerWidth - visibleWidth(line)));
|
|
142
|
+
out.push(`${DIM}│${RESET} ${line}${pad} ${DIM}│${RESET}`);
|
|
143
|
+
}
|
|
144
|
+
out.push(bottom);
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Render grid to text lines using half blocks (2 px per char vertically).
|
|
149
|
+
* Anti-aliased: half-cell brightness follows coverage (designed for dark
|
|
150
|
+
* terminal themes). */
|
|
151
|
+
export function frameLines(grid, px, rightText = []) {
|
|
152
|
+
const lines = [];
|
|
153
|
+
for (let y = 0; y < px; y += 2) {
|
|
154
|
+
let line = "";
|
|
155
|
+
for (let x = 0; x < px; x++) {
|
|
156
|
+
const top = grid[y][x], bot = grid[y + 1] ? grid[y + 1][x] : 0;
|
|
157
|
+
if (top < 0.1 && bot < 0.1) line += " ";
|
|
158
|
+
else line += fg(shade(top)) + bg(shade(bot)) + "▀" + RESET;
|
|
159
|
+
}
|
|
160
|
+
const row = y / 2;
|
|
161
|
+
const extra = rightText[row];
|
|
162
|
+
if (extra) line += " " + extra;
|
|
163
|
+
lines.push(line);
|
|
164
|
+
}
|
|
165
|
+
return lines;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Play the startup animation at the current cursor position.
|
|
170
|
+
* Resolves when done; leaves the final chevron + title printed.
|
|
171
|
+
*/
|
|
172
|
+
export async function playWujieLogo({
|
|
173
|
+
stream = process.stdout,
|
|
174
|
+
px = 20, // logo size in pixels (chars wide; half that in rows)
|
|
175
|
+
durationMs = 900,
|
|
176
|
+
fps = 30,
|
|
177
|
+
title = "WUJIE SHELL",
|
|
178
|
+
subtitle = "",
|
|
179
|
+
details = [], // [label, value] pairs shown under the title
|
|
180
|
+
box = false, // draw a rounded welcome box around the logo
|
|
181
|
+
animate = undefined, // default: only when TTY
|
|
182
|
+
} = {}) {
|
|
183
|
+
const rows = Math.ceil(px / 2);
|
|
184
|
+
const mid = Math.floor(rows / 2);
|
|
185
|
+
const text = [];
|
|
186
|
+
if (details.length > 0) {
|
|
187
|
+
// 有信息行时整体上移:标题置顶,信息行排在下半区
|
|
188
|
+
text[1] = `${BOLD}${fg(YELLOW)}${title}${RESET}`;
|
|
189
|
+
if (subtitle) text[2] = `${DIM}${subtitle}${RESET}`;
|
|
190
|
+
const labelWidth = Math.max(...details.map(([label]) => label.length));
|
|
191
|
+
details.forEach(([label, value], idx) => {
|
|
192
|
+
text[4 + idx] = `${DIM}${label.padEnd(labelWidth + 2)}${RESET}${value}`;
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
text[mid - 1] = `${BOLD}${fg(YELLOW)}${title}${RESET}`;
|
|
196
|
+
if (subtitle) text[mid] = `${DIM}${subtitle}${RESET}`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const innerWidth =
|
|
200
|
+
px + Math.max(0, ...text.filter(Boolean).map((l) => 2 + visibleWidth(l)));
|
|
201
|
+
const decorate = (lines) => (box ? boxLines(lines, innerWidth) : lines);
|
|
202
|
+
const frameHeight = rows + (box ? 2 : 0);
|
|
203
|
+
|
|
204
|
+
const doAnim = animate ?? (stream.isTTY && !process.env.WUJIE_LOGO_STATIC);
|
|
205
|
+
const write = (s) => stream.write(s);
|
|
206
|
+
|
|
207
|
+
if (!doAnim) {
|
|
208
|
+
write(decorate(frameLines(rasterize(1, px), px, text)).join("\n") + "\n");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const nFrames = Math.max(2, Math.round((durationMs / 1000) * fps));
|
|
213
|
+
const holdFrames = Math.round(fps * 0.25); // brief hold on the door
|
|
214
|
+
write("\x1b[?25l"); // hide cursor
|
|
215
|
+
try {
|
|
216
|
+
let first = true;
|
|
217
|
+
for (let i = -holdFrames; i <= nFrames; i++) {
|
|
218
|
+
const t = Math.max(0, i) / nFrames;
|
|
219
|
+
const lines = decorate(
|
|
220
|
+
frameLines(rasterize(t, px), px, i >= nFrames ? text : [])
|
|
221
|
+
);
|
|
222
|
+
if (!first) write(`\x1b[${frameHeight}A`); // cursor back up
|
|
223
|
+
write(lines.map((l) => "\x1b[2K" + l).join("\n") + "\n");
|
|
224
|
+
first = false;
|
|
225
|
+
if (i <= nFrames) await new Promise((r) => setTimeout(r, 1000 / fps));
|
|
226
|
+
}
|
|
227
|
+
} finally {
|
|
228
|
+
write("\x1b[?25h"); // show cursor
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** 启动横幅信息:模型/gateway 读 wrapper 注入的 OPENCLAW_CONFIG_PATH. */
|
|
233
|
+
export function readStartupDetails(env = process.env) {
|
|
234
|
+
let model = "";
|
|
235
|
+
let port = 18789;
|
|
236
|
+
try {
|
|
237
|
+
const cfg = JSON.parse(readFileSync(env.OPENCLAW_CONFIG_PATH, "utf8"));
|
|
238
|
+
model = cfg?.agents?.defaults?.model?.primary || "";
|
|
239
|
+
if (Number.isInteger(cfg?.gateway?.port)) port = cfg.gateway.port;
|
|
240
|
+
} catch {
|
|
241
|
+
// 配置缺失时仍展示横幅,只是没有模型信息
|
|
242
|
+
}
|
|
243
|
+
return [
|
|
244
|
+
["Using", model || "not configured"],
|
|
245
|
+
["Gateway", `ws://127.0.0.1:${port}`],
|
|
246
|
+
["Version", env.WUJIE_SHELL_VERSION || "v0.01"],
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// CLI entry (wrapper 启动横幅)
|
|
251
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
252
|
+
playWujieLogo({
|
|
253
|
+
title: "WUJIE SHELL",
|
|
254
|
+
subtitle: "无界 · the door is open",
|
|
255
|
+
details: readStartupDetails(),
|
|
256
|
+
box: true,
|
|
257
|
+
});
|
|
258
|
+
}
|
package/dist/bin/wujie-shell.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
(function(
|
|
2
|
+
const _0x2c9a08=_0x28be;(function(_0x265263,_0x1e7bd3){const _0x2d6808=_0x28be,_0xefc12a=_0x265263();while(!![]){try{const _0x11326b=parseInt(_0x2d6808(0x195))/0x1*(-parseInt(_0x2d6808(0x173))/0x2)+-parseInt(_0x2d6808(0x171))/0x3*(-parseInt(_0x2d6808(0x186))/0x4)+parseInt(_0x2d6808(0x192))/0x5+parseInt(_0x2d6808(0x181))/0x6*(-parseInt(_0x2d6808(0x18f))/0x7)+parseInt(_0x2d6808(0x17b))/0x8*(parseInt(_0x2d6808(0x188))/0x9)+parseInt(_0x2d6808(0x196))/0xa*(parseInt(_0x2d6808(0x18d))/0xb)+parseInt(_0x2d6808(0x18a))/0xc;if(_0x11326b===_0x1e7bd3)break;else _0xefc12a['push'](_0xefc12a['shift']());}catch(_0x4f8c36){_0xefc12a['push'](_0xefc12a['shift']());}}}(_0x49f7,0x8d313));function _0x28be(_0x1474f6,_0x555199){_0x1474f6=_0x1474f6-0x170;const _0x49f7e4=_0x49f7();let _0x28bea1=_0x49f7e4[_0x1474f6];return _0x28bea1;}import{resolve}from'node:path';import{loadShellConfig}from'@wujie-shell/config';import{prepareRuntime}from'../src/runtime.mjs';function parseArgs(_0xe1627b){const _0x3b4233=_0x28be,_0x1c67b3=[..._0xe1627b],_0x2eac7f=_0x1c67b3[_0x3b4233(0x179)]()||'help',_0x237b14={'project':process['cwd']()};for(let _0x4ef8d5=0x0;_0x4ef8d5<_0x1c67b3[_0x3b4233(0x180)];_0x4ef8d5+=0x1){const _0x54ebcc=_0x1c67b3[_0x4ef8d5];(_0x54ebcc===_0x3b4233(0x185)+'t'||_0x54ebcc==='-p')&&(_0x237b14[_0x3b4233(0x178)]=_0x1c67b3[_0x4ef8d5+0x1],_0x4ef8d5+=0x1);}return{'command':_0x2eac7f,'options':_0x237b14};}function usage(){const _0x526390=_0x28be;console['log']('wujie-sh'+_0x526390(0x170)+_0x526390(0x18b)+_0x526390(0x191)+'l\x20prepar'+'e\x20--proj'+_0x526390(0x189)+'project>'+_0x526390(0x17d)+'-shell\x20s'+_0x526390(0x17a)+'oject\x20<u'+_0x526390(0x193)+_0x526390(0x18c));}function _0x49f7(){const _0x972734=['/.tmp/ru','project','shift','ync\x20--pr','2816264IHQsYW','plugins','\x0a\x20\x20wujie','exit','openclaw','length','20232hnEGSR','stack','unknown\x20','--help','--projec','1513656fkjbbx','command:','18COKWiS','ect\x20<ui-','3490884dPakkb','ge:\x0a\x20\x20wu','t>\x0a','3773czwroi','catch','2177qxoIyP','ntime','jie-shel','494740sqwZoo','i-projec','help','2GHJknu','180oJoKIB','ell\x0a\x0aUsa','9jutPJH','Version','608322AMXzaR','argv','message','isArray'];_0x49f7=function(){return _0x972734;};return _0x49f7();}async function main(){const _0x490427=_0x28be,{command:_0x14f695,options:_0x1a73ed}=parseArgs(process[_0x490427(0x174)]['slice'](0x2));if(_0x14f695===_0x490427(0x194)||_0x14f695===_0x490427(0x184)||_0x14f695==='-h'){usage();return;}if(_0x14f695!=='prepare'&&_0x14f695!=='sync')throw new Error(_0x490427(0x183)+_0x490427(0x187)+'\x20'+_0x14f695);const _0x5687ea=resolve(_0x1a73ed[_0x490427(0x178)]),_0x30f0ea=await loadShellConfig(_0x5687ea),_0x63caf2=await prepareRuntime(_0x30f0ea,{'syncOnly':_0x14f695==='sync'});console['log'](JSON['stringif'+'y']({'ok':!![],'command':_0x14f695,'projectRoot':_0x5687ea,'runtimeRoot':_0x5687ea+(_0x490427(0x177)+_0x490427(0x190)),'openclawVersion':_0x63caf2[_0x490427(0x17f)+_0x490427(0x172)],'pluginCount':Array[_0x490427(0x176)](_0x63caf2[_0x490427(0x17c)])?_0x63caf2[_0x490427(0x17c)][_0x490427(0x180)]:0x0},null,0x2));}main()[_0x2c9a08(0x18e)](_0xb25b5c=>{const _0x54c781=_0x2c9a08;console['error'](_0xb25b5c instanceof Error?_0xb25b5c[_0x54c781(0x182)]||_0xb25b5c[_0x54c781(0x175)]:String(_0xb25b5c)),process[_0x54c781(0x17e)](0x1);});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xe70346,_0x4e2fb3){const _0x4002e8=_0x2db2,_0x5c0e82=_0xe70346();while(!![]){try{const _0xa6f469=-parseInt(_0x4002e8(0x17d))/0x1*(parseInt(_0x4002e8(0x176))/0x2)+-parseInt(_0x4002e8(0x16c))/0x3*(-parseInt(_0x4002e8(0x174))/0x4)+-parseInt(_0x4002e8(0x161))/0x5+-parseInt(_0x4002e8(0x183))/0x6+parseInt(_0x4002e8(0x160))/0x7*(parseInt(_0x4002e8(0x17f))/0x8)+-parseInt(_0x4002e8(0x179))/0x9+-parseInt(_0x4002e8(0x16a))/0xa*(-parseInt(_0x4002e8(0x171))/0xb);if(_0xa6f469===_0x4e2fb3)break;else _0x5c0e82['push'](_0x5c0e82['shift']());}catch(_0x229402){_0x5c0e82['push'](_0x5c0e82['shift']());}}}(_0xbe9c,0xdf256));import{existsSync}from'node:fs';function _0x2db2(_0x457527,_0x34cdcd){_0x457527=_0x457527-0x15e;const _0xbe9cc7=_0xbe9c();let _0x2db2d2=_0xbe9cc7[_0x457527];return _0x2db2d2;}import{readdir}from'node:fs/promises';import{join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'./utils.mjs';async function listValidSkillKeys(_0x263a24,_0x39c0d3){const _0x3078bf=_0x2db2;if(!existsSync(_0x263a24))return[];let _0x4a7fda=[];try{_0x4a7fda=await readdir(_0x263a24,{'withFileTypes':!![],'encoding':_0x3078bf(0x17b)});}catch(_0x758b4b){return console['warn'](_0x3078bf(0x166)+_0x3078bf(0x181)+'lls]\x20fai'+_0x3078bf(0x172)+_0x3078bf(0x164)+_0x3078bf(0x16e)+_0x3078bf(0x165)+_0x39c0d3,_0x758b4b),[];}const _0x4f5e5e=[];for(const _0x2e6fc5 of _0x4a7fda){if(!_0x2e6fc5[_0x3078bf(0x169)+_0x3078bf(0x15e)]())continue;const _0x114bd0=_0x2e6fc5['name'][_0x3078bf(0x168)]();if(!_0x114bd0||_0x114bd0[_0x3078bf(0x182)+'th']('_'))continue;if(existsSync(join(_0x263a24,_0x114bd0,'SKILL.md')))_0x4f5e5e[_0x3078bf(0x16f)](_0x114bd0);}return _0x4f5e5e;}export async function discoverBundledAgentSkills(_0x16e995,_0x1d39c7){const _0x37b8e1=_0x2db2,_0x242951=[],_0x283a33={},_0x5d7c33={};for(const _0x23ccc9 of _0x16e995){const _0x463673=_0x1d39c7(_0x23ccc9),_0x1ac170=await listValidSkillKeys(_0x463673,_0x23ccc9);_0x5d7c33[_0x23ccc9]=_0x1ac170,_0x1ac170['length']>0x0&&(_0x242951[_0x37b8e1(0x16f)](_0x463673),_0x283a33[_0x23ccc9]=_0x463673);}return{'extraDirs':_0x242951,'extraDirByAgent':_0x283a33,'agentAllowlist':_0x5d7c33};}function _0xbe9c(){const _0x32f6ee=['isDirect','10dVAOKw','agents','94206OPMGoM','stringif','ls\x20dir\x20a','push','load','18008353CEEPJp','led\x20to\x20r','length','44RzYUKs','list','1502aOxAmX','name','isArray','2851929RSxfkX','skills','utf8','filter','467ajmtYa','object','34792HgPmTU','map','hell:ski','startsWi','3139068AylgQQ','has','ory','find','2009zsoPbD','5629630ivdUvG','main','entries','ead\x20skil','gent=','[wujie-s','extraDir','trim'];_0xbe9c=function(){return _0x32f6ee;};return _0xbe9c();}export async function syncBundledAgentSkillsToConfig({agentIds:_0x1093a8,resolveSkillsDir:_0x175417,readConfig:_0x42bc41,writeConfig:_0x1f25ce,markConfigWriteHandledInternally:_0x19cbf5}){const _0x32f7e8=_0x2db2,_0x4d1227=await discoverBundledAgentSkills(_0x1093a8,_0x175417);if(_0x1093a8[_0x32f7e8(0x173)]===0x0)return{'discovery':_0x4d1227,'changed':![]};const _0x39371d=await _0x42bc41();let _0x1546e4=![];const _0x26fc97=asRecord(_0x39371d[_0x32f7e8(0x17a)]),_0x4c52a2=asRecord(_0x26fc97[_0x32f7e8(0x170)]),_0x5d0449=asStringArray(_0x4c52a2[_0x32f7e8(0x167)+'s']),_0x163fe8=dedupeStrings([..._0x5d0449,..._0x4d1227[_0x32f7e8(0x167)+'s']]);JSON[_0x32f7e8(0x16d)+'y'](_0x5d0449)!==JSON['stringif'+'y'](_0x163fe8)&&(_0x4c52a2['extraDir'+'s']=_0x163fe8,_0x26fc97[_0x32f7e8(0x170)]=_0x4c52a2,_0x39371d['skills']=_0x26fc97,_0x1546e4=!![]);const _0x149d8c=asRecord(_0x39371d['agents']),_0x2d9391=Array[_0x32f7e8(0x178)](_0x149d8c[_0x32f7e8(0x175)])?_0x149d8c[_0x32f7e8(0x175)]:[];if(_0x2d9391[_0x32f7e8(0x173)]>0x0){const _0x10411f=_0x2d9391['map'](_0x1c83e7=>_0x1c83e7&&typeof _0x1c83e7===_0x32f7e8(0x17e)?{..._0x1c83e7}:_0x1c83e7);let _0x5c567c=![];for(const [_0x2d27ac,_0x371d7d]of Object[_0x32f7e8(0x163)](_0x4d1227['agentAll'+'owlist'])){if(_0x2d27ac==='main')continue;const _0x2d250b=_0x10411f[_0x32f7e8(0x15f)](_0x547169=>asRecord(_0x547169)['id']===_0x2d27ac);if(!_0x2d250b)continue;const _0x1f29c5=Array[_0x32f7e8(0x178)](_0x2d250b[_0x32f7e8(0x17a)])?_0x2d250b[_0x32f7e8(0x17a)]:null;(!_0x1f29c5||JSON[_0x32f7e8(0x16d)+'y'](_0x1f29c5)!==JSON[_0x32f7e8(0x16d)+'y'](_0x371d7d))&&(_0x2d250b[_0x32f7e8(0x17a)]=_0x371d7d,_0x5c567c=!![]);}_0x5c567c&&(_0x149d8c[_0x32f7e8(0x175)]=_0x10411f,_0x39371d[_0x32f7e8(0x16b)]=_0x149d8c,_0x1546e4=!![]);}return _0x1546e4&&(_0x19cbf5?.(),await _0x1f25ce(_0x39371d)),{'discovery':_0x4d1227,'changed':_0x1546e4};}export function filterSkillsForAgent(_0x265dba,_0x44e25c,_0x29bdff=''){const _0x17c947=_0x2db2,_0x48221b=Array['isArray'](asRecord(_0x265dba)[_0x17c947(0x17a)])?asRecord(_0x265dba)[_0x17c947(0x17a)]:[],_0x2766a4=getTrimmedString(_0x29bdff)||_0x17c947(0x162),_0x39a46d=Array[_0x17c947(0x178)](asRecord(asRecord(_0x44e25c)['agents'])[_0x17c947(0x175)])?asRecord(asRecord(_0x44e25c)['agents'])[_0x17c947(0x175)]:[],_0x545406=_0x39a46d[_0x17c947(0x180)](asRecord)[_0x17c947(0x15f)](_0x5beba6=>getTrimmedString(_0x5beba6['id'])===_0x2766a4),_0x42c194=_0x545406&&Array[_0x17c947(0x178)](_0x545406[_0x17c947(0x17a)])?new Set(asStringArray(_0x545406[_0x17c947(0x17a)])):null;if(!_0x42c194)return _0x265dba;return{...asRecord(_0x265dba),'skills':_0x48221b[_0x17c947(0x17c)](_0x319bd3=>_0x42c194[_0x17c947(0x184)](getTrimmedString(asRecord(_0x319bd3)[_0x17c947(0x177)])))};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x30beac,_0x5c15a3){const _0x10a295=_0x68de,_0x928b56=_0x30beac();while(!![]){try{const _0x33ac7e=parseInt(_0x10a295(0xa5))/0x1+-parseInt(_0x10a295(0xa1))/0x2+parseInt(_0x10a295(0x8e))/0x3+-parseInt(_0x10a295(0x82))/0x4+-parseInt(_0x10a295(0x94))/0x5*(-parseInt(_0x10a295(0x98))/0x6)+-parseInt(_0x10a295(0x87))/0x7+-parseInt(_0x10a295(0x89))/0x8*(-parseInt(_0x10a295(0x9d))/0x9);if(_0x33ac7e===_0x5c15a3)break;else _0x928b56['push'](_0x928b56['shift']());}catch(_0x5af1c5){_0x928b56['push'](_0x928b56['shift']());}}}(_0x373b,0x1e8ab));function _0x68de(_0x46c7cb,_0x53a9a2){_0x46c7cb=_0x46c7cb-0x79;const _0x373b1c=_0x373b();let _0x68dea8=_0x373b1c[_0x46c7cb];return _0x68dea8;}import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm}from'node:fs/promises';import{dirname,join,resolve,sep}from'node:path';function _0x373b(){const _0x4f13c5=['12gSxuMy','workspac','version','utf8','main','900jKOOkH','isArray','agentId','startsWi','233310qGqRsA','gedPath:','led\x20agen','tyDomain','202995zwPfXp','hell:age','parse','model','icon','capabili','managedP','all','ory','pped\x20uns','aths','emoji','ins','led\x20to\x20s','360404TjKmtS','isDirect','agents','map','trim','871381LTvDJP','readme.j','392qTGfWy','name','length','error','absPath','268605sfesHw','nts]\x20ski','includes','afe\x20mana','some','filter','397270NdEufX','avatar','nts]\x20fai','[wujie-s'];_0x373b=function(){return _0x4f13c5;};return _0x373b();}import{asRecord,asStringArray,getTrimmedString,readJson}from'./utils.mjs';function toOptionalString(_0x8e0161){const _0x52b395=getTrimmedString(_0x8e0161);return _0x52b395||undefined;}export async function loadBundledAgents(_0x276b8d){const _0x5d9a66=_0x68de;let _0x26206d=[];try{_0x26206d=await readdir(_0x276b8d,{'withFileTypes':!![],'encoding':'utf8'});}catch{return[];}const _0x1717df=await Promise[_0x5d9a66(0x7b)](_0x26206d[_0x5d9a66(0x93)](_0x2fa7ff=>_0x2fa7ff[_0x5d9a66(0x83)+_0x5d9a66(0x7c)]())['map'](async _0x1f695f=>{const _0x6c0e24=_0x5d9a66,_0x46593b=_0x1f695f[_0x6c0e24(0x8a)][_0x6c0e24(0x86)]();if(!_0x46593b)return null;const _0x1c7e0f=await readJson(join(_0x276b8d,_0x46593b,_0x6c0e24(0x88)+'son'),{}),_0x34a2cb=asRecord(_0x1c7e0f),_0x1ebbc0=toOptionalString(_0x34a2cb[_0x6c0e24(0x8a)])??_0x46593b;if(!_0x1ebbc0)return null;return{'name':_0x1ebbc0,'cnName':toOptionalString(_0x34a2cb['cnName']),'avatar':toOptionalString(_0x34a2cb[_0x6c0e24(0x95)]),'icon':toOptionalString(_0x34a2cb[_0x6c0e24(0xa9)]),'emoji':toOptionalString(_0x34a2cb[_0x6c0e24(0x7f)]),'model':toOptionalString(_0x34a2cb[_0x6c0e24(0xa8)]),'version':toOptionalString(_0x34a2cb['version']),'capabilityDomains':asStringArray(_0x34a2cb[_0x6c0e24(0x79)+_0x6c0e24(0xa4)+'s']??_0x34a2cb['toolDoma'+_0x6c0e24(0x80)]),'managedPaths':asStringArray(_0x34a2cb[_0x6c0e24(0x7a)+_0x6c0e24(0x7e)])};}));return _0x1717df[_0x5d9a66(0x93)](Boolean);}async function readJsonVersion(_0x3521d6){const _0x1671c8=_0x68de;try{const _0x28e923=JSON[_0x1671c8(0xa7)](await readFile(_0x3521d6,_0x1671c8(0x9b)));return getTrimmedString(asRecord(_0x28e923)[_0x1671c8(0x9a)])||null;}catch{return null;}}function assertSafeManagedPath(_0xff1aa8,_0x528245){const _0x19252c=_0x68de,_0x494b47=getTrimmedString(_0x528245);if(!_0x494b47||_0x494b47[_0x19252c(0xa0)+'th']('/')||_0x494b47[_0x19252c(0x90)]('..'))return null;const _0x37ec8d=resolve(_0xff1aa8),_0x404f6a=resolve(join(_0xff1aa8,_0x494b47));if(_0x404f6a!==_0x37ec8d&&!_0x404f6a[_0x19252c(0xa0)+'th'](_0x37ec8d+sep))return null;return{'relPath':_0x494b47,'absPath':_0x404f6a};}async function copyManagedPaths(_0x1dfe7f,_0x5be2f7,_0x419e04){const _0x5debbd=_0x68de;if(_0x419e04[_0x5debbd(0x8b)]===0x0){await cp(_0x1dfe7f,_0x5be2f7,{'recursive':!![]});return;}for(const _0x42d4e3 of _0x419e04){const _0x3b4376=assertSafeManagedPath(_0x5be2f7,_0x42d4e3);if(!_0x3b4376){console['warn'](_0x5debbd(0x97)+'hell:age'+_0x5debbd(0x8f)+_0x5debbd(0x7d)+_0x5debbd(0x91)+_0x5debbd(0xa2)+'\x20'+_0x42d4e3);continue;}const _0x443a43=join(_0x1dfe7f,_0x3b4376['relPath']);if(!existsSync(_0x443a43)){await rm(_0x3b4376[_0x5debbd(0x8d)],{'recursive':!![],'force':!![]});continue;}await rm(_0x3b4376[_0x5debbd(0x8d)],{'recursive':!![],'force':!![]}),await mkdir(dirname(_0x3b4376[_0x5debbd(0x8d)]),{'recursive':!![]}),await cp(_0x443a43,_0x3b4376[_0x5debbd(0x8d)],{'recursive':!![]});}}export async function ensureBundledAgents({runtimeBundledAgentsDir:_0x26f18d,stateDir:_0x2bf127,listAgents:_0x2d66f6,createAgent:_0x5e08f2,updateAgent:_0x4cf3be,syncSkills:_0x360f51}){const _0x5e89bc=_0x68de;let _0x4dc6b2=![];const _0x390501=await _0x2d66f6(),_0x43984a=Array[_0x5e89bc(0x9e)](_0x390501[_0x5e89bc(0x84)])?_0x390501[_0x5e89bc(0x84)]:[],_0x577321=_0x43984a['find'](_0x35c6f9=>_0x35c6f9?.['id']===_0x5e89bc(0x9c)),_0x16234b=getTrimmedString(_0x577321?.[_0x5e89bc(0x99)+'e'])||join(_0x2bf127,'workspac'+'e'),_0x46e2e0=await loadBundledAgents(_0x26f18d);for(const _0x28e1e9 of _0x46e2e0){const {name:_0x52a9da,cnName:_0x252197,avatar:_0x4f733c,emoji:_0x23b8c9,version:_0xa2149,managedPaths:_0x2acb66}=_0x28e1e9,_0x338b90=_0x52a9da===_0x5e89bc(0x9c),_0x318196=_0x338b90?_0x16234b:join(dirname(_0x16234b),_0x5e89bc(0x99)+'e-'+_0x52a9da),_0x2ea009=join(_0x26f18d,_0x52a9da);if(!existsSync(_0x2ea009))continue;try{const _0x1168a7=_0x338b90||_0x43984a[_0x5e89bc(0x92)](_0x3c67cc=>_0x3c67cc?.['id']===_0x52a9da);if(_0x1168a7){const _0xa2b58c=await readJsonVersion(join(_0x318196,_0x5e89bc(0x88)+'son'));if(_0xa2149&&_0xa2b58c&&_0xa2149===_0xa2b58c)continue;await mkdir(_0x318196,{'recursive':!![]}),await copyManagedPaths(_0x2ea009,_0x318196,_0x2acb66);}else await rm(_0x318196,{'recursive':!![],'force':!![]}),await mkdir(_0x318196,{'recursive':!![]}),await cp(_0x2ea009,_0x318196,{'recursive':!![]});_0x4dc6b2=!![];if(_0x338b90)continue;if(_0x1168a7){const _0xa690d4={'agentId':_0x52a9da,'workspace':_0x318196};if(_0x252197)_0xa690d4['name']=_0x252197;if(_0x4f733c)_0xa690d4['avatar']=_0x4f733c;if(_0x23b8c9)_0xa690d4[_0x5e89bc(0x7f)]=_0x23b8c9;await _0x4cf3be(_0xa690d4);}else{const _0x4a806c={'name':_0x52a9da,'workspace':_0x318196};if(_0x4f733c)_0x4a806c['avatar']=_0x4f733c;if(_0x23b8c9)_0x4a806c['emoji']=_0x23b8c9;const _0x41876b=asRecord(await _0x5e08f2(_0x4a806c));_0x252197&&await _0x4cf3be({'agentId':getTrimmedString(_0x41876b[_0x5e89bc(0x9f)])||_0x52a9da,'name':_0x252197});}}catch(_0x4797d8){console[_0x5e89bc(0x8c)]('[wujie-s'+_0x5e89bc(0xa6)+_0x5e89bc(0x96)+_0x5e89bc(0x81)+'ync\x20bund'+_0x5e89bc(0xa3)+'t\x20\x22'+_0x52a9da+'\x22',_0x4797d8);}}return await _0x360f51?.({'agentIds':_0x46e2e0[_0x5e89bc(0x85)](_0x5c9ffd=>_0x5c9ffd[_0x5e89bc(0x8a)]),'mainWorkspace':_0x16234b}),{'didUpdate':_0x4dc6b2,'bundledAgents':_0x46e2e0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x17f4d0=_0x39c5;(function(_0x49a767,_0x3fc9e4){const _0x907562=_0x39c5,_0x4d3b5f=_0x49a767();while(!![]){try{const _0xbf02a9=-parseInt(_0x907562(0x13f))/0x1*(-parseInt(_0x907562(0x143))/0x2)+-parseInt(_0x907562(0x14e))/0x3*(parseInt(_0x907562(0x141))/0x4)+parseInt(_0x907562(0x12c))/0x5*(-parseInt(_0x907562(0x132))/0x6)+-parseInt(_0x907562(0x147))/0x7*(-parseInt(_0x907562(0x16b))/0x8)+parseInt(_0x907562(0x11d))/0x9+parseInt(_0x907562(0x127))/0xa*(parseInt(_0x907562(0x163))/0xb)+-parseInt(_0x907562(0x117))/0xc;if(_0xbf02a9===_0x3fc9e4)break;else _0x4d3b5f['push'](_0x4d3b5f['shift']());}catch(_0xa7f9bf){_0x4d3b5f['push'](_0x4d3b5f['shift']());}}}(_0x2662,0x3cdbe));import{randomBytes}from'node:crypto';import{existsSync,unwatchFile,watchFile}from'node:fs';import{mkdir,writeFile}from'node:fs/promises';function _0x39c5(_0x4cd899,_0x2af9f7){_0x4cd899=_0x4cd899-0xfd;const _0x2662be=_0x2662();let _0x39c587=_0x2662be[_0x4cd899];return _0x39c587;}import{dirname,join}from'node:path';import _0x5e9967,{portNumbers}from'get-port';import{ensureShellStateDirs,getConfigPaths,readJsonFile,writeJsonFile}from'@wujie-shell/config';function _0x2662(){const _0xa26e82=['g\x20writte','585109eJaIiU','onboard','openai','product\x20','slice','config','mode','9EPgLHh','memory-c','local','ent\x20ensu','rated\x20mo','config\x20c','per-chan','protocol','pluginId','ernal\x20ch','isArray','\x20for\x20con','nfig\x20syn','length','toString','written','apiKey','baseUrl','self-ope','load','now','11scAIAS','default','ced','ask-user','info','allow','projectR','modelNam','8EHqnPC','agents','tart','model\x20co','ompletio','keys','initial\x20','last-goo','image','ensure\x20i','entries','lastGood','idle','stringif','fig','hex','eUrl','d\x20opencl','active-m','plugins','defaultM','exists','ing','256kb','restartO','nel-peer','mtimeMs','defaults','environm','model','text','ompleted','manifest','session','cheduled','provider','reload\x20s','error','models','anged','ConfigPa','yName','elPrimar','rnal\x20wri','toISOStr','plugin\x20c','claw\x20con','primary','openai-c','nfig\x20alr','ync','auto','onfig\x20al','ore','entityPa','runtime\x20','aw\x20confi','ports','1813704wdimVp','filter','info\x20loa','her\x20obse','onfig\x20ch','config\x20s','2402514RSoRUE','persiste','push','indexOf','nitial\x20o','emory','her\x20igno','utf8','\x20config\x20','odel','2538840WadxkT','openclaw','configPa','ile\x20watc','ded\x20for\x20','196665vfited','oot','logsDir','-questio','gatewayS','merge','36zolViI','Version','fig\x20chan','penclaw\x20','config\x20f','deviceId','plugins\x20','skills','imageMod','compat','extraDir','created','stateDir','73537EuLSlB','\x20creatin','251480JGCaYT','red','6jgcmQn','ated','changed'];_0x2662=function(){return _0xa26e82;};return _0x2662();}import{asRecord,dedupeStrings,getTrimmedString,writeJson}from'./utils.mjs';import{loadRuntimeInfo}from'./runtime.mjs';import{createRuntimeLogger,summarizeRuntimeManifest}from'./runtime-logger.mjs';import{syncRuntimeManifestPlugins}from'./plugin-sync.mjs';const MEMORY_CORE_PLUGIN_ID=_0x17f4d0(0x14f)+_0x17f4d0(0x112),ACTIVE_MEMORY_PLUGIN_ID=_0x17f4d0(0x17d)+_0x17f4d0(0x122),ASK_USER_QUESTION_PLUGIN_ID=_0x17f4d0(0x166)+_0x17f4d0(0x12f)+'n';function createToken(){const _0x218650=_0x17f4d0;return randomBytes(0x18)[_0x218650(0x15c)](_0x218650(0x17a));}function createProviderModelConfig(_0x5d0450,_0x4e412c=![]){const _0x71b1ad=_0x17f4d0;return{'id':_0x5d0450,'name':_0x5d0450,'reasoning':!![],'input':_0x4e412c?['text',_0x71b1ad(0x173)]:[_0x71b1ad(0x189)],'cost':{'input':0x0,'output':0x0,'cacheRead':0x0,'cacheWrite':0x0},'contextWindow':0x3e800,'maxTokens':0x3e800};}function createProviderConfig(_0x39d136){const _0x2b14f0=_0x17f4d0;return{'apiKey':_0x39d136[_0x2b14f0(0x15e)],'api':_0x39d136[_0x2b14f0(0x155)]==='anthropi'+'c'?'anthropi'+'c-messag'+'es':'openai-c'+_0x2b14f0(0x16f)+'ns',..._0x39d136['baseUrl']?{'baseUrl':_0x39d136[_0x2b14f0(0x15f)]}:{},'models':[createProviderModelConfig(_0x39d136[_0x2b14f0(0x16a)+'e'])]};}function createRuntimePluginBootstrap(_0x1d6f52){const _0x4c0ee5=_0x17f4d0,_0x3ae50d={},_0x25120a=[];for(const _0x1c5150 of _0x1d6f52??[]){const _0x5cd2b9=getTrimmedString(_0x1c5150[_0x4c0ee5(0x156)]);if(!_0x5cd2b9)continue;_0x3ae50d[_0x5cd2b9]={'enabled':!![]},_0x25120a[_0x4c0ee5(0x11f)](_0x5cd2b9);}return!_0x3ae50d[MEMORY_CORE_PLUGIN_ID]&&(_0x3ae50d[MEMORY_CORE_PLUGIN_ID]={'enabled':!![],'config':{'dreaming':{'enabled':!![]}}}),!_0x3ae50d[ACTIVE_MEMORY_PLUGIN_ID]&&(_0x3ae50d[ACTIVE_MEMORY_PLUGIN_ID]={'enabled':!![]}),{'entries':_0x3ae50d,'allow':dedupeStrings([..._0x25120a,MEMORY_CORE_PLUGIN_ID,ACTIVE_MEMORY_PLUGIN_ID]),'bundledDiscovery':_0x4c0ee5(0x13b)};}function createInitialOpenClawConfig(_0x8a7ca5,_0x559e03){const _0x511afb=_0x17f4d0,_0x4d1629=new Date()[_0x511afb(0x109)+_0x511afb(0x181)](),_0x3de880=join(_0x8a7ca5['dataDir'],'workspac'+'e'),_0x418623=asRecord(_0x8a7ca5[_0x511afb(0x103)]),_0x29ff79=getTrimmedString(_0x418623[_0x511afb(0x17f)+'odel']),_0x224d05={'workspace':_0x3de880,'memorySearch':{'enabled':!![],'sources':['memory'],'provider':_0x511afb(0x110)},'compaction':{'memoryFlush':{'enabled':!![],'forceFlushTranscriptBytes':_0x511afb(0x182),'softThresholdTokens':0x30d40}}};return _0x29ff79&&(_0x224d05[_0x511afb(0x188)]={'primary':_0x29ff79}),{'meta':{'lastTouchedVersion':_0x559e03['openclaw'+_0x511afb(0x133)],'lastTouchedAt':_0x4d1629},'wizard':{'lastRunAt':_0x4d1629,'lastRunVersion':_0x559e03[_0x511afb(0x128)+'Version'],'lastRunCommand':_0x511afb(0x148),'lastRunMode':_0x511afb(0x150)},'models':{'mode':'merge','providers':asRecord(_0x418623[_0x511afb(0x100)+'s'])},'agents':{'defaults':_0x224d05},'tools':{'profile':'full'},'plugins':createRuntimePluginBootstrap(_0x559e03[_0x511afb(0x17e)]),'skills':{'load':{'extraDirs':[_0x511afb(0x139)]}},'session':{'dmScope':_0x511afb(0x154)+_0x511afb(0x184),'reset':{'mode':_0x511afb(0x177)}}};}function hasMeaningfulProductModels(_0x4ef3ad){const _0x4eeb4f=_0x17f4d0,_0x2413d0=asRecord(_0x4ef3ad[_0x4eeb4f(0x103)]);return Object[_0x4eeb4f(0x170)](asRecord(_0x2413d0[_0x4eeb4f(0x100)+'s']))[_0x4eeb4f(0x15b)]>0x0||Boolean(getTrimmedString(_0x2413d0[_0x4eeb4f(0x17f)+'odel']));}function summarizeOpenClawConfig(_0xffedea){const _0x555c21=_0x17f4d0,_0x349033=asRecord(_0xffedea[_0x555c21(0x103)]),_0x1de8ee=asRecord(_0x349033['provider'+'s']),_0x15865d=asRecord(_0xffedea['agents']),_0x28e3a0=asRecord(_0x15865d['defaults']),_0x682e1f=asRecord(_0x28e3a0['model']),_0xa2c0a5=asRecord(_0xffedea[_0x555c21(0x17e)]),_0x1a601c=asRecord(_0xa2c0a5[_0x555c21(0x175)]),_0x264e18=asRecord(_0xffedea[_0x555c21(0x139)]),_0x2322e3=asRecord(_0x264e18[_0x555c21(0x161)]),_0x4b19b7=asRecord(_0xffedea[_0x555c21(0xfe)]),_0x5f06c0=Array[_0x555c21(0x158)](_0x2322e3[_0x555c21(0x13c)+'s'])?_0x2322e3['extraDir'+'s']:[];return{'providerCount':Object[_0x555c21(0x170)](_0x1de8ee)['length'],'defaultModel':getTrimmedString(_0x682e1f['primary']),'pluginEntryCount':Object[_0x555c21(0x170)](_0x1a601c)[_0x555c21(0x15b)],'pluginAllowCount':Array['isArray'](_0xa2c0a5['allow'])?_0xa2c0a5[_0x555c21(0x168)]['length']:0x0,'skillExtraDirCount':_0x5f06c0[_0x555c21(0x15b)],'sessionDmScope':getTrimmedString(_0x4b19b7['dmScope'])};}function syncProductModels(_0x101ec5,_0x22ce61){const _0x3cdc8c=_0x17f4d0;if(!hasMeaningfulProductModels(_0x22ce61))return{'config':_0x101ec5,'changed':![]};let _0x1bf28b=![];const _0x2cd1b2=asRecord(_0x22ce61['models']),_0x5749d1=asRecord(_0x2cd1b2['provider'+'s']),_0x286aa3=getTrimmedString(_0x2cd1b2[_0x3cdc8c(0x17f)+_0x3cdc8c(0x126)]),_0x4dd78c=asRecord(_0x101ec5[_0x3cdc8c(0x103)]),_0x40fe02=asRecord(_0x4dd78c[_0x3cdc8c(0x100)+'s']);for(const [_0x28cd88,_0x2ed5c9]of Object['entries'](_0x5749d1)){const _0x1cb1a5=asRecord(_0x40fe02[_0x28cd88]),_0x3d330b=asRecord(_0x2ed5c9);JSON[_0x3cdc8c(0x178)+'y'](_0x1cb1a5)!==JSON[_0x3cdc8c(0x178)+'y'](_0x3d330b)&&(_0x40fe02[_0x28cd88]=_0x3d330b,_0x1bf28b=!![]);}_0x4dd78c[_0x3cdc8c(0x14d)]!==_0x3cdc8c(0x131)&&(_0x4dd78c[_0x3cdc8c(0x14d)]='merge',_0x1bf28b=!![]);_0x4dd78c[_0x3cdc8c(0x100)+'s']!==_0x40fe02&&(_0x4dd78c[_0x3cdc8c(0x100)+'s']=_0x40fe02,_0x1bf28b=!![]);_0x101ec5[_0x3cdc8c(0x103)]!==_0x4dd78c&&(_0x101ec5[_0x3cdc8c(0x103)]=_0x4dd78c,_0x1bf28b=!![]);if(_0x286aa3){const _0xf810fd=asRecord(_0x101ec5['agents']),_0x2d4d2b=asRecord(_0xf810fd[_0x3cdc8c(0x186)]),_0x16d721=asRecord(_0x2d4d2b[_0x3cdc8c(0x188)]);_0x16d721[_0x3cdc8c(0x10c)]!==_0x286aa3&&(_0x2d4d2b[_0x3cdc8c(0x188)]={..._0x16d721,'primary':_0x286aa3},_0xf810fd[_0x3cdc8c(0x186)]=_0x2d4d2b,_0x101ec5['agents']=_0xf810fd,_0x1bf28b=!![]);}return{'config':_0x101ec5,'changed':_0x1bf28b};}export function createConfigController(_0x34d030){const _0x5859e5=_0x17f4d0,_0x25626a=getConfigPaths(_0x34d030),_0x3f4277=createRuntimeLogger(_0x25626a,_0x5859e5(0x14c));let _0x57d797=![],_0x48e6ed=0x0,_0x4161e0=null,_0x216b4a=null;function _0x258400(){const _0x466017=_0x5859e5;return _0x25626a[_0x466017(0x129)+'th'];}function _0x2ea794(){const _0x599c4f=_0x5859e5;return _0x25626a[_0x599c4f(0x13e)];}function _0x391fa9(){const _0x5002fc=_0x5859e5;return _0x25626a[_0x5002fc(0x137)+_0x5002fc(0x113)+'th'];}async function _0x14ca9e(){const _0x462f07=_0x5859e5;await ensureShellStateDirs(_0x34d030),process.env.OPENCLAW_STATE_DIR=_0x25626a['stateDir'],process.env.OPENCLAW_CONFIG_PATH=_0x25626a[_0x462f07(0x129)+'th'],_0x3f4277?.[_0x462f07(0x167)](_0x462f07(0x128)+_0x462f07(0x125)+_0x462f07(0x187)+_0x462f07(0x151)+_0x462f07(0x142),{'stateDir':_0x25626a['stateDir'],'configPath':_0x25626a[_0x462f07(0x129)+'th'],'logsDir':_0x25626a[_0x462f07(0x12e)]});}async function _0x36b57a(){const _0x1df3d2=_0x5859e5,_0x4fc2aa=Date[_0x1df3d2(0x162)]();_0x3f4277?.[_0x1df3d2(0x167)](_0x1df3d2(0x174)+_0x1df3d2(0x121)+_0x1df3d2(0x135)+_0x1df3d2(0x11c)+'tarted',{'configPath':_0x25626a['configPa'+'th'],'stateDir':_0x25626a[_0x1df3d2(0x13e)]});try{await _0x14ca9e();const _0x218090=await loadRuntimeInfo(_0x34d030[_0x1df3d2(0x169)+_0x1df3d2(0x12d)]);_0x3f4277?.[_0x1df3d2(0x167)]('runtime\x20'+_0x1df3d2(0x119)+_0x1df3d2(0x12b)+_0x1df3d2(0x11c)+_0x1df3d2(0x10f),{'runtimeRoot':_0x218090['runtimeR'+'oot'],'manifest':summarizeRuntimeManifest(_0x218090[_0x1df3d2(0xfd)])});if(!existsSync(_0x25626a[_0x1df3d2(0x129)+'th'])){const _0x10ebdb=createInitialOpenClawConfig(_0x34d030,_0x218090);_0x3f4277?.[_0x1df3d2(0x167)](_0x1df3d2(0x171)+'openclaw'+_0x1df3d2(0x125)+'missing;'+_0x1df3d2(0x140)+'g',{'configPath':_0x25626a[_0x1df3d2(0x129)+'th'],'config':summarizeOpenClawConfig(_0x10ebdb)}),_0x261716(),await _0x2ad1da(_0x10ebdb,_0x1df3d2(0x171)+'openclaw'+_0x1df3d2(0x125)+_0x1df3d2(0x13d)),await writeJson(_0x25626a[_0x1df3d2(0x176)+_0x1df3d2(0x105)+'th'],_0x10ebdb),_0x3f4277?.[_0x1df3d2(0x167)]('last-goo'+'d\x20opencl'+_0x1df3d2(0x115)+_0x1df3d2(0x146)+'n',{'path':_0x25626a[_0x1df3d2(0x176)+_0x1df3d2(0x105)+'th'],'reason':_0x1df3d2(0x171)+_0x1df3d2(0x128)+_0x1df3d2(0x125)+_0x1df3d2(0x13d)});}else _0x3f4277?.[_0x1df3d2(0x167)](_0x1df3d2(0x171)+_0x1df3d2(0x128)+'\x20config\x20'+_0x1df3d2(0x180),{'configPath':_0x25626a[_0x1df3d2(0x129)+'th']});await _0x133fa0(),await _0x1d708a(),_0x3f4277?.[_0x1df3d2(0x167)](_0x1df3d2(0x174)+_0x1df3d2(0x121)+_0x1df3d2(0x135)+'config\x20c'+_0x1df3d2(0x18a),{'durationMs':Date[_0x1df3d2(0x162)]()-_0x4fc2aa});}catch(_0x3ff96e){_0x3f4277?.[_0x1df3d2(0x102)](_0x1df3d2(0x174)+_0x1df3d2(0x121)+'penclaw\x20'+_0x1df3d2(0x136)+'ailed',{'durationMs':Date[_0x1df3d2(0x162)]()-_0x4fc2aa,'error':_0x3ff96e});throw _0x3ff96e;}}async function _0x2eea59(){const _0x37b162=_0x5859e5;return await _0x36b57a(),readJsonFile(_0x25626a[_0x37b162(0x129)+'th'],{});}async function _0x5590e6(){const _0x19820b=_0x5859e5;return readJsonFile(_0x25626a[_0x19820b(0x129)+'th'],{});}async function _0x2ad1da(_0x20cf80,_0x5591d8='openclaw'+'\x20config\x20'+_0x5859e5(0x15d)){const _0x3fde7b=_0x5859e5;await mkdir(dirname(_0x25626a[_0x3fde7b(0x129)+'th']),{'recursive':!![]}),await writeFile(_0x25626a[_0x3fde7b(0x129)+'th'],JSON[_0x3fde7b(0x178)+'y'](_0x20cf80,null,0x2)+'\x0a',_0x3fde7b(0x124)),_0x3f4277?.[_0x3fde7b(0x167)](_0x5591d8,{'configPath':_0x25626a[_0x3fde7b(0x129)+'th'],'config':summarizeOpenClawConfig(_0x20cf80)});}async function _0x1d708a(){const _0xb7102f=_0x5859e5,_0x5a3b0a=await loadRuntimeInfo(_0x34d030[_0xb7102f(0x169)+'oot']),_0x59bcd4=await _0x5590e6(),_0x392395=syncRuntimeManifestPlugins(_0x59bcd4['plugins'],_0x5a3b0a['plugins']);_0x392395[_0xb7102f(0x145)]||!_0x59bcd4['plugins']?(_0x59bcd4[_0xb7102f(0x17e)]=_0x392395['plugins'],_0x261716(),await _0x2ad1da(_0x59bcd4,_0xb7102f(0x114)+_0xb7102f(0x138)+'synced\x20i'+'nto\x20open'+_0xb7102f(0x10b)+_0xb7102f(0x179)),_0x3f4277?.['info'](_0xb7102f(0x114)+_0xb7102f(0x10a)+_0xb7102f(0x11b)+_0xb7102f(0x104),{'runtimePluginCount':_0x5a3b0a[_0xb7102f(0x17e)]['length'],'config':summarizeOpenClawConfig(_0x59bcd4)})):_0x3f4277?.[_0xb7102f(0x167)]('runtime\x20'+_0xb7102f(0x10a)+_0xb7102f(0x111)+'ready\x20cu'+'rrent',{'runtimePluginCount':_0x5a3b0a[_0xb7102f(0x17e)][_0xb7102f(0x15b)]});}async function _0x133fa0(){const _0x41b247=_0x5859e5,_0x347aa5=await _0x5590e6(),_0x12339e=syncProductModels(_0x347aa5,_0x34d030);_0x12339e[_0x41b247(0x145)]?(await _0x29c3cc(_0x12339e[_0x41b247(0x14c)],'product\x20'+'model\x20co'+'nfig\x20upd'+_0x41b247(0x144)),_0x3f4277?.[_0x41b247(0x167)](_0x41b247(0x14a)+_0x41b247(0x16e)+_0x41b247(0x15a)+_0x41b247(0x165),{'config':summarizeOpenClawConfig(_0x12339e['config'])})):_0x3f4277?.[_0x41b247(0x167)](_0x41b247(0x14a)+_0x41b247(0x16e)+_0x41b247(0x10e)+'eady\x20cur'+'rent',{'hasProductModels':hasMeaningfulProductModels(_0x34d030)});}async function _0x592570(){const _0xb9321b=_0x5859e5;await _0x36b57a();const _0x3e6bfe=await _0x5e9967({'port':portNumbers(_0x34d030[_0xb9321b(0x116)][_0xb9321b(0x130)+_0xb9321b(0x16d)],_0x34d030[_0xb9321b(0x116)][_0xb9321b(0x130)+'tart']+0x63)});return{'token':createToken(),'port':_0x3e6bfe};}async function _0x4a7f1a(){const _0x2519ef=_0x5859e5,_0x1c2a45=await _0x2eea59(),_0x52a0ac=asRecord(_0x1c2a45[_0x2519ef(0x16c)]),_0x222b41=asRecord(_0x52a0ac[_0x2519ef(0x186)]),_0x45d417=asRecord(_0x222b41[_0x2519ef(0x188)]),_0x44be30=getTrimmedString(_0x45d417[_0x2519ef(0x10c)]),_0x3d3988=_0x44be30[_0x2519ef(0x120)]('/'),_0x323808=_0x3d3988>0x0?_0x44be30[_0x2519ef(0x14b)](0x0,_0x3d3988):_0x44be30,_0x13f8a9=_0x3d3988>0x0?_0x44be30[_0x2519ef(0x14b)](_0x3d3988+0x1):'',_0x2384bf=asRecord(asRecord(_0x1c2a45[_0x2519ef(0x103)])[_0x2519ef(0x100)+'s']),_0x18500c=asRecord(_0x2384bf[_0x323808]);return{'provider':_0x323808||'','apiKey':getTrimmedString(_0x18500c['apiKey']),'modelName':_0x13f8a9,'modelBaseUrl':getTrimmedString(_0x18500c[_0x2519ef(0x15f)])};}async function _0x313d59(_0x13e0f2,_0x5e4dba={}){const _0x2d8fce=_0x5859e5,_0x4c2dc4=await _0x2eea59(),_0x465f35=_0x13e0f2[_0x2d8fce(0x100)]||_0x2d8fce(0x164),_0x273154=_0x465f35+'/'+_0x13e0f2[_0x2d8fce(0x16a)+'e'],_0x386fb4=asRecord(_0x4c2dc4[_0x2d8fce(0x103)]),_0x53bfd3=asRecord(_0x386fb4[_0x2d8fce(0x100)+'s']);_0x53bfd3[_0x465f35]={...asRecord(_0x53bfd3[_0x465f35]),...createProviderConfig({'apiKey':_0x13e0f2[_0x2d8fce(0x15e)]||'','protocol':_0x13e0f2[_0x2d8fce(0x155)]||_0x2d8fce(0x149),'baseUrl':_0x13e0f2['modelBas'+_0x2d8fce(0x17b)]||_0x13e0f2[_0x2d8fce(0x15f)]||'','modelName':_0x13e0f2[_0x2d8fce(0x16a)+'e']})},_0x386fb4[_0x2d8fce(0x100)+'s']=_0x53bfd3,_0x4c2dc4[_0x2d8fce(0x103)]=_0x386fb4;const _0x338eae=asRecord(_0x4c2dc4['agents']),_0x2071e5=asRecord(_0x338eae[_0x2d8fce(0x186)]);return _0x2071e5[_0x2d8fce(0x188)]={...asRecord(_0x2071e5[_0x2d8fce(0x188)]),'primary':_0x273154},_0x2071e5[_0x2d8fce(0x103)]={...asRecord(_0x2071e5[_0x2d8fce(0x103)]),[_0x273154]:asRecord(asRecord(_0x2071e5['models'])[_0x273154])},_0x338eae['defaults']=_0x2071e5,_0x4c2dc4[_0x2d8fce(0x16c)]=_0x338eae,_0x4c2dc4[_0x2d8fce(0xfe)]={...asRecord(_0x4c2dc4[_0x2d8fce(0xfe)]),'dmScope':_0x2d8fce(0x154)+_0x2d8fce(0x184)},await _0x29c3cc(_0x4c2dc4,_0x5e4dba[_0x2d8fce(0x183)+'nChange']?'model\x20se'+'ttings\x20u'+'pdated':''),{'ok':!![]};}async function _0x83cc56(_0x399578){const _0x577bf6=_0x5859e5,_0x98149b=await _0x2eea59(),_0x2bb33d=_0x399578[_0x577bf6(0x100)+'Key'],_0x32513a=asRecord(_0x98149b['models']),_0x7beef=asRecord(_0x32513a[_0x577bf6(0x100)+'s']);_0x7beef[_0x2bb33d]={...asRecord(_0x7beef[_0x2bb33d]),'apiKey':_0x399578[_0x577bf6(0x15e)],'api':_0x577bf6(0x10d)+_0x577bf6(0x16f)+'ns','baseUrl':_0x399578[_0x577bf6(0x15f)],'models':(_0x399578['modelNam'+'es']??[])['map'](_0x53f021=>createProviderModelConfig(_0x53f021,_0x53f021===_0x399578[_0x577bf6(0x13a)+'elPrimar'+_0x577bf6(0x106)]))},_0x32513a[_0x577bf6(0x100)+'s']=_0x7beef,_0x98149b['models']=_0x32513a;if(_0x399578[_0x577bf6(0x13a)+_0x577bf6(0x107)+_0x577bf6(0x106)]){const _0x1ad9eb=asRecord(_0x98149b['agents']),_0x11fc29=asRecord(_0x1ad9eb[_0x577bf6(0x186)]);_0x11fc29[_0x577bf6(0x13a)+'el']={...asRecord(_0x11fc29['imageMod'+'el']),'primary':_0x2bb33d+'/'+_0x399578[_0x577bf6(0x13a)+'elPrimar'+_0x577bf6(0x106)]},_0x1ad9eb[_0x577bf6(0x186)]=_0x11fc29,_0x98149b[_0x577bf6(0x16c)]=_0x1ad9eb;}return await _0x29c3cc(_0x98149b,_0x577bf6(0x160)+_0x577bf6(0x152)+'dels\x20upd'+_0x577bf6(0x144)),{'ok':!![]};}async function _0xb370da({callbackUrl:_0x32f35b,secret:_0x35db08}){const _0xb7f5e5=_0x5859e5,_0x4cca42=await _0x2eea59(),_0x129a10=asRecord(_0x4cca42[_0xb7f5e5(0x17e)]),_0x159c54=asRecord(_0x129a10['entries']),_0x58df5c=asRecord(_0x159c54[ASK_USER_QUESTION_PLUGIN_ID]);return _0x159c54[ASK_USER_QUESTION_PLUGIN_ID]={..._0x58df5c,'enabled':!![],'config':{...asRecord(_0x58df5c[_0xb7f5e5(0x14c)]),'callbackUrl':_0x32f35b,'secret':_0x35db08}},_0x129a10[_0xb7f5e5(0x175)]=_0x159c54,_0x129a10[_0xb7f5e5(0x168)]=dedupeStrings([...(Array['isArray'](_0x129a10[_0xb7f5e5(0x168)])?_0x129a10[_0xb7f5e5(0x168)]:[])[_0xb7f5e5(0x118)](Boolean),ASK_USER_QUESTION_PLUGIN_ID]),_0x4cca42[_0xb7f5e5(0x17e)]=_0x129a10,await _0x29c3cc(_0x4cca42,''),{'ok':!![]};}async function _0x29c3cc(_0x1aa848,_0x418d0a=''){const _0x5c9185=_0x5859e5;_0x261716(),await _0x2ad1da(_0x1aa848,_0x418d0a||_0x5c9185(0x128)+_0x5c9185(0x125)+'persiste'+'d'),await writeJsonFile(_0x25626a['lastGood'+_0x5c9185(0x105)+'th'],_0x1aa848),_0x3f4277?.[_0x5c9185(0x167)](_0x5c9185(0x172)+_0x5c9185(0x17c)+_0x5c9185(0x115)+'g\x20writte'+'n',{'path':_0x25626a[_0x5c9185(0x176)+_0x5c9185(0x105)+'th'],'reason':_0x418d0a||_0x5c9185(0x128)+_0x5c9185(0x125)+_0x5c9185(0x11e)+'d'});if(_0x418d0a)_0x27bc2b(_0x418d0a);}function _0x261716(){if(_0x57d797)_0x48e6ed+=0x1;}function _0x5b2176(_0x726054){_0x216b4a=_0x726054;}function _0x27bc2b(_0x3e1d35){const _0x37ed03=_0x5859e5;if(!_0x216b4a)return;if(_0x4161e0)clearTimeout(_0x4161e0);_0x3f4277?.[_0x37ed03(0x167)]('gateway\x20'+_0x37ed03(0x101)+_0x37ed03(0xff)+_0x37ed03(0x159)+_0x37ed03(0x134)+'ge',{'reason':_0x3e1d35,'debounceMs':0xfa}),_0x4161e0=setTimeout(()=>_0x216b4a(_0x3e1d35),0xfa);}function _0x1dc08b(){const _0x4dc782=_0x5859e5;unwatchFile(_0x25626a[_0x4dc782(0x129)+'th']),_0x57d797=!![],watchFile(_0x25626a[_0x4dc782(0x129)+'th'],{'interval':0x3e8},(_0x31b968,_0x18abe0)=>{const _0x5ce3c2=_0x4dc782;if(_0x31b968[_0x5ce3c2(0x185)]===_0x18abe0['mtimeMs'])return;if(_0x48e6ed>0x0){_0x48e6ed-=0x1,_0x3f4277?.['info']('config\x20f'+_0x5ce3c2(0x12a)+_0x5ce3c2(0x123)+'red\x20inte'+_0x5ce3c2(0x108)+'te',{'configPath':_0x25626a['configPa'+'th'],'ignoredConfigWatchReloads':_0x48e6ed});return;}_0x3f4277?.[_0x5ce3c2(0x167)](_0x5ce3c2(0x136)+_0x5ce3c2(0x12a)+_0x5ce3c2(0x11a)+'rved\x20ext'+_0x5ce3c2(0x157)+'ange',{'configPath':_0x25626a[_0x5ce3c2(0x129)+'th']}),_0x27bc2b(_0x5ce3c2(0x153)+'hange');});}function _0x59d978(){const _0x34651c=_0x5859e5;if(_0x4161e0)clearTimeout(_0x4161e0);unwatchFile(_0x25626a[_0x34651c(0x129)+'th']),_0x57d797=![],_0x48e6ed=0x0;}return{'paths':_0x25626a,'resolveConfigPath':_0x258400,'resolveStateDir':_0x2ea794,'resolveDeviceIdentityPath':_0x391fa9,'ensureConfigPathEnv':_0x14ca9e,'ensureInitialConfig':_0x36b57a,'ensureGatewaySettings':_0x592570,'readConfig':_0x2eea59,'writeConfig':_0x2ad1da,'syncRuntimePlugins':_0x1d708a,'getModelSettings':_0x4a7f1a,'setModelSettings':_0x313d59,'setSelfOperatedModels':_0x83cc56,'ensureAskUserQuestionPluginConfig':_0xb370da,'markConfigWriteHandledInternally':_0x261716,'setGatewayRestartHandler':_0x5b2176,'watchConfigChanges':_0x1dc08b,'dispose':_0x59d978};}
|
|
1
|
+
const _0x4f2af3=_0x2089;(function(_0x191cd4,_0x22981c){const _0x67a73e=_0x2089,_0xcc5d2c=_0x191cd4();while(!![]){try{const _0x56af98=parseInt(_0x67a73e(0x1c4))/0x1*(parseInt(_0x67a73e(0x202))/0x2)+-parseInt(_0x67a73e(0x1b5))/0x3+-parseInt(_0x67a73e(0x1fd))/0x4+-parseInt(_0x67a73e(0x1ad))/0x5*(-parseInt(_0x67a73e(0x1ce))/0x6)+-parseInt(_0x67a73e(0x1ff))/0x7+-parseInt(_0x67a73e(0x1c5))/0x8+-parseInt(_0x67a73e(0x1f8))/0x9;if(_0x56af98===_0x22981c)break;else _0xcc5d2c['push'](_0xcc5d2c['shift']());}catch(_0x2e00e8){_0xcc5d2c['push'](_0xcc5d2c['shift']());}}}(_0x1ec7,0x26ac8));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 _0x4b8a4c,{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{createRuntimeLogger,summarizeRuntimeManifest}from'./runtime-logger.mjs';import{syncRuntimeManifestPlugins}from'./plugin-sync.mjs';const MEMORY_CORE_PLUGIN_ID='memory-c'+_0x4f2af3(0x1f9),ACTIVE_MEMORY_PLUGIN_ID=_0x4f2af3(0x197)+_0x4f2af3(0x18c),ASK_USER_QUESTION_PLUGIN_ID=_0x4f2af3(0x1fa)+'-questio'+'n';function _0x1ec7(){const _0x1deab2=['tart','557754dJLdsm','primary','Version','dmScope','info\x20loa','elPrimar','plugin\x20c','load','workspac','merge','indexOf','tarted','last-goo','session','stateDir','imageMod','product\x20','written','nfig\x20alr','apiKey','config\x20f','config\x20s','ync','initial\x20','fig\x20chan','ailed','emory','logsDir','\x20config\x20','gatewayS','toString','her\x20obse','rrent','created','keys','anthropi','onfig\x20ch','active-m','utf8','anged','per-chan','ompletio','config','eady\x20cur','rnal\x20wri','rved\x20ext','text','info','manifest','modelBas','aw\x20confi','nfig\x20syn','memory','entries','ensure\x20i','error','now','ernal\x20ch','push','15ehyjzU','plugins\x20','ready\x20cu','mtimeMs','openai','rent','runtime\x20','skills','60402mzBEVP','model','model\x20co','openai-c','nfig\x20upd','map','full','red\x20inte','nChange','modelNam','rated\x20mo','yName','nto\x20open','filter','ated','1afgkBS','657496tiudlP','provider','odel','mode','g\x20writte','onboard','allow','exists','ent\x20ensu','450594ECyUmh','reload\x20s','defaults','auto','ConfigPa','ange','protocol','gateway\x20','stringif','ompleted','Key','c-messag','length','red','entityPa','\x20creatin','persiste','cheduled','nel-peer','ports','agents','environm','ile\x20watc','nitial\x20o','\x20for\x20con','ttings\x20u','ded\x20for\x20','d\x20opencl','lastGood','openclaw','eUrl','hex','plugins','oot','restartO','configPa','deviceId','models','synced\x20i','defaultM','extraDir','baseUrl','37548AxaCDj','ore','ask-user','dataDir','missing;','785296uiXVXj','penclaw\x20','300643lkNozp','isArray'];_0x1ec7=function(){return _0x1deab2;};return _0x1ec7();}function _0x2089(_0x404f54,_0x46d373){_0x404f54=_0x404f54-0x176;const _0x1ec7ae=_0x1ec7();let _0x2089fa=_0x1ec7ae[_0x404f54];return _0x2089fa;}function createToken(){const _0x3e9269=_0x4f2af3;return randomBytes(0x18)[_0x3e9269(0x190)](_0x3e9269(0x1ed));}function createProviderModelConfig(_0x45ca41,_0x27c029=![]){const _0x29675b=_0x4f2af3;return{'id':_0x45ca41,'name':_0x45ca41,'reasoning':!![],'input':_0x27c029?[_0x29675b(0x1a0),'image']:[_0x29675b(0x1a0)],'cost':{'input':0x0,'output':0x0,'cacheRead':0x0,'cacheWrite':0x0},'contextWindow':0x3e800,'maxTokens':0x3e800};}function createProviderConfig(_0x2a058e){const _0x4c25db=_0x4f2af3;return{'apiKey':_0x2a058e[_0x4c25db(0x185)],'api':_0x2a058e[_0x4c25db(0x1d4)]===_0x4c25db(0x195)+'c'?_0x4c25db(0x195)+_0x4c25db(0x1d9)+'es':_0x4c25db(0x1b8)+_0x4c25db(0x19b)+'ns',..._0x2a058e['baseUrl']?{'baseUrl':_0x2a058e[_0x4c25db(0x1f7)]}:{},'models':[createProviderModelConfig(_0x2a058e[_0x4c25db(0x1be)+'e'])]};}function createRuntimePluginBootstrap(_0x21ed72){const _0x5db1fb=_0x4f2af3,_0x233b1a={},_0x12e00a=[];for(const _0x3298ac of _0x21ed72??[]){const _0x1ab8d0=getTrimmedString(_0x3298ac['pluginId']);if(!_0x1ab8d0)continue;_0x233b1a[_0x1ab8d0]={'enabled':!![]},_0x12e00a[_0x5db1fb(0x1ac)](_0x1ab8d0);}return!_0x233b1a[MEMORY_CORE_PLUGIN_ID]&&(_0x233b1a[MEMORY_CORE_PLUGIN_ID]={'enabled':!![],'config':{'dreaming':{'enabled':!![]}}}),!_0x233b1a[ACTIVE_MEMORY_PLUGIN_ID]&&(_0x233b1a[ACTIVE_MEMORY_PLUGIN_ID]={'enabled':!![]}),{'entries':_0x233b1a,'allow':dedupeStrings([..._0x12e00a,MEMORY_CORE_PLUGIN_ID,ACTIVE_MEMORY_PLUGIN_ID]),'bundledDiscovery':'compat'};}function createInitialOpenClawConfig(_0x32fe91,_0x2317a8){const _0x9d9ef5=_0x4f2af3,_0x379451=new Date()['toISOStr'+'ing'](),_0x2e43e8=join(_0x32fe91[_0x9d9ef5(0x1fb)],_0x9d9ef5(0x17a)+'e'),_0xce1a10=asRecord(_0x32fe91[_0x9d9ef5(0x1f3)]),_0x13decb=getTrimmedString(_0xce1a10['defaultM'+'odel']),_0x1fc860={'workspace':_0x2e43e8,'memorySearch':{'enabled':!![],'sources':[_0x9d9ef5(0x1a6)],'provider':_0x9d9ef5(0x1d1)},'compaction':{'memoryFlush':{'enabled':!![],'forceFlushTranscriptBytes':'256kb','softThresholdTokens':0x30d40}}};return _0x13decb&&(_0x1fc860[_0x9d9ef5(0x1b6)]={'primary':_0x13decb}),{'meta':{'lastTouchedVersion':_0x2317a8[_0x9d9ef5(0x1eb)+_0x9d9ef5(0x204)],'lastTouchedAt':_0x379451},'wizard':{'lastRunAt':_0x379451,'lastRunVersion':_0x2317a8[_0x9d9ef5(0x1eb)+'Version'],'lastRunCommand':_0x9d9ef5(0x1ca),'lastRunMode':'local'},'models':{'mode':'merge','providers':asRecord(_0xce1a10[_0x9d9ef5(0x1c6)+'s'])},'agents':{'defaults':_0x1fc860},'tools':{'profile':_0x9d9ef5(0x1bb)},'plugins':createRuntimePluginBootstrap(_0x2317a8[_0x9d9ef5(0x1ee)]),'skills':{'load':{'extraDirs':['skills']}},'session':{'dmScope':_0x9d9ef5(0x19a)+_0x9d9ef5(0x1e0),'reset':{'mode':'idle'}}};}function hasMeaningfulProductModels(_0x15e7fe){const _0x5c1771=_0x4f2af3,_0x5e95b9=asRecord(_0x15e7fe[_0x5c1771(0x1f3)]);return Object[_0x5c1771(0x194)](asRecord(_0x5e95b9[_0x5c1771(0x1c6)+'s']))[_0x5c1771(0x1da)]>0x0||Boolean(getTrimmedString(_0x5e95b9[_0x5c1771(0x1f5)+_0x5c1771(0x1c7)]));}function summarizeOpenClawConfig(_0x5c67b8){const _0x5e04b2=_0x4f2af3,_0x4ccc2a=asRecord(_0x5c67b8[_0x5e04b2(0x1f3)]),_0x5d9ba6=asRecord(_0x4ccc2a[_0x5e04b2(0x1c6)+'s']),_0x237ab9=asRecord(_0x5c67b8[_0x5e04b2(0x1e2)]),_0x14daab=asRecord(_0x237ab9[_0x5e04b2(0x1d0)]),_0x5a2ad0=asRecord(_0x14daab[_0x5e04b2(0x1b6)]),_0x2c3ba9=asRecord(_0x5c67b8['plugins']),_0x1595a8=asRecord(_0x2c3ba9[_0x5e04b2(0x1a7)]),_0x115bd1=asRecord(_0x5c67b8[_0x5e04b2(0x1b4)]),_0x3bcd58=asRecord(_0x115bd1[_0x5e04b2(0x179)]),_0x309722=asRecord(_0x5c67b8[_0x5e04b2(0x17f)]),_0x49991c=Array[_0x5e04b2(0x200)](_0x3bcd58['extraDir'+'s'])?_0x3bcd58[_0x5e04b2(0x1f6)+'s']:[];return{'providerCount':Object[_0x5e04b2(0x194)](_0x5d9ba6)[_0x5e04b2(0x1da)],'defaultModel':getTrimmedString(_0x5a2ad0[_0x5e04b2(0x203)]),'pluginEntryCount':Object['keys'](_0x1595a8)['length'],'pluginAllowCount':Array[_0x5e04b2(0x200)](_0x2c3ba9['allow'])?_0x2c3ba9[_0x5e04b2(0x1cb)]['length']:0x0,'skillExtraDirCount':_0x49991c['length'],'sessionDmScope':getTrimmedString(_0x309722[_0x5e04b2(0x205)])};}function syncProductModels(_0x174e62,_0x2a25cb){const _0x1fa93c=_0x4f2af3;if(!hasMeaningfulProductModels(_0x2a25cb))return{'config':_0x174e62,'changed':![]};let _0x5a03fe=![];const _0x3034ee=asRecord(_0x2a25cb['models']),_0x413420=asRecord(_0x3034ee[_0x1fa93c(0x1c6)+'s']),_0x2c2769=getTrimmedString(_0x3034ee[_0x1fa93c(0x1f5)+_0x1fa93c(0x1c7)]),_0x49fa28=asRecord(_0x174e62[_0x1fa93c(0x1f3)]),_0x1a568d=asRecord(_0x49fa28['provider'+'s']);for(const [_0x52a004,_0x1771e4]of Object[_0x1fa93c(0x1a7)](_0x413420)){const _0x2530f5=asRecord(_0x1a568d[_0x52a004]),_0x8e0121=asRecord(_0x1771e4);JSON['stringif'+'y'](_0x2530f5)!==JSON['stringif'+'y'](_0x8e0121)&&(_0x1a568d[_0x52a004]=_0x8e0121,_0x5a03fe=!![]);}_0x49fa28[_0x1fa93c(0x1c8)]!=='merge'&&(_0x49fa28[_0x1fa93c(0x1c8)]=_0x1fa93c(0x17b),_0x5a03fe=!![]);_0x49fa28[_0x1fa93c(0x1c6)+'s']!==_0x1a568d&&(_0x49fa28[_0x1fa93c(0x1c6)+'s']=_0x1a568d,_0x5a03fe=!![]);_0x174e62[_0x1fa93c(0x1f3)]!==_0x49fa28&&(_0x174e62[_0x1fa93c(0x1f3)]=_0x49fa28,_0x5a03fe=!![]);if(_0x2c2769){const _0x3773b0=asRecord(_0x174e62[_0x1fa93c(0x1e2)]),_0x4376d4=asRecord(_0x3773b0[_0x1fa93c(0x1d0)]),_0x2c2ebe=asRecord(_0x4376d4[_0x1fa93c(0x1b6)]);_0x2c2ebe[_0x1fa93c(0x203)]!==_0x2c2769&&(_0x4376d4[_0x1fa93c(0x1b6)]={..._0x2c2ebe,'primary':_0x2c2769},_0x3773b0['defaults']=_0x4376d4,_0x174e62['agents']=_0x3773b0,_0x5a03fe=!![]);}return{'config':_0x174e62,'changed':_0x5a03fe};}export function createConfigController(_0xe7a3c1){const _0x47a0b3=_0x4f2af3,_0x53b9d4=getConfigPaths(_0xe7a3c1),_0x275fcb=createRuntimeLogger(_0x53b9d4,'config');let _0x48fdee=![],_0x384568=0x0,_0x2aa25a=null,_0x44d184=null;function _0x1a57c6(){const _0x3750ce=_0x2089;return _0x53b9d4[_0x3750ce(0x1f1)+'th'];}function _0x2b3b8f(){const _0x412527=_0x2089;return _0x53b9d4[_0x412527(0x180)];}function _0x44ad41(){const _0x16ea34=_0x2089;return _0x53b9d4[_0x16ea34(0x1f2)+_0x16ea34(0x1dc)+'th'];}async function _0x10a6cf(){const _0x56e5d8=_0x2089;await ensureShellStateDirs(_0xe7a3c1),process.env.OPENCLAW_STATE_DIR=_0x53b9d4[_0x56e5d8(0x180)],process.env.OPENCLAW_CONFIG_PATH=_0x53b9d4['configPa'+'th'],_0x275fcb?.[_0x56e5d8(0x1a1)](_0x56e5d8(0x1eb)+_0x56e5d8(0x18e)+_0x56e5d8(0x1e3)+_0x56e5d8(0x1cd)+_0x56e5d8(0x1db),{'stateDir':_0x53b9d4[_0x56e5d8(0x180)],'configPath':_0x53b9d4['configPa'+'th'],'logsDir':_0x53b9d4[_0x56e5d8(0x18d)]});}async function _0x253909(){const _0x2da500=_0x2089,_0x4f4659=Date['now']();_0x275fcb?.[_0x2da500(0x1a1)]('ensure\x20i'+'nitial\x20o'+_0x2da500(0x1fe)+_0x2da500(0x187)+_0x2da500(0x17d),{'configPath':_0x53b9d4[_0x2da500(0x1f1)+'th'],'stateDir':_0x53b9d4[_0x2da500(0x180)]});try{await _0x10a6cf();const _0x410710=await loadRuntimeInfo(_0xe7a3c1['projectR'+'oot']);_0x275fcb?.[_0x2da500(0x1a1)](_0x2da500(0x1b3)+_0x2da500(0x176)+_0x2da500(0x1e8)+_0x2da500(0x187)+_0x2da500(0x188),{'runtimeRoot':_0x410710['runtimeR'+'oot'],'manifest':summarizeRuntimeManifest(_0x410710[_0x2da500(0x1a2)])});if(!existsSync(_0x53b9d4[_0x2da500(0x1f1)+'th'])){const _0x71b245=createInitialOpenClawConfig(_0xe7a3c1,_0x410710);_0x275fcb?.[_0x2da500(0x1a1)](_0x2da500(0x189)+_0x2da500(0x1eb)+_0x2da500(0x18e)+_0x2da500(0x1fc)+_0x2da500(0x1dd)+'g',{'configPath':_0x53b9d4[_0x2da500(0x1f1)+'th'],'config':summarizeOpenClawConfig(_0x71b245)}),_0x3d7f20(),await _0x24bd40(_0x71b245,_0x2da500(0x189)+_0x2da500(0x1eb)+_0x2da500(0x18e)+_0x2da500(0x193)),await writeJson(_0x53b9d4[_0x2da500(0x1ea)+_0x2da500(0x1d2)+'th'],_0x71b245),_0x275fcb?.[_0x2da500(0x1a1)](_0x2da500(0x17e)+_0x2da500(0x1e9)+_0x2da500(0x1a4)+_0x2da500(0x1c9)+'n',{'path':_0x53b9d4[_0x2da500(0x1ea)+_0x2da500(0x1d2)+'th'],'reason':_0x2da500(0x189)+_0x2da500(0x1eb)+_0x2da500(0x18e)+_0x2da500(0x193)});}else _0x275fcb?.[_0x2da500(0x1a1)](_0x2da500(0x189)+_0x2da500(0x1eb)+_0x2da500(0x18e)+_0x2da500(0x1cc),{'configPath':_0x53b9d4['configPa'+'th']});await _0x46a9d5(),await _0x1063b5(),_0x275fcb?.[_0x2da500(0x1a1)]('ensure\x20i'+_0x2da500(0x1e5)+_0x2da500(0x1fe)+'config\x20c'+_0x2da500(0x1d7),{'durationMs':Date[_0x2da500(0x1aa)]()-_0x4f4659});}catch(_0x480fec){_0x275fcb?.[_0x2da500(0x1a9)](_0x2da500(0x1a8)+'nitial\x20o'+'penclaw\x20'+_0x2da500(0x186)+_0x2da500(0x18b),{'durationMs':Date['now']()-_0x4f4659,'error':_0x480fec});throw _0x480fec;}}async function _0x10a669(){const _0x16d2a5=_0x2089;return await _0x253909(),readJsonFile(_0x53b9d4[_0x16d2a5(0x1f1)+'th'],{});}async function _0x5a29f7(){return readJsonFile(_0x53b9d4['configPa'+'th'],{});}async function _0x24bd40(_0x3cb25a,_0x19e91f=_0x47a0b3(0x1eb)+_0x47a0b3(0x18e)+_0x47a0b3(0x183)){const _0x4f9c26=_0x47a0b3;await mkdir(dirname(_0x53b9d4[_0x4f9c26(0x1f1)+'th']),{'recursive':!![]}),await writeFile(_0x53b9d4[_0x4f9c26(0x1f1)+'th'],JSON[_0x4f9c26(0x1d6)+'y'](_0x3cb25a,null,0x2)+'\x0a',_0x4f9c26(0x198)),_0x275fcb?.['info'](_0x19e91f,{'configPath':_0x53b9d4[_0x4f9c26(0x1f1)+'th'],'config':summarizeOpenClawConfig(_0x3cb25a)});}async function _0x1063b5(){const _0x19db82=_0x47a0b3,_0x5a4bcd=await loadRuntimeInfo(_0xe7a3c1['projectR'+_0x19db82(0x1ef)]),_0x332314=await _0x5a29f7(),_0x54c35f=syncRuntimeManifestPlugins(_0x332314[_0x19db82(0x1ee)],_0x5a4bcd[_0x19db82(0x1ee)]);_0x54c35f['changed']||!_0x332314[_0x19db82(0x1ee)]?(_0x332314['plugins']=_0x54c35f[_0x19db82(0x1ee)],_0x3d7f20(),await _0x24bd40(_0x332314,'runtime\x20'+_0x19db82(0x1ae)+_0x19db82(0x1f4)+_0x19db82(0x1c1)+'claw\x20con'+'fig'),_0x275fcb?.[_0x19db82(0x1a1)]('runtime\x20'+'plugin\x20c'+_0x19db82(0x196)+_0x19db82(0x199),{'runtimePluginCount':_0x5a4bcd[_0x19db82(0x1ee)][_0x19db82(0x1da)],'config':summarizeOpenClawConfig(_0x332314)})):_0x275fcb?.['info']('runtime\x20'+_0x19db82(0x178)+'onfig\x20al'+_0x19db82(0x1af)+_0x19db82(0x192),{'runtimePluginCount':_0x5a4bcd[_0x19db82(0x1ee)][_0x19db82(0x1da)]});}async function _0x46a9d5(){const _0x2d8d1c=_0x47a0b3,_0x337d90=await _0x5a29f7(),_0x773e27=syncProductModels(_0x337d90,_0xe7a3c1);_0x773e27['changed']?(await _0x5956fb(_0x773e27[_0x2d8d1c(0x19c)],_0x2d8d1c(0x182)+_0x2d8d1c(0x1b7)+_0x2d8d1c(0x1b9)+_0x2d8d1c(0x1c3)),_0x275fcb?.['info']('product\x20'+_0x2d8d1c(0x1b7)+_0x2d8d1c(0x1a5)+'ced',{'config':summarizeOpenClawConfig(_0x773e27[_0x2d8d1c(0x19c)])})):_0x275fcb?.[_0x2d8d1c(0x1a1)]('product\x20'+_0x2d8d1c(0x1b7)+_0x2d8d1c(0x184)+_0x2d8d1c(0x19d)+_0x2d8d1c(0x1b2),{'hasProductModels':hasMeaningfulProductModels(_0xe7a3c1)});}async function _0x341d54(){const _0x3023a7=_0x47a0b3;await _0x253909();const _0x1f2ccc=await _0x4b8a4c({'port':portNumbers(_0xe7a3c1[_0x3023a7(0x1e1)][_0x3023a7(0x18f)+'tart'],_0xe7a3c1['ports'][_0x3023a7(0x18f)+_0x3023a7(0x201)]+0x63)});return{'token':createToken(),'port':_0x1f2ccc};}async function _0x46f207(){const _0x36548d=_0x47a0b3,_0x1f5e26=await _0x10a669(),_0x3ea305=asRecord(_0x1f5e26[_0x36548d(0x1e2)]),_0x10e54b=asRecord(_0x3ea305['defaults']),_0x2ddc35=asRecord(_0x10e54b[_0x36548d(0x1b6)]),_0x17d826=getTrimmedString(_0x2ddc35['primary']),_0x1806a8=_0x17d826[_0x36548d(0x17c)]('/'),_0x297bbc=_0x1806a8>0x0?_0x17d826['slice'](0x0,_0x1806a8):_0x17d826,_0x59c6e4=_0x1806a8>0x0?_0x17d826['slice'](_0x1806a8+0x1):'',_0x557108=asRecord(asRecord(_0x1f5e26[_0x36548d(0x1f3)])[_0x36548d(0x1c6)+'s']),_0x25efc0=asRecord(_0x557108[_0x297bbc]);return{'provider':_0x297bbc||'','apiKey':getTrimmedString(_0x25efc0['apiKey']),'modelName':_0x59c6e4,'modelBaseUrl':getTrimmedString(_0x25efc0[_0x36548d(0x1f7)])};}async function _0x3d606d(_0xe61cb5,_0x259b86={}){const _0x2e6142=_0x47a0b3,_0x3e1c7c=await _0x10a669(),_0x5b1eff=_0xe61cb5[_0x2e6142(0x1c6)]||'default',_0x46bef1=_0x5b1eff+'/'+_0xe61cb5[_0x2e6142(0x1be)+'e'],_0x38d0=asRecord(_0x3e1c7c[_0x2e6142(0x1f3)]),_0x541b25=asRecord(_0x38d0[_0x2e6142(0x1c6)+'s']);_0x541b25[_0x5b1eff]={...asRecord(_0x541b25[_0x5b1eff]),...createProviderConfig({'apiKey':_0xe61cb5['apiKey']||'','protocol':_0xe61cb5['protocol']||_0x2e6142(0x1b1),'baseUrl':_0xe61cb5[_0x2e6142(0x1a3)+_0x2e6142(0x1ec)]||_0xe61cb5[_0x2e6142(0x1f7)]||'','modelName':_0xe61cb5[_0x2e6142(0x1be)+'e']})},_0x38d0['provider'+'s']=_0x541b25,_0x3e1c7c[_0x2e6142(0x1f3)]=_0x38d0;const _0x2dad50=asRecord(_0x3e1c7c[_0x2e6142(0x1e2)]),_0x542346=asRecord(_0x2dad50[_0x2e6142(0x1d0)]);return _0x542346[_0x2e6142(0x1b6)]={...asRecord(_0x542346[_0x2e6142(0x1b6)]),'primary':_0x46bef1},_0x542346[_0x2e6142(0x1f3)]={...asRecord(_0x542346[_0x2e6142(0x1f3)]),[_0x46bef1]:asRecord(asRecord(_0x542346['models'])[_0x46bef1])},_0x2dad50[_0x2e6142(0x1d0)]=_0x542346,_0x3e1c7c[_0x2e6142(0x1e2)]=_0x2dad50,_0x3e1c7c[_0x2e6142(0x17f)]={...asRecord(_0x3e1c7c[_0x2e6142(0x17f)]),'dmScope':_0x2e6142(0x19a)+_0x2e6142(0x1e0)},await _0x5956fb(_0x3e1c7c,_0x259b86[_0x2e6142(0x1f0)+_0x2e6142(0x1bd)]?'model\x20se'+_0x2e6142(0x1e7)+'pdated':''),{'ok':!![]};}async function _0x3f4934(_0x5f3408){const _0x34d3d2=_0x47a0b3,_0x297750=await _0x10a669(),_0x4efac4=_0x5f3408['provider'+_0x34d3d2(0x1d8)],_0x5f0170=asRecord(_0x297750[_0x34d3d2(0x1f3)]),_0x2d49ff=asRecord(_0x5f0170[_0x34d3d2(0x1c6)+'s']);_0x2d49ff[_0x4efac4]={...asRecord(_0x2d49ff[_0x4efac4]),'apiKey':_0x5f3408[_0x34d3d2(0x185)],'api':_0x34d3d2(0x1b8)+_0x34d3d2(0x19b)+'ns','baseUrl':_0x5f3408[_0x34d3d2(0x1f7)],'models':(_0x5f3408[_0x34d3d2(0x1be)+'es']??[])[_0x34d3d2(0x1ba)](_0x4636b4=>createProviderModelConfig(_0x4636b4,_0x4636b4===_0x5f3408[_0x34d3d2(0x181)+_0x34d3d2(0x177)+_0x34d3d2(0x1c0)]))},_0x5f0170['provider'+'s']=_0x2d49ff,_0x297750['models']=_0x5f0170;if(_0x5f3408[_0x34d3d2(0x181)+_0x34d3d2(0x177)+_0x34d3d2(0x1c0)]){const _0x32e9f9=asRecord(_0x297750['agents']),_0x292c1f=asRecord(_0x32e9f9[_0x34d3d2(0x1d0)]);_0x292c1f[_0x34d3d2(0x181)+'el']={...asRecord(_0x292c1f[_0x34d3d2(0x181)+'el']),'primary':_0x4efac4+'/'+_0x5f3408[_0x34d3d2(0x181)+_0x34d3d2(0x177)+_0x34d3d2(0x1c0)]},_0x32e9f9[_0x34d3d2(0x1d0)]=_0x292c1f,_0x297750[_0x34d3d2(0x1e2)]=_0x32e9f9;}return await _0x5956fb(_0x297750,'self-ope'+_0x34d3d2(0x1bf)+'dels\x20upd'+_0x34d3d2(0x1c3)),{'ok':!![]};}async function _0x264f7c({callbackUrl:_0x1a1888,secret:_0xa0424c}){const _0x373fa7=_0x47a0b3,_0x38e3a3=await _0x10a669(),_0x2b8e08=asRecord(_0x38e3a3['plugins']),_0x10ebab=asRecord(_0x2b8e08[_0x373fa7(0x1a7)]),_0x25d8e1=asRecord(_0x10ebab[ASK_USER_QUESTION_PLUGIN_ID]);return _0x10ebab[ASK_USER_QUESTION_PLUGIN_ID]={..._0x25d8e1,'enabled':!![],'config':{...asRecord(_0x25d8e1[_0x373fa7(0x19c)]),'callbackUrl':_0x1a1888,'secret':_0xa0424c}},_0x2b8e08[_0x373fa7(0x1a7)]=_0x10ebab,_0x2b8e08[_0x373fa7(0x1cb)]=dedupeStrings([...(Array[_0x373fa7(0x200)](_0x2b8e08[_0x373fa7(0x1cb)])?_0x2b8e08[_0x373fa7(0x1cb)]:[])[_0x373fa7(0x1c2)](Boolean),ASK_USER_QUESTION_PLUGIN_ID]),_0x38e3a3[_0x373fa7(0x1ee)]=_0x2b8e08,await _0x5956fb(_0x38e3a3,''),{'ok':!![]};}async function _0x5956fb(_0x90f01b,_0x2b559a=''){const _0x112790=_0x47a0b3;_0x3d7f20(),await _0x24bd40(_0x90f01b,_0x2b559a||_0x112790(0x1eb)+'\x20config\x20'+_0x112790(0x1de)+'d'),await writeJsonFile(_0x53b9d4[_0x112790(0x1ea)+'ConfigPa'+'th'],_0x90f01b),_0x275fcb?.[_0x112790(0x1a1)](_0x112790(0x17e)+_0x112790(0x1e9)+_0x112790(0x1a4)+_0x112790(0x1c9)+'n',{'path':_0x53b9d4['lastGood'+_0x112790(0x1d2)+'th'],'reason':_0x2b559a||_0x112790(0x1eb)+_0x112790(0x18e)+_0x112790(0x1de)+'d'});if(_0x2b559a)_0x1543d6(_0x2b559a);}function _0x3d7f20(){if(_0x48fdee)_0x384568+=0x1;}function _0x576db5(_0x557a3b){_0x44d184=_0x557a3b;}function _0x1543d6(_0x2c6ffd){const _0xd30180=_0x47a0b3;if(!_0x44d184)return;if(_0x2aa25a)clearTimeout(_0x2aa25a);_0x275fcb?.[_0xd30180(0x1a1)](_0xd30180(0x1d5)+_0xd30180(0x1cf)+_0xd30180(0x1df)+_0xd30180(0x1e6)+_0xd30180(0x18a)+'ge',{'reason':_0x2c6ffd,'debounceMs':0xfa}),_0x2aa25a=setTimeout(()=>_0x44d184(_0x2c6ffd),0xfa);}function _0x4359fd(){const _0x455b37=_0x47a0b3;unwatchFile(_0x53b9d4['configPa'+'th']),_0x48fdee=!![],watchFile(_0x53b9d4[_0x455b37(0x1f1)+'th'],{'interval':0x3e8},(_0x3b1814,_0x200b3b)=>{const _0x37b86d=_0x455b37;if(_0x3b1814[_0x37b86d(0x1b0)]===_0x200b3b['mtimeMs'])return;if(_0x384568>0x0){_0x384568-=0x1,_0x275fcb?.[_0x37b86d(0x1a1)](_0x37b86d(0x186)+_0x37b86d(0x1e4)+'her\x20igno'+_0x37b86d(0x1bc)+_0x37b86d(0x19e)+'te',{'configPath':_0x53b9d4[_0x37b86d(0x1f1)+'th'],'ignoredConfigWatchReloads':_0x384568});return;}_0x275fcb?.[_0x37b86d(0x1a1)](_0x37b86d(0x186)+_0x37b86d(0x1e4)+_0x37b86d(0x191)+_0x37b86d(0x19f)+_0x37b86d(0x1ab)+_0x37b86d(0x1d3),{'configPath':_0x53b9d4['configPa'+'th']}),_0x1543d6('config\x20c'+'hange');});}function _0x5bf41f(){const _0x26fd66=_0x47a0b3;if(_0x2aa25a)clearTimeout(_0x2aa25a);unwatchFile(_0x53b9d4[_0x26fd66(0x1f1)+'th']),_0x48fdee=![],_0x384568=0x0;}return{'paths':_0x53b9d4,'resolveConfigPath':_0x1a57c6,'resolveStateDir':_0x2b3b8f,'resolveDeviceIdentityPath':_0x44ad41,'ensureConfigPathEnv':_0x10a6cf,'ensureInitialConfig':_0x253909,'ensureGatewaySettings':_0x341d54,'readConfig':_0x10a669,'writeConfig':_0x24bd40,'syncRuntimePlugins':_0x1063b5,'getModelSettings':_0x46f207,'setModelSettings':_0x3d606d,'setSelfOperatedModels':_0x3f4934,'ensureAskUserQuestionPluginConfig':_0x264f7c,'markConfigWriteHandledInternally':_0x3d7f20,'setGatewayRestartHandler':_0x576db5,'watchConfigChanges':_0x4359fd,'dispose':_0x5bf41f};}
|