@wujie-shell/core 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- 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
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Electron main/preload implementation used by product UI projects.
|
|
|
7
7
|
|
|
8
8
|
## Responsibility
|
|
9
9
|
|
|
10
|
-
- Prepare `apps/<product>/.tmp/runtime`
|
|
10
|
+
- Prepare `apps/<product>/.tmp/runtime` for the product.
|
|
11
11
|
- Install or validate the configured OpenClaw version.
|
|
12
12
|
- Sync product Plugin, Agent, and Skill directories into the runtime.
|
|
13
13
|
- Generate and maintain `~/<dataDirName>/openclaw.json`.
|
|
@@ -54,7 +54,7 @@ Options:
|
|
|
54
54
|
|
|
55
55
|
Behavior:
|
|
56
56
|
|
|
57
|
-
-
|
|
57
|
+
- Builds or refreshes the product-local runtime base when needed.
|
|
58
58
|
- Validates Node runtime version.
|
|
59
59
|
- Installs the configured OpenClaw version when `prepare` is used and versions
|
|
60
60
|
differ.
|
|
@@ -63,10 +63,14 @@ Behavior:
|
|
|
63
63
|
- Copies product agents into `openclaw/agents`.
|
|
64
64
|
- Copies product global skills into `openclaw/skills`.
|
|
65
65
|
- Writes `bin/wujieclaw` so OpenClaw uses the product data directory and config.
|
|
66
|
+
The wrapper plays the Wujie startup logo animation (`bin/wujie-logo.mjs`,
|
|
67
|
+
copied from `assets/wujie-logo.mjs`) before exec'ing OpenClaw. It only runs on
|
|
68
|
+
an interactive TTY and can be disabled with `WUJIE_NO_LOGO=1`.
|
|
66
69
|
- Updates `runtime-manifest.json` with product metadata.
|
|
67
70
|
|
|
68
|
-
`syncOnly: true` does not install a new OpenClaw version; it
|
|
69
|
-
prepared runtime already matches the
|
|
71
|
+
`syncOnly: true` does not install a new OpenClaw version; it builds any missing
|
|
72
|
+
runtime base files, then validates that the prepared runtime already matches the
|
|
73
|
+
configured OpenClaw version.
|
|
70
74
|
|
|
71
75
|
The desktop gateway startup calls `ensureOpenClawDoctorFixed()` before
|
|
72
76
|
launching OpenClaw. That check compares the embedded runtime version with a
|
|
@@ -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
|
-
|
|
2
|
+
function _0x525e(_0x4d99fd,_0x53d628){_0x4d99fd=_0x4d99fd-0xc5;const _0x4a178f=_0x4a17();let _0x525e29=_0x4a178f[_0x4d99fd];return _0x525e29;}(function(_0x5d62b7,_0x53b93b){const _0x366155=_0x525e,_0x252c5b=_0x5d62b7();while(!![]){try{const _0x551249=-parseInt(_0x366155(0xe9))/0x1*(-parseInt(_0x366155(0xc6))/0x2)+-parseInt(_0x366155(0xe2))/0x3+-parseInt(_0x366155(0xd3))/0x4*(-parseInt(_0x366155(0xdd))/0x5)+parseInt(_0x366155(0xdb))/0x6*(parseInt(_0x366155(0xe4))/0x7)+parseInt(_0x366155(0xcd))/0x8+parseInt(_0x366155(0xe6))/0x9+-parseInt(_0x366155(0xcf))/0xa*(parseInt(_0x366155(0xdf))/0xb);if(_0x551249===_0x53b93b)break;else _0x252c5b['push'](_0x252c5b['shift']());}catch(_0x4dcca1){_0x252c5b['push'](_0x252c5b['shift']());}}}(_0x4a17,0x864fd));import{resolve}from'node:path';import{loadShellConfig}from'@wujie-shell/config';import{prepareRuntime}from'../src/runtime.mjs';function parseArgs(_0x42f503){const _0x26c039=_0x525e,_0x128f55=[..._0x42f503],_0x2df09d=_0x128f55[_0x26c039(0xed)]()||_0x26c039(0xc9),_0x41a96c={'project':process[_0x26c039(0xd6)]()};for(let _0x2774e7=0x0;_0x2774e7<_0x128f55['length'];_0x2774e7+=0x1){const _0x1fdbb1=_0x128f55[_0x2774e7];(_0x1fdbb1===_0x26c039(0xd4)+'t'||_0x1fdbb1==='-p')&&(_0x41a96c[_0x26c039(0xe8)]=_0x128f55[_0x2774e7+0x1],_0x2774e7+=0x1);}return{'command':_0x2df09d,'options':_0x41a96c};}function usage(){const _0x4fc9c4=_0x525e;console[_0x4fc9c4(0xd0)](_0x4fc9c4(0xdc)+_0x4fc9c4(0xd9)+_0x4fc9c4(0xe1)+_0x4fc9c4(0xeb)+'l\x20prepar'+_0x4fc9c4(0xda)+_0x4fc9c4(0xe5)+_0x4fc9c4(0xde)+_0x4fc9c4(0xd1)+_0x4fc9c4(0xee)+_0x4fc9c4(0xc7)+'oject\x20<u'+'i-projec'+_0x4fc9c4(0xd8));}function _0x4a17(){const _0xeb6d7=['ect\x20<ui-','1625391JChuDF','plugins','project','29TYahAb','command:','jie-shel','slice','shift','-shell\x20s','Version','stack','46760IbMguV','ync\x20--pr','--help','help','exit','prepare','length','7126104ntJlDu','/.tmp/ru','20700qvJNsN','log','\x0a\x20\x20wujie','ntime','2174136sPncet','--projec','error','cwd','stringif','t>\x0a','ell\x0a\x0aUsa','e\x20--proj','19014vhIBzE','wujie-sh','5NhzcIi','project>','4950iwfpdz','sync','ge:\x0a\x20\x20wu','2443332PUnlnP','unknown\x20','7yhnkPN'];_0x4a17=function(){return _0xeb6d7;};return _0x4a17();}async function main(){const _0x289d2b=_0x525e,{command:_0x20ba1f,options:_0x536c5c}=parseArgs(process['argv'][_0x289d2b(0xec)](0x2));if(_0x20ba1f===_0x289d2b(0xc9)||_0x20ba1f===_0x289d2b(0xc8)||_0x20ba1f==='-h'){usage();return;}if(_0x20ba1f!==_0x289d2b(0xcb)&&_0x20ba1f!==_0x289d2b(0xe0))throw new Error(_0x289d2b(0xe3)+_0x289d2b(0xea)+'\x20'+_0x20ba1f);const _0x523a56=resolve(_0x536c5c[_0x289d2b(0xe8)]),_0x148cf0=await loadShellConfig(_0x523a56),_0x117c70=await prepareRuntime(_0x148cf0,{'syncOnly':_0x20ba1f===_0x289d2b(0xe0)});console[_0x289d2b(0xd0)](JSON[_0x289d2b(0xd7)+'y']({'ok':!![],'command':_0x20ba1f,'projectRoot':_0x523a56,'runtimeRoot':_0x523a56+(_0x289d2b(0xce)+_0x289d2b(0xd2)),'openclawVersion':_0x117c70['openclaw'+_0x289d2b(0xef)],'pluginCount':Array['isArray'](_0x117c70['plugins'])?_0x117c70[_0x289d2b(0xe7)][_0x289d2b(0xcc)]:0x0},null,0x2));}main()['catch'](_0x5b08d7=>{const _0x5afd38=_0x525e;console[_0x5afd38(0xd5)](_0x5b08d7 instanceof Error?_0x5b08d7[_0x5afd38(0xc5)]||_0x5b08d7['message']:String(_0x5b08d7)),process[_0x5afd38(0xca)](0x1);});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x21725c,_0x15d903){const _0x50205e=_0x2b3f,_0x49bfb5=_0x21725c();while(!![]){try{const _0x4643e3=parseInt(_0x50205e(0x8e))/0x1*(parseInt(_0x50205e(0x80))/0x2)+parseInt(_0x50205e(0x7e))/0x3+parseInt(_0x50205e(0x9e))/0x4*(parseInt(_0x50205e(0x9d))/0x5)+parseInt(_0x50205e(0x85))/0x6+parseInt(_0x50205e(0x82))/0x7+-parseInt(_0x50205e(0xa1))/0x8+-parseInt(_0x50205e(0x90))/0x9*(parseInt(_0x50205e(0x98))/0xa);if(_0x4643e3===_0x15d903)break;else _0x49bfb5['push'](_0x49bfb5['shift']());}catch(_0x1dec81){_0x49bfb5['push'](_0x49bfb5['shift']());}}}(_0x1ebc,0x8e05f));import{existsSync}from'node:fs';function _0x1ebc(){const _0x3dfb90=['filter','skills','led\x20to\x20r','main','isArray','1PxMPxz','trim','823869RtHbTc','object','startsWi','ead\x20skil','push','lls]\x20fai','agents','ory','200zUnwCi','stringif','list','has','load','610FExZbR','15364xcnPHc','utf8','extraDir','6536624IzPgtP','876264kYeesA','name','2252800aMVcXF','entries','7819553eZAEPH','hell:ski','agentAll','1352736JuAwEu','find','length','map'];_0x1ebc=function(){return _0x3dfb90;};return _0x1ebc();}function _0x2b3f(_0x1c1615,_0x1f39c1){_0x1c1615=_0x1c1615-0x7e;const _0x1ebc90=_0x1ebc();let _0x2b3f60=_0x1ebc90[_0x1c1615];return _0x2b3f60;}import{readdir}from'node:fs/promises';import{join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'./utils.mjs';async function listValidSkillKeys(_0x57892b,_0x3fee07){const _0x3f7ad1=_0x2b3f;if(!existsSync(_0x57892b))return[];let _0x3c42fb=[];try{_0x3c42fb=await readdir(_0x57892b,{'withFileTypes':!![],'encoding':_0x3f7ad1(0x9f)});}catch(_0x3158e5){return console['warn']('[wujie-s'+_0x3f7ad1(0x83)+_0x3f7ad1(0x95)+_0x3f7ad1(0x8b)+_0x3f7ad1(0x93)+'ls\x20dir\x20a'+'gent='+_0x3fee07,_0x3158e5),[];}const _0x6d6ee3=[];for(const _0x1151ff of _0x3c42fb){if(!_0x1151ff['isDirect'+_0x3f7ad1(0x97)]())continue;const _0x8aae6e=_0x1151ff[_0x3f7ad1(0x7f)][_0x3f7ad1(0x8f)]();if(!_0x8aae6e||_0x8aae6e[_0x3f7ad1(0x92)+'th']('_'))continue;if(existsSync(join(_0x57892b,_0x8aae6e,'SKILL.md')))_0x6d6ee3['push'](_0x8aae6e);}return _0x6d6ee3;}export async function discoverBundledAgentSkills(_0x2d27bd,_0x48dacd){const _0x357be5=_0x2b3f,_0x2adb12=[],_0x16cf88={},_0xd951c8={};for(const _0x1f6be5 of _0x2d27bd){const _0xaa953=_0x48dacd(_0x1f6be5),_0x238a1a=await listValidSkillKeys(_0xaa953,_0x1f6be5);_0xd951c8[_0x1f6be5]=_0x238a1a,_0x238a1a['length']>0x0&&(_0x2adb12[_0x357be5(0x94)](_0xaa953),_0x16cf88[_0x1f6be5]=_0xaa953);}return{'extraDirs':_0x2adb12,'extraDirByAgent':_0x16cf88,'agentAllowlist':_0xd951c8};}export async function syncBundledAgentSkillsToConfig({agentIds:_0x18a978,resolveSkillsDir:_0x93fd61,readConfig:_0x3797bf,writeConfig:_0xa0a835,markConfigWriteHandledInternally:_0x4afcd9}){const _0xd8cff4=_0x2b3f,_0x4ef429=await discoverBundledAgentSkills(_0x18a978,_0x93fd61);if(_0x18a978[_0xd8cff4(0x87)]===0x0)return{'discovery':_0x4ef429,'changed':![]};const _0x2bed85=await _0x3797bf();let _0xe52d=![];const _0x19197c=asRecord(_0x2bed85['skills']),_0x276f1e=asRecord(_0x19197c[_0xd8cff4(0x9c)]),_0x5ee61d=asStringArray(_0x276f1e[_0xd8cff4(0xa0)+'s']),_0x32730c=dedupeStrings([..._0x5ee61d,..._0x4ef429['extraDir'+'s']]);JSON[_0xd8cff4(0x99)+'y'](_0x5ee61d)!==JSON[_0xd8cff4(0x99)+'y'](_0x32730c)&&(_0x276f1e[_0xd8cff4(0xa0)+'s']=_0x32730c,_0x19197c[_0xd8cff4(0x9c)]=_0x276f1e,_0x2bed85[_0xd8cff4(0x8a)]=_0x19197c,_0xe52d=!![]);const _0xddd61a=asRecord(_0x2bed85[_0xd8cff4(0x96)]),_0x492b34=Array[_0xd8cff4(0x8d)](_0xddd61a[_0xd8cff4(0x9a)])?_0xddd61a[_0xd8cff4(0x9a)]:[];if(_0x492b34[_0xd8cff4(0x87)]>0x0){const _0x331929=_0x492b34[_0xd8cff4(0x88)](_0x2ef3cc=>_0x2ef3cc&&typeof _0x2ef3cc===_0xd8cff4(0x91)?{..._0x2ef3cc}:_0x2ef3cc);let _0x8f112d=![];for(const [_0x1c8a6f,_0x141d0a]of Object[_0xd8cff4(0x81)](_0x4ef429[_0xd8cff4(0x84)+'owlist'])){if(_0x1c8a6f===_0xd8cff4(0x8c))continue;const _0x27d42b=_0x331929[_0xd8cff4(0x86)](_0x50ee14=>asRecord(_0x50ee14)['id']===_0x1c8a6f);if(!_0x27d42b)continue;const _0x350375=Array[_0xd8cff4(0x8d)](_0x27d42b[_0xd8cff4(0x8a)])?_0x27d42b[_0xd8cff4(0x8a)]:null;(!_0x350375||JSON[_0xd8cff4(0x99)+'y'](_0x350375)!==JSON[_0xd8cff4(0x99)+'y'](_0x141d0a))&&(_0x27d42b[_0xd8cff4(0x8a)]=_0x141d0a,_0x8f112d=!![]);}_0x8f112d&&(_0xddd61a[_0xd8cff4(0x9a)]=_0x331929,_0x2bed85[_0xd8cff4(0x96)]=_0xddd61a,_0xe52d=!![]);}return _0xe52d&&(_0x4afcd9?.(),await _0xa0a835(_0x2bed85)),{'discovery':_0x4ef429,'changed':_0xe52d};}export function filterSkillsForAgent(_0x5ebfd3,_0x3051c5,_0x3ed5b5=''){const _0x3352a2=_0x2b3f,_0x1bf6a6=Array['isArray'](asRecord(_0x5ebfd3)[_0x3352a2(0x8a)])?asRecord(_0x5ebfd3)[_0x3352a2(0x8a)]:[],_0x559c77=getTrimmedString(_0x3ed5b5)||_0x3352a2(0x8c),_0x30cd63=Array[_0x3352a2(0x8d)](asRecord(asRecord(_0x3051c5)[_0x3352a2(0x96)])[_0x3352a2(0x9a)])?asRecord(asRecord(_0x3051c5)[_0x3352a2(0x96)])['list']:[],_0x1ada21=_0x30cd63['map'](asRecord)['find'](_0x5b6bb7=>getTrimmedString(_0x5b6bb7['id'])===_0x559c77),_0x37271b=_0x1ada21&&Array[_0x3352a2(0x8d)](_0x1ada21[_0x3352a2(0x8a)])?new Set(asStringArray(_0x1ada21[_0x3352a2(0x8a)])):null;if(!_0x37271b)return _0x5ebfd3;return{...asRecord(_0x5ebfd3),'skills':_0x1bf6a6[_0x3352a2(0x89)](_0x5daf80=>_0x37271b[_0x3352a2(0x9b)](getTrimmedString(asRecord(_0x5daf80)[_0x3352a2(0x7f)])))};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4778a7,_0x353e1b){const _0x2caacd=_0xa985,_0x717dcb=_0x4778a7();while(!![]){try{const _0x10d803=parseInt(_0x2caacd(0x1e6))/0x1+parseInt(_0x2caacd(0x1bd))/0x2+-parseInt(_0x2caacd(0x1e0))/0x3+parseInt(_0x2caacd(0x1c9))/0x4+-parseInt(_0x2caacd(0x1c2))/0x5+-parseInt(_0x2caacd(0x1c0))/0x6*(-parseInt(_0x2caacd(0x1b7))/0x7)+parseInt(_0x2caacd(0x1e3))/0x8*(-parseInt(_0x2caacd(0x1c6))/0x9);if(_0x10d803===_0x353e1b)break;else _0x717dcb['push'](_0x717dcb['shift']());}catch(_0xbe4176){_0x717dcb['push'](_0x717dcb['shift']());}}}(_0x1f4b,0xa0b7b));import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm}from'node:fs/promises';function _0x1f4b(){const _0x104c56=['parse','includes','1289226LiiFqR','error','6232680RFXMpL','nts]\x20fai','tyDomain','agents','2684754muwTdF','filter','trim','1258284LYHnlO','main','capabili','some','isArray','ync\x20bund','emoji','[wujie-s','managedP','aths','relPath','avatar','afe\x20mana','toolDoma','version','map','led\x20to\x20s','son','absPath','ory','icon','name','cnName','1513998wSfDPo','workspac','readme.j','8XYHbXa','led\x20agen','agentId','498346ZdENxF','all','length','startsWi','warn','35uhzMfW','model','find','nts]\x20ski','hell:age','isDirect','1641070zFPRPJ'];_0x1f4b=function(){return _0x104c56;};return _0x1f4b();}import{dirname,join,resolve,sep}from'node:path';import{asRecord,asStringArray,getTrimmedString,readJson}from'./utils.mjs';function toOptionalString(_0x3a7b83){const _0x361aae=getTrimmedString(_0x3a7b83);return _0x361aae||undefined;}export async function loadBundledAgents(_0x355382){const _0x2b60e2=_0xa985;let _0x2dece7=[];try{_0x2dece7=await readdir(_0x355382,{'withFileTypes':!![],'encoding':'utf8'});}catch{return[];}const _0x5e2a32=await Promise[_0x2b60e2(0x1e7)](_0x2dece7[_0x2b60e2(0x1c7)](_0x19780d=>_0x19780d[_0x2b60e2(0x1bc)+_0x2b60e2(0x1dc)]())[_0x2b60e2(0x1d8)](async _0xfffbfa=>{const _0x1ce901=_0x2b60e2,_0x39a5b3=_0xfffbfa[_0x1ce901(0x1de)][_0x1ce901(0x1c8)]();if(!_0x39a5b3)return null;const _0x466702=await readJson(join(_0x355382,_0x39a5b3,'readme.j'+_0x1ce901(0x1da)),{}),_0x32961f=asRecord(_0x466702),_0x20d280=toOptionalString(_0x32961f[_0x1ce901(0x1de)])??_0x39a5b3;if(!_0x20d280)return null;return{'name':_0x20d280,'cnName':toOptionalString(_0x32961f[_0x1ce901(0x1df)]),'avatar':toOptionalString(_0x32961f[_0x1ce901(0x1d4)]),'icon':toOptionalString(_0x32961f[_0x1ce901(0x1dd)]),'emoji':toOptionalString(_0x32961f[_0x1ce901(0x1cf)]),'model':toOptionalString(_0x32961f[_0x1ce901(0x1b8)]),'version':toOptionalString(_0x32961f['version']),'capabilityDomains':asStringArray(_0x32961f[_0x1ce901(0x1cb)+_0x1ce901(0x1c4)+'s']??_0x32961f[_0x1ce901(0x1d6)+'ins']),'managedPaths':asStringArray(_0x32961f[_0x1ce901(0x1d1)+_0x1ce901(0x1d2)])};}));return _0x5e2a32[_0x2b60e2(0x1c7)](Boolean);}async function readJsonVersion(_0x5d7781){const _0x2408f8=_0xa985;try{const _0x4bc657=JSON[_0x2408f8(0x1be)](await readFile(_0x5d7781,'utf8'));return getTrimmedString(asRecord(_0x4bc657)[_0x2408f8(0x1d7)])||null;}catch{return null;}}function assertSafeManagedPath(_0x3ddd90,_0x29cf3e){const _0x2c06ab=_0xa985,_0x28cdf5=getTrimmedString(_0x29cf3e);if(!_0x28cdf5||_0x28cdf5[_0x2c06ab(0x1e9)+'th']('/')||_0x28cdf5[_0x2c06ab(0x1bf)]('..'))return null;const _0x5e9c3b=resolve(_0x3ddd90),_0x580f0a=resolve(join(_0x3ddd90,_0x28cdf5));if(_0x580f0a!==_0x5e9c3b&&!_0x580f0a[_0x2c06ab(0x1e9)+'th'](_0x5e9c3b+sep))return null;return{'relPath':_0x28cdf5,'absPath':_0x580f0a};}async function copyManagedPaths(_0x304c87,_0x2e1e85,_0x29adb1){const _0x2ee365=_0xa985;if(_0x29adb1[_0x2ee365(0x1e8)]===0x0){await cp(_0x304c87,_0x2e1e85,{'recursive':!![]});return;}for(const _0x819f3b of _0x29adb1){const _0x3d85ab=assertSafeManagedPath(_0x2e1e85,_0x819f3b);if(!_0x3d85ab){console[_0x2ee365(0x1b6)](_0x2ee365(0x1d0)+_0x2ee365(0x1bb)+_0x2ee365(0x1ba)+'pped\x20uns'+_0x2ee365(0x1d5)+'gedPath:'+'\x20'+_0x819f3b);continue;}const _0x31547e=join(_0x304c87,_0x3d85ab[_0x2ee365(0x1d3)]);if(!existsSync(_0x31547e)){await rm(_0x3d85ab['absPath'],{'recursive':!![],'force':!![]});continue;}await rm(_0x3d85ab['absPath'],{'recursive':!![],'force':!![]}),await mkdir(dirname(_0x3d85ab[_0x2ee365(0x1db)]),{'recursive':!![]}),await cp(_0x31547e,_0x3d85ab[_0x2ee365(0x1db)],{'recursive':!![]});}}function _0xa985(_0x29d612,_0x424e36){_0x29d612=_0x29d612-0x1b6;const _0x1f4b9e=_0x1f4b();let _0xa9856f=_0x1f4b9e[_0x29d612];return _0xa9856f;}export async function ensureBundledAgents({runtimeBundledAgentsDir:_0x1c6db4,stateDir:_0x2a84bc,listAgents:_0x226e27,createAgent:_0x36e80c,updateAgent:_0x5e3242,syncSkills:_0x592932}){const _0x1e807b=_0xa985;let _0x528c6d=![];const _0x3960c5=await _0x226e27(),_0x23702f=Array[_0x1e807b(0x1cd)](_0x3960c5[_0x1e807b(0x1c5)])?_0x3960c5[_0x1e807b(0x1c5)]:[],_0x49c622=_0x23702f[_0x1e807b(0x1b9)](_0x462d7a=>_0x462d7a?.['id']==='main'),_0x28d618=getTrimmedString(_0x49c622?.[_0x1e807b(0x1e1)+'e'])||join(_0x2a84bc,_0x1e807b(0x1e1)+'e'),_0x5402b3=await loadBundledAgents(_0x1c6db4);for(const _0x123003 of _0x5402b3){const {name:_0x32e676,cnName:_0x444d5d,avatar:_0x5cf8c5,emoji:_0x181ae1,version:_0x191712,managedPaths:_0x20ec0b}=_0x123003,_0x50f41f=_0x32e676===_0x1e807b(0x1ca),_0x3d67b8=_0x50f41f?_0x28d618:join(dirname(_0x28d618),_0x1e807b(0x1e1)+'e-'+_0x32e676),_0x345a3a=join(_0x1c6db4,_0x32e676);if(!existsSync(_0x345a3a))continue;try{const _0x143cde=_0x50f41f||_0x23702f[_0x1e807b(0x1cc)](_0x537329=>_0x537329?.['id']===_0x32e676);if(_0x143cde){const _0x147df4=await readJsonVersion(join(_0x3d67b8,_0x1e807b(0x1e2)+'son'));if(_0x191712&&_0x147df4&&_0x191712===_0x147df4)continue;await mkdir(_0x3d67b8,{'recursive':!![]}),await copyManagedPaths(_0x345a3a,_0x3d67b8,_0x20ec0b);}else await rm(_0x3d67b8,{'recursive':!![],'force':!![]}),await mkdir(_0x3d67b8,{'recursive':!![]}),await cp(_0x345a3a,_0x3d67b8,{'recursive':!![]});_0x528c6d=!![];if(_0x50f41f)continue;if(_0x143cde){const _0x1984cc={'agentId':_0x32e676,'workspace':_0x3d67b8};if(_0x444d5d)_0x1984cc[_0x1e807b(0x1de)]=_0x444d5d;if(_0x5cf8c5)_0x1984cc[_0x1e807b(0x1d4)]=_0x5cf8c5;if(_0x181ae1)_0x1984cc['emoji']=_0x181ae1;await _0x5e3242(_0x1984cc);}else{const _0x32355c={'name':_0x32e676,'workspace':_0x3d67b8};if(_0x5cf8c5)_0x32355c[_0x1e807b(0x1d4)]=_0x5cf8c5;if(_0x181ae1)_0x32355c[_0x1e807b(0x1cf)]=_0x181ae1;const _0xd76a4c=asRecord(await _0x36e80c(_0x32355c));_0x444d5d&&await _0x5e3242({'agentId':getTrimmedString(_0xd76a4c[_0x1e807b(0x1e5)])||_0x32e676,'name':_0x444d5d});}}catch(_0x56523c){console[_0x1e807b(0x1c1)]('[wujie-s'+_0x1e807b(0x1bb)+_0x1e807b(0x1c3)+_0x1e807b(0x1d9)+_0x1e807b(0x1ce)+_0x1e807b(0x1e4)+'t\x20\x22'+_0x32e676+'\x22',_0x56523c);}}return await _0x592932?.({'agentIds':_0x5402b3[_0x1e807b(0x1d8)](_0x54de8e=>_0x54de8e['name']),'mainWorkspace':_0x28d618}),{'didUpdate':_0x528c6d,'bundledAgents':_0x5402b3};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0xe7c34b=_0x103d;(function(_0x3faeca,_0x2f0942){const _0x5c21a7=_0x103d,_0x1d73ea=_0x3faeca();while(!![]){try{const _0x9bb23f=-parseInt(_0x5c21a7(0x124))/0x1+parseInt(_0x5c21a7(0xbe))/0x2+parseInt(_0x5c21a7(0x128))/0x3*(-parseInt(_0x5c21a7(0x10c))/0x4)+parseInt(_0x5c21a7(0xb9))/0x5*(-parseInt(_0x5c21a7(0x118))/0x6)+-parseInt(_0x5c21a7(0xbf))/0x7+-parseInt(_0x5c21a7(0xa9))/0x8+parseInt(_0x5c21a7(0xaa))/0x9;if(_0x9bb23f===_0x2f0942)break;else _0x1d73ea['push'](_0x1d73ea['shift']());}catch(_0x3face7){_0x1d73ea['push'](_0x1d73ea['shift']());}}}(_0x1c58,0xcfbe7));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 _0x2ec80b,{portNumbers}from'get-port';import{ensureShellStateDirs,getConfigPaths,readJsonFile,writeJsonFile}from'@wujie-shell/config';import{asRecord,dedupeStrings,getTrimmedString,writeJson}from'./utils.mjs';function _0x103d(_0x851c37,_0x289eb4){_0x851c37=_0x851c37-0xa8;const _0x1c587e=_0x1c58();let _0x103d69=_0x1c587e[_0x851c37];return _0x103d69;}import{loadRuntimeInfo}from'./runtime.mjs';import{createRuntimeLogger,summarizeRuntimeManifest}from'./runtime-logger.mjs';import{syncRuntimeManifestPlugins}from'./plugin-sync.mjs';const MEMORY_CORE_PLUGIN_ID=_0xe7c34b(0x130)+_0xe7c34b(0xa8),ACTIVE_MEMORY_PLUGIN_ID=_0xe7c34b(0xc5)+'emory',ASK_USER_QUESTION_PLUGIN_ID=_0xe7c34b(0x10b)+_0xe7c34b(0x10d)+'n';function createToken(){const _0x179e8c=_0xe7c34b;return randomBytes(0x18)[_0x179e8c(0xae)](_0x179e8c(0x108));}function createProviderModelConfig(_0x27f22f,_0x2ad79a=![]){const _0x4b3df8=_0xe7c34b;return{'id':_0x27f22f,'name':_0x27f22f,'reasoning':!![],'input':_0x2ad79a?[_0x4b3df8(0x115),'image']:['text'],'cost':{'input':0x0,'output':0x0,'cacheRead':0x0,'cacheWrite':0x0},'contextWindow':0x3e800,'maxTokens':0x3e800};}function createProviderConfig(_0x1e3a5c){const _0xc7f7c=_0xe7c34b;return{'apiKey':_0x1e3a5c[_0xc7f7c(0xd8)],'api':_0x1e3a5c[_0xc7f7c(0x100)]===_0xc7f7c(0x127)+'c'?_0xc7f7c(0x127)+_0xc7f7c(0xd6)+'es':_0xc7f7c(0x103)+_0xc7f7c(0xb1)+'ns',..._0x1e3a5c[_0xc7f7c(0xe8)]?{'baseUrl':_0x1e3a5c[_0xc7f7c(0xe8)]}:{},'models':[createProviderModelConfig(_0x1e3a5c[_0xc7f7c(0xf0)+'e'])]};}function _0x1c58(){const _0x1d9da8=['tart','active-m','elPrimar','keys','filter','\x20config\x20','environm','provider','ange','model\x20co','product\x20','entries','self-ope','written','claw\x20con','mtimeMs','dels\x20upd','plugins\x20','c-messag','agents','apiKey','tarted','defaultM','ing','ated','missing;','config','isArray','configPa','config\x20s','auto','runtimeR','fig\x20chan','stateDir','runtime\x20','oot','baseUrl','created','Version','mode','info\x20loa','extraDir','last-goo','per-chan','modelNam','compat','\x20for\x20con','local','nfig\x20syn','ded\x20for\x20','fig','ConfigPa','skills','ready\x20cu','red','gatewayS','indexOf','openclaw','toISOStr','penclaw\x20','protocol','info','ensure\x20i','openai-c','onfig\x20ch','plugin\x20c','slice','imageMod','hex','her\x20obse','now','ask-user','689288ZMtqGp','-questio','allow','config\x20c','nto\x20open','memory','her\x20igno','nfig\x20alr','nitial\x20o','text','models','anged','3953370fqjZVw','merge','odel','load','stringif','aw\x20confi','projectR','rated\x20mo','idle','eUrl','g\x20writte','Key','1646854YkFlhG','error','d\x20opencl','anthropi','3QtULGk','reload\x20s','entityPa','deviceId','ile\x20watc','dmScope','\x20creatin','dataDir','memory-c','modelBas','yName','ailed','nChange','ore','10062760bpEAck','37340370vteTeM','defaults','rrent','ports','toString','config\x20f','manifest','ompletio','initial\x20','eady\x20cur','session','ync','primary','ttings\x20u','changed','5saeESN','persiste','length','plugins','nfig\x20upd','959662yKyaAM','293482yclsJU','ompleted','model','lastGood','ernal\x20ch'];_0x1c58=function(){return _0x1d9da8;};return _0x1c58();}function createRuntimePluginBootstrap(_0x35e1dd){const _0x353957=_0xe7c34b,_0xaf2c79={},_0x42a263=[];for(const _0x324397 of _0x35e1dd??[]){const _0xe13a3=getTrimmedString(_0x324397['pluginId']);if(!_0xe13a3)continue;_0xaf2c79[_0xe13a3]={'enabled':!![]},_0x42a263['push'](_0xe13a3);}return!_0xaf2c79[MEMORY_CORE_PLUGIN_ID]&&(_0xaf2c79[MEMORY_CORE_PLUGIN_ID]={'enabled':!![],'config':{'dreaming':{'enabled':!![]}}}),!_0xaf2c79[ACTIVE_MEMORY_PLUGIN_ID]&&(_0xaf2c79[ACTIVE_MEMORY_PLUGIN_ID]={'enabled':!![]}),{'entries':_0xaf2c79,'allow':dedupeStrings([..._0x42a263,MEMORY_CORE_PLUGIN_ID,ACTIVE_MEMORY_PLUGIN_ID]),'bundledDiscovery':_0x353957(0xf1)};}function createInitialOpenClawConfig(_0x1d4f2d,_0x52a088){const _0x478f6d=_0xe7c34b,_0x55df76=new Date()[_0x478f6d(0xfe)+_0x478f6d(0xdb)](),_0x257b0f=join(_0x1d4f2d[_0x478f6d(0x12f)],'workspac'+'e'),_0xce3ee4=asRecord(_0x1d4f2d[_0x478f6d(0x116)]),_0x5d225b=getTrimmedString(_0xce3ee4[_0x478f6d(0xda)+_0x478f6d(0x11a)]),_0x379a1d={'workspace':_0x257b0f,'memorySearch':{'enabled':!![],'sources':[_0x478f6d(0x111)],'provider':_0x478f6d(0xe2)},'compaction':{'memoryFlush':{'enabled':!![],'forceFlushTranscriptBytes':'256kb','softThresholdTokens':0x30d40}}};return _0x5d225b&&(_0x379a1d['model']={'primary':_0x5d225b}),{'meta':{'lastTouchedVersion':_0x52a088[_0x478f6d(0xfd)+_0x478f6d(0xea)],'lastTouchedAt':_0x55df76},'wizard':{'lastRunAt':_0x55df76,'lastRunVersion':_0x52a088['openclaw'+'Version'],'lastRunCommand':'onboard','lastRunMode':_0x478f6d(0xf3)},'models':{'mode':_0x478f6d(0x119),'providers':asRecord(_0xce3ee4[_0x478f6d(0xcb)+'s'])},'agents':{'defaults':_0x379a1d},'tools':{'profile':'full'},'plugins':createRuntimePluginBootstrap(_0x52a088[_0x478f6d(0xbc)]),'skills':{'load':{'extraDirs':[_0x478f6d(0xf8)]}},'session':{'dmScope':'per-chan'+'nel-peer','reset':{'mode':_0x478f6d(0x120)}}};}function hasMeaningfulProductModels(_0x59ba6e){const _0x2c8bc3=_0xe7c34b,_0xf46259=asRecord(_0x59ba6e[_0x2c8bc3(0x116)]);return Object[_0x2c8bc3(0xc7)](asRecord(_0xf46259[_0x2c8bc3(0xcb)+'s']))[_0x2c8bc3(0xbb)]>0x0||Boolean(getTrimmedString(_0xf46259['defaultM'+_0x2c8bc3(0x11a)]));}function summarizeOpenClawConfig(_0x475187){const _0x115ce9=_0xe7c34b,_0x42b527=asRecord(_0x475187['models']),_0x3d27bc=asRecord(_0x42b527[_0x115ce9(0xcb)+'s']),_0x2750d4=asRecord(_0x475187[_0x115ce9(0xd7)]),_0x587215=asRecord(_0x2750d4[_0x115ce9(0xab)]),_0x5d8047=asRecord(_0x587215['model']),_0x37bd3a=asRecord(_0x475187[_0x115ce9(0xbc)]),_0x47ae26=asRecord(_0x37bd3a['entries']),_0x5b3973=asRecord(_0x475187[_0x115ce9(0xf8)]),_0x2f747a=asRecord(_0x5b3973[_0x115ce9(0x11b)]),_0x1ed08d=asRecord(_0x475187[_0x115ce9(0xb4)]),_0x4d92de=Array[_0x115ce9(0xdf)](_0x2f747a[_0x115ce9(0xed)+'s'])?_0x2f747a[_0x115ce9(0xed)+'s']:[];return{'providerCount':Object[_0x115ce9(0xc7)](_0x3d27bc)['length'],'defaultModel':getTrimmedString(_0x5d8047[_0x115ce9(0xb6)]),'pluginEntryCount':Object[_0x115ce9(0xc7)](_0x47ae26)[_0x115ce9(0xbb)],'pluginAllowCount':Array[_0x115ce9(0xdf)](_0x37bd3a[_0x115ce9(0x10e)])?_0x37bd3a[_0x115ce9(0x10e)][_0x115ce9(0xbb)]:0x0,'skillExtraDirCount':_0x4d92de[_0x115ce9(0xbb)],'sessionDmScope':getTrimmedString(_0x1ed08d[_0x115ce9(0x12d)])};}function syncProductModels(_0x33a71a,_0x28825a){const _0x42fc71=_0xe7c34b;if(!hasMeaningfulProductModels(_0x28825a))return{'config':_0x33a71a,'changed':![]};let _0x20eb74=![];const _0x5022a0=asRecord(_0x28825a['models']),_0x2a4ff8=asRecord(_0x5022a0['provider'+'s']),_0x50b45c=getTrimmedString(_0x5022a0[_0x42fc71(0xda)+_0x42fc71(0x11a)]),_0x44aa94=asRecord(_0x33a71a[_0x42fc71(0x116)]),_0x3358ba=asRecord(_0x44aa94[_0x42fc71(0xcb)+'s']);for(const [_0x1e6800,_0x64610a]of Object[_0x42fc71(0xcf)](_0x2a4ff8)){const _0x1fdbb7=asRecord(_0x3358ba[_0x1e6800]),_0x1221d7=asRecord(_0x64610a);JSON['stringif'+'y'](_0x1fdbb7)!==JSON[_0x42fc71(0x11c)+'y'](_0x1221d7)&&(_0x3358ba[_0x1e6800]=_0x1221d7,_0x20eb74=!![]);}_0x44aa94[_0x42fc71(0xeb)]!==_0x42fc71(0x119)&&(_0x44aa94[_0x42fc71(0xeb)]=_0x42fc71(0x119),_0x20eb74=!![]);_0x44aa94[_0x42fc71(0xcb)+'s']!==_0x3358ba&&(_0x44aa94[_0x42fc71(0xcb)+'s']=_0x3358ba,_0x20eb74=!![]);_0x33a71a[_0x42fc71(0x116)]!==_0x44aa94&&(_0x33a71a[_0x42fc71(0x116)]=_0x44aa94,_0x20eb74=!![]);if(_0x50b45c){const _0x580307=asRecord(_0x33a71a[_0x42fc71(0xd7)]),_0x2be581=asRecord(_0x580307[_0x42fc71(0xab)]),_0x396511=asRecord(_0x2be581[_0x42fc71(0xc1)]);_0x396511[_0x42fc71(0xb6)]!==_0x50b45c&&(_0x2be581[_0x42fc71(0xc1)]={..._0x396511,'primary':_0x50b45c},_0x580307['defaults']=_0x2be581,_0x33a71a[_0x42fc71(0xd7)]=_0x580307,_0x20eb74=!![]);}return{'config':_0x33a71a,'changed':_0x20eb74};}export function createConfigController(_0x28e9e9){const _0x4e77e2=_0xe7c34b,_0x1c03f6=getConfigPaths(_0x28e9e9),_0x345183=createRuntimeLogger(_0x1c03f6,_0x4e77e2(0xde));let _0x34942d=![],_0x5c0ca1=0x0,_0x25d807=null,_0x7fde80=null;function _0x4dc29a(){const _0x386100=_0x4e77e2;return _0x1c03f6[_0x386100(0xe0)+'th'];}function _0x5dc681(){const _0x5e1b72=_0x4e77e2;return _0x1c03f6[_0x5e1b72(0xe5)];}function _0x405ae1(){const _0x6db0fe=_0x4e77e2;return _0x1c03f6[_0x6db0fe(0x12b)+_0x6db0fe(0x12a)+'th'];}async function _0x4bf6ae(){const _0x3a5398=_0x4e77e2;await ensureShellStateDirs(_0x28e9e9),process.env.OPENCLAW_STATE_DIR=_0x1c03f6[_0x3a5398(0xe5)],process.env.OPENCLAW_CONFIG_PATH=_0x1c03f6[_0x3a5398(0xe0)+'th'],_0x345183?.[_0x3a5398(0x101)]('openclaw'+_0x3a5398(0xc9)+_0x3a5398(0xca)+'ent\x20ensu'+_0x3a5398(0xfa),{'stateDir':_0x1c03f6[_0x3a5398(0xe5)],'configPath':_0x1c03f6['configPa'+'th'],'logsDir':_0x1c03f6['logsDir']});}async function _0x80cb40(){const _0x4eba1d=_0x4e77e2,_0x59c612=Date[_0x4eba1d(0x10a)]();_0x345183?.['info'](_0x4eba1d(0x102)+_0x4eba1d(0x114)+_0x4eba1d(0xff)+_0x4eba1d(0xe1)+_0x4eba1d(0xd9),{'configPath':_0x1c03f6[_0x4eba1d(0xe0)+'th'],'stateDir':_0x1c03f6[_0x4eba1d(0xe5)]});try{await _0x4bf6ae();const _0x116afb=await loadRuntimeInfo(_0x28e9e9[_0x4eba1d(0x11e)+_0x4eba1d(0xe7)]);_0x345183?.[_0x4eba1d(0x101)](_0x4eba1d(0xe6)+_0x4eba1d(0xec)+_0x4eba1d(0xf5)+_0x4eba1d(0xe1)+_0x4eba1d(0xb5),{'runtimeRoot':_0x116afb[_0x4eba1d(0xe3)+'oot'],'manifest':summarizeRuntimeManifest(_0x116afb[_0x4eba1d(0xb0)])});if(!existsSync(_0x1c03f6[_0x4eba1d(0xe0)+'th'])){const _0x2015de=createInitialOpenClawConfig(_0x28e9e9,_0x116afb);_0x345183?.['info'](_0x4eba1d(0xb2)+_0x4eba1d(0xfd)+_0x4eba1d(0xc9)+_0x4eba1d(0xdd)+_0x4eba1d(0x12e)+'g',{'configPath':_0x1c03f6[_0x4eba1d(0xe0)+'th'],'config':summarizeOpenClawConfig(_0x2015de)}),_0x359e29(),await _0x119139(_0x2015de,'initial\x20'+_0x4eba1d(0xfd)+'\x20config\x20'+_0x4eba1d(0xe9)),await writeJson(_0x1c03f6[_0x4eba1d(0xc2)+'ConfigPa'+'th'],_0x2015de),_0x345183?.[_0x4eba1d(0x101)]('last-goo'+_0x4eba1d(0x126)+_0x4eba1d(0x11d)+_0x4eba1d(0x122)+'n',{'path':_0x1c03f6[_0x4eba1d(0xc2)+_0x4eba1d(0xf7)+'th'],'reason':'initial\x20'+_0x4eba1d(0xfd)+_0x4eba1d(0xc9)+'created'});}else _0x345183?.['info'](_0x4eba1d(0xb2)+'openclaw'+'\x20config\x20'+'exists',{'configPath':_0x1c03f6[_0x4eba1d(0xe0)+'th']});await _0x3cb49d(),await _0x1afcbd(),_0x345183?.[_0x4eba1d(0x101)](_0x4eba1d(0x102)+_0x4eba1d(0x114)+_0x4eba1d(0xff)+_0x4eba1d(0x10f)+_0x4eba1d(0xc0),{'durationMs':Date[_0x4eba1d(0x10a)]()-_0x59c612});}catch(_0x1bbf59){_0x345183?.[_0x4eba1d(0x125)](_0x4eba1d(0x102)+_0x4eba1d(0x114)+_0x4eba1d(0xff)+_0x4eba1d(0xaf)+_0x4eba1d(0x133),{'durationMs':Date[_0x4eba1d(0x10a)]()-_0x59c612,'error':_0x1bbf59});throw _0x1bbf59;}}async function _0x15d653(){return await _0x80cb40(),readJsonFile(_0x1c03f6['configPa'+'th'],{});}async function _0x5f15b3(){const _0x2bfed7=_0x4e77e2;return readJsonFile(_0x1c03f6[_0x2bfed7(0xe0)+'th'],{});}async function _0x119139(_0x5683ff,_0x13457d=_0x4e77e2(0xfd)+_0x4e77e2(0xc9)+_0x4e77e2(0xd1)){const _0xd6e5b4=_0x4e77e2;await mkdir(dirname(_0x1c03f6[_0xd6e5b4(0xe0)+'th']),{'recursive':!![]}),await writeFile(_0x1c03f6[_0xd6e5b4(0xe0)+'th'],JSON[_0xd6e5b4(0x11c)+'y'](_0x5683ff,null,0x2)+'\x0a','utf8'),_0x345183?.['info'](_0x13457d,{'configPath':_0x1c03f6[_0xd6e5b4(0xe0)+'th'],'config':summarizeOpenClawConfig(_0x5683ff)});}async function _0x1afcbd(){const _0x446ab2=_0x4e77e2,_0x43a51f=await loadRuntimeInfo(_0x28e9e9[_0x446ab2(0x11e)+'oot']),_0x3ad17c=await _0x5f15b3(),_0x2468be=syncRuntimeManifestPlugins(_0x3ad17c[_0x446ab2(0xbc)],_0x43a51f[_0x446ab2(0xbc)]);_0x2468be['changed']||!_0x3ad17c[_0x446ab2(0xbc)]?(_0x3ad17c[_0x446ab2(0xbc)]=_0x2468be[_0x446ab2(0xbc)],_0x359e29(),await _0x119139(_0x3ad17c,'runtime\x20'+_0x446ab2(0xd5)+'synced\x20i'+_0x446ab2(0x110)+_0x446ab2(0xd2)+_0x446ab2(0xf6)),_0x345183?.[_0x446ab2(0x101)](_0x446ab2(0xe6)+_0x446ab2(0x105)+_0x446ab2(0x104)+_0x446ab2(0x117),{'runtimePluginCount':_0x43a51f[_0x446ab2(0xbc)][_0x446ab2(0xbb)],'config':summarizeOpenClawConfig(_0x3ad17c)})):_0x345183?.[_0x446ab2(0x101)](_0x446ab2(0xe6)+_0x446ab2(0x105)+'onfig\x20al'+_0x446ab2(0xf9)+_0x446ab2(0xac),{'runtimePluginCount':_0x43a51f['plugins'][_0x446ab2(0xbb)]});}async function _0x3cb49d(){const _0x108419=_0x4e77e2,_0xa5e177=await _0x5f15b3(),_0x15cbc1=syncProductModels(_0xa5e177,_0x28e9e9);_0x15cbc1[_0x108419(0xb8)]?(await _0x4dd52c(_0x15cbc1[_0x108419(0xde)],_0x108419(0xce)+'model\x20co'+_0x108419(0xbd)+_0x108419(0xdc)),_0x345183?.[_0x108419(0x101)](_0x108419(0xce)+_0x108419(0xcd)+_0x108419(0xf4)+'ced',{'config':summarizeOpenClawConfig(_0x15cbc1['config'])})):_0x345183?.[_0x108419(0x101)](_0x108419(0xce)+'model\x20co'+_0x108419(0x113)+_0x108419(0xb3)+'rent',{'hasProductModels':hasMeaningfulProductModels(_0x28e9e9)});}async function _0x44acab(){const _0x3cd4c3=_0x4e77e2;await _0x80cb40();const _0x19394b=await _0x2ec80b({'port':portNumbers(_0x28e9e9[_0x3cd4c3(0xad)]['gatewayS'+_0x3cd4c3(0xc4)],_0x28e9e9[_0x3cd4c3(0xad)][_0x3cd4c3(0xfb)+_0x3cd4c3(0xc4)]+0x63)});return{'token':createToken(),'port':_0x19394b};}async function _0x2c6883(){const _0x2f08c4=_0x4e77e2,_0x2a2482=await _0x15d653(),_0x175000=asRecord(_0x2a2482['agents']),_0x128bcf=asRecord(_0x175000[_0x2f08c4(0xab)]),_0x4f9e2f=asRecord(_0x128bcf['model']),_0x5e381d=getTrimmedString(_0x4f9e2f[_0x2f08c4(0xb6)]),_0x422526=_0x5e381d[_0x2f08c4(0xfc)]('/'),_0x1819a3=_0x422526>0x0?_0x5e381d[_0x2f08c4(0x106)](0x0,_0x422526):_0x5e381d,_0x407450=_0x422526>0x0?_0x5e381d[_0x2f08c4(0x106)](_0x422526+0x1):'',_0x3cdb1b=asRecord(asRecord(_0x2a2482['models'])['provider'+'s']),_0x35d8a3=asRecord(_0x3cdb1b[_0x1819a3]);return{'provider':_0x1819a3||'','apiKey':getTrimmedString(_0x35d8a3['apiKey']),'modelName':_0x407450,'modelBaseUrl':getTrimmedString(_0x35d8a3[_0x2f08c4(0xe8)])};}async function _0x35bf70(_0x1b0e04,_0x4e758d={}){const _0x43efdd=_0x4e77e2,_0x222df9=await _0x15d653(),_0x2b0695=_0x1b0e04[_0x43efdd(0xcb)]||'default',_0x86f1ab=_0x2b0695+'/'+_0x1b0e04[_0x43efdd(0xf0)+'e'],_0x37dfb9=asRecord(_0x222df9['models']),_0x437824=asRecord(_0x37dfb9[_0x43efdd(0xcb)+'s']);_0x437824[_0x2b0695]={...asRecord(_0x437824[_0x2b0695]),...createProviderConfig({'apiKey':_0x1b0e04[_0x43efdd(0xd8)]||'','protocol':_0x1b0e04[_0x43efdd(0x100)]||'openai','baseUrl':_0x1b0e04[_0x43efdd(0x131)+_0x43efdd(0x121)]||_0x1b0e04['baseUrl']||'','modelName':_0x1b0e04[_0x43efdd(0xf0)+'e']})},_0x37dfb9['provider'+'s']=_0x437824,_0x222df9[_0x43efdd(0x116)]=_0x37dfb9;const _0x355907=asRecord(_0x222df9[_0x43efdd(0xd7)]),_0x2f346e=asRecord(_0x355907[_0x43efdd(0xab)]);return _0x2f346e[_0x43efdd(0xc1)]={...asRecord(_0x2f346e[_0x43efdd(0xc1)]),'primary':_0x86f1ab},_0x2f346e[_0x43efdd(0x116)]={...asRecord(_0x2f346e['models']),[_0x86f1ab]:asRecord(asRecord(_0x2f346e[_0x43efdd(0x116)])[_0x86f1ab])},_0x355907[_0x43efdd(0xab)]=_0x2f346e,_0x222df9[_0x43efdd(0xd7)]=_0x355907,_0x222df9[_0x43efdd(0xb4)]={...asRecord(_0x222df9[_0x43efdd(0xb4)]),'dmScope':_0x43efdd(0xef)+'nel-peer'},await _0x4dd52c(_0x222df9,_0x4e758d['restartO'+_0x43efdd(0x134)]?'model\x20se'+_0x43efdd(0xb7)+'pdated':''),{'ok':!![]};}async function _0x2bdf03(_0x5bcaa0){const _0x5cfa4d=_0x4e77e2,_0x27d9fb=await _0x15d653(),_0x10f64b=_0x5bcaa0[_0x5cfa4d(0xcb)+_0x5cfa4d(0x123)],_0x4800e8=asRecord(_0x27d9fb[_0x5cfa4d(0x116)]),_0x30e72a=asRecord(_0x4800e8[_0x5cfa4d(0xcb)+'s']);_0x30e72a[_0x10f64b]={...asRecord(_0x30e72a[_0x10f64b]),'apiKey':_0x5bcaa0[_0x5cfa4d(0xd8)],'api':_0x5cfa4d(0x103)+_0x5cfa4d(0xb1)+'ns','baseUrl':_0x5bcaa0['baseUrl'],'models':(_0x5bcaa0[_0x5cfa4d(0xf0)+'es']??[])['map'](_0x4ed84a=>createProviderModelConfig(_0x4ed84a,_0x4ed84a===_0x5bcaa0[_0x5cfa4d(0x107)+'elPrimar'+_0x5cfa4d(0x132)]))},_0x4800e8[_0x5cfa4d(0xcb)+'s']=_0x30e72a,_0x27d9fb[_0x5cfa4d(0x116)]=_0x4800e8;if(_0x5bcaa0[_0x5cfa4d(0x107)+_0x5cfa4d(0xc6)+_0x5cfa4d(0x132)]){const _0x457331=asRecord(_0x27d9fb[_0x5cfa4d(0xd7)]),_0x4764e3=asRecord(_0x457331['defaults']);_0x4764e3[_0x5cfa4d(0x107)+'el']={...asRecord(_0x4764e3[_0x5cfa4d(0x107)+'el']),'primary':_0x10f64b+'/'+_0x5bcaa0['imageMod'+_0x5cfa4d(0xc6)+_0x5cfa4d(0x132)]},_0x457331[_0x5cfa4d(0xab)]=_0x4764e3,_0x27d9fb[_0x5cfa4d(0xd7)]=_0x457331;}return await _0x4dd52c(_0x27d9fb,_0x5cfa4d(0xd0)+_0x5cfa4d(0x11f)+_0x5cfa4d(0xd4)+_0x5cfa4d(0xdc)),{'ok':!![]};}async function _0x22ccdd({callbackUrl:_0x50201f,secret:_0x2dc680}){const _0x2e8819=_0x4e77e2,_0x5a5210=await _0x15d653(),_0x291930=asRecord(_0x5a5210[_0x2e8819(0xbc)]),_0x2cd16a=asRecord(_0x291930[_0x2e8819(0xcf)]),_0x1edda4=asRecord(_0x2cd16a[ASK_USER_QUESTION_PLUGIN_ID]);return _0x2cd16a[ASK_USER_QUESTION_PLUGIN_ID]={..._0x1edda4,'enabled':!![],'config':{...asRecord(_0x1edda4[_0x2e8819(0xde)]),'callbackUrl':_0x50201f,'secret':_0x2dc680}},_0x291930[_0x2e8819(0xcf)]=_0x2cd16a,_0x291930[_0x2e8819(0x10e)]=dedupeStrings([...(Array[_0x2e8819(0xdf)](_0x291930['allow'])?_0x291930[_0x2e8819(0x10e)]:[])[_0x2e8819(0xc8)](Boolean),ASK_USER_QUESTION_PLUGIN_ID]),_0x5a5210[_0x2e8819(0xbc)]=_0x291930,await _0x4dd52c(_0x5a5210,''),{'ok':!![]};}async function _0x4dd52c(_0x9f99b2,_0x126004=''){const _0x1ae5b8=_0x4e77e2;_0x359e29(),await _0x119139(_0x9f99b2,_0x126004||_0x1ae5b8(0xfd)+_0x1ae5b8(0xc9)+_0x1ae5b8(0xba)+'d'),await writeJsonFile(_0x1c03f6[_0x1ae5b8(0xc2)+_0x1ae5b8(0xf7)+'th'],_0x9f99b2),_0x345183?.[_0x1ae5b8(0x101)](_0x1ae5b8(0xee)+'d\x20opencl'+_0x1ae5b8(0x11d)+_0x1ae5b8(0x122)+'n',{'path':_0x1c03f6[_0x1ae5b8(0xc2)+_0x1ae5b8(0xf7)+'th'],'reason':_0x126004||_0x1ae5b8(0xfd)+'\x20config\x20'+'persiste'+'d'});if(_0x126004)_0x2fbc22(_0x126004);}function _0x359e29(){if(_0x34942d)_0x5c0ca1+=0x1;}function _0xdbce9f(_0x3c28ea){_0x7fde80=_0x3c28ea;}function _0x2fbc22(_0x4ac04b){const _0x550c8f=_0x4e77e2;if(!_0x7fde80)return;if(_0x25d807)clearTimeout(_0x25d807);_0x345183?.[_0x550c8f(0x101)]('gateway\x20'+_0x550c8f(0x129)+'cheduled'+_0x550c8f(0xf2)+_0x550c8f(0xe4)+'ge',{'reason':_0x4ac04b,'debounceMs':0xfa}),_0x25d807=setTimeout(()=>_0x7fde80(_0x4ac04b),0xfa);}function _0x1a1cac(){const _0x1f1eea=_0x4e77e2;unwatchFile(_0x1c03f6[_0x1f1eea(0xe0)+'th']),_0x34942d=!![],watchFile(_0x1c03f6[_0x1f1eea(0xe0)+'th'],{'interval':0x3e8},(_0x2b7cd0,_0x1ec52b)=>{const _0x2aa322=_0x1f1eea;if(_0x2b7cd0[_0x2aa322(0xd3)]===_0x1ec52b[_0x2aa322(0xd3)])return;if(_0x5c0ca1>0x0){_0x5c0ca1-=0x1,_0x345183?.[_0x2aa322(0x101)](_0x2aa322(0xaf)+'ile\x20watc'+_0x2aa322(0x112)+'red\x20inte'+'rnal\x20wri'+'te',{'configPath':_0x1c03f6[_0x2aa322(0xe0)+'th'],'ignoredConfigWatchReloads':_0x5c0ca1});return;}_0x345183?.[_0x2aa322(0x101)]('config\x20f'+_0x2aa322(0x12c)+_0x2aa322(0x109)+'rved\x20ext'+_0x2aa322(0xc3)+_0x2aa322(0xcc),{'configPath':_0x1c03f6['configPa'+'th']}),_0x2fbc22(_0x2aa322(0x10f)+'hange');});}function _0x26ee04(){const _0x2cd109=_0x4e77e2;if(_0x25d807)clearTimeout(_0x25d807);unwatchFile(_0x1c03f6[_0x2cd109(0xe0)+'th']),_0x34942d=![],_0x5c0ca1=0x0;}return{'paths':_0x1c03f6,'resolveConfigPath':_0x4dc29a,'resolveStateDir':_0x5dc681,'resolveDeviceIdentityPath':_0x405ae1,'ensureConfigPathEnv':_0x4bf6ae,'ensureInitialConfig':_0x80cb40,'ensureGatewaySettings':_0x44acab,'readConfig':_0x15d653,'writeConfig':_0x119139,'syncRuntimePlugins':_0x1afcbd,'getModelSettings':_0x2c6883,'setModelSettings':_0x35bf70,'setSelfOperatedModels':_0x2bdf03,'ensureAskUserQuestionPluginConfig':_0x22ccdd,'markConfigWriteHandledInternally':_0x359e29,'setGatewayRestartHandler':_0xdbce9f,'watchConfigChanges':_0x1a1cac,'dispose':_0x26ee04};}
|
|
1
|
+
const _0x382e09=_0x4756;(function(_0x3233bc,_0x2d16cd){const _0x4afdf9=_0x4756,_0x17263b=_0x3233bc();while(!![]){try{const _0x59748b=-parseInt(_0x4afdf9(0x99))/0x1*(parseInt(_0x4afdf9(0xcb))/0x2)+-parseInt(_0x4afdf9(0xf5))/0x3*(parseInt(_0x4afdf9(0xa3))/0x4)+-parseInt(_0x4afdf9(0xae))/0x5+parseInt(_0x4afdf9(0x100))/0x6*(-parseInt(_0x4afdf9(0x105))/0x7)+parseInt(_0x4afdf9(0xc7))/0x8*(-parseInt(_0x4afdf9(0xec))/0x9)+parseInt(_0x4afdf9(0xfe))/0xa*(parseInt(_0x4afdf9(0xd3))/0xb)+parseInt(_0x4afdf9(0xc4))/0xc*(parseInt(_0x4afdf9(0xb7))/0xd);if(_0x59748b===_0x2d16cd)break;else _0x17263b['push'](_0x17263b['shift']());}catch(_0x25e5c3){_0x17263b['push'](_0x17263b['shift']());}}}(_0x2ad1,0x8fe5f));import{randomBytes}from'node:crypto';import{existsSync,unwatchFile,watchFile}from'node:fs';import{mkdir,writeFile}from'node:fs/promises';function _0x2ad1(){const _0x19f648=['anthropi','ompleted','1353HoXAFH','per-chan','map','pdated','gateway\x20','exists','image','stringif','\x20for\x20con','error','session','mtimeMs','ced','her\x20obse','ConfigPa','idle','ync','onfig\x20ch','runtimeR','memory','nfig\x20syn','last-goo','push','c-messag','256kb','5068899ODAJPD','configPa','modelNam','openclaw','ready\x20cu','openai-c','ent\x20ensu','compat','g\x20writte','24pDclEK','now','config\x20s','rnal\x20wri','nto\x20open','ompletio','mode','models','persiste','46910LtFDAX','dmScope','1767732GixVmA','logsDir','gatewayS','config','Key','21TsjPpw','fig\x20chan','info\x20loa','defaults','ttings\x20u','manifest','info','nel-peer','tarted','ensure\x20i','workspac','hex','penclaw\x20','fig','ange','\x20config\x20','model\x20se','skills','deviceId','extraDir','text','product\x20','config\x20c','onfig\x20al','yName','length','memory-c','odel','baseUrl','-questio','utf8','provider','config\x20f','tart','eady\x20cur','plugins','entries','nitial\x20o','her\x20igno','8KJnlkt','ing','toString','ports','primary','emory','oot','modelBas','initial\x20','plugins\x20','160632IWumGR','eUrl','reload\x20s','full','self-ope','filter','ated','model','agents','protocol','model\x20co','4344865OAfexQ','nfig\x20alr','rrent','aw\x20confi','pluginId','runtime\x20','plugin\x20c','merge','stateDir','4886102sLadWU','isArray','ailed','slice','imageMod','red','allow','local','projectR','toISOStr','changed','hange','red\x20inte','96FeFEkP','apiKey','defaultM','8ElLbUY','lastGood','indexOf','nChange','89276UkIyDW','d\x20opencl','ask-user','written','rved\x20ext','active-m'];_0x2ad1=function(){return _0x19f648;};return _0x2ad1();}import{dirname,join}from'node:path';function _0x4756(_0x210d88,_0x4cb2f9){_0x210d88=_0x210d88-0x8f;const _0x2ad19f=_0x2ad1();let _0x47567a=_0x2ad19f[_0x210d88];return _0x47567a;}import _0x5e04fc,{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=_0x382e09(0x11f)+'ore',ACTIVE_MEMORY_PLUGIN_ID=_0x382e09(0xd0)+_0x382e09(0x9e),ASK_USER_QUESTION_PLUGIN_ID=_0x382e09(0xcd)+_0x382e09(0x8f)+'n';function createToken(){const _0x47af4f=_0x382e09;return randomBytes(0x18)[_0x47af4f(0x9b)](_0x47af4f(0x110));}function createProviderModelConfig(_0x34fd0d,_0x535b70=![]){const _0xad7efe=_0x382e09;return{'id':_0x34fd0d,'name':_0x34fd0d,'reasoning':!![],'input':_0x535b70?[_0xad7efe(0x119),_0xad7efe(0xd9)]:['text'],'cost':{'input':0x0,'output':0x0,'cacheRead':0x0,'cacheWrite':0x0},'contextWindow':0x3e800,'maxTokens':0x3e800};}function createProviderConfig(_0x467ade){const _0x3e08e5=_0x382e09;return{'apiKey':_0x467ade[_0x3e08e5(0xc5)],'api':_0x467ade[_0x3e08e5(0xac)]===_0x3e08e5(0xd1)+'c'?_0x3e08e5(0xd1)+_0x3e08e5(0xea)+'es':_0x3e08e5(0xf1)+_0x3e08e5(0xfa)+'ns',..._0x467ade[_0x3e08e5(0x121)]?{'baseUrl':_0x467ade[_0x3e08e5(0x121)]}:{},'models':[createProviderModelConfig(_0x467ade[_0x3e08e5(0xee)+'e'])]};}function createRuntimePluginBootstrap(_0x373a98){const _0x15e4c9=_0x382e09,_0xbe4663={},_0xff34e1=[];for(const _0x3a5be9 of _0x373a98??[]){const _0x3d7575=getTrimmedString(_0x3a5be9[_0x15e4c9(0xb2)]);if(!_0x3d7575)continue;_0xbe4663[_0x3d7575]={'enabled':!![]},_0xff34e1[_0x15e4c9(0xe9)](_0x3d7575);}return!_0xbe4663[MEMORY_CORE_PLUGIN_ID]&&(_0xbe4663[MEMORY_CORE_PLUGIN_ID]={'enabled':!![],'config':{'dreaming':{'enabled':!![]}}}),!_0xbe4663[ACTIVE_MEMORY_PLUGIN_ID]&&(_0xbe4663[ACTIVE_MEMORY_PLUGIN_ID]={'enabled':!![]}),{'entries':_0xbe4663,'allow':dedupeStrings([..._0xff34e1,MEMORY_CORE_PLUGIN_ID,ACTIVE_MEMORY_PLUGIN_ID]),'bundledDiscovery':_0x15e4c9(0xf3)};}function createInitialOpenClawConfig(_0x6ec7e0,_0x3a5a73){const _0x29b916=_0x382e09,_0x43bd14=new Date()[_0x29b916(0xc0)+_0x29b916(0x9a)](),_0x512d9e=join(_0x6ec7e0['dataDir'],_0x29b916(0x10f)+'e'),_0x1f9670=asRecord(_0x6ec7e0['models']),_0x5c6ea9=getTrimmedString(_0x1f9670[_0x29b916(0xc6)+_0x29b916(0x120)]),_0x180c65={'workspace':_0x512d9e,'memorySearch':{'enabled':!![],'sources':[_0x29b916(0xe6)],'provider':'auto'},'compaction':{'memoryFlush':{'enabled':!![],'forceFlushTranscriptBytes':_0x29b916(0xeb),'softThresholdTokens':0x30d40}}};return _0x5c6ea9&&(_0x180c65[_0x29b916(0xaa)]={'primary':_0x5c6ea9}),{'meta':{'lastTouchedVersion':_0x3a5a73[_0x29b916(0xef)+'Version'],'lastTouchedAt':_0x43bd14},'wizard':{'lastRunAt':_0x43bd14,'lastRunVersion':_0x3a5a73['openclaw'+'Version'],'lastRunCommand':'onboard','lastRunMode':_0x29b916(0xbe)},'models':{'mode':_0x29b916(0xb5),'providers':asRecord(_0x1f9670[_0x29b916(0x91)+'s'])},'agents':{'defaults':_0x180c65},'tools':{'profile':_0x29b916(0xa6)},'plugins':createRuntimePluginBootstrap(_0x3a5a73['plugins']),'skills':{'load':{'extraDirs':['skills']}},'session':{'dmScope':_0x29b916(0xd4)+_0x29b916(0x10c),'reset':{'mode':_0x29b916(0xe2)}}};}function hasMeaningfulProductModels(_0x21dcc4){const _0xa10f64=_0x382e09,_0x902f3=asRecord(_0x21dcc4[_0xa10f64(0xfc)]);return Object['keys'](asRecord(_0x902f3[_0xa10f64(0x91)+'s']))[_0xa10f64(0x11e)]>0x0||Boolean(getTrimmedString(_0x902f3[_0xa10f64(0xc6)+_0xa10f64(0x120)]));}function summarizeOpenClawConfig(_0x5eeb74){const _0x143956=_0x382e09,_0x488566=asRecord(_0x5eeb74[_0x143956(0xfc)]),_0x264ad9=asRecord(_0x488566['provider'+'s']),_0x33f295=asRecord(_0x5eeb74[_0x143956(0xab)]),_0x395072=asRecord(_0x33f295[_0x143956(0x108)]),_0x2f53b3=asRecord(_0x395072['model']),_0x2fc840=asRecord(_0x5eeb74['plugins']),_0x49aa7a=asRecord(_0x2fc840[_0x143956(0x96)]),_0x5b6585=asRecord(_0x5eeb74[_0x143956(0x116)]),_0x43f553=asRecord(_0x5b6585['load']),_0x53a048=asRecord(_0x5eeb74[_0x143956(0xdd)]),_0x5c749b=Array['isArray'](_0x43f553[_0x143956(0x118)+'s'])?_0x43f553[_0x143956(0x118)+'s']:[];return{'providerCount':Object['keys'](_0x264ad9)[_0x143956(0x11e)],'defaultModel':getTrimmedString(_0x2f53b3[_0x143956(0x9d)]),'pluginEntryCount':Object['keys'](_0x49aa7a)[_0x143956(0x11e)],'pluginAllowCount':Array['isArray'](_0x2fc840[_0x143956(0xbd)])?_0x2fc840['allow'][_0x143956(0x11e)]:0x0,'skillExtraDirCount':_0x5c749b[_0x143956(0x11e)],'sessionDmScope':getTrimmedString(_0x53a048[_0x143956(0xff)])};}function syncProductModels(_0x3e9a39,_0x15786b){const _0x51ab2e=_0x382e09;if(!hasMeaningfulProductModels(_0x15786b))return{'config':_0x3e9a39,'changed':![]};let _0x51966f=![];const _0x481e66=asRecord(_0x15786b[_0x51ab2e(0xfc)]),_0xc8ad18=asRecord(_0x481e66[_0x51ab2e(0x91)+'s']),_0x33e31b=getTrimmedString(_0x481e66[_0x51ab2e(0xc6)+_0x51ab2e(0x120)]),_0x44462f=asRecord(_0x3e9a39['models']),_0x1a3655=asRecord(_0x44462f[_0x51ab2e(0x91)+'s']);for(const [_0x43b7ea,_0x42676c]of Object['entries'](_0xc8ad18)){const _0x5b23ef=asRecord(_0x1a3655[_0x43b7ea]),_0x1287bd=asRecord(_0x42676c);JSON[_0x51ab2e(0xda)+'y'](_0x5b23ef)!==JSON['stringif'+'y'](_0x1287bd)&&(_0x1a3655[_0x43b7ea]=_0x1287bd,_0x51966f=!![]);}_0x44462f[_0x51ab2e(0xfb)]!==_0x51ab2e(0xb5)&&(_0x44462f[_0x51ab2e(0xfb)]=_0x51ab2e(0xb5),_0x51966f=!![]);_0x44462f['provider'+'s']!==_0x1a3655&&(_0x44462f[_0x51ab2e(0x91)+'s']=_0x1a3655,_0x51966f=!![]);_0x3e9a39[_0x51ab2e(0xfc)]!==_0x44462f&&(_0x3e9a39[_0x51ab2e(0xfc)]=_0x44462f,_0x51966f=!![]);if(_0x33e31b){const _0x510239=asRecord(_0x3e9a39[_0x51ab2e(0xab)]),_0x4983ea=asRecord(_0x510239[_0x51ab2e(0x108)]),_0x3da56d=asRecord(_0x4983ea[_0x51ab2e(0xaa)]);_0x3da56d['primary']!==_0x33e31b&&(_0x4983ea[_0x51ab2e(0xaa)]={..._0x3da56d,'primary':_0x33e31b},_0x510239[_0x51ab2e(0x108)]=_0x4983ea,_0x3e9a39[_0x51ab2e(0xab)]=_0x510239,_0x51966f=!![]);}return{'config':_0x3e9a39,'changed':_0x51966f};}export function createConfigController(_0x3cda29){const _0x27feac=_0x382e09,_0x52d9f2=getConfigPaths(_0x3cda29),_0x29b4a0=createRuntimeLogger(_0x52d9f2,'config');let _0x27aa30=![],_0x22f32c=0x0,_0x26c575=null,_0x1f1b52=null;function _0x3bcafb(){return _0x52d9f2['configPa'+'th'];}function _0x2bfe6f(){const _0x284c17=_0x4756;return _0x52d9f2[_0x284c17(0xb6)];}function _0x9df177(){const _0x54d7e6=_0x4756;return _0x52d9f2[_0x54d7e6(0x117)+'entityPa'+'th'];}async function _0x16578d(){const _0x33a19d=_0x4756;await ensureShellStateDirs(_0x3cda29),process.env.OPENCLAW_STATE_DIR=_0x52d9f2[_0x33a19d(0xb6)],process.env.OPENCLAW_CONFIG_PATH=_0x52d9f2[_0x33a19d(0xed)+'th'],_0x29b4a0?.[_0x33a19d(0x10b)]('openclaw'+_0x33a19d(0x114)+'environm'+_0x33a19d(0xf2)+_0x33a19d(0xbc),{'stateDir':_0x52d9f2[_0x33a19d(0xb6)],'configPath':_0x52d9f2[_0x33a19d(0xed)+'th'],'logsDir':_0x52d9f2[_0x33a19d(0x101)]});}async function _0x49612c(){const _0x59e26c=_0x4756,_0x26687d=Date[_0x59e26c(0xf6)]();_0x29b4a0?.['info']('ensure\x20i'+_0x59e26c(0x97)+_0x59e26c(0x111)+'config\x20s'+_0x59e26c(0x10d),{'configPath':_0x52d9f2[_0x59e26c(0xed)+'th'],'stateDir':_0x52d9f2[_0x59e26c(0xb6)]});try{await _0x16578d();const _0x48a743=await loadRuntimeInfo(_0x3cda29[_0x59e26c(0xbf)+'oot']);_0x29b4a0?.['info'](_0x59e26c(0xb3)+_0x59e26c(0x107)+'ded\x20for\x20'+_0x59e26c(0xf7)+_0x59e26c(0xe3),{'runtimeRoot':_0x48a743[_0x59e26c(0xe5)+_0x59e26c(0x9f)],'manifest':summarizeRuntimeManifest(_0x48a743[_0x59e26c(0x10a)])});if(!existsSync(_0x52d9f2[_0x59e26c(0xed)+'th'])){const _0x221635=createInitialOpenClawConfig(_0x3cda29,_0x48a743);_0x29b4a0?.['info'](_0x59e26c(0xa1)+_0x59e26c(0xef)+_0x59e26c(0x114)+'missing;'+'\x20creatin'+'g',{'configPath':_0x52d9f2[_0x59e26c(0xed)+'th'],'config':summarizeOpenClawConfig(_0x221635)}),_0x7b32bd(),await _0x574c39(_0x221635,_0x59e26c(0xa1)+_0x59e26c(0xef)+_0x59e26c(0x114)+'created'),await writeJson(_0x52d9f2[_0x59e26c(0xc8)+'ConfigPa'+'th'],_0x221635),_0x29b4a0?.[_0x59e26c(0x10b)](_0x59e26c(0xe8)+'d\x20opencl'+_0x59e26c(0xb1)+_0x59e26c(0xf4)+'n',{'path':_0x52d9f2[_0x59e26c(0xc8)+_0x59e26c(0xe1)+'th'],'reason':_0x59e26c(0xa1)+'openclaw'+_0x59e26c(0x114)+'created'});}else _0x29b4a0?.[_0x59e26c(0x10b)](_0x59e26c(0xa1)+_0x59e26c(0xef)+'\x20config\x20'+_0x59e26c(0xd8),{'configPath':_0x52d9f2[_0x59e26c(0xed)+'th']});await _0x1416f3(),await _0x3f9c43(),_0x29b4a0?.[_0x59e26c(0x10b)]('ensure\x20i'+_0x59e26c(0x97)+_0x59e26c(0x111)+_0x59e26c(0x11b)+_0x59e26c(0xd2),{'durationMs':Date[_0x59e26c(0xf6)]()-_0x26687d});}catch(_0x46f70d){_0x29b4a0?.[_0x59e26c(0xdc)](_0x59e26c(0x10e)+_0x59e26c(0x97)+_0x59e26c(0x111)+'config\x20f'+_0x59e26c(0xb9),{'durationMs':Date[_0x59e26c(0xf6)]()-_0x26687d,'error':_0x46f70d});throw _0x46f70d;}}async function _0x43fe50(){const _0x35bbd4=_0x4756;return await _0x49612c(),readJsonFile(_0x52d9f2[_0x35bbd4(0xed)+'th'],{});}async function _0x4147ff(){return readJsonFile(_0x52d9f2['configPa'+'th'],{});}async function _0x574c39(_0x15cf7f,_0x592d8a=_0x27feac(0xef)+_0x27feac(0x114)+_0x27feac(0xce)){const _0x49a5e9=_0x27feac;await mkdir(dirname(_0x52d9f2[_0x49a5e9(0xed)+'th']),{'recursive':!![]}),await writeFile(_0x52d9f2[_0x49a5e9(0xed)+'th'],JSON[_0x49a5e9(0xda)+'y'](_0x15cf7f,null,0x2)+'\x0a',_0x49a5e9(0x90)),_0x29b4a0?.[_0x49a5e9(0x10b)](_0x592d8a,{'configPath':_0x52d9f2[_0x49a5e9(0xed)+'th'],'config':summarizeOpenClawConfig(_0x15cf7f)});}async function _0x3f9c43(){const _0x4cdcf4=_0x27feac,_0xa03578=await loadRuntimeInfo(_0x3cda29['projectR'+_0x4cdcf4(0x9f)]),_0x144aaf=await _0x4147ff(),_0x12d228=syncRuntimeManifestPlugins(_0x144aaf['plugins'],_0xa03578[_0x4cdcf4(0x95)]);_0x12d228[_0x4cdcf4(0xc1)]||!_0x144aaf[_0x4cdcf4(0x95)]?(_0x144aaf[_0x4cdcf4(0x95)]=_0x12d228[_0x4cdcf4(0x95)],_0x7b32bd(),await _0x574c39(_0x144aaf,_0x4cdcf4(0xb3)+_0x4cdcf4(0xa2)+'synced\x20i'+_0x4cdcf4(0xf9)+'claw\x20con'+_0x4cdcf4(0x112)),_0x29b4a0?.[_0x4cdcf4(0x10b)]('runtime\x20'+_0x4cdcf4(0xb4)+_0x4cdcf4(0xe4)+'anged',{'runtimePluginCount':_0xa03578[_0x4cdcf4(0x95)][_0x4cdcf4(0x11e)],'config':summarizeOpenClawConfig(_0x144aaf)})):_0x29b4a0?.['info'](_0x4cdcf4(0xb3)+_0x4cdcf4(0xb4)+_0x4cdcf4(0x11c)+_0x4cdcf4(0xf0)+_0x4cdcf4(0xb0),{'runtimePluginCount':_0xa03578['plugins']['length']});}async function _0x1416f3(){const _0x40b2c3=_0x27feac,_0x2c4f02=await _0x4147ff(),_0x133dd8=syncProductModels(_0x2c4f02,_0x3cda29);_0x133dd8[_0x40b2c3(0xc1)]?(await _0xeedc9(_0x133dd8[_0x40b2c3(0x103)],_0x40b2c3(0x11a)+_0x40b2c3(0xad)+'nfig\x20upd'+_0x40b2c3(0xa9)),_0x29b4a0?.[_0x40b2c3(0x10b)](_0x40b2c3(0x11a)+_0x40b2c3(0xad)+_0x40b2c3(0xe7)+_0x40b2c3(0xdf),{'config':summarizeOpenClawConfig(_0x133dd8['config'])})):_0x29b4a0?.[_0x40b2c3(0x10b)](_0x40b2c3(0x11a)+_0x40b2c3(0xad)+_0x40b2c3(0xaf)+_0x40b2c3(0x94)+'rent',{'hasProductModels':hasMeaningfulProductModels(_0x3cda29)});}async function _0x47d650(){const _0x19cf99=_0x27feac;await _0x49612c();const _0x38c86a=await _0x5e04fc({'port':portNumbers(_0x3cda29[_0x19cf99(0x9c)][_0x19cf99(0x102)+_0x19cf99(0x93)],_0x3cda29[_0x19cf99(0x9c)][_0x19cf99(0x102)+_0x19cf99(0x93)]+0x63)});return{'token':createToken(),'port':_0x38c86a};}async function _0x354a61(){const _0x378c4b=_0x27feac,_0x25258a=await _0x43fe50(),_0x147fbf=asRecord(_0x25258a[_0x378c4b(0xab)]),_0x2ee768=asRecord(_0x147fbf[_0x378c4b(0x108)]),_0x582e3=asRecord(_0x2ee768[_0x378c4b(0xaa)]),_0x13ab79=getTrimmedString(_0x582e3[_0x378c4b(0x9d)]),_0x147f2f=_0x13ab79[_0x378c4b(0xc9)]('/'),_0x39bf1a=_0x147f2f>0x0?_0x13ab79[_0x378c4b(0xba)](0x0,_0x147f2f):_0x13ab79,_0xb963b0=_0x147f2f>0x0?_0x13ab79[_0x378c4b(0xba)](_0x147f2f+0x1):'',_0xb5cda4=asRecord(asRecord(_0x25258a[_0x378c4b(0xfc)])[_0x378c4b(0x91)+'s']),_0x1ca865=asRecord(_0xb5cda4[_0x39bf1a]);return{'provider':_0x39bf1a||'','apiKey':getTrimmedString(_0x1ca865[_0x378c4b(0xc5)]),'modelName':_0xb963b0,'modelBaseUrl':getTrimmedString(_0x1ca865['baseUrl'])};}async function _0x4c21b7(_0x5d8d23,_0x4bac4c={}){const _0x26ae10=_0x27feac,_0x38aaa5=await _0x43fe50(),_0x394c22=_0x5d8d23[_0x26ae10(0x91)]||'default',_0x26240e=_0x394c22+'/'+_0x5d8d23[_0x26ae10(0xee)+'e'],_0x20505b=asRecord(_0x38aaa5[_0x26ae10(0xfc)]),_0x4cba22=asRecord(_0x20505b['provider'+'s']);_0x4cba22[_0x394c22]={...asRecord(_0x4cba22[_0x394c22]),...createProviderConfig({'apiKey':_0x5d8d23[_0x26ae10(0xc5)]||'','protocol':_0x5d8d23[_0x26ae10(0xac)]||'openai','baseUrl':_0x5d8d23[_0x26ae10(0xa0)+_0x26ae10(0xa4)]||_0x5d8d23[_0x26ae10(0x121)]||'','modelName':_0x5d8d23[_0x26ae10(0xee)+'e']})},_0x20505b['provider'+'s']=_0x4cba22,_0x38aaa5[_0x26ae10(0xfc)]=_0x20505b;const _0x883caa=asRecord(_0x38aaa5[_0x26ae10(0xab)]),_0x212906=asRecord(_0x883caa['defaults']);return _0x212906[_0x26ae10(0xaa)]={...asRecord(_0x212906[_0x26ae10(0xaa)]),'primary':_0x26240e},_0x212906[_0x26ae10(0xfc)]={...asRecord(_0x212906[_0x26ae10(0xfc)]),[_0x26240e]:asRecord(asRecord(_0x212906[_0x26ae10(0xfc)])[_0x26240e])},_0x883caa[_0x26ae10(0x108)]=_0x212906,_0x38aaa5[_0x26ae10(0xab)]=_0x883caa,_0x38aaa5['session']={...asRecord(_0x38aaa5[_0x26ae10(0xdd)]),'dmScope':_0x26ae10(0xd4)+'nel-peer'},await _0xeedc9(_0x38aaa5,_0x4bac4c['restartO'+_0x26ae10(0xca)]?_0x26ae10(0x115)+_0x26ae10(0x109)+_0x26ae10(0xd6):''),{'ok':!![]};}async function _0x1c58b1(_0x45d21b){const _0x137f3e=_0x27feac,_0x2a3225=await _0x43fe50(),_0x25b74e=_0x45d21b[_0x137f3e(0x91)+_0x137f3e(0x104)],_0x4d5af6=asRecord(_0x2a3225[_0x137f3e(0xfc)]),_0x39c70f=asRecord(_0x4d5af6[_0x137f3e(0x91)+'s']);_0x39c70f[_0x25b74e]={...asRecord(_0x39c70f[_0x25b74e]),'apiKey':_0x45d21b[_0x137f3e(0xc5)],'api':'openai-c'+_0x137f3e(0xfa)+'ns','baseUrl':_0x45d21b['baseUrl'],'models':(_0x45d21b[_0x137f3e(0xee)+'es']??[])[_0x137f3e(0xd5)](_0x2572bc=>createProviderModelConfig(_0x2572bc,_0x2572bc===_0x45d21b['imageMod'+'elPrimar'+_0x137f3e(0x11d)]))},_0x4d5af6[_0x137f3e(0x91)+'s']=_0x39c70f,_0x2a3225[_0x137f3e(0xfc)]=_0x4d5af6;if(_0x45d21b['imageMod'+'elPrimar'+'yName']){const _0x4aeb41=asRecord(_0x2a3225['agents']),_0x41f509=asRecord(_0x4aeb41[_0x137f3e(0x108)]);_0x41f509[_0x137f3e(0xbb)+'el']={...asRecord(_0x41f509['imageMod'+'el']),'primary':_0x25b74e+'/'+_0x45d21b[_0x137f3e(0xbb)+'elPrimar'+'yName']},_0x4aeb41[_0x137f3e(0x108)]=_0x41f509,_0x2a3225[_0x137f3e(0xab)]=_0x4aeb41;}return await _0xeedc9(_0x2a3225,_0x137f3e(0xa7)+'rated\x20mo'+'dels\x20upd'+'ated'),{'ok':!![]};}async function _0x5f3c2f({callbackUrl:_0x54b9fb,secret:_0x1eb700}){const _0x17ad26=_0x27feac,_0x8a33f1=await _0x43fe50(),_0x26a5f6=asRecord(_0x8a33f1['plugins']),_0x35c532=asRecord(_0x26a5f6[_0x17ad26(0x96)]),_0x2ee2fe=asRecord(_0x35c532[ASK_USER_QUESTION_PLUGIN_ID]);return _0x35c532[ASK_USER_QUESTION_PLUGIN_ID]={..._0x2ee2fe,'enabled':!![],'config':{...asRecord(_0x2ee2fe[_0x17ad26(0x103)]),'callbackUrl':_0x54b9fb,'secret':_0x1eb700}},_0x26a5f6['entries']=_0x35c532,_0x26a5f6[_0x17ad26(0xbd)]=dedupeStrings([...(Array[_0x17ad26(0xb8)](_0x26a5f6[_0x17ad26(0xbd)])?_0x26a5f6['allow']:[])[_0x17ad26(0xa8)](Boolean),ASK_USER_QUESTION_PLUGIN_ID]),_0x8a33f1[_0x17ad26(0x95)]=_0x26a5f6,await _0xeedc9(_0x8a33f1,''),{'ok':!![]};}async function _0xeedc9(_0x336500,_0x106958=''){const _0x4c5315=_0x27feac;_0x7b32bd(),await _0x574c39(_0x336500,_0x106958||_0x4c5315(0xef)+_0x4c5315(0x114)+'persiste'+'d'),await writeJsonFile(_0x52d9f2['lastGood'+_0x4c5315(0xe1)+'th'],_0x336500),_0x29b4a0?.[_0x4c5315(0x10b)](_0x4c5315(0xe8)+_0x4c5315(0xcc)+'aw\x20confi'+_0x4c5315(0xf4)+'n',{'path':_0x52d9f2[_0x4c5315(0xc8)+_0x4c5315(0xe1)+'th'],'reason':_0x106958||_0x4c5315(0xef)+'\x20config\x20'+_0x4c5315(0xfd)+'d'});if(_0x106958)_0x428b8d(_0x106958);}function _0x7b32bd(){if(_0x27aa30)_0x22f32c+=0x1;}function _0x3a6f35(_0x41ccfc){_0x1f1b52=_0x41ccfc;}function _0x428b8d(_0x42ca19){const _0x54ddd6=_0x27feac;if(!_0x1f1b52)return;if(_0x26c575)clearTimeout(_0x26c575);_0x29b4a0?.[_0x54ddd6(0x10b)](_0x54ddd6(0xd7)+_0x54ddd6(0xa5)+'cheduled'+_0x54ddd6(0xdb)+_0x54ddd6(0x106)+'ge',{'reason':_0x42ca19,'debounceMs':0xfa}),_0x26c575=setTimeout(()=>_0x1f1b52(_0x42ca19),0xfa);}function _0x515b61(){const _0x1f6d07=_0x27feac;unwatchFile(_0x52d9f2[_0x1f6d07(0xed)+'th']),_0x27aa30=!![],watchFile(_0x52d9f2[_0x1f6d07(0xed)+'th'],{'interval':0x3e8},(_0x15a0ff,_0x38abba)=>{const _0x5203e9=_0x1f6d07;if(_0x15a0ff[_0x5203e9(0xde)]===_0x38abba[_0x5203e9(0xde)])return;if(_0x22f32c>0x0){_0x22f32c-=0x1,_0x29b4a0?.['info'](_0x5203e9(0x92)+'ile\x20watc'+_0x5203e9(0x98)+_0x5203e9(0xc3)+_0x5203e9(0xf8)+'te',{'configPath':_0x52d9f2[_0x5203e9(0xed)+'th'],'ignoredConfigWatchReloads':_0x22f32c});return;}_0x29b4a0?.['info']('config\x20f'+'ile\x20watc'+_0x5203e9(0xe0)+_0x5203e9(0xcf)+'ernal\x20ch'+_0x5203e9(0x113),{'configPath':_0x52d9f2['configPa'+'th']}),_0x428b8d(_0x5203e9(0x11b)+_0x5203e9(0xc2));});}function _0x4a8373(){const _0x16729f=_0x27feac;if(_0x26c575)clearTimeout(_0x26c575);unwatchFile(_0x52d9f2[_0x16729f(0xed)+'th']),_0x27aa30=![],_0x22f32c=0x0;}return{'paths':_0x52d9f2,'resolveConfigPath':_0x3bcafb,'resolveStateDir':_0x2bfe6f,'resolveDeviceIdentityPath':_0x9df177,'ensureConfigPathEnv':_0x16578d,'ensureInitialConfig':_0x49612c,'ensureGatewaySettings':_0x47d650,'readConfig':_0x43fe50,'writeConfig':_0x574c39,'syncRuntimePlugins':_0x3f9c43,'getModelSettings':_0x354a61,'setModelSettings':_0x4c21b7,'setSelfOperatedModels':_0x1c58b1,'ensureAskUserQuestionPluginConfig':_0x5f3c2f,'markConfigWriteHandledInternally':_0x7b32bd,'setGatewayRestartHandler':_0x3a6f35,'watchConfigChanges':_0x515b61,'dispose':_0x4a8373};}
|