From 1dd622449e109e6f37eb122de6883c321f82af7b Mon Sep 17 00:00:00 2001 From: Arjun <6592213+arkml@users.noreply.github.com> Date: Wed, 1 Apr 2026 23:00:43 +0530 Subject: [PATCH] ensure agent-slack is available at startup --- apps/x/apps/main/src/main.ts | 18 +++++++++++++++++- apps/x/packages/core/src/config/security.ts | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/x/apps/main/src/main.ts b/apps/x/apps/main/src/main.ts index d828f38d..a2ed0aa1 100644 --- a/apps/x/apps/main/src/main.ts +++ b/apps/x/apps/main/src/main.ts @@ -24,9 +24,12 @@ import { init as initAgentRunner } from "@x/core/dist/agent-schedule/runner.js"; import { init as initAgentNotes } from "@x/core/dist/knowledge/agent_notes.js"; import { initConfigs } from "@x/core/dist/config/initConfigs.js"; import started from "electron-squirrel-startup"; -import { execSync } from "node:child_process"; +import { execSync, exec } from "node:child_process"; +import { promisify } from "node:util"; import { init as initChromeSync } from "@x/core/dist/knowledge/chrome-extension/server/server.js"; +const execAsync = promisify(exec); + const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); @@ -185,6 +188,19 @@ app.whenReady().then(async () => { }); } + // Ensure agent-slack CLI is available + try { + execSync('agent-slack --version', { stdio: 'ignore', timeout: 5000 }); + } catch { + try { + console.log('agent-slack not found, installing...'); + await execAsync('npm install -g agent-slack', { timeout: 60000 }); + console.log('agent-slack installed successfully'); + } catch (e) { + console.error('Failed to install agent-slack:', e); + } + } + // Initialize all config files before UI can access them await initConfigs(); diff --git a/apps/x/packages/core/src/config/security.ts b/apps/x/packages/core/src/config/security.ts index b081826e..199a6fc6 100644 --- a/apps/x/packages/core/src/config/security.ts +++ b/apps/x/packages/core/src/config/security.ts @@ -6,6 +6,7 @@ import { WorkDir } from "./config.js"; export const SECURITY_CONFIG_PATH = path.join(WorkDir, "config", "security.json"); const DEFAULT_ALLOW_LIST = [ + "agent-slack", "awk", "basename", "cat", @@ -25,6 +26,7 @@ const DEFAULT_ALLOW_LIST = [ "jq", "ls", "printenv", + "printf", "pwd", "readlink", "realpath",