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
Merge remote-tracking branch 'origin/master' into vibe/20260518-session-target-plan
cyhe997b4054514
diff --cc core/system_prompt_injection.pyindex a0e60f79e,e3e948cfe..f95199d94--- a/core/system_prompt_injection.py+++ b/core/system_prompt_injection.py@@@ -70,10 -103,10 +103,10 @@@ Rules_SCHEDULED_TASKS_PROMPT = """\- ## 3. Scheduled tasks, watches, and hooks+ ## Scheduled tasks, watches, and hooksUse `vibe task add` for saved work that should run later on a schedule or at one exact time.Use `vibe watch add` for managed background waiters that should keep running until a condition is met and then send a follow-up.-Use `vibe hook send --session-id ... --prompt ...` for one-shot asynchronous sends without saving a task or watch.+Use `vibe agent run --async --session-id ... --message ...` for one-shot asynchronous sends without saving a task or watch.Current conversation targeting:- Current session id: `{default_session_id}`diff --cc storage/alembic/versions/20260523_0004_show_pages.pyindex 000000000,000000000..2f48e8555new file mode 100644--- /dev/null+++ b/storage/alembic/versions/20260523_0004_show_pages.py@@@ -1,0 -1,0 +1,41 @@@++"""show page state++++Revision ID: 20260523_0004++Revises: 20260522_0003++Create Date: 2026-05-22++"""++++from __future__ import annotations++++import sqlalchemy as sa++from alembic import op++++revision = "20260523_0004"++down_revision = "20260522_0003"++branch_labels = None++depends_on = None++++++def _tables() -> set[str]:++ bind = op.get_bind()++ return {row[0] for row in bind.exec_driver_sql("select name from sqlite_master where type = 'table'")}++++++def upgrade() -> None:++ if "show_pages" not in _tables():++ op.create_table(++ "show_pages",++ sa.Column("session_id", sa.String(), primary_key=True),++ sa.Column("visibility", sa.String(), nullable=False),++ sa.Column("share_id", sa.String(), nullable=True),++ sa.Column("offline_at", sa.String(), nullable=True),++ sa.Column("created_at", sa.String(), nullable=False),++ sa.Column("updated_at", sa.String(), nullable=False),++ sa.UniqueConstraint("share_id", name="uq_show_pages_share_id"),++ )++ op.create_index("ix_show_pages_share_id", "show_pages", ["share_id"], if_not_exists=True)++ op.create_index("ix_show_pages_visibility", "show_pages", ["visibility"], if_not_exists=True)++++++def downgrade() -> None:++ op.drop_table("show_pages")diff --cc storage/migrations.pyindex dad59b98a,381f5f274..b32d33ea9--- a/storage/migrations.py+++ b/storage/migrations.py@@@ -19,38 -18,9 +19,38 @@@ INITIAL_TABLES ="agent_sessions","runtime_records",}- HEAD_TABLES = INITIAL_TABLES | {"run_definitions", "agent_runs"}-HEAD_TABLES = INITIAL_TABLES | {"background_tasks", "background_runs", "show_pages"}++HEAD_TABLES = INITIAL_TABLES | {"run_definitions", "agent_runs", "show_pages"}HEAD_REQUIRED_COLUMNS = {- "background_tasks": {"deleted_at"},+ "scope_settings": {"agent_name"},+ "agent_sessions": {"agent_id", "agent_name"},+ "run_definitions": {+ "deleted_at",+ "definition_type",+ "agent_name",+ "session_policy",+ "message",+ "message_payload_json",+ "last_run_id",+ },+ "agent_runs": {+ "definition_id",+ "source_kind",+ "source_actor",+ "parent_run_id",+ "agent_name",+ "agent_id",+ "agent_backend",+ "model",+ "reasoning_effort",+ "session_policy",+ "message",+ "message_payload_json",+ "result_text",+ "result_payload_json",+ "message_ids_json",+ "cancel_requested",+ "cancel_requested_at",+ },}UNRELEASED_OLD_INITIAL_TABLES = ["session_messages",diff --cc storage/models.pyindex e362bdc6b,4ad19d419..41b6df96e--- a/storage/models.py+++ b/storage/models.py@@@ -228,21 -182,29 +228,36 @@@ agent_runs = TableColumn("completed_at", String, nullable=True),Column("updated_at", String, nullable=False),Column("metadata_json", Text, nullable=False),- Index("ix_background_runs_task_created", "task_id", "created_at"),- Index("ix_background_runs_status", "status"),- Index("ix_background_runs_session_created", "session_id", "created_at"),+ Index("ix_agent_runs_definition_created", "definition_id", "created_at"),+ Index("ix_agent_runs_status_created", "status", "created_at"),+ Index("ix_agent_runs_type_status_created", "run_type", "status", "created_at"),+ Index("ix_agent_runs_session_created", "session_id", "created_at"),+ Index("ix_agent_runs_agent_created", "agent_name", "created_at"),)+# Backwards-compatible Python aliases for legacy callers. The physical table+# names are the new domain names.+background_tasks = run_definitions+background_runs = agent_runs++ show_pages = Table(+ "show_pages",+ metadata,+ Column("session_id", String, primary_key=True),+ Column("visibility", String, nullable=False),+ Column("share_id", String, nullable=True),+ Column("offline_at", String, nullable=True),+ Column("created_at", String, nullable=False),+ Column("updated_at", String, nullable=False),+ UniqueConstraint("share_id", name="uq_show_pages_share_id"),+ Index("ix_show_pages_share_id", "share_id"),+ Index("ix_show_pages_visibility", "visibility"),+ )+imported_state_tables = [- agent_runs,- run_definitions,+ show_pages,+ background_runs,+ background_tasks,scope_settings,auth_codes,agent_sessions,diff --cc tests/test_claude_cli_path.pyindex a722ef3f8,789e51c5e..919dc8252--- a/tests/test_claude_cli_path.py+++ b/tests/test_claude_cli_path.py@@@ -236,42 -236,37 +236,73 @@@ def test_session_handler_ensures_agent_assert "--session-key" not in prompt+def test_session_handler_preserves_passed_agent_system_prompt(monkeypatch, tmp_path: Path) -> None:+ captured: dict[str, Any] = {}++ class _PromptSessions(_Sessions):+ @staticmethod+ def ensure_agent_session_id(settings_key, agent_name, base_session_id):+ return "sesk8m4q2p7x"++ class _StubClaudeSDKClient:+ def __init__(self, options):+ captured["options"] = options++ async def connect(self) -> None:+ captured["connected"] = True++ monkeypatch.setattr(session_handler_module, "ClaudeAgentOptions", _StubClaudeAgentOptions)+ monkeypatch.setattr(session_handler_module, "ClaudeSDKClient", _StubClaudeSDKClient)++ controller = _Controller(tmp_path)+ controller.settings_manager.sessions = _PromptSessions()+ handler = SessionHandler(controller)+ context = MessageContext(user_id="U123", channel_id="C123")++ asyncio.run(+ handler.get_or_create_claude_session(+ context,+ agent_system_prompt="Use the release-reviewer Vibe Agent policy.",+ )+ )++ prompt_value = captured["options"].system_prompt+ prompt = prompt_value["append"] if isinstance(prompt_value, dict) else prompt_value+ assert captured["connected"] is True+ assert "Use the release-reviewer Vibe Agent policy." in prompt+++ def test_session_handler_omits_show_pages_prompt_when_disabled(+ monkeypatch, tmp_path: Path+ ) -> None:+ captured: dict[str, Any] = {}++ class _StubClaudeSDKClient:+ def __init__(self, options):+ captured["options"] = options++ async def connect(self) -> None:+ captured["connected"] = True++ monkeypatch.setattr(session_handler_module, "ClaudeAgentOptions", _StubClaudeAgentOptions)+ monkeypatch.setattr(session_handler_module, "ClaudeSDKClient", _StubClaudeSDKClient)++ controller = _Controller(tmp_path)+ controller.config.show_pages_prompt = False+ handler = SessionHandler(controller)+ context = MessageContext(user_id="U123", channel_id="C123")++ _run_session(handler, context)++ prompt_value = captured["options"].system_prompt+ prompt = prompt_value["append"] if isinstance(prompt_value, dict) else prompt_value+ assert captured["connected"] is True+ assert "# Vibe Remote" in prompt+ assert "Current session id: `sesk8m4q2p7x`" in prompt+ assert "## Show Pages" not in prompt+ assert "vibe show path" not in prompt++def test_session_handler_recreates_cached_claude_client_when_prompt_changes(monkeypatch, tmp_path: Path) -> None:diff --cc tests/test_reply_enhancer_platform.pyindex 541f54a22,991bb1111..c5f4e57f4--- a/tests/test_reply_enhancer_platform.py+++ b/tests/test_reply_enhancer_platform.py@@@ -199,9 -218,13 +218,13 @@@ class ReplyEnhancerPlatformTests(unittewith patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):prompt = build_system_prompt_injection(include_quick_replies=True, context=context)- self.assertIn("## 3. Scheduled tasks, watches, and hooks", prompt)+ self.assertIn("## Show Pages", prompt)+ self.assertIn("`vibe show path --session-id sesk8m4q2p7x`", prompt)+ self.assertIn("Make the page work reasonably on mobile", prompt)+ self.assertIn("Excalidraw-style static SVG/PNG diagrams", prompt)+ self.assertIn("## Scheduled tasks, watches, and hooks", prompt)self.assertIn("`vibe task add`", prompt)- self.assertIn("`vibe hook send --session-id ... --prompt ...`", prompt)+ self.assertIn("`vibe agent run --async --session-id ... --message ...`", prompt)self.assertIn("`vibe watch add`", prompt)self.assertIn("Use `vibe task add` for saved work that should run later on a schedule or at one exact time.", prompt)self.assertIn(diff --cc tests/test_sqlite_state_migration.pyindex 34ef3bd9f,f0cc87f65..9e747580e--- a/tests/test_sqlite_state_migration.py+++ b/tests/test_sqlite_state_migration.py@@@ -31,8 -31,8 +31,9 @@@ def test_run_migrations_creates_initialassert "scope_settings" in tablesassert "agent_sessions" in tablesassert "runtime_records" in tables- assert "background_tasks" in tables- assert "background_runs" in tables+ assert "run_definitions" in tables+ assert "agent_runs" in tables++ assert "show_pages" in tablesbackground_columns = {row[1]for row in conn.execute(@@@ -41,7 -41,7 +42,7 @@@}assert "deleted_at" in background_columnsversion = conn.execute("select version_num from alembic_version").fetchone()-- assert version == ("20260522_0003",)++ assert version == ("20260523_0004",)def test_initial_migration_is_schema_snapshot() -> None:@@@ -79,7 -79,7 +80,7 @@@ def test_run_migrations_stamps_existingwith sqlite3.connect(db_path) as conn:version = conn.execute("select version_num from alembic_version").fetchone()-- assert version == ("20260522_0003",)++ assert version == ("20260523_0004",)def test_run_migrations_stamps_existing_initial_schema_with_empty_version_table(tmp_path: Path) -> None:@@@ -99,7 -99,7 +100,7 @@@with sqlite3.connect(db_path) as conn:version = conn.execute("select version_num from alembic_version").fetchone()-- assert version == ("20260522_0003",)++ assert version == ("20260523_0004",)def test_run_migrations_repairs_head_columns_before_stamping_head(tmp_path: Path) -> None:@@@ -138,8 -138,8 +139,8 @@@with sqlite3.connect(db_path) as conn:version = conn.execute("select version_num from alembic_version").fetchone()- background_columns = {row[1] for row in conn.execute("pragma table_info(background_tasks)")}- assert version == ("20260522_0003",)+ background_columns = {row[1] for row in conn.execute("pragma table_info(run_definitions)")}- assert version == ("20260522_0003",)++ assert version == ("20260523_0004",)assert "deleted_at" in background_columnsassert background_tables_ready(db_path) is Truediff --cc vibe/cli.pyindex dfe734752,e1170eba3..d957749a1--- a/vibe/cli.py+++ b/vibe/cli.py@@@ -3887,112 -3103,68 +4137,174 @@@ def build_parser()help="Print a machine-readable result with the output path and capture backend.",)+ agent_parser = subparsers.add_parser(+ "agent",+ help="Manage Vibe Agents",+ description="Create, inspect, import, update, and run Vibe-owned Agent definitions.",+ formatter_class=argparse.RawDescriptionHelpFormatter,+ error_help_command="vibe agent --help",+ )+ agent_subparsers = agent_parser.add_subparsers(+ dest="agent_command",+ metavar="{list,show,create,update,remove,import,run}",+ )+ agent_subparsers.required = True++ agent_list_parser = agent_subparsers.add_parser("list", help="List Vibe Agents")+ agent_list_parser.add_argument("--brief", action="store_true", help="Show compact Agent rows")+ agent_list_parser.add_argument("--backend", choices=("codex", "claude", "opencode"), help="Filter by backend")+ _add_json_noop(agent_list_parser)++ agent_show_parser = agent_subparsers.add_parser("show", help="Show one Vibe Agent")+ agent_show_parser.add_argument("name", help="Agent name")+ _add_json_noop(agent_show_parser)++ agent_create_parser = agent_subparsers.add_parser("create", help="Create a Vibe Agent")+ agent_create_parser.add_argument("name", help="Globally unique Agent name")+ agent_create_parser.add_argument("--backend", required=True, choices=("codex", "claude", "opencode"))+ agent_create_parser.add_argument("--description")+ agent_create_parser.add_argument("--model")+ agent_create_parser.add_argument("--reasoning-effort")+ agent_create_parser.add_argument("--effort", dest="reasoning_effort", help=argparse.SUPPRESS)+ system_prompt_group = agent_create_parser.add_mutually_exclusive_group()+ system_prompt_group.add_argument("--system-prompt")+ system_prompt_group.add_argument("--system-prompt-file")+ agent_create_parser.add_argument("--metadata", help="JSON object stored with the Agent")+ _add_json_noop(agent_create_parser)++ agent_update_parser = agent_subparsers.add_parser("update", help="Update editable Vibe Agent fields")+ agent_update_parser.add_argument("name", help="Agent name. Name and backend are immutable.")+ agent_update_parser.add_argument("--description")+ agent_update_parser.add_argument("--clear-description", action="store_true")+ agent_update_parser.add_argument("--model")+ agent_update_parser.add_argument("--clear-model", action="store_true")+ agent_update_parser.add_argument("--reasoning-effort")+ agent_update_parser.add_argument("--effort", dest="reasoning_effort", help=argparse.SUPPRESS)+ agent_update_parser.add_argument("--clear-reasoning-effort", action="store_true")+ update_prompt_group = agent_update_parser.add_mutually_exclusive_group()+ update_prompt_group.add_argument("--system-prompt")+ update_prompt_group.add_argument("--system-prompt-file")+ update_prompt_group.add_argument("--clear-system-prompt", action="store_true")+ agent_update_parser.add_argument("--metadata", help="Replace metadata with a JSON object")+ _add_json_noop(agent_update_parser)++ agent_remove_parser = agent_subparsers.add_parser("remove", help="Remove a Vibe Agent")+ agent_remove_parser.add_argument("name", help="Agent name")+ _add_json_noop(agent_remove_parser)++ agent_import_parser = agent_subparsers.add_parser("import", help="Import global or file-based Agents")+ import_source_group = agent_import_parser.add_mutually_exclusive_group(required=True)+ import_source_group.add_argument("--file", help="Import one markdown Agent file")+ import_source_group.add_argument("--from", dest="from_source", choices=("claude", "codex", "opencode"))+ agent_import_parser.add_argument("--backend", choices=("codex", "claude", "opencode"), help="Backend for --file imports")+ agent_import_parser.add_argument("--name", help="Import one named global Agent from --from source")+ agent_import_parser.add_argument("--all", action="store_true", help="Import all global Agents from --from source")+ _add_json_noop(agent_import_parser)++ agent_run_parser = agent_subparsers.add_parser(+ "run",+ help="Run a Vibe Agent",+ description="Run a Vibe Agent turn. Use --async to queue it as a background run.",+ formatter_class=argparse.RawDescriptionHelpFormatter,+ error_help_command="vibe agent run --help",+ )+ agent_run_parser.add_argument("--agent", help="Vibe Agent name")+ agent_run_parser.add_argument("--session-id", help="Existing Agent Session ID to continue")+ agent_run_parser.add_argument("--create-session", action="store_true", help="Create a new Vibe Session ID before running")+ agent_run_parser.add_argument("--create-session-per-run", action="store_true", help="Create a new Vibe Session ID for each definition run")+ agent_run_parser.add_argument("--deliver-key", help="Scope ID used as delivery target when creating or sending to a target")+ agent_run_parser.add_argument("--post-to", choices=("thread", "channel"))+ agent_run_parser.add_argument("--async", dest="async_run", action="store_true", help="Queue the run and return immediately")+ agent_run_parser.add_argument("--wait-timeout", type=float, help="Maximum seconds the CLI waits for a synchronous run result")+ agent_message_group = agent_run_parser.add_mutually_exclusive_group(required=True)+ agent_message_group.add_argument("--message")+ agent_message_group.add_argument("--message-file")+ agent_message_group.add_argument("--prompt", help=argparse.SUPPRESS)+ agent_message_group.add_argument("--prompt-file", help=argparse.SUPPRESS)+ _add_json_noop(agent_run_parser)++ runs_parser = subparsers.add_parser(+ "runs",+ help="Inspect and manage Agent run records",+ description="List, inspect, and request cancellation for Agent run records.",+ formatter_class=argparse.RawDescriptionHelpFormatter,+ error_help_command="vibe runs --help",+ )+ runs_subparsers = runs_parser.add_subparsers(dest="runs_command", metavar="{list,show,cancel}")+ runs_subparsers.required = True+ runs_list_parser = runs_subparsers.add_parser("list", help="List Agent runs")+ runs_list_parser.add_argument("--status", help="Filter by run status")+ runs_list_parser.add_argument("--brief", action="store_true", help="Show compact run rows")+ _add_json_noop(runs_list_parser)+ runs_show_parser = runs_subparsers.add_parser("show", help="Show one Agent run")+ runs_show_parser.add_argument("run_id")+ _add_json_noop(runs_show_parser)+ runs_cancel_parser = runs_subparsers.add_parser("cancel", help="Request best-effort cancellation for one run")+ runs_cancel_parser.add_argument("run_id")+ _add_json_noop(runs_cancel_parser)++ show_parser = subparsers.add_parser(+ "show",+ help="Create, inspect, and publish session Show Pages",+ description=(+ "Manage the one visual Show Page attached to an Agent Session. "+ "Use it when an agent needs a web page for diagrams, reports, dashboards, or visual explanations."+ ),+ epilog=_show_examples_text(),+ formatter_class=argparse.RawDescriptionHelpFormatter,+ error_help_command="vibe show --help",+ error_hint="Run one of the show subcommands below. Start with: vibe show path --session-id <session-id>",+ )+ show_subparsers = show_parser.add_subparsers(dest="show_command", metavar="{path,status,update}")+ show_subparsers.required = True++ show_path_parser = show_subparsers.add_parser(+ "path",+ help="Create or resolve this session's Show Page directory",+ description="Create or resolve the local workspace for one session Show Page.",+ epilog=_show_path_examples_text(),+ formatter_class=argparse.RawDescriptionHelpFormatter,+ error_help_command="vibe show path --help",+ error_hint="Pass the current Agent Session ID explicitly.",+ )+ show_path_parser.add_argument("--session-id", required=True, help="Agent Session ID for the Show Page.")+ show_path_parser.add_argument("--json", action="store_true", help="Print machine-readable state.")++ show_status_parser = show_subparsers.add_parser(+ "status",+ help="Show this session's Show Page state",+ description="Inspect one Show Page without creating it.",+ epilog=_show_status_examples_text(),+ formatter_class=argparse.RawDescriptionHelpFormatter,+ error_help_command="vibe show status --help",+ error_hint="Pass the current Agent Session ID explicitly.",+ )+ show_status_parser.add_argument("--session-id", required=True, help="Agent Session ID for the Show Page.")+ show_status_parser.add_argument("--json", action="store_true", help="Print machine-readable state.")++ show_update_parser = show_subparsers.add_parser(+ "update",+ help="Update visibility or rotate the public share link",+ description="Switch a Show Page between private, public, and offline states, or rotate its public share link.",+ epilog=_show_update_examples_text(),+ formatter_class=argparse.RawDescriptionHelpFormatter,+ error_help_command="vibe show update --help",+ error_hint="Pass --visibility private|public|offline or --rotate-share.",+ )+ show_update_parser.add_argument("--session-id", required=True, help="Agent Session ID for the Show Page.")+ show_update_action = show_update_parser.add_mutually_exclusive_group(required=True)+ show_update_action.add_argument(+ "--visibility",+ choices=("private", "public", "offline"),+ help="Set the active Show Page visibility.",+ )+ show_update_action.add_argument(+ "--rotate-share",+ action="store_true",+ help="Revoke the current public URL and create a new one. Allowed only while public.",+ )+ show_update_parser.add_argument("--json", action="store_true", help="Print machine-readable state.")+task_parser = subparsers.add_parser("task",help="Manage scheduled tasks",