Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(ui): improve Slack setup wizard with step-by-step guide
cyhhaoba9bb2a253d7
diff --git a/ui/src/components/steps/SlackConfig.tsx b/ui/src/components/steps/SlackConfig.tsxindex 433d23fe7..3d7144e12 100644--- a/ui/src/components/steps/SlackConfig.tsx+++ b/ui/src/components/steps/SlackConfig.tsx@@ -1,5 +1,5 @@-import React, { useMemo, useState } from 'react';-import { Lock, Shield, RefreshCw } from 'lucide-react';+import React, { useEffect, useMemo, useState } from 'react';+import { Lock, Shield, RefreshCw, Copy, ExternalLink, Check, ChevronDown, ChevronUp, Key, Hash, Plus } from 'lucide-react';import { useTranslation } from 'react-i18next';import clsx from 'clsx';import { useApi } from '../../context/ApiContext';@@ -15,15 +15,77 @@ export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }const api = useApi();const [botToken, setBotToken] = useState(data.slack?.bot_token || data.slackBotToken || '');const [appToken, setAppToken] = useState(data.slack?.app_token || data.slackAppToken || '');- const [mode] = useState<'self_host' | 'saas'>(data.mode || 'saas'); // Default to saas if undefined, though Mode step should set it+ const [mode] = useState<'self_host' | 'saas'>(data.mode || 'saas');const [checking, setChecking] = useState(false);const [authResult, setAuthResult] = useState<any>(null);+ const [manifest, setManifest] = useState<string>('');+ const [manifestCompact, setManifestCompact] = useState<string>('');+ const [manifestLoading, setManifestLoading] = useState(false);+ const [copied, setCopied] = useState(false);++ // Collapsible states for each step+ const [expandedSteps, setExpandedSteps] = useState<Record<number, boolean>>({ 1: true, 2: false, 3: false, 4: false });const isValid = useMemo(() => {- if (mode === 'saas') return true; // For now, SaaS assumes valid if we proceed+ if (mode === 'saas') return true;return botToken.startsWith('xoxb-') && appToken.startsWith('xapp-');}, [mode, botToken, appToken]);+ // Load manifest on mount for self-host mode+ useEffect(() => {+ if (mode === 'self_host') {+ loadManifest();+ }+ }, [mode]);++ // Auto-expand next step when token is entered+ useEffect(() => {+ if (botToken.startsWith('xoxb-') && !expandedSteps[3]) {+ setExpandedSteps(prev => ({ ...prev, 2: false, 3: true }));+ }+ }, [botToken]);++ useEffect(() => {+ if (appToken.startsWith('xapp-') && !expandedSteps[4]) {+ setExpandedSteps(prev => ({ ...prev, 3: false, 4: true }));+ }+ }, [appToken]);++ const loadManifest = async () => {+ setManifestLoading(true);+ try {+ const result = await api.slackManifest();+ if (result.ok) {+ if (result.manifest) setManifest(result.manifest);+ if (result.manifest_compact) setManifestCompact(result.manifest_compact);+ }+ } catch (err) {+ console.error('Failed to load manifest:', err);+ } finally {+ setManifestLoading(false);+ }+ };++ const copyManifest = async () => {+ if (!manifest) return;+ try {+ await navigator.clipboard.writeText(manifest);+ setCopied(true);+ setTimeout(() => setCopied(false), 2000);+ } catch (err) {+ console.error('Failed to copy:', err);+ }+ };++ const openSlackCreateApp = () => {+ if (manifestCompact) {+ const url = `https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(manifestCompact)}`;+ window.open(url, '_blank');+ } else {+ window.open('https://api.slack.com/apps?new_app=1', '_blank');+ }+ };+const runAuthTest = async () => {setChecking(true);try {@@ -36,14 +98,39 @@ export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }}};+ const toggleStep = (step: number) => {+ setExpandedSteps(prev => ({ ...prev, [step]: !prev[step] }));+ };++ const StepHeader: React.FC<{ step: number; title: string; icon: React.ReactNode; completed?: boolean }> = ({ step, title, icon, completed }) => (+ <button+ onClick={() => toggleStep(step)}+ className="w-full px-4 py-3 flex items-center justify-between bg-neutral-50 hover:bg-neutral-100 transition-colors"+ >+ <div className="flex items-center gap-3">+ <span className={clsx(+ 'w-7 h-7 rounded-full text-sm font-bold flex items-center justify-center transition-colors',+ completed ? 'bg-success text-white' : 'bg-accent text-white'+ )}>+ {completed ? <Check size={14} /> : step}+ </span>+ <span className="flex items-center gap-2 font-semibold text-text">+ {icon}+ {title}+ </span>+ </div>+ {expandedSteps[step] ? <ChevronUp size={18} className="text-muted" /> : <ChevronDown size={18} className="text-muted" />}+ </button>+ );+return (<div className="flex flex-col h-full max-w-2xl mx-auto">- <h2 className="text-3xl font-display font-bold mb-2 text-text">{t('slackConfig.title')}</h2>- <p className="text-muted mb-8">- {mode === 'saas'- ? t('slackConfig.saasDescription')- : t('slackConfig.selfHostDescription')}- </p>+ <div className="mb-4">+ <h2 className="text-3xl font-display font-bold text-text">{t('slackConfig.title')}</h2>+ <p className="text-muted mt-1">+ {mode === 'saas' ? t('slackConfig.saasDescription') : t('slackConfig.selfHostDescription')}+ </p>+ </div>{mode === 'saas' ? (<div className="flex flex-col items-center justify-center h-64 border-2 border-dashed border-border rounded-xl bg-neutral-50">@@ -54,63 +141,198 @@ export const SlackConfig: React.FC<SlackConfigProps> = ({ data, onNext, onBack }<p className="text-xs text-muted mt-6">{t('slackConfig.afterAuth')}</p></div>) : (- <div className="space-y-6">- <div className="space-y-2">- <label className="text-sm font-medium text-text flex items-center gap-2">- <Shield size={16} className="text-accent" /> {t('slackConfig.botToken')}- </label>- <input- type="password"- value={botToken}- onChange={(e) => setBotToken(e.target.value)}- placeholder="xoxb-..."- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent font-mono transition-colors shadow-sm"+ <div className="space-y-3 overflow-y-auto flex-1 pr-1">+ {/* Step 1: Create Slack App */}+ <div className="bg-panel border border-border rounded-xl overflow-hidden">+ <StepHeader+ step={1}+ title={t('slackConfig.step1Title')}+ icon={<Plus size={16} className="text-accent" />}+ />+ {expandedSteps[1] && (+ <div className="p-4 space-y-4 border-t border-border">+ <p className="text-sm text-muted">{t('slackConfig.step1Description')}</p>++ <div className="flex flex-wrap gap-2">+ <button+ onClick={openSlackCreateApp}+ disabled={!manifestCompact || manifestLoading}+ className="flex items-center gap-2 px-4 py-2 bg-accent text-white rounded-lg hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium shadow-sm"+ >+ <ExternalLink size={16} />+ {t('slackConfig.createSlackApp')}+ </button>+ <button+ onClick={copyManifest}+ disabled={!manifest || manifestLoading}+ className="flex items-center gap-2 px-4 py-2 bg-neutral-100 hover:bg-neutral-200 text-text rounded-lg transition-colors font-medium border border-border"+ >+ {copied ? <Check size={16} /> : <Copy size={16} />}+ {copied ? t('slackConfig.copied') : t('slackConfig.copyManifest')}+ </button>+ </div>++ {manifest && (+ <details className="group">+ <summary className="cursor-pointer text-sm text-accent hover:text-accent/80 flex items-center gap-1">+ <ChevronDown size={14} className="transition-transform group-open:rotate-180" />+ {t('slackConfig.viewManifest')}+ </summary>+ <pre className="mt-2 bg-neutral-900 text-neutral-100 p-3 rounded-lg text-xs overflow-x-auto max-h-40 overflow-y-auto font-mono">+ {manifest}+ </pre>+ </details>+ )}++ {manifestLoading && (+ <div className="flex items-center gap-2 text-sm text-muted">+ <RefreshCw size={14} className="animate-spin" />+ {t('common.loading')}+ </div>+ )}++ <div className="bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800">+ <strong>{t('slackConfig.tip')}:</strong> {t('slackConfig.step1Tip')}+ </div>+ </div>+ )}+ </div>++ {/* Step 2: Get Bot Token */}+ <div className="bg-panel border border-border rounded-xl overflow-hidden">+ <StepHeader+ step={2}+ title={t('slackConfig.step2Title')}+ icon={<Shield size={16} className="text-accent" />}+ completed={botToken.startsWith('xoxb-')}/>- <p className="text-xs text-muted pl-1">{t('slackConfig.botTokenHint')} <code className="bg-neutral-100 px-1 rounded">xoxb-</code></p>+ {expandedSteps[2] && (+ <div className="p-4 space-y-4 border-t border-border">+ <p className="text-sm text-muted">{t('slackConfig.step2Description')}</p>++ <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">+ <li>{t('slackConfig.step2Item1')}</li>+ <li>{t('slackConfig.step2Item2')}</li>+ <li>{t('slackConfig.step2Item3')}</li>+ <li>{t('slackConfig.step2Item4')}</li>+ </ol>++ <div className="space-y-2 pt-2">+ <label className="text-sm font-medium text-text flex items-center gap-2">+ <Key size={16} className="text-accent" /> {t('slackConfig.botToken')}+ </label>+ <input+ type="password"+ value={botToken}+ onChange={(e) => setBotToken(e.target.value)}+ placeholder="xoxb-..."+ className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"+ />+ <p className="text-xs text-muted">{t('slackConfig.botTokenHint')} <code className="bg-neutral-100 px-1.5 py-0.5 rounded text-text">xoxb-</code></p>+ </div>+ </div>+ )}</div>- <div className="space-y-2">- <label className="text-sm font-medium text-text flex items-center gap-2">- <Lock size={16} className="text-accent" /> {t('slackConfig.appToken')}- </label>- <input- type="password"- value={appToken}- onChange={(e) => setAppToken(e.target.value)}- placeholder="xapp-..."- className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent font-mono transition-colors shadow-sm"+ {/* Step 3: Get App Token */}+ <div className="bg-panel border border-border rounded-xl overflow-hidden">+ <StepHeader+ step={3}+ title={t('slackConfig.step3Title')}+ icon={<Lock size={16} className="text-accent" />}+ completed={appToken.startsWith('xapp-')}/>- <p className="text-xs text-muted pl-1">{t('slackConfig.botTokenHint')} <code className="bg-neutral-100 px-1 rounded">xapp-</code></p>+ {expandedSteps[3] && (+ <div className="p-4 space-y-4 border-t border-border">+ <p className="text-sm text-muted">{t('slackConfig.step3Description')}</p>++ <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">+ <li>{t('slackConfig.step3Item1')}</li>+ <li>{t('slackConfig.step3Item2')}</li>+ <li>{t('slackConfig.step3Item3')}</li>+ <li>{t('slackConfig.step3Item4')}</li>+ <li>{t('slackConfig.step3Item5')}</li>+ </ol>++ <div className="space-y-2 pt-2">+ <label className="text-sm font-medium text-text flex items-center gap-2">+ <Key size={16} className="text-accent" /> {t('slackConfig.appToken')}+ </label>+ <input+ type="password"+ value={appToken}+ onChange={(e) => setAppToken(e.target.value)}+ placeholder="xapp-..."+ className="w-full bg-bg border border-border rounded-lg p-3 text-text focus:outline-none focus:border-accent focus:ring-1 focus:ring-accent font-mono transition-colors"+ />+ <p className="text-xs text-muted">{t('slackConfig.appTokenHint')} <code className="bg-neutral-100 px-1.5 py-0.5 rounded text-text">xapp-</code></p>+ </div>++ <div className="bg-yellow-50 border border-yellow-200 rounded-lg p-3 text-sm text-yellow-800">+ <strong>{t('slackConfig.important')}:</strong> {t('slackConfig.step3Warning')}+ </div>+ </div>+ )}</div>- <div className="flex items-center gap-3 pt-2">- <button- onClick={runAuthTest}- className="px-4 py-2 bg-neutral-100 hover:bg-neutral-200 text-text rounded-lg flex items-center gap-2 transition-colors font-medium border border-border"- >- {checking ? <RefreshCw size={16} className="animate-spin" /> : <RefreshCw size={16} />}- {t('slackConfig.validateTokens')}- </button>- {authResult && (- <span className={clsx('flex items-center gap-2 text-sm font-medium px-3 py-1.5 rounded-lg border', authResult.ok ? 'text-success bg-success/10 border-success/20' : 'text-danger bg-danger/10 border-danger/20')}>- {authResult.ok ? (- <>- <Shield size={14} />- <span>{t('slackConfig.tokenValidated')}</span>- </>- ) : (- <>- <Shield size={14} />- <span>{t('slackConfig.authFailed')}: {authResult.error}</span>- </>+ {/* Step 4: Validate & Invite */}+ <div className="bg-panel border border-border rounded-xl overflow-hidden">+ <StepHeader+ step={4}+ title={t('slackConfig.step4Title')}+ icon={<Hash size={16} className="text-accent" />}+ completed={authResult?.ok}+ />+ {expandedSteps[4] && (+ <div className="p-4 space-y-4 border-t border-border">+ <p className="text-sm text-muted">{t('slackConfig.step4Description')}</p>++ <div className="flex items-center gap-3">+ <button+ onClick={runAuthTest}+ disabled={!botToken || !appToken || checking}+ className="px-4 py-2 bg-accent text-white rounded-lg flex items-center gap-2 transition-colors font-medium shadow-sm hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed"+ >+ {checking ? <RefreshCw size={16} className="animate-spin" /> : <Shield size={16} />}+ {t('slackConfig.validateTokens')}+ </button>+ {authResult && (+ <span className={clsx(+ 'flex items-center gap-2 text-sm font-medium px-3 py-1.5 rounded-lg border',+ authResult.ok ? 'text-success bg-success/10 border-success/20' : 'text-danger bg-danger/10 border-danger/20'+ )}>+ {authResult.ok ? (+ <>+ <Check size={14} />+ <span>{t('slackConfig.tokenValidated')}</span>+ </>+ ) : (+ <span>{t('slackConfig.authFailed')}: {authResult.error}</span>+ )}+ </span>+ )}+ </div>++ {authResult?.ok && (+ <div className="space-y-3 pt-2">+ <p className="text-sm font-medium text-text">{t('slackConfig.inviteBotTitle')}</p>+ <ol className="list-decimal list-inside space-y-1.5 text-sm text-muted pl-1">+ <li>{t('slackConfig.step4Item1')}</li>+ <li>{t('slackConfig.step4Item2')}</li>+ <li>{t('slackConfig.step4Item3')}</li>+ </ol>+ <div className="bg-green-50 border border-green-200 rounded-lg p-3 text-sm text-green-800">+ <strong>{t('slackConfig.tip')}:</strong> {t('slackConfig.step4Tip')}+ </div>+ </div>)}- </span>+ </div>)}</div></div>)}- <div className="mt-auto flex justify-between pt-6">+ <div className="mt-auto flex justify-between pt-6 border-t border-border"><buttononClick={onBack}className="px-6 py-2 text-muted hover:text-text font-medium transition-colors"diff --git a/ui/src/context/ApiContext.tsx b/ui/src/context/ApiContext.tsxindex 426b81c01..17ea3a609 100644--- a/ui/src/context/ApiContext.tsx+++ b/ui/src/context/ApiContext.tsx@@ -8,6 +8,7 @@ export type ApiContextType = {detectCli: (binary: string) => Promise<any>;slackAuthTest: (botToken: string) => Promise<any>;slackChannels: (botToken: string) => Promise<any>;+ slackManifest: () => Promise<{ ok: boolean; manifest?: string; manifest_compact?: string; error?: string }>;doctor: () => Promise<any>;opencodeOptions: (cwd: string) => Promise<any>;getLogs: (lines?: number) => Promise<{ logs: LogEntry[]; total: number }>;@@ -55,6 +56,7 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ childrendetectCli: (binary) => getJson(`/cli/detect?binary=${encodeURIComponent(binary)}`),slackAuthTest: (botToken) => postJson('/slack/auth_test', { bot_token: botToken }),slackChannels: (botToken) => postJson('/slack/channels', { bot_token: botToken }),+ slackManifest: () => getJson('/slack/manifest'),doctor: () => postJson('/doctor', {}),opencodeOptions: (cwd) => postJson('/opencode/options', { cwd }),getLogs: (lines = 500) => postJson('/logs', { lines }),diff --git a/vibe/api.py b/vibe/api.pyindex 8572ac47b..6c469103d 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -260,3 +260,48 @@ def _settings_to_payload(store: SettingsStore) -> dict:},}return payload+++def get_slack_manifest() -> dict:+ """Get Slack App Manifest template for self-host mode.++ Loads manifest from vibe/templates/slack_manifest.json.++ Returns:+ {"ok": True, "manifest": str, "manifest_compact": str} on success+ {"ok": False, "error": str} on failure+ """+ import json+ import importlib.resources++ try:+ manifest = None++ # Try to load from package resources (installed via pip/uv)+ try:+ if hasattr(importlib.resources, 'files'):+ package_files = importlib.resources.files('vibe')+ template_path = package_files / 'templates' / 'slack_manifest.json'+ if hasattr(template_path, 'read_text'):+ manifest = json.loads(template_path.read_text(encoding='utf-8'))+ except (TypeError, FileNotFoundError, AttributeError, json.JSONDecodeError):+ pass++ # Fallback: load from file system (development mode)+ if manifest is None:+ this_dir = Path(__file__).parent+ template_file = this_dir / 'templates' / 'slack_manifest.json'+ if template_file.exists():+ manifest = json.loads(template_file.read_text(encoding='utf-8'))++ if manifest is None:+ return {"ok": False, "error": "Manifest template file not found"}++ # Pretty JSON for display, compact JSON for URL+ manifest_pretty = json.dumps(manifest, indent=2)+ manifest_compact = json.dumps(manifest, separators=(',', ':'))+ return {"ok": True, "manifest": manifest_pretty, "manifest_compact": manifest_compact}+ except Exception as exc:+ logger.error("Failed to load Slack manifest: %s", exc)+ return {"ok": False, "error": str(exc)}+diff --git a/vibe/templates/slack_manifest.json b/vibe/templates/slack_manifest.jsonnew file mode 100644index 000000000..4c425e4a7--- /dev/null+++ b/vibe/templates/slack_manifest.json@@ -0,0 +1,65 @@+{+ "_metadata": {+ "major_version": 1,+ "minor_version": 1+ },+ "display_information": {+ "name": "Vibe Remote",+ "description": "AI coding agent runtime for Slack",+ "background_color": "#262626"+ },+ "features": {+ "bot_user": {+ "display_name": "Vibe Remote",+ "always_online": true+ },+ "app_home": {+ "home_tab_enabled": true,+ "messages_tab_enabled": true,+ "messages_tab_read_only_enabled": false+ }+ },+ "oauth_config": {+ "scopes": {+ "bot": [+ "channels:history",+ "channels:read",+ "chat:write",+ "app_mentions:read",+ "users:read",+ "commands",+ "groups:read",+ "groups:history",+ "im:history",+ "im:read",+ "im:write",+ "mpim:history",+ "mpim:read",+ "mpim:write",+ "files:read",+ "files:write",+ "reactions:read",+ "reactions:write"+ ]+ }+ },+ "settings": {+ "event_subscriptions": {+ "bot_events": [+ "message.channels",+ "message.groups",+ "message.im",+ "message.mpim",+ "app_mention",+ "reaction_added",+ "reaction_removed"+ ]+ },+ "interactivity": {+ "is_enabled": true+ },+ "org_deploy_enabled": true,+ "socket_mode_enabled": true,+ "token_rotation_enabled": false+ }+}diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 96537ee27..58c2f1c9d 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -104,6 +104,11 @@ class UiHandler(http.server.BaseHTTPRequestHandler):binary = (query.get("binary") or [""])[0]self._send_json(api.detect_cli(binary))return+ if self.path == "/slack/manifest":+ from vibe import api++ self._send_json(api.get_slack_manifest())+ returnui_dist = get_ui_dist_path()requested_path = self.path.lstrip("/")