Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Merge origin/main into remote-host onboarding rewrite (CHOO-1809)

switch-worker-louis-remote8c5442b7e6bc
diff --cc dash/apps/switchdash-desktop/drizzle/0046_military_whirlwind.sql
index 000000000,000000000..3498d04bf
new file mode 100644
--- /dev/null
+++ b/dash/apps/switchdash-desktop/drizzle/0046_military_whirlwind.sql
@@@ -1,0 -1,0 +1,8 @@@
++CREATE TABLE `remote_host_setup_plans` (
++ `ssh_host` text PRIMARY KEY NOT NULL,
++ `status` text DEFAULT 'idle' NOT NULL,
++ `steps` text NOT NULL,
++ `current_step_id` text,
++ `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
++ `updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
++);
diff --cc dash/apps/switchdash-desktop/drizzle/meta/0046_snapshot.json
index 000000000,000000000..d2b5f6f37
new file mode 100644
--- /dev/null
+++ b/dash/apps/switchdash-desktop/drizzle/meta/0046_snapshot.json
@@@ -1,0 -1,0 +1,891 @@@
++{
++ "version": "6",
++ "dialect": "sqlite",
++ "id": "2e3bb8e5-5808-4f99-a61d-d2d70ff8e2d9",
++ "prevId": "9e33859d-6f5a-4fe3-b926-f902c4cb0863",
++ "tables": {
++ "agents": {
++ "name": "agents",
++ "columns": {
++ "id": {
++ "name": "id",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "location_id": {
++ "name": "location_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "name": {
++ "name": "name",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "provider_id": {
++ "name": "provider_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "switch_agent_id": {
++ "name": "switch_agent_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "api_endpoint": {
++ "name": "api_endpoint",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "server_id": {
++ "name": "server_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "status": {
++ "name": "status",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "auto_approve": {
++ "name": "auto_approve",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": false
++ },
++ "provider_config": {
++ "name": "provider_config",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "created_at": {
++ "name": "created_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {
++ "idx_agents_location_id": {
++ "name": "idx_agents_location_id",
++ "columns": ["location_id"],
++ "isUnique": false
++ },
++ "idx_agents_server_id": {
++ "name": "idx_agents_server_id",
++ "columns": ["server_id"],
++ "isUnique": false
++ }
++ },
++ "foreignKeys": {
++ "agents_location_id_locations_id_fk": {
++ "name": "agents_location_id_locations_id_fk",
++ "tableFrom": "agents",
++ "tableTo": "locations",
++ "columnsFrom": ["location_id"],
++ "columnsTo": ["id"],
++ "onDelete": "no action",
++ "onUpdate": "no action"
++ },
++ "agents_server_id_switch_servers_id_fk": {
++ "name": "agents_server_id_switch_servers_id_fk",
++ "tableFrom": "agents",
++ "tableTo": "switch_servers",
++ "columnsFrom": ["server_id"],
++ "columnsTo": ["id"],
++ "onDelete": "set null",
++ "onUpdate": "no action"
++ }
++ },
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "app_secrets": {
++ "name": "app_secrets",
++ "columns": {
++ "key": {
++ "name": "key",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "secret": {
++ "name": "secret",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ }
++ },
++ "indexes": {
++ "idx_app_secrets_key": {
++ "name": "idx_app_secrets_key",
++ "columns": ["key"],
++ "isUnique": true
++ }
++ },
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "app_settings": {
++ "name": "app_settings",
++ "columns": {
++ "key": {
++ "name": "key",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "value": {
++ "name": "value",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {
++ "idx_app_settings_key": {
++ "name": "idx_app_settings_key",
++ "columns": ["key"],
++ "isUnique": true
++ }
++ },
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "kv": {
++ "name": "kv",
++ "columns": {
++ "key": {
++ "name": "key",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "value": {
++ "name": "value",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {
++ "idx_kv_key": {
++ "name": "idx_kv_key",
++ "columns": ["key"],
++ "isUnique": true
++ }
++ },
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "location_settings": {
++ "name": "location_settings",
++ "columns": {
++ "location_id": {
++ "name": "location_id",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "base_settings_json": {
++ "name": "base_settings_json",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "'{}'"
++ },
++ "shareable_settings_json": {
++ "name": "shareable_settings_json",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "'{}'"
++ },
++ "legacy_config_migrated_at": {
++ "name": "legacy_config_migrated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "created_at": {
++ "name": "created_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {},
++ "foreignKeys": {
++ "location_settings_location_id_locations_id_fk": {
++ "name": "location_settings_location_id_locations_id_fk",
++ "tableFrom": "location_settings",
++ "tableTo": "locations",
++ "columnsFrom": ["location_id"],
++ "columnsTo": ["id"],
++ "onDelete": "cascade",
++ "onUpdate": "no action"
++ }
++ },
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "locations": {
++ "name": "locations",
++ "columns": {
++ "id": {
++ "name": "id",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "name": {
++ "name": "name",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "ssh_host": {
++ "name": "ssh_host",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "''"
++ },
++ "dir": {
++ "name": "dir",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "created_at": {
++ "name": "created_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {
++ "idx_locations_host_dir": {
++ "name": "idx_locations_host_dir",
++ "columns": ["ssh_host", "dir"],
++ "isUnique": true
++ }
++ },
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "messages": {
++ "name": "messages",
++ "columns": {
++ "id": {
++ "name": "id",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "session_id": {
++ "name": "session_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "content": {
++ "name": "content",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "sender": {
++ "name": "sender",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "timestamp": {
++ "name": "timestamp",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "metadata": {
++ "name": "metadata",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ }
++ },
++ "indexes": {
++ "idx_messages_session_id": {
++ "name": "idx_messages_session_id",
++ "columns": ["session_id"],
++ "isUnique": false
++ },
++ "idx_messages_timestamp": {
++ "name": "idx_messages_timestamp",
++ "columns": ["timestamp"],
++ "isUnique": false
++ }
++ },
++ "foreignKeys": {
++ "messages_session_id_sessions_id_fk": {
++ "name": "messages_session_id_sessions_id_fk",
++ "tableFrom": "messages",
++ "tableTo": "sessions",
++ "columnsFrom": ["session_id"],
++ "columnsTo": ["id"],
++ "onDelete": "cascade",
++ "onUpdate": "no action"
++ }
++ },
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "remote_host_reachability": {
++ "name": "remote_host_reachability",
++ "columns": {
++ "ssh_host": {
++ "name": "ssh_host",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "status": {
++ "name": "status",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "'unknown'"
++ },
++ "last_error": {
++ "name": "last_error",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "last_checked_at": {
++ "name": "last_checked_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "last_reachable_at": {
++ "name": "last_reachable_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "consecutive_failures": {
++ "name": "consecutive_failures",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": 0
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {},
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "remote_host_setup_plans": {
++ "name": "remote_host_setup_plans",
++ "columns": {
++ "ssh_host": {
++ "name": "ssh_host",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "status": {
++ "name": "status",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "'idle'"
++ },
++ "steps": {
++ "name": "steps",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "current_step_id": {
++ "name": "current_step_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "created_at": {
++ "name": "created_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {},
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "remote_hosts": {
++ "name": "remote_hosts",
++ "columns": {
++ "ssh_host": {
++ "name": "ssh_host",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "name": {
++ "name": "name",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "created_at": {
++ "name": "created_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {},
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "session_room_connections": {
++ "name": "session_room_connections",
++ "columns": {
++ "session_id": {
++ "name": "session_id",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "room_id": {
++ "name": "room_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "room_name": {
++ "name": "room_name",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "switch_agent_id": {
++ "name": "switch_agent_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {},
++ "foreignKeys": {
++ "session_room_connections_session_id_sessions_id_fk": {
++ "name": "session_room_connections_session_id_sessions_id_fk",
++ "tableFrom": "session_room_connections",
++ "tableTo": "sessions",
++ "columnsFrom": ["session_id"],
++ "columnsTo": ["id"],
++ "onDelete": "cascade",
++ "onUpdate": "no action"
++ }
++ },
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "sessions": {
++ "name": "sessions",
++ "columns": {
++ "id": {
++ "name": "id",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "agent_id": {
++ "name": "agent_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "title": {
++ "name": "title",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "config": {
++ "name": "config",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "shell_id": {
++ "name": "shell_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "'system'"
++ },
++ "status": {
++ "name": "status",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "agent_session_id": {
++ "name": "agent_session_id",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "agent_status": {
++ "name": "agent_status",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "agent_status_seen": {
++ "name": "agent_status_seen",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false,
++ "default": 1
++ },
++ "is_initial_session": {
++ "name": "is_initial_session",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "is_pinned": {
++ "name": "is_pinned",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": 0
++ },
++ "archived_at": {
++ "name": "archived_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "last_interacted_at": {
++ "name": "last_interacted_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "status_changed_at": {
++ "name": "status_changed_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "created_at": {
++ "name": "created_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {
++ "idx_sessions_agent_id": {
++ "name": "idx_sessions_agent_id",
++ "columns": ["agent_id"],
++ "isUnique": false
++ }
++ },
++ "foreignKeys": {
++ "sessions_agent_id_agents_id_fk": {
++ "name": "sessions_agent_id_agents_id_fk",
++ "tableFrom": "sessions",
++ "tableTo": "agents",
++ "columnsFrom": ["agent_id"],
++ "columnsTo": ["id"],
++ "onDelete": "cascade",
++ "onUpdate": "no action"
++ }
++ },
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ },
++ "switch_servers": {
++ "name": "switch_servers",
++ "columns": {
++ "id": {
++ "name": "id",
++ "type": "text",
++ "primaryKey": true,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "name": {
++ "name": "name",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "gateway_url": {
++ "name": "gateway_url",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "api_url": {
++ "name": "api_url",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false
++ },
++ "managed": {
++ "name": "managed",
++ "type": "integer",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": false
++ },
++ "management_kind": {
++ "name": "management_kind",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "ssh_host": {
++ "name": "ssh_host",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": false,
++ "autoincrement": false
++ },
++ "created_at": {
++ "name": "created_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ },
++ "updated_at": {
++ "name": "updated_at",
++ "type": "text",
++ "primaryKey": false,
++ "notNull": true,
++ "autoincrement": false,
++ "default": "CURRENT_TIMESTAMP"
++ }
++ },
++ "indexes": {
++ "idx_switch_servers_gateway_url": {
++ "name": "idx_switch_servers_gateway_url",
++ "columns": ["gateway_url"],
++ "isUnique": true
++ }
++ },
++ "foreignKeys": {},
++ "compositePrimaryKeys": {},
++ "uniqueConstraints": {},
++ "checkConstraints": {}
++ }
++ },
++ "views": {},
++ "enums": {},
++ "_meta": {
++ "schemas": {},
++ "tables": {},
++ "columns": {}
++ },
++ "internal": {
++ "indexes": {}
++ }
++}
diff --cc dash/apps/switchdash-desktop/src/main/db/tests/migrations/0046-remote-host-setup-plans.test.ts
index 99116bcfc,000000000..99116bcfc
mode 100644,000000..100644
--- a/dash/apps/switchdash-desktop/src/main/db/tests/migrations/0046-remote-host-setup-plans.test.ts
+++ b/dash/apps/switchdash-desktop/src/main/db/tests/migrations/0046-remote-host-setup-plans.test.ts
diff --cc dash/apps/switchdash-desktop/vitest.config.ts
index c89c77496,a0cd1e11b..7cbe3a771
--- a/dash/apps/switchdash-desktop/vitest.config.ts
+++ b/dash/apps/switchdash-desktop/vitest.config.ts
@@@ -82,15 -81,21 +82,27 @@@ export default defineConfig(
},
},
{
- // Renderer terminal tests that need a real browser environment
- // (real CSS layout, ResizeObserver, requestAnimationFrame, WebGL).
+ // Renderer tests that need a real browser environment (real CSS
+ // layout, ResizeObserver, requestAnimationFrame, WebGL).
extends: true,
+ // Tailwind runs here for the same reason it runs in the app build:
+ // without it every utility class resolves to nothing, so anything
+ // rendered in these tests is unstyled and no test can say a word about
+ // how it looks. `electron.vite.config.ts` is the app's build and does
+ // not apply to Vitest.
+ plugins: [tailwindcss()],
+ // Crawl the browser tests when deps are first optimized. Without this
+ // their imports are only discovered once the page loads them, so Vite
+ // re-optimizes and reloads mid-run — which vitest reports as flaky and
+ // which, before the tests imported statically, split React in two.
+ // A glob rather than a dependency list: a new import is picked up here,
+ // an inventory would go stale.
+ // `react/jsx-dev-runtime` is named explicitly because the JSX transform
+ // injects it rather than any file importing it, so crawling cannot find it.
+ optimizeDeps: {
+ entries: ['src/renderer/tests/browser/**/*.test.{ts,tsx}'],
+ include: ['react/jsx-dev-runtime'],
+ },
test: {
name: 'browser',
browser: {