Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

Merge origin/master into feat/slack-resume-ux

yh c1b187b30c1ec
diff --cc modules/im/slack.py
index b99edf75d,1caa14cc5..92c886e71
--- a/modules/im/slack.py
+++ b/modules/im/slack.py
@@@ -851,51 -899,8 +866,52 @@@ class SlackBot(BaseIMClient)
# We need to find the right channel to send the message
# For now, we'll rely on the controller to handle this
+ elif callback_id == "resume_session_modal":
+ user_id = payload.get("user", {}).get("id")
+ values = view.get("state", {}).get("values", {})
+
+ agent_data = values.get("agent_block", {}).get("agent_select", {})
+ agent = agent_data.get("selected_option", {}).get("value")
+
+ manual_data = values.get("manual_block", {}).get("manual_input", {})
+ manual_session = (manual_data.get("value") or "").strip()
+
+ session_data = values.get("session_block", {}).get("session_select", {}) if values else {}
+ selected_option = session_data.get("selected_option") or {}
+ selected_value = selected_option.get("value") if isinstance(selected_option, dict) else None
+ selected_session = None
+ selected_agent = None
+ if selected_value and "|" in selected_value:
+ selected_agent, selected_session = selected_value.split("|", 1)
+
+ # Manual input takes precedence and should respect the manual agent selector.
+ if manual_session:
+ chosen_session = manual_session
+ chosen_agent = agent or selected_agent
+ else:
+ chosen_session = selected_session
+ chosen_agent = selected_agent or agent
+ metadata_raw = view.get("private_metadata")
+ channel_id = None
+ thread_id = None
+ host_message_ts = None
+ try:
+ import json
+
+ md = json.loads(metadata_raw) if metadata_raw else {}
+ channel_id = md.get("channel_id")
+ thread_id = md.get("thread_id")
+ host_message_ts = md.get("host_message_ts")
+ except Exception:
+ pass
+
+ if hasattr(self, "_on_resume_session"):
+ await self._on_resume_session(
+ user_id, channel_id, thread_id, chosen_agent, chosen_session, host_message_ts
+ )
+
- elif callback_id == "opencode_question_modal":
+ elif callback_id == "opencode_question_modal" or callback_id == "claude_question_modal":
+ # Generic question modal handling for both OpenCode and Claude
user_id = payload.get("user", {}).get("id")
values = view.get("state", {}).get("values", {})
metadata_raw = view.get("private_metadata")
@@@ -975,19 -989,45 +996,52 @@@
if oc_reasoning == "__default__":
oc_reasoning = None
+ # Extract require_mention (optional)
+ require_mention_data = values.get("require_mention_block", {}).get("require_mention_select", {})
+ require_mention_value = require_mention_data.get("selected_option", {}).get("value")
+ # Convert to Optional[bool]: "__default__" -> None, "true" -> True, "false" -> False
+ if require_mention_value == "__default__":
+ require_mention = None
+ elif require_mention_value == "true":
+ require_mention = True
+ elif require_mention_value == "false":
+ require_mention = False
+ else:
+ require_mention = None
+
+ # Extract Claude agent (optional)
- claude_agent_data = values.get("claude_agent_block", {}).get(
- "claude_agent_select", {}
- )
++ claude_agent_data = values.get("claude_agent_block", {}).get("claude_agent_select", {})
+ claude_agent = claude_agent_data.get("selected_option", {}).get("value")
+ if claude_agent == "__default__":
+ claude_agent = None
+
+ # Extract Claude model (optional)
- claude_model_data = values.get("claude_model_block", {}).get(
- "claude_model_select", {}
- )
++ claude_model_data = values.get("claude_model_block", {}).get("claude_model_select", {})
+ claude_model = claude_model_data.get("selected_option", {}).get("value")
+ if claude_model == "__default__":
+ claude_model = None
+
+ # Extract Codex model (optional)
- codex_model_data = values.get("codex_model_block", {}).get(
- "codex_model_select", {}
- )
++ codex_model_data = values.get("codex_model_block", {}).get("codex_model_select", {})
+ codex_model = codex_model_data.get("selected_option", {}).get("value")
+ if codex_model == "__default__":
+ codex_model = None
+
+ # Extract Codex reasoning effort (optional)
+ codex_reasoning = None
+ codex_reasoning_block = values.get("codex_reasoning_block", {})
+ if isinstance(codex_reasoning_block, dict):
+ for action_id, action_data in codex_reasoning_block.items():
+ if (
+ isinstance(action_id, str)
+ and action_id.startswith("codex_reasoning_select")
+ and isinstance(action_data, dict)
+ ):
+ codex_reasoning = action_data.get("selected_option", {}).get("value")
+ break
+ if codex_reasoning == "__default__":
+ codex_reasoning = None
+
# Update routing via callback
if hasattr(self, "_on_routing_update"):
await self._on_routing_update(
@@@ -1653,55 -1554,16 +1722,40 @@@
},
]
- # Add require_mention selector
- # Build options: Default (uses global), Require @mention, Don't require @mention
- global_mention_label = "On" if global_require_mention else "Off"
- require_mention_options = [
- {
- "text": {"type": "plain_text", "text": f"(Default) - {global_mention_label}"},
- "value": "__default__",
- },
- {
- "text": {"type": "plain_text", "text": "Require @mention"},
- "value": "true",
- },
- {
- "text": {"type": "plain_text", "text": "Don't require @mention"},
- "value": "false",
- },
- ]
+ # Determine effective backend for showing backend-specific options
+ effective_backend = selected_backend_value or current_backend or "opencode"
+ # Determine initial option
+ initial_require_mention = require_mention_options[0] # Default
+ if current_require_mention is not _UNSET and current_require_mention is not None:
+ target_value = "true" if current_require_mention else "false"
+ for opt in require_mention_options:
+ if opt["value"] == target_value:
+ initial_require_mention = opt
+ break
+
+ require_mention_select = {
+ "type": "static_select",
+ "action_id": "require_mention_select",
+ "placeholder": {"type": "plain_text", "text": "Select @mention behavior"},
+ "options": require_mention_options,
+ "initial_option": initial_require_mention,
+ }
+
+ blocks.append(
+ {
+ "type": "input",
+ "block_id": "require_mention_block",
+ "element": require_mention_select,
+ "label": {"type": "plain_text", "text": "Require @mention to respond"},
+ }
+ )
+
- # OpenCode-specific options (only if opencode is registered)
- if "opencode" in registered_backends:
+ # OpenCode-specific options (only if opencode is selected)
+ if effective_backend == "opencode" and "opencode" in registered_backends:
# Get current opencode settings
if selected_opencode_agent is _UNSET:
- current_oc_agent = (
- current_routing.opencode_agent if current_routing else None
- )
+ current_oc_agent = current_routing.opencode_agent if current_routing else None
else:
current_oc_agent = selected_opencode_agent
@@@ -1950,54 -1819,270 +2004,274 @@@
}
# Add OpenCode section
- blocks.extend([
- {"type": "divider"},
- {
- "type": "section",
- "text": {
- "type": "mrkdwn",
- "text": "*OpenCode Settings*",
+ blocks.extend(
+ [
+ {"type": "divider"},
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
- "text": "*OpenCode Options* (only applies when backend is OpenCode)",
++ "text": "*OpenCode Settings*",
+ },
},
- },
- {
- "type": "input",
- "block_id": "opencode_agent_block",
- "optional": True,
- "dispatch_action": True,
- "element": agent_select,
- "label": {"type": "plain_text", "text": "OpenCode Agent"},
- },
- {
- "type": "input",
- "block_id": "opencode_model_block",
- "optional": True,
- "dispatch_action": True,
- "element": model_select,
- "label": {"type": "plain_text", "text": "Model"},
- },
- {
- "type": "input",
- "block_id": "opencode_reasoning_block",
- "optional": True,
- "element": reasoning_select,
- "label": {"type": "plain_text", "text": "Reasoning Effort (Thinking Mode)"},
- },
- ])
+ {
+ "type": "input",
+ "block_id": "opencode_agent_block",
+ "optional": True,
+ "dispatch_action": True,
+ "element": agent_select,
+ "label": {"type": "plain_text", "text": "OpenCode Agent"},
+ },
+ {
+ "type": "input",
+ "block_id": "opencode_model_block",
+ "optional": True,
+ "dispatch_action": True,
+ "element": model_select,
+ "label": {"type": "plain_text", "text": "Model"},
+ },
+ {
+ "type": "input",
+ "block_id": "opencode_reasoning_block",
+ "optional": True,
+ "element": reasoning_select,
+ "label": {"type": "plain_text", "text": "Reasoning Effort (Thinking Mode)"},
+ },
+ ]
+ )
+ # Claude-specific options (only if claude is selected)
+ if effective_backend == "claude" and "claude" in registered_backends:
+ claude_agents = claude_agents or []
+ claude_models = claude_models or []
+
+ # Get current claude settings
+ if selected_claude_agent is _UNSET:
- current_cl_agent = (
- current_routing.claude_agent if current_routing else None
- )
++ current_cl_agent = current_routing.claude_agent if current_routing else None
+ else:
+ current_cl_agent = selected_claude_agent
+
+ if selected_claude_model is _UNSET:
- current_cl_model = (
- current_routing.claude_model if current_routing else None
- )
++ current_cl_model = current_routing.claude_model if current_routing else None
+ else:
+ current_cl_model = selected_claude_model
+
+ # Build agent options
- cl_agent_options = [
- {"text": {"type": "plain_text", "text": "(Default)"}, "value": "__default__"}
- ]
++ cl_agent_options = [{"text": {"type": "plain_text", "text": "(Default)"}, "value": "__default__"}]
+ for agent in claude_agents:
+ agent_id = agent.get("id", "")
+ agent_name = agent.get("name", agent_id)
+ if agent_id:
- cl_agent_options.append({
- "text": {"type": "plain_text", "text": agent_name[:75]},
- "value": agent_id,
- })
++ cl_agent_options.append(
++ {
++ "text": {"type": "plain_text", "text": agent_name[:75]},
++ "value": agent_id,
++ }
++ )
+
+ # Find initial agent
+ initial_cl_agent = cl_agent_options[0]
+ if current_cl_agent:
+ for opt in cl_agent_options:
+ if opt["value"] == current_cl_agent:
+ initial_cl_agent = opt
+ break
+
+ cl_agent_select = {
+ "type": "static_select",
+ "action_id": "claude_agent_select",
+ "placeholder": {"type": "plain_text", "text": "Select Claude agent"},
+ "options": cl_agent_options,
+ "initial_option": initial_cl_agent,
+ }
+
+ # Build model options
- cl_model_options = [
- {"text": {"type": "plain_text", "text": "(Default)"}, "value": "__default__"}
- ]
++ cl_model_options = [{"text": {"type": "plain_text", "text": "(Default)"}, "value": "__default__"}]
+ for model in claude_models:
+ if model:
- cl_model_options.append({
- "text": {"type": "plain_text", "text": model[:75]},
- "value": model,
- })
++ cl_model_options.append(
++ {
++ "text": {"type": "plain_text", "text": model[:75]},
++ "value": model,
++ }
++ )
+
+ # Add current model if not in list (preserve custom models)
+ if current_cl_model and not any(opt["value"] == current_cl_model for opt in cl_model_options):
- cl_model_options.append({
- "text": {"type": "plain_text", "text": current_cl_model[:75]},
- "value": current_cl_model,
- })
++ cl_model_options.append(
++ {
++ "text": {"type": "plain_text", "text": current_cl_model[:75]},
++ "value": current_cl_model,
++ }
++ )
+
+ # Limit to 100 options
+ if len(cl_model_options) > 100:
+ cl_model_options = cl_model_options[:100]
+
+ # Find initial model
+ initial_cl_model = cl_model_options[0]
+ if current_cl_model:
+ for opt in cl_model_options:
+ if opt["value"] == current_cl_model:
+ initial_cl_model = opt
+ break
+
+ cl_model_select = {
+ "type": "static_select",
+ "action_id": "claude_model_select",
+ "placeholder": {"type": "plain_text", "text": "Select model"},
+ "options": cl_model_options,
+ "initial_option": initial_cl_model,
+ }
+
+ # Add Claude section
- blocks.extend([
- {"type": "divider"},
- {
- "type": "section",
- "text": {
- "type": "mrkdwn",
- "text": "*Claude Settings*",
++ blocks.extend(
++ [
++ {"type": "divider"},
++ {
++ "type": "section",
++ "text": {
++ "type": "mrkdwn",
++ "text": "*Claude Settings*",
++ },
+ },
- },
- {
- "type": "input",
- "block_id": "claude_agent_block",
- "optional": True,
- "element": cl_agent_select,
- "label": {"type": "plain_text", "text": "Claude Agent"},
- },
- {
- "type": "input",
- "block_id": "claude_model_block",
- "optional": True,
- "element": cl_model_select,
- "label": {"type": "plain_text", "text": "Model"},
- },
- ])
++ {
++ "type": "input",
++ "block_id": "claude_agent_block",
++ "optional": True,
++ "element": cl_agent_select,
++ "label": {"type": "plain_text", "text": "Claude Agent"},
++ },
++ {
++ "type": "input",
++ "block_id": "claude_model_block",
++ "optional": True,
++ "element": cl_model_select,
++ "label": {"type": "plain_text", "text": "Model"},
++ },
++ ]
++ )
+
+ # Codex-specific options (only if codex is selected)
+ if effective_backend == "codex" and "codex" in registered_backends:
+ codex_models = codex_models or []
+
+ # Get current codex settings
+ if selected_codex_model is _UNSET:
- current_cx_model = (
- current_routing.codex_model if current_routing else None
- )
++ current_cx_model = current_routing.codex_model if current_routing else None
+ else:
+ current_cx_model = selected_codex_model
+
+ if selected_codex_reasoning is _UNSET:
- current_cx_reasoning = (
- current_routing.codex_reasoning_effort if current_routing else None
- )
++ current_cx_reasoning = current_routing.codex_reasoning_effort if current_routing else None
+ else:
+ current_cx_reasoning = selected_codex_reasoning
+
+ # Build model options
- cx_model_options = [
- {"text": {"type": "plain_text", "text": "(Default)"}, "value": "__default__"}
- ]
++ cx_model_options = [{"text": {"type": "plain_text", "text": "(Default)"}, "value": "__default__"}]
+ for model in codex_models:
+ if model:
- cx_model_options.append({
- "text": {"type": "plain_text", "text": model[:75]},
- "value": model,
- })
++ cx_model_options.append(
++ {
++ "text": {"type": "plain_text", "text": model[:75]},
++ "value": model,
++ }
++ )
+
+ # Add current model if not in list (preserve custom models)
+ if current_cx_model and not any(opt["value"] == current_cx_model for opt in cx_model_options):
- cx_model_options.append({
- "text": {"type": "plain_text", "text": current_cx_model[:75]},
- "value": current_cx_model,
- })
++ cx_model_options.append(
++ {
++ "text": {"type": "plain_text", "text": current_cx_model[:75]},
++ "value": current_cx_model,
++ }
++ )
+
+ # Limit to 100 options
+ if len(cx_model_options) > 100:
+ cx_model_options = cx_model_options[:100]
+
+ # Find initial model
+ initial_cx_model = cx_model_options[0]
+ if current_cx_model:
+ for opt in cx_model_options:
+ if opt["value"] == current_cx_model:
+ initial_cx_model = opt
+ break
+
+ cx_model_select = {
+ "type": "static_select",
+ "action_id": "codex_model_select",
+ "placeholder": {"type": "plain_text", "text": "Select model"},
+ "options": cx_model_options,
+ "initial_option": initial_cx_model,
+ }
+
+ # Build reasoning effort options
+ cx_reasoning_options = [
+ {"text": {"type": "plain_text", "text": "(Default)"}, "value": "__default__"},
+ {"text": {"type": "plain_text", "text": "Low"}, "value": "low"},
+ {"text": {"type": "plain_text", "text": "Medium"}, "value": "medium"},
+ {"text": {"type": "plain_text", "text": "High"}, "value": "high"},
+ ]
+
+ # Find initial reasoning
+ initial_cx_reasoning = cx_reasoning_options[0]
+ if current_cx_reasoning:
+ for opt in cx_reasoning_options:
+ if opt["value"] == current_cx_reasoning:
+ initial_cx_reasoning = opt
+ break
+
+ cx_reasoning_select = {
+ "type": "static_select",
+ "action_id": "codex_reasoning_select",
+ "placeholder": {"type": "plain_text", "text": "Select reasoning effort"},
+ "options": cx_reasoning_options,
+ "initial_option": initial_cx_reasoning,
+ }
+
+ # Add Codex section
- blocks.extend([
- {"type": "divider"},
- {
- "type": "section",
- "text": {
- "type": "mrkdwn",
- "text": "*Codex Settings*",
++ blocks.extend(
++ [
++ {"type": "divider"},
++ {
++ "type": "section",
++ "text": {
++ "type": "mrkdwn",
++ "text": "*Codex Settings*",
++ },
+ },
- },
- {
- "type": "input",
- "block_id": "codex_model_block",
- "optional": True,
- "element": cx_model_select,
- "label": {"type": "plain_text", "text": "Model"},
- },
- {
- "type": "input",
- "block_id": "codex_reasoning_block",
- "optional": True,
- "element": cx_reasoning_select,
- "label": {"type": "plain_text", "text": "Reasoning Effort"},
- },
- ])
++ {
++ "type": "input",
++ "block_id": "codex_model_block",
++ "optional": True,
++ "element": cx_model_select,
++ "label": {"type": "plain_text", "text": "Model"},
++ },
++ {
++ "type": "input",
++ "block_id": "codex_reasoning_block",
++ "optional": True,
++ "element": cx_reasoning_select,
++ "label": {"type": "plain_text", "text": "Reasoning Effort"},
++ },
++ ]
++ )
+
# Add tip
- blocks.append({
- "type": "context",
- "elements": [
- {
- "type": "mrkdwn",
- "text": "_💡 Select (Default) to use the backend's configured defaults._",
- }
- ],
- })
+ blocks.append(
+ {
+ "type": "context",
+ "elements": [
+ {
+ "type": "mrkdwn",
- "text": "_💡 Select (Default) to use OpenCode's configured defaults._",
++ "text": "_💡 Select (Default) to use the backend's configured defaults._",
+ }
+ ],
+ }
+ )
return {
"type": "modal",
diff --cc modules/settings_manager.py
index 32b064e3f,dd5ca0585..248384a51
--- a/modules/settings_manager.py
+++ b/modules/settings_manager.py
@@@ -22,9 -21,20 +21,18 @@@ class ChannelRouting
"""Per-channel agent routing configuration."""
agent_backend: Optional[str] = None # "claude" | "codex" | "opencode" | None
+ # OpenCode settings
opencode_agent: Optional[str] = None # "build" | "plan" | ... | None
opencode_model: Optional[str] = None # "provider/model" | None
- opencode_reasoning_effort: Optional[str] = (
- None # "low" | "medium" | "high" | "xhigh" | None
- )
+ opencode_reasoning_effort: Optional[str] = None # "low" | "medium" | "high" | "xhigh" | None
+ # Claude Code settings
+ claude_agent: Optional[str] = None # subagent name from ~/.claude/agents/
+ claude_model: Optional[str] = None # "claude-sonnet-4" | "claude-opus-4" | ...
+ # Note: Claude Code has no CLI parameter for reasoning effort
+ # Codex settings
+ codex_model: Optional[str] = None # "gpt-5-codex" | "o3" | ...
+ codex_reasoning_effort: Optional[str] = None # "minimal" | "low" | "medium" | "high" | "xhigh"
+ # Note: Codex subagent not supported yet
def to_dict(self) -> dict:
"""Convert to dictionary for JSON serialization"""
@@@ -115,9 -135,15 +127,13 @@@ class SettingsManager
opencode_agent=channel_settings.routing.opencode_agent,
opencode_model=channel_settings.routing.opencode_model,
opencode_reasoning_effort=channel_settings.routing.opencode_reasoning_effort,
+ claude_agent=channel_settings.routing.claude_agent,
+ claude_model=channel_settings.routing.claude_model,
+ codex_model=channel_settings.routing.codex_model,
+ codex_reasoning_effort=channel_settings.routing.codex_reasoning_effort,
)
return UserSettings(
- show_message_types=self._normalize_show_message_types(
- channel_settings.show_message_types
- ),
+ show_message_types=self._normalize_show_message_types(channel_settings.show_message_types),
custom_cwd=channel_settings.custom_cwd,
channel_routing=routing,
enabled=channel_settings.enabled,