Lines 4641-4687javascript
4641 "\u{1F606}": Reactions2.HAHA,
4642 "\u{1F62E}": Reactions2.WOW,
4643 "\u{1F622}": Reactions2.CRY,
4644 "\u{1F620}": Reactions2.ANGRY
4646function resolveReaction(raw) {
4647 return REACTION_MAP[raw.toLowerCase()] ?? raw;
4649async function handleChannelEnable(enable) {
4651 const cfg = safeReadConfig();
4652 const updated = updateZaloClawConfig(cfg, { enabled: enable });
4653 safeWriteConfig(updated);
4654 setTimeout(() => process.kill(process.pid, "SIGUSR1"), 300);
4655 return ok({ success: true, enabled: enable, message: `ZaloClaw channel ${enable ? "enabled" : "disabled"}. Gateway hot-reloading...` });
4657 return ok({ error: true, message: `Failed to ${enable ? "enable" : "disable"} channel: ${String(err)}` });
4660async function handleSelfUpdate() {
4662 const { execSync } = await import("node:child_process");
4663 const pluginDir = nodePath.resolve(nodePath.dirname(new URL(import.meta.url).pathname), "..");
4664 const pull = execSync("git pull origin main 2>&1", { cwd: pluginDir, encoding: "utf-8", timeout: 3e4 });
4665 if (pull.includes("Already up to date")) {
4666 return ok({ updated: false, message: "ZaloClaw is already up to date." });
4668 execSync("npm install --prefer-offline 2>&1", { cwd: pluginDir, encoding: "utf-8", timeout: 12e4 });
4669 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 · L4667 4670 setTimeout(() => process.kill(process.pid, "SIGUSR1"), 500);
4671 return ok({ updated: true, message: "ZaloClaw updated. Gateway hot-reloading...", output: pull.trim() });
4673 return ok({ error: true, message: `Self-update failed: ${String(err)}` });
4676async function executeZaloClawTool(_callId, p, _signal) {
4678 return await dispatch(p);
4680 const msg = err instanceof Error ? err.message : String(err);
4681 return ok({ error: true, message: msg });
4684async function dispatch(p) {
4685 const api = async () => getApi();
4687 // ── Messaging ──────────────────────────────────────────────────────────