From 9e804eef3f115f6e52bd54f5f73b4c6cdb895935 Mon Sep 17 00:00:00 2001
From: "(CJ) Chukwudi Nwobodo" <142016413+chuks-qua@users.noreply.github.com>
Date: Fri, 23 Oct 2026 13:43:19 +0100
Subject: [PATCH 1/4] feat(contracts): add the HTML visual message field
A system message can carry a self-contained HTML page with a title and a
requested height. The page is capped at 512 KiB of UTF-8 so one visual
always fits a conversation history page.
---
.../src/__tests__/html-visual.test.ts | 47 +++++++++++++++++++
packages/contracts/src/index.ts | 10 ++++
packages/contracts/src/models/html-visual.ts | 39 +++++++++++++++
packages/contracts/src/models/message.ts | 3 ++
4 files changed, 99 insertions(+)
create mode 100644 packages/contracts/src/__tests__/html-visual.test.ts
create mode 100644 packages/contracts/src/models/html-visual.ts
diff --git a/packages/contracts/src/__tests__/html-visual.test.ts b/packages/contracts/src/__tests__/html-visual.test.ts
new file mode 100644
index 000000000..77dd40ce3
--- /dev/null
+++ b/packages/contracts/src/__tests__/html-visual.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it } from "vitest";
+import { HtmlVisualSchema, MessageSchema } from "../index.js";
+
+const visual = { title: "Latency by provider", html: "
chart
", maxHeight: 480 };
+
+describe("HtmlVisualSchema", () => {
+ it("accepts a page at the 512 KiB limit", () => {
+ const html = "x".repeat(524_288);
+ expect(HtmlVisualSchema().parse({ ...visual, html }).html).toHaveLength(524_288);
+ });
+
+ it("rejects a page over the limit", () => {
+ expect(HtmlVisualSchema().safeParse({ ...visual, html: "x".repeat(524_289) }).success).toBe(false);
+ });
+
+ it("measures the limit in UTF-8 bytes, not characters", () => {
+ // "é" is two UTF-8 bytes, so this page is 524,290 bytes in 262,145 characters.
+ expect(HtmlVisualSchema().safeParse({ ...visual, html: "é".repeat(262_145) }).success).toBe(false);
+ });
+
+ it("rejects an empty page and a blank title", () => {
+ expect(HtmlVisualSchema().safeParse({ ...visual, html: "" }).success).toBe(false);
+ expect(HtmlVisualSchema().safeParse({ ...visual, title: " " }).success).toBe(false);
+ });
+
+ it("bounds the requested height to 80..2000 whole pixels", () => {
+ expect(HtmlVisualSchema().safeParse({ ...visual, maxHeight: 80 }).success).toBe(true);
+ expect(HtmlVisualSchema().safeParse({ ...visual, maxHeight: 2000 }).success).toBe(true);
+ expect(HtmlVisualSchema().safeParse({ ...visual, maxHeight: 79 }).success).toBe(false);
+ expect(HtmlVisualSchema().safeParse({ ...visual, maxHeight: 2001 }).success).toBe(false);
+ expect(HtmlVisualSchema().safeParse({ ...visual, maxHeight: 300.5 }).success).toBe(false);
+ });
+
+ it("rejects unknown fields", () => {
+ expect(HtmlVisualSchema().safeParse({ ...visual, sandbox: "allow-same-origin" }).success).toBe(false);
+ });
+
+ it("travels on a message and rejects a malformed one", () => {
+ const message = {
+ id: "m1", thread_id: "t1", role: "system", content: "Visual: Latency by provider",
+ tool_calls: null, files_changed: null, cost_usd: null, tokens_used: null,
+ timestamp: "2026-10-23T00:00:00.000Z", sequence: 2, attachments: null,
+ };
+ expect(MessageSchema().parse({ ...message, visual }).visual).toEqual(visual);
+ expect(MessageSchema().safeParse({ ...message, visual: { ...visual, maxHeight: 0 } }).success).toBe(false);
+ });
+});
diff --git a/packages/contracts/src/index.ts b/packages/contracts/src/index.ts
index 1bfbbb5ac..0fdc71035 100644
--- a/packages/contracts/src/index.ts
+++ b/packages/contracts/src/index.ts
@@ -354,6 +354,16 @@ export type {
DelegatedTaskNoticeStatus,
} from "./models/message.js";
+export {
+ HtmlVisualSchema,
+ HTML_VISUAL_MAX_HTML_BYTES,
+ HTML_VISUAL_MIN_HEIGHT,
+ HTML_VISUAL_MAX_HEIGHT,
+ HTML_VISUAL_MAX_TITLE_LENGTH,
+ HTML_VISUAL_THEME_TOKENS,
+} from "./models/html-visual.js";
+export type { HtmlVisual } from "./models/html-visual.js";
+
export {
MessageMentionSchema,
MessageMentionsSchema,
diff --git a/packages/contracts/src/models/html-visual.ts b/packages/contracts/src/models/html-visual.ts
new file mode 100644
index 000000000..2af171e18
--- /dev/null
+++ b/packages/contracts/src/models/html-visual.ts
@@ -0,0 +1,39 @@
+import { z } from "zod";
+import { lazySchema } from "../utils/lazySchema.js";
+
+/**
+ * Largest page an HTML visual may carry, in UTF-8 bytes. Inlined images count toward it.
+ * Even fully JSON-escaped, a page this size fits one conversation history page budget.
+ */
+export const HTML_VISUAL_MAX_HTML_BYTES = 512 * 1024;
+/** Smallest frame height, in CSS pixels, a visual may request or be drawn at. */
+export const HTML_VISUAL_MIN_HEIGHT = 80;
+/** Largest frame height, in CSS pixels, a visual may request. Taller pages scroll inside the frame. */
+export const HTML_VISUAL_MAX_HEIGHT = 2000;
+/** Longest title, used as the frame's accessible name and the plain-text fallback. */
+export const HTML_VISUAL_MAX_TITLE_LENGTH = 200;
+
+/**
+ * App design tokens injected into every visual's `:root` as CSS custom properties.
+ * They follow the user's light or dark mode live, so pages can match the thread without hardcoded colours.
+ */
+export const HTML_VISUAL_THEME_TOKENS = [
+ "--background", "--ink", "--muted", "--panel", "--hover", "--selected", "--field",
+ "--border", "--control-border", "--focus", "--link", "--primary", "--primary-ink",
+ "--destructive", "--destructive-ink", "--success", "--error", "--warning", "--info",
+ "--font-sans", "--font-mono",
+] as const;
+
+/** A self-contained HTML page shown in a sandboxed frame in the thread timeline. */
+export const HtmlVisualSchema = lazySchema(() => z.object({
+ title: z.string().trim().min(1).max(HTML_VISUAL_MAX_TITLE_LENGTH),
+ html: z.string().min(1).max(HTML_VISUAL_MAX_HTML_BYTES)
+ .refine((html) => new TextEncoder().encode(html).length <= HTML_VISUAL_MAX_HTML_BYTES, {
+ message: `HTML visual exceeds ${HTML_VISUAL_MAX_HTML_BYTES} UTF-8 bytes`,
+ }),
+ /** The frame grows with its content up to this height, then scrolls. */
+ maxHeight: z.number().int().min(HTML_VISUAL_MIN_HEIGHT).max(HTML_VISUAL_MAX_HEIGHT),
+}).strict());
+
+/** A self-contained HTML page shown in a sandboxed frame in the thread timeline. */
+export type HtmlVisual = z.infer>;
diff --git a/packages/contracts/src/models/message.ts b/packages/contracts/src/models/message.ts
index ccf3f2300..6f7a4512c 100644
--- a/packages/contracts/src/models/message.ts
+++ b/packages/contracts/src/models/message.ts
@@ -7,6 +7,7 @@ import { SelectedTextCommentsSchema } from "./selected-text-comment.js";
import { PreviewAnnotationBundleSchema } from "./browser-preview.js";
import { ProviderIdentitySchema } from "../compat/agent-model.js";
import { TurnOutcomeSchema } from "./turn-outcome.js";
+import { HtmlVisualSchema } from "./html-visual.js";
/** Canonical provenance for a user-side message sent by a parent agent. */
export const ParentAgentMessageProvenanceSchema = lazySchema(() => z.object({
@@ -155,6 +156,8 @@ export const MessageSchema = lazySchema(() =>
systemNotice: SystemNoticeMetadataSchema().nullable().optional(),
/** Set on the system message that marks a provider switch in the timeline. */
providerSwitch: ProviderSwitchMarkerSchema().nullable().optional(),
+ /** Set on the system message that shows an HTML visual in the timeline. */
+ visual: HtmlVisualSchema().nullable().optional(),
/**
* When true, mcode hides this message from the chat timeline.
* Used for hidden handoff turns on Cursor parent threads.
From 89383dc3113923abb138b617949fd97185267aaa Mon Sep 17 00:00:00 2001
From: "(CJ) Chukwudi Nwobodo" <142016413+chuks-qua@users.noreply.github.com>
Date: Fri, 23 Oct 2026 13:43:19 +0100
Subject: [PATCH 2/4] feat(server): persist HTML visuals with the turn
Store the visual as JSON on a system message, return it on conversation
pages and the tail, and add MessageStore.createVisual for the upcoming
html_render tool. Its text names the visual for readers without the frame.
---
.../drizzle/0099_quiet_master_chief.sql | 1 +
apps/server/drizzle/meta/0099_snapshot.json | 6452 +++++++++++++++++
apps/server/drizzle/meta/_journal.json | 7 +
.../__tests__/message-repo.test.ts | 1 +
.../conversation/persistence/message-store.ts | 17 +
.../__tests__/conversation-page.test.ts | 30 +
.../read-model/conversation-page.ts | 1 +
.../src/runtime/persistence/sqlite/schema.ts | 2 +
8 files changed, 6511 insertions(+)
create mode 100644 apps/server/drizzle/0099_quiet_master_chief.sql
create mode 100644 apps/server/drizzle/meta/0099_snapshot.json
diff --git a/apps/server/drizzle/0099_quiet_master_chief.sql b/apps/server/drizzle/0099_quiet_master_chief.sql
new file mode 100644
index 000000000..3205ea062
--- /dev/null
+++ b/apps/server/drizzle/0099_quiet_master_chief.sql
@@ -0,0 +1 @@
+ALTER TABLE `messages` ADD `visual` text;
\ No newline at end of file
diff --git a/apps/server/drizzle/meta/0099_snapshot.json b/apps/server/drizzle/meta/0099_snapshot.json
new file mode 100644
index 000000000..a28fec0b9
--- /dev/null
+++ b/apps/server/drizzle/meta/0099_snapshot.json
@@ -0,0 +1,6452 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "b340670a-28ef-4629-8361-108c18392316",
+ "prevId": "cbeb4668-197d-477d-9137-b40ad7a8d88d",
+ "tables": {
+ "approval_receipts": {
+ "name": "approval_receipts",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_call_id": {
+ "name": "tool_call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "subject_label": {
+ "name": "subject_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "origin": {
+ "name": "origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "decided_at": {
+ "name": "decided_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_approval_receipts_message_sort_order_id": {
+ "name": "idx_approval_receipts_message_sort_order_id",
+ "columns": [
+ "message_id",
+ "sort_order",
+ "id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "approval_receipts_message_id_messages_id_fk": {
+ "name": "approval_receipts_message_id_messages_id_fk",
+ "tableFrom": "approval_receipts",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_agent_events": {
+ "name": "canonical_agent_events",
+ "columns": {
+ "event_id": {
+ "name": "event_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accepted_sequence": {
+ "name": "accepted_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "durable_revision": {
+ "name": "durable_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "roster_revision": {
+ "name": "roster_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "envelope_json": {
+ "name": "envelope_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "persisted_at": {
+ "name": "persisted_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_canonical_agent_events_execution_sequence": {
+ "name": "idx_canonical_agent_events_execution_sequence",
+ "columns": [
+ "execution_id",
+ "accepted_sequence"
+ ],
+ "isUnique": true
+ },
+ "idx_canonical_agent_events_thread_revision": {
+ "name": "idx_canonical_agent_events_thread_revision",
+ "columns": [
+ "thread_id",
+ "durable_revision"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_agent_events_thread_id_canonical_agent_threads_id_fk": {
+ "name": "canonical_agent_events_thread_id_canonical_agent_threads_id_fk",
+ "tableFrom": "canonical_agent_events",
+ "tableTo": "canonical_agent_threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_agent_ingest_checkpoints": {
+ "name": "canonical_agent_ingest_checkpoints",
+ "columns": {
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_accepted_sequence": {
+ "name": "last_accepted_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_durable_sequence": {
+ "name": "last_durable_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "native_cursor_json": {
+ "name": "native_cursor_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "terminal_outcome": {
+ "name": "terminal_outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recovery_incident_id": {
+ "name": "recovery_incident_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_canonical_agent_checkpoints_thread": {
+ "name": "idx_canonical_agent_checkpoints_thread",
+ "columns": [
+ "thread_id",
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "idx_canonical_agent_checkpoints_recovery_incident": {
+ "name": "idx_canonical_agent_checkpoints_recovery_incident",
+ "columns": [
+ "recovery_incident_id",
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_agent_ingest_checkpoints_thread_id_canonical_agent_threads_id_fk": {
+ "name": "canonical_agent_ingest_checkpoints_thread_id_canonical_agent_threads_id_fk",
+ "tableFrom": "canonical_agent_ingest_checkpoints",
+ "tableTo": "canonical_agent_threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "canonical_agent_ingest_checkpoints_turn_id_canonical_agent_turns_id_fk": {
+ "name": "canonical_agent_ingest_checkpoints_turn_id_canonical_agent_turns_id_fk",
+ "tableFrom": "canonical_agent_ingest_checkpoints",
+ "tableTo": "canonical_agent_turns",
+ "columnsFrom": [
+ "turn_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_agent_items": {
+ "name": "canonical_agent_items",
+ "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
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parent_item_id": {
+ "name": "parent_item_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_identities_json": {
+ "name": "provider_identities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_canonical_agent_items_turn": {
+ "name": "idx_canonical_agent_items_turn",
+ "columns": [
+ "turn_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "idx_canonical_agent_items_thread": {
+ "name": "idx_canonical_agent_items_thread",
+ "columns": [
+ "thread_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "idx_canonical_agent_items_created_id": {
+ "name": "idx_canonical_agent_items_created_id",
+ "columns": [
+ "created_at",
+ "id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_agent_items_thread_id_canonical_agent_threads_id_fk": {
+ "name": "canonical_agent_items_thread_id_canonical_agent_threads_id_fk",
+ "tableFrom": "canonical_agent_items",
+ "tableTo": "canonical_agent_threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "canonical_agent_items_turn_id_canonical_agent_turns_id_fk": {
+ "name": "canonical_agent_items_turn_id_canonical_agent_turns_id_fk",
+ "tableFrom": "canonical_agent_items",
+ "tableTo": "canonical_agent_turns",
+ "columnsFrom": [
+ "turn_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_agent_threads": {
+ "name": "canonical_agent_threads",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parent_thread_id": {
+ "name": "parent_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "root_thread_id": {
+ "name": "root_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owning_parent_thread_id": {
+ "name": "owning_parent_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_identities_json": {
+ "name": "provider_identities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "activity_state": {
+ "name": "activity_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "conversation_revision": {
+ "name": "conversation_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "roster_revision": {
+ "name": "roster_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_canonical_agent_threads_workspace": {
+ "name": "idx_canonical_agent_threads_workspace",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "idx_canonical_agent_threads_root": {
+ "name": "idx_canonical_agent_threads_root",
+ "columns": [
+ "root_thread_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_agent_threads_id_threads_id_fk": {
+ "name": "canonical_agent_threads_id_threads_id_fk",
+ "tableFrom": "canonical_agent_threads",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "canonical_agent_threads_workspace_id_workspaces_id_fk": {
+ "name": "canonical_agent_threads_workspace_id_workspaces_id_fk",
+ "tableFrom": "canonical_agent_threads",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_agent_turns": {
+ "name": "canonical_agent_turns",
+ "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
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attempt_of": {
+ "name": "attempt_of",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "trigger_json": {
+ "name": "trigger_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission_mode": {
+ "name": "permission_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "approval_review_mode": {
+ "name": "approval_review_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'manual'"
+ },
+ "approval_review_reason": {
+ "name": "approval_review_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'manual-requested'"
+ },
+ "provider_identities_json": {
+ "name": "provider_identities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_started_at": {
+ "name": "provider_started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "ending_json": {
+ "name": "ending_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_canonical_agent_turns_execution": {
+ "name": "idx_canonical_agent_turns_execution",
+ "columns": [
+ "execution_id"
+ ],
+ "isUnique": true
+ },
+ "idx_canonical_agent_turns_attempt_of": {
+ "name": "idx_canonical_agent_turns_attempt_of",
+ "columns": [
+ "attempt_of"
+ ],
+ "isUnique": false
+ },
+ "idx_canonical_agent_turns_thread": {
+ "name": "idx_canonical_agent_turns_thread",
+ "columns": [
+ "thread_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_agent_turns_thread_id_canonical_agent_threads_id_fk": {
+ "name": "canonical_agent_turns_thread_id_canonical_agent_threads_id_fk",
+ "tableFrom": "canonical_agent_turns",
+ "tableTo": "canonical_agent_threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_collaboration_actions": {
+ "name": "canonical_collaboration_actions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_thread_id": {
+ "name": "source_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_turn_id": {
+ "name": "source_turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_item_id": {
+ "name": "source_item_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_thread_id": {
+ "name": "target_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_turn_id": {
+ "name": "target_turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "delivery_unknown": {
+ "name": "delivery_unknown",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_identities_json": {
+ "name": "provider_identities_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_canonical_collaboration_source": {
+ "name": "idx_canonical_collaboration_source",
+ "columns": [
+ "source_thread_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "idx_canonical_collaboration_target": {
+ "name": "idx_canonical_collaboration_target",
+ "columns": [
+ "target_thread_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_conversation_display_mappings": {
+ "name": "canonical_conversation_display_mappings",
+ "columns": {
+ "source_item_id": {
+ "name": "source_item_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_kind": {
+ "name": "target_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_updated_at": {
+ "name": "source_updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_canonical_conversation_display_mappings_target": {
+ "name": "idx_canonical_conversation_display_mappings_target",
+ "columns": [
+ "target_kind",
+ "target_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_conversation_display_mappings_source_item_id_canonical_agent_items_id_fk": {
+ "name": "canonical_conversation_display_mappings_source_item_id_canonical_agent_items_id_fk",
+ "tableFrom": "canonical_conversation_display_mappings",
+ "tableTo": "canonical_agent_items",
+ "columnsFrom": [
+ "source_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_legacy_message_provenance": {
+ "name": "canonical_legacy_message_provenance",
+ "columns": {
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "migration_version": {
+ "name": "migration_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mapping_status": {
+ "name": "mapping_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "canonical_thread_id": {
+ "name": "canonical_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "canonical_turn_id": {
+ "name": "canonical_turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "canonical_item_id": {
+ "name": "canonical_item_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_canonical_legacy_message_mapping": {
+ "name": "idx_canonical_legacy_message_mapping",
+ "columns": [
+ "mapping_status",
+ "message_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_legacy_message_provenance_message_id_messages_id_fk": {
+ "name": "canonical_legacy_message_provenance_message_id_messages_id_fk",
+ "tableFrom": "canonical_legacy_message_provenance",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_legacy_migration_checkpoints": {
+ "name": "canonical_legacy_migration_checkpoints",
+ "columns": {
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "migrated_messages": {
+ "name": "migrated_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "ambiguous_messages": {
+ "name": "ambiguous_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_writer_live_publication_heads": {
+ "name": "canonical_writer_live_publication_heads",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_sequence": {
+ "name": "last_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "canonical_writer_live_publication_heads_thread_id_threads_id_fk": {
+ "name": "canonical_writer_live_publication_heads_thread_id_threads_id_fk",
+ "tableFrom": "canonical_writer_live_publication_heads",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_writer_operation_receipts": {
+ "name": "canonical_writer_operation_receipts",
+ "columns": {
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "operation_id": {
+ "name": "operation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "input_hash": {
+ "name": "input_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "receipt_json": {
+ "name": "receipt_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "canonical_writer_operation_receipts_execution_id_canonical_agent_turns_execution_id_fk": {
+ "name": "canonical_writer_operation_receipts_execution_id_canonical_agent_turns_execution_id_fk",
+ "tableFrom": "canonical_writer_operation_receipts",
+ "tableTo": "canonical_agent_turns",
+ "columnsFrom": [
+ "execution_id"
+ ],
+ "columnsTo": [
+ "execution_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "canonical_writer_operation_receipts_execution_id_operation_id_pk": {
+ "columns": [
+ "execution_id",
+ "operation_id"
+ ],
+ "name": "canonical_writer_operation_receipts_execution_id_operation_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "canonical_writer_thread_operation_receipts": {
+ "name": "canonical_writer_thread_operation_receipts",
+ "columns": {
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "operation_id": {
+ "name": "operation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "input_hash": {
+ "name": "input_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "receipt_json": {
+ "name": "receipt_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_canonical_writer_thread_receipts_thread": {
+ "name": "idx_canonical_writer_thread_receipts_thread",
+ "columns": [
+ "thread_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "canonical_writer_thread_operation_receipts_thread_id_canonical_agent_threads_id_fk": {
+ "name": "canonical_writer_thread_operation_receipts_thread_id_canonical_agent_threads_id_fk",
+ "tableFrom": "canonical_writer_thread_operation_receipts",
+ "tableTo": "canonical_agent_threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "canonical_writer_thread_operation_receipts_execution_id_operation_id_pk": {
+ "columns": [
+ "execution_id",
+ "operation_id"
+ ],
+ "name": "canonical_writer_thread_operation_receipts_execution_id_operation_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {
+ "canonical_writer_thread_receipts_append_only": {
+ "name": "canonical_writer_thread_receipts_append_only",
+ "value": "\"canonical_writer_thread_operation_receipts\".\"kind\" = 'append-accepted'"
+ }
+ }
+ },
+ "cleanup_jobs": {
+ "name": "cleanup_jobs",
+ "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
+ },
+ "workspace_path": {
+ "name": "workspace_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "branch": {
+ "name": "branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'explicit'"
+ },
+ "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,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "cleanup_jobs_thread_id_unique": {
+ "name": "cleanup_jobs_thread_id_unique",
+ "columns": [
+ "thread_id"
+ ],
+ "isUnique": true
+ },
+ "idx_cleanup_jobs_retry": {
+ "name": "idx_cleanup_jobs_retry",
+ "columns": [
+ "next_retry_at",
+ "attempts",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "conversation_display_materialization_state": {
+ "name": "conversation_display_materialization_state",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_source_created_at": {
+ "name": "last_source_created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_source_id": {
+ "name": "last_source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completed": {
+ "name": "completed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "delegated_tasks": {
+ "name": "delegated_tasks",
+ "columns": {
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "coordinator_thread_id": {
+ "name": "coordinator_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "client_request_id": {
+ "name": "client_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "input_fingerprint": {
+ "name": "input_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "plan_json": {
+ "name": "plan_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "notice_delivered": {
+ "name": "notice_delivered",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notice_claim": {
+ "name": "notice_claim",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_delegated_tasks_coordinator_request": {
+ "name": "idx_delegated_tasks_coordinator_request",
+ "columns": [
+ "coordinator_thread_id",
+ "client_request_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "delegated_tasks_coordinator_thread_id_threads_id_fk": {
+ "name": "delegated_tasks_coordinator_thread_id_threads_id_fk",
+ "tableFrom": "delegated_tasks",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "coordinator_thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "external_thread_control_deliveries": {
+ "name": "external_thread_control_deliveries",
+ "columns": {
+ "pairing_id": {
+ "name": "pairing_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "authority_epoch": {
+ "name": "authority_epoch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "delivery_id": {
+ "name": "delivery_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fingerprint": {
+ "name": "fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'in_flight'"
+ },
+ "result_json": {
+ "name": "result_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_external_thread_control_delivery_identity": {
+ "name": "idx_external_thread_control_delivery_identity",
+ "columns": [
+ "pairing_id",
+ "authority_epoch",
+ "delivery_id"
+ ],
+ "isUnique": true
+ },
+ "idx_external_thread_control_delivery_retention": {
+ "name": "idx_external_thread_control_delivery_retention",
+ "columns": [
+ "pairing_id",
+ "status",
+ "expires_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "external_thread_control_pairings": {
+ "name": "external_thread_control_pairings",
+ "columns": {
+ "pairing_id": {
+ "name": "pairing_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "credential_hash": {
+ "name": "credential_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_ids_json": {
+ "name": "workspace_ids_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "scopes_json": {
+ "name": "scopes_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "calls_per_minute": {
+ "name": "calls_per_minute",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "max_active_threads": {
+ "name": "max_active_threads",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "authority_epoch": {
+ "name": "authority_epoch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "replaced_by_pairing_id": {
+ "name": "replaced_by_pairing_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "replaces_pairing_id": {
+ "name": "replaces_pairing_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "external_thread_control_pairings_credential_hash_unique": {
+ "name": "external_thread_control_pairings_credential_hash_unique",
+ "columns": [
+ "credential_hash"
+ ],
+ "isUnique": true
+ },
+ "idx_external_thread_control_pairings_integration": {
+ "name": "idx_external_thread_control_pairings_integration",
+ "columns": [
+ "integration_id",
+ "status"
+ ],
+ "isUnique": false
+ },
+ "idx_external_thread_control_active_integration": {
+ "name": "idx_external_thread_control_active_integration",
+ "columns": [
+ "integration_id"
+ ],
+ "isUnique": true,
+ "where": "status = 'active'"
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "git_commit_requests": {
+ "name": "git_commit_requests",
+ "columns": {
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "repo_path": {
+ "name": "repo_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "inputs_hash": {
+ "name": "inputs_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "original_head": {
+ "name": "original_head",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "branch": {
+ "name": "branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "commit_sha": {
+ "name": "commit_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "rejection": {
+ "name": "rejection",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "push_destination": {
+ "name": "push_destination",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "push_state": {
+ "name": "push_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "push_failure": {
+ "name": "push_failure",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "prepared_at": {
+ "name": "prepared_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_git_commit_requests_state": {
+ "name": "idx_git_commit_requests_state",
+ "columns": [
+ "state"
+ ],
+ "isUnique": false
+ },
+ "idx_git_commit_requests_prepared_at": {
+ "name": "idx_git_commit_requests_prepared_at",
+ "columns": [
+ "prepared_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "git_commit_requests_workspace_id_workspaces_id_fk": {
+ "name": "git_commit_requests_workspace_id_workspaces_id_fk",
+ "tableFrom": "git_commit_requests",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "git_commit_requests_thread_id_threads_id_fk": {
+ "name": "git_commit_requests_thread_id_threads_id_fk",
+ "tableFrom": "git_commit_requests",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {
+ "git_commit_requests_state": {
+ "name": "git_commit_requests_state",
+ "value": "\"git_commit_requests\".\"state\" IN ('prepared', 'committed', 'rejected', 'unknown')"
+ },
+ "git_commit_requests_push_state": {
+ "name": "git_commit_requests_push_state",
+ "value": "\"git_commit_requests\".\"push_state\" IN ('skipped', 'pending', 'pushed', 'failed')"
+ }
+ }
+ },
+ "hook_executions": {
+ "name": "hook_executions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hook_name": {
+ "name": "hook_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "did_block": {
+ "name": "did_block",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "idx_hook_executions_message_sort_order_id": {
+ "name": "idx_hook_executions_message_sort_order_id",
+ "columns": [
+ "message_id",
+ "sort_order",
+ "id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "hook_executions_message_id_messages_id_fk": {
+ "name": "hook_executions_message_id_messages_id_fk",
+ "tableFrom": "hook_executions",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "mcode_schema_compatibility": {
+ "name": "mcode_schema_compatibility",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "floor_when": {
+ "name": "floor_when",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "raised_by": {
+ "name": "raised_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {
+ "mcode_schema_compatibility_single_row": {
+ "name": "mcode_schema_compatibility_single_row",
+ "value": "\"mcode_schema_compatibility\".\"id\" = 1"
+ }
+ }
+ },
+ "messages": {
+ "name": "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
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tool_calls": {
+ "name": "tool_calls",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "files_changed": {
+ "name": "files_changed",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cost_usd": {
+ "name": "cost_usd",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tokens_used": {
+ "name": "tokens_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attachments": {
+ "name": "attachments",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "preview_annotations": {
+ "name": "preview_annotations",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "mentions": {
+ "name": "mentions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "selected_text_comments": {
+ "name": "selected_text_comments",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reply_to_message_id": {
+ "name": "reply_to_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "quoted_text": {
+ "name": "quoted_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "origin_type": {
+ "name": "origin_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'legacy'"
+ },
+ "source_thread_id": {
+ "name": "source_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source_turn_id": {
+ "name": "source_turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source_provider_id": {
+ "name": "source_provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "legacy_provenance": {
+ "name": "legacy_provenance",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_agent_provenance": {
+ "name": "parent_agent_provenance",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "is_internal": {
+ "name": "is_internal",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "outcome_execution_id": {
+ "name": "outcome_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "system_notice": {
+ "name": "system_notice",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_switch": {
+ "name": "provider_switch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "visual": {
+ "name": "visual",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_messages_thread": {
+ "name": "idx_messages_thread",
+ "columns": [
+ "thread_id"
+ ],
+ "isUnique": false
+ },
+ "idx_messages_sequence": {
+ "name": "idx_messages_sequence",
+ "columns": [
+ "thread_id",
+ "sequence"
+ ],
+ "isUnique": false
+ },
+ "idx_messages_thread_sequence_id": {
+ "name": "idx_messages_thread_sequence_id",
+ "columns": [
+ "thread_id",
+ "sequence",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "idx_messages_notice_session_sequence": {
+ "name": "idx_messages_notice_session_sequence",
+ "columns": [
+ "thread_id",
+ "json_extract(\"system_notice\", '$.sessionId')",
+ "\"sequence\" desc"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "messages_thread_id_threads_id_fk": {
+ "name": "messages_thread_id_threads_id_fk",
+ "tableFrom": "messages",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "messages_reply_to_message_id_messages_id_fk": {
+ "name": "messages_reply_to_message_id_messages_id_fk",
+ "tableFrom": "messages",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "reply_to_message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "parent_assistant_text_checkpoint_chunks": {
+ "name": "parent_assistant_text_checkpoint_chunks",
+ "columns": {
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_sequence": {
+ "name": "first_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_sequence": {
+ "name": "last_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "byte_length": {
+ "name": "byte_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_parent_assistant_text_checkpoint_chunks_sequence": {
+ "name": "idx_parent_assistant_text_checkpoint_chunks_sequence",
+ "columns": [
+ "execution_id",
+ "first_sequence"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "parent_assistant_text_checkpoint_chunks_execution_id_parent_assistant_text_checkpoints_execution_id_fk": {
+ "name": "parent_assistant_text_checkpoint_chunks_execution_id_parent_assistant_text_checkpoints_execution_id_fk",
+ "tableFrom": "parent_assistant_text_checkpoint_chunks",
+ "tableTo": "parent_assistant_text_checkpoints",
+ "columnsFrom": [
+ "execution_id"
+ ],
+ "columnsTo": [
+ "execution_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "parent_assistant_text_checkpoints": {
+ "name": "parent_assistant_text_checkpoints",
+ "columns": {
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_sequence": {
+ "name": "last_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "retained_bytes": {
+ "name": "retained_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "retained_chunks": {
+ "name": "retained_chunks",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_parent_assistant_text_checkpoints_thread": {
+ "name": "idx_parent_assistant_text_checkpoints_thread",
+ "columns": [
+ "thread_id",
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "parent_assistant_text_checkpoints_thread_id_canonical_agent_threads_id_fk": {
+ "name": "parent_assistant_text_checkpoints_thread_id_canonical_agent_threads_id_fk",
+ "tableFrom": "parent_assistant_text_checkpoints",
+ "tableTo": "canonical_agent_threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "parent_assistant_text_checkpoints_turn_id_canonical_agent_turns_id_fk": {
+ "name": "parent_assistant_text_checkpoints_turn_id_canonical_agent_turns_id_fk",
+ "tableFrom": "parent_assistant_text_checkpoints",
+ "tableTo": "canonical_agent_turns",
+ "columnsFrom": [
+ "turn_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "plan_comments": {
+ "name": "plan_comments",
+ "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
+ },
+ "version_id": {
+ "name": "version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "anchor_json": {
+ "name": "anchor_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "sent_message_id": {
+ "name": "sent_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "carried_from_comment_id": {
+ "name": "carried_from_comment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_plan_comments_version_status": {
+ "name": "idx_plan_comments_version_status",
+ "columns": [
+ "version_id",
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "plan_comments_thread_id_threads_id_fk": {
+ "name": "plan_comments_thread_id_threads_id_fk",
+ "tableFrom": "plan_comments",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "plan_comments_version_id_plans_id_fk": {
+ "name": "plan_comments_version_id_plans_id_fk",
+ "tableFrom": "plan_comments",
+ "tableTo": "plans",
+ "columnsFrom": [
+ "version_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "plan_implement_requests": {
+ "name": "plan_implement_requests",
+ "columns": {
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_thread_id": {
+ "name": "source_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fingerprint": {
+ "name": "fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "version_id": {
+ "name": "version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "wire_text": {
+ "name": "wire_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target": {
+ "name": "target",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_commit": {
+ "name": "source_commit",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "target_thread_id": {
+ "name": "target_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "startup_id": {
+ "name": "startup_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "native_plan_file_json": {
+ "name": "native_plan_file_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_plan_implement_preparing_thread": {
+ "name": "idx_plan_implement_preparing_thread",
+ "columns": [
+ "source_thread_id"
+ ],
+ "isUnique": true,
+ "where": "\"plan_implement_requests\".\"status\" = 'preparing'"
+ }
+ },
+ "foreignKeys": {
+ "plan_implement_requests_source_thread_id_threads_id_fk": {
+ "name": "plan_implement_requests_source_thread_id_threads_id_fk",
+ "tableFrom": "plan_implement_requests",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "source_thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "plan_question_answers": {
+ "name": "plan_question_answers",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assistant_message_id": {
+ "name": "assistant_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "answered_at": {
+ "name": "answered_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "native_batch_json": {
+ "name": "native_batch_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'answered'"
+ }
+ },
+ "indexes": {
+ "plan_question_answers_assistant_message_id_unique": {
+ "name": "plan_question_answers_assistant_message_id_unique",
+ "columns": [
+ "assistant_message_id"
+ ],
+ "isUnique": true
+ },
+ "idx_plan_question_answers_thread_answered_at": {
+ "name": "idx_plan_question_answers_thread_answered_at",
+ "columns": [
+ "thread_id",
+ "answered_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "plan_question_answers_assistant_message_id_messages_id_fk": {
+ "name": "plan_question_answers_assistant_message_id_messages_id_fk",
+ "tableFrom": "plan_question_answers",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "assistant_message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "plan_question_answers_thread_id_threads_id_fk": {
+ "name": "plan_question_answers_thread_id_threads_id_fk",
+ "tableFrom": "plan_question_answers",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "plans": {
+ "name": "plans",
+ "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
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content_md": {
+ "name": "content_md",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "capture_source": {
+ "name": "capture_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "base_version_id": {
+ "name": "base_version_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "native_plan_file_json": {
+ "name": "native_plan_file_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'draft'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_plans_thread": {
+ "name": "idx_plans_thread",
+ "columns": [
+ "thread_id"
+ ],
+ "isUnique": false
+ },
+ "idx_plans_thread_version": {
+ "name": "idx_plans_thread_version",
+ "columns": [
+ "thread_id",
+ "version"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "plans_thread_id_threads_id_fk": {
+ "name": "plans_thread_id_threads_id_fk",
+ "tableFrom": "plans",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "plans_message_id_messages_id_fk": {
+ "name": "plans_message_id_messages_id_fk",
+ "tableFrom": "plans",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_action_runs": {
+ "name": "project_action_runs",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "action_id": {
+ "name": "action_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "terminal_session_id": {
+ "name": "terminal_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'manual'"
+ },
+ "port_json": {
+ "name": "port_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "action_name": {
+ "name": "action_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "snapshot_json": {
+ "name": "snapshot_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "exit_code": {
+ "name": "exit_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_project_action_runs_slot": {
+ "name": "idx_project_action_runs_slot",
+ "columns": [
+ "thread_id",
+ "action_id"
+ ],
+ "isUnique": true
+ },
+ "idx_project_action_runs_thread": {
+ "name": "idx_project_action_runs_thread",
+ "columns": [
+ "thread_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "project_action_runs_thread_id_threads_id_fk": {
+ "name": "project_action_runs_thread_id_threads_id_fk",
+ "tableFrom": "project_action_runs",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_action_runs_workspace_id_workspaces_id_fk": {
+ "name": "project_action_runs_workspace_id_workspaces_id_fk",
+ "tableFrom": "project_action_runs",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "provider_catalog_snapshots": {
+ "name": "provider_catalog_snapshots",
+ "columns": {
+ "context_key": {
+ "name": "context_key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cwd": {
+ "name": "cwd",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "snapshot_json": {
+ "name": "snapshot_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_provider_catalog_snapshots_workspace": {
+ "name": "idx_provider_catalog_snapshots_workspace",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "idx_provider_catalog_snapshots_provider": {
+ "name": "idx_provider_catalog_snapshots_provider",
+ "columns": [
+ "provider_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "provider_catalog_snapshots_workspace_id_workspaces_id_fk": {
+ "name": "provider_catalog_snapshots_workspace_id_workspaces_id_fk",
+ "tableFrom": "provider_catalog_snapshots",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "provider_model_cache": {
+ "name": "provider_model_cache",
+ "columns": {
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "models_json": {
+ "name": "models_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fetched_at": {
+ "name": "fetched_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "model_count": {
+ "name": "model_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "provider_model_sightings": {
+ "name": "provider_model_sightings",
+ "columns": {
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "model_id": {
+ "name": "model_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "acknowledged_at": {
+ "name": "acknowledged_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "provider_model_sightings_provider_id_model_id_pk": {
+ "columns": [
+ "provider_id",
+ "model_id"
+ ],
+ "name": "provider_model_sightings_provider_id_model_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "pull_request_review_links": {
+ "name": "pull_request_review_links",
+ "columns": {
+ "worktree_id": {
+ "name": "worktree_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "repository_node_id": {
+ "name": "repository_node_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "pull_request_number": {
+ "name": "pull_request_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "pr_url": {
+ "name": "pr_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "pr_state": {
+ "name": "pr_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "worktree_managed": {
+ "name": "worktree_managed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "head_repository_node_id": {
+ "name": "head_repository_node_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "head_repository_owner": {
+ "name": "head_repository_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "head_repository_name": {
+ "name": "head_repository_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "head_ref": {
+ "name": "head_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "head_oid": {
+ "name": "head_oid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "local_branch": {
+ "name": "local_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "push_remote": {
+ "name": "push_remote",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "push_ref": {
+ "name": "push_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "managed_remote_name": {
+ "name": "managed_remote_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "primary_thread_id": {
+ "name": "primary_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_pull_request_review_links_identity": {
+ "name": "idx_pull_request_review_links_identity",
+ "columns": [
+ "provider",
+ "repository_node_id",
+ "pull_request_number"
+ ],
+ "isUnique": true
+ },
+ "idx_pull_request_review_links_primary_thread": {
+ "name": "idx_pull_request_review_links_primary_thread",
+ "columns": [
+ "primary_thread_id"
+ ],
+ "isUnique": true
+ },
+ "idx_pull_request_review_links_workspace": {
+ "name": "idx_pull_request_review_links_workspace",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "idx_pull_request_review_links_worktree_path": {
+ "name": "idx_pull_request_review_links_worktree_path",
+ "columns": [
+ "worktree_path"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "pull_request_review_links_workspace_id_workspaces_id_fk": {
+ "name": "pull_request_review_links_workspace_id_workspaces_id_fk",
+ "tableFrom": "pull_request_review_links",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "pull_request_review_links_primary_thread_id_threads_id_fk": {
+ "name": "pull_request_review_links_primary_thread_id_threads_id_fk",
+ "tableFrom": "pull_request_review_links",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "primary_thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "store_identity": {
+ "name": "store_identity",
+ "columns": {
+ "store_id": {
+ "name": "store_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "database_path": {
+ "name": "database_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "inherited_before": {
+ "name": "inherited_before",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "terminal_cleanup_ledger": {
+ "name": "terminal_cleanup_ledger",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "host_generation": {
+ "name": "host_generation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "root_pid": {
+ "name": "root_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "process_group_id": {
+ "name": "process_group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "containment": {
+ "name": "containment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "thought_segments": {
+ "name": "thought_segments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "is_final_response": {
+ "name": "is_final_response",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'narration'"
+ }
+ },
+ "indexes": {
+ "idx_thought_segments_message_final_sort_order_id": {
+ "name": "idx_thought_segments_message_final_sort_order_id",
+ "columns": [
+ "message_id",
+ "is_final_response",
+ "sort_order",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "idx_thought_segments_final_message_sort_order_id": {
+ "name": "idx_thought_segments_final_message_sort_order_id",
+ "columns": [
+ "message_id",
+ "sort_order",
+ "id"
+ ],
+ "isUnique": false,
+ "where": "\"thought_segments\".\"is_final_response\" <> 0"
+ }
+ },
+ "foreignKeys": {
+ "thought_segments_message_id_messages_id_fk": {
+ "name": "thought_segments_message_id_messages_id_fk",
+ "tableFrom": "thought_segments",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "thread_control_approvals": {
+ "name": "thread_control_approvals",
+ "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
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "execution_json": {
+ "name": "execution_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "placement_json": {
+ "name": "placement_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "caller_id": {
+ "name": "caller_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source_thread_id": {
+ "name": "source_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source_turn_id": {
+ "name": "source_turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source_provider_id": {
+ "name": "source_provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "operation": {
+ "name": "operation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'thread_create_batch'"
+ },
+ "operation_phase": {
+ "name": "operation_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pre_provision'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "processing_started_at": {
+ "name": "processing_started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_thread_control_approvals_thread": {
+ "name": "idx_thread_control_approvals_thread",
+ "columns": [
+ "thread_id",
+ "status"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "thread_control_approvals_thread_id_threads_id_fk": {
+ "name": "thread_control_approvals_thread_id_threads_id_fk",
+ "tableFrom": "thread_control_approvals",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "thread_control_approvals_workspace_id_workspaces_id_fk": {
+ "name": "thread_control_approvals_workspace_id_workspaces_id_fk",
+ "tableFrom": "thread_control_approvals",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "thread_control_audit": {
+ "name": "thread_control_audit",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "caller_id": {
+ "name": "caller_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source_thread_id": {
+ "name": "source_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "operation": {
+ "name": "operation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_thread_control_audit_thread": {
+ "name": "idx_thread_control_audit_thread",
+ "columns": [
+ "thread_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "thread_provider_sessions": {
+ "name": "thread_provider_sessions",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_seen_sequence": {
+ "name": "last_seen_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "thread_provider_sessions_thread_id_threads_id_fk": {
+ "name": "thread_provider_sessions_thread_id_threads_id_fk",
+ "tableFrom": "thread_provider_sessions",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "thread_provider_sessions_thread_id_provider_id_pk": {
+ "columns": [
+ "thread_id",
+ "provider_id"
+ ],
+ "name": "thread_provider_sessions_thread_id_provider_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "thread_startups": {
+ "name": "thread_startups",
+ "columns": {
+ "startup_id": {
+ "name": "startup_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "steps_json": {
+ "name": "steps_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "transcript_json": {
+ "name": "transcript_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cancellation": {
+ "name": "cancellation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'none'"
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "request_fingerprint": {
+ "name": "request_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error_json": {
+ "name": "error_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "block_json": {
+ "name": "block_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_thread_startups_workspace_updated": {
+ "name": "idx_thread_startups_workspace_updated",
+ "columns": [
+ "workspace_id",
+ "\"updated_at\" desc"
+ ],
+ "isUnique": false
+ },
+ "idx_thread_startups_state": {
+ "name": "idx_thread_startups_state",
+ "columns": [
+ "state"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "thread_startups_workspace_id_workspaces_id_fk": {
+ "name": "thread_startups_workspace_id_workspaces_id_fk",
+ "tableFrom": "thread_startups",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "thread_startups_thread_id_threads_id_fk": {
+ "name": "thread_startups_thread_id_threads_id_fk",
+ "tableFrom": "thread_startups",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "thread_tasks": {
+ "name": "thread_tasks",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tasks_json": {
+ "name": "tasks_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "thread_tasks_thread_id_threads_id_fk": {
+ "name": "thread_tasks_thread_id_threads_id_fk",
+ "tableFrom": "thread_tasks",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "threads": {
+ "name": "threads",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'active'"
+ },
+ "seen_through_sequence": {
+ "name": "seen_through_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "seen_at": {
+ "name": "seen_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_turn_outcome": {
+ "name": "last_turn_outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_turn_ended_at": {
+ "name": "last_turn_ended_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_turn_sequence": {
+ "name": "last_turn_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'direct'"
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "branch": {
+ "name": "branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "checkout_state": {
+ "name": "checkout_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'named'"
+ },
+ "base_branch": {
+ "name": "base_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "issue_number": {
+ "name": "issue_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pr_number": {
+ "name": "pr_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "pr_status": {
+ "name": "pr_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_completed_at": {
+ "name": "user_completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scheduled_deletion_at": {
+ "name": "scheduled_deletion_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cleanup_state": {
+ "name": "cleanup_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cleanup_reason": {
+ "name": "cleanup_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "worktree_managed": {
+ "name": "worktree_managed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "sdk_session_id": {
+ "name": "sdk_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_context_tokens": {
+ "name": "last_context_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "context_window": {
+ "name": "context_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'claude'"
+ },
+ "providers_used": {
+ "name": "providers_used",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reasoning_level": {
+ "name": "reasoning_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "interaction_mode": {
+ "name": "interaction_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "plan_phase": {
+ "name": "plan_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "orchestration_mode": {
+ "name": "orchestration_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "permission_mode": {
+ "name": "permission_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_thread_id": {
+ "name": "parent_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "forked_from_message_id": {
+ "name": "forked_from_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delegation_coordinator_thread_id": {
+ "name": "delegation_coordinator_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delegation_creator_turn_id": {
+ "name": "delegation_creator_turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delegation_creator_tool_call_id": {
+ "name": "delegation_creator_tool_call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "delegation_creation_kind": {
+ "name": "delegation_creation_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_by_integration_id": {
+ "name": "created_by_integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_compact_summary": {
+ "name": "last_compact_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "devin_mode": {
+ "name": "devin_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "context_window_mode": {
+ "name": "context_window_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "thinking": {
+ "name": "thinking",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fast_mode": {
+ "name": "fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "codex_fast_mode": {
+ "name": "codex_fast_mode",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "default_open_in_app": {
+ "name": "default_open_in_app",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "has_file_changes": {
+ "name": "has_file_changes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "current_notice_session_id": {
+ "name": "current_notice_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_threads_workspace": {
+ "name": "idx_threads_workspace",
+ "columns": [
+ "workspace_id"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_workspace_deleted": {
+ "name": "idx_threads_workspace_deleted",
+ "columns": [
+ "workspace_id",
+ "deleted_at"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_workspace_completed": {
+ "name": "idx_threads_workspace_completed",
+ "columns": [
+ "workspace_id",
+ "user_completed_at"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_cleanup_due": {
+ "name": "idx_threads_cleanup_due",
+ "columns": [
+ "cleanup_state",
+ "scheduled_deletion_at"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_workspace_recency": {
+ "name": "idx_threads_workspace_recency",
+ "columns": [
+ "workspace_id",
+ "\"updated_at\" desc"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_status": {
+ "name": "idx_threads_status",
+ "columns": [
+ "status"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_parent_thread_id": {
+ "name": "idx_threads_parent_thread_id",
+ "columns": [
+ "parent_thread_id"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_forked_from_message_id": {
+ "name": "idx_threads_forked_from_message_id",
+ "columns": [
+ "forked_from_message_id"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_delegation_coordinator": {
+ "name": "idx_threads_delegation_coordinator",
+ "columns": [
+ "delegation_coordinator_thread_id"
+ ],
+ "isUnique": false
+ },
+ "idx_threads_created_by_integration": {
+ "name": "idx_threads_created_by_integration",
+ "columns": [
+ "created_by_integration_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "threads_workspace_id_workspaces_id_fk": {
+ "name": "threads_workspace_id_workspaces_id_fk",
+ "tableFrom": "threads",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "threads_delegation_coordinator_thread_id_threads_id_fk": {
+ "name": "threads_delegation_coordinator_thread_id_threads_id_fk",
+ "tableFrom": "threads",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "delegation_coordinator_thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "tool_call_records": {
+ "name": "tool_call_records",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "parent_tool_call_id": {
+ "name": "parent_tool_call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider_agent_key": {
+ "name": "provider_agent_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subagent_identity_key": {
+ "name": "subagent_identity_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subagent_provider_name": {
+ "name": "subagent_provider_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subagent_prompt": {
+ "name": "subagent_prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subagent_type": {
+ "name": "subagent_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subagent_agent_id": {
+ "name": "subagent_agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subagent_duration_ms": {
+ "name": "subagent_duration_ms",
+ "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
+ },
+ "input_summary": {
+ "name": "input_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "output_summary": {
+ "name": "output_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "output_truncated": {
+ "name": "output_truncated",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "output_total_bytes": {
+ "name": "output_total_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "output_artifact_path": {
+ "name": "output_artifact_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "exit_code": {
+ "name": "exit_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'running'"
+ },
+ "background": {
+ "name": "background",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "idx_tool_call_records_message_sort_order_id": {
+ "name": "idx_tool_call_records_message_sort_order_id",
+ "columns": [
+ "message_id",
+ "sort_order",
+ "id"
+ ],
+ "isUnique": false
+ },
+ "idx_tool_call_records_parent": {
+ "name": "idx_tool_call_records_parent",
+ "columns": [
+ "parent_tool_call_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "tool_call_records_message_id_messages_id_fk": {
+ "name": "tool_call_records_message_id_messages_id_fk",
+ "tableFrom": "tool_call_records",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "turn_diff_snapshots": {
+ "name": "turn_diff_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fidelity": {
+ "name": "fidelity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "patch": {
+ "name": "patch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_turn_diff_snapshots_message": {
+ "name": "idx_turn_diff_snapshots_message",
+ "columns": [
+ "message_id"
+ ],
+ "isUnique": true
+ },
+ "idx_turn_diff_snapshots_thread": {
+ "name": "idx_turn_diff_snapshots_thread",
+ "columns": [
+ "thread_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "turn_diff_snapshots_message_id_messages_id_fk": {
+ "name": "turn_diff_snapshots_message_id_messages_id_fk",
+ "tableFrom": "turn_diff_snapshots",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "turn_diff_snapshots_thread_id_threads_id_fk": {
+ "name": "turn_diff_snapshots_thread_id_threads_id_fk",
+ "tableFrom": "turn_diff_snapshots",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "turn_resume_schedules": {
+ "name": "turn_resume_schedules",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "execution_id": {
+ "name": "execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "run_at": {
+ "name": "run_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "turn_resume_schedules_thread_id_threads_id_fk": {
+ "name": "turn_resume_schedules_thread_id_threads_id_fk",
+ "tableFrom": "turn_resume_schedules",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "turn_reverts": {
+ "name": "turn_reverts",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "request_params": {
+ "name": "request_params",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "target_message_id": {
+ "name": "target_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "from_message_id": {
+ "name": "from_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "undoes_revert_id": {
+ "name": "undoes_revert_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "undone_by_revert_id": {
+ "name": "undone_by_revert_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "files": {
+ "name": "files",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "recovery_ref": {
+ "name": "recovery_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failure": {
+ "name": "failure",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "receipt_message_id": {
+ "name": "receipt_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "agent_notified_at": {
+ "name": "agent_notified_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "turn_reverts_request_id_unique": {
+ "name": "turn_reverts_request_id_unique",
+ "columns": [
+ "request_id"
+ ],
+ "isUnique": true
+ },
+ "idx_turn_reverts_thread": {
+ "name": "idx_turn_reverts_thread",
+ "columns": [
+ "thread_id",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "idx_turn_reverts_target": {
+ "name": "idx_turn_reverts_target",
+ "columns": [
+ "target_message_id"
+ ],
+ "isUnique": false
+ },
+ "idx_turn_reverts_unfinished": {
+ "name": "idx_turn_reverts_unfinished",
+ "columns": [
+ "state"
+ ],
+ "isUnique": false,
+ "where": "\"turn_reverts\".\"state\" IN ('prepared', 'recovery_failed')"
+ }
+ },
+ "foreignKeys": {
+ "turn_reverts_thread_id_threads_id_fk": {
+ "name": "turn_reverts_thread_id_threads_id_fk",
+ "tableFrom": "turn_reverts",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "turn_reverts_target_message_id_messages_id_fk": {
+ "name": "turn_reverts_target_message_id_messages_id_fk",
+ "tableFrom": "turn_reverts",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "target_message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "turn_reverts_from_message_id_messages_id_fk": {
+ "name": "turn_reverts_from_message_id_messages_id_fk",
+ "tableFrom": "turn_reverts",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "from_message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "turn_reverts_undoes_revert_id_turn_reverts_id_fk": {
+ "name": "turn_reverts_undoes_revert_id_turn_reverts_id_fk",
+ "tableFrom": "turn_reverts",
+ "tableTo": "turn_reverts",
+ "columnsFrom": [
+ "undoes_revert_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "turn_reverts_receipt_message_id_messages_id_fk": {
+ "name": "turn_reverts_receipt_message_id_messages_id_fk",
+ "tableFrom": "turn_reverts",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "receipt_message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "turn_snapshots": {
+ "name": "turn_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_before": {
+ "name": "ref_before",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ref_after": {
+ "name": "ref_after",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "files_changed": {
+ "name": "files_changed",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "file_effects": {
+ "name": "file_effects",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{\"revision\":0,\"fileCount\":0,\"additions\":0,\"deletions\":0,\"effects\":[]}'"
+ },
+ "worktree_path": {
+ "name": "worktree_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_turn_snapshots_message": {
+ "name": "idx_turn_snapshots_message",
+ "columns": [
+ "message_id"
+ ],
+ "isUnique": false
+ },
+ "idx_turn_snapshots_thread": {
+ "name": "idx_turn_snapshots_thread",
+ "columns": [
+ "thread_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "turn_snapshots_message_id_messages_id_fk": {
+ "name": "turn_snapshots_message_id_messages_id_fk",
+ "tableFrom": "turn_snapshots",
+ "tableTo": "messages",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "turn_snapshots_thread_id_threads_id_fk": {
+ "name": "turn_snapshots_thread_id_threads_id_fk",
+ "tableFrom": "turn_snapshots",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "turn_steers": {
+ "name": "turn_steers",
+ "columns": {
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "turn_execution_id": {
+ "name": "turn_execution_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "inputs_hash": {
+ "name": "inputs_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rejection": {
+ "name": "rejection",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "replacement_message_id": {
+ "name": "replacement_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "turn_steers_replacement_message_id_unique": {
+ "name": "turn_steers_replacement_message_id_unique",
+ "columns": [
+ "replacement_message_id"
+ ],
+ "isUnique": true
+ },
+ "idx_turn_steers_state": {
+ "name": "idx_turn_steers_state",
+ "columns": [
+ "state"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "turn_steers_thread_id_threads_id_fk": {
+ "name": "turn_steers_thread_id_threads_id_fk",
+ "tableFrom": "turn_steers",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {
+ "turn_steers_state": {
+ "name": "turn_steers_state",
+ "value": "\"turn_steers\".\"state\" IN ('pending', 'delivered', 'rejected', 'delivery_unknown', 'resend_queued', 'closed')"
+ }
+ }
+ },
+ "workspace_environment_automatic_setup_attempts": {
+ "name": "workspace_environment_automatic_setup_attempts",
+ "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
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failed_action_id": {
+ "name": "failed_action_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_workspace_environment_automatic_setup_attempts_thread": {
+ "name": "idx_workspace_environment_automatic_setup_attempts_thread",
+ "columns": [
+ "thread_id",
+ "\"created_at\" desc"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "workspace_environment_automatic_setup_attempts_thread_id_threads_id_fk": {
+ "name": "workspace_environment_automatic_setup_attempts_thread_id_threads_id_fk",
+ "tableFrom": "workspace_environment_automatic_setup_attempts",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "workspace_environment_command_approvals": {
+ "name": "workspace_environment_command_approvals",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "command_id": {
+ "name": "command_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fingerprint": {
+ "name": "fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "idx_workspace_environment_command_approvals_command": {
+ "name": "idx_workspace_environment_command_approvals_command",
+ "columns": [
+ "workspace_id",
+ "command_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "workspace_environment_command_approvals_workspace_id_workspaces_id_fk": {
+ "name": "workspace_environment_command_approvals_workspace_id_workspaces_id_fk",
+ "tableFrom": "workspace_environment_command_approvals",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "workspace_environment_queued_turns": {
+ "name": "workspace_environment_queued_turns",
+ "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
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "queue_position": {
+ "name": "queue_position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "submission_json": {
+ "name": "submission_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "released_at": {
+ "name": "released_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "dispatching_at": {
+ "name": "dispatching_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "dispatched_at": {
+ "name": "dispatched_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_workspace_environment_queued_turns_state": {
+ "name": "idx_workspace_environment_queued_turns_state",
+ "columns": [
+ "state",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "idx_workspace_environment_queued_turns_thread_state_position": {
+ "name": "idx_workspace_environment_queued_turns_thread_state_position",
+ "columns": [
+ "thread_id",
+ "state",
+ "queue_position"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "workspace_environment_queued_turns_thread_id_threads_id_fk": {
+ "name": "workspace_environment_queued_turns_thread_id_threads_id_fk",
+ "tableFrom": "workspace_environment_queued_turns",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "workspace_environment_setup_gates": {
+ "name": "workspace_environment_setup_gates",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "attempt_id": {
+ "name": "attempt_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_environment_setup_gates_thread_id_threads_id_fk": {
+ "name": "workspace_environment_setup_gates_thread_id_threads_id_fk",
+ "tableFrom": "workspace_environment_setup_gates",
+ "tableTo": "threads",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "workspace_environment_storage_settings": {
+ "name": "workspace_environment_storage_settings",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "storage_mode": {
+ "name": "storage_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_environment_storage_settings_workspace_id_workspaces_id_fk": {
+ "name": "workspace_environment_storage_settings_workspace_id_workspaces_id_fk",
+ "tableFrom": "workspace_environment_storage_settings",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "workspace_terminal_preferences": {
+ "name": "workspace_terminal_preferences",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "default_profile_id": {
+ "name": "default_profile_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_terminal_preferences_workspace_id_workspaces_id_fk": {
+ "name": "workspace_terminal_preferences_workspace_id_workspaces_id_fk",
+ "tableFrom": "workspace_terminal_preferences",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "workspace_worktrees": {
+ "name": "workspace_worktrees",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "canonical_path": {
+ "name": "canonical_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "branch": {
+ "name": "branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "base_ref": {
+ "name": "base_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "managed": {
+ "name": "managed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "stale": {
+ "name": "stale",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "idx_workspace_worktrees_path": {
+ "name": "idx_workspace_worktrees_path",
+ "columns": [
+ "workspace_id",
+ "canonical_path"
+ ],
+ "isUnique": true
+ },
+ "idx_workspace_worktrees_workspace": {
+ "name": "idx_workspace_worktrees_workspace",
+ "columns": [
+ "workspace_id",
+ "stale"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "workspace_worktrees_workspace_id_workspaces_id_fk": {
+ "name": "workspace_worktrees_workspace_id_workspaces_id_fk",
+ "tableFrom": "workspace_worktrees",
+ "tableTo": "workspaces",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "workspaces": {
+ "name": "workspaces",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_config": {
+ "name": "provider_config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "pinned": {
+ "name": "pinned",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_opened_at": {
+ "name": "last_opened_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "is_git_repo": {
+ "name": "is_git_repo",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "icon_path": {
+ "name": "icon_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "workspaces_path_unique": {
+ "name": "workspaces_path_unique",
+ "columns": [
+ "path"
+ ],
+ "isUnique": true
+ },
+ "idx_workspaces_sort_order": {
+ "name": "idx_workspaces_sort_order",
+ "columns": [
+ "\"sort_order\" asc"
+ ],
+ "isUnique": false
+ },
+ "idx_workspaces_pinned_last_opened": {
+ "name": "idx_workspaces_pinned_last_opened",
+ "columns": [
+ "\"pinned\" desc",
+ "\"last_opened_at\" desc"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {
+ "idx_messages_notice_session_sequence": {
+ "columns": {
+ "json_extract(\"system_notice\", '$.sessionId')": {
+ "isExpression": true
+ },
+ "\"sequence\" desc": {
+ "isExpression": true
+ }
+ }
+ },
+ "idx_thread_startups_workspace_updated": {
+ "columns": {
+ "\"updated_at\" desc": {
+ "isExpression": true
+ }
+ }
+ },
+ "idx_threads_workspace_recency": {
+ "columns": {
+ "\"updated_at\" desc": {
+ "isExpression": true
+ }
+ }
+ },
+ "idx_workspace_environment_automatic_setup_attempts_thread": {
+ "columns": {
+ "\"created_at\" desc": {
+ "isExpression": true
+ }
+ }
+ },
+ "idx_workspaces_sort_order": {
+ "columns": {
+ "\"sort_order\" asc": {
+ "isExpression": true
+ }
+ }
+ },
+ "idx_workspaces_pinned_last_opened": {
+ "columns": {
+ "\"pinned\" desc": {
+ "isExpression": true
+ },
+ "\"last_opened_at\" desc": {
+ "isExpression": true
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/server/drizzle/meta/_journal.json b/apps/server/drizzle/meta/_journal.json
index 0d6803059..3d60e4315 100644
--- a/apps/server/drizzle/meta/_journal.json
+++ b/apps/server/drizzle/meta/_journal.json
@@ -701,6 +701,13 @@
"when": 1792755169393,
"tag": "0098_workable_cardiac",
"breakpoints": true
+ },
+ {
+ "idx": 99,
+ "version": "6",
+ "when": 1792759274864,
+ "tag": "0099_quiet_master_chief",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/apps/server/src/features/agents/conversation/persistence/__tests__/message-repo.test.ts b/apps/server/src/features/agents/conversation/persistence/__tests__/message-repo.test.ts
index a4ccdd24c..d20637e94 100644
--- a/apps/server/src/features/agents/conversation/persistence/__tests__/message-repo.test.ts
+++ b/apps/server/src/features/agents/conversation/persistence/__tests__/message-repo.test.ts
@@ -37,6 +37,7 @@ function createTestDb(): Database {
outcome_execution_id TEXT,
provider_switch TEXT
,system_notice TEXT
+ ,visual TEXT
);
CREATE TABLE tool_call_records (
id TEXT PRIMARY KEY,
diff --git a/apps/server/src/features/agents/conversation/persistence/message-store.ts b/apps/server/src/features/agents/conversation/persistence/message-store.ts
index 6cee1adb2..d6b41ac20 100644
--- a/apps/server/src/features/agents/conversation/persistence/message-store.ts
+++ b/apps/server/src/features/agents/conversation/persistence/message-store.ts
@@ -9,6 +9,7 @@ import type { Changes, Database } from "bun:sqlite";
import { and, asc, count, desc, eq, getTableColumns, gt, inArray, isNotNull, lt, lte, notExists, placeholder, sql, type SQL } from "drizzle-orm";
import { drizzle, type BunSQLiteDatabase } from "drizzle-orm/bun-sqlite";
import type {
+ HtmlVisual,
Message,
LegacyMessageProvenance,
MessageMention,
@@ -21,6 +22,7 @@ import type {
TurnOutcome,
} from "@mcode/contracts";
import {
+ HtmlVisualSchema,
PreviewAnnotationBundleSchema,
ProviderSwitchMarkerSchema,
LegacyMessageProvenanceSchema,
@@ -108,6 +110,10 @@ function serializeSelectedTextComments(
return JSON.stringify(SelectedTextCommentsSchema().parse(selectedTextComments));
}
+function parseVisual(value: string | null): HtmlVisual | null {
+ return value === null ? null : HtmlVisualSchema().parse(parseJsonField(value));
+}
+
function rowToMessage(row: MessageRow): Message {
const msg: Message = {
id: row.id,
@@ -134,6 +140,7 @@ function rowToMessage(row: MessageRow): Message {
outcomeExecutionId: row.outcomeExecutionId ?? null,
systemNotice: parseSystemNotice(row.systemNotice),
providerSwitch: row.providerSwitch === null ? null : ProviderSwitchMarkerSchema().parse(parseJsonField(row.providerSwitch)),
+ visual: parseVisual(row.visual),
is_internal: row.isInternal === 1,
...(row.parentAgentProvenance
? { parentAgentProvenance: parseParentAgentProvenance(row.parentAgentProvenance) }
@@ -348,6 +355,16 @@ export class MessageStore {
return rowToMessage(row);
}
+ /** Create the system message that shows an HTML visual. Its text names the visual for builds and readers without the frame. */
+ createVisual(threadId: string, sequence: number, input: HtmlVisual): Message {
+ const visual = HtmlVisualSchema().parse(input);
+ const row = this.orm.insert(messages).values({
+ id: NodeCrypto.randomUUID(), threadId, role: "system", content: `Visual: ${visual.title}`, sequence,
+ timestamp: new Date().toISOString(), visual: JSON.stringify(visual),
+ }).returning().get();
+ return rowToMessage(row);
+ }
+
/** Create a visible system message carrying bounded provider notice metadata. */
createSystemNotice(
threadId: string,
diff --git a/apps/server/src/features/agents/conversation/read-model/__tests__/conversation-page.test.ts b/apps/server/src/features/agents/conversation/read-model/__tests__/conversation-page.test.ts
index 820b75e54..3c1e36ee1 100644
--- a/apps/server/src/features/agents/conversation/read-model/__tests__/conversation-page.test.ts
+++ b/apps/server/src/features/agents/conversation/read-model/__tests__/conversation-page.test.ts
@@ -639,3 +639,33 @@ describe("loadNewerConversationPage", () => {
expect(sequences).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
});
});
+
+describe("HTML visual replay", () => {
+ it("reloads a published visual between the prompt and the reply it precedes", () => {
+ const db = openMemoryDatabase();
+ seedThread(db);
+ const deps = createDeps(db);
+ insertMessage(db, "u1", "user", "chart the latency", 1);
+ const visual = { title: "Latency by provider", html: " ", maxHeight: 480 };
+ const published = deps.messageRepo.createVisual("thread-1", 2, visual);
+ insertMessage(db, "a1", "assistant", "Codex is fastest.", 3);
+
+ const page = loadConversationPage(deps, { threadId: "thread-1", limit: 20 });
+ const tail = loadConversationTail(deps, { threadId: "thread-1", limit: 2 });
+
+ expect(page.messages.map((message) => [message.id, message.role, message.visual ?? null])).toEqual([
+ ["u1", "user", null],
+ [published.id, "system", visual],
+ ["a1", "assistant", null],
+ ]);
+ expect(tail.messages[0]).toMatchObject({ id: published.id, content: "Visual: Latency by provider", visual });
+ });
+
+ it("refuses to store a visual over the contract limits", () => {
+ const db = openMemoryDatabase();
+ seedThread(db);
+ const store = createDeps(db).messageRepo;
+ expect(() => store.createVisual("thread-1", 1, { title: "Too tall", html: "
", maxHeight: 5000 })).toThrow();
+ expect(store.listByThread("thread-1", 10).messages).toEqual([]);
+ });
+});
diff --git a/apps/server/src/features/agents/conversation/read-model/conversation-page.ts b/apps/server/src/features/agents/conversation/read-model/conversation-page.ts
index e3dd0a27f..e875edec7 100644
--- a/apps/server/src/features/agents/conversation/read-model/conversation-page.ts
+++ b/apps/server/src/features/agents/conversation/read-model/conversation-page.ts
@@ -223,6 +223,7 @@ export function loadConversationTail(
outcomeExecutionId: message.outcomeExecutionId,
systemNotice: message.systemNotice,
providerSwitch: message.providerSwitch,
+ visual: message.visual,
is_internal: message.is_internal,
parentAgentProvenance: message.parentAgentProvenance,
}));
diff --git a/apps/server/src/runtime/persistence/sqlite/schema.ts b/apps/server/src/runtime/persistence/sqlite/schema.ts
index eb7a3d7a5..af5d933a5 100644
--- a/apps/server/src/runtime/persistence/sqlite/schema.ts
+++ b/apps/server/src/runtime/persistence/sqlite/schema.ts
@@ -413,6 +413,8 @@ export const messages = sqliteTable(
/** Bounded typed provider notice metadata for durable system messages. */
systemNotice: text("system_notice"),
providerSwitch: text("provider_switch"),
+ /** JSON HtmlVisual shown by a system message in the timeline. */
+ visual: text("visual"),
},
(table) => [
index("idx_messages_thread").on(table.threadId),
From 7f02ec5a7fb963557b814678598767b24bec3b60 Mon Sep 17 00:00:00 2001
From: "(CJ) Chukwudi Nwobodo" <142016413+chuks-qua@users.noreply.github.com>
Date: Fri, 23 Oct 2026 13:49:08 +0100
Subject: [PATCH 3/4] feat(web): show HTML visuals in a sandboxed frame
The frame allows scripts only, so the page runs in an opaque origin with
no access to the app document, storage, or cookies, and cannot navigate
the window. Mcode's design tokens are injected before the page and
posted again when light or dark mode changes, so colours follow the app
without a reload. The frame grows with the page up to its requested
height.
---
.../html-visual/HtmlVisualFrame.tsx | 47 ++++++++
.../__tests__/HtmlVisualFrame.test.tsx | 103 ++++++++++++++++++
.../html-visual/html-visual-document.ts | 58 ++++++++++
.../conversation/messages/MessageBubble.tsx | 11 +-
apps/web/src/hooks/useTheme.ts | 12 ++
5 files changed, 229 insertions(+), 2 deletions(-)
create mode 100644 apps/web/src/features/conversation/html-visual/HtmlVisualFrame.tsx
create mode 100644 apps/web/src/features/conversation/html-visual/__tests__/HtmlVisualFrame.test.tsx
create mode 100644 apps/web/src/features/conversation/html-visual/html-visual-document.ts
diff --git a/apps/web/src/features/conversation/html-visual/HtmlVisualFrame.tsx b/apps/web/src/features/conversation/html-visual/HtmlVisualFrame.tsx
new file mode 100644
index 000000000..d8d299161
--- /dev/null
+++ b/apps/web/src/features/conversation/html-visual/HtmlVisualFrame.tsx
@@ -0,0 +1,47 @@
+import { HTML_VISUAL_MIN_HEIGHT, type HtmlVisual } from "@mcode/contracts";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { useAppearance } from "@/hooks/useTheme";
+import { buildHtmlVisualDocument, HTML_VISUAL_THEME_MESSAGE, readHtmlVisualHeight, readHtmlVisualTheme } from "./html-visual-document";
+
+/**
+ * Shows an agent's HTML visual in a sandboxed frame as wide as the reply column.
+ * The page is untrusted. Without allow-same-origin it runs in an opaque origin, so it cannot
+ * reach the app document, storage, or cookies, and it gets no top navigation, popups, or forms.
+ */
+export function HtmlVisualFrame({ visual }: { readonly visual: HtmlVisual }) {
+ const frameRef = useRef(null);
+ const [height, setHeight] = useState(HTML_VISUAL_MIN_HEIGHT);
+ const appearance = useAppearance();
+ // Built once per page: theme changes are posted to the running page, because a new srcdoc would reload it.
+ const srcDoc = useMemo(() => buildHtmlVisualDocument(visual.html, readHtmlVisualTheme()), [visual.html]);
+
+ const postTheme = useCallback(() => {
+ frameRef.current?.contentWindow?.postMessage({ type: HTML_VISUAL_THEME_MESSAGE, theme: readHtmlVisualTheme() }, "*");
+ }, []);
+
+ useEffect(postTheme, [appearance, postTheme]);
+
+ useEffect(() => {
+ const onMessage = (event: MessageEvent) => {
+ if (event.source === null || event.source !== frameRef.current?.contentWindow) return;
+ const contentHeight = readHtmlVisualHeight(event.data);
+ if (contentHeight === null) return;
+ setHeight(Math.min(visual.maxHeight, Math.max(HTML_VISUAL_MIN_HEIGHT, Math.ceil(contentHeight))));
+ };
+ window.addEventListener("message", onMessage);
+ return () => window.removeEventListener("message", onMessage);
+ }, [visual.maxHeight]);
+
+ return (
+
+ );
+}
diff --git a/apps/web/src/features/conversation/html-visual/__tests__/HtmlVisualFrame.test.tsx b/apps/web/src/features/conversation/html-visual/__tests__/HtmlVisualFrame.test.tsx
new file mode 100644
index 000000000..f8d16166d
--- /dev/null
+++ b/apps/web/src/features/conversation/html-visual/__tests__/HtmlVisualFrame.test.tsx
@@ -0,0 +1,103 @@
+import type { HtmlVisual } from "@mcode/contracts";
+import { act, render, screen } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { createMockMessage } from "@/__tests__/mocks/transport";
+import { MessageBubble } from "@/features/conversation/messages/MessageBubble";
+import { createEmptyThreadRecord } from "@/stores/thread-record";
+import { resetThreadStoreForTests } from "@/stores/thread-store-test-utils";
+import { HtmlVisualFrame } from "../HtmlVisualFrame";
+import { buildHtmlVisualDocument } from "../html-visual-document";
+
+const visual: HtmlVisual = { title: "Latency by provider", html: "chart
", maxHeight: 480 };
+const root = document.documentElement;
+
+function renderFrame() {
+ render( );
+ const frame = screen.getByTitle("Latency by provider");
+ const contentWindow = frame.contentWindow;
+ if (!contentWindow) throw new Error("frame has no window");
+ return { frame, contentWindow };
+}
+
+function postFrom(source: Window, data: unknown) {
+ act(() => window.dispatchEvent(new MessageEvent("message", { data, source })));
+}
+
+beforeEach(() => root.style.setProperty("--ink", "rgb(20, 20, 20)"));
+afterEach(() => {
+ root.classList.remove("dark");
+ root.style.removeProperty("--ink");
+});
+
+describe("HtmlVisualFrame", () => {
+ it("gives the page scripts but no same-origin access, top navigation, popups, or forms", () => {
+ const { frame } = renderFrame();
+ expect(frame.getAttribute("sandbox")).toBe("allow-scripts");
+ });
+
+ it("sends the new token values to the page when the app switches to dark mode", async () => {
+ const { frame, contentWindow } = renderFrame();
+ // The frame also posts the theme on load, so let that pass before switching modes.
+ await new Promise((resolve) => frame.addEventListener("load", resolve, { once: true }));
+ const postMessage = vi.spyOn(contentWindow, "postMessage");
+
+ act(() => {
+ root.style.setProperty("--ink", "rgb(240, 240, 240)");
+ root.classList.add("dark");
+ });
+
+ return vi.waitFor(() => expect(postMessage).toHaveBeenCalledWith(
+ { type: "mcode:visual-theme", theme: expect.objectContaining({ colorScheme: "dark", tokens: expect.objectContaining({ "--ink": "rgb(240, 240, 240)" }) }) },
+ "*",
+ ));
+ });
+
+ it("grows with the page up to the requested height", () => {
+ const { frame, contentWindow } = renderFrame();
+ expect(frame.style.height).toBe("80px");
+
+ postFrom(contentWindow, { type: "mcode:visual-height", height: 312.4 });
+ expect(frame.style.height).toBe("313px");
+
+ postFrom(contentWindow, { type: "mcode:visual-height", height: 5000 });
+ expect(frame.style.height).toBe("480px");
+
+ postFrom(contentWindow, { type: "mcode:visual-height", height: 4 });
+ expect(frame.style.height).toBe("80px");
+ });
+
+ it("ignores height messages from anything but its own page", () => {
+ const { frame, contentWindow } = renderFrame();
+ postFrom(window, { type: "mcode:visual-height", height: 400 });
+ postFrom(contentWindow, { type: "mcode:visual-height", height: "400" });
+ postFrom(contentWindow, { type: "mcode:visual-height", height: Number.NaN });
+ expect(frame.style.height).toBe("80px");
+ });
+});
+
+describe("visual message", () => {
+ beforeEach(() => resetThreadStoreForTests({ records: new Map([["thread-1", createEmptyThreadRecord()]]) }));
+ afterEach(() => resetThreadStoreForTests());
+
+ it("shows the page in the timeline instead of its fallback text", () => {
+ const message = createMockMessage({ thread_id: "thread-1", role: "system", content: "Visual: Latency by provider", visual });
+ render( );
+ expect(screen.getByTitle("Latency by provider").tagName).toBe("IFRAME");
+ expect(screen.queryByText("Visual: Latency by provider")).toBeNull();
+ });
+});
+
+describe("buildHtmlVisualDocument", () => {
+ const theme = { colorScheme: "light" as const, tokens: { "--ink": "" } };
+
+ it("keeps a page's doctype first so it renders in standards mode", () => {
+ const document = new DOMParser().parseFromString(buildHtmlVisualDocument(visual.html, theme), "text/html");
+ expect(document.compatMode).toBe("CSS1Compat");
+ expect(document.body.textContent).toBe("chart");
+ });
+
+ it("cannot be broken out of by a token value", () => {
+ const document = new DOMParser().parseFromString(buildHtmlVisualDocument("chart
", theme), "text/html");
+ expect(document.scripts).toHaveLength(1);
+ });
+});
diff --git a/apps/web/src/features/conversation/html-visual/html-visual-document.ts b/apps/web/src/features/conversation/html-visual/html-visual-document.ts
new file mode 100644
index 000000000..05f7d3646
--- /dev/null
+++ b/apps/web/src/features/conversation/html-visual/html-visual-document.ts
@@ -0,0 +1,58 @@
+import { HTML_VISUAL_THEME_TOKENS } from "@mcode/contracts";
+
+/** Message type a visual's page posts with its content height. */
+export const HTML_VISUAL_HEIGHT_MESSAGE = "mcode:visual-height";
+/** Message type the app posts to a visual's page when light or dark mode changes. */
+export const HTML_VISUAL_THEME_MESSAGE = "mcode:visual-theme";
+
+/** Resolved app design tokens handed to a visual's page. */
+export interface HtmlVisualTheme {
+ readonly colorScheme: "light" | "dark";
+ readonly tokens: Readonly>;
+}
+
+/** Reads the app's current design token values from the document root. */
+export function readHtmlVisualTheme(root: HTMLElement = document.documentElement): HtmlVisualTheme {
+ const style = getComputedStyle(root);
+ const tokens: Record = {};
+ for (const token of HTML_VISUAL_THEME_TOKENS) tokens[token] = style.getPropertyValue(token).trim();
+ return { colorScheme: root.classList.contains("dark") ? "dark" : "light", tokens };
+}
+
+// Page styles come later in the document, so pages can override these defaults.
+const BASE_CSS = "html{background:var(--background);color:var(--ink);font-family:var(--font-sans)}body{margin:0}";
+
+// The script runs before the page's own markup so the tokens exist on first paint.
+// It accepts theme updates only from the app window, and reports the html element's
+// height because it follows the content, unlike scrollHeight, which never drops below the frame.
+function bootstrapScript(theme: HtmlVisualTheme): string {
+ // "<" is escaped so no value can close the script element early.
+ const initial = JSON.stringify(theme).replace(/]*>/i;
+
+/**
+ * Builds the frame document for a visual: the page with Mcode's theme bootstrap ahead of it.
+ * The bootstrap goes after a leading doctype, because markup before it would put the page in quirks mode.
+ */
+export function buildHtmlVisualDocument(html: string, theme: HtmlVisualTheme): string {
+ const bootstrap = ``;
+ const doctype = LEADING_DOCTYPE.exec(html)?.[0] ?? "";
+ return `${doctype}${bootstrap}${html.slice(doctype.length)}`;
+}
+
+/** Returns the content height a message from a visual's page reports, or null for any other message. */
+export function readHtmlVisualHeight(data: unknown): number | null {
+ if (typeof data !== "object" || data === null) return null;
+ if (!("type" in data) || data.type !== HTML_VISUAL_HEIGHT_MESSAGE) return null;
+ if (!("height" in data) || typeof data.height !== "number" || !Number.isFinite(data.height)) return null;
+ return data.height;
+}
diff --git a/apps/web/src/features/conversation/messages/MessageBubble.tsx b/apps/web/src/features/conversation/messages/MessageBubble.tsx
index 51cb07594..01027b251 100644
--- a/apps/web/src/features/conversation/messages/MessageBubble.tsx
+++ b/apps/web/src/features/conversation/messages/MessageBubble.tsx
@@ -28,6 +28,7 @@ import { basename } from "@/lib/path";
import { SelectedTextCommentsComposerAttachment } from "../composer/SelectedTextCommentsComposerAttachment";
import { isCurrentComposerProviderNotice } from "../notices/provider-notices";
import { TURN_REVERT_NOTICE_KINDS, TurnRevertReceipt } from "../turn-revert/TurnRevertReceipt";
+import { HtmlVisualFrame } from "../html-visual/HtmlVisualFrame";
import { ProviderSwitchMarker } from "../provider-switch/ProviderSwitchMarker";
import { DelegatedTaskWakeUp } from "./DelegatedTaskWakeUp";
@@ -806,10 +807,16 @@ function UserMessageContent({
*/
const LEGACY_HANDOFF_ANCHOR_MARKER = "