alvin-bot 5.6.2 → 5.8.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.
Files changed (137) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +1 -1
  3. package/dist/claude.js +1 -102
  4. package/dist/config.js +1 -96
  5. package/dist/engine.js +1 -90
  6. package/dist/find-claude-binary.js +1 -98
  7. package/dist/handlers/async-agent-chunk-handler.js +1 -50
  8. package/dist/handlers/background-bypass.js +1 -75
  9. package/dist/handlers/commands.js +1 -2336
  10. package/dist/handlers/cron-progress.js +1 -52
  11. package/dist/handlers/document.js +1 -194
  12. package/dist/handlers/message.js +1 -959
  13. package/dist/handlers/photo.js +1 -154
  14. package/dist/handlers/platform-message.js +1 -360
  15. package/dist/handlers/stuck-timer.js +1 -54
  16. package/dist/handlers/video.js +1 -237
  17. package/dist/handlers/voice.js +1 -148
  18. package/dist/i18n.js +1 -805
  19. package/dist/index.js +1 -697
  20. package/dist/init-data-dir.js +1 -98
  21. package/dist/middleware/auth.js +1 -233
  22. package/dist/migrate.js +1 -162
  23. package/dist/paths.js +1 -146
  24. package/dist/platforms/discord.js +1 -175
  25. package/dist/platforms/index.js +1 -130
  26. package/dist/platforms/signal.js +1 -205
  27. package/dist/platforms/slack-slash-parser.js +1 -32
  28. package/dist/platforms/slack.js +1 -501
  29. package/dist/platforms/telegram.js +1 -111
  30. package/dist/platforms/types.js +1 -8
  31. package/dist/platforms/whatsapp-auth-helpers.js +1 -53
  32. package/dist/platforms/whatsapp.js +1 -707
  33. package/dist/providers/claude-sdk-provider.js +1 -565
  34. package/dist/providers/codex-cli-provider.js +1 -134
  35. package/dist/providers/index.js +1 -7
  36. package/dist/providers/ollama-provider.js +1 -32
  37. package/dist/providers/openai-compatible.js +1 -406
  38. package/dist/providers/registry.js +1 -352
  39. package/dist/providers/runtime-header.js +1 -45
  40. package/dist/providers/tool-executor.js +1 -475
  41. package/dist/providers/types.js +1 -227
  42. package/dist/services/access.js +1 -144
  43. package/dist/services/allowed-users-gate.js +1 -56
  44. package/dist/services/alvin-dispatch.js +1 -130
  45. package/dist/services/alvin-mcp-tools.js +1 -104
  46. package/dist/services/asset-index.js +1 -224
  47. package/dist/services/async-agent-parser.js +1 -418
  48. package/dist/services/async-agent-watcher.js +1 -443
  49. package/dist/services/auto-diagnostic.js +1 -228
  50. package/dist/services/broadcast.js +1 -52
  51. package/dist/services/browser-manager.js +1 -562
  52. package/dist/services/browser-webfetch.js +1 -127
  53. package/dist/services/browser.js +1 -121
  54. package/dist/services/cdp-bootstrap.js +1 -357
  55. package/dist/services/compaction.js +1 -144
  56. package/dist/services/critical-notify.js +1 -203
  57. package/dist/services/cron-resolver.js +1 -58
  58. package/dist/services/cron-scheduling.js +1 -310
  59. package/dist/services/cron.js +1 -861
  60. package/dist/services/custom-tools.js +1 -317
  61. package/dist/services/delivery-queue.js +1 -173
  62. package/dist/services/delivery-registry.js +1 -21
  63. package/dist/services/disk-cleanup.js +1 -203
  64. package/dist/services/elevenlabs.js +1 -58
  65. package/dist/services/embeddings/auto-detect.js +1 -74
  66. package/dist/services/embeddings/fts5.js +1 -108
  67. package/dist/services/embeddings/gemini.js +1 -65
  68. package/dist/services/embeddings/index.js +1 -496
  69. package/dist/services/embeddings/ollama.js +1 -78
  70. package/dist/services/embeddings/openai.js +1 -49
  71. package/dist/services/embeddings/provider.js +1 -22
  72. package/dist/services/embeddings/vector-base.js +1 -113
  73. package/dist/services/embeddings-migration.js +1 -193
  74. package/dist/services/embeddings.js +1 -9
  75. package/dist/services/env-file.js +1 -50
  76. package/dist/services/exec-guard.js +1 -71
  77. package/dist/services/fallback-order.js +1 -154
  78. package/dist/services/file-permissions.js +1 -93
  79. package/dist/services/heartbeat-file.js +1 -65
  80. package/dist/services/heartbeat.js +1 -313
  81. package/dist/services/hooks.js +1 -44
  82. package/dist/services/imagegen.js +1 -72
  83. package/dist/services/language-detect.js +1 -154
  84. package/dist/services/markdown.js +1 -63
  85. package/dist/services/mcp.js +1 -263
  86. package/dist/services/memory-extractor.js +1 -178
  87. package/dist/services/memory-inject-mode.js +1 -43
  88. package/dist/services/memory-layers.js +1 -156
  89. package/dist/services/memory.js +1 -146
  90. package/dist/services/ollama-manager.js +1 -339
  91. package/dist/services/permissions-wizard.js +1 -291
  92. package/dist/services/personality.js +1 -376
  93. package/dist/services/plugins.js +1 -171
  94. package/dist/services/preflight.js +1 -292
  95. package/dist/services/process-manager.js +1 -291
  96. package/dist/services/release-highlights.js +1 -79
  97. package/dist/services/reminders.js +1 -97
  98. package/dist/services/restart.js +1 -48
  99. package/dist/services/security-audit.js +1 -74
  100. package/dist/services/self-diagnosis.js +1 -272
  101. package/dist/services/self-search.js +1 -129
  102. package/dist/services/session-persistence.js +1 -237
  103. package/dist/services/session.js +1 -282
  104. package/dist/services/skills.js +1 -290
  105. package/dist/services/ssrf-guard.js +1 -162
  106. package/dist/services/standing-orders.js +1 -29
  107. package/dist/services/steer-channel.js +1 -46
  108. package/dist/services/stop-controller.js +1 -52
  109. package/dist/services/subagent-dedup.js +1 -0
  110. package/dist/services/subagent-delivery.js +1 -452
  111. package/dist/services/subagent-stats.js +1 -123
  112. package/dist/services/subagents.js +1 -814
  113. package/dist/services/sudo.js +1 -329
  114. package/dist/services/telegram.js +1 -158
  115. package/dist/services/timing-safe-bearer.js +1 -51
  116. package/dist/services/tool-discovery.js +1 -214
  117. package/dist/services/trends.js +1 -580
  118. package/dist/services/updater.js +1 -291
  119. package/dist/services/usage-tracker.js +1 -144
  120. package/dist/services/users.js +1 -271
  121. package/dist/services/voice.js +1 -104
  122. package/dist/services/watchdog-brake.js +1 -154
  123. package/dist/services/watchdog.js +1 -311
  124. package/dist/services/workspaces.js +1 -276
  125. package/dist/tui/index.js +1 -667
  126. package/dist/util/console-formatter.js +1 -109
  127. package/dist/util/debounce.js +1 -24
  128. package/dist/util/telegram-error-filter.js +1 -62
  129. package/dist/version.js +1 -24
  130. package/dist/web/bind-strategy.js +1 -42
  131. package/dist/web/canvas.js +1 -30
  132. package/dist/web/doctor-api.js +1 -604
  133. package/dist/web/openai-compat.js +1 -252
  134. package/dist/web/server.js +1 -1831
  135. package/dist/web/setup-api.js +1 -1101
  136. package/package.json +5 -2
  137. package/dist/.metadata_never_index +0 -0
@@ -1,475 +1 @@
1
- /**
2
- * Tool Executor — Executes tool calls for non-SDK providers.
3
- *
4
- * Provides core agent capabilities (shell, file read/write, web fetch)
5
- * to any OpenAI-compatible provider that supports function calling.
6
- *
7
- * This bridges the gap between Claude SDK (built-in tools) and other
8
- * providers (Groq, NVIDIA, Gemini, etc.) — giving them all agent powers.
9
- */
10
- import { execSync } from "child_process";
11
- import fs from "fs";
12
- import os from "os";
13
- import { resolve, join as pathJoin } from "path";
14
- import { isSelfRestartCommand, scheduleGracefulRestart } from "../services/restart.js";
15
- import { checkExecAllowed } from "../services/exec-guard.js";
16
- // ── Tool Definitions (OpenAI function calling format) ───────────────────────
17
- export const AGENT_TOOLS = [
18
- {
19
- type: "function",
20
- function: {
21
- name: "run_shell",
22
- description: "Execute a shell command and return the output. Use for: running CLI tools, checking system state, installing packages, processing files, git operations, etc. Timeout: 30 seconds.",
23
- parameters: {
24
- type: "object",
25
- properties: {
26
- command: {
27
- type: "string",
28
- description: "The shell command to execute (bash). Example: 'ls -la', 'which ffmpeg', 'curl wttr.in/Berlin'"
29
- },
30
- workingDir: {
31
- type: "string",
32
- description: "Working directory (optional, defaults to user's configured dir)"
33
- }
34
- },
35
- required: ["command"],
36
- },
37
- },
38
- },
39
- {
40
- type: "function",
41
- function: {
42
- name: "read_file",
43
- description: "Read the contents of a file. Returns the text content. Use for: reading configs, code files, documents, logs, memory files, etc.",
44
- parameters: {
45
- type: "object",
46
- properties: {
47
- path: {
48
- type: "string",
49
- description: "Absolute or relative path to the file"
50
- },
51
- maxLines: {
52
- type: "number",
53
- description: "Maximum number of lines to read (optional, default: all)"
54
- }
55
- },
56
- required: ["path"],
57
- },
58
- },
59
- },
60
- {
61
- type: "function",
62
- function: {
63
- name: "write_file",
64
- description: "Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Use for: creating files, saving results, writing memory, updating configs.",
65
- parameters: {
66
- type: "object",
67
- properties: {
68
- path: {
69
- type: "string",
70
- description: "Absolute or relative path to the file"
71
- },
72
- content: {
73
- type: "string",
74
- description: "Content to write"
75
- },
76
- append: {
77
- type: "boolean",
78
- description: "Append instead of overwrite (default: false)"
79
- }
80
- },
81
- required: ["path", "content"],
82
- },
83
- },
84
- },
85
- {
86
- type: "function",
87
- function: {
88
- name: "web_fetch",
89
- description: "Fetch a URL and return the content as text/markdown. Use for: reading web pages, APIs, documentation, search results.",
90
- parameters: {
91
- type: "object",
92
- properties: {
93
- url: {
94
- type: "string",
95
- description: "URL to fetch (http or https)"
96
- },
97
- maxChars: {
98
- type: "number",
99
- description: "Maximum characters to return (default: 10000)"
100
- }
101
- },
102
- required: ["url"],
103
- },
104
- },
105
- },
106
- {
107
- type: "function",
108
- function: {
109
- name: "web_search",
110
- description: "Search the web and return results. Use for: looking up information, finding answers, research.",
111
- parameters: {
112
- type: "object",
113
- properties: {
114
- query: {
115
- type: "string",
116
- description: "Search query"
117
- }
118
- },
119
- required: ["query"],
120
- },
121
- },
122
- },
123
- {
124
- type: "function",
125
- function: {
126
- name: "list_directory",
127
- description: "List files and directories at a given path. Returns names, types (file/dir), and sizes. Use for: exploring project structures, finding files, checking what exists.",
128
- parameters: {
129
- type: "object",
130
- properties: {
131
- path: {
132
- type: "string",
133
- description: "Directory path to list (default: current working directory)"
134
- },
135
- recursive: {
136
- type: "boolean",
137
- description: "List recursively (max 3 levels deep, default: false)"
138
- }
139
- },
140
- required: [],
141
- },
142
- },
143
- },
144
- {
145
- type: "function",
146
- function: {
147
- name: "python_execute",
148
- description: "Execute a Python 3 script and return stdout/stderr. Use for: data processing, creating Excel/CSV files, complex calculations, JSON/XML transformation, image processing, PDF generation, chart creation, and any task that benefits from Python libraries (openpyxl, pandas, matplotlib, Pillow, etc.).",
149
- parameters: {
150
- type: "object",
151
- properties: {
152
- code: {
153
- type: "string",
154
- description: "Python 3 code to execute. Can use installed pip packages. Use print() for output."
155
- },
156
- workingDir: {
157
- type: "string",
158
- description: "Working directory for the script (optional)"
159
- }
160
- },
161
- required: ["code"],
162
- },
163
- },
164
- },
165
- {
166
- type: "function",
167
- function: {
168
- name: "edit_file",
169
- description: "Make a precise edit to a file by replacing exact text. More surgical than write_file — preserves the rest of the file. Use for: fixing bugs, updating configs, changing specific lines.",
170
- parameters: {
171
- type: "object",
172
- properties: {
173
- path: {
174
- type: "string",
175
- description: "Path to the file to edit"
176
- },
177
- oldText: {
178
- type: "string",
179
- description: "Exact text to find (must match exactly including whitespace)"
180
- },
181
- newText: {
182
- type: "string",
183
- description: "Replacement text"
184
- }
185
- },
186
- required: ["path", "oldText", "newText"],
187
- },
188
- },
189
- },
190
- ];
191
- /**
192
- * Execute a tool call and return the result.
193
- */
194
- export function executeTool(name, args, workingDir) {
195
- try {
196
- switch (name) {
197
- case "run_shell":
198
- return executeShell(args.command, args.workingDir || workingDir);
199
- case "read_file":
200
- return executeReadFile(args.path, args.maxLines, workingDir);
201
- case "write_file":
202
- return executeWriteFile(args.path, args.content, args.append, workingDir);
203
- case "web_fetch":
204
- return executeWebFetch(args.url, args.maxChars);
205
- case "web_search":
206
- return executeWebSearch(args.query);
207
- case "list_directory":
208
- return executeListDirectory(args.path || workingDir, args.recursive, workingDir);
209
- case "python_execute":
210
- return executePython(args.code, args.workingDir || workingDir);
211
- case "edit_file":
212
- return executeEditFile(args.path, args.oldText, args.newText, workingDir);
213
- default:
214
- return { name, result: `Unknown tool: ${name}`, error: true };
215
- }
216
- }
217
- catch (err) {
218
- return {
219
- name,
220
- result: `Error: ${err instanceof Error ? err.message : String(err)}`,
221
- error: true,
222
- };
223
- }
224
- }
225
- // ── Individual Tool Implementations ─────────────────────────────────────────
226
- function executeShell(command, cwd) {
227
- // Intercept self-restart: use graceful internal restart instead of pm2 kill
228
- if (isSelfRestartCommand(command)) {
229
- scheduleGracefulRestart();
230
- return { name: "run_shell", result: "Bot restart scheduled. Grammy will commit the Telegram offset before exiting." };
231
- }
232
- // Exec-guard: enforce EXEC_SECURITY on this non-SDK provider path.
233
- // checkExecAllowed reads config.execSecurity (deny → reject all;
234
- // allowlist → reject metachars + non-allowlisted bins; full → pass).
235
- const guardResult = checkExecAllowed(command);
236
- if (!guardResult.allowed) {
237
- return {
238
- name: "run_shell",
239
- result: `Command not allowed: ${guardResult.reason ?? "exec execution denied"}`,
240
- error: true,
241
- };
242
- }
243
- // Security: block obviously dangerous commands (belt-and-suspenders)
244
- const blocked = ["rm -rf /", "mkfs", "dd if=/dev/zero", "> /dev/sda"];
245
- if (blocked.some(b => command.includes(b))) {
246
- return { name: "run_shell", result: "Command blocked for safety.", error: true };
247
- }
248
- try {
249
- const output = execSync(command, {
250
- encoding: "utf-8",
251
- cwd: cwd || process.cwd(),
252
- timeout: 30_000,
253
- maxBuffer: 1024 * 1024, // 1MB
254
- env: { ...process.env, LANG: "en_US.UTF-8" },
255
- });
256
- // Truncate very long output
257
- const truncated = output.length > 8000
258
- ? output.substring(0, 8000) + `\n... (truncated, ${output.length} chars total)`
259
- : output;
260
- return { name: "run_shell", result: truncated || "(no output)" };
261
- }
262
- catch (err) {
263
- const stderr = err.stderr ? err.stderr.toString().substring(0, 2000) : "";
264
- const stdout = err.stdout ? err.stdout.toString().substring(0, 2000) : "";
265
- return {
266
- name: "run_shell",
267
- result: `Exit code ${err.status || 1}\n${stdout}\n${stderr}`.trim(),
268
- error: true,
269
- };
270
- }
271
- }
272
- function executeReadFile(path, maxLines, cwd) {
273
- const fullPath = path.startsWith("/") ? path : resolve(cwd || process.cwd(), path);
274
- try {
275
- let content = fs.readFileSync(fullPath, "utf-8");
276
- if (maxLines && maxLines > 0) {
277
- const lines = content.split("\n");
278
- if (lines.length > maxLines) {
279
- content = lines.slice(0, maxLines).join("\n") + `\n... (${lines.length} lines total)`;
280
- }
281
- }
282
- if (content.length > 20000) {
283
- content = content.substring(0, 20000) + `\n... (truncated, ${content.length} chars)`;
284
- }
285
- return { name: "read_file", result: content };
286
- }
287
- catch (err) {
288
- return { name: "read_file", result: `File not found or not readable: ${fullPath}`, error: true };
289
- }
290
- }
291
- function executeWriteFile(path, content, append, cwd) {
292
- const fullPath = path.startsWith("/") ? path : resolve(cwd || process.cwd(), path);
293
- try {
294
- // Ensure directory exists
295
- const dir = fullPath.substring(0, fullPath.lastIndexOf("/"));
296
- if (dir && !fs.existsSync(dir)) {
297
- fs.mkdirSync(dir, { recursive: true });
298
- }
299
- if (append) {
300
- fs.appendFileSync(fullPath, content);
301
- }
302
- else {
303
- fs.writeFileSync(fullPath, content);
304
- }
305
- return { name: "write_file", result: `✅ Written to ${fullPath} (${content.length} chars)` };
306
- }
307
- catch (err) {
308
- return { name: "write_file", result: `Write failed: ${err instanceof Error ? err.message : err}`, error: true };
309
- }
310
- }
311
- function executeWebFetch(url, maxChars) {
312
- try {
313
- // Use curl for simplicity and reliability
314
- const max = maxChars || 10000;
315
- const output = execSync(`curl -sL --max-time 15 --max-filesize 5000000 "${url}" | head -c ${max * 2}`, { encoding: "utf-8", timeout: 20_000, maxBuffer: 5 * 1024 * 1024 });
316
- // Basic HTML → text conversion
317
- let text = output
318
- .replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "")
319
- .replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "")
320
- .replace(/<[^>]+>/g, " ")
321
- .replace(/\s+/g, " ")
322
- .trim();
323
- if (text.length > max)
324
- text = text.substring(0, max) + "...";
325
- return { name: "web_fetch", result: text || "(empty response)" };
326
- }
327
- catch (err) {
328
- return { name: "web_fetch", result: `Fetch failed: ${err instanceof Error ? err.message : err}`, error: true };
329
- }
330
- }
331
- function executeWebSearch(query) {
332
- try {
333
- // Use DuckDuckGo instant answer API (no key needed)
334
- const encoded = encodeURIComponent(query);
335
- const output = execSync(`curl -sL "https://api.duckduckgo.com/?q=${encoded}&format=json&no_html=1&skip_disambig=1"`, { encoding: "utf-8", timeout: 10_000 });
336
- const data = JSON.parse(output);
337
- const results = [];
338
- if (data.AbstractText) {
339
- results.push(`📝 ${data.AbstractText}`);
340
- if (data.AbstractURL)
341
- results.push(` Source: ${data.AbstractURL}`);
342
- }
343
- if (data.RelatedTopics) {
344
- for (const topic of data.RelatedTopics.slice(0, 5)) {
345
- if (topic.Text) {
346
- results.push(`• ${topic.Text}`);
347
- if (topic.FirstURL)
348
- results.push(` ${topic.FirstURL}`);
349
- }
350
- }
351
- }
352
- if (results.length === 0) {
353
- // Fallback: use curl with a search engine
354
- const fallback = execSync(`curl -sL "https://html.duckduckgo.com/html/?q=${encoded}" | grep -oP '<a rel="nofollow" class="result__a" href="[^"]*">[^<]*</a>' | head -5 | sed 's/<[^>]*>//g'`, { encoding: "utf-8", timeout: 10_000 }).trim();
355
- if (fallback)
356
- return { name: "web_search", result: fallback };
357
- return { name: "web_search", result: `No results for "${query}". Try a different query or use web_fetch with a specific URL.` };
358
- }
359
- return { name: "web_search", result: results.join("\n") };
360
- }
361
- catch (err) {
362
- return { name: "web_search", result: `Search failed: ${err instanceof Error ? err.message : err}`, error: true };
363
- }
364
- }
365
- function executeListDirectory(dirPath, recursive, cwd) {
366
- const fullPath = dirPath?.startsWith("/") ? dirPath : resolve(cwd || process.cwd(), dirPath || ".");
367
- try {
368
- if (!fs.existsSync(fullPath)) {
369
- return { name: "list_directory", result: `Directory not found: ${fullPath}`, error: true };
370
- }
371
- const entries = [];
372
- function listDir(dir, depth) {
373
- const items = fs.readdirSync(dir, { withFileTypes: true });
374
- const indent = " ".repeat(depth);
375
- for (const item of items) {
376
- if (item.name.startsWith(".") && depth === 0 && items.length > 20)
377
- continue; // skip dotfiles in large dirs
378
- const itemPath = resolve(dir, item.name);
379
- if (item.isDirectory()) {
380
- entries.push(`${indent}📁 ${item.name}/`);
381
- if (recursive && depth < 3) {
382
- listDir(itemPath, depth + 1);
383
- }
384
- }
385
- else {
386
- try {
387
- const stats = fs.statSync(itemPath);
388
- const size = stats.size < 1024 ? `${stats.size}B`
389
- : stats.size < 1048576 ? `${(stats.size / 1024).toFixed(1)}KB`
390
- : `${(stats.size / 1048576).toFixed(1)}MB`;
391
- entries.push(`${indent}📄 ${item.name} (${size})`);
392
- }
393
- catch {
394
- entries.push(`${indent}📄 ${item.name}`);
395
- }
396
- }
397
- }
398
- }
399
- listDir(fullPath, 0);
400
- const result = entries.length > 0
401
- ? `${fullPath}:\n${entries.join("\n")}`
402
- : `${fullPath}: (empty directory)`;
403
- // Truncate if huge
404
- return { name: "list_directory", result: result.length > 8000 ? result.substring(0, 8000) + "\n..." : result };
405
- }
406
- catch (err) {
407
- return { name: "list_directory", result: `Error listing directory: ${err instanceof Error ? err.message : err}`, error: true };
408
- }
409
- }
410
- function executePython(code, cwd) {
411
- // Exec-guard: enforce EXEC_SECURITY before writing or executing anything.
412
- // Use "python3" as the representative binary — deny blocks all execution;
413
- // allowlist allows python3 (it is in SAFE_BINS) unless globally denied.
414
- const guardResult = checkExecAllowed("python3");
415
- if (!guardResult.allowed) {
416
- return {
417
- name: "python_execute",
418
- result: `Python execution not allowed: ${guardResult.reason ?? "exec execution denied"}`,
419
- error: true,
420
- };
421
- }
422
- try {
423
- // Write code to temp file to avoid shell escaping issues.
424
- // os.tmpdir() is cross-platform (works on Windows/Linux/macOS).
425
- const tmpFile = pathJoin(os.tmpdir(), `alvin-bot-py-${Date.now()}.py`);
426
- fs.writeFileSync(tmpFile, code);
427
- try {
428
- const output = execSync(`python3 "${tmpFile}"`, {
429
- encoding: "utf-8",
430
- cwd: cwd || process.cwd(),
431
- timeout: 60_000, // 60s for Python (may need to install packages, process data)
432
- maxBuffer: 5 * 1024 * 1024, // 5MB
433
- env: { ...process.env, LANG: "en_US.UTF-8", PYTHONIOENCODING: "utf-8" },
434
- });
435
- const truncated = output.length > 10000
436
- ? output.substring(0, 10000) + `\n... (truncated, ${output.length} chars total)`
437
- : output;
438
- return { name: "python_execute", result: truncated || "(no output)" };
439
- }
440
- finally {
441
- // Cleanup temp file
442
- try {
443
- fs.unlinkSync(tmpFile);
444
- }
445
- catch { /* ignore */ }
446
- }
447
- }
448
- catch (err) {
449
- const stderr = err.stderr ? err.stderr.toString().substring(0, 3000) : "";
450
- const stdout = err.stdout ? err.stdout.toString().substring(0, 3000) : "";
451
- return {
452
- name: "python_execute",
453
- result: `Python error (exit ${err.status || 1}):\n${stderr}\n${stdout}`.trim(),
454
- error: true,
455
- };
456
- }
457
- }
458
- function executeEditFile(filePath, oldText, newText, cwd) {
459
- const fullPath = filePath.startsWith("/") ? filePath : resolve(cwd || process.cwd(), filePath);
460
- try {
461
- if (!fs.existsSync(fullPath)) {
462
- return { name: "edit_file", result: `File not found: ${fullPath}`, error: true };
463
- }
464
- const content = fs.readFileSync(fullPath, "utf-8");
465
- if (!content.includes(oldText)) {
466
- return { name: "edit_file", result: `oldText not found in ${fullPath}. Make sure it matches exactly (including whitespace).`, error: true };
467
- }
468
- const newContent = content.replace(oldText, newText);
469
- fs.writeFileSync(fullPath, newContent);
470
- return { name: "edit_file", result: `✅ Edited ${fullPath} — replaced ${oldText.length} chars with ${newText.length} chars` };
471
- }
472
- catch (err) {
473
- return { name: "edit_file", result: `Edit failed: ${err instanceof Error ? err.message : err}`, error: true };
474
- }
475
- }
1
+ const _0x23092a=_0x3daa,_0x477a89=_0x3daa;(function(_0x56030d,_0x3abe66){const _0x215b69=_0x3daa,_0x47e378=_0x3daa,_0x4daeb4=_0x56030d();while(!![]){try{const _0x52293e=-parseInt(_0x215b69(0xf8))/(-0x22cc+0x1df3+0x26d*0x2)+parseInt(_0x47e378(0xef))/(-0x18f6+-0xc9+0x19c1)*(-parseInt(_0x215b69(0x101))/(-0x138d+0x6c4+0x3*0x444))+-parseInt(_0x215b69(0x179))/(0x7b*-0x3d+0x5b5*-0x1+0x2308)+-parseInt(_0x47e378(0x17b))/(0xd78+0xa*0x2a7+-0x27f9)*(parseInt(_0x215b69(0x1ce))/(0x7e3+-0x1e1*-0x1+-0x9be))+parseInt(_0x47e378(0xe6))/(-0x14e9+0x5c*-0x2e+0x2578)+parseInt(_0x215b69(0x171))/(-0x1*0x1835+0x1ffe+0x18d*-0x5)+-parseInt(_0x47e378(0x13b))/(0x1d*-0xcb+-0xec*0x18+0x2d28)*(-parseInt(_0x215b69(0xcd))/(0x19b*-0xc+0x1f3c+-0x2*0x5f7));if(_0x52293e===_0x3abe66)break;else _0x4daeb4['push'](_0x4daeb4['shift']());}catch(_0xa42f11){_0x4daeb4['push'](_0x4daeb4['shift']());}}}(_0x22eb,-0x11*-0x6911+-0x5*0xb56d+0x34f88));const _0x93b16b=(function(){let _0x15d82d=!![];return function(_0x2a8be9,_0x42bee4){const _0x44e64a=_0x15d82d?function(){const _0xdb31b4=_0x3daa;if(_0x42bee4){const _0x21b4f9=_0x42bee4[_0xdb31b4(0x13e)](_0x2a8be9,arguments);return _0x42bee4=null,_0x21b4f9;}}:function(){};return _0x15d82d=![],_0x44e64a;};}()),_0x4f86dd=_0x93b16b(this,function(){const _0x1bb430=_0x3daa,_0x17639d=_0x3daa;return _0x4f86dd[_0x1bb430(0x14b)]()['search'](_0x1bb430(0x15a)+'+$')[_0x1bb430(0x14b)]()[_0x17639d(0xf2)+'r'](_0x4f86dd)[_0x17639d(0xca)](_0x1bb430(0x15a)+'+$');});function _0x3daa(_0x13e7fb,_0x80aad2){_0x13e7fb=_0x13e7fb-(0x19db*-0x1+-0x1e75+0x38f1);const _0x1a6638=_0x22eb();let _0x2ca9a3=_0x1a6638[_0x13e7fb];if(_0x3daa['TkIXXP']===undefined){var _0x14f32d=function(_0x498830){const _0x50ecd0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x396fb0='',_0x116af2='',_0x36adc1=_0x396fb0+_0x14f32d;for(let _0x207412=0xb73+-0x15*-0xdd+-0x1*0x1d94,_0x53afff,_0x1b9bf6,_0x324b19=0x1244+0x1*0x137+-0x137b*0x1;_0x1b9bf6=_0x498830['charAt'](_0x324b19++);~_0x1b9bf6&&(_0x53afff=_0x207412%(0x322*-0x7+-0x1fc9+-0x23*-0x189)?_0x53afff*(-0xfcc+-0xc95+0x15d*0x15)+_0x1b9bf6:_0x1b9bf6,_0x207412++%(-0x1931+-0x1*0x1619+-0x976*-0x5))?_0x396fb0+=_0x36adc1['charCodeAt'](_0x324b19+(0x2b3*-0xd+-0x102f+0x3350))-(-0x79*-0x31+0x3b9*-0x1+0xbf*-0x1a)!==0xcaa+0x1e6*-0xf+0x16*0xb8?String['fromCharCode'](-0x18ee+-0x2d4*0x4+0x253d&_0x53afff>>(-(-0x125b+-0xd70+0x1fcd)*_0x207412&-0xb9e*-0x1+-0xdfd+-0x265*-0x1)):_0x207412:-0x14f4+-0x95f*-0x3+-0x729){_0x1b9bf6=_0x50ecd0['indexOf'](_0x1b9bf6);}for(let _0x166de9=0x33b*-0x9+0x9*0x1a7+0xe34,_0x42d45a=_0x396fb0['length'];_0x166de9<_0x42d45a;_0x166de9++){_0x116af2+='%'+('00'+_0x396fb0['charCodeAt'](_0x166de9)['toString'](0x5*-0x86+0x9ad*-0x2+0x11a*0x14))['slice'](-(-0x2065+0x1d46*-0x1+-0x1*-0x3dad));}return decodeURIComponent(_0x116af2);};_0x3daa['bfXLnr']=_0x14f32d,_0x3daa['LomBgL']={},_0x3daa['TkIXXP']=!![];}const _0x97ae06=_0x1a6638[0xf7a+-0x180d+0x893],_0x2e8cbb=_0x13e7fb+_0x97ae06,_0x3b9fe5=_0x3daa['LomBgL'][_0x2e8cbb];if(!_0x3b9fe5){const _0x400898=function(_0x184031){this['qCWPnC']=_0x184031,this['KcuvtA']=[0x7e3*0x4+-0x1*0x1e16+0x1*-0x175,-0x321*0xb+-0x147*-0x3+0x1e96,0x1*-0x176c+-0x455*-0x5+0x1c3],this['srmMyn']=function(){return'newState';},this['qhzqeB']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['uXzHyF']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x400898['prototype']['rmtPhy']=function(){const _0x30fdcf=new RegExp(this['qhzqeB']+this['uXzHyF']),_0x588a97=_0x30fdcf['test'](this['srmMyn']['toString']())?--this['KcuvtA'][-0x1*-0xe59+-0xee2+-0x45*-0x2]:--this['KcuvtA'][0xb1*-0x35+-0x7*0x42+0x2673];return this['JtDzTd'](_0x588a97);},_0x400898['prototype']['JtDzTd']=function(_0x201b25){if(!Boolean(~_0x201b25))return _0x201b25;return this['TDkTcZ'](this['qCWPnC']);},_0x400898['prototype']['TDkTcZ']=function(_0x23c3da){for(let _0x597321=0xe*-0xbe+-0x1*-0x2397+-0x1933,_0x30d286=this['KcuvtA']['length'];_0x597321<_0x30d286;_0x597321++){this['KcuvtA']['push'](Math['round'](Math['random']())),_0x30d286=this['KcuvtA']['length'];}return _0x23c3da(this['KcuvtA'][-0x7*-0x470+-0x21cf+0x2bf]);},new _0x400898(_0x3daa)['rmtPhy'](),_0x2ca9a3=_0x3daa['bfXLnr'](_0x2ca9a3),_0x3daa['LomBgL'][_0x2e8cbb]=_0x2ca9a3;}else _0x2ca9a3=_0x3b9fe5;return _0x2ca9a3;}_0x4f86dd();import{execSync}from'child_process';import _0xec49a7 from'fs';import _0x204cd2 from'os';function _0x22eb(){const _0x2ad652=['zM9YoIbJCMvHDa','DgGUifjLDhvYBG','ywnRywDLCYWGCa','qwjZB2X1DguGBW','zxnUj3qGzxHPCW','CMv0DxjUihn0za','4PYfifDYAxr0zw4G','C2XPy2u','AgL0zxnWywnLkq','DhvYBIb0AguGBW','yNKGCMvWBgfJAq','ihnHDMLUzYbYzq','mJK3mdaXnNHAC0LIDG','cI4UlIaODhj1BG','twf4Aw11BsbJAa','igrLzxaSigrLzG','zxH0lIbnB3jLia','ihDOyxqGzxHPCW','Cgf0Aa','C3rHDfn5BMm','mtuGls1TyxGTzG','otiXntaYEuTyB0fS','Dg9YAwvZigf0ia','qxbWzw5KigLUCW','y29UC3rYDwn0BW','zxHPC3rZu3LUyW','C3rHBgXPBMCGCa','yxbWzw5KrMLSzq','BgvKoIa','y29TBwfUzcb0BW','nty0mJm3t2Djtuj5','rMLYC3rvuKW','Dcb0AguGvgvSzq','rgLYzwn0B3j5ia','C3rHCNrZv2L0Aa','BNvTyMvY','zw52','yxvSDdOGzMfSCW','zxjZlcbYzxnLyq','m0DoyNLTzq','D3jPDgvFzMLSzq','AgfUihDYAxrLxW','iokaLcbYzxbSywnL','igzVCJOGCNvUBG','psjUB2zVBgXVDW','zw50ihrVigeGzG','zwnPzMLJigXPBG','CIb0AguGC2nYAq','zwrPDf9MAwXL','zxn1BhrFx2eIia','Aw9UCYWGsLnptG','zYb1CcbPBMzVCG','y2GGkgH0DhaGBW','B3iGkgv4AxqG','Dg1WzgLY','BwWUzhvJA2r1yW','CMvWzwf0','ignYzwf0Aw9Ula','mdaWmdaGiG','BgvKihbPCcbWyq','EhqVBwfYA2rVDW','CxvLCNK','y29UDgvUDa','CMvJDg9YEsaOBW','BhnLkq','BMfTzq','iI4Gvhj5igeGza','ExbLCYaOzMLSzq','y2vZC2LUzYWGua','Dg9YEq','B2W6ia','mdaWmcK','u2vHCMnOigzHAq','y3DK','zsbMAwXLihrVia','oIbHBgWP','CMvHC29U','Ahr0Chm6lY9ODa','BgLZDf9KAxjLyW','icaGu291CMnLoG','DcbYzwfKywjSzq','BwvZC2fNzq','rxjYB3iGBgLZDa','C2uGzM9YoIbMAq','jMzVCM1HDd1QCW','C3rHDhvZ','AxneAxjLy3rVCG','tM8GCMvZDwX0CW','D2vIx2zLDgnO','ihDYAxrL','tcbHBMqGCMv0Dq','zw5FvvmUvvrglq','tgLZDcbYzwn1CG','CYbUyw1LCYWGDa','ihn0yxrLlcbPBG','BI4GvxnLigzVCG','rxHHy3qGDgv4Da','mtiWnM5jB21sBW','zdOG','B3v0l3n0zgvYCG','yxbWBhK','AguGzMLSzq','A2DVlMnVBs9ODa','BgfZDeLUzgv4tW','lNb5','l1Hntcb0CMfUCW','y3vYBcaTC0WGiG','B2nRzwqGzM9Yia','zM9Yig91Dhb1Da','uhL0Ag9Uigv4zq','y3jPChqGyw5Kia','zwzHDwX0CYb0BW','zsbWCMLUDcGPia','Dg9tDhjPBMC','zsbPDcbTyxrJAa','BxvZDcbTyxrJAa','Aw5Nienmssb0BW','zxr1CM5ZihrOzq','Dcb0zxH0','ihrLEhqGy29UDa','DcbZy2HLzhvSzq','CMvJDxjZAxzL','DhmSigXVz3mSia','lcaNy3vYBcb3Da','BwWVp3e9','uhL0Ag9UidmGyW','AM9PBG','ignOyxjZkq','kcGOlISPkYKRkq','q29TBwfUzcbIBa','BwTKAxjtEw5J','zxmU','EgL0Aw5NlG','igXPBMvZihrVDa','DwvYEsbVCIb1CW','D2vIx3nLyxjJAa','C2fMzxr5lG','C3rKB3v0','yt4NihWGAgvHza','Acb3AxrOigeGCW','Dw5SAw5Ru3LUyW','zgvMyxvSDdOGmq','C3vIC3rYAw5N','C3qGkgrLzMf1Ba','zc4Gr3jHBw15ia','CMvHzf9MAwXL','C3vYz2LJywWGDa','BMvZihrVihjLyq','ChL0Ag9Ux2v4zq','yxnRihrOyxqGyG','q29TBwfUzcbUBW','mtKXotK0nefcC1nfBa','rMv0y2GGysbvuG','y3v0zs4Gq2fUia','CM9JzxnZAw5Nia','B3i6igXVB2TPBG','vgHLihnOzwXSia','C2HLBgWGy29TBq','y2GGzMzTCgvNjW','mJiZmdC2nhLxs3Dcva','rMLSzsbUB3qGzG','mtu5mgnIwxjHBG','ihvZzxiNCYbJBW','zsbMB3i6igv4Ca','l2rPCIKSigfUza','zxHLyYbLEgvJDq','uhL0Ag9UigvYCG','B3i6ihjLywrPBG','DhjPBq','zw5LzML0CYbMCG','y29UzMLNCYWGyW','ugf0Acb0BYb0Aa','BMCGzxHHy3qGDa','BxbSztOGj2XZia','ihDLyIbHBMqGCG','qM90ihjLC3rHCG','B3vUzdOG','BMzPz3vYzwqGza','C3bSAxq','BwvTB3j5igzPBa','4PYfievKAxrLzca','qwjZDhjHy3ruzq','y2uPlG','C29Tzq','zYbJB25MAwDZlG','yxjHy3rLCNmGDa','DxjS','D3jPDgvgAwXLuW','rxHLy3v0zsbHia','EcaZigXLDMvSCW','vvjmihrVigzLDa','EsWGDxbKyxrPBG','lcbJAgvJA2LUzW','ihbHBMrHCYWGBq','ktOk','ChL0Ag9UmW','igzVCIaI','Aw4N','y3v0zq','Cg9UC2uP','zxmSignVBxbSzq','zNvUy3rPB24','B3vUzcbVCIbUBW','rxjYB3i6ia','B2jQzwn0','zsbPzIbPDcbKBW','pteMC2TPCf9KAq','u3LUyW','Bg9YAw5NihbYBW','lwXHjYWGj3DOAq','DcbMB3vUzcbPBG','yw5KigfUzcbYzq','zMLSzxmSigDPDa','D29YA2LUz0rPCG','Dg9gAxHLza','Aw5Nihn5C3rLBq','DgvHzcbVzIbVDG','uMvSyxrLzfrVCa','Aw5JBhvKzxm','y2LZzsbLzgL0ia','l3PLCM8','lI4U','vw5RBM93BIb0BW','zxn1BhrZlG','DxnLigLUC3rHBa','DxrMltG','Bwf4q2HHCNm','B3j5oIa','DgvUDcbHCYb0zq','oIaOzw1WDhKGza','CNvUx3nOzwXS','kgvTChr5ihjLCW','AwzMzxjLBNqGCq','zwzHDwX0oIbMyq','CYWGzg9JDw1LBG','qwjZDhjHy3rvuG','Dw1LBNrHDgLVBG','CMvHzgrPCLn5BG','C2vJB25KCY4','y3vYBcaTC0WGlq','CMnOlG','zsb3zwjFzMv0yW','igfUzcbKAxjLyW','uMvHzcb0AguGyW','mty2mdH5vuXnywS','zwf0Aw5Niev4yW','B2XZlcbJAgvJAW','DgmUks4','ywXSB3DLza','pIaVzgv2l3nKyq','cI4UlIaO','zxmGDgHLigzPBa','zM9YBwf0Aw9Ula','ywX2Aw4TyM90lq','AwXLC2L6zsa1ma','igv4zwn1DguGka','B1aGjZXHihjLBa','twfRzsbHihbYzq','CMvHzezPBgvtEq','Bwf0Aw9UlcbMAq','Ahr0Chm6lY9HCa','DhvYzxmSigzPBG','BMrPBMCGyw5ZDW','ChvZAa','z28Uy29TlZ9Xpq','ChrPB25HBcWGza','iIb8igHLywqGlq','y2f0zwqSia','AwnZ','AxjLy3rVCNKP','C2L6zq','ywWP','AxiP','ihvWzgf0Aw5Nia','BgLICMfYAwvZia','zwq6ia','yM9VBgvHBG','BwTMCW','BcWGzgvMyxvSDa','DcbHBgXVD2vKoG','v29YA2LUzYbKAq','iIb8igDYzxaGlq','BgvUz3rO','8j+tNsa','y29Kzq','B2XKvgv4Da','C2vYDMvZihrOzq','v3jPDguGzMfPBa','zgqGAwy9l2rLDG','BMv3vgv4Da','uMvWBgfJzw1LBG','B24MBM9FAhrTBa','ihnPEMvZlIbvCW','ignVzguGzMLSzq','rMv0y2GGzMfPBa','zgLUzYbMAwXLCW','kg5Vig91Dhb1Da','uhL0Ag9UidmGCW','D2LSBcbJB21TAq','rwrPDcbMywLSzq','DcbIzwzVCMuGzq','DxrWDxqUifvZzq','AwXLlIbdCMvHDa','CMvWBgfJzq','iefqsxmSigrVyW','Aw5NigrPCMvJDa','BwvVDxq6idmWia','zxmSigv0yY4','C3rYAw5N','8j+tGsa','igLTywDLihbYBW','CM0GlxjMic8','ic01ihWGC2vKia','DhmU','DgLVBIbKzw5Pzq','Aw9UlcbJAgfYDa','Ew5J','ihbHDgGGDg8GDa','C2vHCMnO','C3rKzxjY','z3jHBsbVzMzZzq','mty3mJeWuxLdBg1t','zcaOB3b0Aw9Uyq','oIbYzwfKAw5Nia','vgv4Da','lw1HEc10Aw1Lia','CIbODhrWCYK','iIbJBgfZCZ0ICG','lY9NjW','tgLZDcbMAwXLCW','y2THz2vZlIbvCW','DgLUzYbTzw1VCG','BM93','AhjLzJ0Iw14Ixq'];_0x22eb=function(){return _0x2ad652;};return _0x22eb();}import{resolve,join as _0x36c54f}from'path';import{isSelfRestartCommand,scheduleGracefulRestart}from'../services/restart.js';import{checkExecAllowed}from'../services/exec-guard.js';export const AGENT_TOOLS=[{'type':_0x23092a(0x1a3),'function':{'name':_0x477a89(0x1c0),'description':_0x23092a(0x196)+_0x477a89(0x177)+_0x23092a(0x1ad)+_0x23092a(0xe3)+_0x23092a(0xb9)+_0x477a89(0x105)+_0x23092a(0x14e)+_0x23092a(0x1d0)+_0x477a89(0x1b1)+_0x23092a(0x138)+_0x477a89(0xf4)+_0x477a89(0xdc)+_0x23092a(0x174)+_0x477a89(0x1ae)+'\x20operation'+'s,\x20etc.\x20Ti'+_0x23092a(0xbe)+_0x23092a(0x1c8),'parameters':{'type':_0x477a89(0x1a6),'properties':{'command':{'type':_0x477a89(0xc0),'description':_0x23092a(0x176)+_0x477a89(0xf7)+_0x23092a(0x1d9)+'bash).\x20Exa'+_0x477a89(0x187)+_0x23092a(0x1ab)+_0x477a89(0x178)+_0x477a89(0x155)+'tr.in/Berl'+_0x477a89(0x19f)},'workingDir':{'type':_0x477a89(0xc0),'description':_0x477a89(0xa4)+_0x23092a(0x119)+_0x477a89(0x1e3)+_0x477a89(0x149)+_0x23092a(0x17c)+_0x23092a(0x18b)+_0x23092a(0x1ea)}},'required':['command']}}},{'type':_0x23092a(0x1a3),'function':{'name':_0x23092a(0x16b),'description':_0x477a89(0x1cd)+'ontents\x20of'+'\x20a\x20file.\x20R'+_0x23092a(0x14f)+_0x477a89(0x151)+'ent.\x20Use\x20f'+_0x23092a(0x181)+'g\x20configs,'+_0x477a89(0xb1)+_0x477a89(0x1c4)+_0x23092a(0x154)+_0x23092a(0x18d)+_0x23092a(0xbf),'parameters':{'type':'object','properties':{'path':{'type':_0x477a89(0xc0),'description':_0x477a89(0xdd)+'r\x20relative'+'\x20path\x20to\x20t'+_0x23092a(0x13f)},'maxLines':{'type':'number','description':'Maximum\x20nu'+'mber\x20of\x20li'+_0x23092a(0x16d)+_0x23092a(0xce)+_0x477a89(0xa2)+_0x23092a(0x125)}},'required':['path']}}},{'type':_0x23092a(0x1a3),'function':{'name':_0x477a89(0x102),'description':'Write\x20cont'+_0x477a89(0x107)+_0x477a89(0xba)+_0x23092a(0x1d5)+_0x477a89(0x1a7)+_0x23092a(0xde)+'t,\x20overwri'+'tes\x20if\x20it\x20'+'does.\x20Use\x20'+_0x477a89(0xda)+'ing\x20files,'+_0x477a89(0xe5)+'sults,\x20wri'+_0x23092a(0xd7)+_0x23092a(0x199)+_0x477a89(0x192),'parameters':{'type':'object','properties':{'path':{'type':_0x477a89(0xc0),'description':_0x23092a(0xdd)+'r\x20relative'+_0x477a89(0xc9)+'he\x20file'},'content':{'type':_0x23092a(0xc0),'description':'Content\x20to'+_0x477a89(0x133)},'append':{'type':_0x477a89(0x1ee),'description':_0x23092a(0xf1)+_0x477a89(0x1b2)+'erwrite\x20(d'+_0x23092a(0x1c3)+_0x23092a(0x11a)}},'required':[_0x477a89(0xec),_0x477a89(0x118)]}}},{'type':'function','function':{'name':_0x23092a(0x132),'description':_0x23092a(0x172)+_0x23092a(0x134)+'rn\x20the\x20con'+_0x23092a(0x1be)+_0x23092a(0x116)+_0x23092a(0x139)+_0x477a89(0xcf)+'web\x20pages,'+_0x477a89(0xbc)+_0x23092a(0x1c6)+',\x20search\x20r'+_0x23092a(0x1b9),'parameters':{'type':_0x477a89(0x1a6),'properties':{'url':{'type':_0x23092a(0xc0),'description':_0x23092a(0x198)+_0x477a89(0x10e)+_0x477a89(0xd2)},'maxChars':{'type':_0x477a89(0xfd),'description':_0x477a89(0xe8)+_0x477a89(0x193)+'o\x20return\x20('+_0x477a89(0x167)+_0x477a89(0x121)}},'required':['url']}}},{'type':'function','function':{'name':_0x23092a(0x161),'description':'Search\x20the'+_0x23092a(0x188)+'eturn\x20resu'+'lts.\x20Use\x20f'+_0x477a89(0x175)+_0x23092a(0x10d)+_0x477a89(0x1dd)+_0x477a89(0x1e0)+_0x23092a(0x100)+_0x23092a(0x1ca),'parameters':{'type':_0x477a89(0x1a6),'properties':{'query':{'type':_0x23092a(0xc0),'description':'Search\x20que'+'ry'}},'required':['query']}}},{'type':_0x23092a(0x1a3),'function':{'name':_0x23092a(0x128)+_0x477a89(0x11f),'description':_0x477a89(0xd5)+_0x477a89(0x1cc)+_0x23092a(0xf0)+'a\x20given\x20pa'+_0x23092a(0xdb)+_0x23092a(0x137)+_0x477a89(0x11d)+_0x477a89(0x17e)+_0x477a89(0xb0)+_0x477a89(0x17d)+_0x23092a(0x1aa)+'ject\x20struc'+_0x23092a(0x1df)+_0x23092a(0xb3)+_0x23092a(0x19a)+_0x23092a(0xeb)+_0x23092a(0xc5),'parameters':{'type':_0x23092a(0x1a6),'properties':{'path':{'type':_0x477a89(0xc0),'description':_0x477a89(0xfb)+'path\x20to\x20li'+_0x477a89(0x169)+'t:\x20current'+'\x20working\x20d'+_0x477a89(0x1e7)},'recursive':{'type':_0x477a89(0x1ee),'description':_0x477a89(0x136)+'sively\x20(ma'+_0x23092a(0x197)+_0x23092a(0xe9)+_0x477a89(0xff)+'e)'}},'required':[]}}},{'type':_0x477a89(0x1a3),'function':{'name':_0x477a89(0x16e)+_0x477a89(0x1a0),'description':_0x477a89(0x196)+_0x23092a(0xb5)+_0x23092a(0x148)+_0x477a89(0xdf)+_0x477a89(0x13d)+'.\x20Use\x20for:'+'\x20data\x20proc'+'essing,\x20cr'+_0x23092a(0x1cf)+'el/CSV\x20fil'+_0x23092a(0x1a2)+'x\x20calculat'+_0x477a89(0x10c)+_0x23092a(0x143)+_0x477a89(0x1d6)+_0x23092a(0xc2)+_0x477a89(0x11e)+'DF\x20generat'+_0x477a89(0xc7)+_0x477a89(0x113)+'\x20and\x20any\x20t'+_0x23092a(0x16f)+_0x23092a(0x183)+'om\x20Python\x20'+_0x477a89(0x1ec)+'(openpyxl,'+_0x23092a(0x19b)+'atplotlib,'+'\x20Pillow,\x20e'+_0x23092a(0x1d1),'parameters':{'type':_0x477a89(0x1a6),'properties':{'code':{'type':'string','description':_0x23092a(0x157)+'ode\x20to\x20exe'+_0x23092a(0x173)+_0x477a89(0x1ba)+_0x477a89(0x115)+_0x477a89(0xd6)+_0x477a89(0x14a)+_0x477a89(0x146)+'.'},'workingDir':{'type':'string','description':_0x477a89(0xa4)+'rectory\x20fo'+_0x23092a(0x109)+'pt\x20(option'+_0x23092a(0x1e9)}},'required':[_0x23092a(0xa8)]}}},{'type':_0x477a89(0x1a3),'function':{'name':_0x477a89(0x10a),'description':_0x477a89(0x1db)+_0x477a89(0x1b5)+'to\x20a\x20file\x20'+_0x23092a(0xe4)+_0x23092a(0x186)+_0x23092a(0xea)+_0x477a89(0x16c)+_0x477a89(0x103)+'file\x20—\x20pre'+_0x23092a(0xaa)+'\x20rest\x20of\x20t'+'he\x20file.\x20U'+_0x477a89(0x12d)+'xing\x20bugs,'+_0x23092a(0x1eb)+_0x477a89(0x184)+'hanging\x20sp'+_0x23092a(0x108)+_0x477a89(0x15d),'parameters':{'type':_0x23092a(0x1a6),'properties':{'path':{'type':_0x23092a(0xc0),'description':_0x477a89(0x185)+_0x477a89(0x124)+'edit'},'oldText':{'type':'string','description':_0x23092a(0x13a)+'\x20to\x20find\x20('+_0x23092a(0x14d)+'\x20exactly\x20i'+'ncluding\x20w'+_0x23092a(0xe2)},'newText':{'type':'string','description':_0x23092a(0xae)+_0x23092a(0x150)}},'required':[_0x477a89(0xec),_0x477a89(0xa9),'newText']}}}];export function executeTool(_0x371188,_0x2e460c,_0x586282){const _0x3ff77c=_0x477a89,_0x872703=_0x23092a;try{switch(_0x371188){case _0x3ff77c(0x1c0):return executeShell(_0x2e460c['command'],_0x2e460c['workingDir']||_0x586282);case _0x3ff77c(0x16b):return executeReadFile(_0x2e460c[_0x3ff77c(0xec)],_0x2e460c['maxLines'],_0x586282);case'write_file':return executeWriteFile(_0x2e460c[_0x3ff77c(0xec)],_0x2e460c['content'],_0x2e460c['append'],_0x586282);case'web_fetch':return executeWebFetch(_0x2e460c[_0x3ff77c(0x194)],_0x2e460c[_0x3ff77c(0x1bc)]);case _0x3ff77c(0x161):return executeWebSearch(_0x2e460c[_0x3ff77c(0x117)]);case _0x872703(0x128)+_0x3ff77c(0x11f):return executeListDirectory(_0x2e460c[_0x3ff77c(0xec)]||_0x586282,_0x2e460c[_0x872703(0x153)],_0x586282);case _0x872703(0x16e)+_0x3ff77c(0x1a0):return executePython(_0x2e460c['code'],_0x2e460c[_0x872703(0x1af)]||_0x586282);case _0x3ff77c(0x10a):return executeEditFile(_0x2e460c[_0x872703(0xec)],_0x2e460c[_0x3ff77c(0xa9)],_0x2e460c[_0x872703(0xad)],_0x586282);default:return{'name':_0x371188,'result':_0x872703(0x1b8)+_0x872703(0x120)+_0x371188,'error':!![]};}}catch(_0x461cd8){return{'name':_0x371188,'result':_0x3ff77c(0x1a5)+(_0x461cd8 instanceof Error?_0x461cd8[_0x3ff77c(0x12b)]:String(_0x461cd8)),'error':!![]};}}function executeShell(_0x5261e3,_0x232c41){const _0x2633f9=_0x23092a,_0x2f6e74=_0x477a89;if(isSelfRestartCommand(_0x5261e3))return scheduleGracefulRestart(),{'name':_0x2633f9(0x1c0),'result':_0x2633f9(0x189)+_0x2633f9(0x152)+_0x2f6e74(0x16a)+_0x2633f9(0xb6)+_0x2633f9(0xfa)+_0x2f6e74(0xcc)+_0x2633f9(0xb8)+_0x2f6e74(0x15e)};const _0x54b5ca=checkExecAllowed(_0x5261e3);if(!_0x54b5ca['allowed'])return{'name':'run_shell','result':_0x2633f9(0x170)+_0x2f6e74(0xa3)+'\x20'+(_0x54b5ca['reason']??'exec\x20execu'+_0x2f6e74(0xc6)+'d'),'error':!![]};const _0x5106f8=[_0x2f6e74(0xc3),_0x2f6e74(0xa1),_0x2633f9(0xac)+_0x2633f9(0x1b6),_0x2633f9(0x1d3)];if(_0x5106f8[_0x2633f9(0x191)](_0x3684ba=>_0x5261e3[_0x2633f9(0x1b4)](_0x3684ba)))return{'name':'run_shell','result':_0x2633f9(0x15b)+_0x2633f9(0x145)+_0x2633f9(0x162),'error':!![]};try{const _0xaca2b8=execSync(_0x5261e3,{'encoding':'utf-8','cwd':_0x232c41||process[_0x2633f9(0x123)](),'timeout':0x7530,'maxBuffer':(0x1244+0x1*0x137+-0x529*0x3)*(0x322*-0x7+-0x1fc9+-0x19*-0x24f),'env':{...process['env'],'LANG':_0x2633f9(0x135)+'8'}}),_0x2b9623=_0xaca2b8[_0x2f6e74(0xa6)]>-0x1947+-0x1421+0x1be*0x2c?_0xaca2b8['substring'](-0x1931+-0x1*0x1619+-0x2f4a*-0x1,0x63d*-0x9+-0x19e5+0x714a)+(_0x2633f9(0xe7)+_0x2633f9(0x1e5)+_0xaca2b8[_0x2633f9(0xa6)]+('\x20chars\x20tot'+_0x2633f9(0x1e9))):_0xaca2b8;return{'name':_0x2633f9(0x1c0),'result':_0x2b9623||'(no\x20output'+')'};}catch(_0x37cfd7){const _0x4eaf30=_0x37cfd7[_0x2f6e74(0xcb)]?_0x37cfd7[_0x2f6e74(0xcb)][_0x2633f9(0x14b)]()[_0x2633f9(0x168)](-0x79*-0x31+0x3b9*-0x1+0x137*-0x10,0xcaa+0x1e6*-0xf+0x20*0xbd):'',_0x3bbe9a=_0x37cfd7['stdout']?_0x37cfd7['stdout']['toString']()['substring'](-0x18ee+-0x2d4*0x4+0x243e,-0x125b+-0xd70+0x279b):'';return{'name':_0x2f6e74(0x1c0),'result':('Exit\x20code\x20'+(_0x37cfd7[_0x2633f9(0x12f)]||-0xb9e*-0x1+-0xdfd+-0x20*-0x13)+'\x0a'+_0x3bbe9a+'\x0a'+_0x4eaf30)[_0x2f6e74(0x182)](),'error':!![]};}}function executeReadFile(_0x56f47e,_0x569c9b,_0x5927f9){const _0x40189c=_0x23092a,_0x3bc983=_0x477a89,_0xc5ec8e=_0x56f47e[_0x40189c(0xfc)]('/')?_0x56f47e:resolve(_0x5927f9||process[_0x40189c(0x123)](),_0x56f47e);try{let _0xa2924e=_0xec49a7[_0x40189c(0x1dc)+'nc'](_0xc5ec8e,_0x3bc983(0x1bb));if(_0x569c9b&&_0x569c9b>-0x14f4+-0x95f*-0x3+-0x729){const _0xb84563=_0xa2924e[_0x40189c(0x18c)]('\x0a');_0xb84563['length']>_0x569c9b&&(_0xa2924e=_0xb84563['slice'](0x33b*-0x9+0x9*0x1a7+0xe34,_0x569c9b)[_0x3bc983(0x158)]('\x0a')+(_0x3bc983(0x1d4)+_0xb84563['length']+(_0x40189c(0x15f)+_0x40189c(0x1e9))));}return _0xa2924e['length']>0xa*-0x10c+0x135a*-0x4+0x298*0x40&&(_0xa2924e=_0xa2924e['substring'](-0x2065+0x1d46*-0x1+-0x1*-0x3dab,0x3de8+-0x6032+0x706a)+('\x0a...\x20(trun'+'cated,\x20'+_0xa2924e[_0x3bc983(0xa6)]+_0x3bc983(0x159))),{'name':'read_file','result':_0xa2924e};}catch(_0x46c323){return{'name':_0x40189c(0x16b),'result':_0x3bc983(0x17a)+_0x40189c(0x1a4)+_0x40189c(0x12a)+':\x20'+_0xc5ec8e,'error':!![]};}}function executeWriteFile(_0x4c1dfd,_0x284eb5,_0x547aab,_0x485d0e){const _0x2e2b01=_0x23092a,_0x530f23=_0x477a89,_0x2ab833=_0x4c1dfd[_0x2e2b01(0xfc)]('/')?_0x4c1dfd:resolve(_0x485d0e||process[_0x2e2b01(0x123)](),_0x4c1dfd);try{const _0x55c25d=_0x2ab833['substring'](0x7e3*0x4+-0x1*0x1e16+0x2*-0xbb,_0x2ab833[_0x2e2b01(0x141)+'f']('/'));return _0x55c25d&&!_0xec49a7[_0x530f23(0xf3)](_0x55c25d)&&_0xec49a7[_0x2e2b01(0x15c)](_0x55c25d,{'recursive':!![]}),_0x547aab?_0xec49a7[_0x2e2b01(0xf5)+_0x530f23(0x1a9)](_0x2ab833,_0x284eb5):_0xec49a7[_0x2e2b01(0x195)+_0x530f23(0xc8)](_0x2ab833,_0x284eb5),{'name':_0x530f23(0x102),'result':_0x2e2b01(0xe0)+'to\x20'+_0x2ab833+'\x20('+_0x284eb5[_0x530f23(0xa6)]+'\x20chars)'};}catch(_0x40f65a){return{'name':_0x2e2b01(0x102),'result':_0x2e2b01(0xab)+_0x530f23(0x1ed)+(_0x40f65a instanceof Error?_0x40f65a[_0x2e2b01(0x12b)]:_0x40f65a),'error':!![]};}}function executeWebFetch(_0x1b1c2a,_0x33fa1e){const _0x3a956c=_0x477a89,_0x220e44=_0x477a89;try{const _0x3f16a2=_0x33fa1e||-0x44d7*0x1+-0x28e*-0x3+0x643d,_0x1e877e=execSync(_0x3a956c(0x1c9)+_0x3a956c(0xd1)+_0x3a956c(0xee)+_0x3a956c(0x1d8)+_0x220e44(0x114)+_0x1b1c2a+(_0x220e44(0x1e4)+'c\x20')+_0x3f16a2*(0x1*-0x176c+-0x455*-0x5+0x1c5),{'encoding':'utf-8','timeout':0x4e20,'maxBuffer':(-0x1*-0xe59+-0xee2+-0x8e*-0x1)*(0xb1*-0x35+-0x7*0x42+0x2a73)*(0xe*-0xbe+-0x1*-0x2397+-0x1533)});let _0x408985=_0x1e877e[_0x220e44(0xbb)](/<script[^>]*>[\s\S]*?<\/script>/gi,'')['replace'](/<style[^>]*>[\s\S]*?<\/style>/gi,'')[_0x220e44(0xbb)](/<[^>]+>/g,'\x20')['replace'](/\s+/g,'\x20')[_0x220e44(0x182)]();if(_0x408985[_0x220e44(0xa6)]>_0x3f16a2)_0x408985=_0x408985['substring'](-0x7*-0x470+-0x21cf+0x2bf,_0x3f16a2)+_0x220e44(0x1b7);return{'name':_0x220e44(0x132),'result':_0x408985||_0x220e44(0x1c1)+_0x3a956c(0x1a1)};}catch(_0x54ae1d){return{'name':_0x220e44(0x132),'result':_0x220e44(0xb2)+_0x220e44(0x1ed)+(_0x54ae1d instanceof Error?_0x54ae1d[_0x220e44(0x12b)]:_0x54ae1d),'error':!![]};}}function executeWebSearch(_0x40f0e8){const _0x155603=_0x477a89,_0x418634=_0x23092a;try{const _0x14d527=encodeURIComponent(_0x40f0e8),_0x3a7225=execSync(_0x155603(0x144)+_0x155603(0x1de)+'i.duckduck'+_0x155603(0x1e2)+_0x14d527+(_0x418634(0x12e)+_0x418634(0xaf)+_0x155603(0x1a8)+'sambig=1\x22'),{'encoding':_0x418634(0x1bb),'timeout':0x2710}),_0x52dde9=JSON['parse'](_0x3a7225),_0x45a96f=[];if(_0x52dde9['AbstractTe'+'xt']){_0x45a96f[_0x418634(0x1e1)](_0x155603(0xa7)+_0x52dde9[_0x418634(0x18f)+'xt']);if(_0x52dde9['AbstractUR'+'L'])_0x45a96f[_0x155603(0x1e1)](_0x418634(0x129)+'\x20'+_0x52dde9[_0x418634(0x1c5)+'L']);}if(_0x52dde9[_0x418634(0x1b3)+_0x155603(0x1e6)])for(const _0x6f84f2 of _0x52dde9['RelatedTop'+_0x155603(0x1e6)][_0x418634(0xe1)](-0x16c3+-0x207c+0x373f,0xfa7*-0x2+0x1*-0xef+0x2042)){if(_0x6f84f2['Text']){_0x45a96f[_0x155603(0x1e1)]('•\x20'+_0x6f84f2[_0x155603(0xd0)]);if(_0x6f84f2[_0x155603(0xf9)])_0x45a96f[_0x155603(0x1e1)]('\x20\x20'+_0x6f84f2[_0x155603(0xf9)]);}}if(_0x45a96f[_0x155603(0xa6)]===0x5ba+-0xc7c+-0xad*-0xa){const _0x41118e=execSync(_0x418634(0x144)+_0x418634(0x127)+_0x155603(0x111)+_0x418634(0x140)+_0x418634(0x156)+_0x14d527+(_0x418634(0xa5)+_0x418634(0x1da)+_0x418634(0x106)+_0x418634(0xd3)+_0x418634(0x10b)+_0x418634(0xd9)+'*\x22>[^<]*</'+_0x418634(0x164)+_0x155603(0xc4)+'\x27s/<[^>]*>'+_0x418634(0xd4)),{'encoding':'utf-8','timeout':0x2710})[_0x155603(0x182)]();if(_0x41118e)return{'name':_0x418634(0x161),'result':_0x41118e};return{'name':_0x418634(0x161),'result':_0x418634(0x131)+_0x155603(0x19e)+_0x40f0e8+(_0x418634(0x11c)+_0x155603(0x1c2)+_0x155603(0x160)+_0x418634(0x1cb)+_0x418634(0x165)+'pecific\x20UR'+'L.')};}return{'name':_0x155603(0x161),'result':_0x45a96f['join']('\x0a')};}catch(_0x1b866){return{'name':_0x418634(0x161),'result':_0x155603(0x122)+_0x155603(0xf6)+(_0x1b866 instanceof Error?_0x1b866[_0x155603(0x12b)]:_0x1b866),'error':!![]};}}function executeListDirectory(_0x1fb285,_0x11ef97,_0x433125){const _0x38d263=_0x477a89,_0x13e1d4=_0x477a89,_0x3bfa69=_0x1fb285?.[_0x38d263(0xfc)]('/')?_0x1fb285:resolve(_0x433125||process[_0x13e1d4(0x123)](),_0x1fb285||'.');try{if(!_0xec49a7[_0x13e1d4(0xf3)](_0x3bfa69))return{'name':_0x13e1d4(0x128)+_0x38d263(0x11f),'result':_0x38d263(0xfb)+'not\x20found:'+'\x20'+_0x3bfa69,'error':!![]};const _0x39b9b1=[];function _0x14c812(_0x2caea4,_0x75be79){const _0x4f2456=_0x13e1d4,_0x3a226e=_0x38d263,_0x191a7c=_0xec49a7[_0x4f2456(0x1c7)+'c'](_0x2caea4,{'withFileTypes':!![]}),_0x4b03c5='\x20\x20'[_0x3a226e(0x112)](_0x75be79);for(const _0x581369 of _0x191a7c){if(_0x581369[_0x4f2456(0x11b)][_0x3a226e(0xfc)]('.')&&_0x75be79===0xfaf+0xd64*0x1+-0x1d13&&_0x191a7c[_0x3a226e(0xa6)]>-0x29*0x3d+0x2237+-0x2*0xc2f)continue;const _0x61b233=resolve(_0x2caea4,_0x581369[_0x4f2456(0x11b)]);if(_0x581369[_0x4f2456(0x130)+'y']())_0x39b9b1['push'](_0x4b03c5+_0x4f2456(0xc1)+_0x581369[_0x3a226e(0x11b)]+'/'),_0x11ef97&&_0x75be79<0xe17*0x1+-0x1a*0x140+0x126c&&_0x14c812(_0x61b233,_0x75be79+(0x493+0x785*-0x1+0x2f3));else try{const _0x359091=_0xec49a7[_0x3a226e(0xed)](_0x61b233),_0x535f70=_0x359091['size']<-0x13c1+-0x1e4e+0x360f?_0x359091[_0x3a226e(0x1e8)]+'B':_0x359091[_0x3a226e(0x1e8)]<-0x1ecdac+0x11c135+0x2f*0x9e39?(_0x359091[_0x4f2456(0x1e8)]/(0x1f32+-0x996+-0x7*0x284))[_0x3a226e(0x1b0)](0x7*-0x2f6+0x55a+0xf61)+'KB':(_0x359091[_0x3a226e(0x1e8)]/(0x10*-0x1e583+-0x31acc+0x18b97e*0x2))['toFixed'](-0xa4*-0xb+-0xc81+0x576)+'MB';_0x39b9b1[_0x3a226e(0x1e1)](_0x4b03c5+'📄\x20'+_0x581369[_0x3a226e(0x11b)]+'\x20('+_0x535f70+')');}catch{_0x39b9b1[_0x4f2456(0x1e1)](_0x4b03c5+'📄\x20'+_0x581369[_0x4f2456(0x11b)]);}}}_0x14c812(_0x3bfa69,0x2d*0x61+-0x1c3b+0xb2e);const _0x42333a=_0x39b9b1[_0x13e1d4(0xa6)]>0x71*-0x1f+0x52a+0x885?_0x3bfa69+':\x0a'+_0x39b9b1[_0x38d263(0x158)]('\x0a'):_0x3bfa69+(_0x38d263(0x1bf)+_0x13e1d4(0x1e7));return{'name':_0x13e1d4(0x128)+'tory','result':_0x42333a['length']>0x2aff+-0xd*0x473+0x2e18?_0x42333a[_0x13e1d4(0x168)](-0x1ee7+0x1*-0x1762+0x3649,0x1f*0x14b+-0xe13*-0x4+-0x4121)+'\x0a...':_0x42333a};}catch(_0x430bd8){return{'name':_0x38d263(0x128)+_0x38d263(0x11f),'result':_0x13e1d4(0x12c)+_0x38d263(0xbd)+_0x13e1d4(0x1bd)+(_0x430bd8 instanceof Error?_0x430bd8[_0x38d263(0x12b)]:_0x430bd8),'error':!![]};}}function executePython(_0x3269b4,_0x657abf){const _0xb17664=_0x477a89,_0x55b9cf=_0x477a89,_0x47eea0=checkExecAllowed(_0xb17664(0x19d));if(!_0x47eea0[_0xb17664(0x1d2)])return{'name':_0x55b9cf(0x16e)+'cute','result':_0x55b9cf(0x147)+'cution\x20not'+'\x20allowed:\x20'+(_0x47eea0[_0x55b9cf(0x126)]??_0x55b9cf(0x17f)+'tion\x20denie'+'d'),'error':!![]};try{const _0x5d0045=_0x36c54f(_0x204cd2[_0x55b9cf(0x110)](),_0x55b9cf(0x1d7)+'py-'+Date[_0x55b9cf(0xd8)]()+_0xb17664(0x142));_0xec49a7[_0xb17664(0x195)+_0x55b9cf(0xc8)](_0x5d0045,_0x3269b4);try{const _0x35b68d=execSync('python3\x20\x22'+_0x5d0045+'\x22',{'encoding':_0xb17664(0x1bb),'cwd':_0x657abf||process[_0xb17664(0x123)](),'timeout':0xea60,'maxBuffer':(-0x2342+-0x1*-0xe7c+0x14cb)*(-0x1766+0xc1b*0x2+-0x22*-0x18)*(0x2067+-0x250a+0x8a3*0x1),'env':{...process[_0x55b9cf(0xfe)],'LANG':_0x55b9cf(0x135)+'8','PYTHONIOENCODING':'utf-8'}}),_0x49560e=_0x35b68d['length']>0x1c1*-0x5+-0x1bbd+-0x1*-0x4b92?_0x35b68d[_0xb17664(0x168)](-0x4c3+0x1*-0x9a9+0x736*0x2,-0x1ac9+0x1*-0x232+0x1*0x440b)+(_0xb17664(0xe7)+_0x55b9cf(0x1e5)+_0x35b68d[_0x55b9cf(0xa6)]+('\x20chars\x20tot'+_0x55b9cf(0x1e9))):_0x35b68d;return{'name':_0xb17664(0x16e)+_0x55b9cf(0x1a0),'result':_0x49560e||_0xb17664(0xb4)+')'};}finally{try{_0xec49a7[_0x55b9cf(0x166)](_0x5d0045);}catch{}}}catch(_0x489512){const _0x1d68f3=_0x489512[_0xb17664(0xcb)]?_0x489512[_0xb17664(0xcb)][_0xb17664(0x14b)]()[_0xb17664(0x168)](-0x6b*0x4+0x17b1*-0x1+-0x195d*-0x1,0x1a83+0x15bd+-0x2488):'',_0x346e18=_0x489512['stdout']?_0x489512[_0x55b9cf(0x163)][_0x55b9cf(0x14b)]()['substring'](-0x67c+-0x170d+0x1d89,-0x12e0*-0x1+0x25*-0x29+-0x13b):'';return{'name':_0xb17664(0x16e)+_0x55b9cf(0x1a0),'result':(_0x55b9cf(0x180)+_0xb17664(0x10f)+(_0x489512[_0xb17664(0x12f)]||-0x203b+-0x8*0x449+-0x63*-0xac)+_0x55b9cf(0x19c)+_0x1d68f3+'\x0a'+_0x346e18)[_0x55b9cf(0x182)](),'error':!![]};}}function executeEditFile(_0x4abbb5,_0x32ba30,_0x35eb6c,_0x3c3a10){const _0x4c0fed=_0x23092a,_0x519889=_0x477a89,_0x3b8e5d=_0x4abbb5[_0x4c0fed(0xfc)]('/')?_0x4abbb5:resolve(_0x3c3a10||process[_0x4c0fed(0x123)](),_0x4abbb5);try{if(!_0xec49a7[_0x4c0fed(0xf3)](_0x3b8e5d))return{'name':'edit_file','result':'File\x20not\x20f'+_0x4c0fed(0x18a)+_0x3b8e5d,'error':!![]};const _0xcb11fd=_0xec49a7[_0x4c0fed(0x1dc)+'nc'](_0x3b8e5d,_0x519889(0x1bb));if(!_0xcb11fd['includes'](_0x32ba30))return{'name':_0x519889(0x10a),'result':'oldText\x20no'+_0x519889(0x1ac)+'\x20'+_0x3b8e5d+('.\x20Make\x20sur'+_0x4c0fed(0x14c)+'es\x20exactly'+'\x20(includin'+'g\x20whitespa'+_0x519889(0x190)),'error':!![]};const _0x65fb39=_0xcb11fd[_0x519889(0xbb)](_0x32ba30,_0x35eb6c);return _0xec49a7[_0x4c0fed(0x195)+_0x4c0fed(0xc8)](_0x3b8e5d,_0x65fb39),{'name':_0x519889(0x10a),'result':_0x519889(0x18e)+_0x3b8e5d+(_0x519889(0x104)+'d\x20')+_0x32ba30[_0x519889(0xa6)]+('\x20chars\x20wit'+'h\x20')+_0x35eb6c[_0x519889(0xa6)]+'\x20chars'};}catch(_0x3313d4){return{'name':_0x519889(0x10a),'result':_0x4c0fed(0xb7)+_0x519889(0x13c)+(_0x3313d4 instanceof Error?_0x3313d4['message']:_0x3313d4),'error':!![]};}}