Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(tags): 支持桌面、手机和远程任务标签管理 (#4670)

Dash4e67c26f06de
diff --git a/apps/desktop/drizzle/0110_abandoned_scarlet_witch.sql b/apps/desktop/drizzle/0110_abandoned_scarlet_witch.sql
new file mode 100644
index 0000000000..8f480c80a0
--- /dev/null
+++ b/apps/desktop/drizzle/0110_abandoned_scarlet_witch.sql
@@ -0,0 +1,27 @@
+CREATE TABLE `session_task_tags` (
+ `session_id` text NOT NULL,
+ `tag_id` text NOT NULL,
+ PRIMARY KEY(`session_id`, `tag_id`),
+ FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`tag_id`) REFERENCES `task_tags`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE INDEX `session_task_tags_tag_idx` ON `session_task_tags` (`tag_id`);--> statement-breakpoint
+CREATE TABLE `task_tags` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `color` text NOT NULL,
+ `favorite_order` integer,
+ `revision` integer DEFAULT 1 NOT NULL
+);
+--> statement-breakpoint
+CREATE UNIQUE INDEX `task_tags_name_idx` ON `task_tags` (`name`);
+--> statement-breakpoint
+INSERT INTO task_tags(id,name,color,favorite_order) VALUES
+('default:red','Red','red',0),
+('default:orange','Orange','orange',1),
+('default:yellow','Yellow','yellow',2),
+('default:green','Green','green',3),
+('default:blue','Blue','blue',4),
+('default:purple','Purple','purple',5),
+('default:gray','Gray','gray',6);
diff --git a/apps/desktop/drizzle/0111_messy_newton_destine.sql b/apps/desktop/drizzle/0111_messy_newton_destine.sql
new file mode 100644
index 0000000000..f94ae4b246
--- /dev/null
+++ b/apps/desktop/drizzle/0111_messy_newton_destine.sql
@@ -0,0 +1 @@
+ALTER TABLE `task_tags` ADD `sort_order` integer;
\ No newline at end of file
diff --git a/apps/desktop/drizzle/0112_backfill_task_tag_order.sql b/apps/desktop/drizzle/0112_backfill_task_tag_order.sql
new file mode 100644
index 0000000000..b60e406764
--- /dev/null
+++ b/apps/desktop/drizzle/0112_backfill_task_tag_order.sql
@@ -0,0 +1,2 @@
+WITH ranked AS (SELECT id, row_number() OVER (ORDER BY sort_order IS NULL, sort_order, favorite_order IS NULL, favorite_order, name, id) - 1 AS position FROM task_tags)
+UPDATE task_tags SET sort_order = (SELECT position FROM ranked WHERE ranked.id = task_tags.id);
diff --git a/apps/desktop/drizzle/0113_grey_cannonball.sql b/apps/desktop/drizzle/0113_grey_cannonball.sql
new file mode 100644
index 0000000000..13edf92689
--- /dev/null
+++ b/apps/desktop/drizzle/0113_grey_cannonball.sql
@@ -0,0 +1 @@
+ALTER TABLE `task_tags` ADD `name_customized` integer DEFAULT false NOT NULL;
\ No newline at end of file
diff --git a/apps/desktop/drizzle/meta/0110_snapshot.json b/apps/desktop/drizzle/meta/0110_snapshot.json
new file mode 100644
index 0000000000..d3f1cf1982
--- /dev/null
+++ b/apps/desktop/drizzle/meta/0110_snapshot.json
@@ -0,0 +1,5460 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "588751c2-f163-4c2d-bed6-4ee60321b520",
+ "prevId": "ae93ac48-96a0-4978-b017-0c68f2f242a6",
+ "tables": {
+ "account_usage_snapshots": {
+ "name": "account_usage_snapshots",
+ "columns": {
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "agent_input_queue_snapshots": {
+ "name": "agent_input_queue_snapshots",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_input_queue_snapshots_session_id_sessions_id_fk": {
+ "name": "agent_input_queue_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "agent_input_queue_snapshots",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_delegations": {
+ "name": "bot_delegations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "requesting_bot_id": {
+ "name": "requesting_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_bot_id": {
+ "name": "target_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "child_session_id": {
+ "name": "child_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_refs_json": {
+ "name": "context_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "artifact_refs_json": {
+ "name": "artifact_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "permission_snapshot_json": {
+ "name": "permission_snapshot_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "lineage_json": {
+ "name": "lineage_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "target_profile_version": {
+ "name": "target_profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "depth": {
+ "name": "depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'queued'"
+ },
+ "result_summary": {
+ "name": "result_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "output_artifacts_json": {
+ "name": "output_artifacts_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "pending_interaction_json": {
+ "name": "pending_interaction_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "run_sequence": {
+ "name": "run_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completion_delivered_at": {
+ "name": "completion_delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_delegations_requester_status": {
+ "name": "idx_bot_delegations_requester_status",
+ "columns": ["requesting_bot_id", "status"],
+ "isUnique": false
+ },
+ "idx_bot_delegations_target_status": {
+ "name": "idx_bot_delegations_target_status",
+ "columns": ["target_bot_id", "status"],
+ "isUnique": false
+ },
+ "idx_bot_delegations_parent_session": {
+ "name": "idx_bot_delegations_parent_session",
+ "columns": ["parent_session_id"],
+ "isUnique": false
+ },
+ "uniq_bot_delegations_child_session": {
+ "name": "uniq_bot_delegations_child_session",
+ "columns": ["child_session_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "bot_delegations_requesting_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_requesting_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["requesting_bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_target_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_target_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["target_bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_parent_session_id_sessions_id_fk": {
+ "name": "bot_delegations_parent_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "sessions",
+ "columnsFrom": ["parent_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_child_session_id_sessions_id_fk": {
+ "name": "bot_delegations_child_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "sessions",
+ "columnsFrom": ["child_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_message_threads": {
+ "name": "bot_direct_message_threads",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_a_id": {
+ "name": "bot_a_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_b_id": {
+ "name": "bot_b_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "close_reason": {
+ "name": "close_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message_count": {
+ "name": "message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "max_messages": {
+ "name": "max_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "blocked_until": {
+ "name": "blocked_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "closed_at": {
+ "name": "closed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_dm_threads_active_pair": {
+ "name": "uniq_bot_dm_threads_active_pair",
+ "columns": ["bot_a_id", "bot_b_id"],
+ "isUnique": true,
+ "where": "\"bot_direct_message_threads\".\"status\" = 'active'"
+ },
+ "idx_bot_dm_threads_pair_updated": {
+ "name": "idx_bot_dm_threads_pair_updated",
+ "columns": ["bot_a_id", "bot_b_id", "updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_messages": {
+ "name": "bot_direct_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_bot_id": {
+ "name": "sender_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recipient_bot_id": {
+ "name": "recipient_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_session_id": {
+ "name": "sender_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_session_id": {
+ "name": "recipient_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delivery_status": {
+ "name": "delivery_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "sender_name": {
+ "name": "sender_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_name": {
+ "name": "recipient_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bridge_session_id": {
+ "name": "bridge_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_direct_messages_thread_sequence": {
+ "name": "uniq_bot_direct_messages_thread_sequence",
+ "columns": ["thread_id", "sequence"],
+ "isUnique": true
+ },
+ "idx_bot_direct_messages_thread_created": {
+ "name": "idx_bot_direct_messages_thread_created",
+ "columns": ["thread_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk": {
+ "name": "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "bot_direct_message_threads",
+ "columnsFrom": ["thread_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_direct_messages_sender_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_sender_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "sessions",
+ "columnsFrom": ["sender_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "bot_direct_messages_recipient_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_recipient_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "sessions",
+ "columnsFrom": ["recipient_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_lifecycle_events": {
+ "name": "bot_lifecycle_events",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_lifecycle_events_bot_created": {
+ "name": "idx_bot_lifecycle_events_bot_created",
+ "columns": ["bot_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_bot_lifecycle_events_session_created": {
+ "name": "idx_bot_lifecycle_events_session_created",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_lifecycle_events_bot_id_bot_profiles_id_fk": {
+ "name": "bot_lifecycle_events_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_lifecycle_events_session_id_sessions_id_fk": {
+ "name": "bot_lifecycle_events_session_id_sessions_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profile_versions": {
+ "name": "bot_profile_versions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "identity_source": {
+ "name": "identity_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "capabilities_json": {
+ "name": "capabilities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_profile_versions_bot_version": {
+ "name": "uniq_bot_profile_versions_bot_version",
+ "columns": ["bot_id", "version"],
+ "isUnique": true
+ },
+ "idx_bot_profile_versions_bot_created": {
+ "name": "idx_bot_profile_versions_bot_created",
+ "columns": ["bot_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profile_versions_bot_id_bot_profiles_id_fk": {
+ "name": "bot_profile_versions_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_profile_versions",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profiles": {
+ "name": "bot_profiles",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "avatar": {
+ "name": "avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'🤖'"
+ },
+ "avatar_color": {
+ "name": "avatar_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'violet'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "hidden_at": {
+ "name": "hidden_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_reason": {
+ "name": "attention_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_at": {
+ "name": "attention_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "current_version": {
+ "name": "current_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "canonical_session_id": {
+ "name": "canonical_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_profiles_status_updated": {
+ "name": "idx_bot_profiles_status_updated",
+ "columns": ["status", "updated_at"],
+ "isUnique": false
+ },
+ "idx_bot_profiles_canonical_session": {
+ "name": "idx_bot_profiles_canonical_session",
+ "columns": ["canonical_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profiles_canonical_session_id_sessions_id_fk": {
+ "name": "bot_profiles_canonical_session_id_sessions_id_fk",
+ "tableFrom": "bot_profiles",
+ "tableTo": "sessions",
+ "columnsFrom": ["canonical_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_runtime_snapshots": {
+ "name": "bot_runtime_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "memory_scope_key": {
+ "name": "memory_scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "configured_json": {
+ "name": "configured_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "resolved_json": {
+ "name": "resolved_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prepared_at": {
+ "name": "prepared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failure_json": {
+ "name": "failure_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_runtime_snapshots_bot_prepared": {
+ "name": "idx_bot_runtime_snapshots_bot_prepared",
+ "columns": ["bot_id", "prepared_at"],
+ "isUnique": false
+ },
+ "idx_bot_runtime_snapshots_session_prepared": {
+ "name": "idx_bot_runtime_snapshots_session_prepared",
+ "columns": ["session_id", "prepared_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_runtime_snapshots_bot_id_bot_profiles_id_fk": {
+ "name": "bot_runtime_snapshots_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_runtime_snapshots_session_id_sessions_id_fk": {
+ "name": "bot_runtime_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_session_links": {
+ "name": "bot_session_links",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_session_links_session": {
+ "name": "uniq_bot_session_links_session",
+ "columns": ["session_id"],
+ "isUnique": true
+ },
+ "uniq_bot_session_links_canonical_per_bot": {
+ "name": "uniq_bot_session_links_canonical_per_bot",
+ "columns": ["bot_id"],
+ "isUnique": true,
+ "where": "\"bot_session_links\".\"role\" = 'canonical'"
+ },
+ "idx_bot_session_links_bot_role": {
+ "name": "idx_bot_session_links_bot_role",
+ "columns": ["bot_id", "role"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_session_links_bot_id_bot_profiles_id_fk": {
+ "name": "bot_session_links_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_session_links",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_session_links_session_id_sessions_id_fk": {
+ "name": "bot_session_links_session_id_sessions_id_fk",
+ "tableFrom": "bot_session_links",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_mcp_servers": {
+ "name": "custom_mcp_servers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "transport": {
+ "name": "transport",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "headers": {
+ "name": "headers",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_mcp_servers_sort_order": {
+ "name": "idx_custom_mcp_servers_sort_order",
+ "columns": ["sort_order"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_providers": {
+ "name": "custom_providers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "runtimes": {
+ "name": "runtimes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "auth": {
+ "name": "auth",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_providers_sort_order": {
+ "name": "idx_custom_providers_sort_order",
+ "columns": ["sort_order"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_model_usage": {
+ "name": "daily_model_usage",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_read_tokens": {
+ "name": "cache_read_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_create_tokens": {
+ "name": "cache_create_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_model_usage_day_agent_kind_model_cost_currency_pk": {
+ "columns": ["day", "agent_kind", "model", "cost_currency"],
+ "name": "daily_model_usage_day_agent_kind_model_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_spend": {
+ "name": "daily_spend",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_spend_day_cost_currency_pk": {
+ "columns": ["day", "cost_currency"],
+ "name": "daily_spend_day_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "device_link_ownership": {
+ "name": "device_link_ownership",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_pid": {
+ "name": "owner_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_label": {
+ "name": "owner_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_jobs": {
+ "name": "embedding_jobs",
+ "columns": {
+ "rowid": {
+ "name": "rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scheduled_at": {
+ "name": "scheduled_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_embedding_jobs_natural": {
+ "name": "uniq_embedding_jobs_natural",
+ "columns": ["source", "source_id", "chunk_index", "model_id"],
+ "isUnique": true
+ },
+ "idx_embedding_jobs_status_scheduled": {
+ "name": "idx_embedding_jobs_status_scheduled",
+ "columns": ["status", "scheduled_at"],
+ "isUnique": false
+ },
+ "idx_embedding_jobs_source_id": {
+ "name": "idx_embedding_jobs_source_id",
+ "columns": ["source", "source_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_meta": {
+ "name": "embedding_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ghost_cards": {
+ "name": "ghost_cards",
+ "columns": {
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ghost_id": {
+ "name": "ghost_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "html": {
+ "name": "html",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "v": {
+ "name": "v",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "ghost_cards_updated_at_idx": {
+ "name": "ghost_cards_updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_context_cursors": {
+ "name": "hook_group_context_cursors",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_key": {
+ "name": "cursor_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_id": {
+ "name": "cursor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_context_cursors_updated_at_idx": {
+ "name": "hook_group_context_cursors_updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "hook_group_context_cursors_provider_cursor_key_pk": {
+ "columns": ["provider", "cursor_key"],
+ "name": "hook_group_context_cursors_provider_cursor_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_message_stats": {
+ "name": "hook_group_message_stats",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "row_count": {
+ "name": "row_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text_bytes": {
+ "name": "text_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_messages": {
+ "name": "hook_group_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_name": {
+ "name": "chat_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_bot": {
+ "name": "is_bot",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_names": {
+ "name": "file_names",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_messages_msg_idx": {
+ "name": "hook_group_messages_msg_idx",
+ "columns": ["provider", "chat_id", "thread_id", "message_id"],
+ "isUnique": true
+ },
+ "hook_group_messages_window_idx": {
+ "name": "hook_group_messages_window_idx",
+ "columns": ["provider", "chat_id", "thread_id", "id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_bindings": {
+ "name": "im_bindings",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "scope_key": {
+ "name": "scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_at": {
+ "name": "attached_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_via_card_message_id": {
+ "name": "attached_via_card_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_im_bindings_target": {
+ "name": "idx_im_bindings_target",
+ "columns": ["target_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "im_bindings_target_session_id_sessions_id_fk": {
+ "name": "im_bindings_target_session_id_sessions_id_fk",
+ "tableFrom": "im_bindings",
+ "tableTo": "sessions",
+ "columnsFrom": ["target_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "im_bindings_channel_bot_context_id_user_id_scope_key_pk": {
+ "columns": ["channel", "bot_context_id", "user_id", "scope_key"],
+ "name": "im_bindings_channel_bot_context_id_user_id_scope_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_notification_origins": {
+ "name": "im_notification_origins",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "im_notification_origins_channel_bot_context_id_user_id_message_id_pk": {
+ "columns": ["channel", "bot_context_id", "user_id", "message_id"],
+ "name": "im_notification_origins_channel_bot_context_id_user_id_message_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_blobs": {
+ "name": "media_blobs",
+ "columns": {
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ext": {
+ "name": "ext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_cache": {
+ "name": "is_cache",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_access_at": {
+ "name": "last_access_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_invocations": {
+ "name": "media_invocations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "capability": {
+ "name": "capability",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_revision": {
+ "name": "guide_revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_json": {
+ "name": "guide_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "response_json": {
+ "name": "response_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_invocations_owner_created_at_idx": {
+ "name": "media_invocations_owner_created_at_idx",
+ "columns": ["owner", "created_at"],
+ "isUnique": false
+ },
+ "media_invocations_owner_state_idx": {
+ "name": "media_invocations_owner_state_idx",
+ "columns": ["owner", "state"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_refs": {
+ "name": "media_refs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_kind": {
+ "name": "ref_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_id": {
+ "name": "ref_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "origin_session_id": {
+ "name": "origin_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_kind": {
+ "name": "origin_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_id": {
+ "name": "origin_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_refs_hash_idx": {
+ "name": "media_refs_hash_idx",
+ "columns": ["hash"],
+ "isUnique": false
+ },
+ "media_refs_ref_idx": {
+ "name": "media_refs_ref_idx",
+ "columns": ["ref_kind", "ref_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "media_refs_hash_media_blobs_hash_fk": {
+ "name": "media_refs_hash_media_blobs_hash_fk",
+ "tableFrom": "media_refs",
+ "tableTo": "media_blobs",
+ "columnsFrom": ["hash"],
+ "columnsTo": ["hash"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "messages": {
+ "name": "messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_meta": {
+ "name": "agent_meta",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_messages_session_client": {
+ "name": "uniq_messages_session_client",
+ "columns": ["session_id", "client_id"],
+ "isUnique": true
+ },
+ "idx_messages_session_created": {
+ "name": "idx_messages_session_created",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_messages_created_at": {
+ "name": "idx_messages_created_at",
+ "columns": ["created_at", "id"],
+ "isUnique": false
+ },
+ "idx_messages_rewind_at": {
+ "name": "idx_messages_rewind_at",
+ "columns": ["rewind_at"],
+ "isUnique": false
+ },
+ "idx_messages_active_error_tail": {
+ "name": "idx_messages_active_error_tail",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false,
+ "where": "\"messages\".\"role\" = 'error' AND \"messages\".\"rewind_at\" IS NULL"
+ }
+ },
+ "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": {}
+ },
+ "messages_fts_rows": {
+ "name": "messages_fts_rows",
+ "columns": {
+ "fts_rowid": {
+ "name": "fts_rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "messages_fts_rows_message_id_idx": {
+ "name": "messages_fts_rows_message_id_idx",
+ "columns": ["message_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_history": {
+ "name": "migration_history",
+ "columns": {
+ "seq": {
+ "name": "seq",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_meta": {
+ "name": "migration_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_teams": {
+ "name": "orca_teams",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "lead_session_id": {
+ "name": "lead_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_active_team_per_lead": {
+ "name": "uniq_active_team_per_lead",
+ "columns": ["lead_session_id"],
+ "isUnique": true,
+ "where": "\"orca_teams\".\"status\" = 'active'"
+ },
+ "idx_orca_teams_status": {
+ "name": "idx_orca_teams_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_teams_lead_session_id_sessions_id_fk": {
+ "name": "orca_teams_lead_session_id_sessions_id_fk",
+ "tableFrom": "orca_teams",
+ "tableTo": "sessions",
+ "columnsFrom": ["lead_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_worker_creation_reservations": {
+ "name": "orca_worker_creation_reservations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "name": "uniq_orca_worker_creation_reservations_team_label",
+ "columns": ["team_id", "lower(\"label\")"],
+ "isUnique": true
+ },
+ "idx_orca_worker_creation_reservations_expires_at": {
+ "name": "idx_orca_worker_creation_reservations_expires_at",
+ "columns": ["expires_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_worker_creation_reservations_team_id_orca_teams_id_fk": {
+ "name": "orca_worker_creation_reservations_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_worker_creation_reservations",
+ "tableTo": "orca_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_workers": {
+ "name": "orca_workers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'idle'"
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_branch": {
+ "name": "worktree_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'developer'"
+ },
+ "focused": {
+ "name": "focused",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "idle_since": {
+ "name": "idle_since",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_workers_session_id": {
+ "name": "uniq_orca_workers_session_id",
+ "columns": ["session_id"],
+ "isUnique": true
+ },
+ "uniq_orca_workers_team_label": {
+ "name": "uniq_orca_workers_team_label",
+ "columns": ["team_id", "lower(\"label\")"],
+ "isUnique": true
+ },
+ "uniq_orca_workers_focused_per_team": {
+ "name": "uniq_orca_workers_focused_per_team",
+ "columns": ["team_id"],
+ "isUnique": true,
+ "where": "\"orca_workers\".\"focused\" = true"
+ },
+ "idx_orca_workers_team_id": {
+ "name": "idx_orca_workers_team_id",
+ "columns": ["team_id"],
+ "isUnique": false
+ },
+ "idx_orca_workers_status": {
+ "name": "idx_orca_workers_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_workers_team_id_orca_teams_id_fk": {
+ "name": "orca_workers_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_workers",
+ "tableTo": "orca_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "orca_workers_session_id_sessions_id_fk": {
+ "name": "orca_workers_session_id_sessions_id_fk",
+ "tableFrom": "orca_workers",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_aliases": {
+ "name": "project_aliases",
+ "columns": {
+ "project_key": {
+ "name": "project_key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_project_aliases_updated_at": {
+ "name": "idx_project_aliases_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_automation_consents": {
+ "name": "project_automation_consents",
+ "columns": {
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "consented_at": {
+ "name": "consented_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "config_hash": {
+ "name": "config_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "recent_workdirs": {
+ "name": "recent_workdirs",
+ "columns": {
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_recent_workdirs_last_used_at": {
+ "name": "idx_recent_workdirs_last_used_at",
+ "columns": ["last_used_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "right_sidebar_tabs": {
+ "name": "right_sidebar_tabs",
+ "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
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "right_sidebar_tabs_session_idx": {
+ "name": "right_sidebar_tabs_session_idx",
+ "columns": ["session_id", "position"],
+ "isUnique": false
+ },
+ "right_sidebar_tabs_subagents_singleton_idx": {
+ "name": "right_sidebar_tabs_subagents_singleton_idx",
+ "columns": ["session_id"],
+ "isUnique": true,
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'subagents'"
+ },
+ "right_sidebar_tabs_bot_artifacts_singleton_idx": {
+ "name": "right_sidebar_tabs_bot_artifacts_singleton_idx",
+ "columns": ["session_id"],
+ "isUnique": true,
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'bot-artifacts'"
+ }
+ },
+ "foreignKeys": {
+ "right_sidebar_tabs_session_id_sessions_id_fk": {
+ "name": "right_sidebar_tabs_session_id_sessions_id_fk",
+ "tableFrom": "right_sidebar_tabs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_runs": {
+ "name": "schedule_runs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "error_msg": {
+ "name": "error_msg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_usd": {
+ "name": "estimated_value_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_amount": {
+ "name": "estimated_value_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cost_attribution": {
+ "name": "cost_attribution",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'legacy'"
+ },
+ "result_text": {
+ "name": "result_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_result": {
+ "name": "pre_run_hook_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_runs_schedule": {
+ "name": "idx_schedule_runs_schedule",
+ "columns": ["schedule_id", "fired_at"],
+ "isUnique": false
+ },
+ "idx_schedule_runs_running_schedule": {
+ "name": "idx_schedule_runs_running_schedule",
+ "columns": ["schedule_id"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running'"
+ },
+ "idx_schedule_runs_running_heartbeat": {
+ "name": "idx_schedule_runs_running_heartbeat",
+ "columns": ["heartbeat_at"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NOT NULL"
+ },
+ "idx_schedule_runs_running_legacy": {
+ "name": "idx_schedule_runs_running_legacy",
+ "columns": ["fired_at"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NULL"
+ },
+ "idx_schedule_runs_unread_terminal": {
+ "name": "idx_schedule_runs_unread_terminal",
+ "columns": ["schedule_id", "status", "fired_at"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"read_at\" IS NULL AND \"schedule_runs\".\"status\" IN ('success', 'failed', 'aborted', 'interrupted')"
+ },
+ "idx_schedule_runs_session_latest": {
+ "name": "idx_schedule_runs_session_latest",
+ "columns": ["session_id", "fired_at", "id"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"session_id\" IS NOT NULL"
+ }
+ },
+ "foreignKeys": {
+ "schedule_runs_schedule_id_schedules_id_fk": {
+ "name": "schedule_runs_schedule_id_schedules_id_fk",
+ "tableFrom": "schedule_runs",
+ "tableTo": "schedules",
+ "columnsFrom": ["schedule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "schedule_runs_session_id_sessions_id_fk": {
+ "name": "schedule_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_runs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_session_latest_runs": {
+ "name": "schedule_session_latest_runs",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_session_latest_runs_run": {
+ "name": "idx_schedule_session_latest_runs_run",
+ "columns": ["run_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "schedule_session_latest_runs_session_id_sessions_id_fk": {
+ "name": "schedule_session_latest_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "schedule_session_latest_runs_run_id_schedule_runs_id_fk": {
+ "name": "schedule_session_latest_runs_run_id_schedule_runs_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "tableTo": "schedule_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedules": {
+ "name": "schedules",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "job_type": {
+ "name": "job_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'prompt'"
+ },
+ "job_config": {
+ "name": "job_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "execution_mode": {
+ "name": "execution_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'agent'"
+ },
+ "script_config": {
+ "name": "script_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'user'"
+ },
+ "project_config_id": {
+ "name": "project_config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "legacy_session_fallback": {
+ "name": "legacy_session_fallback",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cron'"
+ },
+ "cron_expr": {
+ "name": "cron_expr",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recurring": {
+ "name": "recurring",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "manual": {
+ "name": "manual",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "interval_ms": {
+ "name": "interval_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_agent_kind": {
+ "name": "model_agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "use_worktree": {
+ "name": "use_worktree",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "persistent_session": {
+ "name": "persistent_session",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "silent_when_idle": {
+ "name": "silent_when_idle",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "pre_run_hook_command": {
+ "name": "pre_run_hook_command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_timeout_ms": {
+ "name": "pre_run_hook_timeout_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skip_log_session_id": {
+ "name": "skip_log_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notify_desktop": {
+ "name": "notify_desktop",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "notify_feishu": {
+ "name": "notify_feishu",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "notify_wecom_group": {
+ "name": "notify_wecom_group",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_fired_at": {
+ "name": "last_fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_finished_at": {
+ "name": "last_finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "next_fire_at": {
+ "name": "next_fire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expire_at": {
+ "name": "expire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedules_active_next": {
+ "name": "idx_schedules_active_next",
+ "columns": ["status", "next_fire_at"],
+ "isUnique": false
+ },
+ "idx_schedules_target_session": {
+ "name": "idx_schedules_target_session",
+ "columns": ["target_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "schedules_target_session_id_sessions_id_fk": {
+ "name": "schedules_target_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "tableTo": "sessions",
+ "columnsFrom": ["target_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "schedules_skip_log_session_id_sessions_id_fk": {
+ "name": "schedules_skip_log_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "tableTo": "sessions",
+ "columnsFrom": ["skip_log_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_goals": {
+ "name": "session_goals",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "max_turns": {
+ "name": "max_turns",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "no_progress_limit": {
+ "name": "no_progress_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "turns_used": {
+ "name": "turns_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "no_progress_streak": {
+ "name": "no_progress_streak",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "usage_reset_at": {
+ "name": "usage_reset_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_reason": {
+ "name": "last_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_session_goals_status": {
+ "name": "idx_session_goals_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_goals_session_id_sessions_id_fk": {
+ "name": "session_goals_session_id_sessions_id_fk",
+ "tableFrom": "session_goals",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_pr_refs": {
+ "name": "session_pr_refs",
+ "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
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "repo": {
+ "name": "repo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_session_pr_refs": {
+ "name": "uniq_session_pr_refs",
+ "columns": ["session_id", "owner", "repo", "pr_number"],
+ "isUnique": true
+ },
+ "idx_session_pr_refs_session_last_seen": {
+ "name": "idx_session_pr_refs_session_last_seen",
+ "columns": ["session_id", "last_seen_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_pr_refs_session_id_sessions_id_fk": {
+ "name": "session_pr_refs_session_id_sessions_id_fk",
+ "tableFrom": "session_pr_refs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_task_tags": {
+ "name": "session_task_tags",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "session_task_tags_tag_idx": {
+ "name": "session_task_tags_tag_idx",
+ "columns": ["tag_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_task_tags_session_id_sessions_id_fk": {
+ "name": "session_task_tags_session_id_sessions_id_fk",
+ "tableFrom": "session_task_tags",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "session_task_tags_tag_id_task_tags_id_fk": {
+ "name": "session_task_tags_tag_id_task_tags_id_fk",
+ "tableFrom": "session_task_tags",
+ "tableTo": "task_tags",
+ "columnsFrom": ["tag_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "session_task_tags_session_id_tag_id_pk": {
+ "columns": ["session_id", "tag_id"],
+ "name": "session_task_tags_session_id_tag_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "sessions": {
+ "name": "sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'New Maker'"
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'claude-sonnet-4-6'"
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'high'"
+ },
+ "permission_mode": {
+ "name": "permission_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ask'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_token_usage": {
+ "name": "total_token_usage",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_usd": {
+ "name": "total_cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_amount": {
+ "name": "total_cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_currency": {
+ "name": "total_cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_cost_is_approximate": {
+ "name": "total_cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "context_tokens": {
+ "name": "context_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window": {
+ "name": "context_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window_runtime": {
+ "name": "context_window_runtime",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "plan_mode_enabled": {
+ "name": "plan_mode_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cleared_at": {
+ "name": "cleared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_send_at": {
+ "name": "user_send_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cc'"
+ },
+ "orca_role": {
+ "name": "orca_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "forked_at_message_id": {
+ "name": "forked_at_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'desktop'"
+ },
+ "feishu_open_id": {
+ "name": "feishu_open_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "feishu_bot_app_id": {
+ "name": "feishu_bot_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_bot_context_id": {
+ "name": "im_bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_user_id": {
+ "name": "im_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "used_project_context": {
+ "name": "used_project_context",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "codex_history_has_product_prompt": {
+ "name": "codex_history_has_product_prompt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "codex_plan_json": {
+ "name": "codex_plan_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "extra_dirs": {
+ "name": "extra_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "writable_dirs": {
+ "name": "writable_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "remote_host_id": {
+ "name": "remote_host_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_started_at": {
+ "name": "active_turn_started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_pid": {
+ "name": "active_turn_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_turn_ended_at": {
+ "name": "last_turn_ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview": {
+ "name": "list_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview_role": {
+ "name": "list_preview_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_message_count": {
+ "name": "list_message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_sessions_updated_at": {
+ "name": "idx_sessions_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ },
+ "idx_sessions_user_send_at": {
+ "name": "idx_sessions_user_send_at",
+ "columns": ["user_send_at"],
+ "isUnique": false
+ },
+ "idx_sessions_sdk_session_id": {
+ "name": "idx_sessions_sdk_session_id",
+ "columns": ["sdk_session_id"],
+ "isUnique": false
+ },
+ "idx_sessions_workdir_created": {
+ "name": "idx_sessions_workdir_created",
+ "columns": ["working_dir", "created_at", "id"],
+ "isUnique": false
+ },
+ "idx_sessions_created_at": {
+ "name": "idx_sessions_created_at",
+ "columns": ["created_at", "id"],
+ "isUnique": false
+ },
+ "idx_sessions_workspace_kind": {
+ "name": "idx_sessions_workspace_kind",
+ "columns": ["workspace_kind"],
+ "isUnique": false
+ },
+ "idx_sessions_parent_session_id": {
+ "name": "idx_sessions_parent_session_id",
+ "columns": ["parent_session_id"],
+ "isUnique": false
+ },
+ "idx_sessions_orca_role": {
+ "name": "idx_sessions_orca_role",
+ "columns": ["orca_role"],
+ "isUnique": false
+ },
+ "idx_sessions_worktree_path": {
+ "name": "idx_sessions_worktree_path",
+ "columns": ["worktree_path"],
+ "isUnique": false
+ },
+ "idx_sessions_feishu_lookup": {
+ "name": "idx_sessions_feishu_lookup",
+ "columns": ["source", "feishu_bot_app_id", "feishu_open_id"],
+ "isUnique": false
+ },
+ "idx_sessions_im_lookup": {
+ "name": "idx_sessions_im_lookup",
+ "columns": ["source", "im_bot_context_id", "im_user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "sessions_parent_session_id_sessions_id_fk": {
+ "name": "sessions_parent_session_id_sessions_id_fk",
+ "tableFrom": "sessions",
+ "tableTo": "sessions",
+ "columnsFrom": ["parent_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_exposures": {
+ "name": "skill_usage_exposures",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "raw_line_no": {
+ "name": "raw_line_no",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_name": {
+ "name": "skill_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_path": {
+ "name": "skill_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skill_document_hash": {
+ "name": "skill_document_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "exposure_content_hash": {
+ "name": "exposure_content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "document_hash_source": {
+ "name": "document_hash_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "seen_at": {
+ "name": "seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_call_count": {
+ "name": "tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "repeated_tool_call_count": {
+ "name": "repeated_tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tool_error_count": {
+ "name": "tool_error_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_call_count": {
+ "name": "command_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_failure_count": {
+ "name": "command_failure_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_exposures_skill_document_version": {
+ "name": "idx_skill_usage_exposures_skill_document_version",
+ "columns": ["analyzer_version", "skill_name", "skill_document_hash"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent": {
+ "name": "idx_skill_usage_exposures_skill_recent",
+ "columns": ["skill_name", "analyzer_version", "seen_at"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent_any_version": {
+ "name": "idx_skill_usage_exposures_skill_recent_any_version",
+ "columns": ["skill_name", "seen_at"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_analyzer_recent_source": {
+ "name": "idx_skill_usage_exposures_analyzer_recent_source",
+ "columns": ["analyzer_version", "seen_at", "raw_file_path"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_session": {
+ "name": "idx_skill_usage_exposures_session",
+ "columns": ["session_id"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_raw_file": {
+ "name": "idx_skill_usage_exposures_raw_file",
+ "columns": ["raw_file_path"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk": {
+ "name": "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk",
+ "tableFrom": "skill_usage_exposures",
+ "tableTo": "skill_usage_sources",
+ "columnsFrom": ["raw_file_path"],
+ "columnsTo": ["raw_file_path"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_sources": {
+ "name": "skill_usage_sources",
+ "columns": {
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mtime_ms": {
+ "name": "mtime_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_scanned_at": {
+ "name": "last_scanned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ok'"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_sources_session": {
+ "name": "idx_skill_usage_sources_session",
+ "columns": ["session_id"],
+ "isUnique": false
+ },
+ "idx_skill_usage_sources_sdk_session": {
+ "name": "idx_skill_usage_sources_sdk_session",
+ "columns": ["sdk_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_run_aliases": {
+ "name": "subagent_run_aliases",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_run_aliases_lookup_idx": {
+ "name": "subagent_run_aliases_lookup_idx",
+ "columns": ["session_id", "provider", "alias", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_run_aliases_session_id_sessions_id_fk": {
+ "name": "subagent_run_aliases_session_id_sessions_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "subagent_run_aliases_run_id_subagent_runs_id_fk": {
+ "name": "subagent_run_aliases_run_id_subagent_runs_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "tableTo": "subagent_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "subagent_run_aliases_run_id_alias_pk": {
+ "columns": ["run_id", "alias"],
+ "name": "subagent_run_aliases_run_id_alias_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_runs": {
+ "name": "subagent_runs",
+ "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
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "logical_agent_id": {
+ "name": "logical_agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parent_tool_use_id": {
+ "name": "parent_tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "aliases": {
+ "name": "aliases",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "provider_run_ids": {
+ "name": "provider_run_ids",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'running'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result": {
+ "name": "returned_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_empty": {
+ "name": "returned_result_empty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_truncated": {
+ "name": "returned_result_truncated",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tool_uses": {
+ "name": "tool_uses",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "activity": {
+ "name": "activity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_runs_logical_idx": {
+ "name": "subagent_runs_logical_idx",
+ "columns": ["session_id", "provider", "logical_agent_id"],
+ "isUnique": false
+ },
+ "subagent_runs_session_idx": {
+ "name": "subagent_runs_session_idx",
+ "columns": ["session_id", "rewind_at", "deleted_at", "started_at"],
+ "isUnique": false
+ },
+ "subagent_runs_parent_tool_use_idx": {
+ "name": "subagent_runs_parent_tool_use_idx",
+ "columns": ["session_id", "parent_tool_use_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_runs_session_id_sessions_id_fk": {
+ "name": "subagent_runs_session_id_sessions_id_fk",
+ "tableFrom": "subagent_runs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task_tags": {
+ "name": "task_tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "favorite_order": {
+ "name": "favorite_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "task_tags_name_idx": {
+ "name": "task_tags_name_idx",
+ "columns": ["name"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "vec_table_meta": {
+ "name": "vec_table_meta",
+ "columns": {
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "dim": {
+ "name": "dim",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "registered_at": {
+ "name": "registered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_file_attachments": {
+ "name": "wechat_file_attachments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "abs_path": {
+ "name": "abs_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "original_name": {
+ "name": "original_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'staged'"
+ },
+ "promoted_at": {
+ "name": "promoted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_wechat_file_attachments_task": {
+ "name": "idx_wechat_file_attachments_task",
+ "columns": ["binding_epoch", "task_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": ["binding_epoch"],
+ "columnsTo": ["binding_epoch"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_file_attachments_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_file_attachments_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "wechat_inbox",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_file_attachments_session_id_sessions_id_fk": {
+ "name": "wechat_file_attachments_session_id_sessions_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_inbox": {
+ "name": "wechat_inbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_message_id": {
+ "name": "platform_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_seq": {
+ "name": "platform_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "peer_id": {
+ "name": "peer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_created_at": {
+ "name": "platform_created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "lease_until": {
+ "name": "lease_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "conversation_epoch": {
+ "name": "conversation_epoch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_nonce": {
+ "name": "context_nonce",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_ciphertext": {
+ "name": "context_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_tag": {
+ "name": "context_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_inbox_platform_message": {
+ "name": "uniq_wechat_inbox_platform_message",
+ "columns": ["binding_epoch", "platform_message_id"],
+ "isUnique": true
+ },
+ "idx_wechat_inbox_queue": {
+ "name": "idx_wechat_inbox_queue",
+ "columns": ["binding_epoch", "status", "received_at"],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_lease": {
+ "name": "idx_wechat_inbox_lease",
+ "columns": ["binding_epoch", "lease_until"],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_conversation": {
+ "name": "idx_wechat_inbox_conversation",
+ "columns": ["binding_epoch", "peer_id", "conversation_epoch"],
+ "isUnique": false
+ },
+ "uniq_wechat_inbox_running_session": {
+ "name": "uniq_wechat_inbox_running_session",
+ "columns": ["binding_epoch", "session_id"],
+ "isUnique": true,
+ "where": "\"wechat_inbox\".\"session_id\" IS NOT NULL AND \"wechat_inbox\".\"status\" IN ('dispatching', 'accepted_running', 'waiting_desktop', 'delivery_pending')"
+ }
+ },
+ "foreignKeys": {
+ "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_inbox",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": ["binding_epoch"],
+ "columnsTo": ["binding_epoch"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_inbox_session_id_sessions_id_fk": {
+ "name": "wechat_inbox_session_id_sessions_id_fk",
+ "tableFrom": "wechat_inbox",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_outbox": {
+ "name": "wechat_outbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "media_json": {
+ "name": "media_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_outbox_client_id": {
+ "name": "uniq_wechat_outbox_client_id",
+ "columns": ["binding_epoch", "client_id"],
+ "isUnique": true
+ },
+ "idx_wechat_outbox_delivery": {
+ "name": "idx_wechat_outbox_delivery",
+ "columns": ["binding_epoch", "status", "next_retry_at"],
+ "isUnique": false
+ },
+ "idx_wechat_outbox_task": {
+ "name": "idx_wechat_outbox_task",
+ "columns": ["binding_epoch", "task_id", "chunk_index"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_outbox",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": ["binding_epoch"],
+ "columnsTo": ["binding_epoch"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_outbox_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_outbox_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_outbox",
+ "tableTo": "wechat_inbox",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_sync_state": {
+ "name": "wechat_sync_state",
+ "columns": {
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "sync_cursor": {
+ "name": "sync_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "last_poll_at": {
+ "name": "last_poll_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_sync_active": {
+ "name": "uniq_wechat_sync_active",
+ "columns": ["is_active"],
+ "isUnique": true,
+ "where": "\"wechat_sync_state\".\"is_active\" = 1"
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ },
+ "uniq_orca_workers_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/apps/desktop/drizzle/meta/0111_snapshot.json b/apps/desktop/drizzle/meta/0111_snapshot.json
new file mode 100644
index 0000000000..f0bcddc116
--- /dev/null
+++ b/apps/desktop/drizzle/meta/0111_snapshot.json
@@ -0,0 +1,5467 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "32c19e58-2258-4fc0-a99a-c704caa46de4",
+ "prevId": "588751c2-f163-4c2d-bed6-4ee60321b520",
+ "tables": {
+ "account_usage_snapshots": {
+ "name": "account_usage_snapshots",
+ "columns": {
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "agent_input_queue_snapshots": {
+ "name": "agent_input_queue_snapshots",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_input_queue_snapshots_session_id_sessions_id_fk": {
+ "name": "agent_input_queue_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "agent_input_queue_snapshots",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_delegations": {
+ "name": "bot_delegations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "requesting_bot_id": {
+ "name": "requesting_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_bot_id": {
+ "name": "target_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "child_session_id": {
+ "name": "child_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_refs_json": {
+ "name": "context_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "artifact_refs_json": {
+ "name": "artifact_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "permission_snapshot_json": {
+ "name": "permission_snapshot_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "lineage_json": {
+ "name": "lineage_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "target_profile_version": {
+ "name": "target_profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "depth": {
+ "name": "depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'queued'"
+ },
+ "result_summary": {
+ "name": "result_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "output_artifacts_json": {
+ "name": "output_artifacts_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "pending_interaction_json": {
+ "name": "pending_interaction_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "run_sequence": {
+ "name": "run_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completion_delivered_at": {
+ "name": "completion_delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_delegations_requester_status": {
+ "name": "idx_bot_delegations_requester_status",
+ "columns": ["requesting_bot_id", "status"],
+ "isUnique": false
+ },
+ "idx_bot_delegations_target_status": {
+ "name": "idx_bot_delegations_target_status",
+ "columns": ["target_bot_id", "status"],
+ "isUnique": false
+ },
+ "idx_bot_delegations_parent_session": {
+ "name": "idx_bot_delegations_parent_session",
+ "columns": ["parent_session_id"],
+ "isUnique": false
+ },
+ "uniq_bot_delegations_child_session": {
+ "name": "uniq_bot_delegations_child_session",
+ "columns": ["child_session_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "bot_delegations_requesting_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_requesting_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["requesting_bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_target_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_target_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["target_bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_parent_session_id_sessions_id_fk": {
+ "name": "bot_delegations_parent_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "sessions",
+ "columnsFrom": ["parent_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_child_session_id_sessions_id_fk": {
+ "name": "bot_delegations_child_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "sessions",
+ "columnsFrom": ["child_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_message_threads": {
+ "name": "bot_direct_message_threads",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_a_id": {
+ "name": "bot_a_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_b_id": {
+ "name": "bot_b_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "close_reason": {
+ "name": "close_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message_count": {
+ "name": "message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "max_messages": {
+ "name": "max_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "blocked_until": {
+ "name": "blocked_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "closed_at": {
+ "name": "closed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_dm_threads_active_pair": {
+ "name": "uniq_bot_dm_threads_active_pair",
+ "columns": ["bot_a_id", "bot_b_id"],
+ "isUnique": true,
+ "where": "\"bot_direct_message_threads\".\"status\" = 'active'"
+ },
+ "idx_bot_dm_threads_pair_updated": {
+ "name": "idx_bot_dm_threads_pair_updated",
+ "columns": ["bot_a_id", "bot_b_id", "updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_messages": {
+ "name": "bot_direct_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_bot_id": {
+ "name": "sender_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recipient_bot_id": {
+ "name": "recipient_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_session_id": {
+ "name": "sender_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_session_id": {
+ "name": "recipient_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delivery_status": {
+ "name": "delivery_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "sender_name": {
+ "name": "sender_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_name": {
+ "name": "recipient_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bridge_session_id": {
+ "name": "bridge_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_direct_messages_thread_sequence": {
+ "name": "uniq_bot_direct_messages_thread_sequence",
+ "columns": ["thread_id", "sequence"],
+ "isUnique": true
+ },
+ "idx_bot_direct_messages_thread_created": {
+ "name": "idx_bot_direct_messages_thread_created",
+ "columns": ["thread_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk": {
+ "name": "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "bot_direct_message_threads",
+ "columnsFrom": ["thread_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_direct_messages_sender_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_sender_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "sessions",
+ "columnsFrom": ["sender_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "bot_direct_messages_recipient_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_recipient_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "sessions",
+ "columnsFrom": ["recipient_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_lifecycle_events": {
+ "name": "bot_lifecycle_events",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_lifecycle_events_bot_created": {
+ "name": "idx_bot_lifecycle_events_bot_created",
+ "columns": ["bot_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_bot_lifecycle_events_session_created": {
+ "name": "idx_bot_lifecycle_events_session_created",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_lifecycle_events_bot_id_bot_profiles_id_fk": {
+ "name": "bot_lifecycle_events_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_lifecycle_events_session_id_sessions_id_fk": {
+ "name": "bot_lifecycle_events_session_id_sessions_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profile_versions": {
+ "name": "bot_profile_versions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "identity_source": {
+ "name": "identity_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "capabilities_json": {
+ "name": "capabilities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_profile_versions_bot_version": {
+ "name": "uniq_bot_profile_versions_bot_version",
+ "columns": ["bot_id", "version"],
+ "isUnique": true
+ },
+ "idx_bot_profile_versions_bot_created": {
+ "name": "idx_bot_profile_versions_bot_created",
+ "columns": ["bot_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profile_versions_bot_id_bot_profiles_id_fk": {
+ "name": "bot_profile_versions_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_profile_versions",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profiles": {
+ "name": "bot_profiles",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "avatar": {
+ "name": "avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'🤖'"
+ },
+ "avatar_color": {
+ "name": "avatar_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'violet'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "hidden_at": {
+ "name": "hidden_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_reason": {
+ "name": "attention_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_at": {
+ "name": "attention_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "current_version": {
+ "name": "current_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "canonical_session_id": {
+ "name": "canonical_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_profiles_status_updated": {
+ "name": "idx_bot_profiles_status_updated",
+ "columns": ["status", "updated_at"],
+ "isUnique": false
+ },
+ "idx_bot_profiles_canonical_session": {
+ "name": "idx_bot_profiles_canonical_session",
+ "columns": ["canonical_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profiles_canonical_session_id_sessions_id_fk": {
+ "name": "bot_profiles_canonical_session_id_sessions_id_fk",
+ "tableFrom": "bot_profiles",
+ "tableTo": "sessions",
+ "columnsFrom": ["canonical_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_runtime_snapshots": {
+ "name": "bot_runtime_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "memory_scope_key": {
+ "name": "memory_scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "configured_json": {
+ "name": "configured_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "resolved_json": {
+ "name": "resolved_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prepared_at": {
+ "name": "prepared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failure_json": {
+ "name": "failure_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_runtime_snapshots_bot_prepared": {
+ "name": "idx_bot_runtime_snapshots_bot_prepared",
+ "columns": ["bot_id", "prepared_at"],
+ "isUnique": false
+ },
+ "idx_bot_runtime_snapshots_session_prepared": {
+ "name": "idx_bot_runtime_snapshots_session_prepared",
+ "columns": ["session_id", "prepared_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_runtime_snapshots_bot_id_bot_profiles_id_fk": {
+ "name": "bot_runtime_snapshots_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_runtime_snapshots_session_id_sessions_id_fk": {
+ "name": "bot_runtime_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_session_links": {
+ "name": "bot_session_links",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_session_links_session": {
+ "name": "uniq_bot_session_links_session",
+ "columns": ["session_id"],
+ "isUnique": true
+ },
+ "uniq_bot_session_links_canonical_per_bot": {
+ "name": "uniq_bot_session_links_canonical_per_bot",
+ "columns": ["bot_id"],
+ "isUnique": true,
+ "where": "\"bot_session_links\".\"role\" = 'canonical'"
+ },
+ "idx_bot_session_links_bot_role": {
+ "name": "idx_bot_session_links_bot_role",
+ "columns": ["bot_id", "role"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_session_links_bot_id_bot_profiles_id_fk": {
+ "name": "bot_session_links_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_session_links",
+ "tableTo": "bot_profiles",
+ "columnsFrom": ["bot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_session_links_session_id_sessions_id_fk": {
+ "name": "bot_session_links_session_id_sessions_id_fk",
+ "tableFrom": "bot_session_links",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_mcp_servers": {
+ "name": "custom_mcp_servers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "transport": {
+ "name": "transport",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "headers": {
+ "name": "headers",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_mcp_servers_sort_order": {
+ "name": "idx_custom_mcp_servers_sort_order",
+ "columns": ["sort_order"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_providers": {
+ "name": "custom_providers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "runtimes": {
+ "name": "runtimes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "auth": {
+ "name": "auth",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_providers_sort_order": {
+ "name": "idx_custom_providers_sort_order",
+ "columns": ["sort_order"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_model_usage": {
+ "name": "daily_model_usage",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_read_tokens": {
+ "name": "cache_read_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_create_tokens": {
+ "name": "cache_create_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_model_usage_day_agent_kind_model_cost_currency_pk": {
+ "columns": ["day", "agent_kind", "model", "cost_currency"],
+ "name": "daily_model_usage_day_agent_kind_model_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_spend": {
+ "name": "daily_spend",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_spend_day_cost_currency_pk": {
+ "columns": ["day", "cost_currency"],
+ "name": "daily_spend_day_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "device_link_ownership": {
+ "name": "device_link_ownership",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_pid": {
+ "name": "owner_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_label": {
+ "name": "owner_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_jobs": {
+ "name": "embedding_jobs",
+ "columns": {
+ "rowid": {
+ "name": "rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scheduled_at": {
+ "name": "scheduled_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_embedding_jobs_natural": {
+ "name": "uniq_embedding_jobs_natural",
+ "columns": ["source", "source_id", "chunk_index", "model_id"],
+ "isUnique": true
+ },
+ "idx_embedding_jobs_status_scheduled": {
+ "name": "idx_embedding_jobs_status_scheduled",
+ "columns": ["status", "scheduled_at"],
+ "isUnique": false
+ },
+ "idx_embedding_jobs_source_id": {
+ "name": "idx_embedding_jobs_source_id",
+ "columns": ["source", "source_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_meta": {
+ "name": "embedding_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ghost_cards": {
+ "name": "ghost_cards",
+ "columns": {
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ghost_id": {
+ "name": "ghost_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "html": {
+ "name": "html",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "v": {
+ "name": "v",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "ghost_cards_updated_at_idx": {
+ "name": "ghost_cards_updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_context_cursors": {
+ "name": "hook_group_context_cursors",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_key": {
+ "name": "cursor_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_id": {
+ "name": "cursor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_context_cursors_updated_at_idx": {
+ "name": "hook_group_context_cursors_updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "hook_group_context_cursors_provider_cursor_key_pk": {
+ "columns": ["provider", "cursor_key"],
+ "name": "hook_group_context_cursors_provider_cursor_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_message_stats": {
+ "name": "hook_group_message_stats",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "row_count": {
+ "name": "row_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text_bytes": {
+ "name": "text_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_messages": {
+ "name": "hook_group_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_name": {
+ "name": "chat_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_bot": {
+ "name": "is_bot",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_names": {
+ "name": "file_names",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_messages_msg_idx": {
+ "name": "hook_group_messages_msg_idx",
+ "columns": ["provider", "chat_id", "thread_id", "message_id"],
+ "isUnique": true
+ },
+ "hook_group_messages_window_idx": {
+ "name": "hook_group_messages_window_idx",
+ "columns": ["provider", "chat_id", "thread_id", "id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_bindings": {
+ "name": "im_bindings",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "scope_key": {
+ "name": "scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_at": {
+ "name": "attached_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_via_card_message_id": {
+ "name": "attached_via_card_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_im_bindings_target": {
+ "name": "idx_im_bindings_target",
+ "columns": ["target_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "im_bindings_target_session_id_sessions_id_fk": {
+ "name": "im_bindings_target_session_id_sessions_id_fk",
+ "tableFrom": "im_bindings",
+ "tableTo": "sessions",
+ "columnsFrom": ["target_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "im_bindings_channel_bot_context_id_user_id_scope_key_pk": {
+ "columns": ["channel", "bot_context_id", "user_id", "scope_key"],
+ "name": "im_bindings_channel_bot_context_id_user_id_scope_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_notification_origins": {
+ "name": "im_notification_origins",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "im_notification_origins_channel_bot_context_id_user_id_message_id_pk": {
+ "columns": ["channel", "bot_context_id", "user_id", "message_id"],
+ "name": "im_notification_origins_channel_bot_context_id_user_id_message_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_blobs": {
+ "name": "media_blobs",
+ "columns": {
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ext": {
+ "name": "ext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_cache": {
+ "name": "is_cache",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_access_at": {
+ "name": "last_access_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_invocations": {
+ "name": "media_invocations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "capability": {
+ "name": "capability",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_revision": {
+ "name": "guide_revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_json": {
+ "name": "guide_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "response_json": {
+ "name": "response_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_invocations_owner_created_at_idx": {
+ "name": "media_invocations_owner_created_at_idx",
+ "columns": ["owner", "created_at"],
+ "isUnique": false
+ },
+ "media_invocations_owner_state_idx": {
+ "name": "media_invocations_owner_state_idx",
+ "columns": ["owner", "state"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_refs": {
+ "name": "media_refs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_kind": {
+ "name": "ref_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_id": {
+ "name": "ref_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "origin_session_id": {
+ "name": "origin_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_kind": {
+ "name": "origin_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_id": {
+ "name": "origin_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_refs_hash_idx": {
+ "name": "media_refs_hash_idx",
+ "columns": ["hash"],
+ "isUnique": false
+ },
+ "media_refs_ref_idx": {
+ "name": "media_refs_ref_idx",
+ "columns": ["ref_kind", "ref_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "media_refs_hash_media_blobs_hash_fk": {
+ "name": "media_refs_hash_media_blobs_hash_fk",
+ "tableFrom": "media_refs",
+ "tableTo": "media_blobs",
+ "columnsFrom": ["hash"],
+ "columnsTo": ["hash"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "messages": {
+ "name": "messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_meta": {
+ "name": "agent_meta",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_messages_session_client": {
+ "name": "uniq_messages_session_client",
+ "columns": ["session_id", "client_id"],
+ "isUnique": true
+ },
+ "idx_messages_session_created": {
+ "name": "idx_messages_session_created",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_messages_created_at": {
+ "name": "idx_messages_created_at",
+ "columns": ["created_at", "id"],
+ "isUnique": false
+ },
+ "idx_messages_rewind_at": {
+ "name": "idx_messages_rewind_at",
+ "columns": ["rewind_at"],
+ "isUnique": false
+ },
+ "idx_messages_active_error_tail": {
+ "name": "idx_messages_active_error_tail",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false,
+ "where": "\"messages\".\"role\" = 'error' AND \"messages\".\"rewind_at\" IS NULL"
+ }
+ },
+ "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": {}
+ },
+ "messages_fts_rows": {
+ "name": "messages_fts_rows",
+ "columns": {
+ "fts_rowid": {
+ "name": "fts_rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "messages_fts_rows_message_id_idx": {
+ "name": "messages_fts_rows_message_id_idx",
+ "columns": ["message_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_history": {
+ "name": "migration_history",
+ "columns": {
+ "seq": {
+ "name": "seq",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_meta": {
+ "name": "migration_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_teams": {
+ "name": "orca_teams",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "lead_session_id": {
+ "name": "lead_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_active_team_per_lead": {
+ "name": "uniq_active_team_per_lead",
+ "columns": ["lead_session_id"],
+ "isUnique": true,
+ "where": "\"orca_teams\".\"status\" = 'active'"
+ },
+ "idx_orca_teams_status": {
+ "name": "idx_orca_teams_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_teams_lead_session_id_sessions_id_fk": {
+ "name": "orca_teams_lead_session_id_sessions_id_fk",
+ "tableFrom": "orca_teams",
+ "tableTo": "sessions",
+ "columnsFrom": ["lead_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_worker_creation_reservations": {
+ "name": "orca_worker_creation_reservations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "name": "uniq_orca_worker_creation_reservations_team_label",
+ "columns": ["team_id", "lower(\"label\")"],
+ "isUnique": true
+ },
+ "idx_orca_worker_creation_reservations_expires_at": {
+ "name": "idx_orca_worker_creation_reservations_expires_at",
+ "columns": ["expires_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_worker_creation_reservations_team_id_orca_teams_id_fk": {
+ "name": "orca_worker_creation_reservations_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_worker_creation_reservations",
+ "tableTo": "orca_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_workers": {
+ "name": "orca_workers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'idle'"
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_branch": {
+ "name": "worktree_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'developer'"
+ },
+ "focused": {
+ "name": "focused",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "idle_since": {
+ "name": "idle_since",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_workers_session_id": {
+ "name": "uniq_orca_workers_session_id",
+ "columns": ["session_id"],
+ "isUnique": true
+ },
+ "uniq_orca_workers_team_label": {
+ "name": "uniq_orca_workers_team_label",
+ "columns": ["team_id", "lower(\"label\")"],
+ "isUnique": true
+ },
+ "uniq_orca_workers_focused_per_team": {
+ "name": "uniq_orca_workers_focused_per_team",
+ "columns": ["team_id"],
+ "isUnique": true,
+ "where": "\"orca_workers\".\"focused\" = true"
+ },
+ "idx_orca_workers_team_id": {
+ "name": "idx_orca_workers_team_id",
+ "columns": ["team_id"],
+ "isUnique": false
+ },
+ "idx_orca_workers_status": {
+ "name": "idx_orca_workers_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_workers_team_id_orca_teams_id_fk": {
+ "name": "orca_workers_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_workers",
+ "tableTo": "orca_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "orca_workers_session_id_sessions_id_fk": {
+ "name": "orca_workers_session_id_sessions_id_fk",
+ "tableFrom": "orca_workers",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_aliases": {
+ "name": "project_aliases",
+ "columns": {
+ "project_key": {
+ "name": "project_key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_project_aliases_updated_at": {
+ "name": "idx_project_aliases_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_automation_consents": {
+ "name": "project_automation_consents",
+ "columns": {
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "consented_at": {
+ "name": "consented_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "config_hash": {
+ "name": "config_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "recent_workdirs": {
+ "name": "recent_workdirs",
+ "columns": {
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_recent_workdirs_last_used_at": {
+ "name": "idx_recent_workdirs_last_used_at",
+ "columns": ["last_used_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "right_sidebar_tabs": {
+ "name": "right_sidebar_tabs",
+ "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
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "right_sidebar_tabs_session_idx": {
+ "name": "right_sidebar_tabs_session_idx",
+ "columns": ["session_id", "position"],
+ "isUnique": false
+ },
+ "right_sidebar_tabs_subagents_singleton_idx": {
+ "name": "right_sidebar_tabs_subagents_singleton_idx",
+ "columns": ["session_id"],
+ "isUnique": true,
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'subagents'"
+ },
+ "right_sidebar_tabs_bot_artifacts_singleton_idx": {
+ "name": "right_sidebar_tabs_bot_artifacts_singleton_idx",
+ "columns": ["session_id"],
+ "isUnique": true,
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'bot-artifacts'"
+ }
+ },
+ "foreignKeys": {
+ "right_sidebar_tabs_session_id_sessions_id_fk": {
+ "name": "right_sidebar_tabs_session_id_sessions_id_fk",
+ "tableFrom": "right_sidebar_tabs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_runs": {
+ "name": "schedule_runs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "error_msg": {
+ "name": "error_msg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_usd": {
+ "name": "estimated_value_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_amount": {
+ "name": "estimated_value_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cost_attribution": {
+ "name": "cost_attribution",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'legacy'"
+ },
+ "result_text": {
+ "name": "result_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_result": {
+ "name": "pre_run_hook_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_runs_schedule": {
+ "name": "idx_schedule_runs_schedule",
+ "columns": ["schedule_id", "fired_at"],
+ "isUnique": false
+ },
+ "idx_schedule_runs_running_schedule": {
+ "name": "idx_schedule_runs_running_schedule",
+ "columns": ["schedule_id"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running'"
+ },
+ "idx_schedule_runs_running_heartbeat": {
+ "name": "idx_schedule_runs_running_heartbeat",
+ "columns": ["heartbeat_at"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NOT NULL"
+ },
+ "idx_schedule_runs_running_legacy": {
+ "name": "idx_schedule_runs_running_legacy",
+ "columns": ["fired_at"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NULL"
+ },
+ "idx_schedule_runs_unread_terminal": {
+ "name": "idx_schedule_runs_unread_terminal",
+ "columns": ["schedule_id", "status", "fired_at"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"read_at\" IS NULL AND \"schedule_runs\".\"status\" IN ('success', 'failed', 'aborted', 'interrupted')"
+ },
+ "idx_schedule_runs_session_latest": {
+ "name": "idx_schedule_runs_session_latest",
+ "columns": ["session_id", "fired_at", "id"],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"session_id\" IS NOT NULL"
+ }
+ },
+ "foreignKeys": {
+ "schedule_runs_schedule_id_schedules_id_fk": {
+ "name": "schedule_runs_schedule_id_schedules_id_fk",
+ "tableFrom": "schedule_runs",
+ "tableTo": "schedules",
+ "columnsFrom": ["schedule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "schedule_runs_session_id_sessions_id_fk": {
+ "name": "schedule_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_runs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_session_latest_runs": {
+ "name": "schedule_session_latest_runs",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_session_latest_runs_run": {
+ "name": "idx_schedule_session_latest_runs_run",
+ "columns": ["run_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "schedule_session_latest_runs_session_id_sessions_id_fk": {
+ "name": "schedule_session_latest_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "schedule_session_latest_runs_run_id_schedule_runs_id_fk": {
+ "name": "schedule_session_latest_runs_run_id_schedule_runs_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "tableTo": "schedule_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedules": {
+ "name": "schedules",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "job_type": {
+ "name": "job_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'prompt'"
+ },
+ "job_config": {
+ "name": "job_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "execution_mode": {
+ "name": "execution_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'agent'"
+ },
+ "script_config": {
+ "name": "script_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'user'"
+ },
+ "project_config_id": {
+ "name": "project_config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "legacy_session_fallback": {
+ "name": "legacy_session_fallback",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cron'"
+ },
+ "cron_expr": {
+ "name": "cron_expr",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recurring": {
+ "name": "recurring",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "manual": {
+ "name": "manual",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "interval_ms": {
+ "name": "interval_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_agent_kind": {
+ "name": "model_agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "use_worktree": {
+ "name": "use_worktree",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "persistent_session": {
+ "name": "persistent_session",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "silent_when_idle": {
+ "name": "silent_when_idle",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "pre_run_hook_command": {
+ "name": "pre_run_hook_command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_timeout_ms": {
+ "name": "pre_run_hook_timeout_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skip_log_session_id": {
+ "name": "skip_log_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notify_desktop": {
+ "name": "notify_desktop",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "notify_feishu": {
+ "name": "notify_feishu",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "notify_wecom_group": {
+ "name": "notify_wecom_group",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_fired_at": {
+ "name": "last_fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_finished_at": {
+ "name": "last_finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "next_fire_at": {
+ "name": "next_fire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expire_at": {
+ "name": "expire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedules_active_next": {
+ "name": "idx_schedules_active_next",
+ "columns": ["status", "next_fire_at"],
+ "isUnique": false
+ },
+ "idx_schedules_target_session": {
+ "name": "idx_schedules_target_session",
+ "columns": ["target_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "schedules_target_session_id_sessions_id_fk": {
+ "name": "schedules_target_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "tableTo": "sessions",
+ "columnsFrom": ["target_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "schedules_skip_log_session_id_sessions_id_fk": {
+ "name": "schedules_skip_log_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "tableTo": "sessions",
+ "columnsFrom": ["skip_log_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_goals": {
+ "name": "session_goals",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "max_turns": {
+ "name": "max_turns",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "no_progress_limit": {
+ "name": "no_progress_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "turns_used": {
+ "name": "turns_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "no_progress_streak": {
+ "name": "no_progress_streak",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "usage_reset_at": {
+ "name": "usage_reset_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_reason": {
+ "name": "last_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_session_goals_status": {
+ "name": "idx_session_goals_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_goals_session_id_sessions_id_fk": {
+ "name": "session_goals_session_id_sessions_id_fk",
+ "tableFrom": "session_goals",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_pr_refs": {
+ "name": "session_pr_refs",
+ "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
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "repo": {
+ "name": "repo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_session_pr_refs": {
+ "name": "uniq_session_pr_refs",
+ "columns": ["session_id", "owner", "repo", "pr_number"],
+ "isUnique": true
+ },
+ "idx_session_pr_refs_session_last_seen": {
+ "name": "idx_session_pr_refs_session_last_seen",
+ "columns": ["session_id", "last_seen_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_pr_refs_session_id_sessions_id_fk": {
+ "name": "session_pr_refs_session_id_sessions_id_fk",
+ "tableFrom": "session_pr_refs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_task_tags": {
+ "name": "session_task_tags",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "session_task_tags_tag_idx": {
+ "name": "session_task_tags_tag_idx",
+ "columns": ["tag_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_task_tags_session_id_sessions_id_fk": {
+ "name": "session_task_tags_session_id_sessions_id_fk",
+ "tableFrom": "session_task_tags",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "session_task_tags_tag_id_task_tags_id_fk": {
+ "name": "session_task_tags_tag_id_task_tags_id_fk",
+ "tableFrom": "session_task_tags",
+ "tableTo": "task_tags",
+ "columnsFrom": ["tag_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "session_task_tags_session_id_tag_id_pk": {
+ "columns": ["session_id", "tag_id"],
+ "name": "session_task_tags_session_id_tag_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "sessions": {
+ "name": "sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'New Maker'"
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'claude-sonnet-4-6'"
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'high'"
+ },
+ "permission_mode": {
+ "name": "permission_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ask'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_token_usage": {
+ "name": "total_token_usage",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_usd": {
+ "name": "total_cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_amount": {
+ "name": "total_cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_currency": {
+ "name": "total_cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_cost_is_approximate": {
+ "name": "total_cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "context_tokens": {
+ "name": "context_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window": {
+ "name": "context_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window_runtime": {
+ "name": "context_window_runtime",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "plan_mode_enabled": {
+ "name": "plan_mode_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cleared_at": {
+ "name": "cleared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_send_at": {
+ "name": "user_send_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cc'"
+ },
+ "orca_role": {
+ "name": "orca_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "forked_at_message_id": {
+ "name": "forked_at_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'desktop'"
+ },
+ "feishu_open_id": {
+ "name": "feishu_open_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "feishu_bot_app_id": {
+ "name": "feishu_bot_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_bot_context_id": {
+ "name": "im_bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_user_id": {
+ "name": "im_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "used_project_context": {
+ "name": "used_project_context",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "codex_history_has_product_prompt": {
+ "name": "codex_history_has_product_prompt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "codex_plan_json": {
+ "name": "codex_plan_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "extra_dirs": {
+ "name": "extra_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "writable_dirs": {
+ "name": "writable_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "remote_host_id": {
+ "name": "remote_host_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_started_at": {
+ "name": "active_turn_started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_pid": {
+ "name": "active_turn_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_turn_ended_at": {
+ "name": "last_turn_ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview": {
+ "name": "list_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview_role": {
+ "name": "list_preview_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_message_count": {
+ "name": "list_message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_sessions_updated_at": {
+ "name": "idx_sessions_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ },
+ "idx_sessions_user_send_at": {
+ "name": "idx_sessions_user_send_at",
+ "columns": ["user_send_at"],
+ "isUnique": false
+ },
+ "idx_sessions_sdk_session_id": {
+ "name": "idx_sessions_sdk_session_id",
+ "columns": ["sdk_session_id"],
+ "isUnique": false
+ },
+ "idx_sessions_workdir_created": {
+ "name": "idx_sessions_workdir_created",
+ "columns": ["working_dir", "created_at", "id"],
+ "isUnique": false
+ },
+ "idx_sessions_created_at": {
+ "name": "idx_sessions_created_at",
+ "columns": ["created_at", "id"],
+ "isUnique": false
+ },
+ "idx_sessions_workspace_kind": {
+ "name": "idx_sessions_workspace_kind",
+ "columns": ["workspace_kind"],
+ "isUnique": false
+ },
+ "idx_sessions_parent_session_id": {
+ "name": "idx_sessions_parent_session_id",
+ "columns": ["parent_session_id"],
+ "isUnique": false
+ },
+ "idx_sessions_orca_role": {
+ "name": "idx_sessions_orca_role",
+ "columns": ["orca_role"],
+ "isUnique": false
+ },
+ "idx_sessions_worktree_path": {
+ "name": "idx_sessions_worktree_path",
+ "columns": ["worktree_path"],
+ "isUnique": false
+ },
+ "idx_sessions_feishu_lookup": {
+ "name": "idx_sessions_feishu_lookup",
+ "columns": ["source", "feishu_bot_app_id", "feishu_open_id"],
+ "isUnique": false
+ },
+ "idx_sessions_im_lookup": {
+ "name": "idx_sessions_im_lookup",
+ "columns": ["source", "im_bot_context_id", "im_user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "sessions_parent_session_id_sessions_id_fk": {
+ "name": "sessions_parent_session_id_sessions_id_fk",
+ "tableFrom": "sessions",
+ "tableTo": "sessions",
+ "columnsFrom": ["parent_session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_exposures": {
+ "name": "skill_usage_exposures",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "raw_line_no": {
+ "name": "raw_line_no",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_name": {
+ "name": "skill_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_path": {
+ "name": "skill_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skill_document_hash": {
+ "name": "skill_document_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "exposure_content_hash": {
+ "name": "exposure_content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "document_hash_source": {
+ "name": "document_hash_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "seen_at": {
+ "name": "seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_call_count": {
+ "name": "tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "repeated_tool_call_count": {
+ "name": "repeated_tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tool_error_count": {
+ "name": "tool_error_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_call_count": {
+ "name": "command_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_failure_count": {
+ "name": "command_failure_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_exposures_skill_document_version": {
+ "name": "idx_skill_usage_exposures_skill_document_version",
+ "columns": ["analyzer_version", "skill_name", "skill_document_hash"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent": {
+ "name": "idx_skill_usage_exposures_skill_recent",
+ "columns": ["skill_name", "analyzer_version", "seen_at"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent_any_version": {
+ "name": "idx_skill_usage_exposures_skill_recent_any_version",
+ "columns": ["skill_name", "seen_at"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_analyzer_recent_source": {
+ "name": "idx_skill_usage_exposures_analyzer_recent_source",
+ "columns": ["analyzer_version", "seen_at", "raw_file_path"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_session": {
+ "name": "idx_skill_usage_exposures_session",
+ "columns": ["session_id"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_raw_file": {
+ "name": "idx_skill_usage_exposures_raw_file",
+ "columns": ["raw_file_path"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk": {
+ "name": "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk",
+ "tableFrom": "skill_usage_exposures",
+ "tableTo": "skill_usage_sources",
+ "columnsFrom": ["raw_file_path"],
+ "columnsTo": ["raw_file_path"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_sources": {
+ "name": "skill_usage_sources",
+ "columns": {
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mtime_ms": {
+ "name": "mtime_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_scanned_at": {
+ "name": "last_scanned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ok'"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_sources_session": {
+ "name": "idx_skill_usage_sources_session",
+ "columns": ["session_id"],
+ "isUnique": false
+ },
+ "idx_skill_usage_sources_sdk_session": {
+ "name": "idx_skill_usage_sources_sdk_session",
+ "columns": ["sdk_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_run_aliases": {
+ "name": "subagent_run_aliases",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_run_aliases_lookup_idx": {
+ "name": "subagent_run_aliases_lookup_idx",
+ "columns": ["session_id", "provider", "alias", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_run_aliases_session_id_sessions_id_fk": {
+ "name": "subagent_run_aliases_session_id_sessions_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "subagent_run_aliases_run_id_subagent_runs_id_fk": {
+ "name": "subagent_run_aliases_run_id_subagent_runs_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "tableTo": "subagent_runs",
+ "columnsFrom": ["run_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "subagent_run_aliases_run_id_alias_pk": {
+ "columns": ["run_id", "alias"],
+ "name": "subagent_run_aliases_run_id_alias_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_runs": {
+ "name": "subagent_runs",
+ "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
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "logical_agent_id": {
+ "name": "logical_agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parent_tool_use_id": {
+ "name": "parent_tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "aliases": {
+ "name": "aliases",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "provider_run_ids": {
+ "name": "provider_run_ids",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'running'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result": {
+ "name": "returned_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_empty": {
+ "name": "returned_result_empty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_truncated": {
+ "name": "returned_result_truncated",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tool_uses": {
+ "name": "tool_uses",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "activity": {
+ "name": "activity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_runs_logical_idx": {
+ "name": "subagent_runs_logical_idx",
+ "columns": ["session_id", "provider", "logical_agent_id"],
+ "isUnique": false
+ },
+ "subagent_runs_session_idx": {
+ "name": "subagent_runs_session_idx",
+ "columns": ["session_id", "rewind_at", "deleted_at", "started_at"],
+ "isUnique": false
+ },
+ "subagent_runs_parent_tool_use_idx": {
+ "name": "subagent_runs_parent_tool_use_idx",
+ "columns": ["session_id", "parent_tool_use_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_runs_session_id_sessions_id_fk": {
+ "name": "subagent_runs_session_id_sessions_id_fk",
+ "tableFrom": "subagent_runs",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task_tags": {
+ "name": "task_tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "favorite_order": {
+ "name": "favorite_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "task_tags_name_idx": {
+ "name": "task_tags_name_idx",
+ "columns": ["name"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "vec_table_meta": {
+ "name": "vec_table_meta",
+ "columns": {
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "dim": {
+ "name": "dim",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "registered_at": {
+ "name": "registered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_file_attachments": {
+ "name": "wechat_file_attachments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "abs_path": {
+ "name": "abs_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "original_name": {
+ "name": "original_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'staged'"
+ },
+ "promoted_at": {
+ "name": "promoted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_wechat_file_attachments_task": {
+ "name": "idx_wechat_file_attachments_task",
+ "columns": ["binding_epoch", "task_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": ["binding_epoch"],
+ "columnsTo": ["binding_epoch"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_file_attachments_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_file_attachments_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "wechat_inbox",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_file_attachments_session_id_sessions_id_fk": {
+ "name": "wechat_file_attachments_session_id_sessions_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_inbox": {
+ "name": "wechat_inbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_message_id": {
+ "name": "platform_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_seq": {
+ "name": "platform_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "peer_id": {
+ "name": "peer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_created_at": {
+ "name": "platform_created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "lease_until": {
+ "name": "lease_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "conversation_epoch": {
+ "name": "conversation_epoch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_nonce": {
+ "name": "context_nonce",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_ciphertext": {
+ "name": "context_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_tag": {
+ "name": "context_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_inbox_platform_message": {
+ "name": "uniq_wechat_inbox_platform_message",
+ "columns": ["binding_epoch", "platform_message_id"],
+ "isUnique": true
+ },
+ "idx_wechat_inbox_queue": {
+ "name": "idx_wechat_inbox_queue",
+ "columns": ["binding_epoch", "status", "received_at"],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_lease": {
+ "name": "idx_wechat_inbox_lease",
+ "columns": ["binding_epoch", "lease_until"],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_conversation": {
+ "name": "idx_wechat_inbox_conversation",
+ "columns": ["binding_epoch", "peer_id", "conversation_epoch"],
+ "isUnique": false
+ },
+ "uniq_wechat_inbox_running_session": {
+ "name": "uniq_wechat_inbox_running_session",
+ "columns": ["binding_epoch", "session_id"],
+ "isUnique": true,
+ "where": "\"wechat_inbox\".\"session_id\" IS NOT NULL AND \"wechat_inbox\".\"status\" IN ('dispatching', 'accepted_running', 'waiting_desktop', 'delivery_pending')"
+ }
+ },
+ "foreignKeys": {
+ "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_inbox",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": ["binding_epoch"],
+ "columnsTo": ["binding_epoch"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_inbox_session_id_sessions_id_fk": {
+ "name": "wechat_inbox_session_id_sessions_id_fk",
+ "tableFrom": "wechat_inbox",
+ "tableTo": "sessions",
+ "columnsFrom": ["session_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_outbox": {
+ "name": "wechat_outbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "media_json": {
+ "name": "media_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_outbox_client_id": {
+ "name": "uniq_wechat_outbox_client_id",
+ "columns": ["binding_epoch", "client_id"],
+ "isUnique": true
+ },
+ "idx_wechat_outbox_delivery": {
+ "name": "idx_wechat_outbox_delivery",
+ "columns": ["binding_epoch", "status", "next_retry_at"],
+ "isUnique": false
+ },
+ "idx_wechat_outbox_task": {
+ "name": "idx_wechat_outbox_task",
+ "columns": ["binding_epoch", "task_id", "chunk_index"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_outbox",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": ["binding_epoch"],
+ "columnsTo": ["binding_epoch"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_outbox_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_outbox_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_outbox",
+ "tableTo": "wechat_inbox",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_sync_state": {
+ "name": "wechat_sync_state",
+ "columns": {
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "sync_cursor": {
+ "name": "sync_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "last_poll_at": {
+ "name": "last_poll_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_sync_active": {
+ "name": "uniq_wechat_sync_active",
+ "columns": ["is_active"],
+ "isUnique": true,
+ "where": "\"wechat_sync_state\".\"is_active\" = 1"
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ },
+ "uniq_orca_workers_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/apps/desktop/drizzle/meta/0112_snapshot.json b/apps/desktop/drizzle/meta/0112_snapshot.json
new file mode 100644
index 0000000000..13695bd21b
--- /dev/null
+++ b/apps/desktop/drizzle/meta/0112_snapshot.json
@@ -0,0 +1,5467 @@
+{
+ "id": "a1e2116f-72e2-4d64-bcf2-9364c9a4d751",
+ "prevId": "32c19e58-2258-4fc0-a99a-c704caa46de4",
+ "version": "6",
+ "dialect": "sqlite",
+ "tables": {
+ "account_usage_snapshots": {
+ "name": "account_usage_snapshots",
+ "columns": {
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "agent_input_queue_snapshots": {
+ "name": "agent_input_queue_snapshots",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_input_queue_snapshots_session_id_sessions_id_fk": {
+ "name": "agent_input_queue_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "agent_input_queue_snapshots",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_delegations": {
+ "name": "bot_delegations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "requesting_bot_id": {
+ "name": "requesting_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_bot_id": {
+ "name": "target_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "child_session_id": {
+ "name": "child_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_refs_json": {
+ "name": "context_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "artifact_refs_json": {
+ "name": "artifact_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "permission_snapshot_json": {
+ "name": "permission_snapshot_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "lineage_json": {
+ "name": "lineage_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "target_profile_version": {
+ "name": "target_profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "depth": {
+ "name": "depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'queued'"
+ },
+ "result_summary": {
+ "name": "result_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "output_artifacts_json": {
+ "name": "output_artifacts_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "pending_interaction_json": {
+ "name": "pending_interaction_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "run_sequence": {
+ "name": "run_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completion_delivered_at": {
+ "name": "completion_delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_delegations_requester_status": {
+ "name": "idx_bot_delegations_requester_status",
+ "columns": ["requesting_bot_id", "status"],
+ "isUnique": false
+ },
+ "idx_bot_delegations_target_status": {
+ "name": "idx_bot_delegations_target_status",
+ "columns": ["target_bot_id", "status"],
+ "isUnique": false
+ },
+ "idx_bot_delegations_parent_session": {
+ "name": "idx_bot_delegations_parent_session",
+ "columns": ["parent_session_id"],
+ "isUnique": false
+ },
+ "uniq_bot_delegations_child_session": {
+ "name": "uniq_bot_delegations_child_session",
+ "columns": ["child_session_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "bot_delegations_requesting_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_requesting_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "columnsFrom": ["requesting_bot_id"],
+ "tableTo": "bot_profiles",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "bot_delegations_target_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_target_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "columnsFrom": ["target_bot_id"],
+ "tableTo": "bot_profiles",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "bot_delegations_parent_session_id_sessions_id_fk": {
+ "name": "bot_delegations_parent_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "columnsFrom": ["parent_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "bot_delegations_child_session_id_sessions_id_fk": {
+ "name": "bot_delegations_child_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "columnsFrom": ["child_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_message_threads": {
+ "name": "bot_direct_message_threads",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_a_id": {
+ "name": "bot_a_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_b_id": {
+ "name": "bot_b_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "close_reason": {
+ "name": "close_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message_count": {
+ "name": "message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "max_messages": {
+ "name": "max_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "blocked_until": {
+ "name": "blocked_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "closed_at": {
+ "name": "closed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_dm_threads_active_pair": {
+ "name": "uniq_bot_dm_threads_active_pair",
+ "columns": ["bot_a_id", "bot_b_id"],
+ "where": "\"bot_direct_message_threads\".\"status\" = 'active'",
+ "isUnique": true
+ },
+ "idx_bot_dm_threads_pair_updated": {
+ "name": "idx_bot_dm_threads_pair_updated",
+ "columns": ["bot_a_id", "bot_b_id", "updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_messages": {
+ "name": "bot_direct_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_bot_id": {
+ "name": "sender_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recipient_bot_id": {
+ "name": "recipient_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_session_id": {
+ "name": "sender_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_session_id": {
+ "name": "recipient_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delivery_status": {
+ "name": "delivery_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "sender_name": {
+ "name": "sender_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_name": {
+ "name": "recipient_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bridge_session_id": {
+ "name": "bridge_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_direct_messages_thread_sequence": {
+ "name": "uniq_bot_direct_messages_thread_sequence",
+ "columns": ["thread_id", "sequence"],
+ "isUnique": true
+ },
+ "idx_bot_direct_messages_thread_created": {
+ "name": "idx_bot_direct_messages_thread_created",
+ "columns": ["thread_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk": {
+ "name": "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "columnsFrom": ["thread_id"],
+ "tableTo": "bot_direct_message_threads",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "bot_direct_messages_sender_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_sender_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "columnsFrom": ["sender_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "bot_direct_messages_recipient_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_recipient_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "columnsFrom": ["recipient_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_lifecycle_events": {
+ "name": "bot_lifecycle_events",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_lifecycle_events_bot_created": {
+ "name": "idx_bot_lifecycle_events_bot_created",
+ "columns": ["bot_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_bot_lifecycle_events_session_created": {
+ "name": "idx_bot_lifecycle_events_session_created",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_lifecycle_events_bot_id_bot_profiles_id_fk": {
+ "name": "bot_lifecycle_events_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "columnsFrom": ["bot_id"],
+ "tableTo": "bot_profiles",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "bot_lifecycle_events_session_id_sessions_id_fk": {
+ "name": "bot_lifecycle_events_session_id_sessions_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profile_versions": {
+ "name": "bot_profile_versions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "identity_source": {
+ "name": "identity_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "capabilities_json": {
+ "name": "capabilities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_profile_versions_bot_version": {
+ "name": "uniq_bot_profile_versions_bot_version",
+ "columns": ["bot_id", "version"],
+ "isUnique": true
+ },
+ "idx_bot_profile_versions_bot_created": {
+ "name": "idx_bot_profile_versions_bot_created",
+ "columns": ["bot_id", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profile_versions_bot_id_bot_profiles_id_fk": {
+ "name": "bot_profile_versions_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_profile_versions",
+ "columnsFrom": ["bot_id"],
+ "tableTo": "bot_profiles",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profiles": {
+ "name": "bot_profiles",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "avatar": {
+ "name": "avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'🤖'"
+ },
+ "avatar_color": {
+ "name": "avatar_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'violet'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "hidden_at": {
+ "name": "hidden_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_reason": {
+ "name": "attention_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_at": {
+ "name": "attention_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "current_version": {
+ "name": "current_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "canonical_session_id": {
+ "name": "canonical_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_profiles_status_updated": {
+ "name": "idx_bot_profiles_status_updated",
+ "columns": ["status", "updated_at"],
+ "isUnique": false
+ },
+ "idx_bot_profiles_canonical_session": {
+ "name": "idx_bot_profiles_canonical_session",
+ "columns": ["canonical_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profiles_canonical_session_id_sessions_id_fk": {
+ "name": "bot_profiles_canonical_session_id_sessions_id_fk",
+ "tableFrom": "bot_profiles",
+ "columnsFrom": ["canonical_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_runtime_snapshots": {
+ "name": "bot_runtime_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "memory_scope_key": {
+ "name": "memory_scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "configured_json": {
+ "name": "configured_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "resolved_json": {
+ "name": "resolved_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prepared_at": {
+ "name": "prepared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failure_json": {
+ "name": "failure_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_runtime_snapshots_bot_prepared": {
+ "name": "idx_bot_runtime_snapshots_bot_prepared",
+ "columns": ["bot_id", "prepared_at"],
+ "isUnique": false
+ },
+ "idx_bot_runtime_snapshots_session_prepared": {
+ "name": "idx_bot_runtime_snapshots_session_prepared",
+ "columns": ["session_id", "prepared_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_runtime_snapshots_bot_id_bot_profiles_id_fk": {
+ "name": "bot_runtime_snapshots_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "columnsFrom": ["bot_id"],
+ "tableTo": "bot_profiles",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "bot_runtime_snapshots_session_id_sessions_id_fk": {
+ "name": "bot_runtime_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_session_links": {
+ "name": "bot_session_links",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_session_links_session": {
+ "name": "uniq_bot_session_links_session",
+ "columns": ["session_id"],
+ "isUnique": true
+ },
+ "uniq_bot_session_links_canonical_per_bot": {
+ "name": "uniq_bot_session_links_canonical_per_bot",
+ "columns": ["bot_id"],
+ "where": "\"bot_session_links\".\"role\" = 'canonical'",
+ "isUnique": true
+ },
+ "idx_bot_session_links_bot_role": {
+ "name": "idx_bot_session_links_bot_role",
+ "columns": ["bot_id", "role"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_session_links_bot_id_bot_profiles_id_fk": {
+ "name": "bot_session_links_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_session_links",
+ "columnsFrom": ["bot_id"],
+ "tableTo": "bot_profiles",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "bot_session_links_session_id_sessions_id_fk": {
+ "name": "bot_session_links_session_id_sessions_id_fk",
+ "tableFrom": "bot_session_links",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_mcp_servers": {
+ "name": "custom_mcp_servers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "transport": {
+ "name": "transport",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "headers": {
+ "name": "headers",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_mcp_servers_sort_order": {
+ "name": "idx_custom_mcp_servers_sort_order",
+ "columns": ["sort_order"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_providers": {
+ "name": "custom_providers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "runtimes": {
+ "name": "runtimes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "auth": {
+ "name": "auth",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_providers_sort_order": {
+ "name": "idx_custom_providers_sort_order",
+ "columns": ["sort_order"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_model_usage": {
+ "name": "daily_model_usage",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_read_tokens": {
+ "name": "cache_read_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_create_tokens": {
+ "name": "cache_create_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_model_usage_day_agent_kind_model_cost_currency_pk": {
+ "columns": ["day", "agent_kind", "model", "cost_currency"],
+ "name": "daily_model_usage_day_agent_kind_model_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_spend": {
+ "name": "daily_spend",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_spend_day_cost_currency_pk": {
+ "columns": ["day", "cost_currency"],
+ "name": "daily_spend_day_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "device_link_ownership": {
+ "name": "device_link_ownership",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_pid": {
+ "name": "owner_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_label": {
+ "name": "owner_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_jobs": {
+ "name": "embedding_jobs",
+ "columns": {
+ "rowid": {
+ "name": "rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scheduled_at": {
+ "name": "scheduled_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_embedding_jobs_natural": {
+ "name": "uniq_embedding_jobs_natural",
+ "columns": ["source", "source_id", "chunk_index", "model_id"],
+ "isUnique": true
+ },
+ "idx_embedding_jobs_status_scheduled": {
+ "name": "idx_embedding_jobs_status_scheduled",
+ "columns": ["status", "scheduled_at"],
+ "isUnique": false
+ },
+ "idx_embedding_jobs_source_id": {
+ "name": "idx_embedding_jobs_source_id",
+ "columns": ["source", "source_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_meta": {
+ "name": "embedding_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ghost_cards": {
+ "name": "ghost_cards",
+ "columns": {
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ghost_id": {
+ "name": "ghost_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "html": {
+ "name": "html",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "v": {
+ "name": "v",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "ghost_cards_updated_at_idx": {
+ "name": "ghost_cards_updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_context_cursors": {
+ "name": "hook_group_context_cursors",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_key": {
+ "name": "cursor_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_id": {
+ "name": "cursor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_context_cursors_updated_at_idx": {
+ "name": "hook_group_context_cursors_updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "hook_group_context_cursors_provider_cursor_key_pk": {
+ "columns": ["provider", "cursor_key"],
+ "name": "hook_group_context_cursors_provider_cursor_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_message_stats": {
+ "name": "hook_group_message_stats",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "row_count": {
+ "name": "row_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text_bytes": {
+ "name": "text_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_messages": {
+ "name": "hook_group_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_name": {
+ "name": "chat_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_bot": {
+ "name": "is_bot",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_names": {
+ "name": "file_names",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_messages_msg_idx": {
+ "name": "hook_group_messages_msg_idx",
+ "columns": ["provider", "chat_id", "thread_id", "message_id"],
+ "isUnique": true
+ },
+ "hook_group_messages_window_idx": {
+ "name": "hook_group_messages_window_idx",
+ "columns": ["provider", "chat_id", "thread_id", "id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_bindings": {
+ "name": "im_bindings",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "scope_key": {
+ "name": "scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_at": {
+ "name": "attached_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_via_card_message_id": {
+ "name": "attached_via_card_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_im_bindings_target": {
+ "name": "idx_im_bindings_target",
+ "columns": ["target_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "im_bindings_target_session_id_sessions_id_fk": {
+ "name": "im_bindings_target_session_id_sessions_id_fk",
+ "tableFrom": "im_bindings",
+ "columnsFrom": ["target_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {
+ "im_bindings_channel_bot_context_id_user_id_scope_key_pk": {
+ "columns": ["channel", "bot_context_id", "user_id", "scope_key"],
+ "name": "im_bindings_channel_bot_context_id_user_id_scope_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_notification_origins": {
+ "name": "im_notification_origins",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "im_notification_origins_channel_bot_context_id_user_id_message_id_pk": {
+ "columns": ["channel", "bot_context_id", "user_id", "message_id"],
+ "name": "im_notification_origins_channel_bot_context_id_user_id_message_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_blobs": {
+ "name": "media_blobs",
+ "columns": {
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ext": {
+ "name": "ext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_cache": {
+ "name": "is_cache",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_access_at": {
+ "name": "last_access_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_invocations": {
+ "name": "media_invocations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "capability": {
+ "name": "capability",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_revision": {
+ "name": "guide_revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_json": {
+ "name": "guide_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "response_json": {
+ "name": "response_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_invocations_owner_created_at_idx": {
+ "name": "media_invocations_owner_created_at_idx",
+ "columns": ["owner", "created_at"],
+ "isUnique": false
+ },
+ "media_invocations_owner_state_idx": {
+ "name": "media_invocations_owner_state_idx",
+ "columns": ["owner", "state"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_refs": {
+ "name": "media_refs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_kind": {
+ "name": "ref_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_id": {
+ "name": "ref_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "origin_session_id": {
+ "name": "origin_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_kind": {
+ "name": "origin_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_id": {
+ "name": "origin_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_refs_hash_idx": {
+ "name": "media_refs_hash_idx",
+ "columns": ["hash"],
+ "isUnique": false
+ },
+ "media_refs_ref_idx": {
+ "name": "media_refs_ref_idx",
+ "columns": ["ref_kind", "ref_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "media_refs_hash_media_blobs_hash_fk": {
+ "name": "media_refs_hash_media_blobs_hash_fk",
+ "tableFrom": "media_refs",
+ "columnsFrom": ["hash"],
+ "tableTo": "media_blobs",
+ "columnsTo": ["hash"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "messages": {
+ "name": "messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_meta": {
+ "name": "agent_meta",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_messages_session_client": {
+ "name": "uniq_messages_session_client",
+ "columns": ["session_id", "client_id"],
+ "isUnique": true
+ },
+ "idx_messages_session_created": {
+ "name": "idx_messages_session_created",
+ "columns": ["session_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_messages_created_at": {
+ "name": "idx_messages_created_at",
+ "columns": ["created_at", "id"],
+ "isUnique": false
+ },
+ "idx_messages_rewind_at": {
+ "name": "idx_messages_rewind_at",
+ "columns": ["rewind_at"],
+ "isUnique": false
+ },
+ "idx_messages_active_error_tail": {
+ "name": "idx_messages_active_error_tail",
+ "columns": ["session_id", "created_at"],
+ "where": "\"messages\".\"role\" = 'error' AND \"messages\".\"rewind_at\" IS NULL",
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "messages_session_id_sessions_id_fk": {
+ "name": "messages_session_id_sessions_id_fk",
+ "tableFrom": "messages",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "messages_fts_rows": {
+ "name": "messages_fts_rows",
+ "columns": {
+ "fts_rowid": {
+ "name": "fts_rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "messages_fts_rows_message_id_idx": {
+ "name": "messages_fts_rows_message_id_idx",
+ "columns": ["message_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_history": {
+ "name": "migration_history",
+ "columns": {
+ "seq": {
+ "name": "seq",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_meta": {
+ "name": "migration_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_teams": {
+ "name": "orca_teams",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "lead_session_id": {
+ "name": "lead_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_active_team_per_lead": {
+ "name": "uniq_active_team_per_lead",
+ "columns": ["lead_session_id"],
+ "where": "\"orca_teams\".\"status\" = 'active'",
+ "isUnique": true
+ },
+ "idx_orca_teams_status": {
+ "name": "idx_orca_teams_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_teams_lead_session_id_sessions_id_fk": {
+ "name": "orca_teams_lead_session_id_sessions_id_fk",
+ "tableFrom": "orca_teams",
+ "columnsFrom": ["lead_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_worker_creation_reservations": {
+ "name": "orca_worker_creation_reservations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "name": "uniq_orca_worker_creation_reservations_team_label",
+ "columns": ["team_id", "lower(\"label\")"],
+ "isUnique": true
+ },
+ "idx_orca_worker_creation_reservations_expires_at": {
+ "name": "idx_orca_worker_creation_reservations_expires_at",
+ "columns": ["expires_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_worker_creation_reservations_team_id_orca_teams_id_fk": {
+ "name": "orca_worker_creation_reservations_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_worker_creation_reservations",
+ "columnsFrom": ["team_id"],
+ "tableTo": "orca_teams",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_workers": {
+ "name": "orca_workers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'idle'"
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_branch": {
+ "name": "worktree_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'developer'"
+ },
+ "focused": {
+ "name": "focused",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "idle_since": {
+ "name": "idle_since",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_workers_session_id": {
+ "name": "uniq_orca_workers_session_id",
+ "columns": ["session_id"],
+ "isUnique": true
+ },
+ "uniq_orca_workers_team_label": {
+ "name": "uniq_orca_workers_team_label",
+ "columns": ["team_id", "lower(\"label\")"],
+ "isUnique": true
+ },
+ "uniq_orca_workers_focused_per_team": {
+ "name": "uniq_orca_workers_focused_per_team",
+ "columns": ["team_id"],
+ "where": "\"orca_workers\".\"focused\" = true",
+ "isUnique": true
+ },
+ "idx_orca_workers_team_id": {
+ "name": "idx_orca_workers_team_id",
+ "columns": ["team_id"],
+ "isUnique": false
+ },
+ "idx_orca_workers_status": {
+ "name": "idx_orca_workers_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_workers_team_id_orca_teams_id_fk": {
+ "name": "orca_workers_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_workers",
+ "columnsFrom": ["team_id"],
+ "tableTo": "orca_teams",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "orca_workers_session_id_sessions_id_fk": {
+ "name": "orca_workers_session_id_sessions_id_fk",
+ "tableFrom": "orca_workers",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_aliases": {
+ "name": "project_aliases",
+ "columns": {
+ "project_key": {
+ "name": "project_key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_project_aliases_updated_at": {
+ "name": "idx_project_aliases_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_automation_consents": {
+ "name": "project_automation_consents",
+ "columns": {
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "consented_at": {
+ "name": "consented_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "config_hash": {
+ "name": "config_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "recent_workdirs": {
+ "name": "recent_workdirs",
+ "columns": {
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_recent_workdirs_last_used_at": {
+ "name": "idx_recent_workdirs_last_used_at",
+ "columns": ["last_used_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "right_sidebar_tabs": {
+ "name": "right_sidebar_tabs",
+ "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
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "right_sidebar_tabs_session_idx": {
+ "name": "right_sidebar_tabs_session_idx",
+ "columns": ["session_id", "position"],
+ "isUnique": false
+ },
+ "right_sidebar_tabs_subagents_singleton_idx": {
+ "name": "right_sidebar_tabs_subagents_singleton_idx",
+ "columns": ["session_id"],
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'subagents'",
+ "isUnique": true
+ },
+ "right_sidebar_tabs_bot_artifacts_singleton_idx": {
+ "name": "right_sidebar_tabs_bot_artifacts_singleton_idx",
+ "columns": ["session_id"],
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'bot-artifacts'",
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "right_sidebar_tabs_session_id_sessions_id_fk": {
+ "name": "right_sidebar_tabs_session_id_sessions_id_fk",
+ "tableFrom": "right_sidebar_tabs",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_runs": {
+ "name": "schedule_runs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "error_msg": {
+ "name": "error_msg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_usd": {
+ "name": "estimated_value_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_amount": {
+ "name": "estimated_value_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cost_attribution": {
+ "name": "cost_attribution",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'legacy'"
+ },
+ "result_text": {
+ "name": "result_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_result": {
+ "name": "pre_run_hook_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_runs_schedule": {
+ "name": "idx_schedule_runs_schedule",
+ "columns": ["schedule_id", "fired_at"],
+ "isUnique": false
+ },
+ "idx_schedule_runs_running_schedule": {
+ "name": "idx_schedule_runs_running_schedule",
+ "columns": ["schedule_id"],
+ "where": "\"schedule_runs\".\"status\" = 'running'",
+ "isUnique": false
+ },
+ "idx_schedule_runs_running_heartbeat": {
+ "name": "idx_schedule_runs_running_heartbeat",
+ "columns": ["heartbeat_at"],
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NOT NULL",
+ "isUnique": false
+ },
+ "idx_schedule_runs_running_legacy": {
+ "name": "idx_schedule_runs_running_legacy",
+ "columns": ["fired_at"],
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NULL",
+ "isUnique": false
+ },
+ "idx_schedule_runs_unread_terminal": {
+ "name": "idx_schedule_runs_unread_terminal",
+ "columns": ["schedule_id", "status", "fired_at"],
+ "where": "\"schedule_runs\".\"read_at\" IS NULL AND \"schedule_runs\".\"status\" IN ('success', 'failed', 'aborted', 'interrupted')",
+ "isUnique": false
+ },
+ "idx_schedule_runs_session_latest": {
+ "name": "idx_schedule_runs_session_latest",
+ "columns": ["session_id", "fired_at", "id"],
+ "where": "\"schedule_runs\".\"session_id\" IS NOT NULL",
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "schedule_runs_schedule_id_schedules_id_fk": {
+ "name": "schedule_runs_schedule_id_schedules_id_fk",
+ "tableFrom": "schedule_runs",
+ "columnsFrom": ["schedule_id"],
+ "tableTo": "schedules",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "schedule_runs_session_id_sessions_id_fk": {
+ "name": "schedule_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_runs",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_session_latest_runs": {
+ "name": "schedule_session_latest_runs",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_session_latest_runs_run": {
+ "name": "idx_schedule_session_latest_runs_run",
+ "columns": ["run_id"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "schedule_session_latest_runs_session_id_sessions_id_fk": {
+ "name": "schedule_session_latest_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "schedule_session_latest_runs_run_id_schedule_runs_id_fk": {
+ "name": "schedule_session_latest_runs_run_id_schedule_runs_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "columnsFrom": ["run_id"],
+ "tableTo": "schedule_runs",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedules": {
+ "name": "schedules",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "job_type": {
+ "name": "job_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'prompt'"
+ },
+ "job_config": {
+ "name": "job_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "execution_mode": {
+ "name": "execution_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'agent'"
+ },
+ "script_config": {
+ "name": "script_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'user'"
+ },
+ "project_config_id": {
+ "name": "project_config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "legacy_session_fallback": {
+ "name": "legacy_session_fallback",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cron'"
+ },
+ "cron_expr": {
+ "name": "cron_expr",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recurring": {
+ "name": "recurring",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "manual": {
+ "name": "manual",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "interval_ms": {
+ "name": "interval_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_agent_kind": {
+ "name": "model_agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "use_worktree": {
+ "name": "use_worktree",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "persistent_session": {
+ "name": "persistent_session",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "silent_when_idle": {
+ "name": "silent_when_idle",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "pre_run_hook_command": {
+ "name": "pre_run_hook_command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_timeout_ms": {
+ "name": "pre_run_hook_timeout_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skip_log_session_id": {
+ "name": "skip_log_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notify_desktop": {
+ "name": "notify_desktop",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "notify_feishu": {
+ "name": "notify_feishu",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "notify_wecom_group": {
+ "name": "notify_wecom_group",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_fired_at": {
+ "name": "last_fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_finished_at": {
+ "name": "last_finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "next_fire_at": {
+ "name": "next_fire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expire_at": {
+ "name": "expire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedules_active_next": {
+ "name": "idx_schedules_active_next",
+ "columns": ["status", "next_fire_at"],
+ "isUnique": false
+ },
+ "idx_schedules_target_session": {
+ "name": "idx_schedules_target_session",
+ "columns": ["target_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "schedules_target_session_id_sessions_id_fk": {
+ "name": "schedules_target_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "columnsFrom": ["target_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "schedules_skip_log_session_id_sessions_id_fk": {
+ "name": "schedules_skip_log_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "columnsFrom": ["skip_log_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_goals": {
+ "name": "session_goals",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "max_turns": {
+ "name": "max_turns",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "no_progress_limit": {
+ "name": "no_progress_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "turns_used": {
+ "name": "turns_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "no_progress_streak": {
+ "name": "no_progress_streak",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "usage_reset_at": {
+ "name": "usage_reset_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_reason": {
+ "name": "last_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_session_goals_status": {
+ "name": "idx_session_goals_status",
+ "columns": ["status"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_goals_session_id_sessions_id_fk": {
+ "name": "session_goals_session_id_sessions_id_fk",
+ "tableFrom": "session_goals",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_pr_refs": {
+ "name": "session_pr_refs",
+ "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
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "repo": {
+ "name": "repo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_session_pr_refs": {
+ "name": "uniq_session_pr_refs",
+ "columns": ["session_id", "owner", "repo", "pr_number"],
+ "isUnique": true
+ },
+ "idx_session_pr_refs_session_last_seen": {
+ "name": "idx_session_pr_refs_session_last_seen",
+ "columns": ["session_id", "last_seen_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_pr_refs_session_id_sessions_id_fk": {
+ "name": "session_pr_refs_session_id_sessions_id_fk",
+ "tableFrom": "session_pr_refs",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_task_tags": {
+ "name": "session_task_tags",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "session_task_tags_tag_idx": {
+ "name": "session_task_tags_tag_idx",
+ "columns": ["tag_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_task_tags_session_id_sessions_id_fk": {
+ "name": "session_task_tags_session_id_sessions_id_fk",
+ "tableFrom": "session_task_tags",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "session_task_tags_tag_id_task_tags_id_fk": {
+ "name": "session_task_tags_tag_id_task_tags_id_fk",
+ "tableFrom": "session_task_tags",
+ "columnsFrom": ["tag_id"],
+ "tableTo": "task_tags",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {
+ "session_task_tags_session_id_tag_id_pk": {
+ "columns": ["session_id", "tag_id"],
+ "name": "session_task_tags_session_id_tag_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "sessions": {
+ "name": "sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'New Maker'"
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'claude-sonnet-4-6'"
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'high'"
+ },
+ "permission_mode": {
+ "name": "permission_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ask'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_token_usage": {
+ "name": "total_token_usage",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_usd": {
+ "name": "total_cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_amount": {
+ "name": "total_cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_currency": {
+ "name": "total_cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_cost_is_approximate": {
+ "name": "total_cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "context_tokens": {
+ "name": "context_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window": {
+ "name": "context_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window_runtime": {
+ "name": "context_window_runtime",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "plan_mode_enabled": {
+ "name": "plan_mode_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cleared_at": {
+ "name": "cleared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_send_at": {
+ "name": "user_send_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cc'"
+ },
+ "orca_role": {
+ "name": "orca_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "forked_at_message_id": {
+ "name": "forked_at_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'desktop'"
+ },
+ "feishu_open_id": {
+ "name": "feishu_open_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "feishu_bot_app_id": {
+ "name": "feishu_bot_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_bot_context_id": {
+ "name": "im_bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_user_id": {
+ "name": "im_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "used_project_context": {
+ "name": "used_project_context",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "codex_history_has_product_prompt": {
+ "name": "codex_history_has_product_prompt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "codex_plan_json": {
+ "name": "codex_plan_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "extra_dirs": {
+ "name": "extra_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "writable_dirs": {
+ "name": "writable_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "remote_host_id": {
+ "name": "remote_host_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_started_at": {
+ "name": "active_turn_started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_pid": {
+ "name": "active_turn_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_turn_ended_at": {
+ "name": "last_turn_ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview": {
+ "name": "list_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview_role": {
+ "name": "list_preview_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_message_count": {
+ "name": "list_message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_sessions_updated_at": {
+ "name": "idx_sessions_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ },
+ "idx_sessions_user_send_at": {
+ "name": "idx_sessions_user_send_at",
+ "columns": ["user_send_at"],
+ "isUnique": false
+ },
+ "idx_sessions_sdk_session_id": {
+ "name": "idx_sessions_sdk_session_id",
+ "columns": ["sdk_session_id"],
+ "isUnique": false
+ },
+ "idx_sessions_workdir_created": {
+ "name": "idx_sessions_workdir_created",
+ "columns": ["working_dir", "created_at", "id"],
+ "isUnique": false
+ },
+ "idx_sessions_created_at": {
+ "name": "idx_sessions_created_at",
+ "columns": ["created_at", "id"],
+ "isUnique": false
+ },
+ "idx_sessions_workspace_kind": {
+ "name": "idx_sessions_workspace_kind",
+ "columns": ["workspace_kind"],
+ "isUnique": false
+ },
+ "idx_sessions_parent_session_id": {
+ "name": "idx_sessions_parent_session_id",
+ "columns": ["parent_session_id"],
+ "isUnique": false
+ },
+ "idx_sessions_orca_role": {
+ "name": "idx_sessions_orca_role",
+ "columns": ["orca_role"],
+ "isUnique": false
+ },
+ "idx_sessions_worktree_path": {
+ "name": "idx_sessions_worktree_path",
+ "columns": ["worktree_path"],
+ "isUnique": false
+ },
+ "idx_sessions_feishu_lookup": {
+ "name": "idx_sessions_feishu_lookup",
+ "columns": ["source", "feishu_bot_app_id", "feishu_open_id"],
+ "isUnique": false
+ },
+ "idx_sessions_im_lookup": {
+ "name": "idx_sessions_im_lookup",
+ "columns": ["source", "im_bot_context_id", "im_user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "sessions_parent_session_id_sessions_id_fk": {
+ "name": "sessions_parent_session_id_sessions_id_fk",
+ "tableFrom": "sessions",
+ "columnsFrom": ["parent_session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_exposures": {
+ "name": "skill_usage_exposures",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "raw_line_no": {
+ "name": "raw_line_no",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_name": {
+ "name": "skill_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_path": {
+ "name": "skill_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skill_document_hash": {
+ "name": "skill_document_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "exposure_content_hash": {
+ "name": "exposure_content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "document_hash_source": {
+ "name": "document_hash_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "seen_at": {
+ "name": "seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_call_count": {
+ "name": "tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "repeated_tool_call_count": {
+ "name": "repeated_tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tool_error_count": {
+ "name": "tool_error_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_call_count": {
+ "name": "command_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_failure_count": {
+ "name": "command_failure_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_exposures_skill_document_version": {
+ "name": "idx_skill_usage_exposures_skill_document_version",
+ "columns": ["analyzer_version", "skill_name", "skill_document_hash"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent": {
+ "name": "idx_skill_usage_exposures_skill_recent",
+ "columns": ["skill_name", "analyzer_version", "seen_at"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent_any_version": {
+ "name": "idx_skill_usage_exposures_skill_recent_any_version",
+ "columns": ["skill_name", "seen_at"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_analyzer_recent_source": {
+ "name": "idx_skill_usage_exposures_analyzer_recent_source",
+ "columns": ["analyzer_version", "seen_at", "raw_file_path"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_session": {
+ "name": "idx_skill_usage_exposures_session",
+ "columns": ["session_id"],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_raw_file": {
+ "name": "idx_skill_usage_exposures_raw_file",
+ "columns": ["raw_file_path"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk": {
+ "name": "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk",
+ "tableFrom": "skill_usage_exposures",
+ "columnsFrom": ["raw_file_path"],
+ "tableTo": "skill_usage_sources",
+ "columnsTo": ["raw_file_path"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_sources": {
+ "name": "skill_usage_sources",
+ "columns": {
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mtime_ms": {
+ "name": "mtime_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_scanned_at": {
+ "name": "last_scanned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ok'"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_sources_session": {
+ "name": "idx_skill_usage_sources_session",
+ "columns": ["session_id"],
+ "isUnique": false
+ },
+ "idx_skill_usage_sources_sdk_session": {
+ "name": "idx_skill_usage_sources_sdk_session",
+ "columns": ["sdk_session_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_run_aliases": {
+ "name": "subagent_run_aliases",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_run_aliases_lookup_idx": {
+ "name": "subagent_run_aliases_lookup_idx",
+ "columns": ["session_id", "provider", "alias", "created_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_run_aliases_session_id_sessions_id_fk": {
+ "name": "subagent_run_aliases_session_id_sessions_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "subagent_run_aliases_run_id_subagent_runs_id_fk": {
+ "name": "subagent_run_aliases_run_id_subagent_runs_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "columnsFrom": ["run_id"],
+ "tableTo": "subagent_runs",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {
+ "subagent_run_aliases_run_id_alias_pk": {
+ "columns": ["run_id", "alias"],
+ "name": "subagent_run_aliases_run_id_alias_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_runs": {
+ "name": "subagent_runs",
+ "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
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "logical_agent_id": {
+ "name": "logical_agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parent_tool_use_id": {
+ "name": "parent_tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "aliases": {
+ "name": "aliases",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "provider_run_ids": {
+ "name": "provider_run_ids",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'running'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result": {
+ "name": "returned_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_empty": {
+ "name": "returned_result_empty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_truncated": {
+ "name": "returned_result_truncated",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tool_uses": {
+ "name": "tool_uses",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "activity": {
+ "name": "activity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_runs_logical_idx": {
+ "name": "subagent_runs_logical_idx",
+ "columns": ["session_id", "provider", "logical_agent_id"],
+ "isUnique": false
+ },
+ "subagent_runs_session_idx": {
+ "name": "subagent_runs_session_idx",
+ "columns": ["session_id", "rewind_at", "deleted_at", "started_at"],
+ "isUnique": false
+ },
+ "subagent_runs_parent_tool_use_idx": {
+ "name": "subagent_runs_parent_tool_use_idx",
+ "columns": ["session_id", "parent_tool_use_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_runs_session_id_sessions_id_fk": {
+ "name": "subagent_runs_session_id_sessions_id_fk",
+ "tableFrom": "subagent_runs",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task_tags": {
+ "name": "task_tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "favorite_order": {
+ "name": "favorite_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "task_tags_name_idx": {
+ "name": "task_tags_name_idx",
+ "columns": ["name"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "vec_table_meta": {
+ "name": "vec_table_meta",
+ "columns": {
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "dim": {
+ "name": "dim",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "registered_at": {
+ "name": "registered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_file_attachments": {
+ "name": "wechat_file_attachments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "abs_path": {
+ "name": "abs_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "original_name": {
+ "name": "original_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'staged'"
+ },
+ "promoted_at": {
+ "name": "promoted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_wechat_file_attachments_task": {
+ "name": "idx_wechat_file_attachments_task",
+ "columns": ["binding_epoch", "task_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_file_attachments",
+ "columnsFrom": ["binding_epoch"],
+ "tableTo": "wechat_sync_state",
+ "columnsTo": ["binding_epoch"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "wechat_file_attachments_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_file_attachments_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "columnsFrom": ["task_id"],
+ "tableTo": "wechat_inbox",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "wechat_file_attachments_session_id_sessions_id_fk": {
+ "name": "wechat_file_attachments_session_id_sessions_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_inbox": {
+ "name": "wechat_inbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_message_id": {
+ "name": "platform_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_seq": {
+ "name": "platform_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "peer_id": {
+ "name": "peer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_created_at": {
+ "name": "platform_created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "lease_until": {
+ "name": "lease_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "conversation_epoch": {
+ "name": "conversation_epoch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_nonce": {
+ "name": "context_nonce",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_ciphertext": {
+ "name": "context_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_tag": {
+ "name": "context_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_inbox_platform_message": {
+ "name": "uniq_wechat_inbox_platform_message",
+ "columns": ["binding_epoch", "platform_message_id"],
+ "isUnique": true
+ },
+ "idx_wechat_inbox_queue": {
+ "name": "idx_wechat_inbox_queue",
+ "columns": ["binding_epoch", "status", "received_at"],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_lease": {
+ "name": "idx_wechat_inbox_lease",
+ "columns": ["binding_epoch", "lease_until"],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_conversation": {
+ "name": "idx_wechat_inbox_conversation",
+ "columns": ["binding_epoch", "peer_id", "conversation_epoch"],
+ "isUnique": false
+ },
+ "uniq_wechat_inbox_running_session": {
+ "name": "uniq_wechat_inbox_running_session",
+ "columns": ["binding_epoch", "session_id"],
+ "where": "\"wechat_inbox\".\"session_id\" IS NOT NULL AND \"wechat_inbox\".\"status\" IN ('dispatching', 'accepted_running', 'waiting_desktop', 'delivery_pending')",
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_inbox",
+ "columnsFrom": ["binding_epoch"],
+ "tableTo": "wechat_sync_state",
+ "columnsTo": ["binding_epoch"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "wechat_inbox_session_id_sessions_id_fk": {
+ "name": "wechat_inbox_session_id_sessions_id_fk",
+ "tableFrom": "wechat_inbox",
+ "columnsFrom": ["session_id"],
+ "tableTo": "sessions",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_outbox": {
+ "name": "wechat_outbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "media_json": {
+ "name": "media_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_outbox_client_id": {
+ "name": "uniq_wechat_outbox_client_id",
+ "columns": ["binding_epoch", "client_id"],
+ "isUnique": true
+ },
+ "idx_wechat_outbox_delivery": {
+ "name": "idx_wechat_outbox_delivery",
+ "columns": ["binding_epoch", "status", "next_retry_at"],
+ "isUnique": false
+ },
+ "idx_wechat_outbox_task": {
+ "name": "idx_wechat_outbox_task",
+ "columns": ["binding_epoch", "task_id", "chunk_index"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_outbox",
+ "columnsFrom": ["binding_epoch"],
+ "tableTo": "wechat_sync_state",
+ "columnsTo": ["binding_epoch"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "wechat_outbox_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_outbox_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_outbox",
+ "columnsFrom": ["task_id"],
+ "tableTo": "wechat_inbox",
+ "columnsTo": ["id"],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_sync_state": {
+ "name": "wechat_sync_state",
+ "columns": {
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "sync_cursor": {
+ "name": "sync_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "last_poll_at": {
+ "name": "last_poll_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_sync_active": {
+ "name": "uniq_wechat_sync_active",
+ "columns": ["is_active"],
+ "where": "\"wechat_sync_state\".\"is_active\" = 1",
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ },
+ "internal": {
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ },
+ "uniq_orca_workers_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/apps/desktop/drizzle/meta/0113_snapshot.json b/apps/desktop/drizzle/meta/0113_snapshot.json
new file mode 100644
index 0000000000..67bef1cfd6
--- /dev/null
+++ b/apps/desktop/drizzle/meta/0113_snapshot.json
@@ -0,0 +1,5968 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "454a5925-19b5-4cb0-a1ef-9d2e0d6858d5",
+ "prevId": "a1e2116f-72e2-4d64-bcf2-9364c9a4d751",
+ "tables": {
+ "account_usage_snapshots": {
+ "name": "account_usage_snapshots",
+ "columns": {
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "agent_input_queue_snapshots": {
+ "name": "agent_input_queue_snapshots",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_input_queue_snapshots_session_id_sessions_id_fk": {
+ "name": "agent_input_queue_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "agent_input_queue_snapshots",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_delegations": {
+ "name": "bot_delegations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "requesting_bot_id": {
+ "name": "requesting_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_bot_id": {
+ "name": "target_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "child_session_id": {
+ "name": "child_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_refs_json": {
+ "name": "context_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "artifact_refs_json": {
+ "name": "artifact_refs_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "permission_snapshot_json": {
+ "name": "permission_snapshot_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "lineage_json": {
+ "name": "lineage_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "target_profile_version": {
+ "name": "target_profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "depth": {
+ "name": "depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'queued'"
+ },
+ "result_summary": {
+ "name": "result_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "output_artifacts_json": {
+ "name": "output_artifacts_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "pending_interaction_json": {
+ "name": "pending_interaction_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "run_sequence": {
+ "name": "run_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completion_delivered_at": {
+ "name": "completion_delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_delegations_requester_status": {
+ "name": "idx_bot_delegations_requester_status",
+ "columns": [
+ "requesting_bot_id",
+ "status"
+ ],
+ "isUnique": false
+ },
+ "idx_bot_delegations_target_status": {
+ "name": "idx_bot_delegations_target_status",
+ "columns": [
+ "target_bot_id",
+ "status"
+ ],
+ "isUnique": false
+ },
+ "idx_bot_delegations_parent_session": {
+ "name": "idx_bot_delegations_parent_session",
+ "columns": [
+ "parent_session_id"
+ ],
+ "isUnique": false
+ },
+ "uniq_bot_delegations_child_session": {
+ "name": "uniq_bot_delegations_child_session",
+ "columns": [
+ "child_session_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "bot_delegations_requesting_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_requesting_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "bot_profiles",
+ "columnsFrom": [
+ "requesting_bot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_target_bot_id_bot_profiles_id_fk": {
+ "name": "bot_delegations_target_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "bot_profiles",
+ "columnsFrom": [
+ "target_bot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_parent_session_id_sessions_id_fk": {
+ "name": "bot_delegations_parent_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "parent_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "bot_delegations_child_session_id_sessions_id_fk": {
+ "name": "bot_delegations_child_session_id_sessions_id_fk",
+ "tableFrom": "bot_delegations",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "child_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_message_threads": {
+ "name": "bot_direct_message_threads",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_a_id": {
+ "name": "bot_a_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_b_id": {
+ "name": "bot_b_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "close_reason": {
+ "name": "close_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message_count": {
+ "name": "message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "max_messages": {
+ "name": "max_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "blocked_until": {
+ "name": "blocked_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "closed_at": {
+ "name": "closed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_dm_threads_active_pair": {
+ "name": "uniq_bot_dm_threads_active_pair",
+ "columns": [
+ "bot_a_id",
+ "bot_b_id"
+ ],
+ "isUnique": true,
+ "where": "\"bot_direct_message_threads\".\"status\" = 'active'"
+ },
+ "idx_bot_dm_threads_pair_updated": {
+ "name": "idx_bot_dm_threads_pair_updated",
+ "columns": [
+ "bot_a_id",
+ "bot_b_id",
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_direct_messages": {
+ "name": "bot_direct_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_bot_id": {
+ "name": "sender_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recipient_bot_id": {
+ "name": "recipient_bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sender_session_id": {
+ "name": "sender_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_session_id": {
+ "name": "recipient_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delivery_status": {
+ "name": "delivery_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "sender_name": {
+ "name": "sender_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recipient_name": {
+ "name": "recipient_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bridge_session_id": {
+ "name": "bridge_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_direct_messages_thread_sequence": {
+ "name": "uniq_bot_direct_messages_thread_sequence",
+ "columns": [
+ "thread_id",
+ "sequence"
+ ],
+ "isUnique": true
+ },
+ "idx_bot_direct_messages_thread_created": {
+ "name": "idx_bot_direct_messages_thread_created",
+ "columns": [
+ "thread_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk": {
+ "name": "bot_direct_messages_thread_id_bot_direct_message_threads_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "bot_direct_message_threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_direct_messages_sender_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_sender_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "sender_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "bot_direct_messages_recipient_session_id_sessions_id_fk": {
+ "name": "bot_direct_messages_recipient_session_id_sessions_id_fk",
+ "tableFrom": "bot_direct_messages",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "recipient_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_lifecycle_events": {
+ "name": "bot_lifecycle_events",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_lifecycle_events_bot_created": {
+ "name": "idx_bot_lifecycle_events_bot_created",
+ "columns": [
+ "bot_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "idx_bot_lifecycle_events_session_created": {
+ "name": "idx_bot_lifecycle_events_session_created",
+ "columns": [
+ "session_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_lifecycle_events_bot_id_bot_profiles_id_fk": {
+ "name": "bot_lifecycle_events_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "tableTo": "bot_profiles",
+ "columnsFrom": [
+ "bot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_lifecycle_events_session_id_sessions_id_fk": {
+ "name": "bot_lifecycle_events_session_id_sessions_id_fk",
+ "tableFrom": "bot_lifecycle_events",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profile_versions": {
+ "name": "bot_profile_versions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "identity_source": {
+ "name": "identity_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "capabilities_json": {
+ "name": "capabilities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_profile_versions_bot_version": {
+ "name": "uniq_bot_profile_versions_bot_version",
+ "columns": [
+ "bot_id",
+ "version"
+ ],
+ "isUnique": true
+ },
+ "idx_bot_profile_versions_bot_created": {
+ "name": "idx_bot_profile_versions_bot_created",
+ "columns": [
+ "bot_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profile_versions_bot_id_bot_profiles_id_fk": {
+ "name": "bot_profile_versions_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_profile_versions",
+ "tableTo": "bot_profiles",
+ "columnsFrom": [
+ "bot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_profiles": {
+ "name": "bot_profiles",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "avatar": {
+ "name": "avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'🤖'"
+ },
+ "avatar_color": {
+ "name": "avatar_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'violet'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "hidden_at": {
+ "name": "hidden_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_reason": {
+ "name": "attention_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attention_at": {
+ "name": "attention_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "current_version": {
+ "name": "current_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "canonical_session_id": {
+ "name": "canonical_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_profiles_status_updated": {
+ "name": "idx_bot_profiles_status_updated",
+ "columns": [
+ "status",
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "idx_bot_profiles_canonical_session": {
+ "name": "idx_bot_profiles_canonical_session",
+ "columns": [
+ "canonical_session_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_profiles_canonical_session_id_sessions_id_fk": {
+ "name": "bot_profiles_canonical_session_id_sessions_id_fk",
+ "tableFrom": "bot_profiles",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "canonical_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_runtime_snapshots": {
+ "name": "bot_runtime_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "memory_scope_key": {
+ "name": "memory_scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "configured_json": {
+ "name": "configured_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "resolved_json": {
+ "name": "resolved_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prepared_at": {
+ "name": "prepared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failure_json": {
+ "name": "failure_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_bot_runtime_snapshots_bot_prepared": {
+ "name": "idx_bot_runtime_snapshots_bot_prepared",
+ "columns": [
+ "bot_id",
+ "prepared_at"
+ ],
+ "isUnique": false
+ },
+ "idx_bot_runtime_snapshots_session_prepared": {
+ "name": "idx_bot_runtime_snapshots_session_prepared",
+ "columns": [
+ "session_id",
+ "prepared_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_runtime_snapshots_bot_id_bot_profiles_id_fk": {
+ "name": "bot_runtime_snapshots_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "tableTo": "bot_profiles",
+ "columnsFrom": [
+ "bot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_runtime_snapshots_session_id_sessions_id_fk": {
+ "name": "bot_runtime_snapshots_session_id_sessions_id_fk",
+ "tableFrom": "bot_runtime_snapshots",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "bot_session_links": {
+ "name": "bot_session_links",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_id": {
+ "name": "bot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "profile_version": {
+ "name": "profile_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "route_key": {
+ "name": "route_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_bot_session_links_session": {
+ "name": "uniq_bot_session_links_session",
+ "columns": [
+ "session_id"
+ ],
+ "isUnique": true
+ },
+ "uniq_bot_session_links_canonical_per_bot": {
+ "name": "uniq_bot_session_links_canonical_per_bot",
+ "columns": [
+ "bot_id"
+ ],
+ "isUnique": true,
+ "where": "\"bot_session_links\".\"role\" = 'canonical'"
+ },
+ "idx_bot_session_links_bot_role": {
+ "name": "idx_bot_session_links_bot_role",
+ "columns": [
+ "bot_id",
+ "role"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "bot_session_links_bot_id_bot_profiles_id_fk": {
+ "name": "bot_session_links_bot_id_bot_profiles_id_fk",
+ "tableFrom": "bot_session_links",
+ "tableTo": "bot_profiles",
+ "columnsFrom": [
+ "bot_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "bot_session_links_session_id_sessions_id_fk": {
+ "name": "bot_session_links_session_id_sessions_id_fk",
+ "tableFrom": "bot_session_links",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_mcp_servers": {
+ "name": "custom_mcp_servers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "transport": {
+ "name": "transport",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "headers": {
+ "name": "headers",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_mcp_servers_sort_order": {
+ "name": "idx_custom_mcp_servers_sort_order",
+ "columns": [
+ "sort_order"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "custom_providers": {
+ "name": "custom_providers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "runtimes": {
+ "name": "runtimes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "auth": {
+ "name": "auth",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_custom_providers_sort_order": {
+ "name": "idx_custom_providers_sort_order",
+ "columns": [
+ "sort_order"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_model_usage": {
+ "name": "daily_model_usage",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_read_tokens": {
+ "name": "cache_read_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cache_create_tokens": {
+ "name": "cache_create_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_model_usage_day_agent_kind_model_cost_currency_pk": {
+ "columns": [
+ "day",
+ "agent_kind",
+ "model",
+ "cost_currency"
+ ],
+ "name": "daily_model_usage_day_agent_kind_model_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "daily_spend": {
+ "name": "daily_spend",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'USD'"
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "daily_spend_day_cost_currency_pk": {
+ "columns": [
+ "day",
+ "cost_currency"
+ ],
+ "name": "daily_spend_day_cost_currency_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "device_link_ownership": {
+ "name": "device_link_ownership",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_pid": {
+ "name": "owner_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_label": {
+ "name": "owner_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_jobs": {
+ "name": "embedding_jobs",
+ "columns": {
+ "rowid": {
+ "name": "rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scheduled_at": {
+ "name": "scheduled_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_embedding_jobs_natural": {
+ "name": "uniq_embedding_jobs_natural",
+ "columns": [
+ "source",
+ "source_id",
+ "chunk_index",
+ "model_id"
+ ],
+ "isUnique": true
+ },
+ "idx_embedding_jobs_status_scheduled": {
+ "name": "idx_embedding_jobs_status_scheduled",
+ "columns": [
+ "status",
+ "scheduled_at"
+ ],
+ "isUnique": false
+ },
+ "idx_embedding_jobs_source_id": {
+ "name": "idx_embedding_jobs_source_id",
+ "columns": [
+ "source",
+ "source_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "embedding_meta": {
+ "name": "embedding_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ghost_cards": {
+ "name": "ghost_cards",
+ "columns": {
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ghost_id": {
+ "name": "ghost_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "html": {
+ "name": "html",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "v": {
+ "name": "v",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "ghost_cards_updated_at_idx": {
+ "name": "ghost_cards_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_context_cursors": {
+ "name": "hook_group_context_cursors",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_key": {
+ "name": "cursor_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cursor_id": {
+ "name": "cursor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_context_cursors_updated_at_idx": {
+ "name": "hook_group_context_cursors_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "hook_group_context_cursors_provider_cursor_key_pk": {
+ "columns": [
+ "provider",
+ "cursor_key"
+ ],
+ "name": "hook_group_context_cursors_provider_cursor_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_message_stats": {
+ "name": "hook_group_message_stats",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "row_count": {
+ "name": "row_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text_bytes": {
+ "name": "text_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "hook_group_messages": {
+ "name": "hook_group_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_name": {
+ "name": "chat_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_bot": {
+ "name": "is_bot",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_names": {
+ "name": "file_names",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "hook_group_messages_msg_idx": {
+ "name": "hook_group_messages_msg_idx",
+ "columns": [
+ "provider",
+ "chat_id",
+ "thread_id",
+ "message_id"
+ ],
+ "isUnique": true
+ },
+ "hook_group_messages_window_idx": {
+ "name": "hook_group_messages_window_idx",
+ "columns": [
+ "provider",
+ "chat_id",
+ "thread_id",
+ "id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_bindings": {
+ "name": "im_bindings",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "scope_key": {
+ "name": "scope_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_at": {
+ "name": "attached_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attached_via_card_message_id": {
+ "name": "attached_via_card_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_im_bindings_target": {
+ "name": "idx_im_bindings_target",
+ "columns": [
+ "target_session_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "im_bindings_target_session_id_sessions_id_fk": {
+ "name": "im_bindings_target_session_id_sessions_id_fk",
+ "tableFrom": "im_bindings",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "target_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "im_bindings_channel_bot_context_id_user_id_scope_key_pk": {
+ "columns": [
+ "channel",
+ "bot_context_id",
+ "user_id",
+ "scope_key"
+ ],
+ "name": "im_bindings_channel_bot_context_id_user_id_scope_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "im_notification_origins": {
+ "name": "im_notification_origins",
+ "columns": {
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bot_context_id": {
+ "name": "bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "im_notification_origins_channel_bot_context_id_user_id_message_id_pk": {
+ "columns": [
+ "channel",
+ "bot_context_id",
+ "user_id",
+ "message_id"
+ ],
+ "name": "im_notification_origins_channel_bot_context_id_user_id_message_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_blobs": {
+ "name": "media_blobs",
+ "columns": {
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ext": {
+ "name": "ext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_cache": {
+ "name": "is_cache",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_access_at": {
+ "name": "last_access_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_invocations": {
+ "name": "media_invocations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "capability": {
+ "name": "capability",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_revision": {
+ "name": "guide_revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guide_json": {
+ "name": "guide_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "response_json": {
+ "name": "response_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_invocations_owner_created_at_idx": {
+ "name": "media_invocations_owner_created_at_idx",
+ "columns": [
+ "owner",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "media_invocations_owner_state_idx": {
+ "name": "media_invocations_owner_state_idx",
+ "columns": [
+ "owner",
+ "state"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media_refs": {
+ "name": "media_refs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_kind": {
+ "name": "ref_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_id": {
+ "name": "ref_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "origin_session_id": {
+ "name": "origin_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_kind": {
+ "name": "origin_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_id": {
+ "name": "origin_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "media_refs_hash_idx": {
+ "name": "media_refs_hash_idx",
+ "columns": [
+ "hash"
+ ],
+ "isUnique": false
+ },
+ "media_refs_ref_idx": {
+ "name": "media_refs_ref_idx",
+ "columns": [
+ "ref_kind",
+ "ref_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "media_refs_hash_media_blobs_hash_fk": {
+ "name": "media_refs_hash_media_blobs_hash_fk",
+ "tableFrom": "media_refs",
+ "tableTo": "media_blobs",
+ "columnsFrom": [
+ "hash"
+ ],
+ "columnsTo": [
+ "hash"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "messages": {
+ "name": "messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_meta": {
+ "name": "agent_meta",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_messages_session_client": {
+ "name": "uniq_messages_session_client",
+ "columns": [
+ "session_id",
+ "client_id"
+ ],
+ "isUnique": true
+ },
+ "idx_messages_session_created": {
+ "name": "idx_messages_session_created",
+ "columns": [
+ "session_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "idx_messages_created_at": {
+ "name": "idx_messages_created_at",
+ "columns": [
+ "created_at",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "idx_messages_rewind_at": {
+ "name": "idx_messages_rewind_at",
+ "columns": [
+ "rewind_at"
+ ],
+ "isUnique": false
+ },
+ "idx_messages_active_error_tail": {
+ "name": "idx_messages_active_error_tail",
+ "columns": [
+ "session_id",
+ "created_at"
+ ],
+ "isUnique": false,
+ "where": "\"messages\".\"role\" = 'error' AND \"messages\".\"rewind_at\" IS NULL"
+ }
+ },
+ "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": {}
+ },
+ "messages_fts_rows": {
+ "name": "messages_fts_rows",
+ "columns": {
+ "fts_rowid": {
+ "name": "fts_rowid",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "messages_fts_rows_message_id_idx": {
+ "name": "messages_fts_rows_message_id_idx",
+ "columns": [
+ "message_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_history": {
+ "name": "migration_history",
+ "columns": {
+ "seq": {
+ "name": "seq",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "migration_meta": {
+ "name": "migration_meta",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_teams": {
+ "name": "orca_teams",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "lead_session_id": {
+ "name": "lead_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_active_team_per_lead": {
+ "name": "uniq_active_team_per_lead",
+ "columns": [
+ "lead_session_id"
+ ],
+ "isUnique": true,
+ "where": "\"orca_teams\".\"status\" = 'active'"
+ },
+ "idx_orca_teams_status": {
+ "name": "idx_orca_teams_status",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_teams_lead_session_id_sessions_id_fk": {
+ "name": "orca_teams_lead_session_id_sessions_id_fk",
+ "tableFrom": "orca_teams",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "lead_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_worker_creation_reservations": {
+ "name": "orca_worker_creation_reservations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "name": "uniq_orca_worker_creation_reservations_team_label",
+ "columns": [
+ "team_id",
+ "lower(\"label\")"
+ ],
+ "isUnique": true
+ },
+ "idx_orca_worker_creation_reservations_expires_at": {
+ "name": "idx_orca_worker_creation_reservations_expires_at",
+ "columns": [
+ "expires_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_worker_creation_reservations_team_id_orca_teams_id_fk": {
+ "name": "orca_worker_creation_reservations_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_worker_creation_reservations",
+ "tableTo": "orca_teams",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "orca_workers": {
+ "name": "orca_workers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'idle'"
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_branch": {
+ "name": "worktree_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'developer'"
+ },
+ "focused": {
+ "name": "focused",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "idle_since": {
+ "name": "idle_since",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_orca_workers_session_id": {
+ "name": "uniq_orca_workers_session_id",
+ "columns": [
+ "session_id"
+ ],
+ "isUnique": true
+ },
+ "uniq_orca_workers_team_label": {
+ "name": "uniq_orca_workers_team_label",
+ "columns": [
+ "team_id",
+ "lower(\"label\")"
+ ],
+ "isUnique": true
+ },
+ "uniq_orca_workers_focused_per_team": {
+ "name": "uniq_orca_workers_focused_per_team",
+ "columns": [
+ "team_id"
+ ],
+ "isUnique": true,
+ "where": "\"orca_workers\".\"focused\" = true"
+ },
+ "idx_orca_workers_team_id": {
+ "name": "idx_orca_workers_team_id",
+ "columns": [
+ "team_id"
+ ],
+ "isUnique": false
+ },
+ "idx_orca_workers_status": {
+ "name": "idx_orca_workers_status",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "orca_workers_team_id_orca_teams_id_fk": {
+ "name": "orca_workers_team_id_orca_teams_id_fk",
+ "tableFrom": "orca_workers",
+ "tableTo": "orca_teams",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "orca_workers_session_id_sessions_id_fk": {
+ "name": "orca_workers_session_id_sessions_id_fk",
+ "tableFrom": "orca_workers",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_aliases": {
+ "name": "project_aliases",
+ "columns": {
+ "project_key": {
+ "name": "project_key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_project_aliases_updated_at": {
+ "name": "idx_project_aliases_updated_at",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_automation_consents": {
+ "name": "project_automation_consents",
+ "columns": {
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "consented_at": {
+ "name": "consented_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "config_hash": {
+ "name": "config_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "recent_workdirs": {
+ "name": "recent_workdirs",
+ "columns": {
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_recent_workdirs_last_used_at": {
+ "name": "idx_recent_workdirs_last_used_at",
+ "columns": [
+ "last_used_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "right_sidebar_tabs": {
+ "name": "right_sidebar_tabs",
+ "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
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "right_sidebar_tabs_session_idx": {
+ "name": "right_sidebar_tabs_session_idx",
+ "columns": [
+ "session_id",
+ "position"
+ ],
+ "isUnique": false
+ },
+ "right_sidebar_tabs_subagents_singleton_idx": {
+ "name": "right_sidebar_tabs_subagents_singleton_idx",
+ "columns": [
+ "session_id"
+ ],
+ "isUnique": true,
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'subagents'"
+ },
+ "right_sidebar_tabs_bot_artifacts_singleton_idx": {
+ "name": "right_sidebar_tabs_bot_artifacts_singleton_idx",
+ "columns": [
+ "session_id"
+ ],
+ "isUnique": true,
+ "where": "\"right_sidebar_tabs\".\"kind\" = 'bot-artifacts'"
+ }
+ },
+ "foreignKeys": {
+ "right_sidebar_tabs_session_id_sessions_id_fk": {
+ "name": "right_sidebar_tabs_session_id_sessions_id_fk",
+ "tableFrom": "right_sidebar_tabs",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_runs": {
+ "name": "schedule_runs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "error_msg": {
+ "name": "error_msg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_usd": {
+ "name": "estimated_value_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_amount": {
+ "name": "cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "estimated_value_amount": {
+ "name": "estimated_value_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "cost_currency": {
+ "name": "cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_is_approximate": {
+ "name": "cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cost_attribution": {
+ "name": "cost_attribution",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'legacy'"
+ },
+ "result_text": {
+ "name": "result_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_result": {
+ "name": "pre_run_hook_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "heartbeat_at": {
+ "name": "heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_runs_schedule": {
+ "name": "idx_schedule_runs_schedule",
+ "columns": [
+ "schedule_id",
+ "fired_at"
+ ],
+ "isUnique": false
+ },
+ "idx_schedule_runs_running_schedule": {
+ "name": "idx_schedule_runs_running_schedule",
+ "columns": [
+ "schedule_id"
+ ],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running'"
+ },
+ "idx_schedule_runs_running_heartbeat": {
+ "name": "idx_schedule_runs_running_heartbeat",
+ "columns": [
+ "heartbeat_at"
+ ],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NOT NULL"
+ },
+ "idx_schedule_runs_running_legacy": {
+ "name": "idx_schedule_runs_running_legacy",
+ "columns": [
+ "fired_at"
+ ],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"status\" = 'running' AND \"schedule_runs\".\"heartbeat_at\" IS NULL"
+ },
+ "idx_schedule_runs_unread_terminal": {
+ "name": "idx_schedule_runs_unread_terminal",
+ "columns": [
+ "schedule_id",
+ "status",
+ "fired_at"
+ ],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"read_at\" IS NULL AND \"schedule_runs\".\"status\" IN ('success', 'failed', 'aborted', 'interrupted')"
+ },
+ "idx_schedule_runs_session_latest": {
+ "name": "idx_schedule_runs_session_latest",
+ "columns": [
+ "session_id",
+ "fired_at",
+ "id"
+ ],
+ "isUnique": false,
+ "where": "\"schedule_runs\".\"session_id\" IS NOT NULL"
+ }
+ },
+ "foreignKeys": {
+ "schedule_runs_schedule_id_schedules_id_fk": {
+ "name": "schedule_runs_schedule_id_schedules_id_fk",
+ "tableFrom": "schedule_runs",
+ "tableTo": "schedules",
+ "columnsFrom": [
+ "schedule_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "schedule_runs_session_id_sessions_id_fk": {
+ "name": "schedule_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_runs",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedule_session_latest_runs": {
+ "name": "schedule_session_latest_runs",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fired_at": {
+ "name": "fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedule_session_latest_runs_run": {
+ "name": "idx_schedule_session_latest_runs_run",
+ "columns": [
+ "run_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "schedule_session_latest_runs_session_id_sessions_id_fk": {
+ "name": "schedule_session_latest_runs_session_id_sessions_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "schedule_session_latest_runs_run_id_schedule_runs_id_fk": {
+ "name": "schedule_session_latest_runs_run_id_schedule_runs_id_fk",
+ "tableFrom": "schedule_session_latest_runs",
+ "tableTo": "schedule_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "schedules": {
+ "name": "schedules",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "job_type": {
+ "name": "job_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'prompt'"
+ },
+ "job_config": {
+ "name": "job_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "execution_mode": {
+ "name": "execution_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'agent'"
+ },
+ "script_config": {
+ "name": "script_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'user'"
+ },
+ "project_config_id": {
+ "name": "project_config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "legacy_session_fallback": {
+ "name": "legacy_session_fallback",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cron'"
+ },
+ "cron_expr": {
+ "name": "cron_expr",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recurring": {
+ "name": "recurring",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "manual": {
+ "name": "manual",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "interval_ms": {
+ "name": "interval_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_agent_kind": {
+ "name": "model_agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "use_worktree": {
+ "name": "use_worktree",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "target_session_id": {
+ "name": "target_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "persistent_session": {
+ "name": "persistent_session",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "silent_when_idle": {
+ "name": "silent_when_idle",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "pre_run_hook_command": {
+ "name": "pre_run_hook_command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pre_run_hook_timeout_ms": {
+ "name": "pre_run_hook_timeout_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skip_log_session_id": {
+ "name": "skip_log_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notify_desktop": {
+ "name": "notify_desktop",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "notify_feishu": {
+ "name": "notify_feishu",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "notify_wecom_group": {
+ "name": "notify_wecom_group",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_fired_at": {
+ "name": "last_fired_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_finished_at": {
+ "name": "last_finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "next_fire_at": {
+ "name": "next_fire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expire_at": {
+ "name": "expire_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_schedules_active_next": {
+ "name": "idx_schedules_active_next",
+ "columns": [
+ "status",
+ "next_fire_at"
+ ],
+ "isUnique": false
+ },
+ "idx_schedules_target_session": {
+ "name": "idx_schedules_target_session",
+ "columns": [
+ "target_session_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "schedules_target_session_id_sessions_id_fk": {
+ "name": "schedules_target_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "target_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "schedules_skip_log_session_id_sessions_id_fk": {
+ "name": "schedules_skip_log_session_id_sessions_id_fk",
+ "tableFrom": "schedules",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "skip_log_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_goals": {
+ "name": "session_goals",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "objective": {
+ "name": "objective",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "budget_tokens": {
+ "name": "budget_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "max_turns": {
+ "name": "max_turns",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "no_progress_limit": {
+ "name": "no_progress_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "turns_used": {
+ "name": "turns_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "no_progress_streak": {
+ "name": "no_progress_streak",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "usage_reset_at": {
+ "name": "usage_reset_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_reason": {
+ "name": "last_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_session_goals_status": {
+ "name": "idx_session_goals_status",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_goals_session_id_sessions_id_fk": {
+ "name": "session_goals_session_id_sessions_id_fk",
+ "tableFrom": "session_goals",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_pr_refs": {
+ "name": "session_pr_refs",
+ "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
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "repo": {
+ "name": "repo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_session_pr_refs": {
+ "name": "uniq_session_pr_refs",
+ "columns": [
+ "session_id",
+ "owner",
+ "repo",
+ "pr_number"
+ ],
+ "isUnique": true
+ },
+ "idx_session_pr_refs_session_last_seen": {
+ "name": "idx_session_pr_refs_session_last_seen",
+ "columns": [
+ "session_id",
+ "last_seen_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_pr_refs_session_id_sessions_id_fk": {
+ "name": "session_pr_refs_session_id_sessions_id_fk",
+ "tableFrom": "session_pr_refs",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session_task_tags": {
+ "name": "session_task_tags",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "session_task_tags_tag_idx": {
+ "name": "session_task_tags_tag_idx",
+ "columns": [
+ "tag_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_task_tags_session_id_sessions_id_fk": {
+ "name": "session_task_tags_session_id_sessions_id_fk",
+ "tableFrom": "session_task_tags",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "session_task_tags_tag_id_task_tags_id_fk": {
+ "name": "session_task_tags_tag_id_task_tags_id_fk",
+ "tableFrom": "session_task_tags",
+ "tableTo": "task_tags",
+ "columnsFrom": [
+ "tag_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "session_task_tags_session_id_tag_id_pk": {
+ "columns": [
+ "session_id",
+ "tag_id"
+ ],
+ "name": "session_task_tags_session_id_tag_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "sessions": {
+ "name": "sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'New Maker'"
+ },
+ "working_dir": {
+ "name": "working_dir",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_kind": {
+ "name": "workspace_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'project'"
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'claude-sonnet-4-6'"
+ },
+ "effort": {
+ "name": "effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'high'"
+ },
+ "permission_mode": {
+ "name": "permission_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ask'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_token_usage": {
+ "name": "total_token_usage",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_usd": {
+ "name": "total_cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_amount": {
+ "name": "total_cost_amount",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "total_cost_currency": {
+ "name": "total_cost_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_cost_is_approximate": {
+ "name": "total_cost_is_approximate",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "context_tokens": {
+ "name": "context_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window": {
+ "name": "context_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "context_window_runtime": {
+ "name": "context_window_runtime",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "plan_mode_enabled": {
+ "name": "plan_mode_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "cleared_at": {
+ "name": "cleared_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pinned_at": {
+ "name": "pinned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_send_at": {
+ "name": "user_send_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cc'"
+ },
+ "orca_role": {
+ "name": "orca_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_session_id": {
+ "name": "parent_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "forked_at_message_id": {
+ "name": "forked_at_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'desktop'"
+ },
+ "feishu_open_id": {
+ "name": "feishu_open_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "feishu_bot_app_id": {
+ "name": "feishu_bot_app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_bot_context_id": {
+ "name": "im_bot_context_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "im_user_id": {
+ "name": "im_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "used_project_context": {
+ "name": "used_project_context",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "codex_history_has_product_prompt": {
+ "name": "codex_history_has_product_prompt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "codex_plan_json": {
+ "name": "codex_plan_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "extra_dirs": {
+ "name": "extra_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "writable_dirs": {
+ "name": "writable_dirs",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "remote_host_id": {
+ "name": "remote_host_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_started_at": {
+ "name": "active_turn_started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "active_turn_pid": {
+ "name": "active_turn_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_turn_ended_at": {
+ "name": "last_turn_ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview": {
+ "name": "list_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_preview_role": {
+ "name": "list_preview_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_message_count": {
+ "name": "list_message_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_sessions_updated_at": {
+ "name": "idx_sessions_updated_at",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_user_send_at": {
+ "name": "idx_sessions_user_send_at",
+ "columns": [
+ "user_send_at"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_sdk_session_id": {
+ "name": "idx_sessions_sdk_session_id",
+ "columns": [
+ "sdk_session_id"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_workdir_created": {
+ "name": "idx_sessions_workdir_created",
+ "columns": [
+ "working_dir",
+ "created_at",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_created_at": {
+ "name": "idx_sessions_created_at",
+ "columns": [
+ "created_at",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_workspace_kind": {
+ "name": "idx_sessions_workspace_kind",
+ "columns": [
+ "workspace_kind"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_parent_session_id": {
+ "name": "idx_sessions_parent_session_id",
+ "columns": [
+ "parent_session_id"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_orca_role": {
+ "name": "idx_sessions_orca_role",
+ "columns": [
+ "orca_role"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_worktree_path": {
+ "name": "idx_sessions_worktree_path",
+ "columns": [
+ "worktree_path"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_feishu_lookup": {
+ "name": "idx_sessions_feishu_lookup",
+ "columns": [
+ "source",
+ "feishu_bot_app_id",
+ "feishu_open_id"
+ ],
+ "isUnique": false
+ },
+ "idx_sessions_im_lookup": {
+ "name": "idx_sessions_im_lookup",
+ "columns": [
+ "source",
+ "im_bot_context_id",
+ "im_user_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "sessions_parent_session_id_sessions_id_fk": {
+ "name": "sessions_parent_session_id_sessions_id_fk",
+ "tableFrom": "sessions",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "parent_session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_exposures": {
+ "name": "skill_usage_exposures",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "raw_line_no": {
+ "name": "raw_line_no",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_name": {
+ "name": "skill_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "skill_path": {
+ "name": "skill_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "skill_document_hash": {
+ "name": "skill_document_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "exposure_content_hash": {
+ "name": "exposure_content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "document_hash_source": {
+ "name": "document_hash_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_use_id": {
+ "name": "tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "seen_at": {
+ "name": "seen_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_call_count": {
+ "name": "tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "repeated_tool_call_count": {
+ "name": "repeated_tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "tool_error_count": {
+ "name": "tool_error_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_call_count": {
+ "name": "command_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "command_failure_count": {
+ "name": "command_failure_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_exposures_skill_document_version": {
+ "name": "idx_skill_usage_exposures_skill_document_version",
+ "columns": [
+ "analyzer_version",
+ "skill_name",
+ "skill_document_hash"
+ ],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent": {
+ "name": "idx_skill_usage_exposures_skill_recent",
+ "columns": [
+ "skill_name",
+ "analyzer_version",
+ "seen_at"
+ ],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_skill_recent_any_version": {
+ "name": "idx_skill_usage_exposures_skill_recent_any_version",
+ "columns": [
+ "skill_name",
+ "seen_at"
+ ],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_analyzer_recent_source": {
+ "name": "idx_skill_usage_exposures_analyzer_recent_source",
+ "columns": [
+ "analyzer_version",
+ "seen_at",
+ "raw_file_path"
+ ],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_session": {
+ "name": "idx_skill_usage_exposures_session",
+ "columns": [
+ "session_id"
+ ],
+ "isUnique": false
+ },
+ "idx_skill_usage_exposures_raw_file": {
+ "name": "idx_skill_usage_exposures_raw_file",
+ "columns": [
+ "raw_file_path"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk": {
+ "name": "skill_usage_exposures_raw_file_path_skill_usage_sources_raw_file_path_fk",
+ "tableFrom": "skill_usage_exposures",
+ "tableTo": "skill_usage_sources",
+ "columnsFrom": [
+ "raw_file_path"
+ ],
+ "columnsTo": [
+ "raw_file_path"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "skill_usage_sources": {
+ "name": "skill_usage_sources",
+ "columns": {
+ "raw_file_path": {
+ "name": "raw_file_path",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "analyzer_version": {
+ "name": "analyzer_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'6'"
+ },
+ "agent_kind": {
+ "name": "agent_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mtime_ms": {
+ "name": "mtime_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_scanned_at": {
+ "name": "last_scanned_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ok'"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_skill_usage_sources_session": {
+ "name": "idx_skill_usage_sources_session",
+ "columns": [
+ "session_id"
+ ],
+ "isUnique": false
+ },
+ "idx_skill_usage_sources_sdk_session": {
+ "name": "idx_skill_usage_sources_sdk_session",
+ "columns": [
+ "sdk_session_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_run_aliases": {
+ "name": "subagent_run_aliases",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_run_aliases_lookup_idx": {
+ "name": "subagent_run_aliases_lookup_idx",
+ "columns": [
+ "session_id",
+ "provider",
+ "alias",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_run_aliases_session_id_sessions_id_fk": {
+ "name": "subagent_run_aliases_session_id_sessions_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "subagent_run_aliases_run_id_subagent_runs_id_fk": {
+ "name": "subagent_run_aliases_run_id_subagent_runs_id_fk",
+ "tableFrom": "subagent_run_aliases",
+ "tableTo": "subagent_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "subagent_run_aliases_run_id_alias_pk": {
+ "columns": [
+ "run_id",
+ "alias"
+ ],
+ "name": "subagent_run_aliases_run_id_alias_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subagent_runs": {
+ "name": "subagent_runs",
+ "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
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "logical_agent_id": {
+ "name": "logical_agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parent_tool_use_id": {
+ "name": "parent_tool_use_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "aliases": {
+ "name": "aliases",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "provider_run_ids": {
+ "name": "provider_run_ids",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'running'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result": {
+ "name": "returned_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_empty": {
+ "name": "returned_result_empty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "returned_result_truncated": {
+ "name": "returned_result_truncated",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tool_uses": {
+ "name": "tool_uses",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "activity": {
+ "name": "activity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "rewind_at": {
+ "name": "rewind_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "subagent_runs_logical_idx": {
+ "name": "subagent_runs_logical_idx",
+ "columns": [
+ "session_id",
+ "provider",
+ "logical_agent_id"
+ ],
+ "isUnique": false
+ },
+ "subagent_runs_session_idx": {
+ "name": "subagent_runs_session_idx",
+ "columns": [
+ "session_id",
+ "rewind_at",
+ "deleted_at",
+ "started_at"
+ ],
+ "isUnique": false
+ },
+ "subagent_runs_parent_tool_use_idx": {
+ "name": "subagent_runs_parent_tool_use_idx",
+ "columns": [
+ "session_id",
+ "parent_tool_use_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "subagent_runs_session_id_sessions_id_fk": {
+ "name": "subagent_runs_session_id_sessions_id_fk",
+ "tableFrom": "subagent_runs",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task_tags": {
+ "name": "task_tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name_customized": {
+ "name": "name_customized",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "favorite_order": {
+ "name": "favorite_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "task_tags_name_idx": {
+ "name": "task_tags_name_idx",
+ "columns": [
+ "name"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "vec_table_meta": {
+ "name": "vec_table_meta",
+ "columns": {
+ "vec_table": {
+ "name": "vec_table",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "dim": {
+ "name": "dim",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "registered_at": {
+ "name": "registered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_file_attachments": {
+ "name": "wechat_file_attachments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "abs_path": {
+ "name": "abs_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "original_name": {
+ "name": "original_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "bytes": {
+ "name": "bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'staged'"
+ },
+ "promoted_at": {
+ "name": "promoted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_wechat_file_attachments_task": {
+ "name": "idx_wechat_file_attachments_task",
+ "columns": [
+ "binding_epoch",
+ "task_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_file_attachments_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": [
+ "binding_epoch"
+ ],
+ "columnsTo": [
+ "binding_epoch"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_file_attachments_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_file_attachments_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "wechat_inbox",
+ "columnsFrom": [
+ "task_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_file_attachments_session_id_sessions_id_fk": {
+ "name": "wechat_file_attachments_session_id_sessions_id_fk",
+ "tableFrom": "wechat_file_attachments",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_inbox": {
+ "name": "wechat_inbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_message_id": {
+ "name": "platform_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_seq": {
+ "name": "platform_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "peer_id": {
+ "name": "peer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "platform_created_at": {
+ "name": "platform_created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "lease_until": {
+ "name": "lease_until",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "conversation_epoch": {
+ "name": "conversation_epoch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_nonce": {
+ "name": "context_nonce",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_ciphertext": {
+ "name": "context_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "context_tag": {
+ "name": "context_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_inbox_platform_message": {
+ "name": "uniq_wechat_inbox_platform_message",
+ "columns": [
+ "binding_epoch",
+ "platform_message_id"
+ ],
+ "isUnique": true
+ },
+ "idx_wechat_inbox_queue": {
+ "name": "idx_wechat_inbox_queue",
+ "columns": [
+ "binding_epoch",
+ "status",
+ "received_at"
+ ],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_lease": {
+ "name": "idx_wechat_inbox_lease",
+ "columns": [
+ "binding_epoch",
+ "lease_until"
+ ],
+ "isUnique": false
+ },
+ "idx_wechat_inbox_conversation": {
+ "name": "idx_wechat_inbox_conversation",
+ "columns": [
+ "binding_epoch",
+ "peer_id",
+ "conversation_epoch"
+ ],
+ "isUnique": false
+ },
+ "uniq_wechat_inbox_running_session": {
+ "name": "uniq_wechat_inbox_running_session",
+ "columns": [
+ "binding_epoch",
+ "session_id"
+ ],
+ "isUnique": true,
+ "where": "\"wechat_inbox\".\"session_id\" IS NOT NULL AND \"wechat_inbox\".\"status\" IN ('dispatching', 'accepted_running', 'waiting_desktop', 'delivery_pending')"
+ }
+ },
+ "foreignKeys": {
+ "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_inbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_inbox",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": [
+ "binding_epoch"
+ ],
+ "columnsTo": [
+ "binding_epoch"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_inbox_session_id_sessions_id_fk": {
+ "name": "wechat_inbox_session_id_sessions_id_fk",
+ "tableFrom": "wechat_inbox",
+ "tableTo": "sessions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_outbox": {
+ "name": "wechat_outbox",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chunk_index": {
+ "name": "chunk_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "media_json": {
+ "name": "media_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "next_retry_at": {
+ "name": "next_retry_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_outbox_client_id": {
+ "name": "uniq_wechat_outbox_client_id",
+ "columns": [
+ "binding_epoch",
+ "client_id"
+ ],
+ "isUnique": true
+ },
+ "idx_wechat_outbox_delivery": {
+ "name": "idx_wechat_outbox_delivery",
+ "columns": [
+ "binding_epoch",
+ "status",
+ "next_retry_at"
+ ],
+ "isUnique": false
+ },
+ "idx_wechat_outbox_task": {
+ "name": "idx_wechat_outbox_task",
+ "columns": [
+ "binding_epoch",
+ "task_id",
+ "chunk_index"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk": {
+ "name": "wechat_outbox_binding_epoch_wechat_sync_state_binding_epoch_fk",
+ "tableFrom": "wechat_outbox",
+ "tableTo": "wechat_sync_state",
+ "columnsFrom": [
+ "binding_epoch"
+ ],
+ "columnsTo": [
+ "binding_epoch"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "wechat_outbox_task_id_wechat_inbox_id_fk": {
+ "name": "wechat_outbox_task_id_wechat_inbox_id_fk",
+ "tableFrom": "wechat_outbox",
+ "tableTo": "wechat_inbox",
+ "columnsFrom": [
+ "task_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "wechat_sync_state": {
+ "name": "wechat_sync_state",
+ "columns": {
+ "binding_epoch": {
+ "name": "binding_epoch",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "sync_cursor": {
+ "name": "sync_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "last_poll_at": {
+ "name": "last_poll_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "uniq_wechat_sync_active": {
+ "name": "uniq_wechat_sync_active",
+ "columns": [
+ "is_active"
+ ],
+ "isUnique": true,
+ "where": "\"wechat_sync_state\".\"is_active\" = 1"
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {
+ "uniq_orca_worker_creation_reservations_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ },
+ "uniq_orca_workers_team_label": {
+ "columns": {
+ "lower(\"label\")": {
+ "isExpression": true
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/desktop/drizzle/meta/_journal.json b/apps/desktop/drizzle/meta/_journal.json
index 427489f765..10b6787346 100644
--- a/apps/desktop/drizzle/meta/_journal.json
+++ b/apps/desktop/drizzle/meta/_journal.json
@@ -771,6 +771,34 @@
"when": 1789622514585,
"tag": "0109_deep_wolfpack",
"breakpoints": true
+ },
+ {
+ "idx": 110,
+ "version": "6",
+ "when": 1789691942187,
+ "tag": "0110_abandoned_scarlet_witch",
+ "breakpoints": true
+ },
+ {
+ "idx": 111,
+ "version": "6",
+ "when": 1789697150336,
+ "tag": "0111_messy_newton_destine",
+ "breakpoints": true
+ },
+ {
+ "idx": 112,
+ "version": "6",
+ "when": 1789698166692,
+ "tag": "0112_backfill_task_tag_order",
+ "breakpoints": true
+ },
+ {
+ "idx": 113,
+ "version": "6",
+ "when": 1789868885746,
+ "tag": "0113_grey_cannonball",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/apps/desktop/src/main/device-link/__tests__/dispatchSendSafety.test.ts b/apps/desktop/src/main/device-link/__tests__/dispatchSendSafety.test.ts
index 1beb54ca16..18f233b219 100644
--- a/apps/desktop/src/main/device-link/__tests__/dispatchSendSafety.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/dispatchSendSafety.test.ts
@@ -987,39 +987,50 @@ describe('background database admission covers the complete remote list lifecycl
} finally { finish(); await list; }
});
- it('rechecks cached and backpressured lists using background admission and fresh visibility', async () => {
+ it.each([false, true])(
+ 'rechecks cached and backpressured lists using background admission and fresh visibility (catalog: %s)', async (catalog) => {
const admissions: string[] = [];
let hidden = false;
setRemoteBotSessionLookup(async () => {
admissions.push(currentDbRpcAdmissionClass());
return hidden ? 'hidden' : 'ordinary';
});
- const handler = vi.fn(() => [{ id: 's1' }]);
+ const rows = [{ id: 's1', tags: [{ id: 'private', name: 'Private label' }] }];
+ const args = catalog ? [20, 'active', { tagCatalog: 1 }] : [];
+ const emptyResult = catalog
+ ? { format: 'session-tag-catalog-v1', sessions: [], tags: [] }
+ : [];
+ const handler = vi.fn(() => rows);
registry.register('local-db:sessions:list', handler);
const client = mkClient();
wireInboundDispatch(client as never);
const frame = client.onFrame.mock.calls[0][0];
- const request = { v: PROTOCOL_VERSION, kind: 'invoke', src: 'ctrl-1', id: 'cached-list', payload: { channel: 'local-db:sessions:list', args: [] } };
+ const request = { v: PROTOCOL_VERSION, kind: 'invoke', src: 'ctrl-1', id: 'cached-list', payload: { channel: 'local-db:sessions:list', args },
+ };
frame(request);
await vi.waitFor(() => expect(client.sendInvokeResult).toHaveBeenCalledTimes(1));
admissions.length = 0;
hidden = true;
frame(request);
await vi.waitFor(() => expect(client.sendInvokeResult).toHaveBeenCalledTimes(2));
- expect(client.sendInvokeResult.mock.calls[1][2]).toMatchObject({ ok: true, result: [] });
+ expect(client.sendInvokeResult.mock.calls[1][2]).toEqual({ ok: true, result: emptyResult });
expect(handler).toHaveBeenCalledTimes(1);
expect(admissions.length).toBeGreaterThan(0);
expect(new Set(admissions)).toEqual(new Set(['background']));
admissions.length = 0;
client.sendInvokeResult.mockImplementationOnce(() => { throw new DeviceLinkError('BACKPRESSURE', 'full'); });
- __testing.sendInvokeResultSafe(client as never, 'ctrl-1', 'queued-list', { ok: true, result: [{ id: 's1' }] }, 'local-db:sessions:list', []);
+ __testing.sendInvokeResultSafe(client as never, 'ctrl-1', 'queued-list', { ok: true, result: rows }, 'local-db:sessions:list',
+ args,
+ );
__testing.flushRemoteInvokeResultOutbox();
await vi.waitFor(() => expect(__testing.remoteInvokeResultOutboxSize()).toBe(0));
- expect(client.sendInvokeResult.mock.calls.at(-1)![2]).toMatchObject({ ok: true, result: [] });
+ expect(client.sendInvokeResult.mock.calls.at(-1)![2]).toEqual({ ok: true, result: emptyResult,
+ });
expect(admissions.length).toBeGreaterThan(0);
expect(new Set(admissions)).toEqual(new Set(['background']));
- });
+ },
+ );
});
diff --git a/apps/desktop/src/main/device-link/__tests__/remoteBotSessionBoundary.test.ts b/apps/desktop/src/main/device-link/__tests__/remoteBotSessionBoundary.test.ts
index 62e51a3f6f..913b8608cb 100644
--- a/apps/desktop/src/main/device-link/__tests__/remoteBotSessionBoundary.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/remoteBotSessionBoundary.test.ts
@@ -1,5 +1,7 @@
import { afterEach, expect, it, vi } from 'vitest';
-import { projectRemoteSessionResult, setRemoteBotSessionLookup } from '../remoteBotSessionBoundary';
+import {
+ assertRemoteBotInvocationAllowed,
+ projectRemoteSessionResult, setRemoteBotSessionLookup } from '../remoteBotSessionBoundary';
afterEach(() => setRemoteBotSessionLookup(null));
@@ -54,3 +56,64 @@ it('filters batch detail reads using the shared fresh visibility lookup', async
expect(await projectRemoteSessionResult('local-db:sessions:get-many', [{ id: 's' }])).toEqual([]);
expect(batch).toHaveBeenCalledTimes(2);
});
+
+it('checks every target of a label batch and filters only task rows in label results', async () => {
+ setRemoteBotSessionLookup(async (id) => (id === 'hidden' ? 'hidden' : 'ordinary'));
+ await expect(
+ assertRemoteBotInvocationAllowed(
+ [{ action: 'attach', sessionIds: ['ordinary', 'hidden'], tagIds: ['label'] }],
+ 'local-db:task-tags:execute',
+ ),
+ ).rejects.toThrow('[NOT_FOUND]');
+ const tags = [{ id: 'hidden', name: 'A label ID is not a task ID' }];
+ expect(
+ await projectRemoteSessionResult('local-db:task-tags:execute', {
+ tags,
+ sessions: [
+ { sessionId: 'ordinary', tags: [] },
+ { sessionId: 'hidden', tags: [] },
+ ],
+ }),
+ ).toEqual({ tags, sessions: [{ sessionId: 'ordinary', tags: [] }] });
+});
+
+it.each(['get', 'attach', 'detach'])('checks normalized task IDs for tag %s', async (action) => {
+ setRemoteBotSessionLookup(async (id) => (id === 'hidden' ? 'hidden' : 'missing'));
+ await expect(
+ assertRemoteBotInvocationAllowed(
+ [{ action, sessionIds: [' hidden '], tagIds: ['label'] }],
+ 'local-db:task-tags:execute',
+ ),
+ ).rejects.toThrow('[NOT_FOUND]');
+});
+
+it.each([
+ undefined, [], [''], [' '], [123], ['x'.repeat(129)],
+ Array.from({ length: 101 }, () => 'same'),
+ Array.from({ length: 10000 }, (_, i) => `session-${i}`),
+])('rejects malformed tag targets before any authorization lookup (%#)', async (sessionIds) => {
+ const lookup = vi.fn(async () => 'ordinary' as const);
+ setRemoteBotSessionLookup(lookup);
+ await expect(assertRemoteBotInvocationAllowed(
+ [{ action: 'get', sessionIds }], 'local-db:task-tags:execute',
+ )).rejects.toThrow('[INVALID_PARAMS]');
+ expect(lookup).not.toHaveBeenCalled();
+});
+
+it('bounds normalized tag authorization and ignores unrelated object references', async () => {
+ const lookup = vi.fn(async () => 'ordinary' as const);
+ setRemoteBotSessionLookup(lookup);
+ const sessionIds = Array.from({ length: 100 }, (_, i) => ` ${String(i).padStart(128, 'x')} `);
+ await assertRemoteBotInvocationAllowed(
+ [{ action: 'get', sessionIds, sessionId: 'unused', session: { id: 'unused' } }],
+ 'local-db:task-tags:execute',
+ );
+ expect(lookup).toHaveBeenCalledTimes(100);
+ expect(lookup).toHaveBeenNthCalledWith(1, sessionIds[0].trim(), 'session');
+ lookup.mockClear();
+ await assertRemoteBotInvocationAllowed(
+ [{ action: 'attach', sessionIds: [' task ', 'task'], tagIds: ['label'] }],
+ 'local-db:task-tags:execute',
+ );
+ expect(lookup).toHaveBeenCalledTimes(1);
+});
diff --git a/apps/desktop/src/main/device-link/dispatch.ts b/apps/desktop/src/main/device-link/dispatch.ts
index 20e3d7f785..f4508db79c 100644
--- a/apps/desktop/src/main/device-link/dispatch.ts
+++ b/apps/desktop/src/main/device-link/dispatch.ts
@@ -1,4 +1,10 @@
-import { FILE_PEER_CHANNEL } from '@cindy/device-link';
+import { executeTaskTags, TASK_TAG_CHANNEL } from '../localDb/ipc/taskTags.js';
+import type { TaskTagRequest } from '@cindy/maker-shared';
+import {
+ FILE_PEER_CHANNEL,
+ encodeSessionTagCatalog,
+ decodeSessionTagCatalog,
+} from '@cindy/device-link';
import { requestFilePeer, stopFilePeers } from './filePeer';
import { normalizeProviderOrder } from "../../shared/providerOrder.js";
/**
@@ -356,7 +362,8 @@ export function setRemoteSettingsPersist(fn: RemoteSettingsPersist | null): void
}
/** set-* channel → 持久化的 session 字段名(args[0]=sessionId, args[1]=value)。 */
-const SET_CHANNEL_FIELD: Record<string, 'model' | 'effort' | 'permissionMode' | 'fastMode' | 'planModeEnabled' | 'extraDirs' | 'writableDirs'> = {
+const SET_CHANNEL_FIELD: Record<string,
+ | 'model' | 'effort' | 'permissionMode' | 'fastMode' | 'planModeEnabled' | 'extraDirs' | 'writableDirs'> = {
'maker:set-model': 'model',
'maker:set-effort': 'effort',
'maker:set-permission-mode': 'permissionMode',
@@ -1625,7 +1632,7 @@ function drainSessionActivityStage(dst: string, stage: SessionActivityStage): vo
return;
}
const next = stage.queue.entries().next().value as
- | [string, { payload: unknown; ownerStamp?: PushOwnerStamp }]
+ [string, { payload: unknown; ownerStamp?: PushOwnerStamp }]
| undefined;
if (!next) return;
const [key, item] = next;
@@ -2849,7 +2856,13 @@ async function authorizeRemoteBotResult(
if (!result.ok) return result;
try {
await assertRemoteBotInvocationAllowed(args ?? [], channel);
- return { ok: true, result: await projectRemoteSessionResult(channel ?? '', result.result) };
+ return {
+ ok: true,
+ result: await projectRemoteSessionResult(
+ channel ?? '',
+ decodeSessionTagCatalog(channel, result.result),
+ ),
+ };
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
if (isDbWorkerOverloadedError(message) && isCompletedInvokeRetryableReadChannel(channel)) {
@@ -2894,7 +2907,17 @@ function sendInvokeResultSafe(
fingerprint?: string,
): boolean {
const key = `${src}\u0000${requestId}`;
- const normalized = sanitizeMessageInvokeResult(normalizeInvokeResultForWire(result), channel);
+ const sanitized = sanitizeMessageInvokeResult(normalizeInvokeResultForWire(result), channel);
+ const normalized = sanitized.ok && channel === 'local-db:sessions:list'
+ ? {
+ ...sanitized,
+ result: encodeSessionTagCatalog(
+ channel,
+ args,
+ decodeSessionTagCatalog(channel, sanitized.result),
+ ),
+ }
+ : sanitized;
const proactive =
subscriptions.controllerSupports(src, DEVICE_LINK_CAPABILITY_COMPACT_MESSAGE_HISTORY_V1) &&
channel === 'local-db:messages:list' && normalized.ok && Array.isArray(normalized.result)
@@ -3755,7 +3778,10 @@ async function executeRemoteInvoke(src: string, payload: InvokePayload | undefin
historyView,
},
// provider:list 的首参只承载隧道能力协商,不进入本机 IPC handler。
- () => dispatchLocalInvoke(
+ () =>
+ payload.channel === TASK_TAG_CHANNEL
+ ? executeTaskTags(args[0] as TaskTagRequest)
+ : dispatchLocalInvoke(
payload.channel,
payload.channel === 'maker:provider:list' ? [] : args,
),
diff --git a/apps/desktop/src/main/device-link/remoteBotSessionBoundary.ts b/apps/desktop/src/main/device-link/remoteBotSessionBoundary.ts
index 85643034a1..691b75dde2 100644
--- a/apps/desktop/src/main/device-link/remoteBotSessionBoundary.ts
+++ b/apps/desktop/src/main/device-link/remoteBotSessionBoundary.ts
@@ -16,12 +16,35 @@ function record(value: unknown): Record<string, unknown> | null {
function sessionIds(value: unknown): string[] {
const row = record(value);
if (!row) return [];
- return [row.sessionId, row.parentSessionId, record(row.session)?.id, record(row.message)?.sessionId]
+ return [
+ ...(Array.isArray(row.sessionIds) ? row.sessionIds : []),
+ row.sessionId, row.parentSessionId, record(row.session)?.id, record(row.message)?.sessionId]
.filter((id): id is string => typeof id === 'string' && id.length > 0);
}
/** Resolve channel-specific Bot IDs before checking generic Session references. */
export async function assertRemoteBotInvocationAllowed(args: unknown[], channel = ''): Promise<void> {
+ if (channel === 'local-db:task-tags:execute') {
+ const request = record(args[0]);
+ const targets = request?.sessionIds;
+ // Match taskTagsTx's ids(..., 100) / text(..., 128) before any DB lookup.
+ // Only sessionIds is consumed by this channel; unrelated object fields must
+ // not manufacture additional authorization queries.
+ if (!request || args.length !== 1 || (
+ targets !== undefined && (
+ !Array.isArray(targets) || !targets.length || targets.length > 100 ||
+ targets.some((id) => typeof id !== 'string' || !id.trim() || id.trim().length > 128)
+ )
+ ) || (['get', 'attach', 'detach'].includes(String(request.action)) && targets === undefined)) {
+ throw new Error('[INVALID_PARAMS] Invalid task tag session IDs');
+ }
+ if (lookup && Array.isArray(targets)) {
+ for (const id of new Set(targets.map((id: string) => id.trim()))) {
+ if (await lookup(id, 'session') === 'hidden') throw new Error('[NOT_FOUND] Session does not exist');
+ }
+ }
+ return;
+ }
if (!lookup) return;
if (channel === 'maker:bot-direct-message-thread:get') {
// The first argument is an opaque thread ID, not a Session. The local service
@@ -37,7 +60,8 @@ export async function assertRemoteBotInvocationAllowed(args: unknown[], channel
...(index === 0 && typeof arg === 'string' ? [arg] : []), ...sessionIds(arg),
]));
for (const id of ids) {
- if (await lookup(id, channel.startsWith('local-db:bots:') ? 'bot' : 'session') === 'hidden') throw new Error('[NOT_FOUND] Session does not exist');
+ if (
+ (await lookup(id, channel.startsWith('local-db:bots:') ? 'bot' : 'session')) === 'hidden') throw new Error('[NOT_FOUND] Session does not exist');
}
for (const arg of args) {
const row = record(arg);
@@ -49,7 +73,17 @@ export async function assertRemoteBotInvocationAllowed(args: unknown[], channel
}
export async function projectRemoteSessionResult(channel: string, value: unknown): Promise<unknown> {
- if (!lookup || !['local-db:sessions:get', 'local-db:sessions:get-many', 'local-db:sessions:list', 'maker:list-active', 'local-db:sessions:interrupted-pending', 'local-db:bots:get', 'local-db:bots:list', 'maker:remote-resources:get', 'maker:remote-resources:list'].includes(channel)) return value;
+ if (!lookup || ![
+ 'local-db:task-tags:execute',
+ 'local-db:sessions:get', 'local-db:sessions:get-many', 'local-db:sessions:list', 'maker:list-active', 'local-db:sessions:interrupted-pending', 'local-db:bots:get', 'local-db:bots:list', 'maker:remote-resources:get', 'maker:remote-resources:list'].includes(channel)) return value;
+ if (channel === 'local-db:task-tags:execute') {
+ const row = record(value);
+ if (!row) return value;
+ return {
+ ...row,
+ sessions: await projectRemoteSessionResult('local-db:sessions:list', row.sessions),
+ };
+ }
const activeLookup = lookup;
const activeBatchLookup = batchLookup;
const identity = (item: unknown) => {
diff --git a/apps/desktop/src/main/localDb/__tests__/dbSlimmingUpgradeOrder.test.ts b/apps/desktop/src/main/localDb/__tests__/dbSlimmingUpgradeOrder.test.ts
index e8767d3f39..81f5c91137 100644
--- a/apps/desktop/src/main/localDb/__tests__/dbSlimmingUpgradeOrder.test.ts
+++ b/apps/desktop/src/main/localDb/__tests__/dbSlimmingUpgradeOrder.test.ts
@@ -26,7 +26,7 @@ describe('database cleanup and upgrade startup order', () => {
open,
);
const migration = source.indexOf(
- 'runMigrations: () => runMigrations(db, filePath)',
+ 'await runMigrations(db, filePath)',
schemaStartup,
);
diff --git a/apps/desktop/src/main/localDb/__tests__/migrationReplay.test.ts b/apps/desktop/src/main/localDb/__tests__/migrationReplay.test.ts
index ca9e715488..cf4fbdb189 100644
--- a/apps/desktop/src/main/localDb/__tests__/migrationReplay.test.ts
+++ b/apps/desktop/src/main/localDb/__tests__/migrationReplay.test.ts
@@ -7,6 +7,7 @@ import { describe, expect, it } from 'vitest';
import { createBetterSqliteDatabase } from '../betterSqliteFactory';
import { listMigrations, runMigrationReplay } from '../migrationRunner';
+import { initializeTaskTagPresets } from '../taskTagPresets';
const canRunMigrationReplay = process.platform === 'win32' || process.platform === 'darwin';
const describeMigrationReplay = canRunMigrationReplay ? describe : describe.skip;
@@ -102,6 +103,24 @@ function columnNames(db: Database.Database, tableName: string): string[] {
}
describeMigrationReplay('migration replay', () => {
+ it('commits the complete fresh schema and task presets in one outer transaction', () => {
+ const { db, cleanup } = createTempDb();
+ try {
+ db.transaction(() => {
+ runMigrationReplay(db, { drizzleDir: drizzleDir() });
+ initializeTaskTagPresets(db);
+ })();
+ expect(
+ db.prepare("SELECT value FROM migration_meta WHERE key='schema_version'").pluck().get(),
+ ).toBe(String(maxMigrationSeq()));
+ expect(
+ db.prepare("SELECT count(*) FROM task_tags WHERE id LIKE 'preset:%'").pluck().get(),
+ ).toBe(6);
+ expect(db.prepare('SELECT count(*) FROM task_tags').pluck().get()).toBe(12);
+ } finally {
+ cleanup();
+ }
+ });
it('adds runtime provenance without certifying or changing legacy context values', () => {
const { db, cleanup } = createTempDb();
const stagedDir = mkdtempSync(path.join(tmpdir(), 'cindy-context-provenance-'));
diff --git a/apps/desktop/src/main/localDb/__tests__/taskTagPresetMigration.test.ts b/apps/desktop/src/main/localDb/__tests__/taskTagPresetMigration.test.ts
new file mode 100644
index 0000000000..6790d75c3a
--- /dev/null
+++ b/apps/desktop/src/main/localDb/__tests__/taskTagPresetMigration.test.ts
@@ -0,0 +1,100 @@
+import { mkdtempSync, mkdirSync, copyFileSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { createBetterSqliteDatabase } from '../betterSqliteFactory';
+import { runMigrations } from '../migrate';
+import { readSchemaVersion, runMigrationReplay } from '../migrationRunner';
+import type Database from 'better-sqlite3';
+
+vi.mock('electron', () => ({ app: { isPackaged: true } }));
+vi.mock('../../logger', () => ({
+ createLogger: () => ({ info: vi.fn(), warn: vi.fn(), error: vi.fn() }),
+}));
+vi.mock('../backup', () => ({
+ backupDb: vi.fn(async () => ({ noDb: true })),
+ estimateDbSizeBytes: () => 0,
+ getFreeDiskBytes: () => null,
+ isoBackupTotalBudgetBytes: () => 0,
+ pruneIsoBackupsToBudget: () => [],
+}));
+let db: Database.Database;
+let dir: string;
+const resourcesDescriptor = Object.getOwnPropertyDescriptor(process, 'resourcesPath');
+beforeEach(() => {
+ dir = mkdtempSync(path.join(tmpdir(), 'tag-migration-'));
+ mkdirSync(path.join(dir, 'drizzle'));
+ for (const file of [
+ '0110_abandoned_scarlet_witch.sql',
+ '0111_messy_newton_destine.sql',
+ '0112_backfill_task_tag_order.sql',
+ ]) {
+ copyFileSync(
+ fileURLToPath(new URL(`../../../../drizzle/${file}`, import.meta.url)),
+ path.join(dir, 'drizzle', file),
+ );
+ }
+ Object.defineProperty(process, 'resourcesPath', { configurable: true, value: dir });
+ db = createBetterSqliteDatabase(':memory:');
+ db.exec(
+ "CREATE TABLE sessions(id TEXT PRIMARY KEY); CREATE TABLE migration_meta(key TEXT PRIMARY KEY,value TEXT); INSERT INTO migration_meta VALUES('schema_version','109');",
+ );
+ db.exec(
+ 'CREATE TABLE migration_history(seq INTEGER PRIMARY KEY,file_name TEXT,content_hash TEXT,applied_at INTEGER)',
+ );
+});
+afterEach(() => {
+ db.close();
+ rmSync(dir, { recursive: true, force: true });
+ if (resourcesDescriptor) Object.defineProperty(process, 'resourcesPath', resourcesDescriptor);
+ else delete (process as any).resourcesPath;
+});
+it('rolls back schema and catalog if first preset initialization fails, then retries', async () => {
+ // Fail during preset insertion, after every pending migration has executed.
+ const prepare = db.prepare.bind(db);
+ const spy = vi.spyOn(db, 'prepare').mockImplementation((sql: string) => {
+ if (sql === 'INSERT INTO task_tags(id,name,color,favorite_order,sort_order) VALUES(?,?,?,?,?)')
+ throw new Error('seed failure');
+ return prepare(sql);
+ });
+ await expect(runMigrations(db, path.join(dir, 'test.db'))).rejects.toThrow('seed failure');
+ expect(readSchemaVersion(db)).toBe(109);
+ expect(prepare('SELECT count(*) AS n FROM migration_history').get()).toEqual({ n: 0 });
+ expect(prepare("SELECT name FROM sqlite_master WHERE name='task_tags'").get()).toBeUndefined();
+ spy.mockRestore();
+ await runMigrations(db, path.join(dir, 'test.db'));
+ expect(readSchemaVersion(db)).toBe(112);
+ expect(db.prepare('SELECT seq FROM migration_history ORDER BY seq').all()).toEqual([
+ { seq: 110 },
+ { seq: 111 },
+ { seq: 112 },
+ ]);
+ expect(db.prepare('SELECT id FROM task_tags ORDER BY sort_order').all()).toEqual([
+ ...['red', 'orange', 'yellow', 'green', 'blue', 'purple'].map((id) => ({
+ id: `default:${id}`,
+ })),
+ ...['important', 'follow-up', 'work', 'life', 'ideas', 'reference'].map((id) => ({
+ id: `preset:${id}`,
+ })),
+ ]);
+ expect(
+ db.prepare('SELECT sort_order, favorite_order FROM task_tags ORDER BY sort_order').all(),
+ ).toEqual(
+ Array.from({ length: 12 }, (_, index) => ({ sort_order: index, favorite_order: index })),
+ );
+ db.prepare("DELETE FROM task_tags WHERE id='default:red'").run();
+ await runMigrations(db, path.join(dir, 'test.db'));
+ expect(db.prepare('SELECT count(*) AS n FROM task_tags').get()).toEqual({ n: 11 });
+});
+it('preserves an existing tag catalog when upgrading from the tag schema', async () => {
+ runMigrationReplay(db, { drizzleDir: path.join(dir, 'drizzle'), currentVersion: 109 });
+ db.exec(
+ "UPDATE migration_meta SET value='111' WHERE key='schema_version'; UPDATE task_tags SET name='Custom',revision=2 WHERE id='default:red';",
+ );
+ await runMigrations(db, path.join(dir, 'test.db'));
+ expect(db.prepare("SELECT name FROM task_tags WHERE id='default:red'").get()).toEqual({
+ name: 'Custom',
+ });
+ expect(db.prepare('SELECT count(*) AS n FROM task_tags').get()).toEqual({ n: 7 });
+});
diff --git a/apps/desktop/src/main/localDb/__tests__/taskTags.test.ts b/apps/desktop/src/main/localDb/__tests__/taskTags.test.ts
new file mode 100644
index 0000000000..1eb1384e99
--- /dev/null
+++ b/apps/desktop/src/main/localDb/__tests__/taskTags.test.ts
@@ -0,0 +1,214 @@
+import { readFileSync } from 'node:fs';
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
+import { createBetterSqliteDatabase } from '../betterSqliteFactory';
+import { runTaskTagsTransaction } from '../worker/opHandlers/taskTagsTx';
+import type Database from 'better-sqlite3';
+
+describe('task labels transactions', () => {
+ let db: Database.Database;
+ beforeEach(() => {
+ db = createBetterSqliteDatabase(':memory:');
+ db.pragma('foreign_keys=ON');
+ db.exec(
+ "CREATE TABLE sessions(id TEXT PRIMARY KEY,status TEXT DEFAULT 'active',source TEXT DEFAULT 'desktop',updated_at INTEGER DEFAULT 1); CREATE TABLE bot_session_links(session_id TEXT); INSERT INTO sessions(id) VALUES('a'),('b');",
+ );
+ db.exec(
+ readFileSync(
+ new URL('../../../../drizzle/0110_abandoned_scarlet_witch.sql', import.meta.url),
+ 'utf8',
+ ),
+ );
+ db.exec(
+ readFileSync(
+ new URL('../../../../drizzle/0111_messy_newton_destine.sql', import.meta.url),
+ 'utf8',
+ ),
+ );
+ db.exec(
+ readFileSync(
+ new URL('../../../../drizzle/0112_backfill_task_tag_order.sql', import.meta.url),
+ 'utf8',
+ ),
+ );
+ });
+ beforeEach(() =>
+ db.exec(
+ readFileSync(
+ new URL('../../../../drizzle/0113_grey_cannonball.sql', import.meta.url),
+ 'utf8',
+ ),
+ ),
+ );
+ afterEach(() => db.close());
+ const run = (input: unknown) => runTaskTagsTransaction(db, input);
+ it('persists explicit same-canonical rename while preserving legacy recoloring', () => {
+ let red = run({
+ action: 'update',
+ tagId: 'default:red',
+ revision: 1,
+ name: 'Red',
+ color: 'blue',
+ }).tags.find((t) => t.id === 'default:red')!;
+ expect(red.nameCustomized).toBe(false);
+ red = run({
+ action: 'update',
+ tagId: red.id,
+ revision: red.revision,
+ name: 'Red',
+ nameCustomized: true,
+ }).tags.find((t) => t.id === red.id)!;
+ expect(red.nameCustomized).toBe(true);
+ run({ action: 'update', tagId: red.id, revision: red.revision, color: 'green' });
+ run({ action: 'attach', sessionIds: ['a'], tagIds: [red.id] });
+ expect(run({ action: 'get', sessionIds: ['a'] }).sessions[0].tags[0]).toMatchObject({
+ name: 'Red',
+ nameCustomized: true,
+ color: 'green',
+ });
+ expect(() =>
+ run({ action: 'update', tagId: red.id, revision: 4, nameCustomized: true }),
+ ).toThrow();
+ });
+ it('seeds exactly seven favorites, preserves unrelated tags and is idempotent', () => {
+ expect(run({ action: 'list' }).tags).toHaveLength(7);
+ run({ action: 'attach', sessionIds: ['a'], tagIds: ['default:red'] });
+ run({ action: 'attach', sessionIds: ['a', 'b'], tagIds: ['default:blue'] });
+ const again = run({ action: 'attach', sessionIds: ['a'], tagIds: ['default:blue'] });
+ expect(again.sessions[0].tags.map((t) => t.id).sort()).toEqual(['default:blue', 'default:red']);
+ expect(
+ run({ action: 'detach', sessionIds: ['a'], tagIds: ['default:red'] }).sessions[0].tags.map(
+ (t) => t.id,
+ ),
+ ).toEqual(['default:blue']);
+ });
+ it('rolls back batches with missing tasks or invalid tags', () => {
+ expect(() =>
+ run({ action: 'attach', sessionIds: ['a', 'missing'], tagIds: ['default:red'] }),
+ ).toThrow('NOT_FOUND');
+ expect(run({ action: 'get', sessionIds: ['a'] }).sessions[0].tags).toEqual([]);
+ expect(() =>
+ run({ action: 'attach', sessionIds: ['a'], tagIds: ['default:red', 'missing'] }),
+ ).toThrow('NOT_FOUND');
+ expect(run({ action: 'get', sessionIds: ['a'] }).sessions[0].tags).toEqual([]);
+ });
+ it('rejects stale delete previews even when association count stays unchanged', () => {
+ run({ action: 'attach', sessionIds: ['a'], tagIds: ['default:red'] });
+ const preview = run({ action: 'previewDelete', tagId: 'default:red' }).deletion!;
+ run({ action: 'detach', sessionIds: ['a'], tagIds: ['default:red'] });
+ run({ action: 'attach', sessionIds: ['b'], tagIds: ['default:red'] });
+ expect(() =>
+ run({
+ action: 'delete',
+ tagId: 'default:red',
+ revision: preview.revision,
+ expectedCount: preview.count,
+ }),
+ ).toThrow('CONFLICT');
+ });
+ it('deletes associations including archives, retaining tasks and other tags', () => {
+ db.exec("UPDATE sessions SET status='archived' WHERE id='b'");
+ run({ action: 'attach', sessionIds: ['a', 'b'], tagIds: ['default:red', 'default:blue'] });
+ const preview = run({ action: 'previewDelete', tagId: 'default:red' }).deletion!;
+ const result = run({
+ action: 'delete',
+ tagId: preview.tagId,
+ revision: preview.revision,
+ expectedCount: preview.count,
+ });
+ expect(result.sessions).toHaveLength(0);
+ const remaining = run({ action: 'get', sessionIds: ['a', 'b'] });
+ expect(remaining.sessions.every((s) => s.tags.length === 1)).toBe(true);
+ expect(db.prepare('SELECT count(*) AS n FROM sessions').get()).toEqual({ n: 2 });
+ });
+ it('excludes deleted tasks from previews while retaining archives and cleaning all associations', () => {
+ db.exec("INSERT INTO sessions(id,status) VALUES('c','archived')");
+ run({ action: 'attach', sessionIds: ['a', 'b', 'c'], tagIds: ['default:red'] });
+ const stale = run({ action: 'previewDelete', tagId: 'default:red' }).deletion!;
+ db.exec("UPDATE sessions SET status='deleted' WHERE id='b'");
+ expect(() =>
+ run({
+ action: 'delete',
+ tagId: stale.tagId,
+ revision: stale.revision,
+ expectedCount: stale.count,
+ }),
+ ).toThrow('CONFLICT');
+ const preview = run({ action: 'previewDelete', tagId: 'default:red' }).deletion!;
+ expect(preview.count).toBe(2);
+ run({
+ action: 'delete',
+ tagId: preview.tagId,
+ revision: preview.revision,
+ expectedCount: preview.count,
+ });
+ expect(db.prepare('SELECT count(*) AS n FROM session_task_tags').get()).toEqual({ n: 0 });
+ expect(db.prepare('SELECT count(*) AS n FROM sessions').get()).toEqual({ n: 3 });
+ });
+ it('checks favorite cap, name uniqueness, colors and stale edit revisions', () => {
+ expect(() =>
+ run({ action: 'create', newId: 'x', name: 'Work', color: 'red', favorite: true }),
+ ).toThrow('FAVORITES_FULL');
+ expect(() => run({ action: 'create', newId: 'x', name: ' RED ', color: 'red' })).toThrow(
+ 'ALREADY_EXISTS',
+ );
+ expect(() => run({ action: 'create', newId: 'x', name: 'Work', color: 'invisible' })).toThrow(
+ 'INVALID_PARAMS',
+ );
+ run({ action: 'update', tagId: 'default:red', revision: 1, name: 'Urgent' });
+ expect(() =>
+ run({ action: 'update', tagId: 'default:red', revision: 1, color: 'blue' }),
+ ).toThrow('CONFLICT');
+ });
+ it('denies missing and bot callers at the write transaction boundary', () => {
+ expect(() =>
+ run({ action: 'create', newId: 'x', name: 'Work', color: 'red', callerSessionId: 'missing' }),
+ ).toThrow('NOT_FOUND');
+ db.exec("INSERT INTO bot_session_links VALUES('a')");
+ expect(() => run({ action: 'list', callerSessionId: 'a' })).toThrow('NOT_FOUND');
+ });
+ it('persists order across edits and projects it onto task associations', () => {
+ const expectedOrder = run({ action: 'list' }).tags.map((t) => t.id);
+ const tagIds = [...expectedOrder].reverse();
+ const reordered = run({ action: 'reorder', tagIds, expectedOrder });
+ expect(reordered.tags.map((t) => t.id)).toEqual(tagIds);
+ const first = reordered.tags[0];
+ run({ action: 'update', tagId: first.id, revision: first.revision, name: 'ZZZ' });
+ run({ action: 'attach', sessionIds: ['a'], tagIds });
+ expect(run({ action: 'get', sessionIds: ['a'] }).sessions[0].tags.map((t) => t.id)).toEqual(
+ tagIds,
+ );
+ expect(() => run({ action: 'reorder', tagIds: expectedOrder, expectedOrder })).toThrow(
+ 'CONFLICT',
+ );
+ expect(() =>
+ run({ action: 'reorder', tagIds: tagIds.slice(1), expectedOrder: tagIds }),
+ ).toThrow();
+ expect(run({ action: 'list' }).tags.map((t) => t.id)).toEqual(tagIds);
+ });
+ it('appends after legacy null positions and rejects stale catalog reorders', () => {
+ db.exec("UPDATE task_tags SET sort_order=NULL WHERE id='default:red'");
+ const expectedOrder = run({ action: 'list' }).tags.map((t) => t.id);
+ const created = run({ action: 'create', newId: 'new', name: 'New', color: 'blue' });
+ expect(created.tags.map((t) => t.id)).toEqual([...expectedOrder, 'new']);
+ expect(created.tags.every((t) => Number.isInteger(t.sortOrder))).toBe(true);
+ expect(() => run({ action: 'reorder', tagIds: expectedOrder, expectedOrder })).toThrow(
+ 'CONFLICT',
+ );
+ });
+ it('accepts the twelve colors and converts legacy uncolored writes to white', () => {
+ const supported = run({ action: 'list' }).supportedColors!;
+ expect(supported).toHaveLength(12);
+ expect(supported).not.toContain('none');
+ for (const color of supported)
+ run({ action: 'create', newId: 'new-' + color, name: 'New ' + color, color });
+ const result = run({ action: 'create', newId: 'legacy', name: 'Legacy', color: 'none' });
+ expect(result.tags.find((t) => t.id === 'legacy')?.color).toBe('white');
+ });
+ it('same standalone implementation executes in the legacy inline worker', () => {
+ const embedded = new Function('return (' + runTaskTagsTransaction.toString() + ')')();
+ expect(
+ embedded(db, { action: 'attach', sessionIds: ['a'], tagIds: ['default:red'] }).sessions[0]
+ .tags[0].color,
+ ).toBe('red');
+ });
+});
diff --git a/apps/desktop/src/main/localDb/client/WorkerThreadTransport.ts b/apps/desktop/src/main/localDb/client/WorkerThreadTransport.ts
index 7587b9e862..4c137ceede 100644
--- a/apps/desktop/src/main/localDb/client/WorkerThreadTransport.ts
+++ b/apps/desktop/src/main/localDb/client/WorkerThreadTransport.ts
@@ -1,3 +1,4 @@
+import { runTaskTagsTransaction } from '../worker/opHandlers/taskTagsTx.js';
import fs from 'node:fs';
import path from 'node:path';
import { Worker } from 'node:worker_threads';
@@ -16,6 +17,7 @@ import {
import { isBackgroundDbRpc } from './rpcAdmission.js';
const WORKER_CODE = `
+const runTaskTagsTransaction = ${runTaskTagsTransaction.toString()};
// 旧版 inline worker fallback。默认运行时走 .vite/build/dbWorker.js;
// 这段只作为打包路径回滚口保留,后续验证 macOS / Windows packaged 后删除。
const { parentPort, workerData } = require('node:worker_threads');
@@ -453,6 +455,7 @@ function dispatchTx(readyDb, payload) {
return recentWorkdirsMergeWindowsIdentity(readyDb, request.args);
case 'recentWorkdirs.removeWindowsIdentity':
return recentWorkdirsRemoveWindowsIdentity(readyDb, request.args);
+ case 'taskTags.execute': return runTaskTagsTransaction(readyDb, request.args);
case 'projectAliases.replaceIdentity':
return projectAliasesReplaceIdentity(readyDb, request.args);
case 'toolResults.compactSession':
diff --git a/apps/desktop/src/main/localDb/client/__tests__/DbClient.inproc.test.ts b/apps/desktop/src/main/localDb/client/__tests__/DbClient.inproc.test.ts
index 7e049b6041..63861d910c 100644
--- a/apps/desktop/src/main/localDb/client/__tests__/DbClient.inproc.test.ts
+++ b/apps/desktop/src/main/localDb/client/__tests__/DbClient.inproc.test.ts
@@ -45,6 +45,20 @@ CREATE TABLE embedding_jobs (
locked_at INTEGER,
UNIQUE(source, source_id, chunk_index, model_id)
);
+CREATE TABLE task_tags (
+ id TEXT PRIMARY KEY NOT NULL,
+ name TEXT NOT NULL,
+ name_customized INTEGER NOT NULL DEFAULT 0,
+ color TEXT NOT NULL,
+ favorite_order INTEGER,
+ sort_order INTEGER,
+ revision INTEGER NOT NULL DEFAULT 1
+);
+CREATE TABLE session_task_tags (
+ session_id TEXT NOT NULL,
+ tag_id TEXT NOT NULL,
+ PRIMARY KEY (session_id, tag_id)
+);
CREATE TABLE sessions (
id TEXT PRIMARY KEY,
status TEXT,
diff --git a/apps/desktop/src/main/localDb/client/tx/types.ts b/apps/desktop/src/main/localDb/client/tx/types.ts
index 869ddb56b7..c36cb7949b 100644
--- a/apps/desktop/src/main/localDb/client/tx/types.ts
+++ b/apps/desktop/src/main/localDb/client/tx/types.ts
@@ -1,4 +1,7 @@
+import type { TaskTagRequest, TaskTagResult } from '@cindy/maker-shared';
+
export type DbTxName =
+ | 'taskTags.execute'
| 'codex.importMessages'
| 'claude.importMessages'
| 'rewind.commit'
@@ -1175,6 +1178,7 @@ export type DbTxArgsByName = {
'sessions.setStatus': SessionsSetStatusArgs;
'recentWorkdirs.mergeWindowsIdentity': RecentWorkdirsMergeWindowsIdentityArgs;
'recentWorkdirs.removeWindowsIdentity': RecentWorkdirsRemoveWindowsIdentityArgs;
+ 'taskTags.execute': TaskTagRequest & { newId?: string; callerSessionId?: string };
'projectAliases.replaceIdentity': ProjectAliasesReplaceIdentityArgs;
'toolResults.compactSession': CompactSessionToolResultsArgs;
'session.agentSwitchFallback': SessionAgentSwitchFallbackArgs;
@@ -1247,6 +1251,7 @@ export type DbTxResultByName = {
'sessions.setStatus': SessionsSetStatusResultItem[];
'recentWorkdirs.mergeWindowsIdentity': undefined;
'recentWorkdirs.removeWindowsIdentity': { changes: number };
+ 'taskTags.execute': TaskTagResult;
'projectAliases.replaceIdentity': {
projectKey: string;
alias: string;
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/sessionAutoTitlePersist.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/sessionAutoTitlePersist.test.ts
index 1109b81827..86e3c718c1 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/sessionAutoTitlePersist.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/sessionAutoTitlePersist.test.ts
@@ -55,6 +55,20 @@ const SESSION_ID = 's1';
function createDb(initialTitle: string): void {
const sqlite = new Database(':memory:');
sqlite.exec(`
+ CREATE TABLE task_tags (
+ id TEXT PRIMARY KEY NOT NULL,
+ name TEXT NOT NULL,
+ name_customized INTEGER NOT NULL DEFAULT 0,
+ color TEXT NOT NULL,
+ favorite_order INTEGER,
+ sort_order INTEGER,
+ revision INTEGER NOT NULL DEFAULT 1
+ );
+ CREATE TABLE session_task_tags (
+ session_id TEXT NOT NULL,
+ tag_id TEXT NOT NULL,
+ PRIMARY KEY (session_id, tag_id)
+ );
CREATE TABLE sessions (
id TEXT PRIMARY KEY NOT NULL,
title TEXT NOT NULL DEFAULT 'New Maker',
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/sessionsRestoreIfArchived.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/sessionsRestoreIfArchived.test.ts
index a3889ca464..5bf5bee866 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/sessionsRestoreIfArchived.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/sessionsRestoreIfArchived.test.ts
@@ -84,6 +84,8 @@ function createDb(): void {
h.sqlite?.close();
const sqlite = new Database(':memory:');
sqlite.exec(`
+ CREATE TABLE task_tags(id TEXT PRIMARY KEY,name TEXT,color TEXT,favorite_order INTEGER,sort_order INTEGER,revision INTEGER,name_customized INTEGER NOT NULL DEFAULT 0);
+ CREATE TABLE session_task_tags(session_id TEXT,tag_id TEXT);
CREATE TABLE sessions (
id TEXT PRIMARY KEY NOT NULL,
title TEXT NOT NULL DEFAULT 'New CCS',
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
index ed2d94d283..a765d9585e 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/sessionsUpdate.test.ts
@@ -170,6 +170,20 @@ function createDb(): void {
const sqlite = new Database(':memory:');
// 与 schema.ts 的 sessions/messages 全列对齐(selectSessionWithCount select 全列)。
sqlite.exec(`
+ CREATE TABLE task_tags (
+ id TEXT PRIMARY KEY NOT NULL,
+ name TEXT NOT NULL,
+ name_customized INTEGER NOT NULL DEFAULT 0,
+ color TEXT NOT NULL,
+ favorite_order INTEGER,
+ sort_order INTEGER,
+ revision INTEGER NOT NULL DEFAULT 1
+ );
+ CREATE TABLE session_task_tags (
+ session_id TEXT NOT NULL,
+ tag_id TEXT NOT NULL,
+ PRIMARY KEY (session_id, tag_id)
+ );
CREATE TABLE sessions (
id TEXT PRIMARY KEY NOT NULL,
title TEXT NOT NULL DEFAULT 'New CCS',
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/taskTagsBroadcast.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/taskTagsBroadcast.test.ts
new file mode 100644
index 0000000000..c486fd9a97
--- /dev/null
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/taskTagsBroadcast.test.ts
@@ -0,0 +1,38 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+const h = vi.hoisted(() => ({ tx: vi.fn(), send: vi.fn(), tap: vi.fn(), session: vi.fn() }));
+vi.mock('electron', () => ({
+ ipcMain: { handle: vi.fn() },
+ BrowserWindow: { getAllWindows: () => [{ webContents: { send: h.send } }] },
+}));
+vi.mock('../../../logger', () => ({ createLogger: () => ({ warn: vi.fn() }) }));
+vi.mock('../../client/current', () => ({ getDbClient: () => ({ tx: h.tx }) }));
+vi.mock('../../../security/trustedAppRenderer.js', () => ({
+ assertTrustedAppRendererEvent: vi.fn(),
+ isTrustedAppRendererWindow: () => true,
+}));
+vi.mock('../../../device-link/broadcast-tap.js', () => ({
+ tapWindowBroadcast: h.tap,
+ captureDataOwnerBroadcastScope: () => ({ ownerStamp: 'owner' }),
+ isDataOwnerBroadcastScopeCurrent: () => true,
+}));
+vi.mock('../sessions', () => ({ broadcastSessionPatched: h.session }));
+import { executeTaskTags } from '../taskTags';
+beforeEach(() => vi.clearAllMocks());
+it.each(['attach', 'detach'] as const)(
+ 'broadcasts the revised catalog after %s to local and remote editors',
+ async (action) => {
+ const tags = [{ id: 'tag', name: 'Tag', color: 'red', revision: 2, favoriteOrder: null }];
+ h.tx.mockResolvedValue({
+ tags,
+ sessions: [{ sessionId: 'task', tags: action === 'attach' ? tags : [] }],
+ });
+ await executeTaskTags({ action, sessionIds: ['task'], tagIds: ['tag'] });
+ expect(h.tap).toHaveBeenCalledWith('local-db:task-tags:changed', { tags }, 'owner');
+ expect(h.send).toHaveBeenCalledWith('local-db:task-tags:changed', { tags }, 'owner');
+ expect(h.session).toHaveBeenCalledWith(
+ 'task',
+ { tags: action === 'attach' ? tags : [] },
+ { ownerStamp: 'owner' },
+ );
+ },
+);
diff --git a/apps/desktop/src/main/localDb/ipc/registerAll.ts b/apps/desktop/src/main/localDb/ipc/registerAll.ts
index 058cd51e46..da653b768e 100644
--- a/apps/desktop/src/main/localDb/ipc/registerAll.ts
+++ b/apps/desktop/src/main/localDb/ipc/registerAll.ts
@@ -1,3 +1,4 @@
+import { registerTaskTagsIpc } from './taskTags';
import { registerRoutineRemoteResources } from '../../routines/remote.js';
import { registerRoutinesIpc } from '../../routines/service.js';
/**
@@ -266,6 +267,7 @@ export function registerLocalDbIpc(opts: RegisterLocalDbIpcOpts = {}): void {
registerOrcaWorkflowIpc();
registerRecentWorkdirsIpc();
registerProjectAliasesIpc();
+ registerTaskTagsIpc();
registerRightSidebarTabsIpc();
// Durable Subagent projection writes share the agent event path's FIFO, so a
// reconciliation and an agent_task_update cannot both insert the first
diff --git a/apps/desktop/src/main/localDb/ipc/taskTags.ts b/apps/desktop/src/main/localDb/ipc/taskTags.ts
new file mode 100644
index 0000000000..e72a141696
--- /dev/null
+++ b/apps/desktop/src/main/localDb/ipc/taskTags.ts
@@ -0,0 +1,77 @@
+import { createLogger } from '../../logger';
+import { randomUUID } from 'node:crypto';
+import { ipcMain, BrowserWindow } from 'electron';
+import { TASK_TAG_PRESETS, type TaskTagRequest, type TaskTagResult } from '@cindy/maker-shared';
+import { getDbClient } from '../client/current';
+import {
+ assertTrustedAppRendererEvent,
+ isTrustedAppRendererWindow,
+} from '../../security/trustedAppRenderer.js';
+import {
+ tapWindowBroadcast,
+ captureDataOwnerBroadcastScope,
+ isDataOwnerBroadcastScopeCurrent,
+} from '../../device-link/broadcast-tap.js';
+import { broadcastSessionPatched } from './sessions';
+
+const log = createLogger('taskTags');
+export const TASK_TAG_CHANNEL = 'local-db:task-tags:execute';
+/** All surfaces share validation, transactions and owner-scoped task patches. */
+export async function executeTaskTags(
+ request: TaskTagRequest,
+ callerSessionId?: string,
+): Promise<TaskTagResult> {
+ const scope = captureDataOwnerBroadcastScope();
+ const assertCurrent = () => {
+ if (!isDataOwnerBroadcastScopeCurrent(scope)) throw new Error('[NOT_FOUND] Owner changed');
+ };
+ assertCurrent();
+ // Only known presets may claim a stable localized identity. Ordinary labels
+ // retain generated IDs, including labels with the same visible name.
+ const preset =
+ request.action === 'create' && request.presetId !== undefined
+ ? TASK_TAG_PRESETS.find((tag) => tag.id === request.presetId)
+ : undefined;
+ if (
+ request.action === 'create' &&
+ request.presetId !== undefined &&
+ (!preset || request.name !== preset.name || request.color !== preset.color)
+ ) {
+ throw new Error('[INVALID_PARAMS] Invalid task tag preset');
+ }
+ const client = getDbClient();
+ const result = await client.tx('taskTags.execute', {
+ ...request,
+ newId: preset?.id ?? randomUUID(),
+ callerSessionId,
+ });
+ assertCurrent();
+ if (['create', 'update', 'delete', 'attach', 'detach'].includes(request.action)) {
+ for (const row of result.sessions)
+ broadcastSessionPatched(row.sessionId, { tags: row.tags }, scope);
+ }
+ if (['create', 'update', 'delete', 'reorder', 'attach', 'detach'].includes(request.action)) {
+ const payload = { tags: result.tags };
+ // A closed renderer must not turn an already committed write into a failed request.
+ try {
+ tapWindowBroadcast('local-db:task-tags:changed', payload, scope.ownerStamp);
+ } catch {
+ log.warn('task tag device-link broadcast failed');
+ }
+ for (const window of BrowserWindow.getAllWindows()) {
+ try {
+ if (isTrustedAppRendererWindow(window))
+ window.webContents.send('local-db:task-tags:changed', payload, scope.ownerStamp);
+ } catch {
+ log.warn('task tag renderer broadcast failed');
+ }
+ }
+ }
+ return result;
+}
+export function registerTaskTagsIpc(): void {
+ ipcMain.handle(TASK_TAG_CHANNEL, async (event, request: TaskTagRequest) => {
+ assertTrustedAppRendererEvent(event);
+ return executeTaskTags(request);
+ });
+}
diff --git a/apps/desktop/src/main/localDb/mapper.ts b/apps/desktop/src/main/localDb/mapper.ts
index 2ba6f0a21c..9487d4a605 100644
--- a/apps/desktop/src/main/localDb/mapper.ts
+++ b/apps/desktop/src/main/localDb/mapper.ts
@@ -113,6 +113,7 @@ export function setSessionRuntimeProjector(projector: SessionRuntimeProjector |
* preview 落 null,渲染端兜底隐藏。
*/
export type SessionRowWithCount = SessionRow & {
+ tags?: import('@cindy/maker-shared').TaskTag[];
messageCount: number;
latestMessageContent?: string | null;
latestMessageExtract?: string | null;
@@ -229,6 +230,7 @@ export function sessionToCamel(row: SessionRowWithCount): Session {
row.totalCostUsd + (row.totalCostCurrency === 'USD' ? row.totalCostAmount : 0);
const base: Session = {
id: row.id,
+ ...(row.tags ? { tags: row.tags } : {}),
userId: '', // 本地 db 已按 user 隔离,无需冗余存储
title: row.title,
workingDir: row.workingDir,
diff --git a/apps/desktop/src/main/localDb/migrate.ts b/apps/desktop/src/main/localDb/migrate.ts
index 3019074602..a612b81199 100644
--- a/apps/desktop/src/main/localDb/migrate.ts
+++ b/apps/desktop/src/main/localDb/migrate.ts
@@ -18,6 +18,7 @@ import fs from 'node:fs';
import path from 'node:path';
import type Database from 'better-sqlite3';
import { app } from 'electron';
+import { initializeTaskTagPresets } from './taskTagPresets';
import { createLogger } from '../logger';
import {
backupDb,
@@ -63,10 +64,7 @@ function resolveDrizzleDir(): string {
return path.resolve(__dirname, '../../drizzle');
}
-export async function runMigrations(
- db: Database.Database,
- dbFilePath: string,
-): Promise<void> {
+export async function runMigrations(db: Database.Database, dbFilePath: string): Promise<void> {
const drizzleDir = resolveDrizzleDir();
log.info(
JSON.stringify({
@@ -87,13 +85,15 @@ export async function runMigrations(
event: 'localDb.migrate.scan',
currentVersion,
pendingCount: pending.length,
- pending: pending.map((m) => ({ seq: m.seq, fileName: m.fileName, hasTsScript: !!m.tsScriptPath })),
+ pending: pending.map((m) => ({
+ seq: m.seq,
+ fileName: m.fileName,
+ hasTsScript: !!m.tsScriptPath,
+ })),
}),
);
if (pending.length === 0) {
- log.info(
- JSON.stringify({ event: 'localDb.migrate.upToDate', currentVersion }),
- );
+ log.info(JSON.stringify({ event: 'localDb.migrate.upToDate', currentVersion }));
return;
}
if (
@@ -130,40 +130,51 @@ export async function runMigrations(
);
try {
- runMigrationReplay(db, {
- drizzleDir,
- currentVersion,
- onMigrationStart: (m) => {
- log.info(
- JSON.stringify({
- event: 'localDb.migrate.apply.begin',
- seq: m.seq,
- fileName: m.fileName,
- hasTsScript: !!m.tsScriptPath,
- }),
- );
- },
- onMigrationApplied: (m, durationMs) => {
- log.info(
- JSON.stringify({
- event: 'localDb.migrate.apply.ok',
- seq: m.seq,
- fileName: m.fileName,
- durationMs,
- }),
- );
- },
- onMigrationHistoryWriteFailed: (failure) => {
- log.warn(
- JSON.stringify({
- event: 'localDb.migrate.history.writeFailed',
- seq: failure.seq,
- fileName: failure.fileName,
- error: failure.error instanceof Error ? failure.error.message : String(failure.error),
- }),
- );
- },
- });
+ const apply = () =>
+ runMigrationReplay(db, {
+ drizzleDir,
+ currentVersion,
+ onMigrationStart: (m) => {
+ log.info(
+ JSON.stringify({
+ event: 'localDb.migrate.apply.begin',
+ seq: m.seq,
+ fileName: m.fileName,
+ hasTsScript: !!m.tsScriptPath,
+ }),
+ );
+ },
+ onMigrationApplied: (m, durationMs) => {
+ log.info(
+ JSON.stringify({
+ event: 'localDb.migrate.apply.ok',
+ seq: m.seq,
+ fileName: m.fileName,
+ durationMs,
+ }),
+ );
+ },
+ onMigrationHistoryWriteFailed: (failure) => {
+ log.warn(
+ JSON.stringify({
+ event: 'localDb.migrate.history.writeFailed',
+ seq: failure.seq,
+ fileName: failure.fileName,
+ error: failure.error instanceof Error ? failure.error.message : String(failure.error),
+ }),
+ );
+ },
+ });
+ if (currentVersion < 110) {
+ // Commit the first tag catalog together with its schema version. A crash
+ // must not leave the temporary color seeds marked as fully initialized.
+ db.transaction(() => {
+ apply();
+ initializeTaskTagPresets(db);
+ })();
+ } else {
+ apply();
+ }
} catch (err) {
log.error(
JSON.stringify({
diff --git a/apps/desktop/src/main/localDb/schema.ts b/apps/desktop/src/main/localDb/schema.ts
index 8c10115bca..8a70d158b4 100644
--- a/apps/desktop/src/main/localDb/schema.ts
+++ b/apps/desktop/src/main/localDb/schema.ts
@@ -2069,3 +2069,34 @@ export const hookGroupContextCursors = sqliteTable(
byUpdatedAt: index('hook_group_context_cursors_updated_at_idx').on(t.updatedAt),
}),
);
+
+/** Finder-style task label directory; scoped by the profile database. */
+export const taskTags = sqliteTable(
+ 'task_tags',
+ {
+ id: text('id').primaryKey(),
+ name: text('name').notNull(),
+ nameCustomized: integer('name_customized', { mode: 'boolean' }).notNull().default(false),
+ color: text('color').notNull(),
+ favoriteOrder: integer('favorite_order'),
+ sortOrder: integer('sort_order'),
+ revision: integer('revision').notNull().default(1),
+ },
+ (t) => ({ nameUnique: uniqueIndex('task_tags_name_idx').on(t.name) }),
+);
+
+export const sessionTaskTags = sqliteTable(
+ 'session_task_tags',
+ {
+ sessionId: text('session_id')
+ .notNull()
+ .references(() => sessions.id, { onDelete: 'cascade' }),
+ tagId: text('tag_id')
+ .notNull()
+ .references(() => taskTags.id, { onDelete: 'cascade' }),
+ },
+ (t) => ({
+ pk: primaryKey({ columns: [t.sessionId, t.tagId] }),
+ byTag: index('session_task_tags_tag_idx').on(t.tagId),
+ }),
+);
diff --git a/apps/desktop/src/main/localDb/sessionQueries.ts b/apps/desktop/src/main/localDb/sessionQueries.ts
index b40b89d2ac..364e5e5e6f 100644
--- a/apps/desktop/src/main/localDb/sessionQueries.ts
+++ b/apps/desktop/src/main/localDb/sessionQueries.ts
@@ -1,3 +1,4 @@
+import { normalizeTaskTags } from '@cindy/maker-shared';
/** Shared database reads for local IPC, remote IPC and internal callers. */
import { desc, eq, inArray, sql, type SQL } from 'drizzle-orm';
import type { DbClient } from './client/DbClient';
@@ -77,11 +78,16 @@ export interface SessionListRow {
messageCount: number;
latestMessageExtract: string | null;
latestMessageRole: string | null;
+ tagsJson?: string;
}
function sessionReadSelection() {
return {
session: sessions,
+ tagsJson:
+ sql<string>`(SELECT coalesce(json_group_array(json_object('id',t.id,'name',t.name,'nameCustomized',json(CASE WHEN t.name_customized THEN 'true' ELSE 'false' END),'color',t.color,'favoriteOrder',t.favorite_order,'sortOrder',t.sort_order,'revision',t.revision)), '[]') FROM task_tags t JOIN session_task_tags st ON st.tag_id=t.id WHERE st.session_id=${OUTER_SESSION_ID_SQL})`.as(
+ 'tags_json',
+ ),
messageCount: SESSION_MESSAGE_COUNT_SQL,
latestMessageExtract: LATEST_MSG_EXTRACT_SQL,
latestMessageRole: LATEST_MSG_ROLE_SQL,
@@ -89,7 +95,8 @@ function sessionReadSelection() {
}
export function flattenSessionReadRow(row: SessionListRow): SessionRowWithCount {
- return { ...row.session, messageCount: row.messageCount,
+ return { ...row.session,
+ tags: normalizeTaskTags(JSON.parse(row.tagsJson ?? '[]')), messageCount: row.messageCount,
latestMessageExtract: row.latestMessageExtract, latestMessageRole: row.latestMessageRole };
}
diff --git a/apps/desktop/src/main/localDb/taskTagPresets.ts b/apps/desktop/src/main/localDb/taskTagPresets.ts
new file mode 100644
index 0000000000..a259d0f353
--- /dev/null
+++ b/apps/desktop/src/main/localDb/taskTagPresets.ts
@@ -0,0 +1,47 @@
+import type Database from 'better-sqlite3';
+import { TASK_TAG_PRESETS } from '@cindy/maker-shared';
+
+/** Called only when this owner first receives the task-tag schema. */
+export function initializeTaskTagPresets(db: Database.Database): void {
+ db.transaction(() => {
+ const rows = db
+ .prepare('SELECT id,name,color,revision,favorite_order,sort_order FROM task_tags')
+ .all() as Array<{
+ id: string;
+ name: string;
+ color: string;
+ revision: number;
+ favorite_order: number | null;
+ sort_order: number | null;
+ }>;
+ const originalColors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray'];
+ // Only adjust the exact untouched seed from migration 0110. Never replace
+ // a user directory, even when it happens to contain seven labels.
+ if (
+ rows.length !== originalColors.length ||
+ originalColors.some(
+ (color, index) =>
+ !rows.some(
+ (row) =>
+ row.id === `default:${color}` &&
+ row.color === color &&
+ row.name === color[0].toUpperCase() + color.slice(1) &&
+ row.revision === 1 &&
+ row.favorite_order === index &&
+ row.sort_order === index,
+ ),
+ )
+ )
+ return;
+ if (db.prepare('SELECT 1 FROM session_task_tags LIMIT 1').get()) return;
+ // Keep the first six color labels, then append the six semantic labels.
+ // Gray remains available as a color and is used by the Reference preset.
+ db.prepare("DELETE FROM task_tags WHERE id='default:gray'").run();
+ const insert = db.prepare(
+ 'INSERT INTO task_tags(id,name,color,favorite_order,sort_order) VALUES(?,?,?,?,?)',
+ );
+ TASK_TAG_PRESETS.forEach((tag, index) =>
+ insert.run(tag.id, tag.name, tag.color, index + 6, index + 6),
+ );
+ })();
+}
diff --git a/apps/desktop/src/main/localDb/worker/opHandlers/taskTagsTx.ts b/apps/desktop/src/main/localDb/worker/opHandlers/taskTagsTx.ts
new file mode 100644
index 0000000000..af554150db
--- /dev/null
+++ b/apps/desktop/src/main/localDb/worker/opHandlers/taskTagsTx.ts
@@ -0,0 +1,281 @@
+import type Database from 'better-sqlite3';
+import type { TaskTag, TaskTagRequest, TaskTagResult } from '@cindy/maker-shared';
+
+/** Self-contained so the legacy inline worker can embed the same implementation. */
+export function runTaskTagsTransaction(db: Database.Database, raw: unknown): TaskTagResult {
+ const fail = (code: string): never => {
+ throw new Error(`[${code}] Task tag operation failed`);
+ };
+ const body = raw as TaskTagRequest & { newId?: string; callerSessionId?: string };
+ const text = (value: unknown, max = 128): string => {
+ if (typeof value !== 'string' || !value.trim() || value.trim().length > max)
+ return fail('INVALID_PARAMS');
+ return value.trim();
+ };
+ const ids = (value: unknown, max: number): string[] => {
+ if (!Array.isArray(value) || !value.length || value.length > max) return fail('INVALID_PARAMS');
+ return [...new Set(value.map((id) => text(id)))];
+ };
+ const color = (value: unknown): string => {
+ if (
+ ![
+ 'red',
+ 'orange',
+ 'yellow',
+ 'green',
+ 'blue',
+ 'purple',
+ 'gray',
+ 'pink',
+ 'coral',
+ 'teal',
+ 'indigo',
+ 'white',
+ 'none',
+ ].includes(String(value))
+ )
+ return fail('INVALID_PARAMS');
+ return value === 'none' ? 'white' : String(value);
+ };
+ const allTags = () =>
+ db
+ .prepare(
+ 'SELECT id,name,name_customized AS nameCustomized,color,favorite_order AS favoriteOrder,sort_order AS sortOrder,revision FROM task_tags ORDER BY sort_order IS NULL,sort_order,favorite_order IS NULL,favorite_order,name,id',
+ )
+ .all()
+ .map((row) => ({
+ ...(row as TaskTag),
+ nameCustomized: !!(row as TaskTag).nameCustomized,
+ })) as TaskTag[];
+ const tag = (id: string) => {
+ const found = allTags().find((t) => t.id === id);
+ return found ?? fail('NOT_FOUND');
+ };
+ const associatedCount = (id: string) =>
+ (
+ db
+ .prepare(
+ "SELECT count(*) AS n FROM session_task_tags t JOIN sessions s ON s.id=t.session_id WHERE t.tag_id=? AND s.status <> 'deleted'",
+ )
+ .get(id) as {
+ n: number;
+ }
+ ).n;
+ const project = (sessionIds: string[]) =>
+ sessionIds.map((sessionId) => ({
+ sessionId,
+ tags: db
+ .prepare(
+ 'SELECT t.id,t.name,t.name_customized AS nameCustomized,t.color,t.favorite_order AS favoriteOrder,t.sort_order AS sortOrder,t.revision FROM task_tags t JOIN session_task_tags s ON s.tag_id=t.id WHERE s.session_id=? ORDER BY t.sort_order IS NULL,t.sort_order,t.favorite_order IS NULL,t.favorite_order,t.name,t.id',
+ )
+ .all(sessionId)
+ .map((row) => ({
+ ...(row as TaskTag),
+ nameCustomized: !!(row as TaskTag).nameCustomized,
+ })) as TaskTag[],
+ }));
+ return db.transaction(() => {
+ if (!body || typeof body !== 'object') return fail('INVALID_PARAMS');
+ if (body.callerSessionId) {
+ if (
+ !db
+ .prepare(
+ "SELECT id FROM sessions WHERE id=? AND status <> 'deleted' AND coalesce(source,'') <> 'bot' AND NOT EXISTS (SELECT 1 FROM bot_session_links b WHERE b.session_id=sessions.id)",
+ )
+ .get(body.callerSessionId)
+ )
+ return fail('NOT_FOUND');
+ }
+ let affected: string[] = [];
+ let deletion: TaskTagResult['deletion'];
+ let hasMore: boolean | undefined;
+ switch (body.action) {
+ case 'list':
+ break;
+ case 'create': {
+ const name = text(body.name, 80);
+ if (allTags().some((t) => t.id === body.newId)) return fail('ALREADY_EXISTS');
+ if (allTags().length >= 256) return fail('LIMIT_EXCEEDED');
+ if (allTags().some((t) => t.name.toLocaleLowerCase() === name.toLocaleLowerCase()))
+ return fail('ALREADY_EXISTS');
+ if (body.favorite !== undefined && typeof body.favorite !== 'boolean')
+ return fail('INVALID_PARAMS');
+ const favorites = allTags().filter((t) => t.favoriteOrder !== null);
+ if (body.favorite && favorites.length >= 7) return fail('FAVORITES_FULL');
+ let appendOrder = Math.max(-1, ...allTags().map((t) => t.sortOrder ?? -1)) + 1;
+ for (const legacy of allTags().filter((t) => t.sortOrder == null)) {
+ db.prepare('UPDATE task_tags SET sort_order=?,revision=revision+1 WHERE id=?').run(
+ appendOrder++,
+ legacy.id,
+ );
+ }
+ db.prepare(
+ 'INSERT INTO task_tags(id,name,color,favorite_order,sort_order) VALUES(?,?,?,?,?)',
+ ).run(
+ text(body.newId),
+ name,
+ color(body.color),
+ body.favorite ? Math.max(-1, ...favorites.map((t) => t.favoriteOrder!)) + 1 : null,
+ appendOrder,
+ );
+ break;
+ }
+ case 'reorder': {
+ const order = ids(body.tagIds, 256);
+ const expected = ids(body.expectedOrder, 256);
+ const current = allTags();
+ if (order.length !== body.tagIds.length || expected.length !== body.expectedOrder.length)
+ return fail('INVALID_PARAMS');
+ if (current.length !== expected.length || current.some((t, i) => t.id !== expected[i]))
+ return fail('CONFLICT');
+ if (order.length !== current.length || order.some((id) => !expected.includes(id)))
+ return fail('INVALID_PARAMS');
+ const update = db.prepare(
+ 'UPDATE task_tags SET sort_order=?,revision=revision+1 WHERE id=? AND (sort_order IS NULL OR sort_order<>?)',
+ );
+ order.forEach((id, index) => update.run(index, id, index));
+ break;
+ }
+ case 'update': {
+ const id = text(body.tagId);
+ const current = tag(id);
+ if (body.revision !== current.revision) return fail('CONFLICT');
+ const name = body.name === undefined ? current.name : text(body.name, 80);
+ if (
+ body.nameCustomized !== undefined &&
+ (body.nameCustomized !== true || body.name === undefined)
+ )
+ return fail('INVALID_PARAMS');
+ if (
+ allTags().some(
+ (t) => t.id !== id && t.name.toLocaleLowerCase() === name.toLocaleLowerCase(),
+ )
+ )
+ return fail('ALREADY_EXISTS');
+ const nextColor = body.color === undefined ? current.color : color(body.color);
+ if (body.favorite !== undefined && typeof body.favorite !== 'boolean')
+ return fail('INVALID_PARAMS');
+ let order = current.favoriteOrder;
+ if (body.favorite === false) order = null;
+ if (body.favorite === true && order === null) {
+ const favorites = allTags().filter((t) => t.favoriteOrder !== null);
+ if (favorites.length >= 7) return fail('FAVORITES_FULL');
+ order = Math.max(-1, ...favorites.map((t) => t.favoriteOrder!)) + 1;
+ }
+ db.prepare(
+ 'UPDATE task_tags SET name=?,name_customized=?,color=?,favorite_order=?,revision=revision+1 WHERE id=?',
+ ).run(
+ name,
+ Number(current.nameCustomized || body.nameCustomized || name !== current.name),
+ nextColor,
+ order,
+ id,
+ );
+ break;
+ }
+ case 'previewDelete': {
+ const current = tag(text(body.tagId));
+ deletion = {
+ tagId: current.id,
+ revision: current.revision,
+ count: associatedCount(current.id),
+ };
+ break;
+ }
+ case 'delete': {
+ const current = tag(text(body.tagId));
+ if (
+ body.revision !== current.revision ||
+ body.expectedCount !== associatedCount(current.id)
+ )
+ return fail('CONFLICT');
+ db.prepare('DELETE FROM task_tags WHERE id=?').run(current.id);
+ break;
+ }
+ case 'attach':
+ case 'detach':
+ case 'get': {
+ affected = ids(body.sessionIds, 100);
+ for (const id of affected) {
+ if (!db.prepare("SELECT id FROM sessions WHERE id=? AND status <> 'deleted'").get(id))
+ return fail('NOT_FOUND');
+ if (
+ body.callerSessionId &&
+ db
+ .prepare(
+ "SELECT id FROM sessions WHERE id=? AND (source='bot' OR EXISTS (SELECT 1 FROM bot_session_links b WHERE b.session_id=sessions.id))",
+ )
+ .get(id)
+ )
+ return fail('NOT_FOUND');
+ }
+ if (body.action !== 'get') {
+ const tagIds = ids(body.tagIds, 32);
+ tagIds.forEach(tag);
+ const statement = db.prepare(
+ body.action === 'attach'
+ ? 'INSERT OR IGNORE INTO session_task_tags(session_id,tag_id) VALUES(?,?)'
+ : 'DELETE FROM session_task_tags WHERE session_id=? AND tag_id=?',
+ );
+ for (const sessionId of affected) {
+ const existing = project([sessionId])[0].tags;
+ if (
+ body.action === 'attach' &&
+ new Set([...existing.map((t) => t.id), ...tagIds]).size > 32
+ )
+ return fail('LIMIT_EXCEEDED');
+ for (const tagId of tagIds) {
+ if (statement.run(sessionId, tagId).changes)
+ db.prepare('UPDATE task_tags SET revision=revision+1 WHERE id=?').run(tagId);
+ }
+ }
+ }
+ break;
+ }
+ case 'find': {
+ const id = text(body.tagId);
+ tag(id);
+ const offset = body.offset ?? 0;
+ const limit = body.limit ?? 50;
+ if (
+ !Number.isInteger(offset) ||
+ offset < 0 ||
+ !Number.isInteger(limit) ||
+ limit < 1 ||
+ limit > 100
+ )
+ return fail('INVALID_PARAMS');
+ const rows = db
+ .prepare(
+ "SELECT s.session_id AS id FROM session_task_tags s JOIN sessions ON sessions.id=s.session_id WHERE s.tag_id=? AND sessions.status <> 'deleted' AND (? IS NULL OR (coalesce(sessions.source,'') <> 'bot' AND NOT EXISTS (SELECT 1 FROM bot_session_links b WHERE b.session_id=sessions.id))) ORDER BY sessions.updated_at DESC,s.session_id LIMIT ? OFFSET ?",
+ )
+ .all(id, body.callerSessionId ?? null, limit + 1, offset) as { id: string }[];
+ hasMore = rows.length > limit;
+ affected = rows.slice(0, limit).map((r) => r.id);
+ break;
+ }
+ default:
+ return fail('INVALID_PARAMS');
+ }
+ return {
+ supportedColors: [
+ 'red',
+ 'orange',
+ 'yellow',
+ 'green',
+ 'blue',
+ 'purple',
+ 'gray',
+ 'pink',
+ 'coral',
+ 'teal',
+ 'indigo',
+ 'white',
+ ] as TaskTagResult['supportedColors'],
+ tags: allTags(),
+ sessions: project(affected),
+ ...(deletion ? { deletion } : {}),
+ ...(hasMore === undefined ? {} : { hasMore }),
+ };
+ })();
+}
diff --git a/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts b/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts
index 4b1dbd9e57..9501055ea5 100644
--- a/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts
+++ b/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts
@@ -1,3 +1,4 @@
+import { runTaskTagsTransaction } from './taskTagsTx.js';
import { normalizeBotName } from '../../../../shared/botCreation.js';
import { inferBotTemplatePresetId } from '../../../../shared/botTemplatePreset.js';
// inproc 回滚口:仅在 XDT_DB_INPROC=true 时使用。
@@ -83,6 +84,8 @@ export function tx(db: Database.Database, args: unknown): unknown {
return recentWorkdirsMergeWindowsIdentity(db, txArgs);
case 'recentWorkdirs.removeWindowsIdentity':
return recentWorkdirsRemoveWindowsIdentity(db, txArgs);
+ case 'taskTags.execute':
+ return runTaskTagsTransaction(db, txArgs);
case 'projectAliases.replaceIdentity':
return projectAliasesReplaceIdentity(db, txArgs);
case 'toolResults.compactSession':
@@ -574,7 +577,8 @@ function botsReconcileCanonicalLink(
db: Database.Database,
args: unknown,
): {
- status: 'unchanged' | 'repaired-mirror' | 'migrated' | 'missing-pointer' | 'missing-session' | 'conflict';
+ status:
+ | 'unchanged' | 'repaired-mirror' | 'migrated' | 'missing-pointer' | 'missing-session' | 'conflict';
canonicalSessionId: string | null;
} {
const p = asRecord(args, 'bots.reconcileCanonicalLink args');
@@ -582,8 +586,7 @@ function botsReconcileCanonicalLink(
const now = expectNumber(p.now, 'now');
return db.transaction(() => {
const bot = db.prepare(`SELECT canonical_session_id AS canonicalSessionId,
- current_version AS currentVersion FROM bot_profiles WHERE id = ?`).get(botId) as
- | { canonicalSessionId: string | null; currentVersion: number } | undefined;
+ current_version AS currentVersion FROM bot_profiles WHERE id = ?`).get(botId) as { canonicalSessionId: string | null; currentVersion: number } | undefined;
if (!bot) throw Object.assign(new Error('Bot 不存在'), { code: 'NOT_FOUND' });
const links = db.prepare(`SELECT id, session_id AS sessionId, profile_version AS profileVersion
@@ -601,7 +604,7 @@ function botsReconcileCanonicalLink(
const authoritative = links[0]?.sessionId ?? null;
if (authoritative) {
const session = db.prepare('SELECT status FROM sessions WHERE id = ?').get(authoritative) as
- | { status: string } | undefined;
+ { status: string } | undefined;
if (!session || session.status === 'deleted') {
return { status: 'missing-session' as const, canonicalSessionId: null };
}
@@ -635,8 +638,7 @@ function botsReconcileCanonicalLink(
return { status: 'conflict' as const, canonicalSessionId: null };
}
const existingLink = db.prepare(`SELECT bot_id AS botId, role FROM bot_session_links
- WHERE session_id = ?`).get(bot.canonicalSessionId) as
- | { botId: string; role: string } | undefined;
+ WHERE session_id = ?`).get(bot.canonicalSessionId) as { botId: string; role: string } | undefined;
if (existingLink) {
return { status: 'conflict' as const, canonicalSessionId: null };
}
@@ -1038,7 +1040,7 @@ function botsDeleteProfile(
const status: 'archived' | 'deleted' = keepTaskHistory ? 'archived' : 'deleted';
return db.transaction(() => {
const profile = db.prepare('SELECT status FROM bot_profiles WHERE id = ?').get(botId) as
- | { status: string }
+ { status: string }
| undefined;
if (!profile) throw Object.assign(new Error('Bot 不存在'), { code: 'NOT_FOUND' });
if (profile.status !== 'archived') throw Object.assign(
@@ -1584,7 +1586,7 @@ function messageDelete(
);
const targets = clientIds.map((clientId) => {
const target = selectTarget.get(sessionId, clientId) as
- | { id: string; clientId: string; toolUseId: string | null }
+ { id: string; clientId: string; toolUseId: string | null }
| undefined;
if (!target) {
throw Object.assign(new Error(`Message 不存在或不可删除: ${clientId}`), {
@@ -1778,7 +1780,8 @@ function sessionsRenameTitles(db: Database.Database, args: unknown): Array<{
expectedCurrentTitle,
expectedUpdatedAtMs,
expectedUpdatedAtMs,
- ) as { id: string; title: string | null; workingDir: string | null; updatedAt: number } | undefined;
+ ) as
+ | { id: string; title: string | null; workingDir: string | null; updatedAt: number } | undefined;
if (!updated) {
throw Object.assign(new Error(`Session 标题或 updatedAt 已变化: ${sessionId}`), {
code: 'PRECONDITION_FAILED',
diff --git a/apps/desktop/src/main/mcp-integrations/mcp-providers.ts b/apps/desktop/src/main/mcp-integrations/mcp-providers.ts
index f92aaf3286..d1af08ab10 100644
--- a/apps/desktop/src/main/mcp-integrations/mcp-providers.ts
+++ b/apps/desktop/src/main/mcp-integrations/mcp-providers.ts
@@ -1,3 +1,4 @@
+import { executeTaskTags } from '../localDb/ipc/taskTags.js';
import { getPluginMarketService } from '../plugin-market/service.js';
import { createProject } from './createProject.js';
import { createMoveSession } from './moveSession.js';
@@ -380,6 +381,10 @@ export function createDesktopMcpProviders(deps: DesktopMcpProvidersDeps): LiziMc
// (LLM 调工具时) registerMakerIpc 早已执行完毕, holder 已 ready。
xdtHelper: {
logger: createLogger('mcp/cindy_helper'),
+ sessionTags: async (callerSessionId, request) => {
+ const result = await executeTaskTags(request, callerSessionId);
+ return ['update', 'delete'].includes(request.action) ? { ...result, sessions: [] } : result;
+ },
createProject,
moveSession: createMoveSession(isSessionInTurn),
projectManagement: { list: listProjects, rename: renameProject, remove: removeProject },
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index 942de3193f..cb279e781f 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -3445,7 +3445,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
uninstall: (
absolutePath: string,
skillId?: string,
- ): Promise<{ success: true; cleanupToken?: string } | { success: false; errorCode: string; message: string }> =>
+ ): Promise<
+ | { success: true; cleanupToken?: string } | { success: false; errorCode: string; message: string }> =>
ipcRenderer.invoke('skillhub:uninstall', { absolutePath, skillId }),
retryUninstallCleanup: (token: string): Promise<{ complete: boolean }> =>
@@ -5432,6 +5433,13 @@ contextBridge.exposeInMainWorld('electronAPI', {
/** Small invalidation push; consumers re-read through list/detail. */
onChanged: createIpcFanOut('local-db:subagent-runs:changed'),
},
+ taskTags: {
+ onChanged: createIpcFanOut('local-db:task-tags:changed'),
+ execute: (
+ request: import('@cindy/maker-shared').TaskTagRequest,
+ ): Promise<import('@cindy/maker-shared').TaskTagResult> =>
+ ipcRenderer.invoke('local-db:task-tags:execute', request),
+ },
projectAliases: {
list: (): Promise<unknown> => ipcRenderer.invoke('local-db:project-aliases:list'),
set: (input: { projectKey: string; alias: string }): Promise<unknown> =>
diff --git a/apps/desktop/src/renderer/__tests__/refreshRemoteSessionsRetry.test.ts b/apps/desktop/src/renderer/__tests__/refreshRemoteSessionsRetry.test.ts
index ac110edefb..95b8fede07 100644
--- a/apps/desktop/src/renderer/__tests__/refreshRemoteSessionsRetry.test.ts
+++ b/apps/desktop/src/renderer/__tests__/refreshRemoteSessionsRetry.test.ts
@@ -567,6 +567,22 @@ describe('refreshRemoteDeviceSessions retry', () => {
expect(remoteProjectsStore.getMergedRemoteSessions()).toHaveLength(0);
});
+ it('does not restore deleted tags from a first snapshot overtaken by a catalog push', async () => {
+ const d = did();
+ const snapshot = deferred<Session[]>();
+ invoke.mockReturnValueOnce(snapshot.promise);
+ const refresh = refreshRemoteDeviceSessions(d, 'Mac', { sleep: noSleep });
+ remoteProjectsStore.applyTagCatalog(d, []);
+ snapshot.resolve([session('task', { tags: [{
+ id: 'old', name: 'Deleted', color: 'red', favoriteOrder: 0, revision: 1,
+ }] })]);
+ await expect(refresh).resolves.toBe('superseded');
+ expect(remoteProjectsStore.getDeviceSessions(d)).toHaveLength(0);
+ invoke.mockResolvedValueOnce([session('task', { tags: [] })]);
+ await expect(refreshRemoteDeviceSessions(d, 'Mac', { sleep: noSleep })).resolves.toBe('ok');
+ expect(remoteProjectsStore.getDeviceSessions(d)).toMatchObject([{ id: 'task', tags: [] }]);
+ });
+
it('首拉 active 列表时要求被控端补齐置顶,避免旧置顶被 200 条窗口截掉', async () => {
const d = did();
invoke.mockResolvedValueOnce([
diff --git a/apps/desktop/src/renderer/__tests__/remoteProjectsStore.test.ts b/apps/desktop/src/renderer/__tests__/remoteProjectsStore.test.ts
index 2d020d0260..59be0a44f7 100644
--- a/apps/desktop/src/renderer/__tests__/remoteProjectsStore.test.ts
+++ b/apps/desktop/src/renderer/__tests__/remoteProjectsStore.test.ts
@@ -61,6 +61,46 @@ describe('remoteProjectsStore', () => {
remoteProjectsStore.__resetPinnedOriginsForTest();
});
+ it('invalidates and reloads the first snapshot when a tag catalog push arrives first', () => {
+ const reseed = vi.fn();
+ setRemoteReseedImpl(reseed);
+ const epoch = remoteProjectsStore.nextSnapshotEpoch('dev-A');
+ const otherEpoch = remoteProjectsStore.nextSnapshotEpoch('dev-B');
+ remoteProjectsStore.applyTagCatalog('dev-A', []);
+ expect(remoteProjectsStore.isLatestSnapshotEpoch('dev-A', epoch)).toBe(false);
+ expect(remoteProjectsStore.isLatestSnapshotEpoch('dev-B', otherEpoch)).toBe(true);
+ expect(reseed.mock.calls).toEqual([['dev-A', 'active']]);
+ const replacementEpoch = remoteProjectsStore.nextSnapshotEpoch('dev-A');
+ expect(remoteProjectsStore.isLatestSnapshotEpoch('dev-A', replacementEpoch)).toBe(true);
+ });
+
+ it('reloads an in-flight first archived snapshot without loading untouched history', () => {
+ const reseed = vi.fn();
+ setRemoteReseedImpl(reseed);
+ remoteProjectsStore.setDeviceSessions('dev-A', 'A', [mk('a')]);
+ remoteProjectsStore.applyTagCatalog('dev-A', []);
+ expect(reseed.mock.calls).toEqual([['dev-A', 'active']]);
+ reseed.mockClear();
+ remoteProjectsStore.markSessionStatusLoading('dev-A', 'archived');
+ const epoch = remoteProjectsStore.nextSnapshotEpoch('dev-A', 'archived');
+ remoteProjectsStore.applyTagCatalog('dev-A', []);
+ expect(remoteProjectsStore.isLatestSnapshotEpoch('dev-A', epoch, 'archived')).toBe(false);
+ expect(reseed.mock.calls).toEqual([['dev-A', 'active'], ['dev-A', 'archived']]);
+ });
+
+ it('requeues both loaded buckets after invalidating a refresh that may contain new tasks', () => {
+ const reseed = vi.fn();
+ setRemoteReseedImpl(reseed);
+ remoteProjectsStore.setDeviceSessions('dev-A', 'A', [mk('a')]);
+ remoteProjectsStore.setDeviceSessions('dev-A', 'A', [mk('archived', { status: 'archived' })], 'archived');
+ const activeEpoch = remoteProjectsStore.nextSnapshotEpoch('dev-A');
+ const archivedEpoch = remoteProjectsStore.nextSnapshotEpoch('dev-A', 'archived');
+ remoteProjectsStore.applyTagCatalog('dev-A', []);
+ expect(remoteProjectsStore.isLatestSnapshotEpoch('dev-A', activeEpoch)).toBe(false);
+ expect(remoteProjectsStore.isLatestSnapshotEpoch('dev-A', archivedEpoch, 'archived')).toBe(false);
+ expect(reseed.mock.calls).toEqual([['dev-A', 'active'], ['dev-A', 'archived']]);
+ });
+
it('把用户的任务重试动作交给 listing tier 注册的 bootstrap 实现', () => {
const retry = vi.fn();
setRemoteSessionBootstrapRetryImpl(retry);
diff --git a/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.ts b/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.ts
index 7f94ea894c..516226ca34 100644
--- a/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.ts
+++ b/apps/desktop/src/renderer/__tests__/sidebarSessionTime.test.ts
@@ -98,7 +98,7 @@ describe('SessionItem activity time', () => {
/buildSessionInfoPieces\(\s*session,\s*taskInfoFields,\s*activityIso,\s*t,/,
);
expect(sessionItemSource).toContain('<SessionInfoMeta');
- expect(sessionItemSource).toContain('pieces={infoPieces}');
+ expect(sessionItemSource).toMatch(/pieces=\{infoPieces\.filter\(\(?piece\)? => piece.key !== 'tags'\)\}/);
expect(sessionInfoMetaSource).toContain('formatSidebarTime(activityIso, t)');
expect(sessionInfoMetaSource).toContain('text-sidebar-action-icon');
expect(sessionItemSource).toContain('transition-opacity');
@@ -115,7 +115,7 @@ describe('SessionItem activity time', () => {
expect(sessionItemSource).toContain('worktree={infoWorktree ?? undefined}');
expect(sessionItemSource).toContain('canQuickArchive && archivePending &&');
expect(sessionItemSource).toContain(
- "!archivePending && 'group-hover:opacity-0 group-focus-within/slot:opacity-0'",
+ "group-hover:opacity-0 group-hover:w-0 group-hover:overflow-hidden group-focus-within/slot:opacity-0 group-focus-within/slot:w-0 group-focus-within/slot:overflow-hidden",
);
expect(sessionItemSource).toContain('group/slot relative ml-auto');
expect(sessionItemSource).toContain(
diff --git a/apps/desktop/src/renderer/__tests__/sidebarUpgradeDefaults.test.ts b/apps/desktop/src/renderer/__tests__/sidebarUpgradeDefaults.test.ts
index 234e785d7a..5cee010b34 100644
--- a/apps/desktop/src/renderer/__tests__/sidebarUpgradeDefaults.test.ts
+++ b/apps/desktop/src/renderer/__tests__/sidebarUpgradeDefaults.test.ts
@@ -3,7 +3,7 @@
* ---------------------------------------------------------------------------
* 目标:老用户升级后左侧任务列表**尽量不变**;新用户才吃新默认。
* - 分组默认老新一致:按项目 + 按设备 + 对话归组(用户明确要求不分老新)。
- * - 排序默认按时间;任务信息默认只显示时间。
+ * - 排序默认按时间;任务信息默认显示标签和时间。
* - **显示模式是唯一按安装新旧分叉的项**:新装 'list',老装 'text'。
* 最难的一类是「从没动过显示模式的老用户」——localStorage 里没有 cardMode,
* 与全新安装无法直接区分,靠 sidebarInstallVintage 的旧版使用痕迹识别。
@@ -85,12 +85,12 @@ describe('侧边栏升级兼容性:默认配置', () => {
vintageTesting.resetMemo();
});
- it('新用户默认:项目 + 设备 + 对话三层分组,按时间排序,任务信息只显示时间', () => {
+ it('新用户默认:项目 + 设备 + 对话三层分组,按时间排序,任务信息显示标签和时间', () => {
expect(loadGroupBy()).toBe('project');
expect(loadGroupDevice()).toBe(true);
expect(loadGroupDialogue()).toBe(true);
expect(loadSortBy()).toBe('recency');
- expect(loadTaskInfoFields()).toEqual(['time']);
+ expect(loadTaskInfoFields()).toEqual(['tags', 'time']);
});
it('分组默认不分老新:老安装拿到同一套分组默认', () => {
diff --git a/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts b/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts
index fb5acd8581..b362f066aa 100644
--- a/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts
+++ b/apps/desktop/src/renderer/__tests__/useSidebarFilter.test.ts
@@ -365,8 +365,8 @@ describe('taskInfoFields(任务行右侧信息复选)', () => {
beforeEach(() => installMemoryLocalStorage());
afterEach(() => uninstallLocalStorage());
- it("defaults to ['time'] when storage is empty", () => {
- expect(loadTaskInfoFields()).toEqual(['time']);
+ it("defaults to ['tags', 'time'] when storage is empty", () => {
+ expect(loadTaskInfoFields()).toEqual(['tags', 'time']);
});
it('空数组是合法状态(用户显式全不选),不回落默认', () => {
@@ -378,14 +378,32 @@ describe('taskInfoFields(任务行右侧信息复选)', () => {
persistTaskInfoFields(['pr', 'worktree', 'tokens', 'cost', 'time']);
expect(loadTaskInfoFields()).toEqual(['pr', 'worktree', 'tokens', 'cost', 'time']);
localStorage.setItem(TASK_INFO_KEY, JSON.stringify(['time', 'bogus', 'time', 42, 'cost']));
- expect(loadTaskInfoFields()).toEqual(['time', 'cost']);
+ expect(loadTaskInfoFields()).toEqual(['tags', 'time', 'cost']);
+ });
+
+ it('enables tags for upgraded preferences while retaining other choices and their order', () => {
+ localStorage.setItem(TASK_INFO_KEY, JSON.stringify(['cost', 'time', 'pr']));
+ expect(loadTaskInfoFields()).toEqual(['tags', 'cost', 'time', 'pr']);
+ localStorage.setItem(TASK_INFO_KEY, '[]');
+ expect(loadTaskInfoFields()).toEqual(['tags']);
+ localStorage.setItem(TASK_INFO_KEY, JSON.stringify(['time', 'tags']));
+ expect(loadTaskInfoFields()).toEqual(['time', 'tags']);
+ });
+
+ it('retains an explicit tag opt-out after upgrading and saving again', () => {
+ localStorage.setItem(TASK_INFO_KEY, JSON.stringify(['time']));
+ const upgraded = loadTaskInfoFields();
+ persistTaskInfoFields(nextTaskInfoAfterToggle(upgraded, 'tags'));
+ expect(loadTaskInfoFields()).toEqual(['time']);
+ persistTaskInfoFields(loadTaskInfoFields());
+ expect(loadTaskInfoFields()).toEqual(['time']);
});
it('falls back to default on broken JSON or shape mismatch', () => {
localStorage.setItem(TASK_INFO_KEY, '{not-json');
- expect(loadTaskInfoFields()).toEqual(['time']);
+ expect(loadTaskInfoFields()).toEqual(['tags', 'time']);
localStorage.setItem(TASK_INFO_KEY, JSON.stringify({ fields: ['time'] }));
- expect(loadTaskInfoFields()).toEqual(['time']);
+ expect(loadTaskInfoFields()).toEqual(['tags', 'time']);
});
it('nextTaskInfoAfterToggle toggles membership and allows empty', () => {
diff --git a/apps/desktop/src/renderer/contexts/AuthContext.tsx b/apps/desktop/src/renderer/contexts/AuthContext.tsx
index 98bc4821e5..3069c2707d 100644
--- a/apps/desktop/src/renderer/contexts/AuthContext.tsx
+++ b/apps/desktop/src/renderer/contexts/AuthContext.tsx
@@ -1,3 +1,4 @@
+import { resetTaskTagCatalogCache } from '@/features/task-tags/taskTagEvents';
import {
createContext,
useCallback,
@@ -116,6 +117,7 @@ const log = createLogger('AuthContext');
function publishDataOwnerGeneration(dataOwnerId: string | null, ownerGeneration?: number): void {
const previousOwnerId = getDataOwnerGeneration().dataOwnerId;
if (previousOwnerId !== dataOwnerId) {
+ resetTaskTagCatalogCache();
cancelRemoteOptimisticSendsForDataOwnerBoundary();
}
setDataOwnerGeneration(dataOwnerId, ownerGeneration);
diff --git a/apps/desktop/src/renderer/features/cc-agent/SessionContentHeader.tsx b/apps/desktop/src/renderer/features/cc-agent/SessionContentHeader.tsx
index 3ce0454412..7d1bc298f1 100644
--- a/apps/desktop/src/renderer/features/cc-agent/SessionContentHeader.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/SessionContentHeader.tsx
@@ -82,6 +82,7 @@ import { SessionBranchTreeDialog } from './SessionBranchTreeDialog';
import { useRemoteProjectSessions } from '@/features/device-link/remoteProjectsStore';
import { isRemoteSessionWriteBlocked } from './lib/remoteSessionWriteGuard';
import { Tip } from '@/components/ui/tooltip';
+import { TaskTagDots, TaskTagMenuSection, TaskTagEditor } from '@/features/task-tags/TaskTags';
const log = createLogger('SessionContentHeader');
@@ -184,6 +185,21 @@ export function SessionContentHeader({
/* ---- 行内重命名(与 SessionItem 同交互:双击进入,Enter 提交 / Esc 取消 / Blur 提交,
输入框本体 + Magic AI 改名按钮统一在 SessionRenameInput) ---- */
const [isEditing, setIsEditing] = useState(false);
+ const [menuOpen, setMenuOpen] = useState(false);
+ const [tagEditorOpen, setTagEditorOpen] = useState(false);
+ useEffect(() => {
+ setMenuOpen(false);
+ setTagEditorOpen(false);
+ }, [session.id, session.deviceLinkDeviceId]);
+ const tagMenu = (
+ <TaskTagMenuSection
+ session={session}
+ onMore={() => {
+ setMenuOpen(false);
+ setTagEditorOpen(true);
+ }}
+ />
+ );
const [editValue, setEditValue] = useState(displayTitle);
// Enter 提交后 input 卸载又触发 onBlur 的二次提交,用 ref 拦掉。
const committedRef = useRef(false);
@@ -582,11 +598,22 @@ export function SessionContentHeader({
</span>
)}
+ {!isEditing && !!session.tags?.length && (
+ <span
+ className="mx-1 shrink-0 [--task-tag-ring-bg:hsl(var(--content-area))]"
+ style={WINDOW_NO_DRAG_STYLE}
+ >
+ <TaskTagDots tags={session.tags} />
+ </span>
+ )}
+
{!isEditing && !readOnly && (
// 菜单打开就把归档/删除的 dirty 预检发出去:用户从展开菜单到点条目至少
// 一次反应时间,足够这次 git status 跑完,点下去时命中缓存、零等待。
<DropdownMenu
+ open={menuOpen}
onOpenChange={(open) => {
+ setMenuOpen(open);
if (open) prefetchDirtyWorktreeForRemoval(session.id, session.deviceLinkDeviceId);
}}
>
@@ -656,6 +683,7 @@ export function SessionContentHeader({
{t('ccAgent.sidebar.sessionMenu.sessionBranches')}
</DropdownMenuItem>
)}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -680,6 +708,7 @@ export function SessionContentHeader({
>
{t('ccAgent.sidebar.sessionMenu.copySessionLink')}
</DropdownMenuItem>
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -767,6 +796,7 @@ export function SessionContentHeader({
{t('ccAgent.sidebar.sessionMenu.exportShare')}
</DropdownMenuItem>
)}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -791,6 +821,8 @@ export function SessionContentHeader({
{/* session-git-pr-context:当前分支 + 关联 PR 徽标(非 git 目录 / dialogue 会话自动隐藏) */}
<GitContextBadge session={session} />
+ {tagEditorOpen && <TaskTagEditor session={session} onClose={() => setTagEditorOpen(false)} />}
+
{/* 导出 .cshare 弹窗:仅打开时挂载,与 SessionItem 同款。 */}
{shareExportOpen && (
<SessionShareExportDialog
diff --git a/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts b/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts
index 1b8c40c73c..3841f9eaaf 100644
--- a/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/hooks/helpers/sidebarFilterCore.ts
@@ -74,7 +74,7 @@ export type FilterProjectOrder = 'activity' | 'custom';
* 任务行右侧信息项(复选)。存储数组的顺序 = 用户勾选先后(nextTaskInfoAfterToggle
* 按序追加),列表行据此渲染(2026-08-12 用户裁决);菜单里选项的排列另有固定顺序。
*/
-export type TaskInfoField = 'time' | 'pr' | 'worktree' | 'tokens' | 'cost';
+export type TaskInfoField = 'time' | 'pr' | 'worktree' | 'tokens' | 'cost' | 'tags';
export type ManualProjectDropPosition = 'before' | 'after';
const STATUS_VALUES: ReadonlySet<string> = new Set<FilterStatus>(['active', 'archived', 'all']);
@@ -556,14 +556,15 @@ const TASK_INFO_VALUES: ReadonlySet<string> = new Set<TaskInfoField>([
'worktree',
'tokens',
'cost',
+ 'tags',
]);
-/** 默认只显示最近活动时间(现状行为)。 */
-export const DEFAULT_TASK_INFO_FIELDS: readonly TaskInfoField[] = ['time'];
+/** 默认显示标签和最近活动时间。 */
+export const DEFAULT_TASK_INFO_FIELDS: readonly TaskInfoField[] = ['tags', 'time'];
/**
- * 读任务行右侧信息复选。存储为 JSON string[];非法值逐项剔除。
- * 与其它维度不同:空数组是合法状态(用户显式全不选 = 行右侧留空),
- * 只有解析失败 / 未设置才回落默认。
+ * 旧 string[] 没有记录用户是否见过标签开关,升级时补上默认开启的标签,
+ * 保留其他字段及顺序。新版本以带版本号的字段列表记录显式选择,
+ * 包括关闭标签或全不选;后续启动不再覆盖这些选择。
*/
export function loadTaskInfoFields(): TaskInfoField[] {
const storage = safeStorage();
@@ -578,15 +579,17 @@ export function loadTaskInfoFields(): TaskInfoField[] {
if (raw == null) return [...DEFAULT_TASK_INFO_FIELDS];
try {
const parsed = JSON.parse(raw);
- if (!Array.isArray(parsed)) return [...DEFAULT_TASK_INFO_FIELDS];
+ const legacy = Array.isArray(parsed);
+ const values = legacy ? parsed : parsed?.version === 1 ? parsed.fields : null;
+ if (!Array.isArray(values)) return [...DEFAULT_TASK_INFO_FIELDS];
const seen = new Set<string>();
const cleaned: TaskInfoField[] = [];
- for (const value of parsed) {
+ for (const value of values) {
if (typeof value !== 'string' || !TASK_INFO_VALUES.has(value) || seen.has(value)) continue;
seen.add(value);
cleaned.push(value as TaskInfoField);
}
- return cleaned;
+ return legacy && !seen.has('tags') ? ['tags', ...cleaned] : cleaned;
} catch (err) {
log.warn('[useSidebarFilter] failed to parse taskInfo JSON:', err);
return [...DEFAULT_TASK_INFO_FIELDS];
@@ -597,7 +600,7 @@ export function persistTaskInfoFields(fields: readonly TaskInfoField[]): void {
const storage = safeStorage();
if (!storage) return;
try {
- storage.setItem(TASK_INFO_KEY, JSON.stringify(fields));
+ storage.setItem(TASK_INFO_KEY, JSON.stringify({ version: 1, fields }));
} catch (err) {
log.warn('[useSidebarFilter] failed to persist taskInfo:', err);
}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
index 1991a04579..c2812d3dd4 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
@@ -1,3 +1,4 @@
+import { TaskTagMenuSection, TaskTagEditor, TaskTagDots } from '@/features/task-tags/TaskTags';
/**
* SessionCard — sidebar-card-mode 下的单条会话卡片(SessionItem 的瀑布流形态)
* ---------------------------------------------------------------------------
@@ -195,6 +196,16 @@ export const SessionCard = withSidebarNavigation<SessionCardProps>(function Sess
const remoteIconConnectionStatus = session.deviceLinkDeviceId
? (session.deviceLinkConnectionStatus ?? 'connected')
: null;
+ const [tagEditorOpen, setTagEditorOpen] = useState(false);
+ const tagMenu = (
+ <TaskTagMenuSection
+ session={session}
+ onMore={() => {
+ setTagEditorOpen(true);
+ setMenuPos(null);
+ }}
+ />
+ );
const remoteWritesBlocked = isRemoteSessionWriteBlocked(session);
const isAutomationGenerated = isAutomationGeneratedSession(session);
const boundSchedules = useSessionBoundSchedules(session.id);
@@ -674,11 +685,12 @@ export const SessionCard = withSidebarNavigation<SessionCardProps>(function Sess
// 把下方所有行整体推移,选中/取消时列表跳动(2026-08-12 用户反馈)。
// inset shadow 画在盒内、不参与布局,行高与未选中时逐像素一致。
isActive
- ? 'bg-sidebar-item-active text-sidebar-item-active-foreground shadow-[inset_0_0_0_1px_var(--sidebar-item-active-border)]'
+ ? 'bg-sidebar-item-active [--task-tag-ring-bg:hsl(var(--sidebar-item-active))] text-sidebar-item-active-foreground shadow-[inset_0_0_0_1px_var(--sidebar-item-active-border)]'
: cn(
- 'hover:bg-sidebar-item-hover',
+ 'hover:bg-sidebar-item-hover hover:[--task-tag-ring-bg:hsl(var(--sidebar-item-hover))]',
// 菜单开着时鼠标常会离开行,行底仍保持 hover 色。
- menuPos !== null && 'bg-sidebar-item-hover',
+ menuPos !== null &&
+ 'bg-sidebar-item-hover [--task-tag-ring-bg:hsl(var(--sidebar-item-hover))]',
),
)
: cn(
@@ -686,8 +698,8 @@ export const SessionCard = withSidebarNavigation<SessionCardProps>(function Sess
// 负责分配列;卡片高度随标题/摘要自然变化。
'rounded-xl bg-[var(--surface-elevated)] border',
isActive
- ? 'border-[var(--sidebar-item-active-border)] !bg-sidebar-item-active text-sidebar-item-active-foreground'
- : 'border-sidebar-border hover:!bg-sidebar-item-hover',
+ ? 'border-[var(--sidebar-item-active-border)] !bg-sidebar-item-active [--task-tag-ring-bg:hsl(var(--sidebar-item-active))] text-sidebar-item-active-foreground'
+ : 'border-sidebar-border [--task-tag-ring-bg:var(--surface-elevated)] hover:!bg-sidebar-item-hover hover:[--task-tag-ring-bg:hsl(var(--sidebar-item-hover))]',
),
// 多选选中态(与列表 SessionItem 同款):内描边软高亮,不与 active 互斥。
isSelected && 'ring-1 ring-inset ring-[var(--focus-ring-soft)]',
@@ -1090,6 +1102,7 @@ export const SessionCard = withSidebarNavigation<SessionCardProps>(function Sess
</DropdownMenuItem>
{exportShareMenuItem}
{copySessionIdSubmenu}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -1109,6 +1122,7 @@ export const SessionCard = withSidebarNavigation<SessionCardProps>(function Sess
{t('ccAgent.sidebar.sessionMenu.rename')}
</DropdownMenuItem>
{copySessionIdSubmenu}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -1147,6 +1161,7 @@ export const SessionCard = withSidebarNavigation<SessionCardProps>(function Sess
{t('ccAgent.sidebar.sessionMenu.openInNewWindow')}
</DropdownMenuItem>
{exportShareMenuItem}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -1168,6 +1183,8 @@ export const SessionCard = withSidebarNavigation<SessionCardProps>(function Sess
</DropdownMenu>
)}
+ {tagEditorOpen && <TaskTagEditor session={session} onClose={() => setTagEditorOpen(false)} />}
+
{shareExportOpen && (
<SessionShareExportDialog
open={shareExportOpen}
@@ -1222,20 +1239,26 @@ function TimeActionsSlot({
const { t } = useTranslation();
return (
<div className="group/slot relative ml-auto flex h-[22px] shrink-0 items-center justify-end">
+ {pieces.find((piece) => piece.key === 'tags')?.tags?.length ? (
+ <span className="mr-1 inline-flex shrink-0 items-center">
+ <TaskTagDots tags={pieces.find((piece) => piece.key === 'tags')?.tags} />
+ </span>
+ ) : null}
<div className="grid h-[22px] grid-cols-[max-content] items-center justify-items-end">
{/* 默认内容:worktree + 信息槽;hover / 菜单打开 / archivePending 时淡出让位给操作钮。 */}
<div
className={cn(
// duration 与操作钮的渐显同拍(120ms),让位/回归一进一出同步。
'col-start-1 row-start-1 flex items-center gap-1 transition-opacity duration-[120ms]',
- !archivePending && 'group-hover/card:opacity-0 group-focus-within/slot:opacity-0',
- (menuOpen || yieldToOrdinalBadge) && 'opacity-0',
+ !archivePending &&
+ 'group-hover/card:opacity-0 group-hover/card:w-0 group-hover/card:overflow-hidden group-focus-within/slot:opacity-0 group-focus-within/slot:w-0 group-focus-within/slot:overflow-hidden',
+ (menuOpen || yieldToOrdinalBadge) && 'opacity-0 w-0 overflow-hidden',
// 确认胶囊覆盖同一槽位时立即隐藏日期,避免 120ms 淡出期间文字叠在一起。
- archivePending && 'invisible opacity-0',
+ archivePending && 'invisible opacity-0 w-0 overflow-hidden',
)}
>
<SessionInfoMeta
- pieces={pieces}
+ pieces={pieces.filter((piece) => piece.key !== 'tags')}
prRef={prRef}
worktree={worktree}
isActive={isActive}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx
index e416ef34c3..d207d2efca 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx
@@ -35,6 +35,7 @@
*/
import { useEffect, useState } from 'react';
+import { TaskTagDots } from '@/features/task-tags/TaskTags';
import { Folders, GitPullRequest } from 'lucide-react';
import { formatCompactTokens } from '@cindy/maker-shared/usage-format';
import { useTranslation } from 'react-i18next';
@@ -66,6 +67,7 @@ type TFunc = (key: string, options?: Record<string, unknown>) => string;
export interface SessionInfoPiece {
key: TaskInfoField;
text: string;
+ tags?: Session['tags'];
/** hover 提示(绝对时间 / 字段说明)。 */
title?: string;
/** time 片段:渲染成语义化 <time dateTime>(与旧时间槽一致)。 */
@@ -91,6 +93,10 @@ export function buildSessionInfoPieces(
): SessionInfoPiece[] {
const pieces: SessionInfoPiece[] = [];
for (const field of fields) {
+ if (field === 'tags') {
+ if (session.tags?.length) pieces.push({ key: 'tags', text: '', tags: session.tags });
+ continue;
+ }
if (field === 'tokens') {
if (session.totalTokenUsage > 0) {
pieces.push({
@@ -313,7 +319,9 @@ export function SessionInfoMeta({
·
</span>
)}
- {piece.key === 'pr' ? (
+ {piece.key === 'tags' ? (
+ <TaskTagDots tags={piece.tags} />
+ ) : piece.key === 'pr' ? (
prRef ? (
<PrNumberPiece prRef={prRef} isActive={isActive} />
) : null
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
index f9ff51b6de..44a78aa301 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
@@ -1,3 +1,4 @@
+import { TaskTagMenuSection, TaskTagEditor, TaskTagDots } from '@/features/task-tags/TaskTags';
/**
* SessionItem — 单条 CCS 会话行
* ---------------------------------------------------------------------------
@@ -430,6 +431,16 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
const remoteIconConnectionStatus = session.deviceLinkDeviceId
? (session.deviceLinkConnectionStatus ?? 'connected')
: null;
+ const [tagEditorOpen, setTagEditorOpen] = useState(false);
+ const tagMenu = (
+ <TaskTagMenuSection
+ session={session}
+ onMore={() => {
+ setTagEditorOpen(true);
+ setMenuPos(null);
+ }}
+ />
+ );
const remoteWritesBlocked = isRemoteSessionWriteBlocked(session);
const isAutomationGenerated = isAutomationGeneratedSession(session);
// heartbeat schedule 绑定标识(targetSessionId 指向本会话);schedule 删除/过期后
@@ -965,13 +976,14 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
// active 描边必须画在盒内且不参与布局。真实 border 会让固定宽高的
// border-box 内容区四边各缩 1px,导致选中行的左侧 icon / 标题整体右移。
isActive
- ? 'bg-sidebar-item-active text-sidebar-item-active-foreground shadow-[inset_0_0_0_1px_var(--sidebar-item-active-border)]'
+ ? 'bg-sidebar-item-active [--task-tag-ring-bg:hsl(var(--sidebar-item-active))] text-sidebar-item-active-foreground shadow-[inset_0_0_0_1px_var(--sidebar-item-active-border)]'
: isSelected
- ? 'bg-[var(--chat-input-chip-bg)] text-foreground'
+ ? 'bg-[var(--chat-input-chip-bg)] [--task-tag-ring-bg:var(--chat-input-chip-bg)] text-foreground'
: cn(
- 'text-foreground hover:bg-sidebar-item-hover',
+ 'text-foreground hover:bg-sidebar-item-hover hover:[--task-tag-ring-bg:hsl(var(--sidebar-item-hover))]',
// 菜单开着时鼠标常会离开行,行底仍保持 hover 色。
- menuPos !== null && 'bg-sidebar-item-hover',
+ menuPos !== null &&
+ 'bg-sidebar-item-hover [--task-tag-ring-bg:hsl(var(--sidebar-item-hover))]',
),
isSelected && 'ring-1 ring-inset ring-[var(--focus-ring-soft)]',
)}
@@ -1071,6 +1083,11 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
槽宽取信息层与按钮的较大值——不再绝对定位盖到标题上。 */}
{!isEditing && (
<div className="group/slot relative ml-auto flex h-6 shrink-0 items-center justify-end">
+ {infoPieces.find((piece) => piece.key === 'tags')?.tags?.length ? (
+ <span className="mr-1 inline-flex shrink-0 items-center">
+ <TaskTagDots tags={session.tags} />
+ </span>
+ ) : null}
{/* 任务信息同步 fade-out:hover/菜单打开/archivePending 时
一起让位,确保只有 action buttons 占住右侧。fade 容器复用同一份条件,
避免两个元素 fade 时机不一致产生闪烁。
@@ -1084,11 +1101,12 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
'col-start-1 row-start-1 flex items-center gap-1',
// duration 与 action 按钮组的渐显同拍(120ms),让位/回归一进一出同步。
'transition-opacity duration-[120ms]',
- !archivePending && 'group-hover:opacity-0 group-focus-within/slot:opacity-0',
- menuPos !== null && 'opacity-0',
- archivePending && 'opacity-0',
+ !archivePending &&
+ 'group-hover:opacity-0 group-hover:w-0 group-hover:overflow-hidden group-focus-within/slot:opacity-0 group-focus-within/slot:w-0 group-focus-within/slot:overflow-hidden',
+ menuPos !== null && 'opacity-0 w-0 overflow-hidden',
+ archivePending && 'opacity-0 w-0 overflow-hidden',
// mod+1..9 序号徽标出现时同样让位:徽标独占行尾,不与时间/badge 并排。
- ordinalBadgeLabel != null && 'opacity-0',
+ ordinalBadgeLabel != null && 'opacity-0 w-0 overflow-hidden',
)}
>
{cindyMakePreparing && rightStatusKind === 'running' ? (
@@ -1108,7 +1126,7 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
// 任务信息复选:按用户勾选拼装 pr / worktree / tokens / cost / time;默认仅
// time,与旧时间槽渲染等价。全不选 → SessionInfoMeta 渲染 null,槽宽归零。
<SessionInfoMeta
- pieces={infoPieces}
+ pieces={infoPieces.filter((piece) => piece.key !== 'tags')}
prRef={infoPrRef}
worktree={infoWorktree ?? undefined}
isActive={isActive}
@@ -1259,6 +1277,7 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
</DropdownMenuItem>
{exportShareMenuItem}
{copySessionIdSubmenu}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -1279,6 +1298,7 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
{t('ccAgent.sidebar.sessionMenu.rename')}
</DropdownMenuItem>
{copySessionIdSubmenu}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -1318,6 +1338,7 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
{t('ccAgent.sidebar.sessionMenu.openInNewWindow')}
</DropdownMenuItem>
{exportShareMenuItem}
+ {tagMenu}
<DropdownMenuSeparator className={MENU_SEPARATOR_CLASS} />
<DropdownMenuItem
disabled={remoteWritesBlocked}
@@ -1340,6 +1361,7 @@ export const SessionItem = withSidebarNavigation<SessionItemProps>(function Sess
)}
{/* 导出 .cshare 弹窗:仅打开时挂载,避免侧栏每行常驻 Dialog 实例。 */}
+ {tagEditorOpen && <TaskTagEditor session={session} onClose={() => setTagEditorOpen(false)} />}
{shareExportOpen && (
<SessionShareExportDialog
open={shareExportOpen}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
index 4ef1fabe76..c2bc122934 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
@@ -47,6 +47,7 @@ import {
Info,
LayoutList,
SlidersHorizontal,
+ Tags,
Wallet,
type LucideIcon,
} from 'lucide-react';
@@ -87,6 +88,7 @@ import type {
UseSidebarFilterReturn,
} from '../hooks/useSidebarFilter';
import { DIALOGUE_FILTER_KEY, projectFilterIncludes } from '../hooks/helpers/sidebarFilterCore';
+import { DEFAULT_TASK_INFO_FIELDS } from '../hooks/helpers/sidebarFilterCore';
import { useTaskInfoFields, type TaskInfoField } from '../hooks/useTaskInfoFields';
import {
MENU_CONTENT_CLASS,
@@ -173,6 +175,7 @@ const PROJECT_ORDER_OPTIONS: ReadonlyArray<Option<FilterProjectOrder>> = [
* token=Coins、费用=Wallet。
*/
const TASK_INFO_OPTIONS: ReadonlyArray<Option<TaskInfoField>> = [
+ { value: 'tags', labelKey: 'taskTags.title', Icon: Tags },
{ value: 'time', labelKey: 'ccAgent.sidebar.taskInfo.time', Icon: Clock },
{ value: 'pr', labelKey: 'ccAgent.sidebar.taskInfo.pr', Icon: GitPullRequest },
{ value: 'worktree', labelKey: 'ccAgent.sidebar.taskInfo.worktree', Icon: Folders },
@@ -530,7 +533,8 @@ export function SidebarFilterPopover({
)
.join(t('ccAgent.sidebar.taskInfoSummarySeparator'))
: t('ccAgent.sidebar.taskInfoSummaryNone');
- const taskInfoIsDefault = taskInfoFields.length === 1 && taskInfoFields[0] === 'time';
+ const taskInfoIsDefault = taskInfoFields.length === DEFAULT_TASK_INFO_FIELDS.length &&
+ DEFAULT_TASK_INFO_FIELDS.every((field, index) => taskInfoFields[index] === field);
const ariaLabel = t('ccAgent.sidebar.filterAria', {
status: statusValue,
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
index 8f27c65253..5a69bdf1fd 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
@@ -241,7 +241,9 @@ describe('SessionCard review regressions', () => {
expect(sessionCardSource).toContain(
'!isEditing && !archivePending && ordinalBadgeLabel != null',
);
- expect(sessionCardSource).toContain("archivePending && 'invisible opacity-0'");
+ expect(sessionCardSource).toContain(
+ "archivePending && 'invisible opacity-0 w-0 overflow-hidden'",
+ );
});
it('keeps running card previews stable instead of streaming compact activity text', () => {
diff --git a/apps/desktop/src/renderer/features/device-link/remoteProjectsStore.ts b/apps/desktop/src/renderer/features/device-link/remoteProjectsStore.ts
index 75defbdc6d..a93e3e41f1 100644
--- a/apps/desktop/src/renderer/features/device-link/remoteProjectsStore.ts
+++ b/apps/desktop/src/renderer/features/device-link/remoteProjectsStore.ts
@@ -1,3 +1,4 @@
+import { normalizeTaskTags, reconcileTaskTags } from '@cindy/maker-shared';
/**
* remoteProjectsStore —— 控制端「远程项目」内存层(device-link 跨设备远程控制)。
* ---------------------------------------------------------------------------
@@ -631,6 +632,28 @@ const actions = {
* - 落到未知 session:active 一律重拉;archived 仅在归档桶已加载时重拉,避免后台
* 为用户尚未查看的历史记录额外取数。
*/
+ applyTagCatalog(deviceId: string, tags: unknown): void {
+ const shard = shards.get(deviceId);
+ // Any list read may also be bringing in new or unarchived tasks. Reconcile
+ // every observed bucket after fencing it, not only its first snapshot.
+ for (const status of ['active', 'archived'] as const) {
+ actions.nextSnapshotEpoch(deviceId, status);
+ if (
+ shard?.loadedStatuses.has(status) ||
+ actions.isSessionStatusLoading(deviceId, status) ||
+ (!shard && status === 'active')
+ ) {
+ requestRemoteReseed(deviceId, status);
+ }
+ }
+ if (!shard) return;
+ const catalog = normalizeTaskTags(tags, 256);
+ shard.sessions = shard.sessions.map((session) => ({
+ ...session,
+ tags: reconcileTaskTags(session.tags, catalog),
+ }));
+ recompute();
+ },
applyPatch(deviceId: string, sessionId: string, patch: Record<string, unknown>): void {
// Even an unknown row can be deleted/archived while its first GET is in flight.
// Usage, reply timestamps and list presentation cannot change its route
diff --git a/apps/desktop/src/renderer/features/device-link/useDeviceLinkRemoteProjects.ts b/apps/desktop/src/renderer/features/device-link/useDeviceLinkRemoteProjects.ts
index ac89098c14..ff51ba9a60 100644
--- a/apps/desktop/src/renderer/features/device-link/useDeviceLinkRemoteProjects.ts
+++ b/apps/desktop/src/renderer/features/device-link/useDeviceLinkRemoteProjects.ts
@@ -1,3 +1,4 @@
+import { evictTaskTagCatalog } from '../task-tags/taskTagEvents';
/**
* useDeviceLinkRemoteProjects —— device-link「自动常驻」接入器(listing tier,push 驱动)。
* ---------------------------------------------------------------------------
@@ -299,7 +300,10 @@ export function resolveIneligibleRemoteProjectAction(input: {
return 'remove';
}
-export function useDeviceLinkRemoteProjects(periodicReconcileActive = true, windowRole: 'main' | 'sidebar' = 'main'): void {
+export function useDeviceLinkRemoteProjects(
+ periodicReconcileActive = true,
+ windowRole: 'main' | 'sidebar' = 'main',
+): void {
const { isAuthenticated, deviceId: selfDeviceId, dataOwnerId } = useAuth();
const periodicReconcileActiveRef = useRef(periodicReconcileActive);
periodicReconcileActiveRef.current = periodicReconcileActive;
@@ -420,6 +424,7 @@ export function useDeviceLinkRemoteProjects(periodicReconcileActive = true, wind
* subscribeAndBootstrap 重试 —— 被控端恢复后即自动接回。
*/
const handleRevoked = (deviceId: string): void => {
+ evictTaskTagCatalog(deviceId);
clearArchivedSessionRetry(deviceId);
eligible.delete(deviceId);
revokedDevicesStore.markRevoked(deviceId);
diff --git a/apps/desktop/src/renderer/features/task-tags/TaskTags.tsx b/apps/desktop/src/renderer/features/task-tags/TaskTags.tsx
new file mode 100644
index 0000000000..c80a1862dd
--- /dev/null
+++ b/apps/desktop/src/renderer/features/task-tags/TaskTags.tsx
@@ -0,0 +1,926 @@
+import './taskTags.css';
+import { subscribeTaskTagCatalog, readTaskTagCatalog, captureTaskTagScope } from './taskTagEvents';
+import { useEffect, useLayoutEffect, useState, useRef } from 'react';
+import * as Dialog from '@radix-ui/react-dialog';
+import { Check, X, MoreHorizontal, Plus, Pencil, GripVertical, ArrowLeft } from 'lucide-react';
+import { Tip } from '@/components/ui/tooltip';
+import { useTranslation } from 'react-i18next';
+import {
+ TASK_TAG_COLORS,
+ taskTagNameKey,
+ taskTagErrorKey,
+ taskTagEditRevision,
+ reconcileTaskTags,
+ type TaskTag,
+ type TaskTagColor,
+ type TaskTagRequest,
+ type TaskTagResult,
+} from '@cindy/maker-shared';
+import type { Session } from '@/lib/ccAgent.types';
+import { isRemoteSessionWriteBlocked } from '@/features/cc-agent/lib/remoteSessionWriteGuard';
+
+const buttonBase = 'rounded-full px-3 py-1.5 text-sm disabled:opacity-40';
+const button = `${buttonBase} enabled:hover:bg-[var(--surface-hover)]`;
+const secondaryButton = `${button} border border-[var(--border-default)]`;
+const dangerButton = `${buttonBase} border border-[hsl(var(--destructive))] text-[hsl(var(--destructive))] enabled:hover:bg-[color-mix(in_srgb,hsl(var(--destructive))_10%,transparent)]`;
+const primaryButton = `${buttonBase} bg-[var(--accent-cta-bg-pure)] text-[var(--accent-pure-cta-fg)] enabled:hover:bg-[var(--button-cta-hover)] enabled:active:bg-[var(--button-cta-pressed)]`;
+const swatch = (tag: TaskTag) => ({
+ backgroundColor: `var(--task-tag-${tag.color === 'none' || tag.color === 'white' ? 'white' : tag.color})`,
+});
+function tagName(tag: TaskTag, t: (key: string) => string) {
+ const key = taskTagNameKey(tag);
+ return key ? t(key) : tag.name;
+}
+export function TaskTagDots({ tags = [] }: { tags?: TaskTag[] }) {
+ const { t } = useTranslation();
+ if (!tags.length) return null;
+ return (
+ <span
+ className="inline-flex shrink-0 items-center pl-1"
+ aria-label={tags.map((tag) => tagName(tag, t)).join(', ')}
+ >
+ {tags.map((tag) => (
+ <Tip key={tag.id} text={tagName(tag, t)} delay={0}>
+ <span
+ aria-label={tagName(tag, t)}
+ className="-ml-1 block h-2.5 w-2.5 rounded-full border border-[var(--task-tag-ring-bg,hsl(var(--sidebar)))]"
+ style={{
+ ...swatch(tag),
+ ...(tag.color === 'none' || tag.color === 'white'
+ ? { borderColor: 'var(--border-default)' }
+ : {}),
+ }}
+ />
+ </Tip>
+ ))}
+ </span>
+ );
+}
+async function execute(session: Session, request: TaskTagRequest): Promise<TaskTagResult> {
+ if (isRemoteSessionWriteBlocked(session)) throw new Error('OFFLINE');
+ const scope = captureTaskTagScope(session.deviceLinkDeviceId);
+ const result = await (session.deviceLinkDeviceId
+ ? ((await window.electronAPI.deviceLink.invoke(
+ session.deviceLinkDeviceId,
+ 'local-db:task-tags:execute',
+ [request],
+ )) as TaskTagResult)
+ : window.electronAPI.localDb.taskTags.execute(request));
+ scope.store(result.tags, result.supportedColors);
+ const catalog = scope.current() ? readTaskTagCatalog(session.deviceLinkDeviceId) : undefined;
+ return catalog
+ ? {
+ ...result,
+ tags: catalog.tags,
+ sessions: result.sessions.map(row => ({ ...row, tags: reconcileTaskTags(row.tags, catalog.tags) })),
+ }
+ : result;
+}
+export function TaskTagMenuSection({ session, onMore }: { session: Session; onMore: () => void }) {
+ const { t } = useTranslation();
+ const target = JSON.stringify([session.deviceLinkDeviceId, session.id]);
+ const currentTarget = useRef(target);
+ currentTarget.current = target;
+ const [tags, setTags] = useState<TaskTag[]>(
+ () => readTaskTagCatalog(session.deviceLinkDeviceId)?.tags ?? [],
+ );
+ const [reload, setReload] = useState(0);
+ const [highlightedId, setHighlightedId] = useState<string | null>(null);
+ const [selected, setSelected] = useState(session.tags ?? []);
+ const catalogGeneration = useRef(0);
+ const selectionGeneration = useRef(0);
+ const alive = useRef(true);
+ useEffect(() => {
+ alive.current = true;
+ return () => {
+ alive.current = false;
+ };
+ }, []);
+ useEffect(
+ () =>
+ subscribeTaskTagCatalog((deviceId, catalog) => {
+ if (deviceId !== session.deviceLinkDeviceId) return;
+ catalogGeneration.current++;
+ setTags(catalog);
+ setSelected((current) => reconcileTaskTags(current, catalog));
+ }),
+ [session.deviceLinkDeviceId],
+ );
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState('');
+ const blocked = isRemoteSessionWriteBlocked(session);
+ useEffect(() => {
+ selectionGeneration.current++;
+ setSelected(session.tags ?? []);
+ }, [session.tags]);
+ useEffect(() => {
+ let alive = true;
+ const catalogAtStart = catalogGeneration.current;
+ const selectionAtStart = selectionGeneration.current;
+ const scope = captureTaskTagScope(session.deviceLinkDeviceId);
+ setTags(readTaskTagCatalog(session.deviceLinkDeviceId)?.tags ?? []);
+ if (blocked) {
+ setBusy(false);
+ return;
+ }
+ setError('');
+ setBusy(true);
+ execute(session, { action: 'get', sessionIds: [session.id] })
+ .then((r) => {
+ if (!scope.current()) return;
+ if (alive && catalogAtStart === catalogGeneration.current) setTags(r.tags);
+ if (alive && selectionAtStart === selectionGeneration.current) {
+ const row = r.sessions.find((item) => item.sessionId === session.id);
+ if (row) setSelected(row.tags);
+ }
+ })
+ .catch((e) => {
+ if (alive && scope.current()) setError(taskTagErrorKey(e, 'get'));
+ })
+ .finally(() => {
+ if (alive) setBusy(false);
+ });
+ return () => {
+ alive = false;
+ };
+ }, [session.id, session.deviceLinkDeviceId, session.deviceLinkConnectionStatus, blocked, reload]);
+
+ const highlightedTag = tags.find((tag) => tag.id === highlightedId);
+ return (
+ <div
+ className="border-t border-[var(--border-default)] px-2 py-2 my-1"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <div className="mb-1 max-w-60 truncate text-xs text-[var(--text-secondary)]">
+ {highlightedTag
+ ? t(
+ selected.some((tag) => tag.id === highlightedTag.id)
+ ? 'taskTags.removeLabel'
+ : 'taskTags.addLabel',
+ {
+ name: tagName(highlightedTag, t),
+ },
+ )
+ : t('taskTags.title')}
+ </div>
+ {error !== 'unavailable' && (
+ <div className="flex items-center" role="group" aria-label={t('taskTags.title')}>
+ {tags.slice(0, 7).map((tag) => {
+ const checked = selected.some((value) => value.id === tag.id);
+ const name = tagName(tag, t);
+ return (
+ <Tip
+ key={tag.id}
+ text={t(checked ? 'taskTags.removeLabel' : 'taskTags.addLabel', { name })}
+ side="bottom"
+ delay={150}
+ >
+ <button
+ type="button"
+ disabled={busy || blocked}
+ aria-label={tagName(tag, t)}
+ aria-pressed={checked}
+ onPointerEnter={() => setHighlightedId(tag.id)}
+ onPointerLeave={() =>
+ setHighlightedId((current) => (current === tag.id ? null : current))
+ }
+ onFocus={() => setHighlightedId(tag.id)}
+ onBlur={() =>
+ setHighlightedId((current) => (current === tag.id ? null : current))
+ }
+ className="group/tag flex h-7 w-6 shrink-0 items-center justify-center rounded-full focus-visible:outline disabled:opacity-40"
+ onClick={async () => {
+ setBusy(true);
+ setError('');
+ const catalogAtStart = catalogGeneration.current;
+ const selectionAtStart = selectionGeneration.current;
+ const scope = captureTaskTagScope(session.deviceLinkDeviceId);
+ try {
+ const r = await execute(session, {
+ action: selected.some((v) => v.id === tag.id) ? 'detach' : 'attach',
+ sessionIds: [session.id],
+ tagIds: [tag.id],
+ });
+ if (!alive.current || !scope.current() || currentTarget.current !== target) return null;
+ if (catalogAtStart === catalogGeneration.current) setTags(r.tags);
+ if (selectionAtStart === selectionGeneration.current)
+ setSelected(r.sessions[0]?.tags ?? []);
+ } catch (e) {
+ if (alive.current && scope.current() && currentTarget.current === target) setError(taskTagErrorKey(e, 'attach'));
+ } finally {
+ if (alive.current && scope.current() && currentTarget.current === target) setBusy(false);
+ }
+ }}
+ >
+ <span
+ className={`flex h-4 w-4 items-center justify-center rounded-full border-[0.5px] border-[var(--border-default)] transition-transform duration-[var(--motion-instant)] ease-[var(--motion-ease-move)] motion-reduce:transition-none group-hover/tag:scale-150 group-focus-visible/tag:scale-150 ${tag.color === 'none' || tag.color === 'white' ? 'text-[var(--task-tag-white-check)]' : 'text-[var(--text-primary-on-dark)]'}`}
+ style={swatch(tag)}
+ >
+ {checked ? (
+ highlightedId === tag.id ? (
+ <X size={12} strokeWidth={2.5} aria-hidden />
+ ) : (
+ <Check size={12} strokeWidth={2.5} aria-hidden />
+ )
+ ) : (
+ <Plus
+ size={12}
+ strokeWidth={2.5}
+ aria-hidden
+ className="opacity-0 group-hover/tag:opacity-100 group-focus-visible/tag:opacity-100"
+ />
+ )}
+ </span>
+ </button>
+ </Tip>
+ );
+ })}
+ <button
+ type="button"
+ className="group/tag flex h-7 w-6 shrink-0 items-center justify-center rounded-full focus-visible:outline disabled:opacity-40"
+ aria-label={t('taskTags.more')}
+ title={t('taskTags.more')}
+ disabled={
+ (blocked && !readTaskTagCatalog(session.deviceLinkDeviceId)) || error === 'unavailable'
+ }
+ onClick={onMore}
+ >
+ <span className="flex h-4 w-4 items-center justify-center rounded-full border-[0.5px] border-[var(--border-default)] text-[var(--text-secondary)] transition-transform duration-[var(--motion-instant)] ease-[var(--motion-ease-move)] motion-reduce:transition-none group-hover/tag:scale-150 group-focus-visible/tag:scale-150">
+ <MoreHorizontal size={12} aria-hidden />
+ </span>
+ </button>
+ </div>
+ )}
+ {error && (
+ <p className="max-w-64 text-xs text-[var(--text-secondary)]" role="status">
+ {t(`taskTags.${error}`)}
+ {error === 'loadFailed' && (
+ <button
+ type="button"
+ className={button}
+ disabled={busy || blocked}
+ onClick={() => setReload((value) => value + 1)}
+ >
+ {t('taskTags.retry')}
+ </button>
+ )}
+ </p>
+ )}
+ </div>
+ );
+}
+export function TaskTagEditor({ session, onClose }: { session: Session; onClose: () => void }) {
+ const { t } = useTranslation();
+ const [tags, setTags] = useState<TaskTag[]>(
+ () => readTaskTagCatalog(session.deviceLinkDeviceId)?.tags ?? [],
+ );
+ const [selected, setSelected] = useState<TaskTag[]>(session.tags ?? []);
+ const requestGeneration = useRef(0);
+ const selectionGeneration = useRef(0);
+ const catalogGeneration = useRef(0);
+ const latestCatalog = useRef<TaskTag[]>(tags);
+ const alive = useRef(true);
+ useEffect(() => {
+ alive.current = true;
+ return () => {
+ alive.current = false;
+ };
+ }, []);
+ useEffect(
+ () =>
+ subscribeTaskTagCatalog((deviceId, catalog) => {
+ if (deviceId !== session.deviceLinkDeviceId) return;
+ catalogGeneration.current++;
+ latestCatalog.current = catalog;
+ setTags(catalog);
+ setSelected((current) => reconcileTaskTags(current, catalog));
+ }),
+ [session.deviceLinkDeviceId],
+ );
+ const [draggedId, setDraggedId] = useState<string | null>(null);
+ const tagListRef = useRef<HTMLDivElement>(null);
+ const pointerDrag = useRef<{
+ id: string;
+ from: number;
+ to: number;
+ expectedOrder: string[];
+ pointerId: number;
+ startY: number;
+ clientY: number;
+ startScroll: number;
+ rowHeight: number;
+ } | null>(null);
+ const dragFrame = useRef<number | null>(null);
+ const dropPositions = useRef<Map<string, number> | null>(null);
+ const dropAnimations = useRef<Animation[]>([]);
+ useLayoutEffect(() => {
+ const positions = dropPositions.current;
+ if (!positions) return;
+ dropPositions.current = null;
+ for (const animation of dropAnimations.current) animation.cancel();
+ dropAnimations.current = [];
+ if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
+ // DOM order and drag transforms have changed together. Animate only the
+ // remaining visual distance, not the old transform in the new DOM slot.
+ for (const row of tagListRef.current?.querySelectorAll<HTMLElement>('[data-tag-row]') ?? []) {
+ const previousTop = positions.get(row.dataset.tagRow ?? '');
+ if (previousTop === undefined) continue;
+ const delta = previousTop - row.getBoundingClientRect().top;
+ if (Math.abs(delta) < 0.5) continue;
+ const motionStyle = getComputedStyle(row);
+ const durationToken = motionStyle.getPropertyValue('--motion-fast').trim();
+ const duration = parseFloat(durationToken) * (durationToken.endsWith('ms') ? 1 : 1000);
+ dropAnimations.current.push(
+ row.animate([{ transform: `translateY(${delta}px)` }, { transform: 'translateY(0px)' }], {
+ duration: Number.isFinite(duration) ? duration : 0,
+ easing: motionStyle.getPropertyValue('--motion-ease-move').trim() || 'linear',
+ }),
+ );
+ }
+ }, [tags, draggedId]);
+ const [dropIndex, setDropIndex] = useState<number | null>(null);
+ const [dragOffset, setDragOffset] = useState(0);
+ function cancelTagDrag() {
+ if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);
+ dragFrame.current = null;
+ pointerDrag.current = null;
+ setDraggedId(null);
+ setDropIndex(null);
+ setDragOffset(0);
+ }
+ useEffect(() => {
+ cancelTagDrag();
+ }, [tags]);
+ useEffect(
+ () => () => {
+ if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);
+ for (const animation of dropAnimations.current) animation.cancel();
+ },
+ [],
+ );
+ function updateTagDrop(clientY: number, autoScroll = false) {
+ const active = pointerDrag.current;
+ const list = tagListRef.current;
+ if (!active || !list) return;
+ active.clientY = clientY;
+ const bounds = list.getBoundingClientRect();
+ if (autoScroll) {
+ if (clientY < bounds.top + 24) list.scrollTop -= 6;
+ else if (clientY > bounds.bottom - 24) list.scrollTop += 6;
+ }
+ const offset = Math.max(
+ -active.from * active.rowHeight,
+ Math.min(
+ (active.expectedOrder.length - 1 - active.from) * active.rowHeight,
+ clientY - active.startY + list.scrollTop - active.startScroll,
+ ),
+ );
+ active.to = Math.max(
+ 0,
+ Math.min(
+ active.expectedOrder.length - 1,
+ active.from + Math.round(offset / active.rowHeight),
+ ),
+ );
+ setDragOffset(offset);
+ setDropIndex(active.to);
+ }
+ function animateTagDrag() {
+ const active = pointerDrag.current;
+ if (!active) return;
+ updateTagDrop(active.clientY, true);
+ dragFrame.current = requestAnimationFrame(animateTagDrag);
+ }
+ function tagRowOffset(index: number) {
+ const active = pointerDrag.current;
+ if (!active || dropIndex === null) return 0;
+ if (index === active.from) return dragOffset;
+ if (active.from < dropIndex && index > active.from && index <= dropIndex)
+ return -active.rowHeight;
+ if (active.from > dropIndex && index >= dropIndex && index < active.from)
+ return active.rowHeight;
+ return 0;
+ }
+ const nameInput = useRef<HTMLInputElement>(null);
+ const [editing, setEditing] = useState<TaskTag | null>(null);
+ const [name, setName] = useState('');
+ const editName = useRef('');
+ const [color, setColor] = useState<TaskTagColor>('blue');
+ const [formOpen, setFormOpen] = useState(false);
+ const [supportedColors, setSupportedColors] = useState<readonly TaskTagColor[]>(
+ () =>
+ readTaskTagCatalog(session.deviceLinkDeviceId)?.supportedColors ??
+ TASK_TAG_COLORS.slice(0, 7),
+ );
+ const clickTimer = useRef(new Map<string, ReturnType<typeof setTimeout>>());
+ const [pendingAttach, setPendingAttach] = useState<string | null>(null);
+ useEffect(
+ () => () => {
+ for (const timer of clickTimer.current.values()) clearTimeout(timer);
+ },
+ [],
+ );
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState('');
+ const [deletion, setDeletion] = useState<TaskTagResult['deletion']>();
+ const blocked = isRemoteSessionWriteBlocked(session);
+ useEffect(() => {
+ if (blocked) cancelTagDrag();
+ }, [blocked]);
+ useEffect(() => {
+ selectionGeneration.current++;
+ setSelected(session.tags ?? []);
+ }, [session.tags]);
+ async function run(request: TaskTagRequest) {
+ const scope = captureTaskTagScope(session.deviceLinkDeviceId);
+ const generation = ++requestGeneration.current;
+ const selectionAtStart = selectionGeneration.current;
+ const catalogAtStart = catalogGeneration.current;
+ setBusy(true);
+ setError('');
+ try {
+ const r = await execute(session, request);
+ if (!alive.current || !scope.current() || generation !== requestGeneration.current) return null;
+ if (catalogAtStart === catalogGeneration.current) {
+ latestCatalog.current = r.tags;
+ setTags(r.tags);
+ }
+ setSupportedColors(r.supportedColors ?? TASK_TAG_COLORS.slice(0, 7));
+ const row = r.sessions.find((s) => s.sessionId === session.id);
+ if (row && selectionAtStart === selectionGeneration.current) {
+ setSelected(
+ catalogAtStart === catalogGeneration.current
+ ? row.tags
+ : reconcileTaskTags(row.tags, latestCatalog.current),
+ );
+ }
+ return r;
+ } catch (e) {
+ if (!alive.current || !scope.current() || generation !== requestGeneration.current) return null;
+ setError(taskTagErrorKey(e, request.action));
+ return null;
+ } finally {
+ if (alive.current && scope.current() && generation === requestGeneration.current) setBusy(false);
+ }
+ }
+ useEffect(() => {
+ const cached = readTaskTagCatalog(session.deviceLinkDeviceId);
+ latestCatalog.current = cached?.tags ?? [];
+ setTags(cached?.tags ?? []);
+ setSupportedColors(cached?.supportedColors ?? TASK_TAG_COLORS.slice(0, 7));
+ if (!blocked) void run({ action: 'get', sessionIds: [session.id] });
+ else setBusy(false);
+ return () => {
+ requestGeneration.current++;
+ };
+ }, [session.id, session.deviceLinkDeviceId, session.deviceLinkConnectionStatus, blocked]);
+ function closeEditor() {
+ setPendingAttach(null);
+ setFormOpen(false);
+ setEditing(null);
+ setDeletion(undefined);
+ }
+ function edit(tag: TaskTag | null) {
+ if (tag) clearTimeout(clickTimer.current.get(tag.id));
+ setFormOpen(true);
+ setEditing(tag);
+ editName.current = tag ? tagName(tag, t) : '';
+ setName(editName.current);
+ setColor(tag?.color === 'none' ? 'white' : (tag?.color ?? 'blue'));
+ setDeletion(undefined);
+ requestAnimationFrame(() => nameInput.current?.focus());
+ }
+ async function moveTag(id: string, to: number, expectedOrder = tags.map((tag) => tag.id)) {
+ if (busy || blocked) return;
+ const from = expectedOrder.indexOf(id);
+ if (from < 0 || to < 0 || to >= tags.length || from === to) return;
+ const tagIds = [...expectedOrder];
+ tagIds.splice(from, 1);
+ tagIds.splice(to, 0, id);
+ const previous = tags;
+ setTags(tagIds.map((tagId) => previous.find((tag) => tag.id === tagId)!));
+ const result = await run({ action: 'reorder', tagIds, expectedOrder });
+ if (!result)
+ setTags((current) =>
+ current.map((tag) => tag.id).join('\0') === tagIds.join('\0') ? previous : current,
+ );
+ if (result && editing) setEditing(result.tags.find((tag) => tag.id === editing.id) ?? null);
+ }
+ return (
+ <Dialog.Root
+ open
+ onOpenChange={(open) => {
+ if (!open && !busy) onClose();
+ }}
+ >
+ <Dialog.Portal>
+ <Dialog.Overlay className="fixed inset-0 z-[200] bg-[var(--overlay-modal)]" />
+ <Dialog.Content
+ onClick={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ onDragStart={(e) => e.stopPropagation()}
+ onDragEnd={(e) => e.stopPropagation()}
+ onDragOver={(e) => e.stopPropagation()}
+ onDrop={(e) => e.stopPropagation()}
+ className={`fixed left-1/2 top-1/2 z-[201] w-[min(380px,calc(100vw-32px))] max-h-[85dvh] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-4 text-[var(--text-primary)] shadow-xl ${formOpen ? 'overflow-auto' : 'flex flex-col overflow-hidden'}`}
+ >
+ <div className="flex shrink-0 items-center gap-2">
+ {formOpen && !deletion && (
+ <button
+ className={button}
+ aria-label={t('taskTags.back')}
+ disabled={busy}
+ onClick={closeEditor}
+ >
+ <ArrowLeft size={16} />
+ </button>
+ )}
+ <Dialog.Title className="flex-1 text-base font-semibold">
+ {t(
+ deletion
+ ? 'taskTags.delete'
+ : formOpen
+ ? editing
+ ? 'taskTags.editTitle'
+ : 'taskTags.add'
+ : 'taskTags.title',
+ )}
+ </Dialog.Title>
+ {!formOpen && (
+ <span className="text-xs text-[var(--text-secondary)]">
+ {t('taskTags.selectedCount', { count: selected.length })}
+ </span>
+ )}
+ </div>
+ <Dialog.Description className="sr-only">{session.title}</Dialog.Description>
+ {!formOpen && (
+ <div
+ ref={tagListRef}
+ className="task-tag-list-scroll my-3 min-h-0 max-h-[528px] overflow-x-hidden overflow-y-auto overscroll-contain"
+ >
+ {tags.map((tag, index) => (
+ <div
+ key={tag.id}
+ data-tag-row={tag.id}
+ style={{
+ transform: `translateY(${tagRowOffset(index)}px)`,
+ zIndex: draggedId === tag.id ? 1 : undefined,
+ }}
+ className={`relative group/tagrow flex items-center gap-2 min-h-11 rounded-lg ${draggedId === tag.id ? 'bg-[var(--surface-hover)] outline outline-1 outline-[var(--border-default)] cursor-grabbing' : `hover:bg-[var(--surface-hover)] ${dropPositions.current ? '' : 'transition-transform duration-[var(--motion-fast)] ease-[var(--motion-ease-move)] motion-reduce:transition-none'}`}`}
+ >
+ <button
+ type="button"
+ className="flex h-7 w-7 shrink-0 cursor-grab items-center justify-center text-[var(--text-secondary)] opacity-0 group-hover/tagrow:opacity-60 group-focus-within/tagrow:opacity-60 [@media(pointer:coarse)]:opacity-60"
+ style={{
+ touchAction: 'none',
+ userSelect: 'none',
+ cursor: draggedId === tag.id ? 'grabbing' : 'grab',
+ opacity: draggedId === tag.id ? 1 : undefined,
+ }}
+ onPointerDown={(event) => {
+ if (event.button !== 0 || busy || blocked) return;
+ event.preventDefault();
+ event.stopPropagation();
+ for (const animation of dropAnimations.current) animation.cancel();
+ dropAnimations.current = [];
+ event.currentTarget.setPointerCapture(event.pointerId);
+ const row = event.currentTarget.closest<HTMLElement>('[data-tag-row]');
+ pointerDrag.current = {
+ id: tag.id,
+ from: index,
+ to: index,
+ expectedOrder: tags.map((item) => item.id),
+ pointerId: event.pointerId,
+ startY: event.clientY,
+ clientY: event.clientY,
+ startScroll: tagListRef.current?.scrollTop ?? 0,
+ rowHeight: row?.getBoundingClientRect().height || 44,
+ };
+ setDragOffset(0);
+ dragFrame.current = requestAnimationFrame(animateTagDrag);
+ setDraggedId(tag.id);
+ setDropIndex(index);
+ }}
+ onPointerMove={(event) => {
+ if (pointerDrag.current?.pointerId !== event.pointerId) return;
+ event.stopPropagation();
+ updateTagDrop(event.clientY);
+ }}
+ onPointerUp={(event) => {
+ if (pointerDrag.current?.pointerId !== event.pointerId) return;
+ event.stopPropagation();
+ updateTagDrop(event.clientY);
+ const active = pointerDrag.current;
+ dropPositions.current = new Map(
+ Array.from(
+ tagListRef.current?.querySelectorAll<HTMLElement>('[data-tag-row]') ?? [],
+ ).map(
+ (row) => [row.dataset.tagRow!, row.getBoundingClientRect().top] as const,
+ ),
+ );
+ cancelTagDrag();
+ if (event.currentTarget.hasPointerCapture(event.pointerId))
+ event.currentTarget.releasePointerCapture(event.pointerId);
+ if (active) void moveTag(active.id, active.to, active.expectedOrder);
+ }}
+ onPointerCancel={cancelTagDrag}
+ onLostPointerCapture={cancelTagDrag}
+ onDragStart={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ }}
+ aria-label={t('taskTags.reorderLabel', { name: tagName(tag, t) })}
+ title={t('taskTags.reorderHint')}
+ disabled={busy || blocked}
+ onKeyDown={(event) => {
+ if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
+ event.preventDefault();
+ void moveTag(tag.id, index + (event.key === 'ArrowUp' ? -1 : 1));
+ }
+ }}
+ >
+ <GripVertical size={14} />
+ </button>
+ <button
+ type="button"
+ disabled={busy || blocked}
+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full"
+ aria-label={t(
+ selected.some((item) => item.id === tag.id)
+ ? 'taskTags.removeLabel'
+ : 'taskTags.addLabel',
+ { name: tagName(tag, t) },
+ )}
+ aria-pressed={selected.some((item) => item.id === tag.id)}
+ onClick={() =>
+ void run({
+ action: selected.some((item) => item.id === tag.id) ? 'detach' : 'attach',
+ sessionIds: [session.id],
+ tagIds: [tag.id],
+ })
+ }
+ >
+ <span
+ className={`flex h-4 w-4 items-center justify-center rounded-full border-[0.5px] border-[var(--border-default)] ${tag.color === 'none' || tag.color === 'white' ? 'text-[var(--task-tag-white-check)]' : 'text-[var(--text-primary-on-dark)]'}`}
+ style={swatch(tag)}
+ >
+ {selected.some((item) => item.id === tag.id) && (
+ <Check size={12} strokeWidth={2.5} />
+ )}
+ </span>
+ </button>
+ <button
+ type="button"
+ disabled={busy || blocked}
+ className="min-w-0 flex-1 truncate py-1.5 text-left text-sm"
+ title={tagName(tag, t)}
+ onDoubleClick={() => edit(tag)}
+ onClick={(event) => {
+ clearTimeout(clickTimer.current.get(tag.id));
+ const toggle = () =>
+ void run({
+ action: selected.some((item) => item.id === tag.id) ? 'detach' : 'attach',
+ sessionIds: [session.id],
+ tagIds: [tag.id],
+ });
+ if (event.detail === 0) toggle();
+ else if (event.detail === 1)
+ clickTimer.current.set(tag.id, setTimeout(toggle, 300));
+ }}
+ >
+ {tagName(tag, t)}
+ </button>
+ <button
+ type="button"
+ disabled={busy || blocked}
+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full opacity-0 group-hover/tagrow:opacity-100 group-focus-within/tagrow:opacity-100 [@media(pointer:coarse)]:opacity-100"
+ aria-label={t('taskTags.editLabel', { name: tagName(tag, t) })}
+ onClick={() => edit(tag)}
+ >
+ <Pencil size={14} />
+ </button>
+ </div>
+ ))}
+ {!tags.length && !error && !blocked && (
+ <p className="py-8 text-center text-sm text-[var(--text-secondary)]" role="status">
+ {t(busy ? 'taskTags.loading' : 'taskTags.empty')}
+ </p>
+ )}
+ </div>
+ )}
+ {!formOpen && (
+ <div className="shrink-0 border-t border-[var(--border-default)] pt-2">
+ <button
+ className={`${button} flex w-full items-center gap-3`}
+ disabled={busy || blocked}
+ onClick={() => edit(null)}
+ >
+ <Plus size={16} />
+ {t('taskTags.add')}
+ </button>
+ </div>
+ )}
+ {formOpen && !deletion && (
+ <form
+ className="space-y-4 pt-4"
+ onSubmit={async (e) => {
+ e.preventDefault();
+ if (pendingAttach) {
+ const attached = await run({
+ action: 'attach',
+ sessionIds: [session.id],
+ tagIds: [pendingAttach],
+ });
+ if (attached) closeEditor();
+ return;
+ }
+ const r = await run(
+ editing
+ ? {
+ action: 'update',
+ tagId: editing.id,
+ revision: taskTagEditRevision(editing, latestCatalog.current),
+ name: name === editName.current ? undefined : name,
+ nameCustomized: name === editName.current ? undefined : true,
+ color:
+ editing.color === 'none' &&
+ color === 'white' &&
+ !supportedColors.includes('white')
+ ? undefined
+ : color,
+ }
+ : { action: 'create', name, color },
+ );
+ if (r) {
+ const created = !editing
+ ? r.tags.find((tag) => tag.name === name.trim())
+ : r.tags.find((tag) => tag.id === pendingAttach);
+ if (created) {
+ setEditing(created);
+ setPendingAttach(created.id);
+ const attached = await run({
+ action: 'attach',
+ sessionIds: [session.id],
+ tagIds: [created.id],
+ });
+ if (!attached) return;
+ }
+ closeEditor();
+ }
+ }}
+ >
+ <label className="block text-sm">
+ {t('taskTags.name')}
+ <input
+ ref={nameInput}
+ className="mt-2 block w-full rounded-lg border border-[var(--border-default)] bg-[var(--surface)] px-3 py-2"
+ value={name}
+ maxLength={80}
+ disabled={busy || blocked || Boolean(pendingAttach)}
+ onChange={(e) => setName(e.target.value)}
+ />
+ </label>
+ <div>
+ <p className="text-sm text-[var(--text-secondary)]">{t('taskTags.color')}</p>
+ <div className="grid grid-cols-6 gap-y-2 py-2">
+ {TASK_TAG_COLORS.map((c) => (
+ <button
+ key={c}
+ type="button"
+ aria-label={t(`taskTags.${c}`)}
+ aria-pressed={color === c}
+ title={t(
+ supportedColors.includes(c) ? `taskTags.${c}` : 'taskTags.unavailable',
+ )}
+ disabled={
+ busy || blocked || Boolean(pendingAttach) || !supportedColors.includes(c)
+ }
+ onClick={() => setColor(c)}
+ className="flex h-11 items-center justify-center rounded-full hover:bg-[var(--surface-hover)] disabled:opacity-30"
+ >
+ <span
+ className={`flex h-6 w-6 items-center justify-center rounded-full border-[0.5px] border-[var(--border-default)] ${c === 'white' ? 'text-[var(--task-tag-white-check)]' : 'text-[var(--text-primary-on-dark)]'}`}
+ style={swatch({ color: c } as TaskTag)}
+ >
+ {color === c && <Check size={14} />}
+ </span>
+ </button>
+ ))}
+ </div>
+ <p className="text-xs text-[var(--text-secondary)]">
+ {t(
+ supportedColors.length < TASK_TAG_COLORS.length
+ ? 'taskTags.unavailable'
+ : editing
+ ? 'taskTags.editHint'
+ : 'taskTags.addHint',
+ )}
+ </p>
+ </div>
+ <div className="flex flex-wrap justify-end gap-2 pt-2">
+ <button
+ className={`${primaryButton} order-3`}
+ disabled={
+ busy ||
+ blocked ||
+ !name.trim() ||
+ (!supportedColors.includes(color) &&
+ !(editing?.color === 'none' && color === 'white'))
+ }
+ type="submit"
+ >
+ {t(editing ? 'taskTags.save' : 'taskTags.create')}
+ </button>
+ <button
+ className={secondaryButton}
+ type="button"
+ disabled={busy}
+ onClick={closeEditor}
+ >
+ {t('taskTags.cancel')}
+ </button>
+ {editing && (
+ <>
+ <button
+ className={`${button} mr-auto order-first text-[var(--text-secondary)]`}
+ type="button"
+ disabled={busy || blocked}
+ onClick={async () => {
+ const r = await run({ action: 'previewDelete', tagId: editing.id });
+ if (r) setDeletion(r.deletion);
+ }}
+ >
+ {t('taskTags.delete')}
+ </button>
+ </>
+ )}
+ </div>
+ </form>
+ )}
+ {deletion && (
+ <div className="space-y-5 pt-3">
+ <p className="break-words text-sm leading-6 text-[var(--text-secondary)]">
+ {t('taskTags.deleteConfirm', {
+ name: editing ? tagName(editing, t) : '',
+ count: deletion.count,
+ })}
+ </p>
+ <div className="flex flex-wrap justify-end gap-2">
+ <button
+ autoFocus
+ className={secondaryButton}
+ disabled={busy}
+ onClick={() => setDeletion(undefined)}
+ >
+ {t('taskTags.cancel')}
+ </button>
+ <button
+ className={dangerButton}
+ disabled={busy || blocked}
+ onClick={async () => {
+ if (
+ await run({
+ action: 'delete',
+ tagId: deletion.tagId,
+ revision: deletion.revision,
+ expectedCount: deletion.count,
+ })
+ )
+ closeEditor();
+ }}
+ >
+ {t('taskTags.delete')}
+ </button>
+ </div>
+ </div>
+ )}
+ {(error || blocked) && (
+ <p
+ className="mt-3 shrink-0 text-xs leading-5 text-[var(--text-secondary)]"
+ role="alert"
+ >
+ {t(`taskTags.${blocked ? 'offline' : error}`)}
+ {!blocked && error === 'loadFailed' && (
+ <button
+ type="button"
+ className={button}
+ disabled={busy}
+ onClick={() => void run({ action: 'get', sessionIds: [session.id] })}
+ >
+ {t('taskTags.retry')}
+ </button>
+ )}
+ </p>
+ )}
+ {!formOpen && (
+ <div className="mt-3 flex shrink-0 justify-end">
+ <button className={primaryButton} disabled={busy} onClick={onClose}>
+ {t('taskTags.done')}
+ </button>
+ </div>
+ )}
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog.Root>
+ );
+}
diff --git a/apps/desktop/src/renderer/features/task-tags/__tests__/TaskTagMenuSection.test.tsx b/apps/desktop/src/renderer/features/task-tags/__tests__/TaskTagMenuSection.test.tsx
new file mode 100644
index 0000000000..8b83d92c2a
--- /dev/null
+++ b/apps/desktop/src/renderer/features/task-tags/__tests__/TaskTagMenuSection.test.tsx
@@ -0,0 +1,359 @@
+// @vitest-environment jsdom
+import React, { act } from 'react';
+import { afterEach, expect, it, vi } from 'vitest';
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { TaskTagEditor, TaskTagMenuSection } from '../TaskTags';
+import { TASK_TAG_COLORS } from '@cindy/maker-shared';
+import { emitTaskTagCatalog, resetTaskTagCatalogCache } from '../taskTagEvents';
+import type { Session } from '@/lib/ccAgent.types';
+
+vi.mock('@/features/cc-agent/lib/remoteSessionWriteGuard', () => ({
+ isRemoteSessionWriteBlocked: (s: Session) => s.deviceLinkConnectionStatus === 'disconnected',
+}));
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({
+ t: (key: string, options?: { name?: string }) =>
+ (
+ ({
+ 'taskTags.title': 'Labels',
+ 'taskTags.red': 'Red',
+ 'taskTags.green': 'Green',
+ 'taskTags.presetWork': '工作',
+ 'taskTags.more': 'More labels',
+ 'taskTags.addLabel': `Add ${options?.name}`,
+ 'taskTags.removeLabel': `Remove ${options?.name}`,
+ }) as Record<string, string>
+ )[key] ?? key,
+ }),
+}));
+
+afterEach(() => {
+ cleanup();
+ resetTaskTagCatalogCache();
+});
+it('treats 工作 to Work as an explicit rename, but not an unchanged save', async () => {
+ const tag = { id: 'preset:work', name: 'Work', color: 'blue', favoriteOrder: null, revision: 1 };
+ const execute = vi.fn(async () => ({ tags: [tag], sessions: [] }));
+ Object.defineProperty(window, 'electronAPI', { configurable: true, value: { localDb: { taskTags: { execute } } } });
+ render(<TaskTagEditor session={{ id: 'task', tags: [] } as unknown as Session} onClose={() => {}} />);
+ fireEvent.doubleClick(await screen.findByRole('button', { name: '工作' }));
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.save' }));
+ await waitFor(() => expect(execute).toHaveBeenLastCalledWith(expect.objectContaining({ action: 'update', name: undefined, nameCustomized: undefined })));
+ fireEvent.doubleClick(await screen.findByRole('button', { name: '工作' }));
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'Work' } });
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.save' }));
+ await waitFor(() => expect(execute).toHaveBeenLastCalledWith(expect.objectContaining({ action: 'update', name: 'Work', nameCustomized: true })));
+});
+
+it.each([false, true])('ignores a previous device mutation after switching tasks (reject: %s)', async (reject) => {
+ const tag = (name: string) => ({ id: name, name, color: 'blue', favoriteOrder: null, revision: 1 });
+ let finish!: (value: unknown) => void;
+ let fail!: (error: Error) => void;
+ const invoke = vi.fn(async (device: string, _channel: string, [request]: [{ action: string }]) => request.action === 'get'
+ ? { tags: [tag(device)], sessions: [] }
+ : new Promise((resolve, reject) => { finish = resolve; fail = reject; }));
+ Object.defineProperty(window, 'electronAPI', { configurable: true, value: { deviceLink: { invoke } } });
+ const session = (device: string) => ({ id: device, deviceLinkDeviceId: device, tags: [] } as unknown as Session);
+ const view = render(<TaskTagMenuSection session={session('A')} onMore={() => {}} />);
+ fireEvent.click(await screen.findByRole('button', { name: 'A' }));
+ view.rerender(<TaskTagMenuSection session={session('B')} onMore={() => {}} />);
+ await screen.findByRole('button', { name: 'B' });
+ await act(async () => { if (reject) fail(new Error('old failure')); else finish({ tags: [tag('A')], sessions: [] }); });
+ expect(screen.queryByRole('button', { name: 'A' })).toBeNull();
+ expect(screen.queryByText('taskTags.failed')).toBeNull();
+ expect(screen.getByRole('button', { name: 'B' })).toBeTruthy();
+});
+it.each([false, true])(
+ 'preserves drafts across catalog pushes (external rename: %s)',
+ async (renamed) => {
+ const tag = {
+ id: 'work',
+ name: 'Work',
+ color: 'red' as const,
+ favoriteOrder: null,
+ revision: 1,
+ };
+ const execute = vi.fn(async () => ({ tags: [tag], sessions: [] }));
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ render(
+ <TaskTagEditor session={{ id: 'task', tags: [] } as unknown as Session} onClose={() => {}} />,
+ );
+ fireEvent.doubleClick(await screen.findByRole('button', { name: 'Work' }));
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'My draft' } });
+ act(() =>
+ emitTaskTagCatalog(undefined, [
+ { ...tag, revision: 2, name: renamed ? 'Other name' : tag.name },
+ ]),
+ );
+ expect((screen.getByRole('textbox') as HTMLInputElement).value).toBe('My draft');
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.save' }));
+ await waitFor(() =>
+ expect(execute).toHaveBeenLastCalledWith({
+ action: 'update',
+ tagId: tag.id,
+ revision: renamed ? 1 : 2,
+ name: 'My draft',
+ nameCustomized: true,
+ color: 'red',
+ }),
+ );
+ },
+);
+it('names the hovered label, describes the action and toggles its inner check', async () => {
+ const red = {
+ id: 'default:red',
+ name: 'Red',
+ color: 'red' as const,
+ favoriteOrder: 0,
+ revision: 1,
+ };
+ const green = {
+ id: 'default:green',
+ name: 'Green',
+ color: 'green' as const,
+ favoriteOrder: 1,
+ revision: 1,
+ };
+ const execute = vi.fn(async (request: { action: string }) => ({
+ tags: [red, green],
+ sessions: request.action === 'attach' ? [{ sessionId: 'task', tags: [red, green] }] : [],
+ }));
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ render(<TaskTagMenuSection session={{ id: 'task', tags: [red] } as Session} onMore={() => {}} />);
+ const greenButton = await screen.findByRole('button', { name: 'Green' });
+ const redButton = screen.getByRole('button', { name: 'Red' });
+ expect(redButton.getAttribute('aria-pressed')).toBe('true');
+ expect(redButton.querySelector('.lucide-check')).not.toBeNull();
+ expect(greenButton.getAttribute('aria-pressed')).toBe('false');
+ fireEvent.pointerEnter(greenButton);
+ fireEvent.pointerMove(greenButton, { pointerType: 'mouse' });
+ expect(screen.getAllByText('Add Green').length).toBeGreaterThan(0);
+ expect((await screen.findByRole('tooltip')).textContent).toBe('Add Green');
+ fireEvent.click(greenButton);
+ await waitFor(() => expect(greenButton.getAttribute('aria-pressed')).toBe('true'));
+ expect(execute).toHaveBeenLastCalledWith({
+ action: 'attach',
+ sessionIds: ['task'],
+ tagIds: ['default:green'],
+ });
+ expect(greenButton.querySelector('.lucide-x')).not.toBeNull();
+ fireEvent.pointerLeave(greenButton);
+ expect(screen.getByText('Labels')).toBeTruthy();
+});
+
+it('edits on double click without toggling membership and reorders the unified directory', async () => {
+ const tags = ['One', 'Two'].map((name, sortOrder) => ({
+ id: name,
+ name,
+ color: 'red' as const,
+ sortOrder,
+ favoriteOrder: null,
+ revision: 1,
+ }));
+ const execute = vi.fn(async () => ({ tags, sessions: [] }));
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ render(
+ <TaskTagEditor
+ session={{ id: 'task', title: 'Example', tags: [] } as unknown as Session}
+ onClose={() => {}}
+ />,
+ );
+ const name = await screen.findByRole('button', { name: 'One' });
+ expect(screen.queryByRole('textbox')).toBeNull();
+ fireEvent.doubleClick(name);
+ expect(screen.getByRole('textbox').getAttribute('value')).toBe('One');
+ expect(execute.mock.calls).toHaveLength(1);
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.cancel' }));
+ expect(screen.queryByRole('textbox')).toBeNull();
+ const rows = screen.getAllByRole('button', { name: 'taskTags.reorderLabel' });
+ fireEvent.keyDown(rows[1], { key: 'ArrowUp' });
+ await waitFor(() =>
+ expect(execute).toHaveBeenLastCalledWith({
+ action: 'reorder',
+ tagIds: ['Two', 'One'],
+ expectedOrder: ['One', 'Two'],
+ }),
+ );
+});
+it('shows only the first seven ordered labels, including non-favorites', async () => {
+ const tags = Array.from({ length: 9 }, (_, i) => ({
+ id: String(i),
+ name: `Label ${i}`,
+ color: 'blue' as const,
+ sortOrder: i,
+ favoriteOrder: null,
+ revision: 1,
+ }));
+ const execute = vi.fn(async () => ({ tags, sessions: [] }));
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ render(
+ <TaskTagMenuSection
+ session={{ id: 'task', tags: [] } as unknown as Session}
+ onMore={() => {}}
+ />,
+ );
+ await screen.findByRole('button', { name: 'Label 6' });
+ expect(screen.queryByRole('button', { name: 'Label 7' })).toBeNull();
+ expect(screen.getAllByRole('button')).toHaveLength(8);
+});
+
+it('opens a twelve-color form only on add, saves white, and returns to selection', async () => {
+ const created = { id: 'new', name: 'Paper', color: 'white', favoriteOrder: null, revision: 1 };
+ const execute = vi.fn(async (request: { action: string }) => ({
+ tags: request.action === 'get' ? [] : [created],
+ sessions: [],
+ supportedColors: TASK_TAG_COLORS,
+ }));
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ render(
+ <TaskTagEditor session={{ id: 'task', tags: [] } as unknown as Session} onClose={() => {}} />,
+ );
+ await waitFor(() => expect(execute).toHaveBeenCalled());
+ expect(screen.queryByRole('textbox')).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.add' }));
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'Paper' } });
+ const white = screen.getByRole('button', { name: 'taskTags.white' });
+ expect(screen.queryByRole('button', { name: 'taskTags.none' })).toBeNull();
+ fireEvent.click(white);
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.create' }));
+ await waitFor(() =>
+ expect(execute).toHaveBeenCalledWith({ action: 'create', name: 'Paper', color: 'white' }),
+ );
+ await waitFor(() => expect(screen.queryByRole('textbox')).toBeNull());
+});
+
+it('keeps the form when attachment fails and retries without creating a duplicate', async () => {
+ const created = { id: 'new', name: 'Paper', color: 'blue', favoriteOrder: null, revision: 1 };
+ let failures = 1;
+ const execute = vi.fn(async (request: { action: string }) => {
+ if (request.action === 'update') throw new Error('CONFLICT');
+ if (request.action === 'attach' && failures-- > 0) {
+ created.revision++; // Committed on the host; only the response was lost.
+ throw new Error('OFFLINE');
+ }
+ return {
+ tags: request.action === 'get' ? [] : [created],
+ sessions: [],
+ supportedColors: TASK_TAG_COLORS,
+ };
+ });
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ render(
+ <TaskTagEditor session={{ id: 'task', tags: [] } as unknown as Session} onClose={() => {}} />,
+ );
+ await waitFor(() => expect(execute).toHaveBeenCalled());
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.add' }));
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'Paper' } });
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.create' }));
+ await screen.findByRole('alert');
+ expect(screen.getByRole('textbox')).toBeTruthy();
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.save' }));
+ await waitFor(() => expect(screen.queryByRole('textbox')).toBeNull());
+ expect(execute.mock.calls.filter(([r]) => r.action === 'create')).toHaveLength(1);
+ expect(execute.mock.calls.filter(([r]) => r.action === 'attach')).toHaveLength(2);
+ expect(execute.mock.calls.filter(([r]) => r.action === 'update')).toHaveLength(0);
+});
+
+it('lets an old host rename an existing uncolored tag without requiring a new color', async () => {
+ const old = { id: 'old', name: 'Old', color: 'none', favoriteOrder: null, revision: 1 };
+ const execute = vi.fn(async () => ({ tags: [old], sessions: [] }));
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ render(
+ <TaskTagEditor session={{ id: 'task', tags: [] } as unknown as Session} onClose={() => {}} />,
+ );
+ fireEvent.doubleClick(await screen.findByRole('button', { name: 'Old' }));
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'Renamed' } });
+ fireEvent.click(screen.getByRole('button', { name: 'taskTags.save' }));
+ await waitFor(() =>
+ expect(execute).toHaveBeenCalledWith({
+ action: 'update',
+ tagId: 'old',
+ revision: 1,
+ name: 'Renamed',
+ nameCustomized: true,
+ color: undefined,
+ }),
+ );
+});
+
+it.each(['menu', 'editor'])('retries a failed %s load without reopening', async (surface) => {
+ const execute = vi
+ .fn()
+ .mockRejectedValueOnce(new Error('network failure'))
+ .mockResolvedValue({
+ tags: [{ id: 'x', name: 'Recovered', color: 'red', favoriteOrder: null, revision: 1 }],
+ sessions: [],
+ });
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { localDb: { taskTags: { execute } } },
+ });
+ const session = { id: 'task', tags: [] } as unknown as Session;
+ render(
+ surface === 'menu' ? (
+ <TaskTagMenuSection session={session} onMore={() => {}} />
+ ) : (
+ <TaskTagEditor session={session} onClose={() => {}} />
+ ),
+ );
+ fireEvent.click(await screen.findByRole('button', { name: 'taskTags.retry' }));
+ await screen.findByRole('button', { name: 'Recovered' });
+ expect(execute).toHaveBeenCalledTimes(2);
+});
+
+it('opens the complete cached directory offline after menu unmount, with writes disabled', async () => {
+ const tags = Array.from({ length: 12 }, (_, i) => ({
+ id: `tag-${i}`,
+ name: `Label ${i}`,
+ color: 'blue' as const,
+ favoriteOrder: null,
+ sortOrder: i,
+ revision: 1,
+ }));
+ const invoke = vi.fn(async () => ({ tags, sessions: [] }));
+ Object.defineProperty(window, 'electronAPI', {
+ configurable: true,
+ value: { deviceLink: { invoke } },
+ });
+ const session = {
+ id: 'task',
+ deviceLinkDeviceId: 'remote',
+ deviceLinkConnectionStatus: 'connected',
+ tags: [],
+ } as unknown as Session;
+ const view = render(<TaskTagMenuSection session={session} onMore={() => {}} />);
+ await screen.findByRole('button', { name: 'Label 0' });
+ view.unmount();
+ const offline = { ...session, deviceLinkConnectionStatus: 'disconnected' } as Session;
+ const more = vi.fn();
+ const menu = render(<TaskTagMenuSection session={offline} onMore={more} />);
+ fireEvent.click(screen.getByRole('button', { name: 'More labels' }));
+ expect(more).toHaveBeenCalledOnce();
+ menu.unmount();
+ render(<TaskTagEditor session={offline} onClose={() => {}} />);
+ expect((screen.getByRole('button', { name: 'Label 11' }) as HTMLButtonElement).disabled).toBe(
+ true,
+ );
+ expect(invoke).toHaveBeenCalledTimes(1);
+});
diff --git a/apps/desktop/src/renderer/features/task-tags/__tests__/taskTagCatalogCache.test.ts b/apps/desktop/src/renderer/features/task-tags/__tests__/taskTagCatalogCache.test.ts
new file mode 100644
index 0000000000..366b70d6d5
--- /dev/null
+++ b/apps/desktop/src/renderer/features/task-tags/__tests__/taskTagCatalogCache.test.ts
@@ -0,0 +1,45 @@
+import { afterEach, expect, it } from 'vitest';
+import {
+ captureTaskTagScope,
+ emitTaskTagCatalog,
+ evictTaskTagCatalog,
+ readTaskTagCatalog,
+ resetTaskTagCatalogCache,
+} from '../taskTagEvents';
+import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
+const tag = { id: 'work', name: 'Work', color: 'blue' as const, favoriteOrder: null, revision: 1 };
+afterEach(resetTaskTagCatalogCache);
+it('keeps the later-started accepted snapshot when requests complete out of order', () => {
+ const old = captureTaskTagScope('a');
+ const fresh = captureTaskTagScope('a');
+ fresh.store([{ ...tag, name: 'Fresh', revision: 2 }]);
+ old.store([tag]);
+ expect(readTaskTagCatalog('a')?.tags[0].name).toBe('Fresh');
+});
+it('retains full directories and push updates without a mounted panel', () => {
+ emitTaskTagCatalog('a', [tag]);
+ expect(readTaskTagCatalog('a')?.tags).toEqual([tag]);
+ expect(readTaskTagCatalog('b')).toBeUndefined();
+ expect(readTaskTagCatalog(undefined)).toBeUndefined();
+ const old = captureTaskTagScope('a');
+ emitTaskTagCatalog('a', [{ ...tag, name: 'Latest' }]);
+ old.store([tag]);
+ expect(readTaskTagCatalog('a')?.tags[0].name).toBe('Latest');
+});
+it('rejects late replies across owner generations and device revocation', () => {
+ setDataOwnerGeneration('owner-a', 1);
+ const a = captureTaskTagScope('a');
+ const b = captureTaskTagScope('b');
+ evictTaskTagCatalog('a');
+ a.store([tag]);
+ b.store([tag]);
+ expect(a.current()).toBe(false);
+ expect(readTaskTagCatalog('a')).toBeUndefined();
+ expect(readTaskTagCatalog('b')?.tags).toEqual([tag]);
+ setDataOwnerGeneration('owner-b', 2);
+ b.store([tag]);
+ expect(b.current()).toBe(false);
+ expect(readTaskTagCatalog('b')).toBeUndefined();
+ setDataOwnerGeneration('owner-a', 3);
+ expect(readTaskTagCatalog('b')).toBeUndefined();
+});
diff --git a/apps/desktop/src/renderer/features/task-tags/taskTagEvents.ts b/apps/desktop/src/renderer/features/task-tags/taskTagEvents.ts
new file mode 100644
index 0000000000..a34680fdf3
--- /dev/null
+++ b/apps/desktop/src/renderer/features/task-tags/taskTagEvents.ts
@@ -0,0 +1,74 @@
+import { normalizeTaskTags, type TaskTag, type TaskTagColor } from '@cindy/maker-shared';
+import {
+ getDataOwnerGeneration,
+ isDataOwnerGenerationCurrent,
+} from '@/contexts/dataOwnerGeneration';
+
+type Catalog = { tags: TaskTag[]; supportedColors?: readonly TaskTagColor[] };
+const catalogs = new Map<string | undefined, Catalog>();
+let owner = getDataOwnerGeneration();
+let generation = 0;
+let requestSequence = 0;
+const deviceGenerations = new Map<string | undefined, number>();
+const catalogGenerations = new Map<string | undefined, number>();
+function ensureOwner() {
+ if (!isDataOwnerGenerationCurrent(owner)) {
+ resetTaskTagCatalogCache();
+ owner = getDataOwnerGeneration();
+ }
+}
+export function resetTaskTagCatalogCache() {
+ generation++;
+ catalogs.clear();
+ deviceGenerations.clear();
+ catalogGenerations.clear();
+}
+export function evictTaskTagCatalog(deviceId: string) {
+ ensureOwner();
+ catalogs.delete(deviceId);
+ deviceGenerations.set(deviceId, (deviceGenerations.get(deviceId) ?? 0) + 1);
+ for (const listener of listeners) listener(deviceId, []);
+}
+export function readTaskTagCatalog(deviceId: string | undefined) {
+ ensureOwner();
+ return catalogs.get(deviceId);
+}
+export function captureTaskTagScope(deviceId: string | undefined) {
+ ensureOwner();
+ const capturedOwner = owner;
+ const capturedGeneration = generation;
+ const peer = deviceGenerations.get(deviceId);
+ const sequence = ++requestSequence;
+ const current = () =>
+ isDataOwnerGenerationCurrent(capturedOwner) &&
+ generation === capturedGeneration &&
+ deviceGenerations.get(deviceId) === peer;
+ return {
+ current,
+ store(tags: TaskTag[], supportedColors?: readonly TaskTagColor[]) {
+ if (!current() || (catalogGenerations.get(deviceId) ?? 0) > sequence) return;
+ catalogGenerations.set(deviceId, sequence);
+ const previous = catalogs.get(deviceId);
+ catalogs.delete(deviceId);
+ catalogs.set(deviceId, {
+ tags: normalizeTaskTags(tags, 256),
+ supportedColors: supportedColors ?? previous?.supportedColors,
+ });
+ if (catalogs.size > 32) catalogs.delete(catalogs.keys().next().value);
+ },
+ };
+}
+// Emitted only after the existing local/remote owner ingress guards accept a push.
+const listeners = new Set<(deviceId: string | undefined, tags: TaskTag[]) => void>();
+export function emitTaskTagCatalog(deviceId: string | undefined, tags: TaskTag[]): void {
+ captureTaskTagScope(deviceId).store(tags);
+ for (const listener of listeners) listener(deviceId, tags);
+}
+export function subscribeTaskTagCatalog(
+ listener: (deviceId: string | undefined, tags: TaskTag[]) => void,
+): () => void {
+ listeners.add(listener);
+ return () => {
+ listeners.delete(listener);
+ };
+}
diff --git a/apps/desktop/src/renderer/features/task-tags/taskTags.css b/apps/desktop/src/renderer/features/task-tags/taskTags.css
new file mode 100644
index 0000000000..2ae3bf68ee
--- /dev/null
+++ b/apps/desktop/src/renderer/features/task-tags/taskTags.css
@@ -0,0 +1,12 @@
+/* Keep overflow discoverable even when the app hides idle scrollbars. */
+.task-tag-list-scroll {
+ scrollbar-gutter: stable;
+}
+
+.task-tag-list-scroll::-webkit-scrollbar-thumb {
+ background-color: var(--msg-scrollbar);
+}
+
+.task-tag-list-scroll::-webkit-scrollbar-thumb:hover {
+ background-color: var(--msg-scrollbar-hover);
+}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index e918f42815..31689ecf06 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -13214,5 +13214,59 @@
"startFailed": "Could not open the resolution task. Please retry."
}
}
+ },
+ "taskTags": {
+ "loadFailed": "Could not load tags. Try again.",
+ "retry": "Retry",
+ "editLabel": "Edit “{{name}}”",
+ "reorderLabel": "Reorder “{{name}}”",
+ "reorderHint": "Drag to reorder, or use the up and down arrow keys",
+ "addLabel": "Add “{{name}}”",
+ "removeLabel": "Remove “{{name}}”",
+ "title": "Tags",
+ "more": "More tags",
+ "settings": "Tag settings",
+ "name": "Name",
+ "color": "Color",
+ "favorite": "Favorite (up to 7)",
+ "create": "Create",
+ "save": "Save",
+ "done": "Done",
+ "back": "Back",
+ "delete": "Delete tag",
+ "cancel": "Cancel",
+ "deleteConfirm": "Delete “{{name}}” from {{count}} tasks? Tasks and messages will be kept.",
+ "loading": "Loading…",
+ "unavailable": "This computer needs an update to support tags.",
+ "offline": "Connect to the source computer to edit tags.",
+ "failed": "Could not save. Please try again.",
+ "conflict": "Tags changed elsewhere. Reload and try again.",
+ "favoritesFull": "Only seven favorite tags are allowed.",
+ "alreadyExists": "A tag with this name already exists.",
+ "empty": "No tags yet.",
+ "red": "Red",
+ "orange": "Orange",
+ "yellow": "Yellow",
+ "green": "Green",
+ "blue": "Blue",
+ "purple": "Purple",
+ "gray": "Gray",
+ "none": "No color",
+ "pink": "Pink",
+ "coral": "Coral",
+ "teal": "Teal",
+ "indigo": "Indigo",
+ "white": "White",
+ "add": "Add tag",
+ "editTitle": "Edit tag",
+ "editHint": "Changes apply to all tasks using this tag.",
+ "addHint": "Added tags are selected for this task.",
+ "selectedCount": "{{count}} selected",
+ "presetImportant": "Important",
+ "presetFollowUp": "Follow up",
+ "presetWork": "Work",
+ "presetLife": "Life",
+ "presetIdeas": "Ideas",
+ "presetReference": "Reference"
}
}
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 5c0739026d..f49544b6ac 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -13195,5 +13195,59 @@
"startFailed": "解決用タスクを開けませんでした。再試行してください。"
}
}
+ },
+ "taskTags": {
+ "loadFailed": "タグを読み込めませんでした。もう一度お試しください。",
+ "retry": "再試行",
+ "editLabel": "「{{name}}」を編集",
+ "reorderLabel": "「{{name}}」の順序を変更",
+ "reorderHint": "ドラッグまたは上下キーで並べ替え",
+ "addLabel": "「{{name}}」を追加",
+ "removeLabel": "「{{name}}」を外す",
+ "title": "タグ",
+ "more": "その他のタグ",
+ "settings": "タグ設定",
+ "name": "名前",
+ "color": "色",
+ "favorite": "よく使うタグ(最大7個)",
+ "create": "作成",
+ "save": "保存",
+ "done": "完了",
+ "back": "戻る",
+ "delete": "タグを削除",
+ "cancel": "キャンセル",
+ "deleteConfirm": "「{{name}}」を{{count}}件のタスクから削除しますか?タスクとメッセージは保持されます。",
+ "loading": "読み込み中…",
+ "unavailable": "タグを使用するには、このコンピュータを更新してください。",
+ "offline": "タグを編集するには、セッションのあるコンピュータに接続してください。",
+ "failed": "保存できませんでした。再試行してください。",
+ "conflict": "別の端末でタグが変更されました。再読み込みしてください。",
+ "favoritesFull": "よく使うタグは最大7個です。",
+ "alreadyExists": "同じ名前のタグが存在します。",
+ "empty": "タグはまだありません。",
+ "red": "赤",
+ "orange": "オレンジ",
+ "yellow": "黄",
+ "green": "緑",
+ "blue": "青",
+ "purple": "紫",
+ "gray": "グレー",
+ "none": "色なし",
+ "pink": "ピンク",
+ "coral": "コーラル",
+ "teal": "ティール",
+ "indigo": "インディゴ",
+ "white": "白",
+ "add": "タグを追加",
+ "editTitle": "タグを編集",
+ "editHint": "このタグを使うすべてのタスクに反映されます。",
+ "addHint": "追加後、このタスクに自動で選択されます。",
+ "selectedCount": "{{count}} 個選択中",
+ "presetImportant": "重要",
+ "presetFollowUp": "フォローアップ",
+ "presetWork": "仕事",
+ "presetLife": "生活",
+ "presetIdeas": "アイデア",
+ "presetReference": "資料"
}
}
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 013c3f9ae8..dc3810d96e 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -13195,5 +13195,59 @@
"startFailed": "해결 작업을 열지 못했습니다. 다시 시도해 주세요."
}
}
+ },
+ "taskTags": {
+ "loadFailed": "태그를 불러오지 못했습니다. 다시 시도해 주세요.",
+ "retry": "다시 시도",
+ "editLabel": "“{{name}}” 편집",
+ "reorderLabel": "“{{name}}” 순서 변경",
+ "reorderHint": "드래그하거나 위아래 방향키로 순서 변경",
+ "addLabel": "“{{name}}” 추가",
+ "removeLabel": "“{{name}}” 제거",
+ "title": "태그",
+ "more": "태그 더 보기",
+ "settings": "태그 설정",
+ "name": "이름",
+ "color": "색상",
+ "favorite": "즐겨찾기(최대 7개)",
+ "create": "만들기",
+ "save": "저장",
+ "done": "완료",
+ "back": "뒤로",
+ "delete": "태그 삭제",
+ "cancel": "취소",
+ "deleteConfirm": "작업 {{count}}개에서 “{{name}}” 태그를 삭제할까요? 작업과 메시지는 유지됩니다.",
+ "loading": "불러오는 중…",
+ "unavailable": "태그를 사용하려면 이 컴퓨터를 업데이트하세요.",
+ "offline": "태그를 편집하려면 세션이 있는 컴퓨터에 연결하세요.",
+ "failed": "저장하지 못했습니다. 다시 시도하세요.",
+ "conflict": "다른 기기에서 태그가 변경되었습니다. 새로고침하세요.",
+ "favoritesFull": "즐겨찾기 태그는 최대 7개입니다.",
+ "alreadyExists": "같은 이름의 태그가 있습니다.",
+ "empty": "태그가 없습니다.",
+ "red": "빨강",
+ "orange": "주황",
+ "yellow": "노랑",
+ "green": "초록",
+ "blue": "파랑",
+ "purple": "보라",
+ "gray": "회색",
+ "none": "색상 없음",
+ "pink": "분홍색",
+ "coral": "산호색",
+ "teal": "청록색",
+ "indigo": "남색",
+ "white": "흰색",
+ "add": "태그 추가",
+ "editTitle": "태그 편집",
+ "editHint": "이 태그를 사용하는 모든 작업에 적용됩니다.",
+ "addHint": "추가 후 현재 작업에 자동으로 선택됩니다.",
+ "selectedCount": "{{count}}개 선택됨",
+ "presetImportant": "중요",
+ "presetFollowUp": "후속 확인",
+ "presetWork": "업무",
+ "presetLife": "생활",
+ "presetIdeas": "아이디어",
+ "presetReference": "자료"
}
}
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 10c4f946af..c81b9ceac3 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -13195,5 +13195,59 @@
"startFailed": "无法打开处理任务,请重试。"
}
}
+ },
+ "taskTags": {
+ "loadFailed": "标签加载失败,请重试。",
+ "retry": "重试",
+ "editLabel": "编辑“{{name}}”",
+ "reorderLabel": "调整“{{name}}”的顺序",
+ "reorderHint": "拖动排序,也可用上下方向键调整",
+ "addLabel": "添加“{{name}}”",
+ "removeLabel": "移除“{{name}}”",
+ "title": "标签",
+ "more": "更多标签",
+ "settings": "标签设置",
+ "name": "名称",
+ "color": "颜色",
+ "favorite": "常用(最多 7 个)",
+ "create": "创建",
+ "save": "保存",
+ "done": "完成",
+ "back": "返回",
+ "delete": "删除标签",
+ "cancel": "取消",
+ "deleteConfirm": "从 {{count}} 个任务中删除“{{name}}”?任务和消息会保留。",
+ "loading": "加载中…",
+ "unavailable": "此电脑需要更新才能支持标签。",
+ "offline": "连接任务所在电脑后可编辑标签。",
+ "failed": "保存失败,请重试。",
+ "conflict": "标签已在其他端修改,请刷新后重试。",
+ "favoritesFull": "最多设置七个常用标签。",
+ "alreadyExists": "已有同名标签。",
+ "empty": "暂无标签。",
+ "red": "红色",
+ "orange": "橙色",
+ "yellow": "黄色",
+ "green": "绿色",
+ "blue": "蓝色",
+ "purple": "紫色",
+ "gray": "灰色",
+ "none": "无颜色",
+ "pink": "粉色",
+ "coral": "珊瑚色",
+ "teal": "青色",
+ "indigo": "靛蓝色",
+ "white": "白色",
+ "add": "添加标签",
+ "editTitle": "编辑标签",
+ "editHint": "修改会同步到使用此标签的所有任务。",
+ "addHint": "添加后,自动选中到当前任务。",
+ "selectedCount": "已选 {{count}} 个",
+ "presetImportant": "重要",
+ "presetFollowUp": "待跟进",
+ "presetWork": "工作",
+ "presetLife": "生活",
+ "presetIdeas": "灵感",
+ "presetReference": "资料"
}
}
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 31c0ddef70..591af16cf3 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -13195,5 +13195,59 @@
"startFailed": "無法開啟處理任務,請重試。"
}
}
+ },
+ "taskTags": {
+ "loadFailed": "標籤載入失敗,請重試。",
+ "retry": "重試",
+ "editLabel": "編輯「{{name}}」",
+ "reorderLabel": "調整「{{name}}」的順序",
+ "reorderHint": "拖曳排序,也可用上下方向鍵調整",
+ "addLabel": "加入「{{name}}」",
+ "removeLabel": "移除「{{name}}」",
+ "title": "標籤",
+ "more": "更多標籤",
+ "settings": "標籤設定",
+ "name": "名稱",
+ "color": "顏色",
+ "favorite": "常用(最多 7 個)",
+ "create": "建立",
+ "save": "儲存",
+ "done": "完成",
+ "back": "返回",
+ "delete": "刪除標籤",
+ "cancel": "取消",
+ "deleteConfirm": "從 {{count}} 個任務中刪除「{{name}}」?任務和訊息會保留。",
+ "loading": "載入中…",
+ "unavailable": "此電腦需要更新才能支援標籤。",
+ "offline": "連線至任務所在電腦後可編輯標籤。",
+ "failed": "儲存失敗,請重試。",
+ "conflict": "標籤已在其他端修改,請重新整理後重試。",
+ "favoritesFull": "最多設定七個常用標籤。",
+ "alreadyExists": "已有同名標籤。",
+ "empty": "暫無標籤。",
+ "red": "紅色",
+ "orange": "橙色",
+ "yellow": "黃色",
+ "green": "綠色",
+ "blue": "藍色",
+ "purple": "紫色",
+ "gray": "灰色",
+ "none": "無顏色",
+ "pink": "粉紅色",
+ "coral": "珊瑚色",
+ "teal": "青色",
+ "indigo": "靛藍色",
+ "white": "白色",
+ "add": "新增標籤",
+ "editTitle": "編輯標籤",
+ "editHint": "修改會同步至使用此標籤的所有任務。",
+ "addHint": "新增後,自動選取至目前任務。",
+ "selectedCount": "已選 {{count}} 個",
+ "presetImportant": "重要",
+ "presetFollowUp": "待跟進",
+ "presetWork": "工作",
+ "presetLife": "生活",
+ "presetIdeas": "靈感",
+ "presetReference": "資料"
}
}
diff --git a/apps/desktop/src/renderer/lib/ccAgent.types.ts b/apps/desktop/src/renderer/lib/ccAgent.types.ts
index 1ed3f0d4cf..5ced75a51f 100644
--- a/apps/desktop/src/renderer/lib/ccAgent.types.ts
+++ b/apps/desktop/src/renderer/lib/ccAgent.types.ts
@@ -253,6 +253,7 @@ export interface CcMeta {
export type AgentMeta = CcMeta;
export interface Session {
+ tags?: import('@cindy/maker-shared').TaskTag[];
id: string;
userId: string;
title: string;
@@ -408,7 +409,8 @@ export interface SessionRuntimePendingProjection {
// 内存(coordinator projection + store.error),事后点进会话毫无痕迹,红点无从追溯。
// 'agent_switch':session 内 agent 引擎切换边界行(session-agent-switch,main 落库)。
// content 为 AgentSwitchContent;渲染成分隔条(可展开查看交接摘要),不是对话正文。
-export type MessageRole = 'user' | 'assistant' | 'tool_use' | 'tool_result' | 'ask_user' | 'plan_review' | 'thinking' | 'error' | 'agent_switch';
+export type MessageRole =
+ | 'user' | 'assistant' | 'tool_use' | 'tool_result' | 'ask_user' | 'plan_review' | 'thinking' | 'error' | 'agent_switch';
/**
* role='agent_switch' 行的 content 结构(JSON 存于 messages.content)。
diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.ts
index 0c6570aa44..fedf122e0e 100644
--- a/apps/desktop/src/renderer/lib/makerChatStore.ts
+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts
@@ -1,3 +1,5 @@
+import { emitTaskTagCatalog } from '@/features/task-tags/taskTagEvents';
+import { normalizeTaskTags } from '@cindy/maker-shared';
import type { ImMessageSource } from '../../shared/imMessageSource';
import { readBotAuthorizationCard } from '../../shared/botAuthorization';
import { confirmRemoteUsers, reserveRemoteUser } from './remoteUserHandoff';
@@ -859,7 +861,8 @@ export interface PendingGhostGrantConfirm {
* forge_source = Forge 打包/骨架/安装的源码目录在工作目录外;
* outside_workdir = 文档/电脑等内置工具读写工作目录外的路径。
*/
- lane: 'attachments' | 'dir' | 'save_dir' | 'reveal_path' | 'fs_write' | 'workspace' | 'forge_source' | 'outside_workdir';
+ lane:
+ | 'attachments' | 'dir' | 'save_dir' | 'reveal_path' | 'fs_write' | 'workspace' | 'forge_source' | 'outside_workdir';
sourceTool?: string;
operation?: 'read' | 'write';
items: Array<{
@@ -8589,7 +8592,7 @@ function initGlobalListeners(options: GlobalListenerOptions = {}): void {
push.channel === 'local-db:messages:created' ||
(push.channel === 'maker:event' && inboundHasPersistId);
const inboundEvent = (push.payload as { event?: unknown } | null)?.event as
- | { type?: unknown; data?: { isFinal?: unknown; isFullText?: unknown } }
+ { type?: unknown; data?: { isFinal?: unknown; isFullText?: unknown } }
| null
| undefined;
const isOrdinaryStreamingTextDelta =
@@ -8710,6 +8713,13 @@ function initGlobalListeners(options: GlobalListenerOptions = {}): void {
}
break;
}
+ case 'local-db:task-tags:changed': {
+ if (!push.deviceId) break;
+ const tags = normalizeTaskTags((push.payload as { tags?: unknown })?.tags, 256);
+ remoteProjectsStore.applyTagCatalog(push.deviceId, tags);
+ emitTaskTagCatalog(push.deviceId, tags);
+ break;
+ }
case 'local-db:sessions:patched': {
// 被控端会话元数据 / 设置变更 → 就地镜像到远程项目分片(取代乐观覆盖)。
const p = push.payload as { sessionId?: string; patch?: Record<string, unknown> } | null;
@@ -15066,7 +15076,8 @@ async function clearSessionAfterGuardImpl(sessionId: string, clearedAt: string):
*/
function insertSystemCard(
sessionId: string,
- cardType: 'help' | 'cost' | 'context' | 'pwd' | 'status' | 'compact' | 'cmd' | 'learn' | 'cindy-make-doctor' | 'cindy-make',
+ cardType:
+ | 'help' | 'cost' | 'context' | 'pwd' | 'status' | 'compact' | 'cmd' | 'learn' | 'cindy-make-doctor' | 'cindy-make',
data?: Record<string, unknown>,
): string | null {
if (!sessionId) return null;
diff --git a/apps/desktop/src/renderer/lib/sessionsStore.ts b/apps/desktop/src/renderer/lib/sessionsStore.ts
index 23f596e7bc..dda1c923dc 100644
--- a/apps/desktop/src/renderer/lib/sessionsStore.ts
+++ b/apps/desktop/src/renderer/lib/sessionsStore.ts
@@ -1,3 +1,5 @@
+import { emitTaskTagCatalog } from '@/features/task-tags/taskTagEvents';
+import { normalizeTaskTags, reconcileTaskTags } from '@cindy/maker-shared';
/**
* sessionsStore — CC Agent Session 列表的模块级单例 store
* ---------------------------------------------------------------------------
@@ -1139,6 +1141,21 @@ if (typeof window !== 'undefined') {
},
);
+ window.electronAPI?.localDb?.taskTags?.onChanged?.(({ tags }, ownerStamp) => {
+ if (!isDataOwnerPushCurrent(ownerStamp)) return;
+ const catalog = normalizeTaskTags(tags, 256);
+ emitTaskTagCatalog(undefined, catalog);
+ for (const [filter, rows] of cache)
+ cache.set(
+ filter,
+ rows.map((row) => ({ ...row, tags: reconcileTaskTags(row.tags, catalog) })),
+ );
+ notify();
+ // Supersede list reads which started before this directory mutation.
+ void sessionsStore.forceRefreshAll();
+ },
+ );
+
const sessionsPush = window.electronAPI?.localDb?.sessionsPush;
if (sessionsPush) {
sessionsPush.onPatched(({ sessionId, patch }, ownerStamp) => {
diff --git a/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.json b/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.json
index 0860ecbe50..7cb31c58c6 100644
--- a/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.json
+++ b/apps/desktop/src/renderer/themes/__tests__/fixtures/desktop-color-defaults.json
@@ -1,6 +1,6 @@
{
"source": "apps/desktop/src/renderer/themes/colors.ts",
- "count": 555,
+ "count": 568,
"colors": [
{
"id": "surface",
@@ -2776,6 +2776,71 @@
"id": "segmented-hover-bg",
"light": "var(--surface-hover)",
"dark": "var(--surface-hover)"
+ },
+ {
+ "id": "task-tag-red",
+ "light": "#ed615f",
+ "dark": "#ed615f"
+ },
+ {
+ "id": "task-tag-orange",
+ "light": "#eea34e",
+ "dark": "#eea34e"
+ },
+ {
+ "id": "task-tag-yellow",
+ "light": "#e5c744",
+ "dark": "#e5c744"
+ },
+ {
+ "id": "task-tag-green",
+ "light": "#70b568",
+ "dark": "#70b568"
+ },
+ {
+ "id": "task-tag-blue",
+ "light": "#609bd4",
+ "dark": "#609bd4"
+ },
+ {
+ "id": "task-tag-purple",
+ "light": "#ab7bc6",
+ "dark": "#ab7bc6"
+ },
+ {
+ "id": "task-tag-gray",
+ "light": "#969696",
+ "dark": "#969696"
+ },
+ {
+ "id": "task-tag-pink",
+ "light": "#df83b0",
+ "dark": "#e79fc1"
+ },
+ {
+ "id": "task-tag-coral",
+ "light": "#de8970",
+ "dark": "#e6a08c"
+ },
+ {
+ "id": "task-tag-teal",
+ "light": "#53a89d",
+ "dark": "#75bfb4"
+ },
+ {
+ "id": "task-tag-indigo",
+ "light": "#7c83cf",
+ "dark": "#999fdf"
+ },
+ {
+ "id": "task-tag-white",
+ "light": "#ffffff",
+ "dark": "#ffffff"
+ },
+ {
+ "id": "task-tag-white-check",
+ "light": "#525252",
+ "dark": "#525252"
}
]
}
diff --git a/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.ts b/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.ts
index 2d43c59974..e43d9959e1 100644
--- a/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.ts
+++ b/apps/desktop/src/renderer/themes/__tests__/generatedEffortInitialization.test.ts
@@ -13,7 +13,7 @@ describe('generated effort inputs initialize without DOM or circular imports', (
await import('../colors');
await import('../effortTierColors');
expect(colorRegistry.getColors()).toEqual(first);
- expect(first.length).toBe(555);
+ expect(first.length).toBe(568);
expect(first[0].id).toBe('surface');
expect(effort.effortTierColor('high')).toBe('#3B82F6');
expect(effort.effortTierColor('unknown')).toBe('#14B8A6');
diff --git a/apps/desktop/src/renderer/themes/colors.ts b/apps/desktop/src/renderer/themes/colors.ts
index 3641512e59..2e135e4ba1 100644
--- a/apps/desktop/src/renderer/themes/colors.ts
+++ b/apps/desktop/src/renderer/themes/colors.ts
@@ -2144,6 +2144,58 @@ const GENERATED_DEFAULTS = {
"segmented-hover-bg": {
"light": "var(--surface-hover)",
"dark": "var(--surface-hover)"
+ },
+ "task-tag-red": {
+ "light": "#ed615f",
+ "dark": "#ed615f"
+ },
+ "task-tag-orange": {
+ "light": "#eea34e",
+ "dark": "#eea34e"
+ },
+ "task-tag-yellow": {
+ "light": "#e5c744",
+ "dark": "#e5c744"
+ },
+ "task-tag-green": {
+ "light": "#70b568",
+ "dark": "#70b568"
+ },
+ "task-tag-blue": {
+ "light": "#609bd4",
+ "dark": "#609bd4"
+ },
+ "task-tag-purple": {
+ "light": "#ab7bc6",
+ "dark": "#ab7bc6"
+ },
+ "task-tag-gray": {
+ "light": "#969696",
+ "dark": "#969696"
+ },
+ "task-tag-pink": {
+ "light": "#df83b0",
+ "dark": "#e79fc1"
+ },
+ "task-tag-coral": {
+ "light": "#de8970",
+ "dark": "#e6a08c"
+ },
+ "task-tag-teal": {
+ "light": "#53a89d",
+ "dark": "#75bfb4"
+ },
+ "task-tag-indigo": {
+ "light": "#7c83cf",
+ "dark": "#999fdf"
+ },
+ "task-tag-white": {
+ "light": "#ffffff",
+ "dark": "#ffffff"
+ },
+ "task-tag-white-check": {
+ "light": "#525252",
+ "dark": "#525252"
}
} as const;
@@ -3101,3 +3153,60 @@ registerColor('segmented-selected-border', GENERATED_DEFAULTS["segmented-selecte
registerColor('segmented-selected-shadow', GENERATED_DEFAULTS["segmented-selected-shadow"], 'Desktop segmented control: selected pill elevation');
registerColor('segmented-option-fg', GENERATED_DEFAULTS["segmented-option-fg"], 'Desktop segmented control: unselected label');
registerColor('segmented-hover-bg', GENERATED_DEFAULTS["segmented-hover-bg"], 'Desktop segmented control: hover plate');
+
+registerColor(
+ 'task-tag-red',
+ GENERATED_DEFAULTS["task-tag-red"],
+ 'Task label identity color; independent of runtime status',
+);
+
+registerColor(
+ 'task-tag-orange',
+ GENERATED_DEFAULTS["task-tag-orange"],
+ 'Task label identity color; independent of runtime status',
+);
+
+registerColor(
+ 'task-tag-yellow',
+ GENERATED_DEFAULTS["task-tag-yellow"],
+ 'Task label identity color; independent of runtime status',
+);
+
+registerColor(
+ 'task-tag-green',
+ GENERATED_DEFAULTS["task-tag-green"],
+ 'Task label identity color; independent of runtime status',
+);
+
+registerColor(
+ 'task-tag-blue',
+ GENERATED_DEFAULTS["task-tag-blue"],
+ 'Task label identity color; independent of runtime status',
+);
+
+registerColor(
+ 'task-tag-purple',
+ GENERATED_DEFAULTS["task-tag-purple"],
+ 'Task label identity color; independent of runtime status',
+);
+
+registerColor(
+ 'task-tag-gray',
+ GENERATED_DEFAULTS["task-tag-gray"],
+ 'Task label identity color; independent of runtime status',
+);
+
+registerColor('task-tag-pink', GENERATED_DEFAULTS["task-tag-pink"], 'Task label identity color');
+registerColor('task-tag-coral', GENERATED_DEFAULTS["task-tag-coral"], 'Task label identity color');
+registerColor('task-tag-teal', GENERATED_DEFAULTS["task-tag-teal"], 'Task label identity color');
+registerColor(
+ 'task-tag-indigo',
+ GENERATED_DEFAULTS["task-tag-indigo"],
+ 'Task label identity color',
+);
+registerColor('task-tag-white', GENERATED_DEFAULTS["task-tag-white"], 'Task label identity color');
+registerColor(
+ 'task-tag-white-check',
+ GENERATED_DEFAULTS["task-tag-white-check"],
+ 'Task label identity color',
+);
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index 220f295508..2e23c46ded 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -4817,6 +4817,17 @@ interface ElectronAPI {
) => void,
) => () => void;
};
+ taskTags: {
+ onChanged: (
+ cb: (
+ payload: { tags: import('@cindy/maker-shared').TaskTag[] },
+ ownerStamp?: import('../shared/dataOwnerPush').DataOwnerPushStamp,
+ ) => void,
+ ) => () => void;
+ execute: (
+ request: import('@cindy/maker-shared').TaskTagRequest,
+ ) => Promise<import('@cindy/maker-shared').TaskTagResult>;
+ };
projectAliases: {
list: () => Promise<import('../shared/projectAliases').ProjectAlias[]>;
set: (input: {
diff --git a/apps/mobile/app/devices/[deviceId].tsx b/apps/mobile/app/devices/[deviceId].tsx
index 96bc85a8bc..b9f0175b75 100644
--- a/apps/mobile/app/devices/[deviceId].tsx
+++ b/apps/mobile/app/devices/[deviceId].tsx
@@ -244,6 +244,7 @@ function DeviceDetailScreenContent() {
const showConnectionBanner = useShowConnectionBanner(status, error, connectionIssue, deviceUnresponsive);
const [lastSyncedAt, setLastSyncedAt] = useState<number | null>(null);
const [selectedSessionIds, setSelectedSessionIds] = useState<string[]>([]);
+ const [selectionRequested, setSelectionRequested] = useState(false);
const [expandedAutomationGroups, setExpandedAutomationGroups] = useState<string[]>([]);
const [bulkActionPending, setBulkActionPending] = useState<MobileSessionBulkAction | null>(null);
const [bulkConfirmAction, setBulkConfirmAction] = useState<MobileSessionBulkAction | null>(null);
@@ -278,6 +279,7 @@ function DeviceDetailScreenContent() {
setLoading(true);
setError(null);
try {
+ const mutationEpoch = remoteSessionStore.captureDeviceSessionListMutationEpoch(deviceId);
const list = await withTransientRemoteRetry(async () => {
await subscribe(`device:${deviceId}`, deviceId, ['sessions']);
return invoke<RemoteSession[]>(deviceId, 'local-db:sessions:list', [
@@ -289,6 +291,11 @@ function DeviceDetailScreenContent() {
{ includePinned: true, fresh: true },
]);
});
+ if (!remoteSessionStore.isDeviceSessionListMutationEpochCurrent(deviceId, mutationEpoch)) {
+ // The existing sync runner queues one follow-up after this stale read.
+ remoteSessionStore.requestReseed(deviceId);
+ return;
+ }
remoteSessionStore.setDeviceSessions(deviceId, deviceName, Array.isArray(list) ? list : []);
// A successful sessions:list is authoritative reachability evidence even when relay
// presence was not replayed. Retire both offline caches before the schedule reload.
@@ -441,7 +448,7 @@ function DeviceDetailScreenContent() {
[bulkActionSummaries],
);
const bulkConfirmSummary = bulkConfirmAction ? bulkActionSummaries[bulkConfirmAction] : null;
- const selectionMode = selectedSessionIds.length > 0;
+ const selectionMode = selectionRequested || selectedSessionIds.length > 0;
const runningAutomationCount = filterCounts.runningAutomation;
const controlsSummary = useMemo(
() => remoteSessionControlsSummary(statusFilter, filterCounts),
@@ -473,6 +480,7 @@ function DeviceDetailScreenContent() {
}, [visibleSessionIds]);
const clearSelection = useCallback(() => {
+ setSelectionRequested(false);
setSelectedSessionIds([]);
setBulkConfirmAction(null);
setBulkNotice(null);
@@ -567,7 +575,8 @@ function DeviceDetailScreenContent() {
}
setBulkConfirmAction(null);
setSelectedSessionIds([]);
- try {
+ setSelectionRequested(false);
+ try {
const failed: typeof rows = [];
await Promise.all(rows.map(async (row) => {
try {
@@ -1003,6 +1012,17 @@ function DeviceDetailScreenContent() {
onPress: () => setFiltersOpen((value) => !value),
testID: 'deviceDetail.filtersToggleButton',
},
+ {
+ label: t('session.new.select'),
+ accessibilityLabel: t('session.new.select'),
+ active: selectionMode,
+ onPress: () => {
+ swipeRegistry.closeOpenRow();
+ if (selectionMode) clearSelection();
+ else setSelectionRequested(true);
+ },
+ testID: 'deviceDetail.selectionToggleButton',
+ },
]}
testID="deviceDetail.toolbarActions"
/>
@@ -1316,6 +1336,7 @@ function SessionListActionOverlays({
return (
<>
<SessionOptionsPresenter
+ session={actionSheetSession}
onAction={handleSessionSheetAction}
onClose={() => setActionSheetSession(null)}
onClosed={handleSessionSheetClosed}
diff --git a/apps/mobile/app/devices/index.tsx b/apps/mobile/app/devices/index.tsx
index cd34514f9d..f91a24c722 100644
--- a/apps/mobile/app/devices/index.tsx
+++ b/apps/mobile/app/devices/index.tsx
@@ -1,3 +1,4 @@
+import { TaskTagDots } from '@/session/TaskTags';
import { GlassView } from "expo-glass-effect";
import { useLiquidGlassAvailable } from "@/session/useLiquidGlassAvailable";
import { useHeaderHeight } from "expo-router/react-navigation";
@@ -2702,10 +2703,7 @@ function HomeScreenContent() {
padding: windowLayout.emptyPadding,
}}
/>
- ) : home.pinned.length > 0 ? (
- // 仅剩置顶且被收起时 item 数为 0,但用户并非"无对话",不显示空状态插画。
- null
- ) : showRemoteGuide && home.emptyNoDevice ? (
+ ) : home.pinned.length > 0 ? null : showRemoteGuide && home.emptyNoDevice ? (
// 无可控制电脑是「首次使用 / 产品模式说明」级空态:按 reason 渲染远程访问引导
// (首跑三步 / 离线设备卡 / 精确开关 / 重试访问 + 云端 Cindy 预告),而非一句话空态。
<RemoteAccessGuide
@@ -2921,6 +2919,7 @@ function HomeScreenContent() {
visible={displaySettingsOpen}
/>
<SessionOptionsPresenter
+ session={actionSheetSession}
onAction={handleSessionSheetAction}
onClose={() => setActionSheetSession(null)}
onClosed={handleSessionSheetClosed}
@@ -3968,7 +3967,14 @@ function HomeSessionRowInner({
? groupRowOpensPrimary ? t('devices.list.a11y.openAutomationLatest', { title: item.title }) : t('devices.list.a11y.automationTask', { title: item.title })
: t('devices.list.a11y.openConversation', { title: item.title })}
accessibilityState={group ? { expanded: groupExpanded, selected } : { selected }}
- onLongPress={onLongPress}
+ delayLongPress={400}
+ onLongPress={
+ !selectionMode && !group && swipe && conversationSearchAllowsLocalWrites(item)
+ ? () => {
+ swipe.registry.closeOpenRow();
+ swipe.onShowOptions(latestMobileSessionRow(item).session as RemoteSession);
+ }
+ : onLongPress}
onPress={handlePress}
style={({ pressed }) => [
styles.sessionListRow,
@@ -4032,6 +4038,7 @@ function HomeSessionRowInner({
>
{item.title}
</Text>
+ <TaskTagDots tags={item.session.tags} surfaceColor={colors.surface} />
{sourceLabel ? (
<Text
ellipsizeMode="tail"
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsx
index ac74f85a0c..f988fb671d 100644
--- a/apps/mobile/app/sessions/[sessionId].tsx
+++ b/apps/mobile/app/sessions/[sessionId].tsx
@@ -74,6 +74,7 @@ import Reanimated, { useAnimatedStyle } from 'react-native-reanimated';
import { GestureDetector } from '@/platform/gestureHandler';
import { MobileAgentMark } from '@/components/MobileAgentMark';
import { SessionHeaderNativeBack, SessionHeaderNativeActions, SessionHeaderNativeTitle, SessionHeaderNativeBlur } from '@/session/SessionHeaderNativeControls';
+import { TaskTagDots } from '@/session/TaskTags';
import type { TextInput as NativeTextInput } from 'react-native';
import { ScreenBackButton } from '@/components/MobilePrimitives';
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
@@ -1431,7 +1432,7 @@ export default function SessionScreen() {
const queueEditingRef = useRef<QueueEditingState | null>(null);
// 会话切换 cleanup(声明在前)引用组件后段的回收函数,经 ref 断开声明顺序依赖。
const discardQueueEditTransientAttachmentResourcesRef = useRef<
- ((editing: QueueEditingState, attachmentsAtExit: readonly RemoteSerializedAttachment[]) => void) | null
+ | ((editing: QueueEditingState, attachmentsAtExit: readonly RemoteSerializedAttachment[]) => void) | null
>(null);
// 排队编辑保存(update-content RPC)在途 promise:会话切换 cleanup 据此把解锁
// 排到保存落定之后,防止 device-link 并发下解锁超车、桌面端用旧内容抢先派发。
@@ -2008,7 +2009,8 @@ export default function SessionScreen() {
const composerInputRef = useRef<ComposerRichInputHandle | null>(null);
const voiceControllerSessionRef = useRef<MobileVoiceControllerSession | null>(null);
const voiceDictionaryLearningTrackerRef = useRef<MobileVoiceDictionaryLearningTracker | null>(null);
- const sendLatestRef = useRef<((options?: {
+ const sendLatestRef = useRef<
+ | ((options?: {
draftOverride?: string;
documentOverride?: ComposerDocument;
}) => Promise<void>) | null>(null);
@@ -9016,6 +9018,7 @@ export default function SessionScreen() {
</View>
{currentSession ? (
<SessionMenuSheet
+ tagDeviceId={deviceId}
providerName={providerAccountLabel}
messageOnly={sessionManagedByHost}
onOpenSearch={() => {
@@ -9868,6 +9871,8 @@ function SessionHeaderBar({
{nativeHeader ? <SessionHeaderNativeTitle
title={title}
+ tags={isDeviceAccessRevoked ? undefined : currentSession?.tags}
+ onTagsPress={onOpenSettings}
pinned={!messageOnly && !!currentSession?.pinnedAt}
syncing={syncing}
syncingImmediately={syncingImmediately}
@@ -9885,7 +9890,12 @@ function SessionHeaderBar({
<Text numberOfLines={1} style={styles.sessionHeaderTitle} testID="session.title">
{title}
</Text>
- <QuietSyncIndicator active={syncing} immediate={syncingImmediately} />
+ <TaskTagDots
+ tags={isDeviceAccessRevoked ? undefined : currentSession?.tags}
+ maxVisible={7}
+ onPress={onOpenSettings}
+ />
+ <QuietSyncIndicator active={syncing} immediate={syncingImmediately} />
</View>
{notice ? (
<Text numberOfLines={1} style={styles.sessionHeaderNotice} testID="session.headerNotice">
diff --git a/apps/mobile/src/__tests__/SessionMenuContextEntry.test.tsx b/apps/mobile/src/__tests__/SessionMenuContextEntry.test.tsx
index b0cf769ccd..5fee64c9f3 100644
--- a/apps/mobile/src/__tests__/SessionMenuContextEntry.test.tsx
+++ b/apps/mobile/src/__tests__/SessionMenuContextEntry.test.tsx
@@ -1,4 +1,5 @@
// @vitest-environment jsdom
+vi.mock('@/session/TaskTags', () => ({ TaskTagsPanel: () => null }));
import { act, type ReactNode } from "react";
import { createRoot } from "react-dom/client";
import { expect, it, vi } from "vitest";
diff --git a/apps/mobile/src/__tests__/fixtures/theme-colors-snapshot.json b/apps/mobile/src/__tests__/fixtures/theme-colors-snapshot.json
index b63a7692ab..beb14181cb 100644
--- a/apps/mobile/src/__tests__/fixtures/theme-colors-snapshot.json
+++ b/apps/mobile/src/__tests__/fixtures/theme-colors-snapshot.json
@@ -101,7 +101,20 @@
"overlaySecondaryPressed": "rgba(0, 0, 0, 0.1)",
"deletionBubbleBg": "#FFFFFF",
"deletionBubbleBorder": "#D7D7D4"
- }
+ },
+ "taskTagRed": "#ed615f",
+ "taskTagOrange": "#eea34e",
+ "taskTagYellow": "#e5c744",
+ "taskTagGreen": "#70b568",
+ "taskTagBlue": "#609bd4",
+ "taskTagPurple": "#ab7bc6",
+ "taskTagGray": "#969696",
+ "taskTagPink": "#df83b0",
+ "taskTagCoral": "#de8970",
+ "taskTagTeal": "#53a89d",
+ "taskTagIndigo": "#7c83cf",
+ "taskTagWhite": "#ffffff",
+ "taskTagWhiteCheck": "#525252"
},
"dark": {
"surface": "#2A2828",
@@ -204,6 +217,19 @@
"overlaySecondaryPressed": "rgba(0, 0, 0, 0.2)",
"deletionBubbleBg": "#1F1F1E",
"deletionBubbleBorder": "#3C3C3A"
- }
+ },
+ "taskTagRed": "#ed615f",
+ "taskTagOrange": "#eea34e",
+ "taskTagYellow": "#e5c744",
+ "taskTagGreen": "#70b568",
+ "taskTagBlue": "#609bd4",
+ "taskTagPurple": "#ab7bc6",
+ "taskTagGray": "#969696",
+ "taskTagPink": "#e79fc1",
+ "taskTagCoral": "#e6a08c",
+ "taskTagTeal": "#75bfb4",
+ "taskTagIndigo": "#999fdf",
+ "taskTagWhite": "#ffffff",
+ "taskTagWhiteCheck": "#525252"
}
}
diff --git a/apps/mobile/src/__tests__/iosChromeActionMenu.test.ts b/apps/mobile/src/__tests__/iosChromeActionMenu.test.ts
index aacf142ff0..0f21e00778 100644
--- a/apps/mobile/src/__tests__/iosChromeActionMenu.test.ts
+++ b/apps/mobile/src/__tests__/iosChromeActionMenu.test.ts
@@ -86,11 +86,14 @@ describe("iOS chrome presenters stay on the system menu path", () => {
resolve(process.cwd(), "src/session/SessionOptionsExpoSheet.tsx"),
"utf8",
);
- expect(expoSheet).toMatch(/from ['"]@expo\/ui['"]/);
- expect(expoSheet).toContain("<BottomSheet");
- expect(expoSheet).toContain("<List>");
- expect(expoSheet).toContain("<ListItem");
- expect(expoSheet).toContain("onClosed?.()");
+ expect(expoSheet).toMatch(/from ['"]@expo\/ui\/swift-ui['"]/);
+ expect(expoSheet).toContain("<ComposerSheet");
+ expect(expoSheet).toContain("<Section>");
+ expect(expoSheet).toContain("<ComposerNativeRow");
+ expect(expoSheet).toContain("onClosed={onClosed}");
+ const nativeSheet = readTextLf(resolve(process.cwd(), "src/session/ComposerSheet.ios.tsx"), "utf8");
+ expect(nativeSheet).toContain("<BottomSheet");
+ expect(nativeSheet).toContain("onDismiss={onClosed}");
expect(expoSheet).not.toContain("snapPoints");
expect(home).toContain("<SessionOptionsPresenter");
const actionMenu = readTextLf(
diff --git a/apps/mobile/src/__tests__/mobileHomeListCache.test.ts b/apps/mobile/src/__tests__/mobileHomeListCache.test.ts
index 25816fa135..4b58442b97 100644
--- a/apps/mobile/src/__tests__/mobileHomeListCache.test.ts
+++ b/apps/mobile/src/__tests__/mobileHomeListCache.test.ts
@@ -376,3 +376,21 @@ describe('utf8ByteLength', () => {
expect(utf8ByteLength('')).toBe(0);
});
});
+
+it('preserves valid task tags across offline cache reads and drops invalid colors', async () => {
+ const { cacheHomeListSnapshot, getCachedHomeListSnapshot } =
+ await import('@/session/mobileHomeListCache');
+ const tag = {
+ id: 'work',
+ name: 'Work',
+ color: 'blue' as const,
+ favoriteOrder: null,
+ revision: 1,
+ };
+ await cacheHomeListSnapshot(USER_ID, [
+ makeSession('tagged', 'dev-a', {
+ tags: [tag, { ...tag, id: 'invalid', color: 'invalid' } as never],
+ }),
+ ]);
+ expect((await getCachedHomeListSnapshot(USER_ID))[0].sessions[0].tags).toEqual([tag]);
+});
diff --git a/apps/mobile/src/__tests__/remoteSessionStore.test.ts b/apps/mobile/src/__tests__/remoteSessionStore.test.ts
index d0dbd7422c..d7c7a88885 100644
--- a/apps/mobile/src/__tests__/remoteSessionStore.test.ts
+++ b/apps/mobile/src/__tests__/remoteSessionStore.test.ts
@@ -6468,3 +6468,38 @@ describe('device-clock live row clamp (applyRemoteTextEvent createdAt, cross-clo
}
});
});
+
+describe('task tag source isolation', () => {
+ beforeEach(() => remoteSessionStore.clear());
+ it('invalidates a first list response before a shard exists, only for the source device', () => {
+ const epoch = remoteSessionStore.captureDeviceSessionListMutationEpoch('dev-a');
+ const otherEpoch = remoteSessionStore.captureDeviceSessionListMutationEpoch('dev-b');
+ remoteSessionStore.applyRemotePush('dev-a', 'local-db:task-tags:changed', { tags: [] });
+ expect(remoteSessionStore.isDeviceSessionListMutationEpochCurrent('dev-a', epoch)).toBe(false);
+ expect(remoteSessionStore.isDeviceSessionListMutationEpochCurrent('dev-b', otherEpoch)).toBe(true);
+ const replacementEpoch = remoteSessionStore.captureDeviceSessionListMutationEpoch('dev-a');
+ expect(remoteSessionStore.isDeviceSessionListMutationEpochCurrent('dev-a', replacementEpoch)).toBe(true);
+ });
+ it('projects rename and deletion only into the source computer task memberships', () => {
+ const tag = {
+ id: 'default:red',
+ name: 'Red',
+ color: 'red' as const,
+ favoriteOrder: 0,
+ revision: 1,
+ };
+ remoteSessionStore.setDeviceSessions('dev-a', 'A', [session('a', { tags: [tag] })]);
+ remoteSessionStore.setDeviceSessions('dev-b', 'B', [session('b', { tags: [tag] })]);
+ const renamed = { ...tag, name: 'Work', revision: 2 };
+ remoteSessionStore.applyRemotePush('dev-a', 'local-db:task-tags:changed', {
+ tags: [renamed],
+ });
+ expect(remoteSessionStore.getSessions().find((row) => row.id === 'a')?.tags).toEqual([renamed]);
+ expect(remoteSessionStore.getSessions().find((row) => row.id === 'b')?.tags).toEqual([tag]);
+ remoteSessionStore.applyRemotePush('dev-a', 'local-db:task-tags:changed', {
+ tags: [],
+ });
+ expect(remoteSessionStore.getSessions().find((row) => row.id === 'a')?.tags).toEqual([]);
+ expect(remoteSessionStore.getSessions().find((row) => row.id === 'b')?.tags).toEqual([tag]);
+ });
+});
diff --git a/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx b/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx
index 8775340ea4..762de0a97d 100644
--- a/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx
+++ b/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx
@@ -1,3 +1,6 @@
+vi.mock('@/session/SessionOptionsExpoSheet', () => ({ SessionOptionsPresenter: () => null }));
+vi.mock('@/session/RenameSessionModal', () => ({ RenameSessionModal: () => null }));
+vi.mock('@/auth/AuthContext', () => ({ useAuth: () => ({ user: { id: 'test-owner' } }) }));
// @vitest-environment jsdom
import { act, type ReactNode } from "react";
import { createRoot, type Root } from "react-dom/client";
diff --git a/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts b/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts
index 939fbb611e..a3fc04e864 100644
--- a/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts
+++ b/apps/mobile/src/__tests__/sessionOptionsExpoSheet.test.ts
@@ -1,3 +1,9 @@
+import { createElement } from 'react';
+import { renderToStaticMarkup } from 'react-dom/server';
+vi.mock('@/session/TaskTags', () => ({ TaskTagsPanel: () => null, TaskMenuHeading: () => null }));
+vi.mock('@/session/ComposerSheet', () => import('@/session/ComposerSheet.ios'));
+vi.mock('@/session/ComposerNativeRow', () => import('@/session/ComposerNativeRow.ios'));
+vi.mock('@/session/ComposerNativeSection', () => import('@/session/ComposerNativeSection.ios'));
import { beforeEach, describe, expect, it, vi } from 'vitest';
/**
@@ -14,9 +20,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
* - onIsPresentedChange(false) = 用户主动关闭 → onClose
* - onDismiss(SwiftUI .sheet(onDismiss:)) = 已完全消失(两种关闭都触发) → onClosed
*
- * 本测试直接调用组件函数、断言真实传给 BottomSheet 的 props 与回调行为
- * (不做源码文本匹配,等价重构不会误报)。mobile 无 react renderer 依赖,
- * 这里手动展开函数组件即可 —— 组件是纯函数,只用到被 mock 的 useTheme。
+ * 在 React server renderer 内展开组件,断言真实 BottomSheet props 与关闭回调。
+ * 原生视图被替换为标记;标签面板独立测试,不加载设备连接原生模块。
*/
const platform = vi.hoisted(() => ({ os: 'ios' }));
@@ -24,7 +29,14 @@ const platform = vi.hoisted(() => ({ os: 'ios' }));
// 原生视图在 node 下 requireNativeView 会抛,全部替换成可识别的标记。
// 通用封装与 swift-ui 用不同标记,才能断言「没退回通用 BottomSheet」。
vi.mock('react-native', () => ({
- Platform: { get OS() { return platform.os; } },
+ useWindowDimensions: () => ({ width: 390, height: 844 }),
+ View: 'View',
+ ScrollView: 'ScrollView',
+ Platform: {
+ get OS() {
+ return platform.os;
+ },
+ },
}));
vi.mock('@expo/ui', () => ({
BottomSheet: 'UniversalBottomSheet',
@@ -37,8 +49,35 @@ vi.mock('@expo/ui', () => ({
vi.mock('@expo/ui/swift-ui', () => ({
BottomSheet: 'SwiftUIBottomSheet',
Group: 'Group',
+ RNHostView: 'RNHostView',
+ Form: 'Form',
+ Button: 'Button',
+ HStack: 'HStack',
+ Image: 'Image',
+ Spacer: 'Spacer',
+ Text: 'Text',
+ VStack: 'VStack',
+ Section: 'Section',
+ ZStack: 'ZStack',
}));
vi.mock('@expo/ui/swift-ui/modifiers', () => ({
+ ...Object.fromEntries(
+ [
+ 'accessibilityAddTraits',
+ 'accessibilityLabel',
+ 'contentShape',
+ 'buttonStyle',
+ 'disabled',
+ 'font',
+ 'foregroundStyle',
+ 'onGeometryChange',
+ 'listRowInsets',
+ 'listRowBackground',
+ 'presentationDetents',
+ 'scrollContentBackground',
+ ].map((name) => [name, (params: unknown) => ({ modifier: name, params })]),
+ ),
+ shapes: { rectangle: () => ({ shape: 'rectangle' }) },
frame: (params: unknown) => ({ modifier: 'frame', params }),
padding: (params: unknown) => ({ modifier: 'padding', params }),
presentationDragIndicator: (visibility: unknown) => ({
@@ -50,6 +89,7 @@ vi.mock('@/session/SessionActionSheet', () => ({
SessionActionSheet: 'SessionActionSheet',
}));
vi.mock('@/theme', () => ({
+ iconSize: { lg: 24 },
useTheme: () => ({ colors: { destructive: '#ff0000' } }),
}));
@@ -61,11 +101,18 @@ interface Element {
props: Record<string, unknown> & { children?: unknown };
}
-/** 手动展开函数组件(组件是纯函数,useTheme 已 mock),得到宿主元素树。 */
+/** 用 React 执行函数组件,保留 hooks,再遍历宿主元素树。 */
function renderTree(element: unknown): unknown {
let current = element;
while (isElement(current) && typeof current.type === 'function') {
- current = (current.type as (p: unknown) => unknown)(current.props);
+ const element = current;
+ // Render inside React so stateful sheets retain real hook semantics.
+ renderToStaticMarkup(
+ createElement(function Capture() {
+ current = (element.type as (p: unknown) => unknown)(element.props);
+ return null;
+ }),
+ );
}
return current;
}
@@ -182,8 +229,12 @@ describe('SessionOptionsExpoSheet 关闭生命周期', () => {
describe('SessionOptionsExpoSheet 菜单接线', () => {
it('每个菜单项把自己的 action 透传给 onAction(含删除)', () => {
const { props, tree } = renderSheet();
- const items = collectByType(tree, 'ListItem');
- const actions = items.map((item) => String(item.props.testID).replace('home.sessionActions.', ''));
+ const items = collectByType(tree, 'Button').filter((item) =>
+ String(item.props.testID).startsWith('home.sessionActions.'),
+ );
+ const actions = items.map((item) =>
+ String(item.props.testID).replace('home.sessionActions.', ''),
+ );
expect(actions).toContain('delete');
expect(actions).toContain('rename');
diff --git a/apps/mobile/src/__tests__/sessionSheetSurfaceVariant.test.ts b/apps/mobile/src/__tests__/sessionSheetSurfaceVariant.test.ts
index 2240b5a7e9..0c09d586f9 100644
--- a/apps/mobile/src/__tests__/sessionSheetSurfaceVariant.test.ts
+++ b/apps/mobile/src/__tests__/sessionSheetSurfaceVariant.test.ts
@@ -46,7 +46,7 @@ describe('mobile session sheet styling variants', () => {
expect(actionSheet).toContain('overlayColor={colors.sheetActionSurface}');
});
- it('keeps the session menu status chips left aligned inside the sheet body', () => {
+ it('centers session menu status chips with the task heading', () => {
const sessionMenu = readTextLf(resolve(process.cwd(), 'src/session/SessionMenuSheet.tsx'), 'utf8');
const headerBlockStart = sessionMenu.indexOf('headerBlock: {');
const headerBlockEnd = sessionMenu.indexOf('chipRow: {', headerBlockStart);
@@ -57,6 +57,6 @@ describe('mobile session sheet styling variants', () => {
expect(headerBlockSource).toContain("alignSelf: 'stretch'");
expect(chipRowSource).toContain("alignSelf: 'stretch'");
- expect(chipRowSource).toContain("justifyContent: 'flex-start'");
+ expect(chipRowSource).toContain("justifyContent: 'center'");
});
});
diff --git a/apps/mobile/src/__tests__/taskTagsRecovery.test.tsx b/apps/mobile/src/__tests__/taskTagsRecovery.test.tsx
new file mode 100644
index 0000000000..c496f0abf9
--- /dev/null
+++ b/apps/mobile/src/__tests__/taskTagsRecovery.test.tsx
@@ -0,0 +1,364 @@
+// @vitest-environment jsdom
+import React, { act } from "react";
+import { createRoot } from "react-dom/client";
+import { beforeEach, afterEach, it, expect, vi } from "vitest";
+const h = vi.hoisted(() => ({
+ invoke: vi.fn(),
+ compact: null as any,
+ input: null as any,
+ onCatalog: null as any,
+ context: {
+ status: "online",
+ connectionEpoch: 1,
+ recoveringDeviceIds: new Set<string>(),
+ getPresenceAvailability: () => true,
+ },
+}));
+vi.mock("react-native", () => ({
+ View: ({ children }: any) => <div>{children}</div>,
+ ScrollView: ({ children }: any) => <div>{children}</div>,
+ Pressable: ({ children, onPress, disabled, accessibilityLabel }: any) => (
+ <button
+ aria-label={accessibilityLabel}
+ disabled={disabled}
+ onClick={onPress}
+ >
+ {children}
+ </button>
+ ),
+ useWindowDimensions: () => ({ height: 800, width: 400 }),
+}));
+vi.mock("@/components/AppText", () => ({
+ Text: ({ children }: any) => <span>{children}</span>,
+ TextInput: (props: any) => {
+ h.input = props;
+ return <input readOnly value={props.value} />;
+ },
+}));
+vi.mock("react-native-reanimated", () => ({
+ default: { View: ({ children }: any) => <div>{children}</div> },
+ useSharedValue: (value: any) => ({ value }),
+ useAnimatedStyle: () => ({}),
+ runOnJS: (fn: any) => fn,
+ withTiming: (v: any) => v,
+ cancelAnimation: vi.fn(),
+ ReduceMotion: { System: "system" },
+}));
+vi.mock("@/platform/gestureHandler", () => {
+ const builder: any = new Proxy({}, { get: () => () => builder });
+ return {
+ Gesture: { Pan: () => builder },
+ GestureDetector: ({ children }: any) => children,
+ };
+});
+vi.mock("lucide-react-native", () => ({
+ GripVertical: () => null,
+ Pencil: () => null,
+ MoreHorizontal: () => null,
+ ArrowLeft: () => null,
+}));
+vi.mock("react-i18next", () => ({
+ useTranslation: () => ({ t: (s: string) => s }),
+}));
+vi.mock("react-native-safe-area-context", () => ({
+ useSafeAreaInsets: () => ({ top: 0, bottom: 0 }),
+}));
+vi.mock("@/auth/AuthContext", () => ({
+ useAuth: () => ({ user: { id: "owner" } }),
+}));
+vi.mock("@/theme", () => ({ useTheme: () => ({ colors: {} }), iconSize: {} }));
+vi.mock("@expo/ui/swift-ui", () => {
+ const Container = ({ children }: any) => <div>{children}</div>;
+ return {
+ Group: Container,
+ HStack: Container,
+ ZStack: Container,
+ RNHostView: Container,
+ Text: Container,
+ Image: () => null,
+ Button: ({ children, onPress, modifiers }: any) => (
+ <button
+ aria-label={
+ modifiers.find((m: any) => m.accessibilityLabel)?.accessibilityLabel
+ }
+ disabled={modifiers.some((m: any) => m.disabled)}
+ onClick={onPress}
+ >
+ {children}
+ </button>
+ ),
+ };
+});
+vi.mock("@expo/ui/swift-ui/modifiers", () => ({
+ ...Object.fromEntries(
+ [
+ "accessibilityAddTraits",
+ "accessibilityLabel",
+ "buttonStyle",
+ "contentShape",
+ "disabled",
+ "foregroundStyle",
+ "onGeometryChange",
+ "frame",
+ "listRowInsets",
+ ].map((k) => [k, (v: any) => ({ [k]: v })]),
+ ),
+ shapes: { rectangle: () => ({}) },
+}));
+vi.mock("@/session/SessionDetailsNative", () => ({
+ SessionDetailsNativeHeading: () => null,
+}));
+vi.mock("@/session/ComposerSheet", () => ({ ComposerSheet: () => null }));
+vi.mock("@/session/ComposerNativeSection", () => ({
+ ComposerNativeSection: ({ children }: any) => <div>{children}</div>,
+}));
+vi.mock("@/session/ComposerNativeRow", () => ({
+ ComposerNativeRow: () => null,
+}));
+vi.mock("@/session/SessionActionSheet", () => ({
+ SessionActionSheet: () => null,
+}));
+vi.mock("@/session/swipeRowRegistry", () => ({
+ buildSessionActionMenu: () => [],
+}));
+vi.mock("@/device-link/DeviceLinkContext", () => ({
+ useDeviceLink: () => ({ ...h.context, invoke: h.invoke }),
+ subscribeRemoteTaskTagsChanged: (callback: any) => {
+ h.onCatalog = callback;
+ return () => {
+ h.onCatalog = null;
+ };
+ },
+}));
+vi.mock("@/session/remoteSessionStore", () => ({
+ remoteSessionStore: {
+ getSessions: () => [],
+ getSessionDeviceId: () => "host",
+ subscribe: () => () => {},
+ },
+ useRemoteSessions: () => [],
+}));
+import { TaskTagsPanel, TaskTagDots } from "@/session/TaskTags";
+import { NativeTagShortcuts } from "@/session/SessionOptionsExpoSheet";
+import {
+ evictTaskTagCatalog,
+ readTaskTagCatalog,
+ resetTaskTagCatalogCache,
+} from "@/session/taskTagCatalogCache";
+const tag = {
+ id: "tag",
+ name: "Work",
+ color: "red" as const,
+ revision: 1,
+ favoriteOrder: null,
+};
+let root: ReturnType<typeof createRoot>;
+let node: HTMLDivElement;
+const session = { id: "task", tags: [], canonicalDeviceId: "host" } as any;
+const onExpandedChange = vi.fn();
+const render = async () =>
+ act(async () =>
+ root.render(
+ <TaskTagsPanel
+ session={session}
+ expanded={false}
+ onExpandedChange={onExpandedChange}
+ renderCompact={(state) => {
+ h.compact = state;
+ return <NativeTagShortcuts state={state} />;
+ }}
+ />,
+ ),
+ );
+beforeEach(() => {
+ (globalThis as any).IS_REACT_ACT_ENVIRONMENT = true;
+ resetTaskTagCatalogCache();
+ onExpandedChange.mockClear();
+ h.context.status = "online";
+ h.context.connectionEpoch = 1;
+ h.context.recoveringDeviceIds.clear();
+ h.invoke.mockReset().mockResolvedValue({ tags: [tag], sessions: [] });
+ node = document.createElement("div");
+ root = createRoot(node);
+});
+afterEach(() => act(() => root.unmount()));
+it.each(["other", "host", "account"])(
+ "scopes in-flight catalog invalidation to %s",
+ async (scope) => {
+ let finish!: (value: any) => void;
+ h.invoke.mockImplementationOnce(
+ () =>
+ new Promise((resolve) => {
+ finish = resolve;
+ }),
+ );
+ await render();
+ if (scope === "account") resetTaskTagCatalogCache();
+ else evictTaskTagCatalog(scope);
+ await act(async () => finish({ tags: [tag], sessions: [] }));
+ expect(h.compact.tags.map((item: any) => item.id)).toEqual(
+ scope === "other" ? [tag.id] : [],
+ );
+ expect(readTaskTagCatalog("owner", "host")?.tags).toEqual(
+ scope === "other" ? [tag] : undefined,
+ );
+ h.context.connectionEpoch++;
+ await render();
+ expect(h.compact.tags.map((item: any) => item.id)).toEqual([tag.id]);
+ },
+);
+it.each(["other", "host", "account"])(
+ "scopes late catalog errors to %s",
+ async (scope) => {
+ let fail!: (error: Error) => void;
+ h.invoke.mockImplementationOnce(
+ () =>
+ new Promise((_, reject) => {
+ fail = reject;
+ }),
+ );
+ await render();
+ if (scope === "account") resetTaskTagCatalogCache();
+ else evictTaskTagCatalog(scope);
+ await act(async () => fail(new Error("OFFLINE")));
+ expect(h.compact.message).toBe(
+ scope === "other" ? "taskTags.offline" : undefined,
+ );
+ },
+);
+it.each([false, true])(
+ "preserves drafts across catalog pushes (external recolor: %s)",
+ async (recolored) => {
+ await act(async () =>
+ root.render(
+ <TaskTagsPanel
+ session={session}
+ expanded
+ onExpandedChange={() => {}}
+ />,
+ ),
+ );
+ await act(async () =>
+ node
+ .querySelector<HTMLButtonElement>(
+ 'button[aria-label="taskTags.editLabel"]',
+ )!
+ .click(),
+ );
+ await act(async () => h.input.onChangeText("My draft"));
+ await act(async () =>
+ h.onCatalog("host", [
+ { ...tag, revision: 2, color: recolored ? "blue" : "red" },
+ ]),
+ );
+ expect(h.input.value).toBe("My draft");
+ const save = Array.from(node.querySelectorAll("button")).find(
+ (b) => b.textContent === "taskTags.save",
+ )!;
+ await act(async () => save.click());
+ expect(h.invoke.mock.calls.at(-1)![2][0]).toEqual({
+ action: "update",
+ tagId: tag.id,
+ revision: recolored ? 1 : 2,
+ name: "My draft",
+ nameCustomized: true,
+ color: "red",
+ });
+ },
+);
+it("refreshes only after the target peer recovers and retains cached offline navigation", async () => {
+ await render();
+ h.context.recoveringDeviceIds.add("other");
+ await render();
+ expect(h.invoke).toHaveBeenCalledTimes(1);
+ h.context.recoveringDeviceIds.add("host");
+ await render();
+ expect(h.compact.disabled).toBe(true);
+ expect(h.compact.canManage).toBe(true);
+ expect(h.compact.tags).toHaveLength(1);
+ const manage = () =>
+ node.querySelector<HTMLButtonElement>(
+ 'button[aria-label="taskTags.title"]',
+ )!;
+ expect(manage().disabled).toBe(false);
+ expect(
+ node.querySelector<HTMLButtonElement>('button[aria-label="Work"]')!
+ .disabled,
+ ).toBe(true);
+ await act(async () => manage().click());
+ expect(onExpandedChange).toHaveBeenCalledWith(true);
+ expect(h.invoke).toHaveBeenCalledTimes(1);
+ h.context.recoveringDeviceIds.delete("host");
+ await render();
+ expect(h.invoke).toHaveBeenCalledTimes(2);
+ h.context.connectionEpoch++;
+ await render();
+ expect(h.invoke).toHaveBeenCalledTimes(3);
+ h.context.status = "offline";
+ await render();
+ expect(h.compact.canManage).toBe(true);
+ expect(manage().disabled).toBe(false);
+});
+it("does not expose native management when offline without a catalog", async () => {
+ h.context.status = "offline";
+ await render();
+ expect(node.querySelector('button[aria-label="taskTags.title"]')).toBeNull();
+});
+it("discards the request from before peer recovery", async () => {
+ let finish!: (value: any) => void;
+ h.invoke.mockImplementationOnce(
+ () =>
+ new Promise((resolve) => {
+ finish = resolve;
+ }),
+ );
+ await render();
+ h.context.recoveringDeviceIds.add("host");
+ await render();
+ h.context.recoveringDeviceIds.delete("host");
+ await render();
+ await act(async () =>
+ finish({ tags: [{ ...tag, name: "Stale" }], sessions: [] }),
+ );
+ expect(h.compact.tags[0].name).toBe("Work");
+});
+it("renders every dot when the optional visible limit is omitted", async () => {
+ await act(async () =>
+ root.render(
+ <TaskTagDots tags={[tag, { ...tag, id: "two", name: "Life" }]} />,
+ ),
+ );
+ expect(node.querySelectorAll("div")).toHaveLength(4);
+});
+
+it("retries a committed attachment whose response was lost without updating a stale revision", async () => {
+ let fail = true;
+ h.invoke.mockImplementation(async (_device, _channel, [request]) => {
+ if (request.action === "update") throw new Error("CONFLICT");
+ if (request.action === "attach" && fail) {
+ fail = false;
+ throw new Error("timeout");
+ }
+ return { tags: request.action === "get" ? [] : [tag], sessions: [] };
+ });
+ await act(async () =>
+ root.render(
+ <TaskTagsPanel session={session} expanded onExpandedChange={() => {}} />,
+ ),
+ );
+ const click = async (label: string) => {
+ const button = Array.from(node.querySelectorAll("button")).find(
+ (b) => b.textContent === label,
+ )!;
+ expect(button).toBeTruthy();
+ await act(async () => button.click());
+ };
+ await click("taskTags.add");
+ await act(async () => h.input.onChangeText("Work"));
+ await click("taskTags.create");
+ expect(h.input.editable).toBe(false);
+ await click("taskTags.save");
+ const actions = h.invoke.mock.calls.map((call) => call[2][0].action);
+ expect(actions).toEqual(["get", "create", "attach", "attach"]);
+ expect(node.querySelector("input")).toBeNull();
+});
diff --git a/apps/mobile/src/device-link/DeviceLinkContext.tsx b/apps/mobile/src/device-link/DeviceLinkContext.tsx
index 929cb863b5..d746eb3b8d 100644
--- a/apps/mobile/src/device-link/DeviceLinkContext.tsx
+++ b/apps/mobile/src/device-link/DeviceLinkContext.tsx
@@ -50,6 +50,11 @@ import {
} from '@/session/agentCapabilitiesCache';
import { createDeviceCatalogRefresh } from '@/device-link/deviceCatalogRefresh';
import { evictComposerPaletteCacheForDevice, resetComposerPaletteCache } from '@/session/composerPaletteCache';
+import {
+ evictTaskTagCatalog,
+ resetTaskTagCatalogCache,
+ writeTaskTagCatalog,
+} from '@/session/taskTagCatalogCache';
import { clearAllDeviceModelMeta, evictDeviceModelMeta } from '@/device-link/deviceModelMetaCache';
import { dispatchFileBrowserWatchEvent } from '@/device-link/fileBrowserWatch';
import {
@@ -212,6 +217,15 @@ const CONTROLLER_CAPABILITIES = [
const remoteResponseEvidenceEpochs = createPresenceAvailabilityEpochs();
const remoteResponseEvidenceListeners = new Set<(deviceId: string) => void>();
const remoteAgentRosterListeners = new Set<(deviceId: string) => void>();
+const remoteTaskTagsChangedListeners = new Set<(deviceId: string, tags: unknown) => void>();
+export function subscribeRemoteTaskTagsChanged(
+ listener: (deviceId: string, tags: unknown) => void,
+): () => void {
+ remoteTaskTagsChangedListeners.add(listener);
+ return () => {
+ remoteTaskTagsChangedListeners.delete(listener);
+ };
+}
const remoteFavoritesChangedListeners = new Set<(deviceId: string) => void>();
export function subscribeRemoteFavoritesChanged(listener: (deviceId: string) => void): () => void {
remoteFavoritesChangedListeners.add(listener);
@@ -434,6 +448,7 @@ export function DeviceLinkProvider({ children }: { children: ReactNode }) {
clearAllDeviceModelMeta();
resetAgentCapabilitiesCache();
resetComposerPaletteCache();
+ resetTaskTagCatalogCache();
setLastPresenceSnapshot(null);
setPresenceVersion((version) => version + 1);
}, []);
@@ -1457,6 +1472,15 @@ export function routeFrame(env: Envelope, handlers: {
if (peerLinkClosed) return;
if (env.kind !== 'push' || !env.src) return;
const push = env.payload as PushPayload;
+ if (push.channel === 'local-db:task-tags:changed') {
+ writeTaskTagCatalog(
+ handlers.currentDataOwnerId,
+ env.src,
+ (push.payload as { tags?: unknown })?.tags,
+ );
+ for (const listener of remoteTaskTagsChangedListeners)
+ listener(env.src, (push.payload as { tags?: unknown })?.tags);
+ }
if (push.channel === 'maker:model-favorites:changed') {
for (const listener of remoteFavoritesChangedListeners) listener(env.src);
return;
@@ -1972,6 +1996,7 @@ function markOfflineDeviceMirror(deviceId: string): void {
}
function wipeUnavailableDeviceMirror(deviceId: string): void {
+ evictTaskTagCatalog(deviceId);
resetRemoteProjectOrderPushFence(deviceId);
invalidateScheduleIndexForDevice(deviceId);
remoteSessionStore.removeDevice(deviceId);
diff --git a/apps/mobile/src/i18n/locales/en/index.ts b/apps/mobile/src/i18n/locales/en/index.ts
index e3152d296b..90203c8da8 100644
--- a/apps/mobile/src/i18n/locales/en/index.ts
+++ b/apps/mobile/src/i18n/locales/en/index.ts
@@ -1,3 +1,4 @@
+import taskTags from './taskTags.json';
/**
* 本 locale 的 catalog 组装:每个区域一个 JSON 文件、一个顶级 key,
* 组装成单一 'common' namespace 的资源对象。
@@ -23,6 +24,7 @@ import startup from './startup.json';
import update from './update.json';
export default {
+ taskTags,
remoteDesktop,
apiErrors,
chat,
diff --git a/apps/mobile/src/i18n/locales/en/taskTags.json b/apps/mobile/src/i18n/locales/en/taskTags.json
new file mode 100644
index 0000000000..db9529427f
--- /dev/null
+++ b/apps/mobile/src/i18n/locales/en/taskTags.json
@@ -0,0 +1,54 @@
+{
+ "title": "Tags",
+ "more": "More tags",
+ "settings": "Tag settings",
+ "name": "Name",
+ "color": "Color",
+ "favorite": "Favorite (up to 7)",
+ "create": "Create",
+ "save": "Save",
+ "done": "Done",
+ "back": "Back",
+ "delete": "Delete tag",
+ "cancel": "Cancel",
+ "deleteConfirm": "Delete “{{name}}” from {{count}} tasks? Tasks and messages will be kept.",
+ "loading": "Loading…",
+ "loadFailed": "Could not load tags. Try again.",
+ "retry": "Retry",
+ "unavailable": "This computer needs an update to support tags.",
+ "offline": "Connect to the source computer to edit tags.",
+ "failed": "Could not save. Please try again.",
+ "conflict": "Tags changed elsewhere. Reload and try again.",
+ "favoritesFull": "Only seven favorite tags are allowed.",
+ "alreadyExists": "A tag with this name already exists.",
+ "empty": "No tags yet.",
+ "red": "Red",
+ "orange": "Orange",
+ "yellow": "Yellow",
+ "green": "Green",
+ "blue": "Blue",
+ "purple": "Purple",
+ "gray": "Gray",
+ "none": "No color",
+ "editLabel": "Edit “{{name}}”",
+ "reorderLabel": "Reorder “{{name}}”",
+ "reorderHint": "Hold the handle and drag to reorder",
+ "pink": "Pink",
+ "coral": "Coral",
+ "teal": "Teal",
+ "indigo": "Indigo",
+ "white": "White",
+ "add": "Add tag",
+ "editTitle": "Edit tag",
+ "editHint": "Changes apply to all tasks using this tag.",
+ "addHint": "Added tags are selected for this task.",
+ "selectedCount": "{{count}} selected",
+ "presetImportant": "Important",
+ "presetFollowUp": "Follow up",
+ "presetWork": "Work",
+ "presetLife": "Life",
+ "presetIdeas": "Ideas",
+ "presetReference": "Reference",
+ "addLabel": "Add “{{name}}”",
+ "removeLabel": "Remove “{{name}}”"
+}
diff --git a/apps/mobile/src/i18n/locales/ja/index.ts b/apps/mobile/src/i18n/locales/ja/index.ts
index e3152d296b..90203c8da8 100644
--- a/apps/mobile/src/i18n/locales/ja/index.ts
+++ b/apps/mobile/src/i18n/locales/ja/index.ts
@@ -1,3 +1,4 @@
+import taskTags from './taskTags.json';
/**
* 本 locale 的 catalog 组装:每个区域一个 JSON 文件、一个顶级 key,
* 组装成单一 'common' namespace 的资源对象。
@@ -23,6 +24,7 @@ import startup from './startup.json';
import update from './update.json';
export default {
+ taskTags,
remoteDesktop,
apiErrors,
chat,
diff --git a/apps/mobile/src/i18n/locales/ja/taskTags.json b/apps/mobile/src/i18n/locales/ja/taskTags.json
new file mode 100644
index 0000000000..20a9f34524
--- /dev/null
+++ b/apps/mobile/src/i18n/locales/ja/taskTags.json
@@ -0,0 +1,54 @@
+{
+ "title": "タグ",
+ "more": "その他のタグ",
+ "settings": "タグ設定",
+ "name": "名前",
+ "color": "色",
+ "favorite": "よく使うタグ(最大7個)",
+ "create": "作成",
+ "save": "保存",
+ "done": "完了",
+ "back": "戻る",
+ "delete": "タグを削除",
+ "cancel": "キャンセル",
+ "deleteConfirm": "「{{name}}」を{{count}}件のタスクから削除しますか?タスクとメッセージは保持されます。",
+ "loading": "読み込み中…",
+ "loadFailed": "タグを読み込めませんでした。もう一度お試しください。",
+ "retry": "再試行",
+ "unavailable": "タグを使用するには、このコンピュータを更新してください。",
+ "offline": "タグを編集するには、セッションのあるコンピュータに接続してください。",
+ "failed": "保存できませんでした。再試行してください。",
+ "conflict": "別の端末でタグが変更されました。再読み込みしてください。",
+ "favoritesFull": "よく使うタグは最大7個です。",
+ "alreadyExists": "同じ名前のタグが存在します。",
+ "empty": "タグはまだありません。",
+ "red": "赤",
+ "orange": "オレンジ",
+ "yellow": "黄",
+ "green": "緑",
+ "blue": "青",
+ "purple": "紫",
+ "gray": "グレー",
+ "none": "色なし",
+ "editLabel": "「{{name}}」を編集",
+ "reorderLabel": "「{{name}}」の順序を変更",
+ "reorderHint": "ハンドルを長押ししてドラッグで並べ替え",
+ "pink": "ピンク",
+ "coral": "コーラル",
+ "teal": "ティール",
+ "indigo": "インディゴ",
+ "white": "白",
+ "add": "タグを追加",
+ "editTitle": "タグを編集",
+ "editHint": "このタグを使うすべてのタスクに反映されます。",
+ "addHint": "追加後、このタスクに自動で選択されます。",
+ "selectedCount": "{{count}} 個選択中",
+ "presetImportant": "重要",
+ "presetFollowUp": "フォローアップ",
+ "presetWork": "仕事",
+ "presetLife": "生活",
+ "presetIdeas": "アイデア",
+ "presetReference": "資料",
+ "addLabel": "「{{name}}」を追加",
+ "removeLabel": "「{{name}}」を外す"
+}
diff --git a/apps/mobile/src/i18n/locales/ko/index.ts b/apps/mobile/src/i18n/locales/ko/index.ts
index e3152d296b..90203c8da8 100644
--- a/apps/mobile/src/i18n/locales/ko/index.ts
+++ b/apps/mobile/src/i18n/locales/ko/index.ts
@@ -1,3 +1,4 @@
+import taskTags from './taskTags.json';
/**
* 本 locale 的 catalog 组装:每个区域一个 JSON 文件、一个顶级 key,
* 组装成单一 'common' namespace 的资源对象。
@@ -23,6 +24,7 @@ import startup from './startup.json';
import update from './update.json';
export default {
+ taskTags,
remoteDesktop,
apiErrors,
chat,
diff --git a/apps/mobile/src/i18n/locales/ko/taskTags.json b/apps/mobile/src/i18n/locales/ko/taskTags.json
new file mode 100644
index 0000000000..781178db2b
--- /dev/null
+++ b/apps/mobile/src/i18n/locales/ko/taskTags.json
@@ -0,0 +1,54 @@
+{
+ "title": "태그",
+ "more": "태그 더 보기",
+ "settings": "태그 설정",
+ "name": "이름",
+ "color": "색상",
+ "favorite": "즐겨찾기(최대 7개)",
+ "create": "만들기",
+ "save": "저장",
+ "done": "완료",
+ "back": "뒤로",
+ "delete": "태그 삭제",
+ "cancel": "취소",
+ "deleteConfirm": "작업 {{count}}개에서 “{{name}}” 태그를 삭제할까요? 작업과 메시지는 유지됩니다.",
+ "loading": "불러오는 중…",
+ "loadFailed": "태그를 불러오지 못했습니다. 다시 시도해 주세요.",
+ "retry": "다시 시도",
+ "unavailable": "태그를 사용하려면 이 컴퓨터를 업데이트하세요.",
+ "offline": "태그를 편집하려면 세션이 있는 컴퓨터에 연결하세요.",
+ "failed": "저장하지 못했습니다. 다시 시도하세요.",
+ "conflict": "다른 기기에서 태그가 변경되었습니다. 새로고침하세요.",
+ "favoritesFull": "즐겨찾기 태그는 최대 7개입니다.",
+ "alreadyExists": "같은 이름의 태그가 있습니다.",
+ "empty": "태그가 없습니다.",
+ "red": "빨강",
+ "orange": "주황",
+ "yellow": "노랑",
+ "green": "초록",
+ "blue": "파랑",
+ "purple": "보라",
+ "gray": "회색",
+ "none": "색상 없음",
+ "editLabel": "“{{name}}” 편집",
+ "reorderLabel": "“{{name}}” 순서 변경",
+ "reorderHint": "손잡이를 길게 누르고 드래그하여 순서 변경",
+ "pink": "분홍색",
+ "coral": "산호색",
+ "teal": "청록색",
+ "indigo": "남색",
+ "white": "흰색",
+ "add": "태그 추가",
+ "editTitle": "태그 편집",
+ "editHint": "이 태그를 사용하는 모든 작업에 적용됩니다.",
+ "addHint": "추가 후 현재 작업에 자동으로 선택됩니다.",
+ "selectedCount": "{{count}}개 선택됨",
+ "presetImportant": "중요",
+ "presetFollowUp": "후속 확인",
+ "presetWork": "업무",
+ "presetLife": "생활",
+ "presetIdeas": "아이디어",
+ "presetReference": "자료",
+ "addLabel": "“{{name}}” 추가",
+ "removeLabel": "“{{name}}” 제거"
+}
diff --git a/apps/mobile/src/i18n/locales/zh-CN/index.ts b/apps/mobile/src/i18n/locales/zh-CN/index.ts
index e3152d296b..90203c8da8 100644
--- a/apps/mobile/src/i18n/locales/zh-CN/index.ts
+++ b/apps/mobile/src/i18n/locales/zh-CN/index.ts
@@ -1,3 +1,4 @@
+import taskTags from './taskTags.json';
/**
* 本 locale 的 catalog 组装:每个区域一个 JSON 文件、一个顶级 key,
* 组装成单一 'common' namespace 的资源对象。
@@ -23,6 +24,7 @@ import startup from './startup.json';
import update from './update.json';
export default {
+ taskTags,
remoteDesktop,
apiErrors,
chat,
diff --git a/apps/mobile/src/i18n/locales/zh-CN/taskTags.json b/apps/mobile/src/i18n/locales/zh-CN/taskTags.json
new file mode 100644
index 0000000000..084ffcf5b5
--- /dev/null
+++ b/apps/mobile/src/i18n/locales/zh-CN/taskTags.json
@@ -0,0 +1,54 @@
+{
+ "title": "标签",
+ "more": "更多标签",
+ "settings": "标签设置",
+ "name": "名称",
+ "color": "颜色",
+ "favorite": "常用(最多 7 个)",
+ "create": "创建",
+ "save": "保存",
+ "done": "完成",
+ "back": "返回",
+ "delete": "删除标签",
+ "cancel": "取消",
+ "deleteConfirm": "从 {{count}} 个任务中删除“{{name}}”?任务和消息会保留。",
+ "loading": "加载中…",
+ "loadFailed": "标签加载失败,请重试。",
+ "retry": "重试",
+ "unavailable": "此电脑需要更新才能支持标签。",
+ "offline": "连接任务所在电脑后可编辑标签。",
+ "failed": "保存失败,请重试。",
+ "conflict": "标签已在其他端修改,请刷新后重试。",
+ "favoritesFull": "最多设置七个常用标签。",
+ "alreadyExists": "已有同名标签。",
+ "empty": "暂无标签。",
+ "red": "红色",
+ "orange": "橙色",
+ "yellow": "黄色",
+ "green": "绿色",
+ "blue": "蓝色",
+ "purple": "紫色",
+ "gray": "灰色",
+ "none": "无颜色",
+ "editLabel": "编辑“{{name}}”",
+ "reorderLabel": "调整“{{name}}”的顺序",
+ "reorderHint": "长按手柄并拖动排序",
+ "pink": "粉色",
+ "coral": "珊瑚色",
+ "teal": "青色",
+ "indigo": "靛蓝色",
+ "white": "白色",
+ "add": "添加标签",
+ "editTitle": "编辑标签",
+ "editHint": "修改会同步到使用此标签的所有任务。",
+ "addHint": "添加后,自动选中到当前任务。",
+ "selectedCount": "已选 {{count}} 个",
+ "presetImportant": "重要",
+ "presetFollowUp": "待跟进",
+ "presetWork": "工作",
+ "presetLife": "生活",
+ "presetIdeas": "灵感",
+ "presetReference": "资料",
+ "addLabel": "添加“{{name}}”",
+ "removeLabel": "移除“{{name}}”"
+}
diff --git a/apps/mobile/src/i18n/locales/zh-TW/index.ts b/apps/mobile/src/i18n/locales/zh-TW/index.ts
index e3152d296b..90203c8da8 100644
--- a/apps/mobile/src/i18n/locales/zh-TW/index.ts
+++ b/apps/mobile/src/i18n/locales/zh-TW/index.ts
@@ -1,3 +1,4 @@
+import taskTags from './taskTags.json';
/**
* 本 locale 的 catalog 组装:每个区域一个 JSON 文件、一个顶级 key,
* 组装成单一 'common' namespace 的资源对象。
@@ -23,6 +24,7 @@ import startup from './startup.json';
import update from './update.json';
export default {
+ taskTags,
remoteDesktop,
apiErrors,
chat,
diff --git a/apps/mobile/src/i18n/locales/zh-TW/taskTags.json b/apps/mobile/src/i18n/locales/zh-TW/taskTags.json
new file mode 100644
index 0000000000..0669a7fe6e
--- /dev/null
+++ b/apps/mobile/src/i18n/locales/zh-TW/taskTags.json
@@ -0,0 +1,54 @@
+{
+ "title": "標籤",
+ "more": "更多標籤",
+ "settings": "標籤設定",
+ "name": "名稱",
+ "color": "顏色",
+ "favorite": "常用(最多 7 個)",
+ "create": "建立",
+ "save": "儲存",
+ "done": "完成",
+ "back": "返回",
+ "delete": "刪除標籤",
+ "cancel": "取消",
+ "deleteConfirm": "從 {{count}} 個任務中刪除「{{name}}」?任務和訊息會保留。",
+ "loading": "載入中…",
+ "loadFailed": "標籤載入失敗,請重試。",
+ "retry": "重試",
+ "unavailable": "此電腦需要更新才能支援標籤。",
+ "offline": "連線至任務所在電腦後可編輯標籤。",
+ "failed": "儲存失敗,請重試。",
+ "conflict": "標籤已在其他端修改,請重新整理後重試。",
+ "favoritesFull": "最多設定七個常用標籤。",
+ "alreadyExists": "已有同名標籤。",
+ "empty": "暫無標籤。",
+ "red": "紅色",
+ "orange": "橙色",
+ "yellow": "黃色",
+ "green": "綠色",
+ "blue": "藍色",
+ "purple": "紫色",
+ "gray": "灰色",
+ "none": "無顏色",
+ "editLabel": "編輯「{{name}}」",
+ "reorderLabel": "調整「{{name}}」的順序",
+ "reorderHint": "長按把手並拖曳排序",
+ "pink": "粉紅色",
+ "coral": "珊瑚色",
+ "teal": "青色",
+ "indigo": "靛藍色",
+ "white": "白色",
+ "add": "新增標籤",
+ "editTitle": "編輯標籤",
+ "editHint": "修改會同步至使用此標籤的所有任務。",
+ "addHint": "新增後,自動選取至目前任務。",
+ "selectedCount": "已選 {{count}} 個",
+ "presetImportant": "重要",
+ "presetFollowUp": "待跟進",
+ "presetWork": "工作",
+ "presetLife": "生活",
+ "presetIdeas": "靈感",
+ "presetReference": "資料",
+ "addLabel": "加入「{{name}}」",
+ "removeLabel": "移除「{{name}}」"
+}
diff --git a/apps/mobile/src/session/SessionActionSheet.tsx b/apps/mobile/src/session/SessionActionSheet.tsx
index 5b7efa7905..6145a185e0 100644
--- a/apps/mobile/src/session/SessionActionSheet.tsx
+++ b/apps/mobile/src/session/SessionActionSheet.tsx
@@ -1,3 +1,6 @@
+import { TaskMenuHeading, TaskTagsPanel } from './TaskTags';
+import { GestureHandlerRootView } from '@/platform/gestureHandler';
+import type { RemoteSession } from './types';
/**
* SessionActionSheet —— 首页会话行左滑「选项」触发的底部操作菜单
* (重命名 / 置顶切换 / 归档 / 删除 + 独立「取消」)。
@@ -65,6 +68,7 @@ const ACTION_ICONS: Record<SessionSwipeAction, LucideIcon> = {
};
export function SessionActionSheet({
+ session,
onAction,
onClose,
onClosed,
@@ -72,6 +76,7 @@ export function SessionActionSheet({
status,
visible,
}: {
+ session?: RemoteSession | null;
/** 点菜单项:父级负责关 sheet 并串后续(删除 Alert / 重命名弹窗 / 直接执行)。 */
onAction(action: SessionSwipeAction): void;
onClose(): void;
@@ -82,6 +87,10 @@ export function SessionActionSheet({
visible: boolean;
}) {
const styles = useThemedStyles(makeStyles);
+ const [tagsExpanded, setTagsExpanded] = useState(false);
+ useEffect(() => {
+ if (!visible) setTagsExpanded(false);
+ }, [visible]);
const { colors } = useTheme();
const { t } = useTranslation();
const insets = useSafeAreaInsets();
@@ -127,13 +136,8 @@ export function SessionActionSheet({
const menu = buildSessionActionMenu(pinnedAt, status);
return (
- <Modal
- animationType="none"
- onRequestClose={onClose}
- transparent
- visible={mounted}
- >
- <View style={styles.overlay}>
+ <Modal animationType="none" onRequestClose={onClose} transparent visible={mounted}>
+ <GestureHandlerRootView style={styles.overlay}>
<Animated.View style={[StyleSheet.absoluteFill, { opacity: progress }]}>
<BlurBackdrop />
<Pressable
@@ -154,44 +158,80 @@ export function SessionActionSheet({
testID="home.sessionActions"
>
<View style={styles.actionCard}>
- <BlurBackdrop
- intensity={32}
- overlayColor={colors.sheetActionSurface}
- />
- {menu.map((item) => {
- const IconComponent = ACTION_ICONS[item.action];
- const color = item.destructive
- ? colors.destructive
- : colors.sheetActionText;
- return (
- <Pressable
- accessibilityLabel={item.label}
- accessibilityRole="button"
- key={item.action}
- onPress={() => onAction(item.action)}
- style={({ pressed }) => [
- styles.actionRow,
- pressed && styles.pressed,
- ]}
- testID={`home.sessionActions.${item.action}`}
- >
- <IconComponent
- color={color}
- size={iconSize.lg}
- strokeWidth={iconStroke.regular}
- />
- <Text
- numberOfLines={1}
- style={[
- styles.actionLabel,
- item.destructive && styles.actionLabelDanger,
- ]}
- >
- {item.label}
- </Text>
- </Pressable>
- );
- })}
+ <BlurBackdrop intensity={32} overlayColor={colors.sheetActionSurface} />
+ {session && <TaskMenuHeading session={session} />}
+ {!tagsExpanded &&
+ menu
+ .filter(
+ (item) =>
+ !item.destructive && item.action !== 'archive' && item.action !== 'restore',
+ )
+ .map((item) => {
+ const IconComponent = ACTION_ICONS[item.action];
+ const color = item.destructive ? colors.destructive : colors.sheetActionText;
+ return (
+ <Pressable
+ accessibilityLabel={item.label}
+ accessibilityRole="button"
+ key={item.action}
+ onPress={() => onAction(item.action)}
+ style={({ pressed }) => [styles.actionRow, pressed && styles.pressed]}
+ testID={`home.sessionActions.${item.action}`}
+ >
+ <IconComponent
+ color={color}
+ size={iconSize.lg}
+ strokeWidth={iconStroke.regular}
+ />
+ <Text
+ numberOfLines={1}
+ style={[styles.actionLabel, item.destructive && styles.actionLabelDanger]}
+ >
+ {item.label}
+ </Text>
+ </Pressable>
+ );
+ })}
+ {visible && session && (
+ <TaskTagsPanel
+ key={`${session.canonicalDeviceId ?? session.deviceLinkDeviceId}:${session.id}`}
+ session={session}
+ expanded={tagsExpanded}
+ onExpandedChange={setTagsExpanded}
+ />
+ )}
+ {!tagsExpanded &&
+ menu
+ .filter(
+ (item) =>
+ item.destructive || item.action === 'archive' || item.action === 'restore',
+ )
+ .map((item) => {
+ const IconComponent = ACTION_ICONS[item.action];
+ const color = item.destructive ? colors.destructive : colors.sheetActionText;
+ return (
+ <Pressable
+ accessibilityLabel={item.label}
+ accessibilityRole="button"
+ key={item.action}
+ onPress={() => onAction(item.action)}
+ style={({ pressed }) => [styles.actionRow, pressed && styles.pressed]}
+ testID={`home.sessionActions.${item.action}`}
+ >
+ <IconComponent
+ color={color}
+ size={iconSize.lg}
+ strokeWidth={iconStroke.regular}
+ />
+ <Text
+ numberOfLines={1}
+ style={[styles.actionLabel, item.destructive && styles.actionLabelDanger]}
+ >
+ {item.label}
+ </Text>
+ </Pressable>
+ );
+ })}
</View>
<Pressable
accessibilityLabel={t("session.common.cancel")}
@@ -210,7 +250,7 @@ export function SessionActionSheet({
<Text style={styles.cancelText}>{t("session.common.cancel")}</Text>
</Pressable>
</Animated.View>
- </View>
+ </GestureHandlerRootView>
</Modal>
);
}
diff --git a/apps/mobile/src/session/SessionDetailsNative.ios.tsx b/apps/mobile/src/session/SessionDetailsNative.ios.tsx
index 889c92f1f1..989b5490ce 100644
--- a/apps/mobile/src/session/SessionDetailsNative.ios.tsx
+++ b/apps/mobile/src/session/SessionDetailsNative.ios.tsx
@@ -18,6 +18,7 @@ import {
foregroundStyle,
frame,
labelStyle,
+ lineLimit,
padding,
presentationDetents,
presentationDragIndicator,
@@ -41,6 +42,7 @@ export function SessionDetailsNative({
onBack,
children,
footer,
+ contentPaddingTop = spacing.lg,
}: SessionDetailsNativeProps) {
const { colors, mode } = useTheme();
const { bottom: bottomInset } = useSafeAreaInsets();
@@ -68,35 +70,7 @@ export function SessionDetailsNative({
spacing={0}
modifiers={[frame({ maxWidth: Infinity, maxHeight: Infinity })]}
>
- <HStack
- modifiers={[
- padding({
- top: spacing.lg,
- bottom: spacing.sm,
- leading: spacing.lg,
- trailing: spacing.lg,
- }),
- ]}
- >
- {onBack ? (
- <Button
- label={backLabel}
- systemImage="chevron.backward"
- onPress={onBack}
- modifiers={[
- labelStyle("iconOnly"),
- buttonStyle("glass"),
- frame({ width: 44, height: 44 }),
- ]}
- />
- ) : (
- <Spacer modifiers={[frame({ width: 44 })]} />
- )}
- <Spacer />
- <Text>{title}</Text>
- <Spacer />
- <Spacer modifiers={[frame({ width: 44, height: 44 })]} />
- </HStack>
+ <SessionDetailsNativeHeading title={title} backLabel={backLabel} onBack={onBack} />
{/* Extend the viewport through the sheet's bottom safe area. Keep the
inset inside scroll content, not as an empty strip below its clip. */}
<Group modifiers={[padding({ bottom: footer ? 0 : -bottomInset })]}>
@@ -106,6 +80,7 @@ export function SessionDetailsNative({
keyboardShouldPersistTaps="handled"
contentContainerStyle={{
padding: spacing.lg,
+ paddingTop: contentPaddingTop,
paddingBottom: spacing.xxl + (footer ? 0 : bottomInset),
}}
>
@@ -193,3 +168,41 @@ export function SessionDetailsNativeActions({
</View>
);
}
+
+export function SessionDetailsNativeHeading({
+ title,
+ backLabel,
+ onBack,
+}: Pick<SessionDetailsNativeProps, 'title' | 'backLabel' | 'onBack'>) {
+ return (
+ <HStack
+ modifiers={[
+ padding({
+ top: spacing.lg,
+ bottom: spacing.sm,
+ leading: spacing.lg,
+ trailing: spacing.lg,
+ }),
+ ]}
+ >
+ {onBack ? (
+ <Button
+ label={backLabel}
+ systemImage="chevron.backward"
+ onPress={onBack}
+ modifiers={[
+ labelStyle('iconOnly'),
+ buttonStyle('glass'),
+ frame({ width: 44, height: 44 }),
+ ]}
+ />
+ ) : (
+ <Spacer modifiers={[frame({ width: 44 })]} />
+ )}
+ <Spacer />
+ <Text modifiers={[lineLimit(1)]}>{title}</Text>
+ <Spacer />
+ <Spacer modifiers={[frame({ width: 44, height: 44 })]} />
+ </HStack>
+ );
+}
diff --git a/apps/mobile/src/session/SessionDetailsNative.tsx b/apps/mobile/src/session/SessionDetailsNative.tsx
index 23de5b47c2..b24319e250 100644
--- a/apps/mobile/src/session/SessionDetailsNative.tsx
+++ b/apps/mobile/src/session/SessionDetailsNative.tsx
@@ -9,6 +9,7 @@ export interface SessionDetailsNativeProps {
onBack?: () => void;
children: ReactNode;
footer?: ReactNode;
+ contentPaddingTop?: number;
}
export interface SessionDetailsAction {
@@ -22,6 +23,11 @@ export interface SessionDetailsAction {
export function SessionDetailsNative(_props: SessionDetailsNativeProps) {
return null;
}
+export function SessionDetailsNativeHeading(
+ _props: Pick<SessionDetailsNativeProps, 'title' | 'backLabel' | 'onBack'>,
+) {
+ return null;
+}
export function SessionDetailsNativeActions(_props: {
actions: SessionDetailsAction[];
}) {
diff --git a/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx b/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx
index 9fca5fa595..cce16639a9 100644
--- a/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx
+++ b/apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx
@@ -11,6 +11,7 @@ import { Folder, Monitor, Pin, type LucideIcon } from "lucide-react-native";
import { View } from "react-native";
import { Text } from "@/components/AppText";
import { QuietSyncIndicator } from "@/components/QuietSyncIndicator";
+import { TaskTagDots } from './TaskTags';
import {
accessibilityHint,
accessibilityElement,
@@ -86,7 +87,10 @@ export function SessionHeaderNativeBlur({ height, edge = 'top', inset = 0 }: { h
);
}
-export function SessionHeaderNativeTitle({ title, pinned, syncing, syncingImmediately, notice }: SessionHeaderNativeTitleProps) {
+export function SessionHeaderNativeTitle({ title,
+ tags,
+ onTagsPress,
+ pinned, syncing, syncingImmediately, notice }: SessionHeaderNativeTitleProps) {
const { colors } = useTheme();
const style = {
borderRadius: radius.pill,
@@ -119,6 +123,12 @@ export function SessionHeaderNativeTitle({ title, pinned, syncing, syncingImmedi
<View style={{ flexDirection: "row", alignItems: "center", justifyContent: "center", gap: spacing.xs }}>
{pinned ? <Pin color={colors.textTertiary} size={iconSize.sm} strokeWidth={iconStroke.regular} /> : null}
{label}
+ <TaskTagDots
+ tags={tags}
+ maxVisible={7}
+ surfaceColor={colors.surfaceTranslucent}
+ onPress={onTagsPress}
+ />
<QuietSyncIndicator active={syncing} immediate={syncingImmediately} />
</View>
{notice ? (
diff --git a/apps/mobile/src/session/SessionHeaderNativeControls.tsx b/apps/mobile/src/session/SessionHeaderNativeControls.tsx
index 4a21e0be78..14063b0f76 100644
--- a/apps/mobile/src/session/SessionHeaderNativeControls.tsx
+++ b/apps/mobile/src/session/SessionHeaderNativeControls.tsx
@@ -6,6 +6,8 @@ export interface SessionHeaderNativeBackProps {
}
export interface SessionHeaderNativeTitleProps {
+ onTagsPress?: () => void;
+ tags?: import('@cindy/maker-shared').TaskTag[];
title: string;
pinned: boolean;
syncing: boolean;
diff --git a/apps/mobile/src/session/SessionListDrawer.tsx b/apps/mobile/src/session/SessionListDrawer.tsx
index e15aadbe9f..48fa774d00 100644
--- a/apps/mobile/src/session/SessionListDrawer.tsx
+++ b/apps/mobile/src/session/SessionListDrawer.tsx
@@ -1,3 +1,4 @@
+import { TaskTagDots } from '@/session/TaskTags';
import { loadDeviceSessionScheduleIndex } from './scheduleIndex';
import { useDeviceLink } from '@/device-link/DeviceLinkContext';
import { remoteScheduleEventStore } from '@/scheduler/remoteScheduleEvents';
@@ -44,9 +45,14 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useTranslation } from 'react-i18next';
import { Text } from '@/components/AppText';
import { ConversationSearchFilterSheet } from '@/session/ConversationSearchFilterSheet';
+import { SessionOptionsPresenter } from '@/session/SessionOptionsExpoSheet';
+import { RenameSessionModal } from '@/session/RenameSessionModal';
+import { useSessionListActions } from '@/session/useSessionListActions';
+import type { RemoteSession } from '@/session/types';
import { HomeSearchBar } from '@/session/HomeSearchBar';
import {
conversationSearchOriginsFromDeviceModels,
+ conversationSearchAllowsLocalWrites,
listConversationSearchProjects,
shouldReplaceListWithSearchResults,
type ConversationSearchDeviceModel,
@@ -118,6 +124,7 @@ export function SessionListDrawer({
const { t } = useTranslation();
const insets = useSafeAreaInsets();
const reduceMotion = useReduceMotionEnabled();
+ const actions = useSessionListActions();
// 抽屉贴左缘,横屏刘海侧的 left inset 并进面板总宽,内容用 padding 让出。
// 下限 1 是除零保险:当前调用点 enabled=false 时本组件整个不渲染(width 恒 >=300),
// 但 progress/scrim 多处除以 panelWidth,不把不变量寄托在调用方身上。
@@ -408,11 +415,12 @@ export function SessionListDrawer({
active={active}
item={item.item}
onSelect={onSelectSession}
+ onShowOptions={actions.showSessionOptions}
searchResult={item.source === 'search'}
/>
);
},
- [currentSessionId, onSelectSession],
+ [currentSessionId, onSelectSession, actions.showSessionOptions],
);
if (!mounted) return null;
@@ -540,6 +548,23 @@ export function SessionListDrawer({
topOffset={insets.top + spacing.sm}
visible={searchFilterOpen}
/>
+ <SessionOptionsPresenter
+ session={actions.actionSheetSession}
+ onAction={actions.handleSessionSheetAction}
+ onClose={() => actions.setActionSheetSession(null)}
+ onClosed={actions.handleSessionSheetClosed}
+ pinnedAt={actions.actionSheetSession?.pinnedAt}
+ status={actions.actionSheetSession?.status}
+ visible={actions.actionSheetSession !== null}
+ />
+ <RenameSessionModal
+ draft={actions.renameSessionDraft}
+ onCancel={actions.closeRenameSession}
+ onChangeDraft={actions.setRenameSessionDraft}
+ onConfirm={actions.confirmRenameSession}
+ saving={false}
+ visible={actions.renameSessionTarget !== null}
+ />
</View>
);
}
@@ -548,11 +573,13 @@ const DrawerSessionRow = memo(function DrawerSessionRow({
active,
item,
onSelect,
+ onShowOptions,
searchResult,
}: {
active: boolean;
item: RemoteSessionListItem;
onSelect(item: RemoteSessionListItem): void;
+ onShowOptions(session: RemoteSession): void;
searchResult: boolean;
}) {
const styles = useThemedStyles(makeStyles);
@@ -578,6 +605,12 @@ const DrawerSessionRow = memo(function DrawerSessionRow({
accessibilityRole="button"
accessibilityState={{ selected: active }}
onPress={() => onSelect(item)}
+ delayLongPress={400}
+ onLongPress={
+ !item.automationGroup && conversationSearchAllowsLocalWrites(item)
+ ? () => onShowOptions(latestItem.session as RemoteSession)
+ : undefined
+ }
style={({ pressed }) => [styles.row, active && styles.rowActive, pressed && styles.pressed]}
testID={`sessionDrawer.row.${item.session.id}`}
>
@@ -585,6 +618,10 @@ const DrawerSessionRow = memo(function DrawerSessionRow({
<Text numberOfLines={1} style={styles.rowTitle}>
{item.title}
</Text>
+ <TaskTagDots
+ tags={item.session.tags}
+ surfaceColor={active ? colors.surfaceChip : colors.surface}
+ />
{rightStatus === 'time' ? (
<DrawerRelativeTime lastActivityAt={item.lastActivityAt} />
) : (
diff --git a/apps/mobile/src/session/SessionMenuSheet.tsx b/apps/mobile/src/session/SessionMenuSheet.tsx
index 7225b24d54..4a0c20e6e5 100644
--- a/apps/mobile/src/session/SessionMenuSheet.tsx
+++ b/apps/mobile/src/session/SessionMenuSheet.tsx
@@ -1,3 +1,5 @@
+import { TaskTagLabels, TaskTagsPanel } from './TaskTags';
+import { TaskTagsSheet, useTaskTagsSheet } from './TaskTagsSheet';
import type { OpenAiAccountProvider } from './sessionControls';
/**
* SessionMenuSheet —— 会话右上角「…」菜单浮窗(取代旧三 tab 的会话设置面板)。
@@ -98,6 +100,7 @@ export interface SessionExtraDirBrowserState {
}
export interface SessionMenuSheetProps {
+ tagDeviceId?: string;
providerName?: string;
messageOnly?: boolean;
onOpenSearch?: () => void;
@@ -140,6 +143,7 @@ export interface SessionMenuSheetProps {
}
export function SessionMenuSheet({
+ tagDeviceId,
providerName,
messageOnly = false,
onOpenSearch,
@@ -478,7 +482,7 @@ export function SessionMenuSheet({
const workspace = buildSessionInfoWorkspace(session);
const showExtraDirs = sessionInfoShowsExtraDirs(session);
- const mainActions = messageOnly ? [] : actions.filter((action) => action.id !== 'delete');
+ const mainActions = messageOnly ? [] : actions.filter((action) => action.id !== 'delete' && action.id !== 'archive');
const deleteAction = messageOnly ? undefined : actions.find((action) => action.id === 'delete');
const confirmCodexReset = useCallback(() => {
@@ -498,6 +502,7 @@ export function SessionMenuSheet({
);
}, [codexRateLimits, codexResetBusy, onResetCodexRateLimits, resetSummary, t]);
+ const tagsSheet = useTaskTagsSheet(visible, onClosed);
const menuContent = (
<View style={styles.menuBody} testID="session.menuSheetBody">
{renaming ? (
@@ -546,26 +551,38 @@ export function SessionMenuSheet({
</View>
) : (
<>
- <View style={styles.headerBlock} testID="session.menuHeader">
- <Text style={styles.detailTitle}>{header.title}</Text>
- {header.chips.length > 0 ? (
- <View style={styles.chipRow}>
- {header.chips.map((chip) => (
- <View key={chip.id} style={styles.chip} testID={`session.menuChip.${chip.id}`}>
- <Text style={styles.chipText}>{chip.label}</Text>
- </View>
- ))}
- </View>
- ) : null}
- <Text numberOfLines={1} style={styles.metaLine} testID="session.menuMetaLine">
- {header.metaLine}
- </Text>
- {readOnlyReason ? (
- <Text style={styles.readOnlyText} testID="session.menuReadOnlyNotice">
- {readOnlyReason}
- </Text>
- ) : null}
- </View>
+ {(header.chips.length > 0 ||
+ (!messageOnly && !!session.tags?.length) ||
+ !!readOnlyReason) && (
+ <View style={styles.headerBlock} testID="session.menuHeader">
+ {!messageOnly && !!session.tags?.length && (
+ <View
+ style={{
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ justifyContent: 'center',
+ alignItems: 'center',
+ gap: spacing.xs,
+ }}
+ >
+ <TaskTagLabels tags={session.tags} />
+ </View>
+ )}
+ {header.chips.length > 0 ? (
+ <View style={styles.chipRow}>
+ {header.chips.map((chip) => (
+ <View key={chip.id} style={styles.chip} testID={`session.menuChip.${chip.id}`}>
+ <Text style={styles.chipText}>{chip.label}</Text>
+ </View>
+ ))}
+ </View>
+ ) : null}
+ {readOnlyReason ? (
+ <Text style={styles.readOnlyText} testID="session.menuReadOnlyNotice">
+ {readOnlyReason}</Text>
+ ) : null}
+ </View>
+ )}
{!messageOnly ? <SessionUsageSummary providerName={providerName} session={session} usage={menuUsage} contextUsage={contextUsage} onPress={openInfo} translucent={Platform.OS === 'ios'} /> : null}
@@ -601,8 +618,49 @@ export function SessionMenuSheet({
</View>
) : null}
+ {!messageOnly && (
+ <TaskTagsPanel
+ key={`${tagDeviceId ?? session.deviceLinkDeviceId}:${session.id}`}
+ session={session}
+ deviceId={tagDeviceId}
+ disabled={busy || !!readOnlyReason}
+ expanded={false}
+ onExpandedChange={(open) => {
+ if (open) tagsSheet.open();
+ }}
+ />
+ )}
+ {!messageOnly &&
+ actions
+ .filter((action) => action.id === 'archive')
+ .map((action) =>
+ Platform.OS === 'ios' ? (
+ <SessionDetailsNativeActions
+ key={action.id}
+ actions={[
+ {
+ label: action.label,
+ disabled: action.disabled,
+ testID: action.testID,
+ onPress: () => handleAction(action),
+ },
+ ]}
+ />
+ ) : (
+ <View key={action.id} style={styles.actionGroup}>
+ <MenuActionRow
+ disabled={action.disabled}
+ icon={menuActionIcon(action, session)}
+ label={action.label}
+ onPress={() => handleAction(action)}
+ testID={action.testID}
+ />
+ </View>
+ ),
+ )}
{deleteAction ? Platform.OS === 'ios' ? (
- <SessionDetailsNativeActions actions={[{ label: deleteAction.label, testID: deleteAction.testID, disabled: deleteAction.disabled, danger: true, onPress: () => handleAction(deleteAction) }]} />
+ <SessionDetailsNativeActions
+ actions={[{ label: deleteAction.label, testID: deleteAction.testID, disabled: deleteAction.disabled, danger: true, onPress: () => handleAction(deleteAction) }]} />
) : (
<View style={styles.actionGroup}>
<MenuActionRow
@@ -818,32 +876,47 @@ export function SessionMenuSheet({
/>
) : undefined;
+ const tagEditor = tagsSheet.mounted ? (
+ <TaskTagsSheet
+ session={session}
+ deviceId={tagDeviceId}
+ disabled={busy || !!readOnlyReason}
+ visible={tagsSheet.visible}
+ onClose={tagsSheet.close}
+ onClosed={tagsSheet.closed}
+ />
+ ) : null;
if (Platform.OS === 'ios') {
const showingInfo = !messageOnly && view === 'info';
return (
- <SessionDetailsNative
- visible={visible}
- title={t(showingInfo ? 'session.menu.sessionInfo' : 'session.menu.details')}
- backLabel={t('session.menu.backToMenu')}
- onBack={showingInfo ? () => setView('menu') : undefined}
+ <>
+ <SessionDetailsNative
+ visible={tagsSheet.parentVisible}
+ title={showingInfo ? t('session.menu.sessionInfo') : header.title}
+ contentPaddingTop={showingInfo ? undefined : spacing.xs}
+ backLabel={t('session.menu.backToMenu')}
+ onBack={showingInfo ? () => setView('menu') : undefined}
onClose={onClose}
- onClosed={onClosed}
+ onClosed={tagsSheet.parentClosed}
footer={renameFooter}
>
{showingInfo ? infoContent : menuContent}
</SessionDetailsNative>
+ {tagEditor}
+ </>
);
}
return (
- <SheetModal
+ <>
+ <SheetModal
backdropTestID="session.settingsBackdrop"
keyboardAvoiding
keyboardAvoidingBehavior={keyboardAvoidingBehavior}
onBackdropPress={onClose}
- onClosed={onClosed}
+ onClosed={tagsSheet.parentClosed}
onRequestClose={handleRequestClose}
- visible={visible}
+ visible={tagsSheet.parentVisible}
>
<SheetSurface
bottomInset={insets.bottom}
@@ -854,7 +927,7 @@ export function SessionMenuSheet({
onSnapChange={setPrimarySnap}
snap={primarySnap}
testID="session.menuSheet"
- title={t('session.menu.details')}
+ title={header.title}
variant="tasksheet"
>
{menuContent}
@@ -887,6 +960,8 @@ export function SessionMenuSheet({
</Animated.View>
) : null}
</SheetModal>
+ {tagEditor}
+ </>
);
}
@@ -1015,74 +1090,78 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
},
headerBlock: {
alignSelf: 'stretch',
- gap: spacing.xs,
- paddingHorizontal: spacing.xs,
- },
- detailTitle: {
- color: colors.textPrimary,
- fontSize: typeScale.body,
- fontWeight: fontWeight.semibold,
- },
- chipRow: {
- alignSelf: 'stretch',
- justifyContent: 'flex-start',
- flexDirection: 'row',
- flexWrap: 'wrap',
- gap: spacing.xs,
- },
- chip: {
- backgroundColor: colors.surfaceChip,
- borderColor: colors.border,
- borderRadius: radius.pill,
- borderWidth: StyleSheet.hairlineWidth,
- paddingHorizontal: spacing.sm,
- paddingVertical: 2,
- },
- chipText: {
- color: colors.textSecondary,
- fontSize: typeScale.caption,
- fontWeight: fontWeight.medium,
- },
- metaLine: {
- color: colors.textSecondary,
- fontSize: typeScale.caption,
- lineHeight: lineHeight.caption,
- },
- readOnlyText: {
- color: colors.textTertiary,
- fontSize: typeScale.caption,
- lineHeight: lineHeight.caption,
- },
- actionGroup: {
- backgroundColor: colors.sheetActionSurface,
- borderColor: colors.sheetActionBorder,
- borderRadius: radius.container,
- borderWidth: StyleSheet.hairlineWidth,
- overflow: 'hidden',
- },
- actionRow: {
- alignItems: 'center',
- flexDirection: 'row',
- gap: spacing.md,
- minHeight: 45,
- paddingHorizontal: spacing.lg,
- },
- actionLabel: {
- color: colors.sheetActionText,
- flexShrink: 1,
- fontSize: typeScale.listBody,
- fontWeight: fontWeight.semibold,
- lineHeight: lineHeight.listBody,
- },
- actionLabelDanger: {
- color: colors.destructive,
- },
- actionTrailing: {
- marginLeft: 'auto',
- },
- renameBlock: {
gap: spacing.sm,
- paddingHorizontal: spacing.xs,
+ paddingHorizontal: spacing.xs,
+ paddingBottom: spacing.sm,
+ },
+ detailTitle: {
+ textAlign: 'center',
+ color: colors.textPrimary,
+ fontSize: typeScale.body,
+ fontWeight: fontWeight.semibold,
+ },
+ chipRow: {
+ alignSelf: 'stretch',
+ justifyContent: 'center',
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ gap: spacing.xs,
+ },
+ chip: {
+ backgroundColor: colors.surfaceChip,
+ borderColor: colors.border,
+ borderRadius: radius.pill,
+ borderWidth: StyleSheet.hairlineWidth,
+ paddingHorizontal: spacing.sm,
+ paddingVertical: 2,
+ },
+ chipText: {
+ color: colors.textSecondary,
+ fontSize: typeScale.caption,
+ fontWeight: fontWeight.medium,
+ },
+ metaLine: {
+ textAlign: 'center',
+ color: colors.textSecondary,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.caption,
+ },
+ readOnlyText: {
+ textAlign: 'center',
+ color: colors.textTertiary,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.caption,
+ },
+ actionGroup: {
+ backgroundColor: colors.sheetActionSurface,
+ borderColor: colors.sheetActionBorder,
+ borderRadius: radius.container,
+ borderWidth: StyleSheet.hairlineWidth,
+ overflow: 'hidden',
+ },
+ actionRow: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ gap: spacing.md,
+ minHeight: 45,
+ paddingHorizontal: spacing.lg,
+ },
+ actionLabel: {
+ color: colors.sheetActionText,
+ flexShrink: 1,
+ fontSize: typeScale.listBody,
+ fontWeight: fontWeight.semibold,
+ lineHeight: lineHeight.listBody,
+ },
+ actionLabelDanger: {
+ color: colors.destructive,
+ },
+ actionTrailing: {
+ marginLeft: 'auto',
+ },
+ renameBlock: {
+ gap: spacing.sm,
+ paddingHorizontal: spacing.xs,
},
renameInputWrap: {
justifyContent: 'center',
@@ -1094,77 +1173,77 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
borderWidth: StyleSheet.hairlineWidth,
color: colors.textPrimary,
fontSize: typeScale.body,
- minHeight: 44,
- paddingLeft: spacing.md,
- paddingRight: 44,
- },
- renameAiButton: {
- alignItems: 'center',
- bottom: 0,
- justifyContent: 'center',
- position: 'absolute',
- right: 0,
- top: 0,
- width: 44,
- },
- renameErrorText: {
- color: colors.errorText,
- fontSize: typeScale.caption,
- lineHeight: lineHeight.caption,
- },
- infoBody: {
- gap: spacing.md,
- paddingBottom: spacing.lg,
- },
- infoSection: {
- backgroundColor: colors.surfaceElevated,
- borderColor: colors.border,
- borderRadius: radius.container,
- borderWidth: StyleSheet.hairlineWidth,
- gap: spacing.sm,
- padding: spacing.md,
- },
- infoSectionHeader: {
- alignItems: 'center',
- flexDirection: 'row',
- justifyContent: 'space-between',
- },
- infoSectionTitle: {
- color: colors.textTertiary,
- fontSize: typeScale.footnote,
- fontWeight: fontWeight.medium,
- lineHeight: lineHeight.caption,
- },
- refreshButton: {
- alignItems: 'center',
+ minHeight: 44,
+ paddingLeft: spacing.md,
+ paddingRight: 44,
+ },
+ renameAiButton: {
+ alignItems: 'center',
+ bottom: 0,
+ justifyContent: 'center',
+ position: 'absolute',
+ right: 0,
+ top: 0,
+ width: 44,
+ },
+ renameErrorText: {
+ color: colors.errorText,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.caption,
+ },
+ infoBody: {
+ gap: spacing.md,
+ paddingBottom: spacing.lg,
+ },
+ infoSection: {
+ backgroundColor: colors.surfaceElevated,
+ borderColor: colors.border,
+ borderRadius: radius.container,
+ borderWidth: StyleSheet.hairlineWidth,
+ gap: spacing.sm,
+ padding: spacing.md,
+ },
+ infoSectionHeader: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ },
+ infoSectionTitle: {
+ color: colors.textTertiary,
+ fontSize: typeScale.footnote,
+ fontWeight: fontWeight.medium,
+ lineHeight: lineHeight.caption,
+ },
+ refreshButton: {
+ alignItems: 'center',
justifyContent: 'center',
- minHeight: 32,
- minWidth: 32,
- },
- infoRow: {
- gap: 2,
- },
- infoLabel: {
- color: colors.textTertiary,
- fontSize: typeScale.caption,
- fontWeight: fontWeight.medium,
- },
- infoValue: {
- color: colors.textPrimary,
- fontSize: typeScale.caption,
- lineHeight: lineHeight.caption,
- },
- infoValueMono: {
- color: colors.textSecondary,
- fontFamily: monoFont,
- },
- infoCaption: {
- color: colors.textSecondary,
- fontSize: typeScale.caption,
- lineHeight: lineHeight.caption,
- },
- infoActionRow: {
- flexDirection: 'row',
+ minHeight: 32,
+ minWidth: 32,
+ },
+ infoRow: {
+ gap: 2,
+ },
+ infoLabel: {
+ color: colors.textTertiary,
+ fontSize: typeScale.caption,
+ fontWeight: fontWeight.medium,
+ },
+ infoValue: {
+ color: colors.textPrimary,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.caption,
+ },
+ infoValueMono: {
+ color: colors.textSecondary,
+ fontFamily: monoFont,
+ },
+ infoCaption: {
+ color: colors.textSecondary,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.caption,
+ },
+ infoActionRow: {
+ flexDirection: 'row',
flexWrap: 'wrap',
gap: spacing.sm,
},
@@ -1193,57 +1272,57 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
backgroundColor: colors.surface,
borderColor: colors.border,
borderRadius: radius.container,
+ borderWidth: StyleSheet.hairlineWidth,
+ gap: spacing.sm,
+ padding: spacing.md,
+ },
+ browsePath: {
+ color: colors.textPrimary,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.caption,
+ },
+ browseList: {
+ gap: spacing.sm,
+ },
+ browseRow: {
+ alignItems: 'center',
+ borderColor: colors.border,
+ borderRadius: radius.container,
+ borderWidth: StyleSheet.hairlineWidth,
+ flexDirection: 'row',
+ gap: spacing.sm,
+ minHeight: 48,
+ padding: spacing.sm,
+ },
+ browseEntryButton: {
+ flex: 1,
+ minWidth: 0,
+ },
+ browseEntryName: {
+ color: colors.textPrimary,
+ fontSize: typeScale.caption,
+ fontWeight: fontWeight.medium,
+ },
+ browseEntryPath: {
+ color: colors.textTertiary,
+ fontSize: typeScale.micro,
+ marginTop: 2,
+ },
+ pillButton: {
+ alignItems: 'center',
+ borderColor: colors.borderStrong,
+ borderRadius: radius.pill,
borderWidth: StyleSheet.hairlineWidth,
- gap: spacing.sm,
- padding: spacing.md,
- },
- browsePath: {
- color: colors.textPrimary,
- fontSize: typeScale.caption,
- lineHeight: lineHeight.caption,
- },
- browseList: {
- gap: spacing.sm,
- },
- browseRow: {
- alignItems: 'center',
- borderColor: colors.border,
- borderRadius: radius.container,
- borderWidth: StyleSheet.hairlineWidth,
- flexDirection: 'row',
- gap: spacing.sm,
- minHeight: 48,
- padding: spacing.sm,
- },
- browseEntryButton: {
- flex: 1,
- minWidth: 0,
- },
- browseEntryName: {
- color: colors.textPrimary,
- fontSize: typeScale.caption,
- fontWeight: fontWeight.medium,
- },
- browseEntryPath: {
- color: colors.textTertiary,
- fontSize: typeScale.micro,
- marginTop: 2,
- },
- pillButton: {
- alignItems: 'center',
- borderColor: colors.borderStrong,
- borderRadius: radius.pill,
- borderWidth: StyleSheet.hairlineWidth,
- justifyContent: 'center',
- minHeight: 36,
- minWidth: 72,
- paddingHorizontal: spacing.md,
- },
- pillButtonPrimary: {
- backgroundColor: colors.cta,
- borderColor: colors.cta,
- },
- pillButtonText: {
+ justifyContent: 'center',
+ minHeight: 36,
+ minWidth: 72,
+ paddingHorizontal: spacing.md,
+ },
+ pillButtonPrimary: {
+ backgroundColor: colors.cta,
+ borderColor: colors.cta,
+ },
+ pillButtonText: {
color: colors.textPrimary,
fontSize: typeScale.caption,
fontWeight: fontWeight.medium,
diff --git a/apps/mobile/src/session/SessionOptionsExpoSheet.tsx b/apps/mobile/src/session/SessionOptionsExpoSheet.tsx
index 124d514042..0047068e6a 100644
--- a/apps/mobile/src/session/SessionOptionsExpoSheet.tsx
+++ b/apps/mobile/src/session/SessionOptionsExpoSheet.tsx
@@ -1,29 +1,32 @@
-/**
- * 左滑「选项」:iOS 用 Expo UI BottomSheet + List;Android 用 SessionActionSheet。
- *
- * iOS 直接用 `@expo/ui/swift-ui` 的 BottomSheet 而非通用 `@expo/ui` 封装:通用封装只把
- * onIsPresentedChange(false) 转成 onDismiss,而原生只在**用户**下拉 / 点背板时派发它;
- * 点菜单项后由 JS 把 isPresented 置 false 属于程序化关闭,不会回调。删除 / 重命名的
- * 后续弹窗都挂在 onClosed 上等 Sheet 卸载后再 present(useSessionListActions),没有
- * 回调就永远不弹。swift-ui 层的 onDismiss 对应 SwiftUI `.sheet(onDismiss:)`,两种关闭
- * 都在 Sheet 完全消失后触发,才是 onClosed 的正确挂点。
- */
-import { Column, Host, List, ListItem, Text } from "@expo/ui";
-import { BottomSheet, Group } from "@expo/ui/swift-ui";
+import { useEffect, useState } from 'react';
+import { Platform, View, useWindowDimensions } from 'react-native';
+import { useTranslation } from 'react-i18next';
+import { projectDraftSessionTitle } from '@cindy/maker-shared/session-title';
+import { SessionDetailsNativeHeading } from './SessionDetailsNative';
+import { Button, Group, HStack, Image, RNHostView, Text, ZStack } from '@expo/ui/swift-ui';
import {
+ accessibilityAddTraits,
+ accessibilityLabel,
+ buttonStyle,
+ contentShape,
+ disabled,
+ foregroundStyle,
+ onGeometryChange,
frame,
- padding,
- presentationDragIndicator,
-} from "@expo/ui/swift-ui/modifiers";
-import { Platform } from "react-native";
-import { SessionActionSheet } from "@/session/SessionActionSheet";
-import {
- buildSessionActionMenu,
- type SessionSwipeAction,
-} from "@/session/swipeRowRegistry";
-import { useTheme } from "@/theme";
+ listRowInsets,
+ shapes,
+} from '@expo/ui/swift-ui/modifiers';
+import { ComposerSheet } from './ComposerSheet';
+import { ComposerNativeSection as Section } from './ComposerNativeSection';
+import { ComposerNativeRow } from './ComposerNativeRow';
+import { TaskMenuHeading, TaskTagsPanel, type TaskTagsCompactState } from './TaskTags';
+import { SessionActionSheet } from './SessionActionSheet';
+import type { RemoteSession } from './types';
+import { buildSessionActionMenu, type SessionSwipeAction } from './swipeRowRegistry';
+import { useTheme, iconSize } from '@/theme';
type SessionOptionsProps = {
+ session?: RemoteSession | null;
onAction(action: SessionSwipeAction): void;
onClose(): void;
onClosed?(): void;
@@ -33,20 +36,82 @@ type SessionOptionsProps = {
};
export function SessionOptionsPresenter(props: SessionOptionsProps) {
- if (Platform.OS !== "ios") {
- return <SessionActionSheet {...props} />;
- }
- return <SessionOptionsExpoSheet {...props} />;
+ return Platform.OS === 'ios' ? (
+ <SessionOptionsExpoSheet {...props} />
+ ) : (
+ <SessionActionSheet {...props} />
+ );
}
-// 与通用 BottomSheet 封装相同的内容边距 / 顶对齐 / 把手,fitToContents 自适应菜单高度。
-const SHEET_CONTENT_MODIFIERS = [
- frame({ maxWidth: Infinity, alignment: "topLeading" }),
- padding({ top: 16, bottom: 0, leading: 16, trailing: 16 }),
- presentationDragIndicator("visible"),
-];
+export function NativeTagShortcuts({ state }: { state: TaskTagsCompactState }) {
+ const { t } = useTranslation();
+ const { colors } = useTheme();
+ const { width } = useWindowDimensions();
+ // Reserve room for management, without shrinking the 44pt tap targets.
+ const count = Math.max(1, Math.min(7, Math.floor((width - 80) / 44) - 1));
+ return (
+ <Section title={t('taskTags.title')}>
+ {state.tags.length > 0 || state.canManage ? (
+ <HStack
+ spacing={0}
+ modifiers={[listRowInsets({ leading: 8, trailing: 8, top: 4, bottom: 4 })]}
+ >
+ {state.tags.slice(0, count).map((tag) => (
+ <Button
+ key={tag.id}
+ onPress={() => state.onToggle(tag.id)}
+ modifiers={[
+ buttonStyle('plain'),
+ disabled(state.disabled),
+ accessibilityLabel(tag.name),
+ accessibilityAddTraits(tag.selected ? ['isSelected'] : []),
+ ]}
+ >
+ <ZStack
+ modifiers={[frame({ width: 44, height: 44 }), contentShape(shapes.rectangle())]}
+ >
+ <Image systemName="circle.fill" size={iconSize.action} color={tag.color} />
+ <Image systemName="circle" size={iconSize.action} color={colors.border} />
+ {tag.selected ? (
+ <Image systemName="checkmark" size={iconSize.xs} color={tag.checkColor} />
+ ) : null}
+ </ZStack>
+ </Button>
+ ))}
+ {state.canManage ? (
+ <Button
+ onPress={state.onManage}
+ modifiers={[
+ buttonStyle('plain'),
+ accessibilityLabel(t('taskTags.title')),
+ ]}
+ >
+ <ZStack
+ modifiers={[frame({ width: 44, height: 44 }), contentShape(shapes.rectangle())]}
+ >
+ <Image systemName="circle" size={iconSize.action} color={colors.border} />
+ <Image systemName="ellipsis" size={iconSize.xs} color={colors.textSecondary} />
+ </ZStack>
+ </Button>
+ ) : null}
+ </HStack>
+ ) : null}
+ {state.message ? (
+ <Text modifiers={[foregroundStyle(colors.textSecondary)]}>{state.message}</Text>
+ ) : null}
+ {state.canRetry ? (
+ <ComposerNativeRow
+ title={t('taskTags.retry')}
+ onPress={state.onRetry}
+ testID="home.sessionActions.tags.retry"
+ />
+ ) : null}
+ </Section>
+ );
+}
function SessionOptionsExpoSheet({
+ session,
onAction,
onClose,
onClosed,
@@ -55,52 +120,102 @@ function SessionOptionsExpoSheet({
visible,
}: SessionOptionsProps) {
const { colors } = useTheme();
+ const { t } = useTranslation();
+ const { width } = useWindowDimensions();
+ const [headingWidth, setHeadingWidth] = useState<number | null>(null);
+ const [tagsExpanded, setTagsExpanded] = useState(false);
+ useEffect(() => {
+ if (!visible) setTagsExpanded(false);
+ }, [visible]);
const menu = buildSessionActionMenu(pinnedAt, status);
- const regular = menu.filter((item) => item.destructive !== true);
- const destructive = menu.filter((item) => item.destructive === true);
+ const regular = menu.filter(
+ (item) => !item.destructive && item.action !== 'archive' && item.action !== 'restore',
+ );
+ const destructive = menu.filter(
+ (item) => item.destructive || item.action === 'archive' || item.action === 'restore',
+ );
return (
- <Host pointerEvents="none" style={{ position: "absolute" }}>
- <BottomSheet
- fitToContents
- isPresented={visible}
- onDismiss={() => {
- onClosed?.();
- }}
- onIsPresentedChange={(presented) => {
- if (!presented) onClose();
- }}
- testID="home.sessionActions"
- >
- <Group modifiers={SHEET_CONTENT_MODIFIERS}>
- <Column>
- <List>
- {regular.map((item) => (
- <ListItem
- key={item.action}
- onPress={() => onAction(item.action)}
- testID={`home.sessionActions.${item.action}`}
- >
- {item.label}
- </ListItem>
- ))}
- </List>
- <List>
- {destructive.map((item) => (
- <ListItem
- key={item.action}
- onPress={() => onAction(item.action)}
- testID={`home.sessionActions.${item.action}`}
- >
- <Text textStyle={{ color: colors.destructive }}>
- {item.label}
- </Text>
- </ListItem>
- ))}
- </List>
- </Column>
- </Group>
- </BottomSheet>
- </Host>
+ <ComposerSheet
+ visible={visible}
+ title=""
+ nativeHeader={
+ session ? (
+ <>
+ <SessionDetailsNativeHeading
+ title={projectDraftSessionTitle(session.title, t('session.menu.unnamedTitle'))}
+ backLabel={t('taskTags.back')}
+ />
+ <Group
+ modifiers={[
+ frame({ maxWidth: Infinity }),
+ onGeometryChange(({ width: measured }) => {
+ if (measured > 0) setHeadingWidth(measured);
+ }),
+ ]}
+ >
+ <RNHostView matchContents>
+ <View style={{ width: headingWidth ?? width }}>
+ <TaskMenuHeading session={session} showTitle={false} />
+ </View>
+ </RNHostView>
+ </Group>
+ </>
+ ) : undefined
+ }
+ onClose={onClose}
+ onClosed={onClosed}
+ nativeContent={!tagsExpanded}
+ testID="home.sessionActions"
+ >
+ {!tagsExpanded ? (
+ <Section>
+ {regular.map((item) => (
+ <ComposerNativeRow
+ key={item.action}
+ title={item.label}
+ onPress={() => onAction(item.action)}
+ testID={`home.sessionActions.${item.action}`}
+ />
+ ))}
+ </Section>
+ ) : null}
+ {visible && session ? (
+ <TaskTagsPanel
+ key={`${session.canonicalDeviceId ?? session.deviceLinkDeviceId}:${session.id}`}
+ session={session}
+ expanded={tagsExpanded}
+ onExpandedChange={setTagsExpanded}
+ renderCompact={(state) => <NativeTagShortcuts state={state} />}
+ />
+ ) : null}
+ {!tagsExpanded ? (
+ <Section>
+ {destructive.map((item) => (
+ <Button
+ key={item.action}
+ role={item.destructive ? 'destructive' : undefined}
+ onPress={() => onAction(item.action)}
+ testID={`home.sessionActions.${item.action}`}
+ modifiers={[buttonStyle('plain')]}
+ >
+ <Text
+ modifiers={[
+ foregroundStyle(item.destructive ? colors.destructive : colors.textPrimary),
+ frame({
+ maxWidth: Infinity,
+ minHeight: 44,
+ alignment: 'leading',
+ }),
+ contentShape(shapes.rectangle()),
+ ]}
+ >
+ {item.label}
+ </Text>
+ </Button>
+ ))}
+ </Section>
+ ) : null}
+ </ComposerSheet>
);
}
diff --git a/apps/mobile/src/session/TaskTags.tsx b/apps/mobile/src/session/TaskTags.tsx
new file mode 100644
index 0000000000..075e15d02f
--- /dev/null
+++ b/apps/mobile/src/session/TaskTags.tsx
@@ -0,0 +1,1482 @@
+import {
+ useEffect,
+ useLayoutEffect,
+ useState,
+ useRef,
+ useMemo,
+ useCallback,
+ type ReactNode,
+} from 'react';
+import {
+ Pressable,
+ useWindowDimensions,
+ ScrollView,
+ View,
+ type TextInput as NativeTextInput,
+} from 'react-native';
+import { Gesture, GestureDetector } from '@/platform/gestureHandler';
+import Animated, {
+ runOnJS,
+ useSharedValue,
+ useAnimatedStyle,
+ withTiming,
+ cancelAnimation,
+ ReduceMotion,
+ Easing,
+ type SharedValue,
+} from 'react-native-reanimated';
+import { GripVertical, Pencil, MoreHorizontal, ArrowLeft } from 'lucide-react-native';
+import { useTranslation } from 'react-i18next';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import {
+ TASK_TAG_COLORS,
+ taskTagNameKey,
+ taskTagErrorKey,
+ taskTagEditRevision,
+ normalizeTaskTags,
+ reconcileTaskTags,
+ type TaskTag,
+ type TaskTagColor,
+ type TaskTagRequest,
+ type TaskTagResult,
+} from '@cindy/maker-shared';
+import { Text, TextInput } from '@/components/AppText';
+import { useDeviceLink, subscribeRemoteTaskTagsChanged } from '@/device-link/DeviceLinkContext';
+import { useTheme, type ThemeColors } from '@/theme';
+import { radius, spacing, typeScale, iconSize, fontWeight, lineHeight, motionDuration, motionEasing } from '@/theme/tokens';
+import { remoteSessionStore, useRemoteSessions } from './remoteSessionStore';
+import { projectDraftSessionTitle } from '@cindy/maker-shared/session-title';
+import { useAuth } from '@/auth/AuthContext';
+import {
+ readTaskTagCatalog,
+ writeTaskTagCatalog,
+ taskTagCacheGeneration,
+ sameTaskTags,
+} from './taskTagCatalogCache';
+import type { RemoteSession } from './types';
+
+function colorFor(tag: TaskTag, colors: ThemeColors) {
+ const palette = {
+ red: colors.taskTagRed,
+ orange: colors.taskTagOrange,
+ yellow: colors.taskTagYellow,
+ green: colors.taskTagGreen,
+ blue: colors.taskTagBlue,
+ purple: colors.taskTagPurple,
+ gray: colors.taskTagGray,
+ none: colors.taskTagWhite,
+ pink: colors.taskTagPink,
+ coral: colors.taskTagCoral,
+ teal: colors.taskTagTeal,
+ indigo: colors.taskTagIndigo,
+ white: colors.taskTagWhite,
+ };
+ return palette[tag.color];
+}
+function tagName(tag: TaskTag, t: (key: string) => string) {
+ const key = taskTagNameKey(tag);
+ return key ? t(key) : tag.name;
+}
+export function TaskTagDots({
+ tags = [],
+ surfaceColor,
+ maxVisible,
+ onPress,
+}: {
+ tags?: TaskTag[];
+ surfaceColor?: string;
+ maxVisible?: number;
+ onPress?: () => void;
+}) {
+ const { colors } = useTheme();
+ const { t } = useTranslation();
+ if (!tags.length) return null;
+ const label = `${t('taskTags.title')}: ${tags.map((tag) => tagName(tag, t)).join(', ')}`;
+ const dots = (
+ <View
+ pointerEvents="none"
+ style={{
+ flexDirection: 'row',
+ paddingLeft: spacing.xs,
+ flexShrink: 0,
+ minHeight: 24,
+ alignItems: 'center',
+ }}
+ >
+ {tags.slice(0, maxVisible).map((tag) => (
+ <View
+ key={tag.id}
+ style={{
+ width: 10,
+ height: 10,
+ marginLeft: -4,
+ borderRadius: radius.pill,
+ borderWidth: 1,
+ borderColor:
+ tag.color === 'none' || tag.color === 'white'
+ ? colors.border
+ : (surfaceColor ?? colors.surface),
+ backgroundColor: colorFor(tag, colors),
+ }}
+ />
+ ))}
+ </View>
+ );
+ // List dots are display-only; touches and long presses belong to the task row.
+ // Header dots can explicitly open task details, without a separate popover.
+ return onPress ? (
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={label}
+ hitSlop={8}
+ style={{ flexShrink: 0 }}
+ onPress={(event) => {
+ event.stopPropagation();
+ onPress();
+ }}
+ >
+ {dots}
+ </Pressable>
+ ) : (
+ <View
+ accessible
+ accessibilityRole="text"
+ accessibilityLabel={label}
+ pointerEvents="none"
+ style={{ flexShrink: 0 }}
+ >
+ {dots}
+ </View>
+ );
+}
+/** Read-only labels beside the title; selection remains in the task menu. */
+export function TaskTagLabels({ tags = [] }: { tags?: TaskTag[] }) {
+ const { colors } = useTheme();
+ const { t } = useTranslation();
+ return (
+ <>
+ {tags.map((tag) => (
+ <View
+ key={tag.id}
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ gap: spacing.xs,
+ maxWidth: '100%',
+ paddingHorizontal: spacing.xs,
+ paddingVertical: 2,
+ borderRadius: radius.control,
+ backgroundColor: colors.surfaceChip,
+ }}
+ >
+ <View
+ style={{
+ width: 8,
+ height: 8,
+ flexShrink: 0,
+ borderRadius: radius.pill,
+ backgroundColor: colorFor(tag, colors),
+ borderWidth: 1,
+ borderColor: colors.border,
+ }}
+ />
+ <Text
+ style={{
+ color: colors.textPrimary,
+ fontSize: typeScale.caption,
+ flexShrink: 1,
+ }}
+ >
+ {tagName(tag, t)}
+ </Text>
+ </View>
+ ))}
+ </>
+ );
+}
+export function TaskMenuHeading({
+ session,
+ showTitle = true,
+}: {
+ session: RemoteSession;
+ showTitle?: boolean;
+}) {
+ const { colors } = useTheme();
+ const { t } = useTranslation();
+ const sessions = useRemoteSessions();
+ const current =
+ sessions.find(
+ (item) =>
+ item.id === session.id &&
+ (item.canonicalDeviceId ?? item.deviceLinkDeviceId) ===
+ (session.canonicalDeviceId ?? session.deviceLinkDeviceId),
+ ) ?? session;
+ return (
+ <View
+ style={{
+ paddingHorizontal: spacing.lg,
+ paddingTop: showTitle ? spacing.xxl : spacing.xs,
+ paddingBottom: spacing.xs,
+ gap: spacing.sm,
+ }}
+ >
+ {showTitle && (
+ <Text
+ accessibilityRole="header"
+ numberOfLines={2}
+ style={{
+ textAlign: 'center',
+ color: colors.textPrimary,
+ fontSize: typeScale.body,
+ fontWeight: fontWeight.semibold,
+ }}
+ >
+ {projectDraftSessionTitle(current.title, t('session.menu.unnamedTitle'))}
+ </Text>
+ )}
+ {!!current.tags?.length && (
+ <View
+ style={{
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ justifyContent: 'center',
+ alignItems: 'center',
+ gap: spacing.xs,
+ }}
+ >
+ <TaskTagLabels tags={current.tags} />
+ </View>
+ )}
+ </View>
+ );
+}
+
+export interface TaskTagsCompactState {
+ tags: {
+ id: string;
+ name: string;
+ color: string;
+ checkColor: string;
+ selected: boolean;
+ }[];
+ disabled: boolean;
+ message?: string;
+ canRetry: boolean;
+ canManage: boolean;
+ onToggle(id: string): void;
+ onManage(): void;
+ onRetry(): void;
+}
+
+export function TaskTagsPanel({
+ session,
+ deviceId,
+ disabled = false,
+ expanded,
+ onExpandedChange,
+ renderCompact,
+ showDone = true,
+}: {
+ session: RemoteSession;
+ deviceId?: string;
+ disabled?: boolean;
+ expanded: boolean;
+ onExpandedChange: (value: boolean) => void;
+ renderCompact?: (state: TaskTagsCompactState) => ReactNode;
+ showDone?: boolean;
+}) {
+ const { colors } = useTheme();
+ const { t } = useTranslation();
+ const link = useDeviceLink();
+ const { user } = useAuth();
+ const owner = user?.id;
+ const target =
+ deviceId ??
+ session.canonicalDeviceId ??
+ session.deviceLinkDeviceId ??
+ remoteSessionStore.getSessionDeviceId(session.id);
+ const recovering = Boolean(target && link.recoveringDeviceIds.has(target));
+ const blocked =
+ recovering ||
+ disabled ||
+ !target ||
+ link.status !== 'online' ||
+ link.getPresenceAvailability(target) !== true;
+ const cached = readTaskTagCatalog(owner, target);
+ const [tags, setTags] = useState<TaskTag[]>(() => cached?.tags ?? []);
+ const [hasCatalog, setHasCatalog] = useState(Boolean(cached));
+ const [selected, setSelected] = useState(session.tags ?? []);
+ const [busy, setBusy] = useState(!cached && !blocked);
+ const [error, setError] = useState('');
+ const [previewTagId, setPreviewTagId] = useState<string | null>(null);
+ const previewTag = tags.find((tag) => tag.id === previewTagId);
+ const [draggedId, setDraggedId] = useState<string | null>(null);
+ const motion = useSharedValue({ from: -1, count: 0 });
+ const dragY = useSharedValue(0);
+ const dragScroll = useSharedValue(0);
+ const { height: windowHeight } = useWindowDimensions();
+ const insets = useSafeAreaInsets();
+ const [viewportHeight, setViewportHeight] = useState(0);
+ const [contentHeight, setContentHeight] = useState(0);
+ const [scrollY, setScrollY] = useState(0);
+ const listMaxHeight = Math.min(
+ 528,
+ Math.max(132, windowHeight - insets.top - insets.bottom - 240),
+ );
+ const listRef = useRef<ScrollView>(null);
+ const nameInput = useRef<NativeTextInput>(null);
+ const viewportRef = useRef<View>(null);
+ const scrollOffset = useRef(0);
+ const drag = useRef<{
+ id: string;
+ from: number;
+ to: number;
+ expectedOrder: string[];
+ startScroll: number;
+ translation: number;
+ absoluteY: number;
+ top: number;
+ height: number;
+ } | null>(null);
+ const dragFrame = useRef<number | null>(null);
+ function cancelDrag() {
+ if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);
+ dragFrame.current = null;
+ drag.current = null;
+ setDraggedId(null);
+ cancelAnimation(dragY);
+ motion.value = { from: -1, count: 0 };
+ dragY.value = 0;
+ dragScroll.value = 0;
+ }
+ useLayoutEffect(() => {
+ cancelDrag();
+ return () => {
+ if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);
+ drag.current = null;
+ cancelAnimation(dragY);
+ };
+ }, [tags, target, expanded, blocked]);
+ useEffect(() => {
+ scrollOffset.current = 0;
+ setScrollY(0);
+ listRef.current?.scrollTo({ y: 0, animated: false });
+ }, [expanded, target]);
+ const [editing, setEditing] = useState<TaskTag | null>(null);
+ const [name, setName] = useState('');
+ const editName = useRef('');
+ const [color, setColor] = useState<TaskTagColor>('blue');
+ const [pendingAttach, setPendingAttach] = useState<string | null>(null);
+ const [formOpen, setFormOpen] = useState(false);
+ const [supportedColors, setSupportedColors] = useState<readonly TaskTagColor[]>(
+ cached?.supportedColors ?? TASK_TAG_COLORS.slice(0, 7),
+ );
+ const [deletion, setDeletion] = useState<TaskTagResult['deletion']>();
+ const requestGeneration = useRef(0);
+ const catalogGeneration = useRef(0);
+ const latestCatalog = useRef<TaskTag[]>(tags);
+ const selectionGeneration = useRef(0);
+ const selectedSnapshot = useRef(JSON.stringify(session.tags ?? []));
+ const alive = useRef(true);
+ useEffect(() => {
+ alive.current = true;
+ return () => {
+ alive.current = false;
+ };
+ }, []);
+ useEffect(
+ () =>
+ subscribeRemoteTaskTagsChanged((source, value) => {
+ if (source !== target && source !== session.deviceLinkDeviceId) return;
+ catalogGeneration.current++;
+ const catalog = normalizeTaskTags(value, 256);
+ latestCatalog.current = catalog;
+ if (target) writeTaskTagCatalog(owner, target, catalog);
+ setHasCatalog(true);
+ setTags((current) => (sameTaskTags(current, catalog) ? current : catalog));
+ setSelected((current) => reconcileTaskTags(current, catalog));
+ }),
+ [owner, target, session.deviceLinkDeviceId],
+ );
+ async function run(request: TaskTagRequest, background = false) {
+ if (blocked || !target) {
+ setError('offline');
+ return null;
+ }
+ const generation = ++requestGeneration.current;
+ const catalogAtStart = catalogGeneration.current;
+ const selectionAtStart = selectionGeneration.current;
+ const cacheAtStart = taskTagCacheGeneration(target);
+ const isCurrent = () =>
+ alive.current &&
+ generation === requestGeneration.current &&
+ cacheAtStart === taskTagCacheGeneration(target);
+ if (!background) setBusy(true);
+ setError('');
+ try {
+ const r = await link.invoke<TaskTagResult>(target, 'local-db:task-tags:execute', [request], {
+ preSend: () => {
+ if (link.status !== 'online' || link.getPresenceAvailability(target) !== true)
+ throw new Error('OFFLINE');
+ },
+ });
+ if (!isCurrent()) return null;
+ if (catalogAtStart === catalogGeneration.current) {
+ latestCatalog.current = r.tags;
+ writeTaskTagCatalog(
+ owner,
+ target,
+ r.tags,
+ r.supportedColors ?? TASK_TAG_COLORS.slice(0, 7),
+ );
+ setHasCatalog(true);
+ setTags((current) => (sameTaskTags(current, r.tags) ? current : r.tags));
+ }
+ setSupportedColors(r.supportedColors ?? TASK_TAG_COLORS.slice(0, 7));
+ const row = r.sessions.find((s) => s.sessionId === session.id);
+ if (row && selectionAtStart === selectionGeneration.current) {
+ const next =
+ catalogAtStart === catalogGeneration.current
+ ? row.tags
+ : reconcileTaskTags(row.tags, latestCatalog.current);
+ setSelected((current) => (sameTaskTags(current, next) ? current : next));
+ }
+ return r;
+ } catch (e) {
+ if (!isCurrent()) return null;
+ setError(taskTagErrorKey(e, request.action));
+ return null;
+ } finally {
+ if (alive.current && generation === requestGeneration.current) setBusy(false);
+ }
+ }
+ useEffect(() => {
+ const snapshot = readTaskTagCatalog(owner, target);
+ setHasCatalog(Boolean(snapshot));
+ setTags((current) =>
+ sameTaskTags(current, snapshot?.tags ?? []) ? current : (snapshot?.tags ?? []),
+ );
+ latestCatalog.current = snapshot?.tags ?? [];
+ setSupportedColors(snapshot?.supportedColors ?? TASK_TAG_COLORS.slice(0, 7));
+ if (!blocked) void run({ action: 'get', sessionIds: [session.id] }, Boolean(snapshot));
+ else setBusy(false);
+ return () => {
+ requestGeneration.current++;
+ };
+ }, [owner, session.id, target, blocked, link.connectionEpoch]);
+ useEffect(() => {
+ const sync = () => {
+ const row = remoteSessionStore
+ .getSessions()
+ .find(
+ (candidate) =>
+ candidate.id === session.id &&
+ ((candidate.canonicalDeviceId ??
+ candidate.deviceLinkDeviceId ??
+ remoteSessionStore.getSessionDeviceId(candidate.id)) === target ||
+ candidate.deviceLinkDeviceId === target),
+ );
+ if (row) {
+ const snapshot = JSON.stringify(row.tags ?? []);
+ if (snapshot !== selectedSnapshot.current) {
+ selectedSnapshot.current = snapshot;
+ selectionGeneration.current++;
+ setSelected(row.tags ?? []);
+ }
+ }
+ };
+ sync();
+ return remoteSessionStore.subscribe(sync);
+ }, [session.id, target]);
+ useEffect(() => {
+ const snapshot = JSON.stringify(session.tags ?? []);
+ if (snapshot !== selectedSnapshot.current) {
+ selectedSnapshot.current = snapshot;
+ selectionGeneration.current++;
+ setSelected(session.tags ?? []);
+ }
+ }, [session.tags]);
+ function closeEditor() {
+ setPendingAttach(null);
+ setFormOpen(false);
+ setEditing(null);
+ setDeletion(undefined);
+ }
+ useEffect(() => {
+ if (!expanded) closeEditor();
+ }, [expanded]);
+ function edit(tag: TaskTag | null) {
+ cancelDrag();
+ setFormOpen(true);
+ setEditing(tag);
+ editName.current = tag ? tagName(tag, t) : '';
+ setName(editName.current);
+ setColor(tag?.color === 'none' ? 'white' : (tag?.color ?? 'blue'));
+ setDeletion(undefined);
+ requestAnimationFrame(() => {
+ listRef.current?.scrollTo({ y: 0, animated: false });
+ nameInput.current?.focus();
+ });
+ }
+ async function reorder(id: string, to: number, expectedOrder = tags.map((tag) => tag.id)) {
+ const from = expectedOrder.indexOf(id);
+ if (from < 0 || to < 0 || to >= expectedOrder.length || from === to) return;
+ const tagIds = [...expectedOrder];
+ tagIds.splice(from, 1);
+ tagIds.splice(to, 0, id);
+ const before = tags;
+ const catalogAtStart = catalogGeneration.current;
+ setTags(tagIds.map((tagId) => before.find((tag) => tag.id === tagId)!));
+ const result = await run({ action: 'reorder', tagIds, expectedOrder });
+ if (!result && alive.current && catalogAtStart === catalogGeneration.current) setTags(before);
+ if (result && editing) setEditing(result.tags.find((tag) => tag.id === editing.id) ?? null);
+ }
+ function trackDrag() {
+ const active = drag.current;
+ if (!active) return;
+ const direction =
+ active.height > 0
+ ? active.absoluteY < active.top + 40
+ ? -1
+ : active.absoluteY > active.top + active.height - 40
+ ? 1
+ : 0
+ : 0;
+ if (direction) {
+ const next = Math.max(
+ 0,
+ Math.min(
+ active.expectedOrder.length * 44 - active.height,
+ scrollOffset.current + direction * 6,
+ ),
+ );
+ scrollOffset.current = next;
+ dragScroll.value = next - active.startScroll;
+ listRef.current?.scrollTo({ y: next, animated: false });
+ }
+ const to = Math.max(
+ 0,
+ Math.min(
+ active.expectedOrder.length - 1,
+ active.from +
+ Math.round((active.translation + scrollOffset.current - active.startScroll) / 44),
+ ),
+ );
+ if (to !== active.to) {
+ active.to = to;
+ }
+ dragFrame.current = requestAnimationFrame(trackDrag);
+ }
+ function startDrag(tagId: string, absoluteY: number) {
+ if (busy || blocked) return;
+ const expectedOrder = tags.map((tag) => tag.id);
+ const from = expectedOrder.indexOf(tagId);
+ drag.current = {
+ id: tagId,
+ from,
+ to: from,
+ expectedOrder,
+ startScroll: scrollOffset.current,
+ translation: 0,
+ absoluteY,
+ top: 0,
+ height: 0,
+ };
+ setDraggedId(tagId);
+ motion.value = { from, count: expectedOrder.length };
+ dragY.value = 0;
+ dragScroll.value = 0;
+ viewportRef.current?.measureInWindow((_x, y, _width, height) => {
+ if (drag.current) {
+ drag.current.top = y;
+ drag.current.height = height;
+ }
+ });
+ dragFrame.current = requestAnimationFrame(trackDrag);
+ }
+ function moveDrag(translation: number, absoluteY: number) {
+ if (drag.current) {
+ drag.current.translation = translation;
+ drag.current.absoluteY = absoluteY;
+ }
+ }
+ function finishDrag(success: boolean) {
+ const active = drag.current;
+ if (active)
+ active.to = Math.max(
+ 0,
+ Math.min(
+ active.expectedOrder.length - 1,
+ active.from +
+ Math.round((active.translation + scrollOffset.current - active.startScroll) / 44),
+ ),
+ );
+ if (!active || !success) {
+ cancelDrag();
+ return;
+ }
+ if (dragFrame.current !== null) cancelAnimationFrame(dragFrame.current);
+ dragFrame.current = null;
+ // Snap visually before committing the reordered array, so release never jumps back.
+ dragY.value = withTiming(
+ (active.to - active.from) * 44 - dragScroll.value,
+ { duration: motionDuration.fast, easing: Easing.bezier(...motionEasing.move), reduceMotion: ReduceMotion.System },
+ (finished) => {
+ if (finished) runOnJS(commitDrop)(active.id, active.to, active.expectedOrder);
+ },
+ );
+ }
+ function commitDrop(id: string, to: number, expectedOrder: string[]) {
+ if (drag.current?.id !== id || blocked) {
+ cancelDrag();
+ return;
+ }
+ if (expectedOrder.indexOf(id) === to) {
+ cancelDrag();
+ return;
+ }
+ void reorder(id, to, expectedOrder);
+ }
+ const textStyle = { color: colors.textPrimary, fontSize: typeScale.body };
+ const action = (
+ label: string,
+ onPress: () => void,
+ inactive = false,
+ primary = false,
+ tone: 'default' | 'secondary' | 'danger' = 'default',
+ local = false,
+ ) => (
+ <Pressable
+ accessibilityRole="button"
+ disabled={busy || (!local && blocked) || inactive}
+ onPress={onPress}
+ style={({ pressed }) => ({
+ minHeight: 44,
+ borderRadius: radius.pill,
+ borderWidth: tone === 'default' ? 0 : 1,
+ borderColor: tone === 'danger' ? colors.destructive : colors.border,
+ backgroundColor: primary ? colors.cta : undefined,
+ justifyContent: 'center',
+ paddingHorizontal: spacing.md,
+ opacity: busy || (!local && blocked) || inactive ? 0.4 : pressed ? 0.75 : 1,
+ })}
+ >
+ <Text
+ style={[
+ textStyle,
+ primary
+ ? { color: colors.ctaText }
+ : tone === 'danger'
+ ? { color: colors.destructive }
+ : {},
+ ]}
+ >
+ {label}
+ </Text>
+ </Pressable>
+ );
+ const toggle = (tag: TaskTag) =>
+ void run({
+ action: selected.some((s) => s.id === tag.id) ? 'detach' : 'attach',
+ sessionIds: [session.id],
+ tagIds: [tag.id],
+ });
+ const canManage = !busy && error !== 'unavailable' && (!blocked || hasCatalog);
+ // The native shortcut row shares transport, cache and mutations with the editor.
+ if (!expanded && renderCompact) {
+ const reason = blocked ? 'offline' : error || (!hasCatalog && busy ? 'loading' : '');
+ return renderCompact({
+ tags:
+ error === 'unavailable'
+ ? []
+ : tags.map((tag) => ({
+ id: tag.id,
+ name: tagName(tag, t),
+ color: colorFor(tag, colors),
+ checkColor:
+ tag.color === 'white' || tag.color === 'none'
+ ? colors.taskTagWhiteCheck
+ : colors.taskTagWhite,
+ selected: selected.some((item) => item.id === tag.id),
+ })),
+ disabled: busy || blocked,
+ message: reason ? t(`taskTags.${reason}`) : undefined,
+ canRetry: !blocked && !busy && Boolean(error) && error !== 'unavailable',
+ canManage,
+ onToggle: (id) => {
+ const tag = tags.find((item) => item.id === id);
+ if (tag && !busy && !blocked) toggle(tag);
+ },
+ onManage: () => onExpandedChange(true),
+ onRetry: () => {
+ void run({ action: 'get', sessionIds: [session.id] }, hasCatalog);
+ },
+ });
+ }
+ if (!formOpen && (error === 'unavailable' || (!hasCatalog && (error || blocked || busy)))) {
+ const reason = blocked ? 'offline' : error || 'loading';
+ return (
+ <View style={{ width: '100%', paddingVertical: spacing.md, gap: spacing.xs }}>
+ <Text style={{ color: colors.textPrimary, fontSize: typeScale.body }}>
+ {t('taskTags.title')}
+ </Text>
+ <Text
+ accessibilityRole={reason === 'loadFailed' ? 'alert' : 'text'}
+ style={{
+ color: colors.textSecondary,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.listBody,
+ }}
+ >
+ {t(`taskTags.${reason}`)}
+ </Text>
+ {!blocked && reason !== 'unavailable' && reason !== 'loading' && (
+ <Pressable
+ disabled={busy}
+ accessibilityRole="button"
+ onPress={() => {
+ void run({ action: 'get', sessionIds: [session.id] });
+ }}
+ style={{
+ minHeight: 44,
+ justifyContent: 'center',
+ alignSelf: 'flex-start',
+ }}
+ >
+ <Text style={{ color: colors.textPrimary, fontSize: typeScale.body }}>
+ {t('taskTags.retry')}
+ </Text>
+ </Pressable>
+ )}
+ {expanded && showDone && (
+ <Pressable
+ accessibilityRole="button"
+ onPress={() => onExpandedChange(false)}
+ style={{
+ minHeight: 44,
+ justifyContent: 'center',
+ alignSelf: 'flex-end',
+ }}
+ >
+ <Text style={{ color: colors.textPrimary, fontSize: typeScale.body }}>
+ {t('taskTags.done')}
+ </Text>
+ </Pressable>
+ )}
+ </View>
+ );
+ }
+ return (
+ <View
+ style={{
+ width: '100%',
+ paddingVertical: spacing.sm,
+ borderTopWidth: 1,
+ borderBottomWidth: 1,
+ borderColor: colors.border,
+ }}
+ >
+ <View
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ gap: spacing.sm,
+ minHeight: expanded ? 44 : 24,
+ marginBottom: expanded ? spacing.sm : 0,
+ }}
+ >
+ {formOpen && !deletion && (
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={t('taskTags.back')}
+ onPress={closeEditor}
+ disabled={busy}
+ style={{
+ width: 44,
+ height: 44,
+ alignItems: 'center',
+ justifyContent: 'center',
+ borderRadius: radius.pill,
+ }}
+ >
+ <ArrowLeft size={iconSize.action} color={colors.textPrimary} />
+ </Pressable>
+ )}
+ <Text
+ style={{
+ flex: 1,
+ color: expanded ? colors.textPrimary : colors.textSecondary,
+ fontSize: expanded ? typeScale.body : typeScale.caption,
+ fontWeight: expanded ? fontWeight.semibold : fontWeight.regular,
+ }}
+ >
+ {deletion
+ ? t('taskTags.delete')
+ : previewTag && !expanded
+ ? t(
+ selected.some((tag) => tag.id === previewTag.id)
+ ? 'taskTags.removeLabel'
+ : 'taskTags.addLabel',
+ { name: tagName(previewTag, t) },
+ )
+ : t(formOpen ? (editing ? 'taskTags.editTitle' : 'taskTags.add') : 'taskTags.title')}
+ </Text>
+ {expanded && !formOpen && (
+ <Text style={{ color: colors.textSecondary, fontSize: typeScale.caption }}>
+ {t('taskTags.selectedCount', { count: selected.length })}
+ </Text>
+ )}
+ </View>
+ {!expanded ? (
+ <ScrollView
+ horizontal
+ showsHorizontalScrollIndicator={false}
+ contentContainerStyle={{
+ flexGrow: 1,
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ }}
+ >
+ {tags.slice(0, 7).map((tag) => (
+ <Pressable
+ key={tag.id}
+ accessibilityRole="button"
+ accessibilityLabel={tagName(tag, t)}
+ accessibilityState={{
+ selected: selected.some((s) => s.id === tag.id),
+ disabled: busy || blocked,
+ }}
+ disabled={busy || blocked}
+ onPressIn={() => setPreviewTagId(tag.id)}
+ onLongPress={() => setPreviewTagId(tag.id)}
+ onPress={() => toggle(tag)}
+ style={{
+ minHeight: 44,
+ minWidth: 44,
+ flex: 1,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ <View
+ style={{
+ padding: spacing.xs,
+ borderWidth: 0,
+ borderRadius: radius.pill,
+ }}
+ >
+ <View
+ style={{
+ width: 20,
+ height: 20,
+ borderRadius: radius.pill,
+ borderWidth: 1,
+ borderColor: colors.border,
+ backgroundColor: colorFor(tag, colors),
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ {selected.some((s) => s.id === tag.id) && (
+ <Text
+ style={{
+ color:
+ tag.color === 'white' || tag.color === 'none'
+ ? colors.taskTagWhiteCheck
+ : colors.taskTagWhite,
+ }}
+ >
+ ✓
+ </Text>
+ )}
+ </View>
+ </View>
+ </Pressable>
+ ))}
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={t('taskTags.more')}
+ disabled={!canManage}
+ onPress={() => onExpandedChange(true)}
+ style={{
+ minHeight: 44,
+ minWidth: 44,
+ flex: 1,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ <View
+ style={{
+ width: 20,
+ height: 20,
+ borderRadius: radius.pill,
+ borderWidth: 1,
+ borderColor: colors.border,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ <MoreHorizontal size={iconSize.xs} color={colors.textSecondary} />
+ </View>
+ </Pressable>
+ </ScrollView>
+ ) : (
+ <View ref={viewportRef} collapsable={false}>
+ <ScrollView
+ ref={listRef}
+ scrollEnabled={!draggedId}
+ scrollEventThrottle={16}
+ onScroll={(event) => {
+ scrollOffset.current = event.nativeEvent.contentOffset.y;
+ setScrollY(event.nativeEvent.contentOffset.y);
+ }}
+ onLayout={(event) => setViewportHeight(event.nativeEvent.layout.height)}
+ onContentSizeChange={(_width, height) => setContentHeight(height)}
+ showsVerticalScrollIndicator={false}
+ contentContainerStyle={{ paddingRight: 12 }}
+ style={{ maxHeight: listMaxHeight }}
+ keyboardShouldPersistTaps="handled"
+ >
+ {!formOpen && !tags.length && !error && !blocked && (
+ <Text
+ accessibilityRole="text"
+ style={{
+ color: colors.textSecondary,
+ textAlign: 'center',
+ paddingVertical: spacing.xl,
+ fontSize: typeScale.body,
+ }}
+ >
+ {t(busy ? 'taskTags.loading' : 'taskTags.empty')}
+ </Text>
+ )}
+ {!formOpen &&
+ tags.map((tag, index) => (
+ <TagSortRow
+ key={tag.id}
+ index={index}
+ motion={motion}
+ dragY={dragY}
+ dragScroll={dragScroll}
+ >
+ <TagDragHandle
+ label={t('taskTags.reorderLabel', {
+ name: tagName(tag, t),
+ })}
+ hint={t('taskTags.reorderHint')}
+ disabled={busy || blocked}
+ dragY={dragY}
+ onStart={(y) => startDrag(tag.id, y)}
+ onMove={moveDrag}
+ onEnd={finishDrag}
+ onStep={(delta) => {
+ void reorder(tag.id, index + delta);
+ }}
+ />
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={tagName(tag, t)}
+ accessibilityState={{
+ selected: selected.some((item) => item.id === tag.id),
+ }}
+ disabled={busy || blocked}
+ onPress={() => toggle(tag)}
+ style={{
+ width: 44,
+ height: 44,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ <View
+ style={{
+ width: 20,
+ height: 20,
+ borderRadius: radius.pill,
+ borderWidth: 0.5,
+ borderColor: colors.border,
+ backgroundColor: colorFor(tag, colors),
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ {selected.some((item) => item.id === tag.id) && (
+ <Text
+ style={{
+ color:
+ tag.color === 'white' || tag.color === 'none'
+ ? colors.taskTagWhiteCheck
+ : colors.taskTagWhite,
+ }}
+ >
+ ✓
+ </Text>
+ )}
+ </View>
+ </Pressable>
+ <Pressable
+ accessibilityRole="button"
+ disabled={busy || blocked}
+ onPress={() => toggle(tag)}
+ style={{ flex: 1, height: 44, justifyContent: 'center' }}
+ >
+ <Text numberOfLines={1} style={textStyle}>
+ {tagName(tag, t)}
+ </Text>
+ </Pressable>
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={t('taskTags.editLabel', {
+ name: tagName(tag, t),
+ })}
+ disabled={busy || blocked}
+ onPress={() => edit(tag)}
+ style={{
+ width: 44,
+ height: 44,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ <Pencil size={iconSize.md} color={colors.textSecondary} />
+ </Pressable>
+ </TagSortRow>
+ ))}
+ {formOpen && !deletion && (
+ <View style={{ gap: spacing.md, paddingBottom: spacing.sm }}>
+ <Text style={textStyle}>{t('taskTags.name')}</Text>
+ <TextInput
+ ref={nameInput}
+ accessibilityLabel={t('taskTags.name')}
+ editable={!busy && !blocked && !pendingAttach}
+ value={name}
+ onChangeText={setName}
+ maxLength={80}
+ style={[
+ textStyle,
+ {
+ minHeight: 44,
+ borderWidth: 1,
+ borderColor: colors.border,
+ borderRadius: radius.control,
+ paddingHorizontal: spacing.md,
+ backgroundColor: colors.surface,
+ },
+ ]}
+ />
+ <Text style={textStyle}>{t('taskTags.color')}</Text>
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
+ {TASK_TAG_COLORS.map((c) => (
+ <Pressable
+ key={c}
+ accessibilityRole="button"
+ accessibilityLabel={t(`taskTags.${c}`)}
+ accessibilityState={{ selected: color === c }}
+ disabled={
+ busy || blocked || Boolean(pendingAttach) || !supportedColors.includes(c)
+ }
+ onPress={() => setColor(c)}
+ style={{
+ width: '16.666667%',
+ minHeight: 44,
+ alignItems: 'center',
+ justifyContent: 'center',
+ opacity: supportedColors.includes(c) ? 1 : 0.3,
+ borderColor: colors.textSecondary,
+ borderRadius: radius.pill,
+ }}
+ >
+ <View
+ style={{
+ width: 24,
+ height: 24,
+ alignItems: 'center',
+ justifyContent: 'center',
+ borderWidth: 0.5,
+ borderColor: colors.border,
+ borderRadius: radius.pill,
+ backgroundColor: colorFor({ color: c } as TaskTag, colors),
+ }}
+ >
+ {color === c && (
+ <Text
+ style={{
+ color: c === 'white' ? colors.taskTagWhiteCheck : colors.taskTagWhite,
+ }}
+ >
+ ✓
+ </Text>
+ )}
+ </View>
+ </Pressable>
+ ))}
+ </View>
+ <Text
+ style={{
+ color: colors.textSecondary,
+ fontSize: typeScale.caption,
+ }}
+ >
+ {t(
+ supportedColors.length < TASK_TAG_COLORS.length
+ ? 'taskTags.unavailable'
+ : editing
+ ? 'taskTags.editHint'
+ : 'taskTags.addHint',
+ )}
+ </Text>
+ <View
+ style={{
+ flexDirection: 'row-reverse',
+ flexWrap: 'wrap',
+ justifyContent: 'flex-start',
+ alignItems: 'center',
+ gap: spacing.sm,
+ paddingTop: spacing.sm,
+ }}
+ >
+ {action(
+ t(editing ? 'taskTags.save' : 'taskTags.create'),
+ () => {
+ void (async () => {
+ if (pendingAttach) {
+ const attached = await run({
+ action: 'attach',
+ sessionIds: [session.id],
+ tagIds: [pendingAttach],
+ });
+ if (attached) closeEditor();
+ return;
+ }
+ const r = await run(
+ editing
+ ? {
+ action: 'update',
+ tagId: editing.id,
+ revision: taskTagEditRevision(editing, latestCatalog.current),
+ name: name === editName.current ? undefined : name,
+ nameCustomized:
+ name === editName.current ? undefined : true,
+ color:
+ editing.color === 'none' &&
+ color === 'white' &&
+ !supportedColors.includes('white')
+ ? undefined
+ : color,
+ }
+ : { action: 'create', name, color },
+ );
+ if (r) {
+ const created = !editing
+ ? r.tags.find((tag) => tag.name === name.trim())
+ : r.tags.find((tag) => tag.id === pendingAttach);
+ if (created) {
+ setEditing(created);
+ setPendingAttach(created.id);
+ const attached = await run({
+ action: 'attach',
+ sessionIds: [session.id],
+ tagIds: [created.id],
+ });
+ if (!attached) return;
+ }
+ closeEditor();
+ }
+ })();
+ },
+ !name.trim() ||
+ (!supportedColors.includes(color) &&
+ !(editing?.color === 'none' && color === 'white')),
+ true,
+ )}
+ {action(t('taskTags.cancel'), closeEditor, false, false, 'secondary', true)}
+ {editing && (
+ <View style={{ flexDirection: 'row', marginRight: 'auto' }}>
+ {action(t('taskTags.delete'), () => {
+ void run({
+ action: 'previewDelete',
+ tagId: editing.id,
+ }).then((r) => {
+ if (r) setDeletion(r.deletion);
+ });
+ })}
+ </View>
+ )}
+ </View>
+ </View>
+ )}
+ {deletion && (
+ <View style={{ gap: spacing.xl, paddingVertical: spacing.sm }}>
+ <Text
+ style={[
+ textStyle,
+ {
+ color: colors.textSecondary,
+ lineHeight: lineHeight.bodyRelaxed,
+ },
+ ]}
+ >
+ {t('taskTags.deleteConfirm', {
+ name: editing ? tagName(editing, t) : '',
+ count: deletion.count,
+ })}
+ </Text>
+ <View
+ style={{
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ justifyContent: 'flex-end',
+ gap: spacing.sm,
+ }}
+ >
+ {action(
+ t('taskTags.cancel'),
+ () => setDeletion(undefined),
+ false,
+ false,
+ 'secondary',
+ true,
+ )}
+ {action(
+ t('taskTags.delete'),
+ () => {
+ void run({
+ action: 'delete',
+ tagId: deletion.tagId,
+ revision: deletion.revision,
+ expectedCount: deletion.count,
+ }).then((r) => {
+ if (r) closeEditor();
+ });
+ },
+ false,
+ false,
+ 'danger',
+ )}
+ </View>
+ </View>
+ )}
+ </ScrollView>
+ {contentHeight > viewportHeight + 1 && viewportHeight > 0 && (
+ <View
+ pointerEvents="none"
+ style={{
+ position: 'absolute',
+ right: 2,
+ top: 0,
+ bottom: 0,
+ width: 4,
+ }}
+ >
+ <View
+ style={{
+ width: 4,
+ borderRadius: radius.pill,
+ backgroundColor: colors.textSecondary,
+ height: Math.max(24, (viewportHeight * viewportHeight) / contentHeight),
+ transform: [
+ {
+ translateY:
+ Math.max(0, Math.min(1, scrollY / (contentHeight - viewportHeight))) *
+ (viewportHeight -
+ Math.max(24, (viewportHeight * viewportHeight) / contentHeight)),
+ },
+ ],
+ }}
+ />
+ </View>
+ )}
+ </View>
+ )}
+ {expanded && !formOpen && (
+ <View
+ style={{
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ borderTopWidth: 1,
+ borderColor: colors.border,
+ paddingTop: spacing.xs,
+ }}
+ >
+ {action(t('taskTags.add'), () => edit(null))}
+ {showDone && (
+ <Pressable
+ accessibilityRole="button"
+ disabled={busy}
+ onPress={() => {
+ onExpandedChange(false);
+ closeEditor();
+ }}
+ style={{
+ minHeight: 44,
+ justifyContent: 'center',
+ paddingHorizontal: spacing.sm,
+ borderRadius: radius.pill,
+ backgroundColor: colors.cta,
+ opacity: busy ? 0.4 : 1,
+ }}
+ >
+ <Text style={[textStyle, { color: colors.ctaText }]}>{t('taskTags.done')}</Text>
+ </Pressable>
+ )}
+ </View>
+ )}
+ {(error || blocked) && (
+ <Text
+ accessibilityRole="alert"
+ style={{
+ color: colors.textSecondary,
+ fontSize: typeScale.caption,
+ lineHeight: lineHeight.listBody,
+ paddingVertical: spacing.xs,
+ marginTop: spacing.sm,
+ }}
+ >
+ {t(`taskTags.${blocked ? 'offline' : error}`)}
+ </Text>
+ )}
+ {!blocked && error === 'loadFailed' && (
+ <Pressable
+ accessibilityRole="button"
+ disabled={busy}
+ onPress={() => void run({ action: 'get', sessionIds: [session.id] }, hasCatalog)}
+ style={{
+ minHeight: 44,
+ justifyContent: 'center',
+ alignSelf: 'flex-start',
+ }}
+ >
+ <Text style={{ color: colors.textPrimary, fontSize: typeScale.body }}>
+ {t('taskTags.retry')}
+ </Text>
+ </Pressable>
+ )}
+ </View>
+ );
+}
+
+function TagDragHandle(props: {
+ dragY: SharedValue<number>;
+ label: string;
+ hint: string;
+ disabled: boolean;
+ onStart: (absoluteY: number) => void;
+ onMove: (translationY: number, absoluteY: number) => void;
+ onEnd: (success: boolean) => void;
+ onStep: (delta: number) => void;
+}) {
+ const { colors } = useTheme();
+ const latest = useRef(props);
+ latest.current = props;
+ const start = useCallback((y: number) => latest.current.onStart(y), []);
+ const move = useCallback(
+ (translation: number, y: number) => latest.current.onMove(translation, y),
+ [],
+ );
+ const finish = useCallback((success: boolean) => latest.current.onEnd(success), []);
+ const dragY = props.dragY;
+ const gesture = useMemo(
+ () =>
+ Gesture.Pan()
+ .enabled(!props.disabled)
+ .activateAfterLongPress(380)
+ .onStart((event) => {
+ runOnJS(start)(event.absoluteY);
+ })
+ .onUpdate((event) => {
+ dragY.value = event.translationY;
+ runOnJS(move)(event.translationY, event.absoluteY);
+ })
+ .onFinalize((event, success) => {
+ runOnJS(move)(event.translationY, event.absoluteY);
+ runOnJS(finish)(success);
+ }),
+ [props.disabled, dragY, start, move, finish],
+ );
+ return (
+ <GestureDetector gesture={gesture}>
+ <View
+ accessible
+ accessibilityRole="adjustable"
+ accessibilityLabel={props.label}
+ accessibilityHint={props.hint}
+ accessibilityState={{ disabled: props.disabled }}
+ accessibilityActions={[{ name: 'increment' }, { name: 'decrement' }]}
+ onAccessibilityAction={(event) => {
+ if (!props.disabled) props.onStep(event.nativeEvent.actionName === 'increment' ? 1 : -1);
+ }}
+ style={{
+ width: 44,
+ height: 44,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ <GripVertical size={iconSize.md} color={colors.textSecondary} />
+ </View>
+ </GestureDetector>
+ );
+}
+
+function TagSortRow({
+ index,
+ motion,
+ dragY,
+ dragScroll,
+ children,
+}: {
+ index: number;
+ motion: SharedValue<{ from: number; count: number }>;
+ dragY: SharedValue<number>;
+ dragScroll: SharedValue<number>;
+ children: React.ReactNode;
+}) {
+ const { colors } = useTheme();
+ const animatedStyle = useAnimatedStyle(() => {
+ const { from, count } = motion.value;
+ if (from < 0)
+ return {
+ transform: [{ translateY: 0 }],
+ zIndex: 0,
+ backgroundColor: 'transparent',
+ };
+ const offset = Math.max(
+ -from * 44,
+ Math.min((count - from - 1) * 44, dragY.value + dragScroll.value),
+ );
+ const to = from + Math.round(offset / 44);
+ const shift = from < index && index <= to ? -44 : to <= index && index < from ? 44 : 0;
+ return {
+ transform: [
+ {
+ translateY:
+ index === from
+ ? offset
+ : withTiming(shift, {
+ duration: motionDuration.fast,
+ easing: Easing.bezier(...motionEasing.move),
+ reduceMotion: ReduceMotion.System,
+ }),
+ },
+ ],
+ zIndex: index === from ? 1 : 0,
+ backgroundColor: index === from ? colors.surface : 'transparent',
+ };
+ });
+ return (
+ <Animated.View
+ style={[
+ {
+ height: 44,
+ flexDirection: 'row',
+ alignItems: 'center',
+ borderRadius: radius.pill,
+ },
+ animatedStyle,
+ ]}
+ >
+ {children}
+ </Animated.View>
+ );
+}
diff --git a/apps/mobile/src/session/TaskTagsSheet.tsx b/apps/mobile/src/session/TaskTagsSheet.tsx
new file mode 100644
index 0000000000..ef63bc46f7
--- /dev/null
+++ b/apps/mobile/src/session/TaskTagsSheet.tsx
@@ -0,0 +1,96 @@
+import { useEffect, useState } from 'react';
+import { Platform, View } from 'react-native';
+import { useTranslation } from 'react-i18next';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { useTheme, radius, spacing } from '@/theme';
+import { TaskTagsPanel } from './TaskTags';
+import { SessionDetailsNative } from './SessionDetailsNative';
+import { SheetModal } from './SheetModal';
+import type { RemoteSession } from './types';
+
+// Present only after the previous sheet has fully dismissed. In particular, do
+// not forward the parent's onClosed while temporarily handing off to tags.
+export function useTaskTagsSheet(visible: boolean, onClosed?: () => void) {
+ const [phase, setPhase] = useState<'idle' | 'opening' | 'open' | 'closing'>('idle');
+ useEffect(() => {
+ if (!visible) setPhase('idle');
+ }, [visible]);
+ return {
+ parentVisible: visible && phase === 'idle',
+ mounted: phase === 'open' || phase === 'closing',
+ visible: visible && phase === 'open',
+ open: () => setPhase('opening'),
+ close: () => setPhase('closing'),
+ parentClosed: () => {
+ if (visible && phase === 'opening') setPhase('open');
+ else onClosed?.();
+ },
+ closed: () => setPhase('idle'),
+ };
+}
+
+export function TaskTagsSheet({
+ session,
+ deviceId,
+ disabled,
+ visible,
+ onClose,
+ onClosed,
+}: {
+ session: RemoteSession;
+ deviceId?: string;
+ disabled?: boolean;
+ visible: boolean;
+ onClose(): void;
+ onClosed(): void;
+}) {
+ const { t } = useTranslation();
+ const { colors } = useTheme();
+ const insets = useSafeAreaInsets();
+ const panel = (
+ <TaskTagsPanel
+ key={`${deviceId ?? session.canonicalDeviceId ?? session.deviceLinkDeviceId}:${session.id}`}
+ session={session}
+ deviceId={deviceId}
+ disabled={disabled}
+ expanded
+ showDone={false}
+ onExpandedChange={() => {}}
+ />
+ );
+ if (Platform.OS === 'ios') {
+ return (
+ <SessionDetailsNative
+ visible={visible}
+ title={t('taskTags.title')}
+ backLabel={t('taskTags.back')}
+ onClose={onClose}
+ onClosed={onClosed}
+ >
+ {panel}
+ </SessionDetailsNative>
+ );
+ }
+ return (
+ <SheetModal
+ visible={visible}
+ onRequestClose={onClose}
+ onBackdropPress={onClose}
+ onClosed={onClosed}
+ keyboardAvoiding
+ >
+ <View
+ style={{
+ backgroundColor: colors.surface,
+ borderTopLeftRadius: radius.container,
+ borderTopRightRadius: radius.container,
+ padding: spacing.lg,
+ paddingBottom: spacing.lg + insets.bottom,
+ maxHeight: '90%',
+ }}
+ >
+ {panel}
+ </View>
+ </SheetModal>
+ );
+}
diff --git a/apps/mobile/src/session/mobileHomeListCache.ts b/apps/mobile/src/session/mobileHomeListCache.ts
index d3a11a3aa5..f1899bf148 100644
--- a/apps/mobile/src/session/mobileHomeListCache.ts
+++ b/apps/mobile/src/session/mobileHomeListCache.ts
@@ -1,3 +1,4 @@
+import { normalizeTaskTags } from '@cindy/maker-shared';
import AsyncStorage from '@react-native-async-storage/async-storage';
import type { RemoteSession } from '@/session/types';
@@ -198,6 +199,7 @@ function coerceCachedSession(item: unknown): RemoteSession | null {
if (orcaRole === 'worker') return null;
const session: RemoteSession = {
+ ...(Array.isArray(item.tags) ? { tags: normalizeTaskTags(item.tags) } : {}),
id,
userId: typeof item.userId === 'string' ? item.userId : '',
title: truncateText(typeof item.title === 'string' ? item.title : ''),
diff --git a/apps/mobile/src/session/remoteSessionStore.ts b/apps/mobile/src/session/remoteSessionStore.ts
index 4c36ae7a06..a870bb62c6 100644
--- a/apps/mobile/src/session/remoteSessionStore.ts
+++ b/apps/mobile/src/session/remoteSessionStore.ts
@@ -1,3 +1,4 @@
+import { normalizeTaskTags, reconcileTaskTags } from '@cindy/maker-shared';
import {
createContext,
createElement,
@@ -2174,12 +2175,10 @@ function reanchorPendingLiveAssistantRows(
messageIdentityMatches(message, row.message)
)));
if (groupedRows.length === 0) continue;
- const withoutPending = next.filter((message) => !group.pendingRows.some((row) => (
- messageIdentityMatches(message, row.message)
- )));
- const anchorIndex = withoutPending.findIndex((message) => (
- messageIdentityMatches(message, group.afterMessage)
+ const withoutPending = next.filter((message) => !group.pendingRows.some((row) => messageIdentityMatches(message, row.message)
));
+ const anchorIndex = withoutPending.findIndex((message) =>
+ messageIdentityMatches(message, group.afterMessage));
if (anchorIndex < 0) continue;
next = [
...withoutPending.slice(0, anchorIndex + 1),
@@ -4255,6 +4254,18 @@ export const remoteSessionStore = {
applySessionModelPrefPush(payload);
return;
}
+ if (channel === 'local-db:task-tags:changed' && isRecord(payload)) {
+ bumpDeviceSessionListMutationEpoch(deviceId);
+ const shard = shards.get(deviceId);
+ if (!shard) return;
+ const catalog = normalizeTaskTags(payload.tags, 256);
+ shard.sessions = shard.sessions.map((session) => ({
+ ...session,
+ tags: reconcileTaskTags(session.tags, catalog),
+ }));
+ recomputeSessions();
+ return;
+ }
if (channel === 'local-db:sessions:patched' && isRecord(payload)) {
const sessionId = readString(payload, 'sessionId');
const patch = isRecord(payload.patch) ? payload.patch : null;
diff --git a/apps/mobile/src/session/taskTagCatalogCache.ts b/apps/mobile/src/session/taskTagCatalogCache.ts
new file mode 100644
index 0000000000..7334f1340c
--- /dev/null
+++ b/apps/mobile/src/session/taskTagCatalogCache.ts
@@ -0,0 +1,72 @@
+import { normalizeTaskTags, type TaskTag, type TaskTagColor } from '@cindy/maker-shared';
+
+// Account/device scoped last-known directories survive panel and page unmounts.
+// A disconnect retains display data; revocation and account changes clear it.
+type Catalog = { tags: TaskTag[]; supportedColors?: readonly TaskTagColor[] };
+const catalogs = new Map<string, Catalog>();
+// Account resets invalidate every request; peer eviction affects only that peer.
+let generation = 0;
+const deviceGenerations = new Map<string, number>();
+const keyFor = (owner: string, device: string) => JSON.stringify([owner, device]);
+
+export function taskTagCacheGeneration(device: string) {
+ return `${generation}:${deviceGenerations.get(device) ?? 0}`;
+}
+
+export function readTaskTagCatalog(
+ owner: string | null | undefined,
+ device: string | null | undefined,
+) {
+ return owner && device ? catalogs.get(keyFor(owner, device)) : undefined;
+}
+
+export function sameTaskTags(a: readonly TaskTag[], b: readonly TaskTag[]) {
+ return (
+ a.length === b.length &&
+ a.every((tag, i) => {
+ const other = b[i];
+ return (
+ tag.id === other.id &&
+ tag.name === other.name &&
+ !!tag.nameCustomized === !!other.nameCustomized &&
+ tag.color === other.color &&
+ tag.revision === other.revision &&
+ tag.sortOrder === other.sortOrder &&
+ tag.favoriteOrder === other.favoriteOrder
+ );
+ })
+ );
+}
+
+export function writeTaskTagCatalog(
+ owner: string | null | undefined,
+ device: string,
+ tags: unknown,
+ supportedColors?: readonly TaskTagColor[],
+) {
+ if (!owner) return;
+ const key = keyFor(owner, device);
+ const previous = catalogs.get(key);
+ const normalized = normalizeTaskTags(tags, 256);
+ const entry: Catalog = {
+ tags: previous && sameTaskTags(previous.tags, normalized) ? previous.tags : normalized,
+ supportedColors: supportedColors ?? previous?.supportedColors,
+ };
+ catalogs.delete(key);
+ catalogs.set(key, entry);
+ if (catalogs.size > 32) catalogs.delete(catalogs.keys().next().value!);
+ return entry;
+}
+
+export function evictTaskTagCatalog(device: string) {
+ deviceGenerations.set(device, (deviceGenerations.get(device) ?? 0) + 1);
+ for (const key of catalogs.keys()) {
+ if (JSON.parse(key)[1] === device) catalogs.delete(key);
+ }
+}
+
+export function resetTaskTagCatalogCache() {
+ generation++;
+ deviceGenerations.clear();
+ catalogs.clear();
+}
diff --git a/apps/mobile/src/session/types.ts b/apps/mobile/src/session/types.ts
index c7cf2aff83..132df5a02e 100644
--- a/apps/mobile/src/session/types.ts
+++ b/apps/mobile/src/session/types.ts
@@ -23,6 +23,7 @@ export type RemoteMessageRole =
| 'agent_switch';
export interface RemoteSession {
+ tags?: import('@cindy/maker-shared').TaskTag[];
id: string;
userId: string;
title: string;
@@ -120,7 +121,8 @@ export interface RemoteMessage {
/** Large settled tool input released from the transcript mirror and recoverable by message id. */
mobileToolInputProjection?: MobileToolInputProjection;
systemCardData?: Record<string, unknown>;
- systemCardType?: 'help' | 'context' | 'cost' | 'pwd' | 'status' | 'compact' | 'cmd' | 'goal-complete' | 'goal-resumed' | 'context-rebuild' | 'auto-resume' | 'learn' | 'agent-switch';
+ systemCardType?:
+ | 'help' | 'context' | 'cost' | 'pwd' | 'status' | 'compact' | 'cmd' | 'goal-complete' | 'goal-resumed' | 'context-rebuild' | 'auto-resume' | 'learn' | 'agent-switch';
}
export type RemoteAttachmentCategory = 'image' | 'pdf' | 'text' | 'office';
diff --git a/apps/mobile/src/theme/tokens.ts b/apps/mobile/src/theme/tokens.ts
index ab331b93ce..3ffcb4d4d0 100644
--- a/apps/mobile/src/theme/tokens.ts
+++ b/apps/mobile/src/theme/tokens.ts
@@ -16,6 +16,20 @@ export type ThemeMode = 'light' | 'dark';
/** 随主题切换的颜色 token。light / dark 必须有完全一致的 key 集合。 */
export interface ThemeColors {
+ taskTagRed: string;
+ taskTagOrange: string;
+ taskTagYellow: string;
+ taskTagGreen: string;
+ taskTagBlue: string;
+ taskTagPurple: string;
+ taskTagGray: string;
+ taskTagPink: string;
+ taskTagCoral: string;
+ taskTagTeal: string;
+ taskTagIndigo: string;
+ taskTagWhite: string;
+ taskTagWhiteCheck: string;
+
/** 页面 Surface 背景 */
surface: string;
/** 抬一层的 Card / 弹窗 / 输入框 */
@@ -370,6 +384,20 @@ export const loginPalettes: Record<ThemeMode, LoginSkinColors> = {
*/
export const lightColors: ThemeColors = {
surface: '#EDEDED',
+ taskTagRed: '#ed615f',
+ taskTagOrange: '#eea34e',
+ taskTagYellow: '#e5c744',
+ taskTagGreen: '#70b568',
+ taskTagBlue: '#609bd4',
+ taskTagPurple: '#ab7bc6',
+ taskTagGray: '#969696',
+ taskTagPink: '#df83b0',
+ taskTagCoral: '#de8970',
+ taskTagTeal: '#53a89d',
+ taskTagIndigo: '#7c83cf',
+ taskTagWhite: '#ffffff',
+ taskTagWhiteCheck: '#525252',
+
surfaceElevated: '#F8F8F8',
surfaceTranslucent: 'rgba(237, 237, 237, 0.78)',
surfaceTranslucentSidebar: 'rgba(246, 246, 246, 0.90)',
@@ -443,6 +471,19 @@ export const lightColors: ThemeColors = {
*/
export const darkColors: ThemeColors = {
surface: '#2A2828',
+ taskTagRed: '#ed615f',
+ taskTagOrange: '#eea34e',
+ taskTagYellow: '#e5c744',
+ taskTagGreen: '#70b568',
+ taskTagBlue: '#609bd4',
+ taskTagPurple: '#ab7bc6',
+ taskTagGray: '#969696',
+ taskTagPink: '#e79fc1',
+ taskTagCoral: '#e6a08c',
+ taskTagTeal: '#75bfb4',
+ taskTagIndigo: '#999fdf',
+ taskTagWhite: '#ffffff',
+ taskTagWhiteCheck: '#525252',
surfaceElevated: '#312F2F',
surfaceTranslucent: 'rgba(42, 40, 40, 0.78)',
surfaceTranslucentSidebar: 'rgba(18, 15, 15, 0.85)',
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 61c06d29a4..2c6084b273 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -62,6 +62,10 @@ The interface is built from a three-tier layer system that applies symmetrically
> **Important — element-level vs. page-level:** The "flat Surface" rule in full-window layouts applies only to the **overall page structure**, not to individual widgets. Lifted widgets _within_ a full-window layout — inputs, chat input boxes, raised cards, modal overlays, panel popups — still use **Card** color per their component rules (see Section 4). A full-window chat interface can have a flat Surface page _and_ a Card-colored chat input box at the same time; those are two different scopes. "Surface flat" means "don't split the page into Page+Card layers," not "every element on the page must be Surface color."
+### Task tag identity colors
+
+用户确认的任务标签色板为红、橙、黄、绿、蓝、紫、灰、粉、珊瑚、青、靛蓝、白共十二色。只用于标签色球与编辑色板,表示用户分类,不表示任务运行状态。色球为圆形、细描边,选中时勾位于球内;白色在 Light/Dark 中均保持白色,用独立深色勾保证对比度。Desktop 使用 `task-tag-*` 语义 token;Mobile 使用对应 `taskTag*` 色板字段。默认面板只显示选择列表,添加或编辑后才显示名称和两行六列色板,不显示双击编辑提示。
+
### Chip & Button Neutrals
Small interactive chips (button backgrounds, tag pills, avatar fills, selected-nav pills) sit outside the layer system — they're foreground elements, not background layers.
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index 90a8e34319..e5add01d55 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -51,20 +51,20 @@
| `desktop.window.sidebar` | desktop | 右侧栏独立窗口 | `?sidebarWindow=1` → renderer/sidebar-window-entry.tsx;hash `/sidebar-window` | RightSidebar, RightSidebarShell, SidebarWindowLayout | apps/desktop/src/main/right-sidebar-window/controller.ts, apps/desktop/src/main/right-sidebar-window/ipc.ts, apps/desktop/src/main/right-sidebar-window/registry.ts, apps/desktop/src/main/right-sidebar-window/resolveHostContext.ts, apps/desktop/src/main/right-sidebar-window/settings-store.ts, apps/desktop/src/main/right-sidebar-window/window.ts, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openRoutinesTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/CindyMakeTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/routines/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/sidebar-window-entry.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 106 | 45 | 196 |
| `desktop.window.voice-dictionary-toast` | desktop | 语音词典 Toast 窗 | `?view=voice-input-dictionary-toast` → main-entry.tsx → VoiceInputDictionaryToast | VoiceInputDictionaryToast | apps/desktop/src/renderer/voice-input/VoiceInputDictionaryToast.tsx | 6 | 0 | 2 |
| `desktop.window.voice-overlay` | desktop | 语音输入浮窗 | `?view=voice-input-overlay` → main-entry.tsx → VoiceInputOverlay | VoiceInputOverlay, VoiceInputStatusNotice | apps/desktop/src/main/voice-input/global.ts, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css, apps/desktop/src/renderer/voice-input/VoiceInputOverlay.tsx, apps/desktop/src/renderer/voice-input/VoiceInputStatusNotice.tsx | 71 | 38 | 25 |
-| `mobile.account-deletion` | mobile | 账号注销 | app/account-deletion.tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, _layout, account-deletion, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/account-deletion.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 55 |
-| `mobile.auth` | mobile | 登录与添加账号 | app/(auth)/login.tsx / app/add-account.tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, IncomingShareBridge, LoginCaptchaWebView, LoginSkinControls, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, _layout, add-account, gestureHandler, login, peerFileTransport, useLocale | apps/mobile/app/(auth)/login.tsx, apps/mobile/app/_layout.tsx, apps/mobile/app/add-account.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/LoginCaptchaWebView.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/LoginSkinControls.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 177 | 76 |
-| `mobile.automations` | mobile | 自动化 | app/automations/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/automations/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 71 |
-| `mobile.chat.new` | mobile | 新建任务 | app/sessions/new.tsx | AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerAttachmentTray, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, ImageLightbox, IncomingShareBridge, MobileAgentMark, MobileAgentSwitcher, MobileChoicePickerList, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, NewTaskSelectionSheet, NewTaskSelectionSheet.ios, PaperPlaneIcon, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, _layout, gestureHandler, new, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/new.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileChoicePickerList.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx, apps/mobile/src/session/NewTaskSelectionSheet.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 202 | 110 |
-| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionMessageCard, ComposerAttachmentTray, ComposerExpandButton, ComposerExpandButton.ios, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeInput, ComposerNativeInput.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerRichInput, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, ConversationSearchFilterSheet, ConversationShareSvg, ConversationShareWebView, DeviceLinkContext, FailedScheduleNotice, HomeEntryProvider, HomeGlassMenuPanel, HomeNativeStackHeader, HomeSearchBar, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RewindPreviewPanel, SentInlineAtomBody, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionResourceCards, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerExpandButton.ios.tsx, apps/mobile/src/session/ComposerExpandButton.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeInput.ios.tsx, apps/mobile/src/session/ComposerNativeInput.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerRichInput.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/ConversationShareSvg.tsx, apps/mobile/src/session/ConversationShareWebView.tsx, apps/mobile/src/session/FailedScheduleNotice.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/InlineQueueSection.tsx, apps/mobile/src/session/InlineQuoteChip.tsx, apps/mobile/src/session/InlineReferenceChip.tsx, apps/mobile/src/session/InteractionPanel.tsx, apps/mobile/src/session/MarkdownBlockContent.tsx, apps/mobile/src/session/MessageActionSheet.tsx, apps/mobile/src/session/MessageRenderer.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/PromptRecommendation.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RewindPreviewPanel.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionListDrawer.tsx, apps/mobile/src/session/SessionMenuSheet.tsx, apps/mobile/src/session/SessionResourceCards.tsx, apps/mobile/src/session/SessionSearchNative.ios.tsx, apps/mobile/src/session/SessionSearchNative.tsx, apps/mobile/src/session/SessionTailBanner.tsx, apps/mobile/src/session/SessionUsageSummary.tsx, apps/mobile/src/session/ShareImageNativeButton.ios.tsx, apps/mobile/src/session/ShareImageNativeButton.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/ShareSelectAllButton.tsx, apps/mobile/src/session/ShareSelectionBar.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 203 | 233 |
-| `mobile.companions.direct` | mobile | 伙伴私聊回看 | app/companions/direct/[threadId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [threadId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/companions/direct/[threadId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 50 |
-| `mobile.device-management` | mobile | 设备管理 | app/devices/manage.tsx / app/devices/manage/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceInformationFields, DeviceInformationFields.ios, DeviceLinkContext, DeviceManagementDialogs, DeviceManagementList, DeviceManagementList.ios, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RenameDeviceModal, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, manage, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/manage.tsx, apps/mobile/app/devices/manage/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceInformationFields.ios.tsx, apps/mobile/src/device-link/DeviceInformationFields.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/DeviceManagementDialogs.tsx, apps/mobile/src/device-link/DeviceManagementList.ios.tsx, apps/mobile/src/device-link/DeviceManagementList.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/RenameDeviceModal.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 53 |
-| `mobile.devices` | mobile | 主机详情 | app/devices/[deviceId].tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeNativeStackHeader, HomeProjectMachineLabel, HomeSearchBar, IncomingShareBridge, MobileAgentMark, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, MobileVendorIcon, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteAccessGuide, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, SessionActionSheet, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, ThemeProvider, [deviceId], _layout, gestureHandler, index, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/[deviceId].tsx, apps/mobile/app/devices/index.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 96 |
-| `mobile.files` | mobile | 任务文件与预览 | app/files/[sessionId].tsx / app/files/preview/[sessionId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HtmlBrowserChrome, HtmlBrowserChrome.ios, HtmlFileReader, HtmlWebsiteBrowser, ImageLightbox, IncomingShareBridge, MarkdownFileReader, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, [sessionId], _layout, gestureHandler, mediaPlayerWebView, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/files/[sessionId].tsx, apps/mobile/app/files/preview/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HtmlBrowserChrome.ios.tsx, apps/mobile/src/session/HtmlBrowserChrome.tsx, apps/mobile/src/session/HtmlFileReader.tsx, apps/mobile/src/session/HtmlWebsiteBrowser.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MarkdownFileReader.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 202 | 77 |
-| `mobile.home` | mobile | 主机与资源首页 | app/index.tsx / app/devices/index.tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeNativeStackHeader, HomeProjectMachineLabel, HomeSearchBar, IncomingShareBridge, MobileAgentMark, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, MobileVendorIcon, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteAccessGuide, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, SessionActionSheet, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, ThemeProvider, _layout, gestureHandler, index, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/index.tsx, apps/mobile/app/index.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 92 |
-| `mobile.overlay.connection-startup` | mobile | 根布局挂载的启动与连接反馈 | app/_layout.tsx → StartupSplashOverlay / ConnectionNoticeProvider;各页面 ConnectionBanner | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ConnectionNoticeProvider, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 48 |
-| `mobile.remote-desktop` | mobile | 远程桌面 | app/devices/desktop/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/desktop/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 48 |
-| `mobile.resources` | mobile | 远程资源列表与详情 | app/resources/[collectionId].tsx / app/resources/[collectionId]/[resourceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteCompanionAvatar, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [collectionId], [resourceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/resources/[collectionId].tsx, apps/mobile/app/resources/[collectionId]/[resourceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteCompanionAvatar.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 54 |
-| `mobile.settings` | mobile | 设置(含调试与日志上传可见入口) | app/settings.tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileChoicePickerList, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, settings, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/settings.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileChoicePickerList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 56 |
+| `mobile.account-deletion` | mobile | 账号注销 | app/account-deletion.tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, _layout, account-deletion, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/account-deletion.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 55 |
+| `mobile.auth` | mobile | 登录与添加账号 | app/(auth)/login.tsx / app/add-account.tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, IncomingShareBridge, LoginCaptchaWebView, LoginSkinControls, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, _layout, add-account, gestureHandler, login, peerFileTransport, useLocale | apps/mobile/app/(auth)/login.tsx, apps/mobile/app/_layout.tsx, apps/mobile/app/add-account.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/LoginCaptchaWebView.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/LoginSkinControls.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 203 | 76 |
+| `mobile.automations` | mobile | 自动化 | app/automations/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/automations/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 71 |
+| `mobile.chat.new` | mobile | 新建任务 | app/sessions/new.tsx | AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerAttachmentTray, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, ImageLightbox, IncomingShareBridge, MobileAgentMark, MobileAgentSwitcher, MobileChoicePickerList, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, NewTaskSelectionSheet, NewTaskSelectionSheet.ios, PaperPlaneIcon, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, _layout, gestureHandler, new, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/new.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileChoicePickerList.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx, apps/mobile/src/session/NewTaskSelectionSheet.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 228 | 110 |
+| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionMessageCard, ComposerAttachmentTray, ComposerExpandButton, ComposerExpandButton.ios, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeInput, ComposerNativeInput.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerRichInput, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, ConversationSearchFilterSheet, ConversationShareSvg, ConversationShareWebView, DeviceLinkContext, FailedScheduleNotice, HomeEntryProvider, HomeGlassMenuPanel, HomeNativeStackHeader, HomeSearchBar, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RenameSessionModal, RewindPreviewPanel, SentInlineAtomBody, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionOptionsExpoSheet, SessionResourceCards, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, TaskTags, TaskTagsSheet, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerExpandButton.ios.tsx, apps/mobile/src/session/ComposerExpandButton.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeInput.ios.tsx, apps/mobile/src/session/ComposerNativeInput.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerRichInput.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/ConversationShareSvg.tsx, apps/mobile/src/session/ConversationShareWebView.tsx, apps/mobile/src/session/FailedScheduleNotice.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/InlineQueueSection.tsx, apps/mobile/src/session/InlineQuoteChip.tsx, apps/mobile/src/session/InlineReferenceChip.tsx, apps/mobile/src/session/InteractionPanel.tsx, apps/mobile/src/session/MarkdownBlockContent.tsx, apps/mobile/src/session/MessageActionSheet.tsx, apps/mobile/src/session/MessageRenderer.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/PromptRecommendation.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/RewindPreviewPanel.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionListDrawer.tsx, apps/mobile/src/session/SessionMenuSheet.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SessionResourceCards.tsx, apps/mobile/src/session/SessionSearchNative.ios.tsx, apps/mobile/src/session/SessionSearchNative.tsx, apps/mobile/src/session/SessionTailBanner.tsx, apps/mobile/src/session/SessionUsageSummary.tsx, apps/mobile/src/session/ShareImageNativeButton.ios.tsx, apps/mobile/src/session/ShareImageNativeButton.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/ShareSelectAllButton.tsx, apps/mobile/src/session/ShareSelectionBar.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/TaskTagsSheet.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 229 | 252 |
+| `mobile.companions.direct` | mobile | 伙伴私聊回看 | app/companions/direct/[threadId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [threadId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/companions/direct/[threadId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 50 |
+| `mobile.device-management` | mobile | 设备管理 | app/devices/manage.tsx / app/devices/manage/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceInformationFields, DeviceInformationFields.ios, DeviceLinkContext, DeviceManagementDialogs, DeviceManagementList, DeviceManagementList.ios, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RenameDeviceModal, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, manage, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/manage.tsx, apps/mobile/app/devices/manage/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceInformationFields.ios.tsx, apps/mobile/src/device-link/DeviceInformationFields.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/DeviceManagementDialogs.tsx, apps/mobile/src/device-link/DeviceManagementList.ios.tsx, apps/mobile/src/device-link/DeviceManagementList.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/RenameDeviceModal.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 53 |
+| `mobile.devices` | mobile | 主机详情 | app/devices/[deviceId].tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeNativeStackHeader, HomeProjectMachineLabel, HomeSearchBar, IncomingShareBridge, MobileAgentMark, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, MobileVendorIcon, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteAccessGuide, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, TaskTags, ThemeProvider, [deviceId], _layout, gestureHandler, index, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/[deviceId].tsx, apps/mobile/app/devices/index.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 112 |
+| `mobile.files` | mobile | 任务文件与预览 | app/files/[sessionId].tsx / app/files/preview/[sessionId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HtmlBrowserChrome, HtmlBrowserChrome.ios, HtmlFileReader, HtmlWebsiteBrowser, ImageLightbox, IncomingShareBridge, MarkdownFileReader, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, [sessionId], _layout, gestureHandler, mediaPlayerWebView, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/files/[sessionId].tsx, apps/mobile/app/files/preview/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HtmlBrowserChrome.ios.tsx, apps/mobile/src/session/HtmlBrowserChrome.tsx, apps/mobile/src/session/HtmlFileReader.tsx, apps/mobile/src/session/HtmlWebsiteBrowser.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MarkdownFileReader.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 228 | 77 |
+| `mobile.home` | mobile | 主机与资源首页 | app/index.tsx / app/devices/index.tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeNativeStackHeader, HomeProjectMachineLabel, HomeSearchBar, IncomingShareBridge, MobileAgentMark, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, MobileVendorIcon, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteAccessGuide, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, TaskTags, ThemeProvider, _layout, gestureHandler, index, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/index.tsx, apps/mobile/app/index.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 108 |
+| `mobile.overlay.connection-startup` | mobile | 根布局挂载的启动与连接反馈 | app/_layout.tsx → StartupSplashOverlay / ConnectionNoticeProvider;各页面 ConnectionBanner | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ConnectionNoticeProvider, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 48 |
+| `mobile.remote-desktop` | mobile | 远程桌面 | app/devices/desktop/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/desktop/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 48 |
+| `mobile.resources` | mobile | 远程资源列表与详情 | app/resources/[collectionId].tsx / app/resources/[collectionId]/[resourceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteCompanionAvatar, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [collectionId], [resourceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/resources/[collectionId].tsx, apps/mobile/app/resources/[collectionId]/[resourceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteCompanionAvatar.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 54 |
+| `mobile.settings` | mobile | 设置(含调试与日志上传可见入口) | app/settings.tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileChoicePickerList, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, settings, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/settings.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileChoicePickerList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 196 | 56 |
### 生产路由覆盖
@@ -169,7 +169,7 @@ Mobile 已由 DS-7 纳入同一台账(2026-09-10 静态入口发现),保
- 测试样张与 `__tests__` fixture。
| ID | owner | 迁移状态 | protected | 目标道路 | 下一动作 |
-| --- | --- | --- | --- | --- | --- |
+| ------------------------------------------ | ------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `desktop.auth.add-account` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §16 登录链路 | DS-9 保留现有专属表面;未改全局 Button/主题源,按共享依赖核影响 | 本批未直接改该入口;无真实实例的独立/原生/账号/插件场景保留原合同,未作完整运行验收;kirozeng 安排所需环境,Codex 核对,2026-09-17 或 DS-10 开工前复查 |
| `desktop.auth.legacy-migration` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §16 登录链路(消费 --login-callback-* 品牌豁免族 component token) | DS-9 保留现有专属表面;未改全局 Button/主题源,按共享依赖核影响 | 本批未直接改该入口;无真实实例的独立/原生/账号/插件场景保留原合同,未作完整运行验收;kirozeng 安排所需环境,Codex 核对,2026-09-17 或 DS-10 开工前复查 |
| `desktop.auth.login` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §16 登录链路 | 既有登录品牌保护;本批无全局按钮/主题变更 | 真实隔离窗口走过登录→本地模式;没有验证 Apple/Google/企业账号登录;2026-09-17 或 DS-10 开工前复查 |
@@ -221,7 +221,6 @@ Mobile 已由 DS-7 纳入同一台账(2026-09-10 静态入口发现),保
| `mobile.resources` | kirozeng 协调 / Codex 发现维护;页面 owner 待认领 | legacy | — | DS-7 已发现入口;Mobile 独立阶段接管,未迁移 | 2026-09-17 复查入口变化和页面 owner;动态内容、平台实际呈现留 Mobile 独立阶段验证 |
| `mobile.settings` | kirozeng 协调 / Codex 发现维护;页面 owner 待认领 | legacy | — | DS-7 已发现入口;Mobile 独立阶段接管,未迁移 | 2026-09-17 复查入口变化和页面 owner;动态内容、平台实际呈现留 Mobile 独立阶段验证 |
-
### Usage History category colors (2026-09-09)
- Surface: `desktop.settings`; owner: kirozeng.
diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.md
index aed4cc9481..f5b74097e4 100644
--- a/docs/dev-rules/protocol-compatibility.md
+++ b/docs/dev-rules/protocol-compatibility.md
@@ -11,6 +11,18 @@
> **增量适用原则**:wire protocol 兼容对所有跨端改动生效,不因是小改而豁免。
+## 任务列表标签目录
+
+`sessions:list` 第三个参数可追加 `tagCatalog: 1`。支持的主机仅对该请求返回
+`{ format: 'session-tag-catalog-v1', sessions, tags }`;任务行的 `tagIds` 是响应内
+目录索引,保留全部任务、标签与顺序。共享 DeviceLinkClient 解包后,上层仍读取原数组。
+新控制端兼容旧主机的数组回复;旧控制端不声明此字段,新主机仍返回数组。
+缓存/outbox 重发先解包并重新检查任务可见性,再从可见行生成目录,不能残留隐藏任务的标签。
+此扩展不改变 relay、帧限制或服务器权限,也不靠截断数据降低体积。
+
+标签的可选 `nameCustomized` 标记区分显式改名与预设本地化。新版更新请求仅在明确改名时
+提交 `nameCustomized: true`;旧端换色时携带相同原名不会误置标记。缺省字段沿用旧显示规则。
+
## 远程桌面临时分辨率
被控端以可选能力 `resolutionRestore` 声明系统分辨率的连接级恢复支持。
diff --git a/docs/product-rules/task-tags.md b/docs/product-rules/task-tags.md
new file mode 100644
index 0000000000..5812617742
--- /dev/null
+++ b/docs/product-rules/task-tags.md
@@ -0,0 +1,31 @@
+# 任务标签
+
+当前实现沿用任务列表单栏结构,不增加标签筛选导航。「任务信息」子菜单提供与时间、PR 状态、worktree、Token、费用同级的「标签」复选项,独立控制列表和卡片中任务信息槽的色球。沿用既有显示偏好持久化与跨窗口同步;「标签」排在「时间」之前,默认两项均勾选,多标签色球重叠显示。已有自定义显示项保持原选择。标签在信息区单独保留色球,鼠标悬停任务或操作按钮浮出时仍显示,与按钮并排;每个色球悬停显示对应的本地化标签名称。其他任务信息继续让位并释放原占用宽度。显示开关不修改标签关联;任务状态标识保持原语义。
+
+任务菜单在常规操作与归档/删除之间显示排序靠前的标签。最多七个标签,同行最后一个圆形「…」进入完整编辑器。桌面菜单悬停色球时放大色球、上方与气泡均提示添加或移除标签;选中状态用球内勾选标记,悬停已选球显示叉号,未选中的悬停球显示加号。统一标签面板可增删当前任务的标签、创建标签、改名、换色和删除标签,不再拆分「标签」与「标签设置」。桌面拖动行排序,点击色球或名称勾选,双击名称或点击悬停编辑按钮修改名称和颜色;手机长按手柄后标签行跟随手指移动,其余行让位,松手吸附后保存排序;支持边缘自动滚动与系统减少动态效果设置。点击名称选择,点击常显编辑按钮编辑。键盘可在排序手柄上使用上下箭头,手机提供辅助功能增减操作。标签目录最多 256 项,单任务最多 32 个标签;颜色为红、橙、黄、绿、蓝、紫、灰、粉、珊瑚、青、靛蓝、白共十二色。名称最长 80 字符,持久名称去除首尾空白后忽略大小写判重。预置名称的界面翻译不占用自定义名称;自定义标签保持独立身份,不按翻译后的显示名合并或拒绝。旧无颜色标签按白色显示,旧请求仍被接受并在保存时归一白色。白色球用细边框和固定深色勾。桌面与手机列表最多展示十二行,并随窗口可用高度收缩;列表溢出时滚动条常显,标题与添加入口留在滚动区域外。手机任务列表中的色球仅展示,不弹出名称菜单;任务标题栏色球可打开任务详情。详情和任务菜单的标题居中,下方完整显示当前标签的色球与名称;任务详情的标签管理在独立弹窗中打开,关闭即完成选择,无额外完成按钮。快捷标签支持长按查看名称,末尾「…」与色球同尺寸。任务色球外圈跟随行背景及选中状态。默认只显示列表,点击添加或编辑后在同一面板切换为名称与两行六列色板,取消不写入,保存后返回列表;不显示双击编辑提示。
+
+首次获得标签功能的账号预置十二个标签:前六个为「红/橙/黄/绿/蓝/紫」颜色标签,后六个为「重要/待跟进/工作/生活/灵感/资料」,后六个分别使用珊瑚/粉/靛蓝/青/白/灰,与前六种默认色红/橙/黄/绿/蓝/紫不重复。默认名称随界面语言显示,用户改名后显示自定义名称。预置项与普通标签一样可改名、换色、排序和删除,不自动关联任务;已有标签目录保持不变,用户删掉的标签不会在重启后补回。显式补入预置项沿用创建接口的 `presetId`,仅接受已知预置 ID 及其标准名称和颜色,追加到目录末尾;ID 已存在则拒绝覆盖。预置名称覆盖简体中文、繁体中文、英语、日语、韩语,桌面和手机按各自界面语言显示同一标签。
+
+取消任务上的标签只解除关联。删除整个标签前显示影响任务数量,包含归档任务;删除不影响任务或消息。预览后目标标签或其任务关联变化会使删除失效,必须重新核对;其他标签的变化不影响本次删除的对象与影响范围。
+
+## 数据与跨端
+
+标签目录和关联位于承载任务的电脑、当前账号的数据库。SSH 工作目录不改变标签的归属;远程桌面和手机通过现有 device-link 通道操作来源电脑。不按名字合并不同电脑的标签。
+
+目录排序保存在来源电脑,新增标签追加末尾,改名换色保留位置。排序操作提交完整新旧顺序,目录已变化时拒绝覆盖;新排序字段兼容旧客户端字段,旧数据按原顺序迁移。
+
+界面和 AI 共用命名数据库事务。关联增删只改变指定标签,不覆盖其他标签。来源电脑写入后推送任务标签;目录改动单次推送有界目录,由各端更新已加载的任务色球,不按全库任务数广播。手机任务列表冷缓存保存经过校验的任务标签;标签目录另外使用按账号、设备隔离的内存缓存,先展示缓存再后台校准,退出账号或设备不可访问时清除。打开的标签面板同步其他端的任务勾选变化;断线重连后主动重读目录和关联,旧连接或旧请求结果不覆盖新状态。断线可查看缓存,但不能写入;旧主机不支持新通道时按结构化错误码识别,保留其他任务操作并显示简洁更新说明,不显示空色板或无效的更多入口。读取失败与保存失败分开提示,读取失败提供重试;iOS 菜单中的标签区域跟随原生容器宽度,不按错误文字的固有宽度收缩。
+
+新增 `local-db:task-tags:execute` invoke 和 `local-db:task-tags:changed` push;推送归 `sessions` topic。调用沿用 owner 与远程伙伴可见性检查。仅增加协议能力;旧主机未知通道不可视为成功,旧控制端可忽略新增标签字段。响应可选 `supportedColors` 宣告主机色板;缺失时只允许原七色,新色禁用并提示升级。旧控制端无法识别新色,需要升级后才能完整显示新色标签。没有服务端或原生依赖变更。
+
+## AI 工具
+
+通过现有 `cindy_helper` 的渐进发现入口暴露:`list_task_tags`、`get_task_tags`、`find_tasks_by_tag`、`create_task_tag`、`update_task_tag`、`reorder_task_tags`、`add_task_tags`、`remove_task_tags`、`delete_task_tag`。查询属于 history,写入属于 control。没有当前任务身份或受限制的伙伴调用不可管理账号标签。
+
+工具以当前任务所在电脑为来源,跨任务操作传明确 ID。全局删除先返回数量及短期确认 token;用户明确确认后才能执行,token 绑定调用任务、标签和预览版本,不替代用户授权。不会自动给用户任务分类。
+
+## 视觉与验证边界
+
+色球是用户选择的分类标记,使用独立 `task-tag-*` 语义角色,不能复用运行状态颜色。色球本体和「…」均为圆形;输入框及文字按钮沿用控件圆角,编辑窗口沿用容器圆角。Desktop 与 Mobile 各自颜色真相源同时覆盖 Light/Dark,保留用户主题覆盖。
+
+数据库使用新增 migration,不改历史 migration。开发验证仅使用独立 profile。运行截图、测试结果和未覆盖平台在交付报告中单独说明;HTML 原型不算实际应用验证。
diff --git a/i18n/GLOSSARY.md b/i18n/GLOSSARY.md
index 877c9e9c24..d63430fd41 100644
--- a/i18n/GLOSSARY.md
+++ b/i18n/GLOSSARY.md
@@ -501,6 +501,10 @@ macOS TCC 的 kTCCServiceListenEvent(系统设置里叫「输入监控」)在 Ci
Codex Subagent 的可选扩展调配开关。默认关闭以保留 Codex 原生 Sol/Terra 调配;开启后允许 Codex 从 Cindy 已连接的更多模型中按任务选择。
+### Tag
+
+任务列表的 Finder 式颜色标签;仅标识任务,不改变运行状态。用户已确认显示为重叠色球,整合现有任务菜单,当前不增加筛选入口。
+
### Teammate
Cindy 里的**持久 AI 助手实体**(原名 Bot):有长期身份、自有记忆与技能、模型候选链,可以通过有界私信互相沟通,也可以启动独立 Cindy 任务。产品定位参照「AI teammates」,故取人称名词而非机器名词。英文用法分两层:功能名与复数用 Teammates(侧栏标题),句中单数用小写 teammate(`this teammate`、`Archive teammate`)——故 checkCase 为 false。**与 IM 平台机器人严格区分**:Telegram Bot / Discord Bot / 飞书 bot / 企业微信机器人 / @BotFather / bot token 指的是消息平台上的 bot 账号,仍写作 Bot / 机器人,不改成本词;判据是「这个词指的是 Cindy 里那个持久助手实体」才用本词。覆盖 desktop 的 bots.* 命名空间、sidebar.tabs.bots、newChat.atMention.bot 与 mobile 的 devices.json bots.*。先登记为 proposed:改名刚落地,等 UI 走查与产品评审后再定 decided,届时再决定是否把「Bot」登记为各语言的 forbidden 译法(现在不能登记——存量 IM 平台 bot 文案会被大面积误伤)。
diff --git a/i18n/glossary.json b/i18n/glossary.json
index f766a31f7e..58c04c1069 100644
--- a/i18n/glossary.json
+++ b/i18n/glossary.json
@@ -22,21 +22,36 @@
"id": "cindy-make-history",
"status": "proposed",
"en": "Make history",
- "translations": { "zh-CN": "制作历史", "zh-TW": "製作歷史", "ja": "制作履歴", "ko": "제작 기록" },
+ "translations": {
+ "zh-CN": "制作历史",
+ "zh-TW": "製作歷史",
+ "ja": "制作履歴",
+ "ko": "제작 기록"
+ },
"note": "Cindy Make 设置中保留全部制作、修改轮次与合入记录的列表;结束制作及清理工作目录后仍可回看。"
},
{
"id": "cindy-make-undo-integration",
"status": "proposed",
"en": "Undo integration",
- "translations": { "zh-CN": "撤销合入", "zh-TW": "撤銷合入", "ja": "取り込みを取り消す", "ko": "반영 취소" },
+ "translations": {
+ "zh-CN": "撤销合入",
+ "zh-TW": "撤銷合入",
+ "ja": "取り込みを取り消す",
+ "ko": "반영 취소"
+ },
"note": "撤销单次制作已合入个人源码的全部改动,保留其他制作与已有应用成品;通过新的反向提交实现。"
},
{
"id": "cindy-make-reapply-integration",
"status": "proposed",
"en": "Reapply integration",
- "translations": { "zh-CN": "重新合入", "zh-TW": "重新合入", "ja": "再度取り込む", "ko": "다시 반영" },
+ "translations": {
+ "zh-CN": "重新合入",
+ "zh-TW": "重新合入",
+ "ja": "再度取り込む",
+ "ko": "다시 반영"
+ },
"note": "重新应用之前明确撤销的制作改动,区别于把尚未合入的新修改首次加入个人源码。"
},
{
@@ -55,16 +70,39 @@
"id": "cindy-original-version",
"status": "proposed",
"en": "Original Version",
- "translations": { "zh-CN": "原版", "zh-TW": "原版", "ja": "オリジナル版", "ko": "기본 버전" },
+ "translations": {
+ "zh-CN": "原版",
+ "zh-TW": "原版",
+ "ja": "オリジナル版",
+ "ko": "기본 버전"
+ },
"note": "Cindy Make 中与个人版对应的来源应用。用户明确要求 Dev 和正式安装版属于同一个类型;Dev 只影响底层启动方式,不作为第三类版本。"
},
{
"id": "cindy-personal-version",
"status": "proposed",
"en": "Personal Version",
- "translations": { "zh-CN": "个人版", "zh-TW": "個人版", "ja": "個人版", "ko": "개인 버전" },
+ "translations": {
+ "zh-CN": "个人版",
+ "zh-TW": "個人版",
+ "ja": "個人版",
+ "ko": "개인 버전"
+ },
"note": "Cindy Make 生成的本机定制应用成品。可与原版切换并沿用同一份日常数据,与使用独立数据的隔离测试版区分。"
},
+ {
+ "id": "task-tag",
+ "status": "proposed",
+ "en": "Tag",
+ "translations": {
+ "zh-CN": "标签",
+ "zh-TW": "標籤",
+ "ja": "タグ",
+ "ko": "태그"
+ },
+ "checkCase": false,
+ "note": "任务列表的 Finder 式颜色标签;仅标识任务,不改变运行状态。用户已确认显示为重叠色球,整合现有任务菜单,当前不增加筛选入口。"
+ },
{
"id": "remote-desktop-display-sound",
"status": "proposed",
diff --git a/packages/design-tokens/src/__tests__/production.test.ts b/packages/design-tokens/src/__tests__/production.test.ts
index 281becd8bc..b7f4a07473 100644
--- a/packages/design-tokens/src/__tests__/production.test.ts
+++ b/packages/design-tokens/src/__tests__/production.test.ts
@@ -176,7 +176,7 @@ describe("DS-8 production source", () => {
ts.forEachChild(node, visit);
};
visit(source);
- expect(new Set(ids).size).toBe(555);
+ expect(new Set(ids).size).toBe(568);
expect(
[
...Object.keys(bindings.defaults),
diff --git a/packages/design-tokens/src/classification.json b/packages/design-tokens/src/classification.json
index d4b4452962..eea8bf0f01 100644
--- a/packages/design-tokens/src/classification.json
+++ b/packages/design-tokens/src/classification.json
@@ -1,9 +1,9 @@
{
"source": "apps/desktop/src/renderer/themes/colors.ts",
"generatedBy": "packages/design-tokens/src/classify.ts",
- "snapshotCount": 555,
+ "snapshotCount": 568,
"categories": {
- "literal": 268,
+ "literal": 281,
"alias": 249,
"hsl-triplet": 6,
"runtime-derived-or-protected": 32
@@ -5535,6 +5535,110 @@
"dark": "surface-hover"
},
"modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-red",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-orange",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-yellow",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-green",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-blue",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-purple",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-gray",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-pink",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-coral",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-teal",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-indigo",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-white",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
+ },
+ {
+ "id": "task-tag-white-check",
+ "category": "literal",
+ "destination": "reference-candidate",
+ "lightKind": "hex",
+ "darkKind": "hex",
+ "modeledAsSemantic": false
}
]
}
diff --git a/packages/design-tokens/src/desktop-bindings.json b/packages/design-tokens/src/desktop-bindings.json
index b1e23bc0b0..56d1f68b54 100644
--- a/packages/design-tokens/src/desktop-bindings.json
+++ b/packages/design-tokens/src/desktop-bindings.json
@@ -2143,6 +2143,58 @@
"segmented-hover-bg": {
"light": "component.defaults.segmented-hover-bg.light",
"dark": "component.defaults.segmented-hover-bg.dark"
+ },
+ "task-tag-red": {
+ "light": "semantic.defaults.task-tag-red.light",
+ "dark": "semantic.defaults.task-tag-red.dark"
+ },
+ "task-tag-orange": {
+ "light": "semantic.defaults.task-tag-orange.light",
+ "dark": "semantic.defaults.task-tag-orange.dark"
+ },
+ "task-tag-yellow": {
+ "light": "semantic.defaults.task-tag-yellow.light",
+ "dark": "semantic.defaults.task-tag-yellow.dark"
+ },
+ "task-tag-green": {
+ "light": "semantic.defaults.task-tag-green.light",
+ "dark": "semantic.defaults.task-tag-green.dark"
+ },
+ "task-tag-blue": {
+ "light": "semantic.defaults.task-tag-blue.light",
+ "dark": "semantic.defaults.task-tag-blue.dark"
+ },
+ "task-tag-purple": {
+ "light": "semantic.defaults.task-tag-purple.light",
+ "dark": "semantic.defaults.task-tag-purple.dark"
+ },
+ "task-tag-gray": {
+ "light": "semantic.defaults.task-tag-gray.light",
+ "dark": "semantic.defaults.task-tag-gray.dark"
+ },
+ "task-tag-pink": {
+ "light": "semantic.defaults.task-tag-pink.light",
+ "dark": "semantic.defaults.task-tag-pink.dark"
+ },
+ "task-tag-coral": {
+ "light": "semantic.defaults.task-tag-coral.light",
+ "dark": "semantic.defaults.task-tag-coral.dark"
+ },
+ "task-tag-teal": {
+ "light": "semantic.defaults.task-tag-teal.light",
+ "dark": "semantic.defaults.task-tag-teal.dark"
+ },
+ "task-tag-indigo": {
+ "light": "semantic.defaults.task-tag-indigo.light",
+ "dark": "semantic.defaults.task-tag-indigo.dark"
+ },
+ "task-tag-white": {
+ "light": "semantic.defaults.task-tag-white.light",
+ "dark": "semantic.defaults.task-tag-white.dark"
+ },
+ "task-tag-white-check": {
+ "light": "semantic.defaults.task-tag-white-check.light",
+ "dark": "semantic.defaults.task-tag-white-check.dark"
}
},
"retained": {
diff --git a/packages/design-tokens/src/reference/color.json b/packages/design-tokens/src/reference/color.json
index ad87f89482..c577a24577 100644
--- a/packages/design-tokens/src/reference/color.json
+++ b/packages/design-tokens/src/reference/color.json
@@ -11002,6 +11002,500 @@
}
}
}
+ },
+ "task-tag-red": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.929412,
+ 0.380392,
+ 0.372549
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.929412,
+ 0.380392,
+ 0.372549
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-orange": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.933333,
+ 0.639216,
+ 0.305882
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.933333,
+ 0.639216,
+ 0.305882
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-yellow": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.898039,
+ 0.780392,
+ 0.266667
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.898039,
+ 0.780392,
+ 0.266667
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-green": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.439216,
+ 0.709804,
+ 0.407843
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.439216,
+ 0.709804,
+ 0.407843
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-blue": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.376471,
+ 0.607843,
+ 0.831373
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.376471,
+ 0.607843,
+ 0.831373
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-purple": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.670588,
+ 0.482353,
+ 0.776471
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.670588,
+ 0.482353,
+ 0.776471
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-gray": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.588235,
+ 0.588235,
+ 0.588235
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.588235,
+ 0.588235,
+ 0.588235
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-pink": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.87451,
+ 0.513725,
+ 0.690196
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.905882,
+ 0.623529,
+ 0.756863
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-coral": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.870588,
+ 0.537255,
+ 0.439216
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.901961,
+ 0.627451,
+ 0.54902
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-teal": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.32549,
+ 0.658824,
+ 0.615686
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.458824,
+ 0.74902,
+ 0.705882
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-indigo": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.486275,
+ 0.513725,
+ 0.811765
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.6,
+ 0.623529,
+ 0.87451
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-white": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 1.0,
+ 1.0,
+ 1.0
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 1.0,
+ 1.0,
+ 1.0
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
+ },
+ "task-tag-white-check": {
+ "light": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.321569,
+ 0.321569,
+ 0.321569
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ },
+ "dark": {
+ "$type": "color",
+ "$value": {
+ "colorSpace": "srgb",
+ "components": [
+ 0.321569,
+ 0.321569,
+ 0.321569
+ ]
+ },
+ "$extensions": {
+ "com.cindy.desktop": {
+ "format": "hex",
+ "uppercase": false,
+ "alpha": false
+ }
+ }
+ }
}
}
}
diff --git a/packages/design-tokens/src/semantic/color.json b/packages/design-tokens/src/semantic/color.json
index 287322cfc7..3182899133 100644
--- a/packages/design-tokens/src/semantic/color.json
+++ b/packages/design-tokens/src/semantic/color.json
@@ -3084,6 +3084,136 @@
"$type": "shadow",
"$value": "{reference.defaults.segmented-selected-shadow.dark}"
}
+ },
+ "task-tag-red": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-red.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-red.dark}"
+ }
+ },
+ "task-tag-orange": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-orange.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-orange.dark}"
+ }
+ },
+ "task-tag-yellow": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-yellow.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-yellow.dark}"
+ }
+ },
+ "task-tag-green": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-green.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-green.dark}"
+ }
+ },
+ "task-tag-blue": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-blue.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-blue.dark}"
+ }
+ },
+ "task-tag-purple": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-purple.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-purple.dark}"
+ }
+ },
+ "task-tag-gray": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-gray.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-gray.dark}"
+ }
+ },
+ "task-tag-pink": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-pink.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-pink.dark}"
+ }
+ },
+ "task-tag-coral": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-coral.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-coral.dark}"
+ }
+ },
+ "task-tag-teal": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-teal.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-teal.dark}"
+ }
+ },
+ "task-tag-indigo": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-indigo.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-indigo.dark}"
+ }
+ },
+ "task-tag-white": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-white.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-white.dark}"
+ }
+ },
+ "task-tag-white-check": {
+ "light": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-white-check.light}"
+ },
+ "dark": {
+ "$type": "color",
+ "$value": "{reference.defaults.task-tag-white-check.dark}"
+ }
}
}
}
diff --git a/packages/device-link/src/__tests__/client.test.ts b/packages/device-link/src/__tests__/client.test.ts
index 8bf7a9f832..28bc710b50 100644
--- a/packages/device-link/src/__tests__/client.test.ts
+++ b/packages/device-link/src/__tests__/client.test.ts
@@ -725,6 +725,40 @@ describe('DeviceLinkClient', () => {
await expect(p).resolves.toMatchObject({ ok: true, result: ['s1'] });
h.client.stop();
});
+ it("negotiates a tag catalog and returns the original session array to callers", async () => {
+ const h = makeHarness();
+ h.client.start();
+ await tick();
+ h.current().ack();
+ const p = h.client.invoke("dev-b", {
+ channel: 'local-db:sessions:list',
+ args: [200, "active", { includePinned: true }],
+ });
+ const sent = h.current().sent.find((e) => e.kind === 'invoke')!;
+ expect(sent.payload).toMatchObject({
+ args: [200, "active", { includePinned: true, tagCatalog: 1 }],
+ });
+ const tag = { id: "work", name: "Work" };
+ h.current().push({
+ v: PROTOCOL_VERSION,
+ kind: "invoke-result",
+ id: sent.id,
+ src: "dev-b",
+ payload: {
+ ok: true,
+ result: {
+ format: "session-tag-catalog-v1",
+ sessions: [{ id: "s1", tagIds: [0] }],
+ tags: [tag],
+ },
+ },
+ });
+ await expect(p).resolves.toEqual({
+ ok: true,
+ result: [{ id: "s1", tags: [tag] }],
+ });
+ h.client.stop();
+ });
it('双方协商可靠传输后,大 invoke-result 分片并在累计 ACK 后停止重发', async () => {
const h = makeHarness({ timing: { pingIntervalMs: 10_000 } });
@@ -2651,7 +2685,7 @@ describe('DeviceLinkClient', () => {
expect(sentListing).toMatchObject({
kind: 'invoke',
dst: 'dev-b',
- payload: { channel: 'local-db:sessions:list', args: [] },
+ payload: { channel: 'local-db:sessions:list', args: [null, null, { tagCatalog: 1 }] },
});
expect(parseTransportPayload(sentListing.payload)).toBeNull();
h.current().push({
@@ -2781,7 +2815,7 @@ describe('DeviceLinkClient', () => {
expect(sentListing).toMatchObject({
kind: 'invoke',
dst: 'dev-b',
- payload: { channel: 'local-db:sessions:list', args: [] },
+ payload: { channel: 'local-db:sessions:list', args: [null, null, { tagCatalog: 1 }] },
});
expect(parseTransportPayload(sentListing.payload)).toBeNull();
diff --git a/packages/device-link/src/__tests__/sessionListTransport.test.ts b/packages/device-link/src/__tests__/sessionListTransport.test.ts
new file mode 100644
index 0000000000..48bfb908c9
--- /dev/null
+++ b/packages/device-link/src/__tests__/sessionListTransport.test.ts
@@ -0,0 +1,72 @@
+import { expect, it } from "vitest";
+import {
+ requestSessionTagCatalog,
+ encodeSessionTagCatalog,
+ decodeSessionTagCatalog,
+} from "../sessionListTransport.js";
+
+const channel = "local-db:sessions:list";
+const options = [1000, "archived", { tagCatalog: 1 }];
+it("opts in without mutating arguments and preserves legacy responses and peers", () => {
+ const input = {
+ channel,
+ args: [20, "active", { fresh: true, includePinned: true }],
+ };
+ expect(requestSessionTagCatalog(input).args[2]).toEqual({
+ fresh: true,
+ includePinned: true,
+ tagCatalog: 1,
+ });
+ expect(input.args[2]).toEqual({ fresh: true, includePinned: true });
+ const rows = [{ id: "a", tags: [] }, { id: "b" }];
+ expect(encodeSessionTagCatalog(channel, [], rows)).toBe(rows);
+ expect(decodeSessionTagCatalog(channel, rows)).toBe(rows);
+});
+it("keeps every row and tag while reducing a >4MiB result below legacy frame limits", () => {
+ const tags = Array.from({ length: 32 }, (_, i) => ({
+ id: `tag-${i}`,
+ name: "字".repeat(80),
+ color: "blue",
+ revision: 1,
+ }));
+ const rows = Array.from({ length: 1000 }, (_, i) => ({
+ id: String(i),
+ title: "task",
+ tags,
+ }));
+ const packed = encodeSessionTagCatalog(channel, options, rows);
+ expect(Buffer.byteLength(JSON.stringify(rows))).toBeGreaterThan(
+ 4 * 1024 * 1024,
+ );
+ expect(Buffer.byteLength(JSON.stringify(packed))).toBeLessThan(
+ 2 * 1024 * 1024,
+ );
+ expect(decodeSessionTagCatalog(channel, packed)).toEqual(rows);
+});
+it("preserves absent/empty tags, order and differing versions of the same tag ID", () => {
+ const rows = [
+ { id: "a" },
+ { id: "b", tags: [] },
+ { id: "c", tags: [{ id: "x", name: "Old" }] },
+ { id: "d", tags: [{ id: "x", name: "New" }] },
+ ];
+ expect(
+ decodeSessionTagCatalog(
+ channel,
+ encodeSessionTagCatalog(channel, options, rows),
+ ),
+ ).toEqual(rows);
+});
+it("rejects broken references instead of silently losing labels", () => {
+ for (const id of [-1, 1, 0.5, "0"])
+ expect(() =>
+ decodeSessionTagCatalog(channel, {
+ format: "session-tag-catalog-v1",
+ tags: [{}],
+ sessions: [{ tagIds: [id] }],
+ }),
+ ).toThrow();
+ expect(() =>
+ decodeSessionTagCatalog(channel, { format: "unknown" }),
+ ).toThrow();
+});
diff --git a/packages/device-link/src/allowlist.ts b/packages/device-link/src/allowlist.ts
index 1f6def4054..95de645e5e 100644
--- a/packages/device-link/src/allowlist.ts
+++ b/packages/device-link/src/allowlist.ts
@@ -265,6 +265,7 @@ const CORE_INVOKE_CHANNELS: readonly string[] = [
...REMOTE_RESOURCE_CHANNELS,
// —— 读模型(被控端本地 DB 是数据真相)——
'local-db:sessions:list',
+ 'local-db:task-tags:execute',
'local-db:sessions:get',
// Bounded metadata reconciliation. Old hosts reject this; controllers fall back to GET.
'local-db:sessions:get-many',
@@ -667,6 +668,7 @@ export const PUSH_FORWARD_ALLOWLIST: ReadonlySet<string> = new Set([
'maker:claude-session-route-changed',
// local-db 推送(读模型增量)
'local-db:sessions:created',
+ 'local-db:task-tags:changed',
'local-db:sessions:patched',
SESSION_ACTIVITY_CHANNEL,
SESSION_SYNC_CHANNEL,
diff --git a/packages/device-link/src/client.ts b/packages/device-link/src/client.ts
index f5499d8db7..1a6724c257 100644
--- a/packages/device-link/src/client.ts
+++ b/packages/device-link/src/client.ts
@@ -1,4 +1,8 @@
import { isPeerResetRetryableReadChannel } from './invokePolicy.js';
+import {
+ requestSessionTagCatalog,
+ decodeSessionTagCatalog,
+} from './sessionListTransport.js';
import { CongestionSendBudget } from './congestionSendBudget.js';
import { PUSH_FORWARD_ALLOWLIST, REMOTE_INVOKE_ALLOWLIST } from './allowlist.js';
import {
@@ -1317,11 +1321,17 @@ export class DeviceLinkClient {
/** 控制端:远程 invoke,等待 invoke-result */
async invoke(dst: string, payload: InvokePayload, timeoutMs?: number): Promise<InvokeResultPayload> {
const env = await this.request(
- { v: PROTOCOL_VERSION, kind: 'invoke', dst, payload },
+ { v: PROTOCOL_VERSION, kind: 'invoke', dst, payload: requestSessionTagCatalog(payload) },
'invoke-result',
timeoutMs,
);
- return env.payload as InvokeResultPayload;
+ const result = env.payload as InvokeResultPayload;
+ return result.ok
+ ? {
+ ...result,
+ result: decodeSessionTagCatalog(payload.channel, result.result),
+ }
+ : result;
}
/** 被控端:回 invoke-result(对应入站 invoke 的 id) */
diff --git a/packages/device-link/src/index.ts b/packages/device-link/src/index.ts
index f8c791d0d4..58c2023beb 100644
--- a/packages/device-link/src/index.ts
+++ b/packages/device-link/src/index.ts
@@ -33,6 +33,7 @@ export * from "./filePeerRuntime.js";
export { FILE_PEER_RUNTIME_SOURCE } from "./filePeerRuntimeSource.js";
export * from "./modelFavorites.js";
+export * from "./sessionListTransport.js";
export * from "./clipboardSync.js";
export * from "./clipboardSyncFailure.js";
diff --git a/packages/device-link/src/sessionListTransport.ts b/packages/device-link/src/sessionListTransport.ts
new file mode 100644
index 0000000000..3c1b3cc079
--- /dev/null
+++ b/packages/device-link/src/sessionListTransport.ts
@@ -0,0 +1,92 @@
+import type { InvokePayload } from "./protocol.js";
+
+const channel = "local-db:sessions:list";
+const format = "session-tag-catalog-v1";
+const record = (value: unknown): value is Record<string, unknown> =>
+ !!value && typeof value === "object" && !Array.isArray(value);
+
+/** Per-request opt-in also works before link establishment. Old hosts ignore it. */
+export function requestSessionTagCatalog(
+ payload: InvokePayload,
+): InvokePayload {
+ if (payload.channel !== channel) return payload;
+ const args = [...(payload.args ?? [])];
+ if (args[2] != null && !record(args[2])) return payload;
+ args[2] = {
+ ...(args[2] as Record<string, unknown> | undefined),
+ tagCatalog: 1,
+ };
+ return { ...payload, args };
+}
+
+/** Pack only the authorized result; never send unused directory entries. */
+export function encodeSessionTagCatalog(
+ name: string | undefined,
+ args: unknown[] | undefined,
+ value: unknown,
+): unknown {
+ if (
+ name !== channel ||
+ !record(args?.[2]) ||
+ args[2].tagCatalog !== 1 ||
+ !Array.isArray(value)
+ )
+ return value;
+ const tags: unknown[] = [];
+ const byValue = new Map<string, number>();
+ const sessions = value.map((row) => {
+ if (!record(row) || !Array.isArray(row.tags)) return row;
+ // Index references preserve even differing snapshots of the same ID exactly.
+ const tagIds = row.tags.map((tag) => {
+ const key = JSON.stringify(tag);
+ let index = byValue.get(key);
+ if (index === undefined) {
+ index = tags.length;
+ byValue.set(key, index);
+ tags.push(tag);
+ }
+ return index;
+ });
+ const { tags: _tags, ...rest } = row;
+ return { ...rest, tagIds };
+ });
+ return { format, sessions, tags };
+}
+
+/** Decode before consumers and before cached results are re-authorized. */
+export function decodeSessionTagCatalog(
+ name: string | undefined,
+ value: unknown,
+): unknown {
+ if (name !== channel || Array.isArray(value)) return value;
+ if (!record(value) || value.format === undefined) return value;
+ if (
+ !record(value) ||
+ value.format !== format ||
+ !Array.isArray(value.sessions) ||
+ !Array.isArray(value.tags)
+ )
+ throw new Error("Invalid session tag catalog");
+ const tags = value.tags;
+ return value.sessions.map((row) => {
+ if (!record(row)) throw new Error("Invalid session row");
+ if (!Object.prototype.hasOwnProperty.call(row, "tagIds")) return row;
+ if (
+ !Array.isArray(row.tagIds) ||
+ Object.prototype.hasOwnProperty.call(row, "tags")
+ )
+ throw new Error("Invalid session tag references");
+ const resolved = row.tagIds.map((id) => {
+ if (
+ !Number.isInteger(id) ||
+ id < 0 ||
+ id >= tags.length ||
+ !record(tags[id])
+ )
+ throw new Error("Invalid session tag reference");
+ return tags[id];
+ });
+ const { tagIds: _ids, ...rest } = row;
+ return { ...rest, tags: resolved };
+ });
+}
diff --git a/packages/device-link/src/topics.ts b/packages/device-link/src/topics.ts
index 7bfd404a5c..d34a381fe8 100644
--- a/packages/device-link/src/topics.ts
+++ b/packages/device-link/src/topics.ts
@@ -146,6 +146,7 @@ export function expandMakerEventBatchPayload(payload: unknown): unknown[] {
*/
const SESSION_LIST_CHANNELS: ReadonlySet<string> = new Set([
'local-db:sessions:created',
+ 'local-db:task-tags:changed',
'local-db:sessions:patched',
'local-db:session:error-persisted',
SESSION_ACTIVITY_CHANNEL,
diff --git a/packages/lizi-mcps/src/__tests__/sessionTags.test.ts b/packages/lizi-mcps/src/__tests__/sessionTags.test.ts
new file mode 100644
index 0000000000..36ad84abf5
--- /dev/null
+++ b/packages/lizi-mcps/src/__tests__/sessionTags.test.ts
@@ -0,0 +1,119 @@
+import { describe, it, expect, vi } from 'vitest';
+import { XdtHelperToolRegistry } from '../lizi_xdtHelperToolRegistry';
+import { registerSessionTagTools } from '../xdt-helper/session_tags';
+import type { TaskTagResult } from '@cindy/maker-shared';
+const parse = (r: any) => JSON.parse(r.content[0].text);
+describe('task label tools', () => {
+ function setup() {
+ const registry = new XdtHelperToolRegistry();
+ let caller = 'a';
+ const execute = vi.fn(async (_caller: string, request: any): Promise<TaskTagResult> => ({
+ tags: [],
+ sessions: [],
+ ...(request.action === 'previewDelete'
+ ? { deletion: { tagId: request.tagId, revision: 3, count: 2 } }
+ : {}),
+ }));
+ registerSessionTagTools(registry, {
+ getSessionContext: () => ({
+ sessionId: caller,
+ agentKind: 'codex',
+ workingDir: '/tmp/task-tags-test',
+ }),
+ execute,
+ });
+ return {
+ registry,
+ execute,
+ setCaller: (v: string) => {
+ caller = v;
+ },
+ call: async (name: string, args: object) => parse(await registry.call(name, args)),
+ };
+ }
+ it('defaults to current task, retains explicit bounded targets and rejects missing context', async () => {
+ const h = setup();
+ await h.call('add_task_tags', { tag_ids: ['red'] });
+ expect(h.execute).toHaveBeenLastCalledWith('a', {
+ action: 'attach',
+ sessionIds: ['a'],
+ tagIds: ['red'],
+ });
+ await h.call('remove_task_tags', { session_ids: ['b'], tag_ids: ['red'] });
+ expect(h.execute).toHaveBeenLastCalledWith('a', {
+ action: 'detach',
+ sessionIds: ['b'],
+ tagIds: ['red'],
+ });
+ h.setCaller('');
+ const r = await h.call('list_task_tags', {});
+ expect(r.errorCode).toBe('NO_SESSION_CONTEXT');
+ });
+ it('passes complete reorder and concurrency preconditions to the owner', async () => {
+ const h = setup();
+ await h.call('reorder_task_tags', {
+ tag_ids: ['blue', 'red'],
+ expected_order: ['red', 'blue'],
+ });
+ expect(h.execute).toHaveBeenLastCalledWith('a', {
+ action: 'reorder',
+ tagIds: ['blue', 'red'],
+ expectedOrder: ['red', 'blue'],
+ });
+ });
+ it("distinguishes an explicit canonical rename from recoloring", async () => {
+ const h = setup();
+ await h.call("update_task_tag", {
+ tag_id: "preset:work",
+ revision: 1,
+ name: "Work",
+ });
+ expect(h.execute).toHaveBeenLastCalledWith(
+ "a",
+ expect.objectContaining({ name: "Work", nameCustomized: true }),
+ );
+ await h.call("update_task_tag", {
+ tag_id: "preset:work",
+ revision: 2,
+ color: "blue",
+ });
+ expect(h.execute).toHaveBeenLastCalledWith(
+ "a",
+ expect.objectContaining({ name: undefined, nameCustomized: undefined }),
+ );
+ });
+ it('requires a signed caller-bound delete preview and passes concurrency preconditions', async () => {
+ const h = setup();
+ const preview = await h.call('delete_task_tag', { tag_id: 'red' });
+ const token = preview.confirmation_token ?? preview.data?.confirmation_token;
+ expect(typeof token).toBe('string');
+ h.setCaller('b');
+ expect(
+ (
+ await h.call('delete_task_tag', {
+ tag_id: 'red',
+ confirmation_token: token,
+ })
+ ).errorCode,
+ ).toBe('INVALID_CONFIRMATION');
+ h.setCaller('a');
+ await h.call('delete_task_tag', {
+ tag_id: 'red',
+ confirmation_token: token,
+ });
+ expect(h.execute).toHaveBeenLastCalledWith('a', {
+ action: 'delete',
+ tagId: 'red',
+ revision: 3,
+ expectedCount: 2,
+ });
+ expect(
+ (
+ await h.call('delete_task_tag', {
+ tag_id: 'blue',
+ confirmation_token: token,
+ })
+ ).errorCode,
+ ).toBe('INVALID_CONFIRMATION');
+ });
+});
diff --git a/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts b/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts
index 79ad4349ad..e80ccd75ed 100644
--- a/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts
+++ b/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts
@@ -1,3 +1,4 @@
+import { registerSessionTagTools, type SessionTagsCallback } from './xdt-helper/session_tags.js';
/**
* lizi_xdtHelperMcpServer.ts
* ---------------------------------------------------------------------------
@@ -156,8 +157,9 @@ interface SessionTaskCallbacks {
interface BotMessagingCallbacks {
checkMessage?(params: { callerSessionId: string; messageId: string }): Promise<
{ ok: true } | { ok: false; errorCode: string; message: string }>;
- listAgents?(params: { callerSessionId: string }): Promise<
- { ok: true; agents: unknown[]; unavailableDevices: unknown[] }
+ listAgents?(params: { callerSessionId: string;
+ }): Promise<
+ | { ok: true; agents: unknown[]; unavailableDevices: unknown[] }
| { ok: false; errorCode: string; message: string }>;
messageAgent(params: {
@@ -647,6 +649,7 @@ export interface XdtHelperMcpDeps {
/** Register an existing local directory as a Cindy project without starting a task. */
createProject?: CreateProjectCallback;
moveSession?: MoveSessionCallback;
+ sessionTags?: SessionTagsCallback;
projectManagement?: ProjectManagementCallbacks;
/** Cindy Bot-only background Session-task controls. Host validates the caller Session. */
sessionTasks?: SessionTaskCallbacks;
@@ -727,6 +730,11 @@ export function createXdtHelperMcpServer(
getSessionContext: () => resolveLiziMcpSessionContext(sessionCtx),
});
+ if (deps.sessionTags)
+ registerSessionTagTools(registry, {
+ getSessionContext: () => resolveLiziMcpSessionContext(sessionCtx),
+ execute: deps.sessionTags,
+ });
if (deps.setCurrentSessionTitle) {
registerSetCurrentSessionTitleTool(registry, {
getSessionContext: () => resolveLiziMcpSessionContext(sessionCtx),
diff --git a/packages/lizi-mcps/src/xdt-helper/session_tags.ts b/packages/lizi-mcps/src/xdt-helper/session_tags.ts
new file mode 100644
index 0000000000..cc3c56a853
--- /dev/null
+++ b/packages/lizi-mcps/src/xdt-helper/session_tags.ts
@@ -0,0 +1,195 @@
+import { z } from 'zod';
+import { TASK_TAG_COLORS, type TaskTagRequest, type TaskTagResult } from '@cindy/maker-shared';
+import type { LiziMcpSessionContext } from '../types.js';
+import type { XdtHelperToolRegistry } from '../lizi_xdtHelperToolRegistry.js';
+import { okPayload, errorPayload } from './_payload.js';
+import { encodeConfirmationToken, decodeConfirmationToken } from './_confirmation_token.js';
+
+export type SessionTagsCallback = (
+ callerSessionId: string,
+ request: TaskTagRequest,
+) => Promise<TaskTagResult>;
+export function registerSessionTagTools(
+ registry: XdtHelperToolRegistry,
+ deps: {
+ getSessionContext: () => LiziMcpSessionContext;
+ execute: SessionTagsCallback;
+ },
+) {
+ const id = z.string().trim().min(1).max(128);
+ const sessionIds = z.array(id).min(1).max(100).optional();
+ const tagIds = z.array(id).min(1).max(32);
+ const invoke = async (request: TaskTagRequest) => {
+ const caller = deps.getSessionContext().sessionId;
+ if (!caller) throw new Error('[NO_SESSION_CONTEXT] No current Cindy task');
+ return deps.execute(caller, request);
+ };
+ const register = (
+ name: string,
+ category: 'history' | 'control',
+ description: string,
+ inputShape: z.ZodRawShape,
+ handler: (args: any) => Promise<object>,
+ ) =>
+ registry.register({
+ name,
+ category,
+ description:
+ description +
+ ' Scope: the owner database on the computer hosting the current task. IDs from another computer are not accepted. Only change tags when requested by the user.',
+ inputShape,
+ handler: async (args) => {
+ try {
+ if (!deps.getSessionContext().sessionId)
+ return errorPayload('NO_SESSION_CONTEXT', 'No current Cindy task');
+ return okPayload({ ...(await handler(args)) });
+ } catch (error) {
+ const message = error instanceof Error ? error.message : String(error);
+ return errorPayload(message.match(/\[([A-Z_]+)\]/)?.[1] ?? 'INTERNAL', message);
+ }
+ },
+ });
+ register(
+ 'list_task_tags',
+ 'history',
+ 'list_task_tags(): List label IDs, names, colors, sort positions and revisions in display order. The first seven appear in the task menu.',
+ {},
+ () => invoke({ action: 'list' }),
+ );
+ register(
+ 'get_task_tags',
+ 'history',
+ 'get_task_tags(session_ids?: string[]): Read tags for up to 100 task IDs; omitted means current task.',
+ { session_ids: sessionIds },
+ (a) =>
+ invoke({
+ action: 'get',
+ sessionIds: a.session_ids ?? [deps.getSessionContext().sessionId!],
+ }),
+ );
+ register(
+ 'find_tasks_by_tag',
+ 'history',
+ 'find_tasks_by_tag(tag_id: string, offset?: number, limit?: number): Find tasks with a label; limit 1–100, default 50. Includes archived tasks; follow hasMore.',
+ {
+ tag_id: id,
+ offset: z.number().int().min(0).optional(),
+ limit: z.number().int().min(1).max(100).optional(),
+ },
+ (a) =>
+ invoke({
+ action: 'find',
+ tagId: a.tag_id,
+ offset: a.offset,
+ limit: a.limit,
+ }),
+ );
+ register(
+ 'create_task_tag',
+ 'control',
+ `create_task_tag(name: string, color: ${TASK_TAG_COLORS.join('|')}): Create a named label at the end of the display order.`,
+ {
+ name: z.string().trim().min(1).max(80),
+ color: z.enum(TASK_TAG_COLORS),
+ },
+ (a) =>
+ invoke({
+ action: 'create',
+ name: a.name,
+ color: a.color,
+ }),
+ );
+ register(
+ 'update_task_tag',
+ 'control',
+ `update_task_tag(tag_id: string, revision: number, name?: string, color?: ${TASK_TAG_COLORS.join('|')}): Rename/recolor globally, preserving display order. Use current revision from list_task_tags; conflicts require rereading.`,
+ {
+ tag_id: id,
+ revision: z.number().int().min(1),
+ name: z.string().trim().min(1).max(80).optional(),
+ color: z.enum(TASK_TAG_COLORS).optional(),
+ },
+ (a) =>
+ invoke({
+ action: 'update',
+ tagId: a.tag_id,
+ revision: a.revision,
+ name: a.name,
+ nameCustomized: a.name === undefined ? undefined : true,
+ color: a.color,
+ }),
+ );
+ for (const action of ['attach', 'detach'] as const)
+ register(
+ action === 'attach' ? 'add_task_tags' : 'remove_task_tags',
+ 'control',
+ `${action === 'attach' ? 'add_task_tags' : 'remove_task_tags'}(tag_ids: string[], session_ids?: string[]): ${action === 'attach' ? 'Add' : 'Remove'} labels atomically for up to 100 tasks on this host; omitted IDs mean current task. Preserves all other labels. Returns per-task tags.`,
+ { tag_ids: tagIds, session_ids: sessionIds },
+ (a) =>
+ invoke({
+ action,
+ tagIds: a.tag_ids,
+ sessionIds: a.session_ids ?? [deps.getSessionContext().sessionId!],
+ }),
+ );
+ register(
+ 'reorder_task_tags',
+ 'control',
+ 'reorder_task_tags(tag_ids: string[], expected_order: string[]): Reorder the complete label directory. Both arrays must contain every label ID exactly once. expected_order is the current order from list_task_tags; tag_ids is the requested order. Concurrent changes require rereading. The first seven labels appear in the task menu.',
+ {
+ tag_ids: z.array(id).min(1).max(256),
+ expected_order: z.array(id).min(1).max(256),
+ },
+ (a) =>
+ invoke({
+ action: 'reorder',
+ tagIds: a.tag_ids,
+ expectedOrder: a.expected_order,
+ }),
+ );
+ const confirmation = z.object({
+ caller: id,
+ tagId: id,
+ revision: z.number().int(),
+ count: z.number().int(),
+ expires: z.number(),
+ });
+ register(
+ 'delete_task_tag',
+ 'control',
+ 'delete_task_tag(tag_id: string, confirmation_token?: string): First omit token to preview affected task count. After the user explicitly approves deleting this label globally, repeat with returned token. Removes label associations, including archived tasks; keeps tasks/messages. Token expires in 10 minutes; changed data requires a new preview.',
+ { tag_id: id, confirmation_token: z.string().max(4096).optional() },
+ async (a) => {
+ const caller = deps.getSessionContext().sessionId!;
+ if (!a.confirmation_token) {
+ const r = await invoke({ action: 'previewDelete', tagId: a.tag_id });
+ return {
+ preview: r.deletion,
+ confirmation_token: encodeConfirmationToken('delete_task_tag', {
+ caller,
+ ...r.deletion,
+ expires: Date.now() + 600_000,
+ }),
+ };
+ }
+ const payload = decodeConfirmationToken(
+ 'delete_task_tag',
+ a.confirmation_token,
+ (v): v is z.infer<typeof confirmation> => confirmation.safeParse(v).success,
+ );
+ if (
+ !payload ||
+ payload.caller !== caller ||
+ payload.tagId !== a.tag_id ||
+ payload.expires < Date.now()
+ )
+ throw new Error('[INVALID_CONFIRMATION] Repeat the deletion preview');
+ return invoke({
+ action: 'delete',
+ tagId: payload.tagId,
+ revision: payload.revision,
+ expectedCount: payload.count,
+ });
+ },
+ );
+}
diff --git a/packages/maker-shared/src/index.ts b/packages/maker-shared/src/index.ts
index 7e59ee7b02..ec8b5eae14 100644
--- a/packages/maker-shared/src/index.ts
+++ b/packages/maker-shared/src/index.ts
@@ -58,3 +58,4 @@ export * from './urlTextBoundary.js';
export * from './workActivityProjection.js';
export * from './worktreePaths.js';
export * from './sessionPrRefs.js';
+export * from './taskTags';
diff --git a/packages/maker-shared/src/sessionList.ts b/packages/maker-shared/src/sessionList.ts
index 64a19ece1d..8fabf64d0a 100644
--- a/packages/maker-shared/src/sessionList.ts
+++ b/packages/maker-shared/src/sessionList.ts
@@ -11,6 +11,7 @@ import { getSessionListCollapseView } from './sessionListCollapse.js';
import { collapseWorktreeDirForGrouping } from './worktreePaths.js';
export interface RemoteSessionListSessionLike extends SessionInterruptionState {
+ tags?: import('./taskTags').TaskTag[];
_count?: { messages?: number } | null;
agentKind: 'cc' | 'codex' | string;
createdAt: string;
diff --git a/packages/maker-shared/src/taskTags.test.ts b/packages/maker-shared/src/taskTags.test.ts
new file mode 100644
index 0000000000..470b94eb24
--- /dev/null
+++ b/packages/maker-shared/src/taskTags.test.ts
@@ -0,0 +1,76 @@
+import { describe, expect, it } from 'vitest';
+import {
+ normalizeTaskTags,
+ reconcileTaskTags,
+ taskTagEditRevision,
+ taskTagNameKey,
+ TASK_TAG_PRESETS,
+ type TaskTag,
+} from './taskTags';
+const tag = (
+ id: string,
+ color: TaskTag['color'] = 'red',
+ favoriteOrder: number | null = null,
+): TaskTag => ({ id, name: id, color, favoriteOrder, revision: 1 });
+
+it('keeps default names localized after recoloring without translating custom names', () => {
+ for (const color of ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray']) {
+ const original = {
+ ...tag(`default:${color}`, 'white'),
+ name: color[0].toUpperCase() + color.slice(1),
+ };
+ expect(taskTagNameKey(original)).toBe(`taskTags.${color}`);
+ expect(taskTagNameKey({ ...original, name: 'My label' })).toBeNull();
+ expect(taskTagNameKey({ ...original, nameCustomized: true })).toBeNull();
+ expect(taskTagNameKey({ ...original, id: 'custom' })).toBeNull();
+ }
+ for (const preset of TASK_TAG_PRESETS) {
+ expect(taskTagNameKey({ ...tag(preset.id),
+ name: preset.name,
+ nameCustomized: true,
+ }),
+ ).toBeNull();
+ expect(taskTagNameKey({ ...tag(preset.id, 'blue'), name: preset.name })).toBe(
+ `taskTags.${preset.key}`,
+ );
+ }
+});
+
+it('advances edit revisions only while the editable baseline remains unchanged', () => {
+ const editing = { ...tag('a'), revision: 3 };
+ expect(taskTagEditRevision(editing, [{ ...editing, revision: 5, sortOrder: 2 }])).toBe(5);
+ expect(taskTagEditRevision(editing, [{ ...editing, revision: 2 }])).toBe(3);
+ expect(taskTagEditRevision(editing, [{ ...editing, revision: 5, name: 'Other' }])).toBe(3);
+ expect(taskTagEditRevision(editing, [{ ...editing, revision: 5, color: 'blue' }])).toBe(3);
+ expect(taskTagEditRevision(editing, [])).toBe(3);
+ expect(
+ taskTagEditRevision(editing, [
+ { ...editing, revision: 5, nameCustomized: true },
+ ]),
+ ).toBe(3);
+});
+describe('task tag wire and cache projection', () => {
+ it('rejects invalid colors and caps malformed cache growth', () => {
+ expect(normalizeTaskTags([tag('a'), { ...tag('b'), color: 'url(secret)' }, null])).toEqual([
+ tag('a'),
+ ]);
+ expect(normalizeTaskTags(Array.from({ length: 40 }, (_, i) => tag(String(i))))).toHaveLength(
+ 32,
+ );
+ });
+ it('preserves membership while applying global rename/recolor/delete with stable ordering', () => {
+ const catalog = [tag('b', 'blue', 1), { ...tag('a', 'none', 0), name: 'Renamed' }, tag('new')];
+ expect(reconcileTaskTags([tag('deleted'), tag('a'), tag('b')], catalog)).toEqual([
+ catalog[1],
+ catalog[0],
+ ]);
+ expect(normalizeTaskTags([...catalog].reverse())).toEqual([catalog[1], catalog[0], catalog[2]]);
+ });
+});
+
+it('uses persisted positions before names and matches SQLite legacy unicode ordering', () => {
+ const a = { ...tag('a'), sortOrder: 2 };
+ const b = { ...tag('b'), sortOrder: 0 };
+ expect(normalizeTaskTags([a, b]).map((t) => t.id)).toEqual(['b', 'a']);
+ expect(normalizeTaskTags([tag('😀'), tag('\ue000')]).map((t) => t.id)).toEqual(['\ue000', '😀']);
+});
diff --git a/packages/maker-shared/src/taskTags.ts b/packages/maker-shared/src/taskTags.ts
new file mode 100644
index 0000000000..a044be117d
--- /dev/null
+++ b/packages/maker-shared/src/taskTags.ts
@@ -0,0 +1,185 @@
+/** Task labels belong to the owner database of the device hosting the task. */
+export const TASK_TAG_COLORS = [
+ 'red',
+ 'orange',
+ 'yellow',
+ 'green',
+ 'blue',
+ 'purple',
+ 'gray',
+ 'pink',
+ 'coral',
+ 'teal',
+ 'indigo',
+ 'white',
+] as const;
+export type TaskTagColor = (typeof TASK_TAG_COLORS)[number] | 'none';
+export interface TaskTag {
+ id: string;
+ name: string;
+ /** Explicit rename, including renaming a localized preset to its canonical name. */
+ nameCustomized?: boolean;
+ color: TaskTagColor;
+ favoriteOrder: number | null;
+ /** Missing on older hosts; legacy favorite ordering remains the fallback. */
+ sortOrder?: number | null;
+ revision: number;
+}
+/** Default names are localized for display until the user renames the tag. */
+export const TASK_TAG_PRESETS = [
+ {
+ id: 'preset:important',
+ name: 'Important',
+ color: 'coral',
+ key: 'presetImportant',
+ },
+ {
+ id: 'preset:follow-up',
+ name: 'Follow up',
+ color: 'pink',
+ key: 'presetFollowUp',
+ },
+ { id: 'preset:work', name: 'Work', color: 'indigo', key: 'presetWork' },
+ { id: 'preset:life', name: 'Life', color: 'teal', key: 'presetLife' },
+ { id: 'preset:ideas', name: 'Ideas', color: 'white', key: 'presetIdeas' },
+ {
+ id: 'preset:reference',
+ name: 'Reference',
+ color: 'gray',
+ key: 'presetReference',
+ },
+] as const;
+
+export function taskTagNameKey(tag: TaskTag): string | null {
+ if (tag.nameCustomized) return null;
+ const preset = TASK_TAG_PRESETS.find((item) => item.id === tag.id && item.name === tag.name);
+ if (preset) return `taskTags.${preset.key}`;
+ const originalColor = TASK_TAG_COLORS.find((color) => tag.id === `default:${color}`);
+ return originalColor && tag.name === originalColor[0].toUpperCase() + originalColor.slice(1)
+ ? `taskTags.${originalColor}`
+ : null;
+}
+
+export type TaskTagRequest =
+ | { action: 'list' }
+ | { action: 'reorder'; tagIds: string[]; expectedOrder: string[] }
+ | {
+ action: 'create';
+ name: string;
+ color: TaskTagColor;
+ favorite?: boolean;
+ /** Explicit preset creation; name and color must match its canonical definition. */
+ presetId?: (typeof TASK_TAG_PRESETS)[number]['id'];
+ }
+ | {
+ action: 'update';
+ tagId: string;
+ revision: number;
+ name?: string;
+ /** Additive intent; legacy clients also send unchanged names when recoloring. */
+ nameCustomized?: true;
+ color?: TaskTagColor;
+ favorite?: boolean;
+ }
+ | { action: 'previewDelete'; tagId: string }
+ | { action: 'delete'; tagId: string; revision: number; expectedCount: number }
+ | { action: 'attach' | 'detach'; sessionIds: string[]; tagIds: string[] }
+ | { action: 'get'; sessionIds: string[] }
+ | { action: 'find'; tagId: string; offset?: number; limit?: number };
+export interface TaskTagResult {
+ supportedColors?: TaskTagColor[];
+ tags: TaskTag[];
+ sessions: Array<{ sessionId: string; tags: TaskTag[] }>;
+ deletion?: { tagId: string; revision: number; count: number };
+ hasMore?: boolean;
+}
+/** Wire/cache guard: old hosts omit the field, malformed data never becomes a color. */
+export function normalizeTaskTags(value: unknown, limit = 32): TaskTag[] {
+ if (!Array.isArray(value)) return [];
+ return value
+ .slice(0, limit)
+ .filter(
+ (tag): tag is TaskTag =>
+ !!tag &&
+ typeof tag === 'object' &&
+ typeof tag.id === 'string' &&
+ tag.id.length <= 128 &&
+ typeof tag.name === 'string' &&
+ tag.name.length <= 80 &&
+ (tag.nameCustomized === undefined ||
+ typeof tag.nameCustomized === 'boolean') &&
+ (tag.color === 'none' || TASK_TAG_COLORS.includes(tag.color)) &&
+ typeof tag.revision === 'number' &&
+ (tag.sortOrder == null || (Number.isInteger(tag.sortOrder) && tag.sortOrder >= 0)) &&
+ (tag.favoriteOrder === null || Number.isInteger(tag.favoriteOrder)),
+ )
+ .sort(compareTaskTags);
+}
+
+/** Same deterministic color-ball order for SQL snapshots, pushes and caches. */
+export function compareTaskTags(a: TaskTag, b: TaskTag): number {
+ const rank = (a.sortOrder ?? Number.MAX_SAFE_INTEGER) - (b.sortOrder ?? Number.MAX_SAFE_INTEGER);
+ if (rank) return rank;
+ const order =
+ (a.favoriteOrder ?? Number.MAX_SAFE_INTEGER) - (b.favoriteOrder ?? Number.MAX_SAFE_INTEGER);
+ const compareText = (left: string, right: string) => {
+ const a = Array.from(left),
+ b = Array.from(right);
+ for (let index = 0; index < Math.min(a.length, b.length); index++) {
+ const difference = a[index].codePointAt(0)! - b[index].codePointAt(0)!;
+ if (difference) return difference;
+ }
+ return a.length - b.length;
+ };
+ // Match SQLite BINARY (UTF-8/codepoint), including supplementary-plane names.
+ return order || compareText(a.name, b.name) || compareText(a.id, b.id);
+}
+export function reconcileTaskTags(
+ current: readonly TaskTag[] | undefined,
+ catalog: readonly TaskTag[],
+): TaskTag[] {
+ const ids = new Set((current ?? []).map((tag) => tag.id));
+ return catalog.filter((tag) => ids.has(tag.id)).sort(compareTaskTags);
+}
+
+/** Association/order changes advance the version without changing the edit baseline. */
+export function taskTagEditRevision(editing: TaskTag, catalog: readonly TaskTag[]): number {
+ const latest = catalog.find((tag) => tag.id === editing.id);
+ return latest && latest.name === editing.name && latest.color === editing.color &&
+ !!latest.nameCustomized === !!editing.nameCustomized
+ ? Math.max(editing.revision, latest.revision)
+ : editing.revision;
+}
+
+/** Device-link errors carry code separately from Error.message. */
+export function taskTagErrorKey(error: unknown, action: TaskTagRequest['action']): string {
+ const value = error as {
+ code?: unknown;
+ message?: unknown;
+ error?: { code?: unknown; message?: unknown };
+ } | null;
+ const code =
+ value && typeof value === 'object' ? String(value.code ?? value.error?.code ?? '') : '';
+ const message =
+ value && typeof value === 'object'
+ ? String(value.message ?? value.error?.message ?? error)
+ : String(error);
+ if (
+ ['CHANNEL_NOT_ALLOWED', 'UNKNOWN_CHANNEL', 'UNSUPPORTED_CHANNEL', 'METHOD_NOT_FOUND'].includes(
+ code,
+ ) ||
+ /CHANNEL_NOT_ALLOWED|No handler|not supported|not allowed remotely|unknown channel/i.test(
+ message,
+ )
+ )
+ return 'unavailable';
+ if (
+ ['DEVICE_OFFLINE', 'NOT_CONNECTED', 'LINK_NOT_OPEN'].includes(code) ||
+ /OFFLINE|disconnected/i.test(message)
+ )
+ return 'offline';
+ if (code === 'CONFLICT' || /\[CONFLICT\]/.test(message)) return 'conflict';
+ if (code === 'FAVORITES_FULL' || /\[FAVORITES_FULL\]/.test(message)) return 'favoritesFull';
+ if (code === 'ALREADY_EXISTS' || /\[ALREADY_EXISTS\]/.test(message)) return 'alreadyExists';
+ return ['get', 'list', 'find', 'previewDelete'].includes(action) ? 'loadFailed' : 'failed';
+}