Lines 4592-4638javascript
4592 "\u{1F606}": Reactions2.HAHA,
4593 "\u{1F62E}": Reactions2.WOW,
4594 "\u{1F622}": Reactions2.CRY,
4595 "\u{1F620}": Reactions2.ANGRY
4597function resolveReaction(raw) {
4598 return REACTION_MAP[raw.toLowerCase()] ?? raw;
4600async function handleChannelEnable(enable) {
4602 const cfg = safeReadConfig();
4603 const updated = updateZaloClawConfig(cfg, { enabled: enable });
4604 safeWriteConfig(updated);
4605 setTimeout(() => process.kill(process.pid, "SIGUSR1"), 300);
4606 return ok({ success: true, enabled: enable, message: `ZaloClaw channel ${enable ? "enabled" : "disabled"}. Gateway hot-reloading...` });
4608 return ok({ error: true, message: `Failed to ${enable ? "enable" : "disable"} channel: ${String(err)}` });
4611async function handleSelfUpdate() {
4613 const { execSync } = await import("node:child_process");
4614 const pluginDir = nodePath.resolve(nodePath.dirname(new URL(import.meta.url).pathname), "..");
4615 const pull = execSync("git pull origin main 2>&1", { cwd: pluginDir, encoding: "utf-8", timeout: 3e4 });
4616 if (pull.includes("Already up to date")) {
4617 return ok({ updated: false, message: "ZaloClaw is already up to date." });
4619 execSync("npm install --prefer-offline 2>&1", { cwd: pluginDir, encoding: "utf-8", timeout: 12e4 });
4620 execSync("npm run build 2>&1", { cwd: pluginDir, encoding: "utf-8", timeout: 3e4 });
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
dist/index.jsView on unpkg · L4618 4621 setTimeout(() => process.kill(process.pid, "SIGUSR1"), 500);
4622 return ok({ updated: true, message: "ZaloClaw updated. Gateway hot-reloading...", output: pull.trim() });
4624 return ok({ error: true, message: `Self-update failed: ${String(err)}` });
4627async function executeZaloClawTool(_callId, p, _signal) {
4629 return await dispatch(p);
4631 const msg = err instanceof Error ? err.message : String(err);
4632 return ok({ error: true, message: msg });
4635async function dispatch(p) {
4636 const api = async () => getApi();
4638 // ── Messaging ──────────────────────────────────────────────────────────