From 2e2165e09901c7de2b8268e0b04ba30dd79b51a4 Mon Sep 17 00:00:00 2001 From: Michael Yong Date: Tue, 27 Oct 2026 15:56:01 -0700 Subject: [PATCH 1/2] Give the Git and GitHub PR Status plugins their own show settings "Show Git changes and Commit button" moves from core general settings to the Git plugin (showGitChanges), and the GitHub PR Status plugin gets its own showPullRequest setting for the composer's pull request segment. Core no longer folds the setting into ExperimentalThreadEnvironment; each plugin hides its own UI. Migration 0147 copies the saved value into both plugins and retires the general-settings row. Co-Authored-By: Claude Opus 5.5 --- .../components/settings/settings-search.ts | 4 - .../mutations/settings-mutations.test.ts | 16 +- .../views/SettingsView.branch-prefix.test.tsx | 2 - apps/app/src/views/SettingsView.stories.tsx | 5 - apps/app/src/views/SettingsView.tsx | 22 - .../views/thread-detail/ThreadDetailView.tsx | 4 +- apps/server/src/routes/system.ts | 1 - .../test/system/general-settings.test.ts | 1 - docs/api_to_audit.md | 3 +- docs/configuration.md | 27 +- ...git_and_pr_status_plugin_show_settings.sql | 9 + packages/db/drizzle/meta/0147_snapshot.json | 5287 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + packages/db/test/migrate.test.ts | 68 +- packages/domain/src/app-settings.ts | 4 - packages/domain/src/plugin-sdk-version.ts | 2 +- packages/plugin-sdk/package.json | 2 +- packages/plugin-sdk/src/app-contract.ts | 3 +- .../src/templates/bb-guide-customization.md | 8 +- .../references/frontend-registration.md | 4 +- plugins/git/PLUGIN_OVERVIEW.md | 2 +- plugins/git/contract.ts | 1 + plugins/git/server.ts | 10 + plugins/git/skills/git/SKILL.md | 4 + plugins/git/ui/commit/commit-action.test.tsx | 34 +- plugins/git/ui/commit/commit-action.ts | 36 +- plugins/git/ui/queries.ts | 10 +- .../git/ui/segment/ChangedFilesSegment.tsx | 8 +- plugins/github-pr-status/PLUGIN_OVERVIEW.md | 2 + plugins/github-pr-status/contract.ts | 1 + plugins/github-pr-status/server.ts | 10 + .../skills/github-pr-status/SKILL.md | 5 + .../ui/PullRequestContextSegment.test.tsx | 22 + .../ui/PullRequestContextSegment.tsx | 10 +- 34 files changed, 5501 insertions(+), 133 deletions(-) create mode 100644 packages/db/drizzle/0147_git_and_pr_status_plugin_show_settings.sql create mode 100644 packages/db/drizzle/meta/0147_snapshot.json diff --git a/apps/app/src/components/settings/settings-search.ts b/apps/app/src/components/settings/settings-search.ts index a8bc9f66ddd..ee281aede4d 100644 --- a/apps/app/src/components/settings/settings-search.ts +++ b/apps/app/src/components/settings/settings-search.ts @@ -42,10 +42,6 @@ export const SETTINGS_SEARCH_INDEX: Record< title: "Navigate to threads on creation", keywords: ["new thread", "open", "background"], }, - { - title: "Show Git changes and Commit button", - keywords: ["pull request", "pr", "diff", "composer"], - }, { title: "Default thread followup behavior", keywords: ["enter", "steer", "queue", "follow-up"], diff --git a/apps/app/src/hooks/mutations/settings-mutations.test.ts b/apps/app/src/hooks/mutations/settings-mutations.test.ts index 2c1eebd669b..558b1d85e26 100644 --- a/apps/app/src/hooks/mutations/settings-mutations.test.ts +++ b/apps/app/src/hooks/mutations/settings-mutations.test.ts @@ -198,17 +198,17 @@ describe("general settings mutation", () => { .mockReturnValueOnce(secondWrite.promise); const save = generalSettingsSave(queryClient); - const firstSave = save.mutate({ showGitChanges: false }); + const firstSave = save.mutate({ summarizeShellCommands: false }); const secondSave = save.mutate({ confirmThreadArchive: false }); await vi.waitFor(() => expect( queryClient.getQueryData(configKey) ?.generalSettings, - ).toMatchObject({ showGitChanges: false, confirmThreadArchive: false }), + ).toMatchObject({ summarizeShellCommands: false, confirmThreadArchive: false }), ); expect(sdk.system.updateGeneralSettings).toHaveBeenCalledOnce(); - firstWrite.resolve({ ...defaultAppSettings, showGitChanges: false }); + firstWrite.resolve({ ...defaultAppSettings, summarizeShellCommands: false }); await firstSave; await vi.waitFor(() => expect(sdk.system.updateGeneralSettings).toHaveBeenCalledTimes(2), @@ -216,11 +216,11 @@ describe("general settings mutation", () => { expect(queryClient.getQueryState(configKey)?.isInvalidated).toBe(false); expect( vi.mocked(sdk.system.updateGeneralSettings).mock.calls[1]?.[0], - ).toMatchObject({ showGitChanges: false, confirmThreadArchive: false }); + ).toMatchObject({ summarizeShellCommands: false, confirmThreadArchive: false }); secondWrite.resolve({ ...defaultAppSettings, - showGitChanges: false, + summarizeShellCommands: false, confirmThreadArchive: false, }); await secondSave; @@ -237,7 +237,7 @@ describe("general settings mutation", () => { .mockReturnValueOnce(new Promise(() => {})); const save = generalSettingsSave(queryClient); - const firstSave = save.mutate({ showGitChanges: false }); + const firstSave = save.mutate({ summarizeShellCommands: false }); void save.mutate({ confirmThreadArchive: false }); await vi.waitFor(() => expect( @@ -254,10 +254,10 @@ describe("general settings mutation", () => { expect( queryClient.getQueryData(configKey) ?.generalSettings, - ).toMatchObject({ showGitChanges: true, confirmThreadArchive: false }); + ).toMatchObject({ summarizeShellCommands: true, confirmThreadArchive: false }); expect( vi.mocked(sdk.system.updateGeneralSettings).mock.calls[1]?.[0], - ).toMatchObject({ showGitChanges: true, confirmThreadArchive: false }); + ).toMatchObject({ summarizeShellCommands: true, confirmThreadArchive: false }); }); it("drops cached model catalogs when streamer mode flips", async () => { diff --git a/apps/app/src/views/SettingsView.branch-prefix.test.tsx b/apps/app/src/views/SettingsView.branch-prefix.test.tsx index e1a2bb28a51..eaff1bff5ae 100644 --- a/apps/app/src/views/SettingsView.branch-prefix.test.tsx +++ b/apps/app/src/views/SettingsView.branch-prefix.test.tsx @@ -20,8 +20,6 @@ function renderSection(overrides?: { }) { return render( void; confirmThreadArchive: boolean; onConfirmThreadArchiveChange: (enabled: boolean) => void; keepHistoryAfterContextClear: boolean; @@ -861,8 +859,6 @@ export function AppearanceSettingsSection({ } export function GeneralSettingsSection({ - showGitChanges, - onShowGitChangesChange, confirmThreadArchive, onConfirmThreadArchiveChange, keepHistoryAfterContextClear, @@ -902,18 +898,6 @@ export function GeneralSettingsSection({ /> - - - - - updateGeneralSettingsMutation.mutate({ - showGitChanges: enabled, - }) - } confirmThreadArchive={generalSettings.confirmThreadArchive} onConfirmThreadArchiveChange={(enabled) => updateGeneralSettingsMutation.mutate({ diff --git a/apps/app/src/views/thread-detail/ThreadDetailView.tsx b/apps/app/src/views/thread-detail/ThreadDetailView.tsx index a414dea42d4..15bd824e2d2 100644 --- a/apps/app/src/views/thread-detail/ThreadDetailView.tsx +++ b/apps/app/src/views/thread-detail/ThreadDetailView.tsx @@ -1630,8 +1630,6 @@ function ThreadDetailViewInternal( }, })) : []; - const showGitChanges = - systemConfigQuery.data?.generalSettings.showGitChanges ?? false; const threadActionTarget = toThreadActionTarget( thread, isThreadOnReusableEnvironment && thread.environmentId !== null @@ -1730,7 +1728,7 @@ function ThreadDetailViewInternal( composer={{ environmentCheckout: threadCheckoutDisplay, environmentChrome: composerEnvironmentChrome, - contextEnvironmentId: showGitChanges ? threadEnvironmentId : null, + contextEnvironmentId: threadEnvironmentId, onCreateNewThreadInEnvironment, onOpenThreadInfo: openThreadInfo, permissionPolicy: "editable", diff --git a/apps/server/src/routes/system.ts b/apps/server/src/routes/system.ts index 66eca6f9541..6ffd21ea3c0 100644 --- a/apps/server/src/routes/system.ts +++ b/apps/server/src/routes/system.ts @@ -316,7 +316,6 @@ export function registerSystemRoutes( telemetryEnabled: settings.telemetryEnabled ?? current.telemetryEnabled, terminalCopyOnSelect: settings.terminalCopyOnSelect ?? current.terminalCopyOnSelect, - showGitChanges: settings.showGitChanges ?? current.showGitChanges, keepHistoryAfterContextClear: settings.keepHistoryAfterContextClear ?? current.keepHistoryAfterContextClear, diff --git a/apps/server/test/system/general-settings.test.ts b/apps/server/test/system/general-settings.test.ts index dc01c18df0e..cc778c664c4 100644 --- a/apps/server/test/system/general-settings.test.ts +++ b/apps/server/test/system/general-settings.test.ts @@ -285,7 +285,6 @@ it("preserves telemetry opt-out when older clients update other settings", async it.each([ "confirmThreadArchive", - "showGitChanges", "summarizeShellCommands", ] as const)( "persists %s opt-out and preserves it for older clients", diff --git a/docs/api_to_audit.md b/docs/api_to_audit.md index d5bbe1b230b..3e7c0e186c4 100644 --- a/docs/api_to_audit.md +++ b/docs/api_to_audit.md @@ -3776,9 +3776,8 @@ own value, so plugins built against the old constant keep working. ## Thread context segments (`app.slots.experimental_threadContextSegment` / `experimental_THREAD_CONTEXT_SEGMENT_GROUPS`) - **Surface:** `PluginAppSlots.experimental_threadContextSegment`, `PluginSdkApp.experimental_THREAD_CONTEXT_SEGMENT_GROUPS`, `ExperimentalThreadContextSegmentRegistration`, `ExperimentalThreadContextSegmentProps`, `ExperimentalThreadContextSegmentInput`, `ExperimentalThreadContextSegmentReference` and `ExperimentalThreadEnvironment` (also used by `ExperimentalThreadInfoProps.environment`). -- **Behavior:** a registration is `{ id, title, group, order?, summary, action?, details?, useVisible? }`. Segments share the context row above an existing thread's composer, and the host mounts each component in its own crash boundary: `summary` in the row (wrapped in a group named by `title`), `action` at the row's end after every summary, and `details` below the row. Segments sort like Info rows and thread actions: by `group` (string compare), then `order` within it (unset last), then registration order, core first on a tie. Core's groups are `experimental_THREAD_CONTEXT_SEGMENT_GROUPS`: `thread` (`1_thread`: parent thread) and `git` (`3_git`: changed files). The constant names only groups core renders; a plugin names its own group, placed where its string sorts. Each entry of `segments` is `{ key, pluginId }` with `key` `/`, the key shape thread actions use; core's segments use `bb--core`. `useVisible(input)` runs in plugin scope per thread; false, or a crash, leaves the segment out of the row and of `segments`. Props carry `threadId`, `projectId`, `environment`, the visible `segments` in row order, and the shared disclosure state: one segment of the row is expanded at a time, keyed by `key`. `environment` is `{ id }`, or null when the thread has no environment, its host is not active, the environment is not a usable checkout, or the user turned off "Show Git changes and Commit button". The row is withheld while core's workspace status loads and while a question is pending, and read-only history (archived thread or gone environment) shows core's parent thread only. The banner renders under every composer plugin, because the host draws it above `ComposerBox`. +- **Behavior:** a registration is `{ id, title, group, order?, summary, action?, details?, useVisible? }`. Segments share the context row above an existing thread's composer, and the host mounts each component in its own crash boundary: `summary` in the row (wrapped in a group named by `title`), `action` at the row's end after every summary, and `details` below the row. Segments sort like Info rows and thread actions: by `group` (string compare), then `order` within it (unset last), then registration order, core first on a tie. Core's groups are `experimental_THREAD_CONTEXT_SEGMENT_GROUPS`: `thread` (`1_thread`: parent thread) and `git` (`3_git`: changed files). The constant names only groups core renders; a plugin names its own group, placed where its string sorts. Each entry of `segments` is `{ key, pluginId }` with `key` `/`, the key shape thread actions use; core's segments use `bb--core`. `useVisible(input)` runs in plugin scope per thread; false, or a crash, leaves the segment out of the row and of `segments`. Props carry `threadId`, `projectId`, `environment`, the visible `segments` in row order, and the shared disclosure state: one segment of the row is expanded at a time, keyed by `key`. `environment` is `{ id }`, or null when the thread has no environment, its host is not active, or the environment is not a usable checkout. The row is withheld while core's workspace status loads and while a question is pending, and read-only history (archived thread or gone environment) shows core's parent thread only. The banner renders under every composer plugin, because the host draws it above `ComposerBox`. - **Core callers:** `ThreadPromptContextBanner` (`apps/app/src/components/promptbox/banner/ThreadPromptContextBanner.tsx`) registers the parent thread (summary and details, including read-only history) and changed files (summary, merge-base action, details) through `definePluginApp` and the same collector, and renders them with plugin registrations through `useThreadContextSegments` and `ThreadContextSegmentMount` (`apps/app/src/components/plugin/PluginThreadContextSegments.tsx`). Core segments read pane-local data from a React context and render without a plugin crash boundary, as core Info rows do. The GitHub PR Status plugin registers the pull request segment in its own group `2_pullRequest`, between core's two and its Mark ready and merge actions. Active child threads are a separate core row above the context row (`ThreadChildThreadsBanner`), not a segment. Contract tests: `ThreadPromptContextBanner.segments.test.tsx`. -- **Known coupling:** `environment` folds in the "Show Git changes and Commit button" setting so the pull request segment hides with core's changed files, as before; that setting should become the git plugin's own when changed files move out of core. - **Stabilization:** audit per-component mounts and crash recovery across reloads and plugin disable, `segments` stability while visibility settles, focus handoff between a plugin's summary and details, independent panes, and compact widths with several plugin segments. Then rename project-wide and remove this entry. ## Provider skills index diff --git a/docs/configuration.md b/docs/configuration.md index 51735ae4ce1..9e1fbeb4cd4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -276,7 +276,6 @@ for the command surface. | `showDiagnosticEvents` | `false` in all builds | Settings → General → Privacy & diagnostics → Show diagnostic events. Shows provider environment resolution and raw provider events bb does not yet understand in the timeline. Warnings, errors, and model fallback stay visible. Hidden diagnostics do not count toward timeline event or byte limits. | | `steerActiveThreadOnEnter` | `true` | Settings → General → Default thread followup behavior, when no typeahead suggestion is active. `true` ("Steer"): Enter sends to the agent during its current run and Mod+Enter queues the message until the agent stops; `false` ("Queue") swaps them. Installs with saved settings or work from before the setting were migrated once to `false`. | | `confirmThreadArchive` | `true` | Settings → General → Thread archive confirmation. `false` archives a thread and its children in the app without a confirmation popup; the toast still offers Undo. CLI and SDK archives never prompt. | -| `showGitChanges` | `true` | Settings → General → Show Git changes and Commit button. `false` hides the untracked, uncommitted, and committed file summary and expanded file list above every thread composer, that shelf's pull-request status and actions, and the Commit action in the thread header and overflow menu. Thread relationships and workspace warnings stay visible. | | `keepHistoryAfterContextClear` | `false` | Settings → General → Show messages from before a context clear. When `false`, a thread's timeline, conversation outline, and message lookup start at its latest `Context cleared` boundary; `true` keeps earlier messages, which load on scroll and appear in the outline and `bb thread log --message`. Clearing always starts a fresh provider conversation and resets the context meter. | | `summarizeShellCommands` | `true` | Settings → General → Summarize shell commands. `true` titles a shell command that runs `ls`, `find`, `grep`, `rg`, `cat`, `head`, `tail`, `nl`, or `sed -n` with a summary such as `Searched for X`, and the row does not expand. `false` titles every shell command row with its command (`Running …`, `Ran …`), expands it to the command and its output, and counts it as a command in step summaries. Native read and search tool rows keep their titles. | | `streamerMode` | `false` | Settings → General. Hides every `customModels` entry from the web and mobile pickers, `bb provider models`, and `sdk.providers.models`, for example before a screen share. Entries stay in `config.json`; a thread that names a hidden model still runs, and default model resolution keeps the full list, so a provider whose only models are custom still starts. A composer whose stored selection is hidden falls back to the provider default and records it on the next send; reselect the custom model after turning streamer mode off. | @@ -300,8 +299,11 @@ On Linux browsers with native primary-selection support, middle-click focuses the terminal and pastes the primary selection independently of this setting. Unsupported browsers never substitute unrelated regular clipboard contents. -Older clients that omit `showGitChanges`, `keepHistoryAfterContextClear`, -`summarizeShellCommands`, or `earlyAdopter` preserve the saved value. For older SDK callers, the +Older clients that omit `keepHistoryAfterContextClear`, +`summarizeShellCommands`, or `earlyAdopter` preserve the saved value. Show Git +changes and Commit button is a [Git plugin setting](#git-and-github-pr-status-plugins), +and the general-settings API rejects an update that still sends +`showGitChanges`. For older SDK callers, the general-settings API still accepts and returns `showUnhandledProviderEvents` as a deprecated alias of `showDiagnosticEvents`, and an existing value is preserved; when a read-modify-write payload contains conflicting values, the one @@ -1111,6 +1113,25 @@ commands; background cleanup started from the page survives navigation and reconnects. See the [plugin skill](../plugins/storage-retention/skills/storage-retention/SKILL.md). +### Git and GitHub PR Status plugins + +The builtin Git plugin's `showGitChanges` (default `true`) is Show Git changes +and Commit button on its plugin page. `false` hides the untracked, uncommitted, +and committed file summary and expanded file list above every thread composer, +and the Commit action in the thread header and overflow menu. The builtin +GitHub PR Status plugin's `showPullRequest` (default `true`) is Show pull +request above the composer on its plugin page. `false` hides the pull request +status, Mark ready and merge actions above every thread composer; the Info +tab's Pull request row stays. Thread relationships and workspace warnings stay +visible either way. + +```bash +bb plugin config bb--git set showGitChanges false +bb plugin config bb--github-pr-status set showPullRequest false +``` + +Upgrading copies the Settings → General switch's saved value into both. + ### Ask User Question plugin The builtin Ask User Question plugin keeps an unanswered question card open for diff --git a/packages/db/drizzle/0147_git_and_pr_status_plugin_show_settings.sql b/packages/db/drizzle/0147_git_and_pr_status_plugin_show_settings.sql new file mode 100644 index 00000000000..fb75bba7a6b --- /dev/null +++ b/packages/db/drizzle/0147_git_and_pr_status_plugin_show_settings.sql @@ -0,0 +1,9 @@ +INSERT INTO `plugin_settings` (`plugin_id`, `key`, `value`, `updated_at`) +SELECT 'bb--git', 'showGitChanges', `value`, `updated_at` + FROM `app_settings_values` WHERE `key` = 'showGitChanges' +UNION ALL +SELECT 'bb--github-pr-status', 'showPullRequest', `value`, `updated_at` + FROM `app_settings_values` WHERE `key` = 'showGitChanges' +ON CONFLICT (`plugin_id`, `key`) DO NOTHING; +--> statement-breakpoint +DELETE FROM `app_settings_values` WHERE `key` = 'showGitChanges'; diff --git a/packages/db/drizzle/meta/0147_snapshot.json b/packages/db/drizzle/meta/0147_snapshot.json new file mode 100644 index 00000000000..dab7d5e8e3b --- /dev/null +++ b/packages/db/drizzle/meta/0147_snapshot.json @@ -0,0 +1,5287 @@ +{ + "id": "a854cade-e8b1-4631-bc38-7512d8c40251", + "prevId": "7d0093af-15d4-4b46-819a-49f038d624ae", + "version": "6", + "dialect": "sqlite", + "tables": { + "app_settings": { + "name": "app_settings", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "caffeinate": { + "name": "caffeinate", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "show_keyboard_hints": { + "name": "show_keyboard_hints", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "steer_active_thread_on_enter": { + "name": "steer_active_thread_on_enter", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "show_unhandled_provider_events": { + "name": "show_unhandled_provider_events", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "codex_memory_enabled": { + "name": "codex_memory_enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "claude_code_memory_enabled": { + "name": "claude_code_memory_enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "codex_subagents_disabled": { + "name": "codex_subagents_disabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "claude_code_subagents_disabled": { + "name": "claude_code_subagents_disabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "claude_code_workflows_disabled": { + "name": "claude_code_workflows_disabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "keybinding_overrides": { + "name": "keybinding_overrides", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "onboarding_completed_at": { + "name": "onboarding_completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_settings_values": { + "name": "app_settings_values", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_theme": { + "name": "app_theme", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "theme_id": { + "name": "theme_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "favicon_color": { + "name": "favicon_color", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'default'" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "apikey": { + "name": "apikey", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "start": { + "name": "start", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "prefix": { + "name": "prefix", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "referenceId": { + "name": "referenceId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "refillInterval": { + "name": "refillInterval", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "refillAmount": { + "name": "refillAmount", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastRefillAt": { + "name": "lastRefillAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rateLimitEnabled": { + "name": "rateLimitEnabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rateLimitTimeWindow": { + "name": "rateLimitTimeWindow", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rateLimitMax": { + "name": "rateLimitMax", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "requestCount": { + "name": "requestCount", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "remaining": { + "name": "remaining", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lastRequest": { + "name": "lastRequest", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "configId": { + "name": "configId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "apikey_key_unique": { + "name": "apikey_key_unique", + "columns": [ + "key" + ], + "isUnique": true + }, + "apikey_reference_id_idx": { + "name": "apikey_reference_id_idx", + "columns": [ + "referenceId" + ], + "isUnique": false + }, + "apikey_config_id_idx": { + "name": "apikey_config_id_idx", + "columns": [ + "configId" + ], + "isUnique": false + } + }, + "foreignKeys": { + "apikey_referenceId_user_id_fk": { + "name": "apikey_referenceId_user_id_fk", + "tableFrom": "apikey", + "columnsFrom": [ + "referenceId" + ], + "tableTo": "user", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user": { + "name": "user", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "emailVerified": { + "name": "emailVerified", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "user_email_unique": { + "name": "user_email_unique", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "diff_viewed_files": { + "name": "diff_viewed_files", + "columns": { + "environment_id": { + "name": "environment_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_key": { + "name": "target_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revision": { + "name": "revision", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "diff_viewed_files_environment_id_environments_id_fk": { + "name": "diff_viewed_files_environment_id_environments_id_fk", + "tableFrom": "diff_viewed_files", + "columnsFrom": [ + "environment_id" + ], + "tableTo": "environments", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "diff_viewed_files_environment_id_target_key_path_pk": { + "columns": [ + "environment_id", + "target_key", + "path" + ], + "name": "diff_viewed_files_environment_id_target_key_path_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "environment_hook_operations": { + "name": "environment_hook_operations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "operation_id": { + "name": "operation_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "started_at": { + "name": "started_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "finished_at": { + "name": "finished_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "environment_variables": { + "name": "environment_variables", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ciphertext": { + "name": "ciphertext", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encryption_version": { + "name": "encryption_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "environment_variables_global_name": { + "name": "environment_variables_global_name", + "columns": [ + "name" + ], + "where": "\"environment_variables\".\"project_id\" IS NULL", + "isUnique": true + }, + "environment_variables_project_name": { + "name": "environment_variables_project_name", + "columns": [ + "project_id", + "name" + ], + "where": "\"environment_variables\".\"project_id\" IS NOT NULL", + "isUnique": true + } + }, + "foreignKeys": { + "environment_variables_project_id_projects_id_fk": { + "name": "environment_variables_project_id_projects_id_fk", + "tableFrom": "environment_variables", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "environments": { + "name": "environments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_git_repo": { + "name": "is_git_repo", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "is_worktree": { + "name": "is_worktree", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "branch_name": { + "name": "branch_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "base_branch": { + "name": "base_branch", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_branch": { + "name": "default_branch", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "merge_base_branch": { + "name": "merge_base_branch", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "environment_provider_id": { + "name": "environment_provider_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "environment_provider_plugin_id": { + "name": "environment_provider_plugin_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_owns_path": { + "name": "provider_owns_path", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "environment_provider_selection": { + "name": "environment_provider_selection", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "environment_provider_instance_key": { + "name": "environment_provider_instance_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "retire_at": { + "name": "retire_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "teardown_attempt": { + "name": "teardown_attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "teardown_status": { + "name": "teardown_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "teardown_message": { + "name": "teardown_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resource": { + "name": "resource", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "owner_thread_id": { + "name": "owner_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "status_message": { + "name": "status_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pending_log": { + "name": "pending_log", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "claim_path": { + "name": "claim_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'provisioning'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "environments_project_host_path_idx": { + "name": "environments_project_host_path_idx", + "columns": [ + "project_id", + "host_id", + "path" + ], + "isUnique": true + }, + "environments_host_path_lookup_idx": { + "name": "environments_host_path_lookup_idx", + "columns": [ + "host_id", + "path" + ], + "isUnique": false + }, + "environments_owner_thread_idx": { + "name": "environments_owner_thread_idx", + "columns": [ + "owner_thread_id" + ], + "where": "\"environments\".\"owner_thread_id\" IS NOT NULL", + "isUnique": true + }, + "environments_claim_idx": { + "name": "environments_claim_idx", + "columns": [ + "host_id", + "claim_path" + ], + "isUnique": false + }, + "environments_project_idx": { + "name": "environments_project_idx", + "columns": [ + "project_id" + ], + "isUnique": false + }, + "environments_status_idx": { + "name": "environments_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "environments_provider_instance_idx": { + "name": "environments_provider_instance_idx", + "columns": [ + "environment_provider_id", + "environment_provider_instance_key" + ], + "isUnique": false + }, + "environments_provider_lifecycle_idx": { + "name": "environments_provider_lifecycle_idx", + "columns": [ + "environment_provider_id" + ], + "where": "\"environments\".\"status\" <> 'destroyed' OR \"environments\".\"teardown_status\" IS NOT 'removed'", + "isUnique": false + } + }, + "foreignKeys": { + "environments_project_id_projects_id_fk": { + "name": "environments_project_id_projects_id_fk", + "tableFrom": "environments", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "environments_host_id_hosts_id_fk": { + "name": "environments_host_id_hosts_id_fk", + "tableFrom": "environments", + "columnsFrom": [ + "host_id" + ], + "tableTo": "hosts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "events": { + "name": "events", + "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 + }, + "environment_id": { + "name": "environment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scope_kind": { + "name": "scope_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "turn_id": { + "name": "turn_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_thread_id": { + "name": "provider_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "item_id": { + "name": "item_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "item_kind": { + "name": "item_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parent_tool_call_id": { + "name": "parent_tool_call_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "data": { + "name": "data", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "events_thread_sequence_idx": { + "name": "events_thread_sequence_idx", + "columns": [ + "thread_id", + "sequence" + ], + "isUnique": true + }, + "events_delegating_item_lookup_idx": { + "name": "events_delegating_item_lookup_idx", + "columns": [ + "thread_id", + "item_id", + "sequence", + "item_kind" + ], + "where": "\"events\".\"item_kind\" IN ('toolCall', 'delegation')", + "isUnique": false + }, + "events_plan_steps_thread_sequence_idx": { + "name": "events_plan_steps_thread_sequence_idx", + "columns": [ + "thread_id", + "sequence" + ], + "where": "(\"events\".\"item_kind\" = 'planSteps' AND \"events\".\"type\" = 'item/completed') OR \"events\".\"type\" = 'turn/plan/updated'", + "isUnique": false + }, + "events_parent_tool_call_thread_parent_sequence_idx": { + "name": "events_parent_tool_call_thread_parent_sequence_idx", + "columns": [ + "thread_id", + "parent_tool_call_id", + "sequence" + ], + "where": "\"events\".\"parent_tool_call_id\" IS NOT NULL", + "isUnique": false + }, + "events_thread_type_item_kind_sequence_idx": { + "name": "events_thread_type_item_kind_sequence_idx", + "columns": [ + "thread_id", + "type", + "item_kind", + "sequence" + ], + "isUnique": false + }, + "events_background_task_thread_type_item_sequence_idx": { + "name": "events_background_task_thread_type_item_sequence_idx", + "columns": [ + "thread_id", + "type", + "item_id", + "sequence" + ], + "where": "\"events\".\"item_kind\" = 'backgroundTask'", + "isUnique": false + }, + "events_thread_type_sequence_idx": { + "name": "events_thread_type_sequence_idx", + "columns": [ + "thread_id", + "type", + "sequence" + ], + "isUnique": false + }, + "events_thread_turn_type_item_sequence_idx": { + "name": "events_thread_turn_type_item_sequence_idx", + "columns": [ + "thread_id", + "turn_id", + "type", + "item_id", + "sequence" + ], + "isUnique": false + }, + "events_item_lifecycle_thread_item_sequence_idx": { + "name": "events_item_lifecycle_thread_item_sequence_idx", + "columns": [ + "thread_id", + "item_id", + "sequence" + ], + "where": "\"events\".\"type\" IN ('item/started', 'item/completed', 'item/backgroundTask/completed')", + "isUnique": false + }, + "events_environment_idx": { + "name": "events_environment_idx", + "columns": [ + "environment_id" + ], + "isUnique": false + }, + "events_provider_identity_idx": { + "name": "events_provider_identity_idx", + "columns": [ + "provider_thread_id", + "created_at" + ], + "where": "\"events\".\"type\" = 'thread/identity'", + "isUnique": false + }, + "events_completed_item_truncation_idx": { + "name": "events_completed_item_truncation_idx", + "columns": [ + "item_kind", + "created_at", + "id" + ], + "where": "\"events\".\"type\" = 'item/completed'", + "isUnique": false + }, + "events_thread_state_thread_sequence_idx": { + "name": "events_thread_state_thread_sequence_idx", + "columns": [ + "thread_id", + "sequence" + ], + "where": "\"events\".\"type\" IN ('thread/goal/updated', 'thread/goal/cleared', 'thread/extensionState/updated')", + "isUnique": false + } + }, + "foreignKeys": { + "events_thread_id_threads_id_fk": { + "name": "events_thread_id_threads_id_fk", + "tableFrom": "events", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "events_environment_id_environments_id_fk": { + "name": "events_environment_id_environments_id_fk", + "tableFrom": "events", + "columnsFrom": [ + "environment_id" + ], + "tableTo": "environments", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "events_scope_shape_check": { + "name": "events_scope_shape_check", + "value": "(\n (\"events\".\"scope_kind\" = 'turn' AND \"events\".\"turn_id\" IS NOT NULL)\n OR\n (\"events\".\"scope_kind\" = 'thread' AND \"events\".\"turn_id\" IS NULL)\n )" + } + } + }, + "host_daemon_sessions": { + "name": "host_daemon_sessions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "instance_id": { + "name": "instance_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_name": { + "name": "host_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "data_dir": { + "name": "data_dir", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "protocol_version": { + "name": "protocol_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "heartbeat_interval_ms": { + "name": "heartbeat_interval_ms", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lease_timeout_ms": { + "name": "lease_timeout_ms", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lease_expires_at": { + "name": "lease_expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "closed_at": { + "name": "closed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "close_reason": { + "name": "close_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "host_daemon_sessions_host_status_idx": { + "name": "host_daemon_sessions_host_status_idx", + "columns": [ + "host_id", + "status" + ], + "isUnique": false + }, + "host_daemon_sessions_host_latest_idx": { + "name": "host_daemon_sessions_host_latest_idx", + "columns": [ + "host_id", + "updated_at", + "created_at", + "id" + ], + "isUnique": false + }, + "host_daemon_sessions_closed_prune_idx": { + "name": "host_daemon_sessions_closed_prune_idx", + "columns": [ + "status", + "closed_at", + "id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "host_daemon_sessions_host_id_hosts_id_fk": { + "name": "host_daemon_sessions_host_id_hosts_id_fk", + "tableFrom": "host_daemon_sessions", + "columnsFrom": [ + "host_id" + ], + "tableTo": "hosts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "hosts": { + "name": "hosts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "connect_machine_id": { + "name": "connect_machine_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "machine_provider_id": { + "name": "machine_provider_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "launch_key": { + "name": "launch_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "machine_inputs": { + "name": "machine_inputs", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "machine_attempt": { + "name": "machine_attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "pending_log": { + "name": "pending_log", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "machine_operation_id": { + "name": "machine_operation_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "server_access_provider_id": { + "name": "server_access_provider_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "server_access_grant_id": { + "name": "server_access_grant_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resource": { + "name": "resource", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "phase": { + "name": "phase", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "suspended_at": { + "name": "suspended_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status_message": { + "name": "status_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "suspend_retry_at": { + "name": "suspend_retry_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "remove_retry_at": { + "name": "remove_retry_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "teardown_attempt": { + "name": "teardown_attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "teardown_status": { + "name": "teardown_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "max_permission_mode": { + "name": "max_permission_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'full'" + }, + "destroyed_at": { + "name": "destroyed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_rejected_protocol_version": { + "name": "last_rejected_protocol_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "hosts_last_seen_idx": { + "name": "hosts_last_seen_idx", + "columns": [ + "last_seen_at" + ], + "isUnique": false + }, + "hosts_pending_provider_idx": { + "name": "hosts_pending_provider_idx", + "columns": [ + "machine_provider_id" + ], + "where": "\"hosts\".\"destroyed_at\" IS NULL AND \"hosts\".\"phase\" <> 'destroyed'", + "isUnique": false + }, + "hosts_live_launch_key_idx": { + "name": "hosts_live_launch_key_idx", + "columns": [ + "launch_key" + ], + "where": "\"hosts\".\"destroyed_at\" is null", + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugins": { + "name": "plugins", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provenance": { + "name": "provenance", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'direct'" + }, + "catalog_entry_id": { + "name": "catalog_entry_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "catalog_marketplace_name": { + "name": "catalog_marketplace_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'path'" + }, + "source_path": { + "name": "source_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_builtin_name": { + "name": "source_builtin_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_package": { + "name": "source_npm_package", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_registry": { + "name": "source_npm_registry", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_requested_spec": { + "name": "source_npm_requested_spec", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_npm_spec_kind": { + "name": "source_npm_spec_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_url": { + "name": "source_git_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_subdirectory": { + "name": "source_git_subdirectory", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_requested_ref": { + "name": "source_git_requested_ref", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_ref_kind": { + "name": "source_git_ref_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_range": { + "name": "source_git_range", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_tag_prefix": { + "name": "source_git_tag_prefix", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_resolved_tag": { + "name": "source_git_resolved_tag", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "npm_resolved_version": { + "name": "npm_resolved_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "npm_integrity": { + "name": "npm_integrity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "git_resolved_commit": { + "name": "git_resolved_commit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_update_check_at": { + "name": "last_update_check_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "available_compatible_version": { + "name": "available_compatible_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "newest_incompatible_version": { + "name": "newest_incompatible_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "update_status_detail": { + "name": "update_status_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_failure_version": { + "name": "last_failure_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_failure_at": { + "name": "last_failure_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_failure_detail": { + "name": "last_failure_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "active_artifact_id": { + "name": "active_artifact_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "normalization_version": { + "name": "normalization_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "root_dir": { + "name": "root_dir", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "enabled_follows_default": { + "name": "enabled_follows_default", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "removed_at": { + "name": "removed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "installed_at": { + "name": "installed_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "plugins_active_artifact_id_plugin_artifacts_id_fk": { + "name": "plugins_active_artifact_id_plugin_artifacts_id_fk", + "tableFrom": "plugins", + "columnsFrom": [ + "active_artifact_id" + ], + "tableTo": "plugin_artifacts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "maintenance_scan_cursors": { + "name": "maintenance_scan_cursors", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "policy": { + "name": "policy", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "item_kind": { + "name": "item_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "output_path": { + "name": "output_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_created_at": { + "name": "last_created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_event_id": { + "name": "last_event_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "maintenance_scan_cursors_path_idx": { + "name": "maintenance_scan_cursors_path_idx", + "columns": [ + "policy", + "version", + "item_kind", + "output_path" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "pending_interactions": { + "name": "pending_interactions", + "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 + }, + "origin_kind": { + "name": "origin_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'provider'" + }, + "turn_id": { + "name": "turn_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_thread_id": { + "name": "provider_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_request_id": { + "name": "provider_request_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "renderer_id": { + "name": "renderer_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resolution": { + "name": "resolution", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status_reason": { + "name": "status_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resolved_at": { + "name": "resolved_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "pending_interactions_provider_request_idx": { + "name": "pending_interactions_provider_request_idx", + "columns": [ + "provider_id", + "provider_thread_id", + "provider_request_id" + ], + "isUnique": true + }, + "pending_interactions_thread_created_idx": { + "name": "pending_interactions_thread_created_idx", + "columns": [ + "thread_id", + "created_at" + ], + "isUnique": false + }, + "pending_interactions_thread_status_created_idx": { + "name": "pending_interactions_thread_status_created_idx", + "columns": [ + "thread_id", + "status", + "created_at" + ], + "isUnique": false + }, + "pending_interactions_status_created_idx": { + "name": "pending_interactions_status_created_idx", + "columns": [ + "status", + "created_at" + ], + "isUnique": false + }, + "pending_interactions_plugin_status_created_idx": { + "name": "pending_interactions_plugin_status_created_idx", + "columns": [ + "plugin_id", + "status", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "pending_interactions_thread_id_threads_id_fk": { + "name": "pending_interactions_thread_id_threads_id_fk", + "tableFrom": "pending_interactions", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_artifacts": { + "name": "plugin_artifacts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "npm_resolved_version": { + "name": "npm_resolved_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "git_resolved_commit": { + "name": "git_resolved_commit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "git_checkout_root": { + "name": "git_checkout_root", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "integrity": { + "name": "integrity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "validation_result": { + "name": "validation_result", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "validated_at": { + "name": "validated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "plugin_artifacts_plugin_idx": { + "name": "plugin_artifacts_plugin_idx", + "columns": [ + "plugin_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_kv": { + "name": "plugin_kv", + "columns": { + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plugin_kv_plugin_id_key_pk": { + "columns": [ + "plugin_id", + "key" + ], + "name": "plugin_kv_plugin_id_key_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_marketplace_icons": { + "name": "plugin_marketplace_icons", + "columns": { + "marketplace_name": { + "name": "marketplace_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entry_id": { + "name": "entry_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_url": { + "name": "source_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "etag": { + "name": "etag", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "bytes": { + "name": "bytes", + "type": "blob", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plugin_marketplace_icons_marketplace_name_entry_id_pk": { + "columns": [ + "marketplace_name", + "entry_id" + ], + "name": "plugin_marketplace_icons_marketplace_name_entry_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_marketplaces": { + "name": "plugin_marketplaces", + "columns": { + "name": { + "name": "name", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'https'" + }, + "manifest_url": { + "name": "manifest_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_git_ref": { + "name": "source_git_ref", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_subdirectory": { + "name": "source_git_subdirectory", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_git_commit": { + "name": "source_git_commit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "manifest_json": { + "name": "manifest_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stats_json": { + "name": "stats_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "etag": { + "name": "etag", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_modified": { + "name": "last_modified", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_successful_refresh_at": { + "name": "last_successful_refresh_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_attempted_refresh_at": { + "name": "last_attempted_refresh_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "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 + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_schedules": { + "name": "plugin_schedules", + "columns": { + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cron": { + "name": "cron", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "next_run_at": { + "name": "next_run_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_run_at": { + "name": "last_run_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_status": { + "name": "last_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plugin_schedules_plugin_id_name_pk": { + "columns": [ + "plugin_id", + "name" + ], + "name": "plugin_schedules_plugin_id_name_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_settings": { + "name": "plugin_settings", + "columns": { + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plugin_settings_plugin_id_key_pk": { + "columns": [ + "plugin_id", + "key" + ], + "name": "plugin_settings_plugin_id_key_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "plugin_state_snapshots": { + "name": "plugin_state_snapshots", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "from_artifact_id": { + "name": "from_artifact_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "to_artifact_id": { + "name": "to_artifact_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "snapshot_path": { + "name": "snapshot_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "database_path": { + "name": "database_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "state_path": { + "name": "state_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secrets_path": { + "name": "secrets_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "registration_path": { + "name": "registration_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rollback_candidate_version": { + "name": "rollback_candidate_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_source_fingerprint": { + "name": "rollback_source_fingerprint", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_bb_version": { + "name": "rollback_bb_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_sdk_version": { + "name": "rollback_sdk_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rollback_detail": { + "name": "rollback_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "retained_until": { + "name": "retained_until", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "plugin_state_snapshots_plugin_idx": { + "name": "plugin_state_snapshots_plugin_idx", + "columns": [ + "plugin_id" + ], + "isUnique": false + }, + "plugin_state_snapshots_retention_idx": { + "name": "plugin_state_snapshots_retention_idx", + "columns": [ + "retained_until" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "project_attachment_backfills": { + "name": "project_attachment_backfills", + "columns": { + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "phase": { + "name": "phase", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "thread_cursor": { + "name": "thread_cursor", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "input_cursor": { + "name": "input_cursor", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "input_id": { + "name": "input_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "input_sequence": { + "name": "input_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "attempted_at": { + "name": "attempted_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_attachment_backfills_project_id_projects_id_fk": { + "name": "project_attachment_backfills_project_id_projects_id_fk", + "tableFrom": "project_attachment_backfills", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "project_attachment_threads": { + "name": "project_attachment_threads", + "columns": { + "attachment_id": { + "name": "attachment_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "project_attachment_threads_thread_idx": { + "name": "project_attachment_threads_thread_idx", + "columns": [ + "thread_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "project_attachment_threads_attachment_id_project_attachments_id_fk": { + "name": "project_attachment_threads_attachment_id_project_attachments_id_fk", + "tableFrom": "project_attachment_threads", + "columnsFrom": [ + "attachment_id" + ], + "tableTo": "project_attachments", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "project_attachment_threads_thread_id_threads_id_fk": { + "name": "project_attachment_threads_thread_id_threads_id_fk", + "tableFrom": "project_attachment_threads", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "project_attachment_threads_attachment_id_thread_id_pk": { + "columns": [ + "attachment_id", + "thread_id" + ], + "name": "project_attachment_threads_attachment_id_thread_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "project_attachments": { + "name": "project_attachments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stored_path": { + "name": "stored_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "size_bytes": { + "name": "size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ready_at": { + "name": "ready_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deletion_claimed_at": { + "name": "deletion_claimed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "project_attachments_project_path_idx": { + "name": "project_attachments_project_path_idx", + "columns": [ + "project_id", + "stored_path" + ], + "isUnique": true + }, + "project_attachments_project_created_idx": { + "name": "project_attachments_project_created_idx", + "columns": [ + "project_id", + "created_at" + ], + "isUnique": false + }, + "project_attachments_deletion_idx": { + "name": "project_attachments_deletion_idx", + "columns": [ + "project_id", + "deletion_claimed_at", + "id" + ], + "where": "\"project_attachments\".\"deletion_claimed_at\" IS NOT NULL", + "isUnique": false + } + }, + "foreignKeys": { + "project_attachments_project_id_projects_id_fk": { + "name": "project_attachments_project_id_projects_id_fk", + "tableFrom": "project_attachments", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "project_attachments_size_check": { + "name": "project_attachments_size_check", + "value": "\"project_attachments\".\"size_bytes\" >= 0" + } + } + }, + "project_execution_defaults": { + "name": "project_execution_defaults", + "columns": { + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "service_tier": { + "name": "service_tier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reasoning_level": { + "name": "reasoning_level", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "permission_mode": { + "name": "permission_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "project_execution_defaults_project_idx": { + "name": "project_execution_defaults_project_idx", + "columns": [ + "project_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "project_execution_defaults_project_id_projects_id_fk": { + "name": "project_execution_defaults_project_id_projects_id_fk", + "tableFrom": "project_execution_defaults", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "project_sources": { + "name": "project_sources", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "owns_path": { + "name": "owns_path", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "is_default": { + "name": "is_default", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "project_sources_project_idx": { + "name": "project_sources_project_idx", + "columns": [ + "project_id" + ], + "isUnique": false + }, + "project_sources_host_idx": { + "name": "project_sources_host_idx", + "columns": [ + "host_id" + ], + "isUnique": false + }, + "project_sources_project_host_idx": { + "name": "project_sources_project_host_idx", + "columns": [ + "project_id", + "host_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "project_sources_project_id_projects_id_fk": { + "name": "project_sources_project_id_projects_id_fk", + "tableFrom": "project_sources", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "project_sources_host_id_hosts_id_fk": { + "name": "project_sources_host_id_hosts_id_fk", + "tableFrom": "project_sources", + "columnsFrom": [ + "host_id" + ], + "tableTo": "hosts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "project_sources_shape_check": { + "name": "project_sources_shape_check", + "value": "(\n \"project_sources\".\"type\" = 'local_path' AND \"project_sources\".\"host_id\" IS NOT NULL AND \"project_sources\".\"path\" IS NOT NULL\n )" + } + } + }, + "projects": { + "name": "projects", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'standard'" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "git_remote_url": { + "name": "git_remote_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_key": { + "name": "sort_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'V'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "projects_updated_idx": { + "name": "projects_updated_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + }, + "projects_deleted_idx": { + "name": "projects_deleted_idx", + "columns": [ + "deleted_at" + ], + "isUnique": false + }, + "projects_sort_idx": { + "name": "projects_sort_idx", + "columns": [ + "sort_key", + "id" + ], + "isUnique": false + }, + "projects_personal_singleton_idx": { + "name": "projects_personal_singleton_idx", + "columns": [ + "kind" + ], + "where": "\"projects\".\"kind\" = 'personal'", + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "prompt_history_entries": { + "name": "prompt_history_entries", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "request_sequence": { + "name": "request_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "input": { + "name": "input", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "prompt_history_entries_thread_request_idx": { + "name": "prompt_history_entries_thread_request_idx", + "columns": [ + "thread_id", + "request_sequence" + ], + "isUnique": true + }, + "prompt_history_entries_project_scope_created_idx": { + "name": "prompt_history_entries_project_scope_created_idx", + "columns": [ + "project_id", + "scope", + "created_at", + "request_sequence", + "id" + ], + "isUnique": false + }, + "prompt_history_entries_created_idx": { + "name": "prompt_history_entries_created_idx", + "columns": [ + "created_at", + "request_sequence", + "id" + ], + "isUnique": false + }, + "prompt_history_entries_thread_scope_created_idx": { + "name": "prompt_history_entries_thread_scope_created_idx", + "columns": [ + "thread_id", + "scope", + "created_at", + "request_sequence", + "id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "prompt_history_entries_project_id_projects_id_fk": { + "name": "prompt_history_entries_project_id_projects_id_fk", + "tableFrom": "prompt_history_entries", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "prompt_history_entries_thread_id_threads_id_fk": { + "name": "prompt_history_entries_thread_id_threads_id_fk", + "tableFrom": "prompt_history_entries", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "provider_model_catalogs": { + "name": "provider_model_catalogs", + "columns": { + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scope_key": { + "name": "scope_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fingerprint": { + "name": "fingerprint", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "models_json": { + "name": "models_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "selected_only_models_json": { + "name": "selected_only_models_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fetched_at": { + "name": "fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "provider_model_catalogs_host_id_hosts_id_fk": { + "name": "provider_model_catalogs_host_id_hosts_id_fk", + "tableFrom": "provider_model_catalogs", + "columnsFrom": [ + "host_id" + ], + "tableTo": "hosts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "provider_model_catalogs_host_id_provider_id_scope_key_pk": { + "columns": [ + "host_id", + "provider_id", + "scope_key" + ], + "name": "provider_model_catalogs_host_id_provider_id_scope_key_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "queued_thread_messages": { + "name": "queued_thread_messages", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "system_notice": { + "name": "system_notice", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sender_thread_id": { + "name": "sender_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "origin": { + "name": "origin", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "origin_plugin_id": { + "name": "origin_plugin_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "requested_by_initiator": { + "name": "requested_by_initiator", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "requested_by_thread_id": { + "name": "requested_by_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reasoning_level": { + "name": "reasoning_level", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "permission_mode": { + "name": "permission_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "service_tier": { + "name": "service_tier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "group_with_next": { + "name": "group_with_next", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "send_at": { + "name": "send_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "waiting_on": { + "name": "waiting_on", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "wait_holder": { + "name": "wait_holder", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "failure_reason": { + "name": "failure_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "next_attempt_at": { + "name": "next_attempt_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payload_kind": { + "name": "payload_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'inline'" + }, + "retry_of_turn_request_id": { + "name": "retry_of_turn_request_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "retry_attempt": { + "name": "retry_attempt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "retry_reason": { + "name": "retry_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "claimed_at": { + "name": "claimed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "claim_token": { + "name": "claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "edit_held_until": { + "name": "edit_held_until", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_key": { + "name": "sort_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "queued_thread_messages_thread_created_idx": { + "name": "queued_thread_messages_thread_created_idx", + "columns": [ + "thread_id", + "created_at", + "id" + ], + "isUnique": false + }, + "queued_thread_messages_thread_sort_idx": { + "name": "queued_thread_messages_thread_sort_idx", + "columns": [ + "thread_id", + "sort_key", + "id" + ], + "isUnique": false + }, + "queued_thread_messages_due_idx": { + "name": "queued_thread_messages_due_idx", + "columns": [ + "state", + "send_at", + "id" + ], + "isUnique": false + }, + "queued_thread_messages_retry_idx": { + "name": "queued_thread_messages_retry_idx", + "columns": [ + "state", + "next_attempt_at", + "id" + ], + "isUnique": false + }, + "queued_thread_messages_wait_holder_idx": { + "name": "queued_thread_messages_wait_holder_idx", + "columns": [ + "wait_holder", + "id" + ], + "where": "\"queued_thread_messages\".\"wait_holder\" IS NOT NULL", + "isUnique": false + } + }, + "foreignKeys": { + "queued_thread_messages_thread_id_threads_id_fk": { + "name": "queued_thread_messages_thread_id_threads_id_fk", + "tableFrom": "queued_thread_messages", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": { + "queued_thread_messages_state_check": { + "name": "queued_thread_messages_state_check", + "value": "CASE \"queued_thread_messages\".\"state\"\n WHEN 'claimed' THEN \"queued_thread_messages\".\"claimed_at\" IS NOT NULL\n WHEN 'failed_retrying' THEN \"queued_thread_messages\".\"claimed_at\" IS NULL AND \"queued_thread_messages\".\"failure_reason\" IS NOT NULL AND \"queued_thread_messages\".\"next_attempt_at\" IS NOT NULL\n WHEN 'failed_exhausted' THEN \"queued_thread_messages\".\"claimed_at\" IS NULL AND \"queued_thread_messages\".\"failure_reason\" IS NOT NULL AND \"queued_thread_messages\".\"next_attempt_at\" IS NULL\n WHEN 'scheduled' THEN \"queued_thread_messages\".\"claimed_at\" IS NULL AND \"queued_thread_messages\".\"failure_reason\" IS NULL AND \"queued_thread_messages\".\"send_at\" IS NOT NULL\n WHEN 'waiting' THEN \"queued_thread_messages\".\"claimed_at\" IS NULL AND \"queued_thread_messages\".\"failure_reason\" IS NULL AND \"queued_thread_messages\".\"send_at\" IS NULL AND \"queued_thread_messages\".\"waiting_on\" IS NOT NULL\n WHEN 'queued' THEN \"queued_thread_messages\".\"claimed_at\" IS NULL AND \"queued_thread_messages\".\"failure_reason\" IS NULL AND \"queued_thread_messages\".\"send_at\" IS NULL AND \"queued_thread_messages\".\"waiting_on\" IS NULL\n ELSE 0\n END" + }, + "queued_thread_messages_claim_check": { + "name": "queued_thread_messages_claim_check", + "value": "(\"queued_thread_messages\".\"claimed_at\" IS NULL) = (\"queued_thread_messages\".\"claim_token\" IS NULL)" + }, + "queued_thread_messages_failure_check": { + "name": "queued_thread_messages_failure_check", + "value": "(\"queued_thread_messages\".\"failure_reason\" IS NULL AND \"queued_thread_messages\".\"failure_count\" = 0 AND \"queued_thread_messages\".\"next_attempt_at\" IS NULL)\n OR (\"queued_thread_messages\".\"failure_reason\" IS NOT NULL AND \"queued_thread_messages\".\"failure_count\" > 0)" + }, + "queued_thread_messages_schedule_check": { + "name": "queued_thread_messages_schedule_check", + "value": "\"queued_thread_messages\".\"send_at\" IS NULL OR \"queued_thread_messages\".\"waiting_on\" IS NOT NULL" + }, + "queued_thread_messages_wait_holder_check": { + "name": "queued_thread_messages_wait_holder_check", + "value": "\"queued_thread_messages\".\"wait_holder\" IS (CASE WHEN json_extract(\"queued_thread_messages\".\"waiting_on\", '$.kind') = 'plugin' THEN 'plugin:' || json_extract(\"queued_thread_messages\".\"waiting_on\", '$.pluginId') END)" + } + } + }, + "retained_event_outputs": { + "name": "retained_event_outputs", + "columns": { + "event_id": { + "name": "event_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "output_path": { + "name": "output_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "retained_event_outputs_expiry_idx": { + "name": "retained_event_outputs_expiry_idx", + "columns": [ + "expires_at", + "event_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "retained_event_outputs_event_id_events_id_fk": { + "name": "retained_event_outputs_event_id_events_id_fk", + "tableFrom": "retained_event_outputs", + "columnsFrom": [ + "event_id" + ], + "tableTo": "events", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "system_experiments": { + "name": "system_experiments", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "terminal_sessions": { + "name": "terminal_sessions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "environment_id": { + "name": "environment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "host_id": { + "name": "host_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "daemon_session_id": { + "name": "daemon_session_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "initial_cwd": { + "name": "initial_cwd", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cols": { + "name": "cols", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rows": { + "name": "rows", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "exit_code": { + "name": "exit_code", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "close_reason": { + "name": "close_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_user_input_at": { + "name": "last_user_input_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "terminal_sessions_thread_status_updated_idx": { + "name": "terminal_sessions_thread_status_updated_idx", + "columns": [ + "thread_id", + "status", + "updated_at" + ], + "isUnique": false + }, + "terminal_sessions_environment_status_idx": { + "name": "terminal_sessions_environment_status_idx", + "columns": [ + "environment_id", + "status" + ], + "isUnique": false + }, + "terminal_sessions_status_thread_idx": { + "name": "terminal_sessions_status_thread_idx", + "columns": [ + "status", + "thread_id" + ], + "isUnique": false + }, + "terminal_sessions_host_status_idx": { + "name": "terminal_sessions_host_status_idx", + "columns": [ + "host_id", + "status" + ], + "isUnique": false + }, + "terminal_sessions_daemon_session_idx": { + "name": "terminal_sessions_daemon_session_idx", + "columns": [ + "daemon_session_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "terminal_sessions_thread_id_threads_id_fk": { + "name": "terminal_sessions_thread_id_threads_id_fk", + "tableFrom": "terminal_sessions", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "terminal_sessions_environment_id_environments_id_fk": { + "name": "terminal_sessions_environment_id_environments_id_fk", + "tableFrom": "terminal_sessions", + "columnsFrom": [ + "environment_id" + ], + "tableTo": "environments", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "terminal_sessions_host_id_hosts_id_fk": { + "name": "terminal_sessions_host_id_hosts_id_fk", + "tableFrom": "terminal_sessions", + "columnsFrom": [ + "host_id" + ], + "tableTo": "hosts", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "terminal_sessions_daemon_session_id_host_daemon_sessions_id_fk": { + "name": "terminal_sessions_daemon_session_id_host_daemon_sessions_id_fk", + "tableFrom": "terminal_sessions", + "columnsFrom": [ + "daemon_session_id" + ], + "tableTo": "host_daemon_sessions", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_conversation_outlines": { + "name": "thread_conversation_outlines", + "columns": { + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "projection_key": { + "name": "projection_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "items_json": { + "name": "items_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "thread_conversation_outlines_thread_id_threads_id_fk": { + "name": "thread_conversation_outlines_thread_id_threads_id_fk", + "tableFrom": "thread_conversation_outlines", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_dynamic_context_file_states": { + "name": "thread_dynamic_context_file_states", + "columns": { + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "file_key": { + "name": "file_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_status": { + "name": "content_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "shown_at": { + "name": "shown_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "thread_dynamic_context_file_states_thread_file_idx": { + "name": "thread_dynamic_context_file_states_thread_file_idx", + "columns": [ + "thread_id", + "file_key" + ], + "isUnique": true + } + }, + "foreignKeys": { + "thread_dynamic_context_file_states_thread_id_threads_id_fk": { + "name": "thread_dynamic_context_file_states_thread_id_threads_id_fk", + "tableFrom": "thread_dynamic_context_file_states", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_plugin_metadata": { + "name": "thread_plugin_metadata", + "columns": { + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "plugin_id": { + "name": "plugin_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata_json": { + "name": "metadata_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "thread_plugin_metadata_thread_id_threads_id_fk": { + "name": "thread_plugin_metadata_thread_id_threads_id_fk", + "tableFrom": "thread_plugin_metadata", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "thread_plugin_metadata_thread_id_plugin_id_pk": { + "columns": [ + "thread_id", + "plugin_id" + ], + "name": "thread_plugin_metadata_thread_id_plugin_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_pruning_cursors": { + "name": "thread_pruning_cursors", + "columns": { + "policy": { + "name": "policy", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_thread_id": { + "name": "last_thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "current_thread_id": { + "name": "current_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "step": { + "name": "step", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "upper_sequence": { + "name": "upper_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "work_revision": { + "name": "work_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "cycle": { + "name": "cycle", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "latest_root_sequence": { + "name": "latest_root_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "latest_context_sequence": { + "name": "latest_context_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "probe_event_id": { + "name": "probe_event_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "probe_phase": { + "name": "probe_phase", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "probe_sequence": { + "name": "probe_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "probe_witness_id": { + "name": "probe_witness_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "thread_pruning_cursors_thread_idx": { + "name": "thread_pruning_cursors_thread_idx", + "columns": [ + "thread_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "thread_pruning_cursors_thread_id_threads_id_fk": { + "name": "thread_pruning_cursors_thread_id_threads_id_fk", + "tableFrom": "thread_pruning_cursors", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "thread_pruning_cursors_policy_scope_pk": { + "columns": [ + "policy", + "scope" + ], + "name": "thread_pruning_cursors_policy_scope_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": { + "thread_pruning_cursors_scope_check": { + "name": "thread_pruning_cursors_scope_check", + "value": "\"thread_pruning_cursors\".\"scope\" = coalesce(\"thread_pruning_cursors\".\"thread_id\", '')" + } + } + }, + "thread_pruning_work": { + "name": "thread_pruning_work", + "columns": { + "policy": { + "name": "policy", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "thread_pruning_work_thread_idx": { + "name": "thread_pruning_work_thread_idx", + "columns": [ + "thread_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "thread_pruning_work_thread_id_threads_id_fk": { + "name": "thread_pruning_work_thread_id_threads_id_fk", + "tableFrom": "thread_pruning_work", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": { + "thread_pruning_work_policy_thread_id_pk": { + "columns": [ + "policy", + "thread_id" + ], + "name": "thread_pruning_work_policy_thread_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_search_segments": { + "name": "thread_search_segments", + "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 + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_key": { + "name": "source_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_seq": { + "name": "source_seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "thread_search_segments_source_idx": { + "name": "thread_search_segments_source_idx", + "columns": [ + "thread_id", + "source_kind", + "source_key" + ], + "isUnique": true + }, + "thread_search_segments_thread_source_seq_idx": { + "name": "thread_search_segments_thread_source_seq_idx", + "columns": [ + "thread_id", + "source_seq" + ], + "isUnique": false + } + }, + "foreignKeys": { + "thread_search_segments_thread_id_threads_id_fk": { + "name": "thread_search_segments_thread_id_threads_id_fk", + "tableFrom": "thread_search_segments", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_sections": { + "name": "thread_sections", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "thread_sections_name_idx": { + "name": "thread_sections_name_idx", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "thread_tabs": { + "name": "thread_tabs", + "columns": { + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tabs_json": { + "name": "tabs_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "thread_tabs_thread_id_threads_id_fk": { + "name": "thread_tabs_thread_id_threads_id_fk", + "tableFrom": "thread_tabs", + "columnsFrom": [ + "thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "threads": { + "name": "threads", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "environment_id": { + "name": "environment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model_override": { + "name": "model_override", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reasoning_level_override": { + "name": "reasoning_level_override", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title_fallback": { + "name": "title_fallback", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "section_id": { + "name": "section_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'starting'" + }, + "startup_context": { + "name": "startup_context", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parent_thread_id": { + "name": "parent_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lifecycle_owner_thread_id": { + "name": "lifecycle_owner_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_thread_id": { + "name": "source_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "origin_kind": { + "name": "origin_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "origin_plugin_id": { + "name": "origin_plugin_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'visible'" + }, + "parent_notifications": { + "name": "parent_notifications", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'auto'" + }, + "archived_at": { + "name": "archived_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pinned_at": { + "name": "pinned_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pin_sort_key": { + "name": "pin_sort_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "storage_deleted_at": { + "name": "storage_deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_read_at": { + "name": "last_read_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "latest_attention_at": { + "name": "latest_attention_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "threads_project_id_idx": { + "name": "threads_project_id_idx", + "columns": [ + "project_id", + "id" + ], + "isUnique": false + }, + "threads_project_updated_idx": { + "name": "threads_project_updated_idx", + "columns": [ + "project_id", + "updated_at" + ], + "isUnique": false + }, + "threads_project_archived_deleted_idx": { + "name": "threads_project_archived_deleted_idx", + "columns": [ + "project_id", + "archived_at", + "deleted_at", + "id" + ], + "isUnique": false + }, + "threads_pin_sort_idx": { + "name": "threads_pin_sort_idx", + "columns": [ + "archived_at", + "deleted_at", + "pin_sort_key", + "id" + ], + "where": "\"threads\".\"pinned_at\" IS NOT NULL", + "isUnique": false + }, + "threads_environment_idx": { + "name": "threads_environment_idx", + "columns": [ + "environment_id" + ], + "isUnique": false + }, + "threads_lifecycle_owner_idx": { + "name": "threads_lifecycle_owner_idx", + "columns": [ + "lifecycle_owner_thread_id" + ], + "isUnique": false + }, + "threads_parent_idx": { + "name": "threads_parent_idx", + "columns": [ + "parent_thread_id" + ], + "isUnique": false + }, + "threads_source_origin_idx": { + "name": "threads_source_origin_idx", + "columns": [ + "source_thread_id", + "origin_kind" + ], + "isUnique": false + }, + "threads_origin_plugin_archived_idx": { + "name": "threads_origin_plugin_archived_idx", + "columns": [ + "origin_plugin_id", + "archived_at" + ], + "isUnique": false + }, + "threads_section_archived_deleted_idx": { + "name": "threads_section_archived_deleted_idx", + "columns": [ + "section_id", + "archived_at", + "deleted_at", + "id" + ], + "isUnique": false + }, + "threads_archived_status_idx": { + "name": "threads_archived_status_idx", + "columns": [ + "archived_at", + "status" + ], + "isUnique": false + }, + "threads_deleted_cleanup_idx": { + "name": "threads_deleted_cleanup_idx", + "columns": [ + "deleted_at" + ], + "where": "\"threads\".\"deleted_at\" IS NOT NULL", + "isUnique": false + }, + "threads_environment_archived_deleted_idx": { + "name": "threads_environment_archived_deleted_idx", + "columns": [ + "environment_id", + "archived_at", + "deleted_at" + ], + "isUnique": false + }, + "threads_active_maintenance_idx": { + "name": "threads_active_maintenance_idx", + "columns": [ + "status" + ], + "where": "\"threads\".\"deleted_at\" IS NULL", + "isUnique": false + } + }, + "foreignKeys": { + "threads_project_id_projects_id_fk": { + "name": "threads_project_id_projects_id_fk", + "tableFrom": "threads", + "columnsFrom": [ + "project_id" + ], + "tableTo": "projects", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "cascade" + }, + "threads_environment_id_environments_id_fk": { + "name": "threads_environment_id_environments_id_fk", + "tableFrom": "threads", + "columnsFrom": [ + "environment_id" + ], + "tableTo": "environments", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "threads_section_id_thread_sections_id_fk": { + "name": "threads_section_id_thread_sections_id_fk", + "tableFrom": "threads", + "columnsFrom": [ + "section_id" + ], + "tableTo": "thread_sections", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "threads_parent_thread_id_threads_id_fk": { + "name": "threads_parent_thread_id_threads_id_fk", + "tableFrom": "threads", + "columnsFrom": [ + "parent_thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + }, + "threads_lifecycle_owner_thread_id_threads_id_fk": { + "name": "threads_lifecycle_owner_thread_id_threads_id_fk", + "tableFrom": "threads", + "columnsFrom": [ + "lifecycle_owner_thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "restrict" + }, + "threads_source_thread_id_threads_id_fk": { + "name": "threads_source_thread_id_threads_id_fk", + "tableFrom": "threads", + "columnsFrom": [ + "source_thread_id" + ], + "tableTo": "threads", + "columnsTo": [ + "id" + ], + "onUpdate": "no action", + "onDelete": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "ui_preference_defaults": { + "name": "ui_preference_defaults", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value_json": { + "name": "value_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "ui_preferences": { + "name": "ui_preferences", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value_json": { + "name": "value_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 26bbc30f2b1..89c6c070064 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -1030,6 +1030,13 @@ "when": 1792453324528, "tag": "0146_diff_viewed_files", "breakpoints": true + }, + { + "idx": 147, + "version": "6", + "when": 1793141159432, + "tag": "0147_git_and_pr_status_plugin_show_settings", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/db/test/migrate.test.ts b/packages/db/test/migrate.test.ts index 5615ff26ce7..233d4593494 100644 --- a/packages/db/test/migrate.test.ts +++ b/packages/db/test/migrate.test.ts @@ -458,6 +458,12 @@ const providerSettingsToPluginsMigrationPath = resolve( "drizzle", "0105_provider_settings_to_plugins.sql", ); +const showGitChangesToPluginsMigrationPath = resolve( + __dirname, + "..", + "drizzle", + "0147_git_and_pr_status_plugin_show_settings.sql", +); const retireRequestedAtMigrationPath = resolve( __dirname, "..", @@ -1785,7 +1791,6 @@ describe("migrate", () => { expect(getAppSettings(db)).toEqual({ showKeyboardHints: false, - showGitChanges: true, steerActiveThreadOnEnter: true, terminalCopyOnSelect: true, confirmThreadArchive: true, @@ -1920,6 +1925,67 @@ describe("migrate", () => { } }); + it("carries showGitChanges into the Git and GitHub PR Status plugins and retires the shared row", () => { + const db = createConnection(":memory:"); + try { + db.$client.exec(` + CREATE TABLE app_settings_values ( + key text PRIMARY KEY NOT NULL, + value text NOT NULL, + updated_at integer NOT NULL + ); + CREATE TABLE plugin_settings ( + plugin_id text NOT NULL, + key text NOT NULL, + value text NOT NULL, + updated_at integer NOT NULL, + PRIMARY KEY (plugin_id, key) + ); + INSERT INTO app_settings_values (key, value, updated_at) VALUES + ('showKeyboardHints', 'false', 10), + ('showGitChanges', 'false', 11); + `); + + runMigrationFile({ + db, + migrationPath: showGitChangesToPluginsMigrationPath, + }); + + expect( + db.$client + .prepare< + [], + { pluginId: string; key: string; value: string; updatedAt: number } + >( + "SELECT plugin_id AS pluginId, key, value, updated_at AS updatedAt FROM plugin_settings ORDER BY plugin_id, key", + ) + .all(), + ).toEqual([ + { + pluginId: "bb--git", + key: "showGitChanges", + value: "false", + updatedAt: 11, + }, + { + pluginId: "bb--github-pr-status", + key: "showPullRequest", + value: "false", + updatedAt: 11, + }, + ]); + expect( + db.$client + .prepare<[], { key: string }>( + "SELECT key FROM app_settings_values ORDER BY key", + ) + .all(), + ).toEqual([{ key: "showKeyboardHints" }]); + } finally { + closeConnection(db); + } + }); + it("keeps a never-onboarded install null through the app settings move", () => { const db = createConnection(":memory:"); diff --git a/packages/domain/src/app-settings.ts b/packages/domain/src/app-settings.ts index e39c47e67ff..8f3c146e4e1 100644 --- a/packages/domain/src/app-settings.ts +++ b/packages/domain/src/app-settings.ts @@ -24,7 +24,6 @@ export const managedBranchPrefixSchema = z export const appSettingsSchema = z .object({ showKeyboardHints: z.boolean(), - showGitChanges: z.boolean(), steerActiveThreadOnEnter: z.boolean(), terminalCopyOnSelect: z.boolean(), confirmThreadArchive: z.boolean(), @@ -64,7 +63,6 @@ export type AppSettings = z.infer; export const defaultAppSettings: AppSettings = { showKeyboardHints: true, - showGitChanges: true, steerActiveThreadOnEnter: true, terminalCopyOnSelect: true, confirmThreadArchive: true, @@ -96,7 +94,6 @@ export const appSettingsUpdateSchema = z.union([ allowFastServiceTier: z.boolean().optional(), telemetryEnabled: z.boolean().optional(), confirmThreadArchive: z.boolean().optional(), - showGitChanges: z.boolean().optional(), keepHistoryAfterContextClear: z.boolean().optional(), summarizeShellCommands: z.boolean().optional(), showUnhandledProviderEvents: z.boolean().optional(), @@ -110,7 +107,6 @@ export const appSettingsUpdateSchema = z.union([ allowFastServiceTier: z.boolean().optional(), telemetryEnabled: z.boolean().optional(), confirmThreadArchive: z.boolean().optional(), - showGitChanges: z.boolean().optional(), keepHistoryAfterContextClear: z.boolean().optional(), summarizeShellCommands: z.boolean().optional(), showUnhandledProviderEvents: z.boolean(), diff --git a/packages/domain/src/plugin-sdk-version.ts b/packages/domain/src/plugin-sdk-version.ts index 97b496adaea..e27ecf995dd 100644 --- a/packages/domain/src/plugin-sdk-version.ts +++ b/packages/domain/src/plugin-sdk-version.ts @@ -1,3 +1,3 @@ -export const PLUGIN_SDK_VERSION = "0.6.92"; +export const PLUGIN_SDK_VERSION = "0.6.93"; export const PLUGIN_SDK_MAJOR = Number(PLUGIN_SDK_VERSION.split(".", 1)[0]); diff --git a/packages/plugin-sdk/package.json b/packages/plugin-sdk/package.json index 1f09faca416..59bc914bc66 100644 --- a/packages/plugin-sdk/package.json +++ b/packages/plugin-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@get-bb/plugin-sdk", - "version": "0.6.92", + "version": "0.6.93", "homepage": "https://github.com/get-bb/bb#readme", "bugs": { "url": "https://github.com/get-bb/bb/issues" diff --git a/packages/plugin-sdk/src/app-contract.ts b/packages/plugin-sdk/src/app-contract.ts index e396d188d47..7224c5389f2 100644 --- a/packages/plugin-sdk/src/app-contract.ts +++ b/packages/plugin-sdk/src/app-contract.ts @@ -1745,8 +1745,7 @@ export interface ExperimentalThreadContextSegmentInput { projectId: string; /** * The thread's environment, or null when the thread has no environment, - * its host is not active, the environment is not a usable checkout, or the - * user turned off "Show Git changes and Commit button". + * its host is not active, or the environment is not a usable checkout. */ environment: ExperimentalThreadEnvironment | null; } diff --git a/packages/templates/src/templates/bb-guide-customization.md b/packages/templates/src/templates/bb-guide-customization.md index 637a8b22ed4..8064c2de0e9 100644 --- a/packages/templates/src/templates/bb-guide-customization.md +++ b/packages/templates/src/templates/bb-guide-customization.md @@ -98,11 +98,9 @@ General. Machine-related keys (`machineServerUrl`, `defaultMachineAccess`, install with saved settings or work keeps false): when on, Enter steers a running thread and Command+Enter queues a follow-up; when off, those are reversed. Shift+Enter inserts a newline. -- `showGitChanges` (default true; Settings → General → Show Git changes and - Commit button): false hides the git summary, expanded file list, - pull-request status and actions above the composer, and Commit action in the - thread header and overflow menu for every thread and connected client. Thread - relationships and workspace warnings remain visible. +- Show Git changes and Commit button and Show pull request above the composer + are plugin settings: `bb plugin config bb--git set showGitChanges false` and + `bb plugin config bb--github-pr-status set showPullRequest false`. - `keepHistoryAfterContextClear` (default false; Settings → General → Show messages from before a context clear): true keeps a cleared thread's earlier messages above the `Context cleared` boundary in the timeline, outline, and diff --git a/plugins/bb-guide/skills/bb-plugin-authoring/references/frontend-registration.md b/plugins/bb-guide/skills/bb-plugin-authoring/references/frontend-registration.md index 3c4aa54291d..46dc72fcc67 100644 --- a/plugins/bb-guide/skills/bb-plugin-authoring/references/frontend-registration.md +++ b/plugins/bb-guide/skills/bb-plugin-authoring/references/frontend-registration.md @@ -203,12 +203,12 @@ remembers it per registration. A crash removes only that row or section. `app.slots.experimental_threadContextSegment({ id, title, group, order?, summary, action?, details?, useVisible? })` adds a segment to the context row above an open thread's composer; bb's parent -thread and changed files use it too. `group`/`order` sort as for Info rows; bb's +thread and the Git plugin's changed files use it too. `group`/`order` sort as for Info rows; bb's groups are `experimental_THREAD_CONTEXT_SEGMENT_GROUPS`, and any other string sorts in place (GitHub PR Status uses `"2_pullRequest"`). Each component mounts in its own crash boundary: `summary` in the row, `action` at its end, `details` below it. Props carry `threadId`, `projectId`, `environment` (null without a -usable environment or when "Show Git changes" is off), the visible `segments` +usable environment), the visible `segments` as `{ key, pluginId }` in row order (`key` is `/`; bb's own use `bb--core`), and `isExpanded`/`onToggle` (one segment is expanded at a time). `useVisible(input)` false leaves it out. diff --git a/plugins/git/PLUGIN_OVERVIEW.md b/plugins/git/PLUGIN_OVERVIEW.md index 8790027c4fe..ecc7e1f4c16 100644 --- a/plugins/git/PLUGIN_OVERVIEW.md +++ b/plugins/git/PLUGIN_OVERVIEW.md @@ -18,4 +18,4 @@ Use the CLI from any thread: - `bb git diff --target all` prints the diff. - `bb git viewed mark --path ` marks a file Viewed. -The Commit button and dialog stay in core. +Turn off Show Git changes and Commit button on this page to hide the changed-files segment and the Commit button. diff --git a/plugins/git/contract.ts b/plugins/git/contract.ts index bd3d81b89a6..a532d5d2c5b 100644 --- a/plugins/git/contract.ts +++ b/plugins/git/contract.ts @@ -143,6 +143,7 @@ export const workspaceStatusSchema = z.object({ export type WorkspaceStatus = z.infer; export const GIT_DIFF_TAB_ID = "diff"; +export const GIT_SHOW_CHANGES_SETTING = "showGitChanges"; export const GIT_STATUS_MAX_KEYS = 200; export const GIT_PATCHES_MAX_KEYS = 50; export const GIT_VIEWED_MAX_PATHS = 500; diff --git a/plugins/git/server.ts b/plugins/git/server.ts index dc06741bfa3..a7442775752 100644 --- a/plugins/git/server.ts +++ b/plugins/git/server.ts @@ -4,6 +4,7 @@ import { type BbPluginApi, } from "@get-bb/plugin-sdk"; import { + GIT_SHOW_CHANGES_SETTING, gitFilesTag, gitRefsTag, gitStatusTag, @@ -31,6 +32,15 @@ function patchGroupKey(key: GitPatchKey): string { } export default function gitPlugin(bb: BbPluginApi): void { + bb.settings.define({ + [GIT_SHOW_CHANGES_SETTING]: { + type: "boolean", + label: "Show Git changes and Commit button", + description: + "Show changed files above the composer, and Commit in the header.", + default: true, + }, + }); const watchedEnvironments = new Map(); const generations = createReadGenerations((environmentId) => watchedEnvironments.has(environmentId), diff --git a/plugins/git/skills/git/SKILL.md b/plugins/git/skills/git/SKILL.md index 32f3a8272ee..a779aa055f3 100644 --- a/plugins/git/skills/git/SKILL.md +++ b/plugins/git/skills/git/SKILL.md @@ -39,6 +39,10 @@ bb git viewed list|mark|unmark|clear --target ... - The old `bb environment status|diff|diff-files|diff-file|diff-patch|branches|diff-viewed` commands still run and print the `bb git` command that replaced them. +The `showGitChanges` setting (default true) shows the composer's changed-files +segment and the thread header's Commit action. Turn them off with +`bb plugin config bb--git set showGitChanges false`. + Other plugins read the same data through RPC. `status` is a keyed read: pass environment ids and get one row per id, refreshed after the workspace's files or refs change. diff --git a/plugins/git/ui/commit/commit-action.test.tsx b/plugins/git/ui/commit/commit-action.test.tsx index c64c4c21179..c9044824384 100644 --- a/plugins/git/ui/commit/commit-action.test.tsx +++ b/plugins/git/ui/commit/commit-action.test.tsx @@ -102,11 +102,12 @@ function Probe({ onItem }: { onItem(item: ItemFor): void }) { function renderAction({ workspace = DIRTY, - showGitChanges = true, -}: { workspace?: WorkspaceStatus; showGitChanges?: boolean } = {}) { + settings = { showGitChanges: true }, +}: { + workspace?: WorkspaceStatus; + settings?: Record; +} = {}) { let itemFor: ItemFor | null = null; - const configChanged: (() => void)[] = []; - const settings = { showGitChanges }; const view = renderSlot( { component: Probe }, { @@ -118,19 +119,10 @@ function renderAction({ rpc: statusFor(workspace) as PluginRpcTestHandlers, experimental_rpcContract: gitRpcContract, pluginId: "bb--git", + settings, sdk: { - system: { - config: async () => ({ - generalSettings: { showGitChanges: settings.showGitChanges }, - }), - }, threads: { get: async () => ({ environmentId: "env-1" }) }, - subscribe: (args: { event: string; callback: () => void }) => { - if (args.event === "system:config-changed") { - configChanged.push(args.callback); - } - return () => {}; - }, + subscribe: () => () => {}, } as never, }, ); @@ -138,10 +130,6 @@ function renderAction({ view, item: (overrides: Partial = {}) => itemFor?.(target(overrides)) ?? null, - setShowGitChanges(value: boolean) { - settings.showGitChanges = value; - for (const callback of configChanged) callback(); - }, }; } @@ -168,14 +156,10 @@ describe("commit header action", () => { expect(dirty.item({ environment: { id: "env-2", path: "/x" } })).toBeNull(); }); - it("follows the Show Git changes setting as it changes", async () => { - const action = renderAction({ showGitChanges: false }); + it("hides Commit while the Show Git changes setting is off", async () => { + const action = renderAction({ settings: { showGitChanges: false } }); await new Promise((resolve) => setTimeout(resolve, 20)); expect(action.item()).toBeNull(); - await act(async () => action.setShowGitChanges(true)); - await waitFor(() => expect(action.item()?.label).toBe("Commit")); - await act(async () => action.setShowGitChanges(false)); - await waitFor(() => expect(action.item()).toBeNull()); }); }); diff --git a/plugins/git/ui/commit/commit-action.ts b/plugins/git/ui/commit/commit-action.ts index e163506c3d3..8f0099f21e4 100644 --- a/plugins/git/ui/commit/commit-action.ts +++ b/plugins/git/ui/commit/commit-action.ts @@ -5,7 +5,7 @@ import { type PluginThreadActionDataInput, type PluginThreadActionRegistration, } from "@get-bb/plugin-sdk/app"; -import { useGitWorkspaces } from "../queries.js"; +import { useGitWorkspaces, useShowGitChanges } from "../queries.js"; import { closeCommitDialogUnlessShown, openCommitDialog, @@ -16,38 +16,6 @@ export interface CommitActionData { environmentIdsWithChanges: ReadonlySet; } -function useShowGitChanges(sdk: PluginBrowserBbSdk): boolean { - const [showGitChanges, setShowGitChanges] = useState(false); - useEffect(() => { - let current = true; - const load = () => { - sdk.system.config().then( - (config) => { - if (current) setShowGitChanges(config.generalSettings.showGitChanges); - }, - () => undefined, - ); - }; - load(); - const config = sdk.subscribe({ - event: "system:config-changed", - callback: load, - }); - const connection = sdk.subscribe({ - event: "realtime:connection", - callback: (event) => { - if (event.state === "connected" && event.reconnected) load(); - }, - }); - return () => { - current = false; - config(); - connection(); - }; - }, [sdk]); - return showGitChanges; -} - type ThreadEnvironmentIds = ReadonlyMap; function useThreadEnvironmentIds( @@ -104,7 +72,7 @@ function useCommitActionData({ threadIds, }: PluginThreadActionDataInput): CommitActionData { const sdk = useSdk(); - const showGitChanges = useShowGitChanges(sdk); + const showGitChanges = useShowGitChanges(); const threadEnvironmentIds = useThreadEnvironmentIds(sdk, threadIds); const environmentIds = useMemo( () => [ diff --git a/plugins/git/ui/queries.ts b/plugins/git/ui/queries.ts index e93bb5665e5..d42944e3c89 100644 --- a/plugins/git/ui/queries.ts +++ b/plugins/git/ui/queries.ts @@ -3,6 +3,7 @@ import { experimental_useRpcMutation as useRpcMutation, experimental_useRpcQuery as useRpcQuery, useSdk, + useSettings, } from "@get-bb/plugin-sdk/app"; import { useEffect, useState } from "react"; import { useDebounceValue } from "usehooks-ts"; @@ -12,7 +13,10 @@ import { type GitStatusKeyedQuery, } from "../status-state.js"; import { gitRpcContract } from "../rpc-contract.js"; -import type { WorkspaceDiffTarget } from "../contract.js"; +import { + GIT_SHOW_CHANGES_SETTING, + type WorkspaceDiffTarget, +} from "../contract.js"; const useGitStatusQuery: GitStatusKeyedQuery = (args) => useRpcKeyedQuery({ contract: gitRpcContract, method: "status", ...args }); @@ -21,6 +25,10 @@ export const useGitStatus = createGitStatusHook(useGitStatusQuery); export const useGitWorkspaces = createGitWorkspacesHook(useGitStatusQuery); +export function useShowGitChanges(): boolean { + return useSettings().values?.[GIT_SHOW_CHANGES_SETTING] === true; +} + const workspacePaths = new Map(); export function useWorkspacePath(environmentId: string): string | null { diff --git a/plugins/git/ui/segment/ChangedFilesSegment.tsx b/plugins/git/ui/segment/ChangedFilesSegment.tsx index e3b7bd1160b..ff374bb28cc 100644 --- a/plugins/git/ui/segment/ChangedFilesSegment.tsx +++ b/plugins/git/ui/segment/ChangedFilesSegment.tsx @@ -24,7 +24,7 @@ import { import { WorkspaceChangesList } from "@bb/shared-ui/workspace-changes-list"; import { useChangedFileActions } from "../changed-files.js"; import { useMergeBase, type MergeBaseState } from "../merge-base.js"; -import { useGitStatus } from "../queries.js"; +import { useGitStatus, useShowGitChanges } from "../queries.js"; import type { WorkspaceFileStatus, WorkspaceStatus } from "../../contract.js"; const TOGGLE_ID = "thread-prompt-banner-git-toggle"; @@ -53,9 +53,11 @@ function useFocusHandoff( export function useChangedFilesSegmentVisible({ environment, }: ExperimentalThreadContextSegmentInput): boolean { - const { workspace } = useGitStatus(environment?.id ?? null); + const environmentId = useShowGitChanges() ? (environment?.id ?? null) : null; + const { workspace } = useGitStatus(environmentId); return ( - environment !== null && selectWorkspaceChangedFilesSection(workspace) !== null + environmentId !== null && + selectWorkspaceChangedFilesSection(workspace) !== null ); } diff --git a/plugins/github-pr-status/PLUGIN_OVERVIEW.md b/plugins/github-pr-status/PLUGIN_OVERVIEW.md index 731f975235a..09770cab639 100644 --- a/plugins/github-pr-status/PLUGIN_OVERVIEW.md +++ b/plugins/github-pr-status/PLUGIN_OVERVIEW.md @@ -16,6 +16,8 @@ Use the CLI from any thread: - `bb pull-request ready|draft ` changes draft state. - `bb pull-request merge --method squash` merges it. +Turn off Show pull request above the composer on this page to hide the composer segment; the Info panel keeps its Pull request row. + ## Requirements Install the GitHub CLI and run `gh auth login` on each machine whose pull requests you want to see. diff --git a/plugins/github-pr-status/contract.ts b/plugins/github-pr-status/contract.ts index db2bdc6374e..7e8b2104efd 100644 --- a/plugins/github-pr-status/contract.ts +++ b/plugins/github-pr-status/contract.ts @@ -2,6 +2,7 @@ import { defineRpcContract } from "@get-bb/plugin-sdk"; import { z } from "zod"; export const GITHUB_PR_STATUS_PLUGIN_ID = "bb--github-pr-status"; +export const SHOW_PULL_REQUEST_SETTING = "showPullRequest"; export const PULL_REQUESTS_MAX_KEYS = 200; export const PULL_REQUESTS_REFETCH_EVENT = "bb--github-pr-status:pull-requests-refetch"; diff --git a/plugins/github-pr-status/server.ts b/plugins/github-pr-status/server.ts index 269e08636b1..fbf8eb4b476 100644 --- a/plugins/github-pr-status/server.ts +++ b/plugins/github-pr-status/server.ts @@ -10,6 +10,7 @@ import { environmentPullRequestTag, githubPrStatusHostContract, githubPrStatusRpcContract, + SHOW_PULL_REQUEST_SETTING, type EnvironmentPullRequest, type HostPullRequestAction, type PullRequest, @@ -118,6 +119,15 @@ function describeEnvironmentPullRequest( } export default function githubPrStatusPlugin(bb: BbPluginApi): void { + bb.settings.define({ + [SHOW_PULL_REQUEST_SETTING]: { + type: "boolean", + label: "Show pull request above the composer", + description: + "Show the pull request's status, Mark ready and merge above the composer.", + default: true, + }, + }); const host = bb.hosts.experimental_client({ contract: githubPrStatusHostContract, }); diff --git a/plugins/github-pr-status/skills/github-pr-status/SKILL.md b/plugins/github-pr-status/skills/github-pr-status/SKILL.md index 00a199af52a..fbb2df7ffee 100644 --- a/plugins/github-pr-status/skills/github-pr-status/SKILL.md +++ b/plugins/github-pr-status/skills/github-pr-status/SKILL.md @@ -28,6 +28,11 @@ bb pull-request merge [--method merge|squash|rebase] [--json] with a message naming the machine. - `gh` must be installed and logged in on that machine. +The `showPullRequest` setting (default true) shows the pull request segment +above the composer. Turn it off with +`bb plugin config bb--github-pr-status set showPullRequest false`; the Info +panel's Pull request row stays. + Other plugins read the same data through RPC. `pullRequests` is a keyed read: pass up to 200 environment ids and get one row per id. While a client watches a row, the plugin re-checks an open or draft PR every 30 seconds while any check is pending, diff --git a/plugins/github-pr-status/ui/PullRequestContextSegment.test.tsx b/plugins/github-pr-status/ui/PullRequestContextSegment.test.tsx index 9d63d11e48e..00f1c50fb38 100644 --- a/plugins/github-pr-status/ui/PullRequestContextSegment.test.tsx +++ b/plugins/github-pr-status/ui/PullRequestContextSegment.test.tsx @@ -18,6 +18,9 @@ import { const sdk = vi.hoisted(() => ({ rows: {} as Record, + settings: { showPullRequest: true } as + | Record + | undefined, mutate: vi.fn(async () => ({ message: "Merged" })), isPending: false, })); @@ -33,6 +36,7 @@ vi.mock("@get-bb/plugin-sdk/app", () => ({ isPending: sdk.isPending, }), useBbNavigate: () => ({ openUrl: () => false }), + useSettings: () => ({ values: sdk.settings, isLoading: false }), })); vi.mock("sonner", () => ({ @@ -101,6 +105,7 @@ function renderPart( afterEach(() => { cleanup(); sdk.rows = {}; + sdk.settings = { showPullRequest: true }; sdk.isPending = false; sdk.mutate.mockClear(); window.localStorage.clear(); @@ -134,6 +139,23 @@ describe("pull request context segment", () => { ).toBe(false); }); + it.each([ + ["off", { showPullRequest: false }], + ["loading", undefined], + ])("hides while the Show pull request setting is %s", (_state, settings) => { + show(PULL_REQUEST); + sdk.settings = settings; + expect( + renderHook(() => + usePullRequestSegmentVisible({ + threadId: "thr_1", + projectId: "proj_1", + environment: { id: "env_1" }, + }), + ).result.current, + ).toBe(false); + }); + it("labels a standalone pull request without a redundant open state", () => { show(PULL_REQUEST); const { container } = renderPart("summary"); diff --git a/plugins/github-pr-status/ui/PullRequestContextSegment.tsx b/plugins/github-pr-status/ui/PullRequestContextSegment.tsx index 0ba2945562a..c3592b88c7c 100644 --- a/plugins/github-pr-status/ui/PullRequestContextSegment.tsx +++ b/plugins/github-pr-status/ui/PullRequestContextSegment.tsx @@ -6,6 +6,7 @@ import { } from "react"; import { useBbNavigate, + useSettings, type ExperimentalThreadContextSegmentInput, type ExperimentalThreadContextSegmentProps, type ExperimentalThreadContextSegmentReference, @@ -26,7 +27,11 @@ import { PROMPT_BANNER_ACTION_SEGMENT_CLASS, PromptBannerActionButton, } from "@bb/shared-ui/prompt-banner-actions"; -import type { PullRequest, PullRequestMergeMethod } from "../contract"; +import { + SHOW_PULL_REQUEST_SETTING, + type PullRequest, + type PullRequestMergeMethod, +} from "../contract"; import { describePullRequestStatus, getPullRequestGithubCheckStatus, @@ -62,7 +67,8 @@ function useThreadPullRequest( export function usePullRequestSegmentVisible( input: ExperimentalThreadContextSegmentInput, ): boolean { - return useThreadPullRequest(input.environment) !== null; + const show = useSettings().values?.[SHOW_PULL_REQUEST_SETTING] === true; + return useThreadPullRequest(show ? input.environment : null) !== null; } function shouldShowAttentionLabel(pullRequest: PullRequest): boolean { From 47d427db66593d37284d8448a5c8f0057ed09cc2 Mon Sep 17 00:00:00 2001 From: Michael Yong Date: Tue, 27 Oct 2026 16:21:19 -0700 Subject: [PATCH 2/2] Split the Commit button into its own Git setting, off by default showGitChanges now gates only the composer's changed-files segment. A new showCommitButton setting (default off for everyone) gates the Commit thread action in the header and overflow menu. Co-Authored-By: Claude Opus 5.5 --- docs/configuration.md | 36 +++++++++++-------- .../src/templates/bb-guide-customization.md | 6 ++-- plugins/git/PLUGIN_OVERVIEW.md | 2 +- plugins/git/contract.ts | 1 + plugins/git/server.ts | 12 +++++-- plugins/git/skills/git/SKILL.md | 7 ++-- plugins/git/ui/commit/commit-action.test.tsx | 6 ++-- plugins/git/ui/commit/commit-action.ts | 14 ++++---- plugins/git/ui/queries.ts | 5 +++ 9 files changed, 56 insertions(+), 33 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 9e1fbeb4cd4..37b1cee460b 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -300,10 +300,10 @@ the terminal and pastes the primary selection independently of this setting. Unsupported browsers never substitute unrelated regular clipboard contents. Older clients that omit `keepHistoryAfterContextClear`, -`summarizeShellCommands`, or `earlyAdopter` preserve the saved value. Show Git -changes and Commit button is a [Git plugin setting](#git-and-github-pr-status-plugins), -and the general-settings API rejects an update that still sends -`showGitChanges`. For older SDK callers, the +`summarizeShellCommands`, or `earlyAdopter` preserve the saved value. The +former Show Git changes and Commit button switch is now +[plugin settings](#git-and-github-pr-status-plugins), and the general-settings +API rejects an update that still sends `showGitChanges`. For older SDK callers, the general-settings API still accepts and returns `showUnhandledProviderEvents` as a deprecated alias of `showDiagnosticEvents`, and an existing value is preserved; when a read-modify-write payload contains conflicting values, the one @@ -1115,22 +1115,30 @@ reconnects. See the ### Git and GitHub PR Status plugins -The builtin Git plugin's `showGitChanges` (default `true`) is Show Git changes -and Commit button on its plugin page. `false` hides the untracked, uncommitted, -and committed file summary and expanded file list above every thread composer, -and the Commit action in the thread header and overflow menu. The builtin -GitHub PR Status plugin's `showPullRequest` (default `true`) is Show pull -request above the composer on its plugin page. `false` hides the pull request -status, Mark ready and merge actions above every thread composer; the Info -tab's Pull request row stays. Thread relationships and workspace warnings stay -visible either way. +The builtin Git plugin's settings page has two switches: + +- `showGitChanges` (default `true`), Show Git changes above the composer. + `false` hides the untracked, uncommitted, and committed file summary, + expanded file list, and merge-base picker above every thread composer. +- `showCommitButton` (default `false`), Show Commit button. `true` shows the + Commit action in the thread header and overflow menu when the workspace has + uncommitted changes. + +The builtin GitHub PR Status plugin's `showPullRequest` (default `true`) is +Show pull request above the composer on its plugin page. `false` hides the pull +request status, Mark ready and merge actions above every thread composer; the +Info tab's Pull request row stays. Thread relationships and workspace warnings +stay visible either way. ```bash bb plugin config bb--git set showGitChanges false +bb plugin config bb--git set showCommitButton true bb plugin config bb--github-pr-status set showPullRequest false ``` -Upgrading copies the Settings → General switch's saved value into both. +Upgrading copies the former Settings → General switch's saved value into +`showGitChanges` and `showPullRequest`. The Commit button starts off for +everyone. ### Ask User Question plugin diff --git a/packages/templates/src/templates/bb-guide-customization.md b/packages/templates/src/templates/bb-guide-customization.md index 8064c2de0e9..b8c7dcb45c1 100644 --- a/packages/templates/src/templates/bb-guide-customization.md +++ b/packages/templates/src/templates/bb-guide-customization.md @@ -98,8 +98,10 @@ General. Machine-related keys (`machineServerUrl`, `defaultMachineAccess`, install with saved settings or work keeps false): when on, Enter steers a running thread and Command+Enter queues a follow-up; when off, those are reversed. Shift+Enter inserts a newline. -- Show Git changes and Commit button and Show pull request above the composer - are plugin settings: `bb plugin config bb--git set showGitChanges false` and +- Git changes above the composer, the Commit button (off by default) and the + pull request above the composer are plugin settings: + `bb plugin config bb--git set showGitChanges false`, + `bb plugin config bb--git set showCommitButton true` and `bb plugin config bb--github-pr-status set showPullRequest false`. - `keepHistoryAfterContextClear` (default false; Settings → General → Show messages from before a context clear): true keeps a cleared thread's earlier diff --git a/plugins/git/PLUGIN_OVERVIEW.md b/plugins/git/PLUGIN_OVERVIEW.md index ecc7e1f4c16..33739d9ea3e 100644 --- a/plugins/git/PLUGIN_OVERVIEW.md +++ b/plugins/git/PLUGIN_OVERVIEW.md @@ -18,4 +18,4 @@ Use the CLI from any thread: - `bb git diff --target all` prints the diff. - `bb git viewed mark --path ` marks a file Viewed. -Turn off Show Git changes and Commit button on this page to hide the changed-files segment and the Commit button. +On this page, Show Git changes above the composer hides or shows the changed-files segment, and Show Commit button (off by default) adds Commit to the thread header. diff --git a/plugins/git/contract.ts b/plugins/git/contract.ts index a532d5d2c5b..632a68ea5b3 100644 --- a/plugins/git/contract.ts +++ b/plugins/git/contract.ts @@ -144,6 +144,7 @@ export type WorkspaceStatus = z.infer; export const GIT_DIFF_TAB_ID = "diff"; export const GIT_SHOW_CHANGES_SETTING = "showGitChanges"; +export const GIT_SHOW_COMMIT_BUTTON_SETTING = "showCommitButton"; export const GIT_STATUS_MAX_KEYS = 200; export const GIT_PATCHES_MAX_KEYS = 50; export const GIT_VIEWED_MAX_PATHS = 500; diff --git a/plugins/git/server.ts b/plugins/git/server.ts index a7442775752..2d850a2007d 100644 --- a/plugins/git/server.ts +++ b/plugins/git/server.ts @@ -5,6 +5,7 @@ import { } from "@get-bb/plugin-sdk"; import { GIT_SHOW_CHANGES_SETTING, + GIT_SHOW_COMMIT_BUTTON_SETTING, gitFilesTag, gitRefsTag, gitStatusTag, @@ -35,11 +36,16 @@ export default function gitPlugin(bb: BbPluginApi): void { bb.settings.define({ [GIT_SHOW_CHANGES_SETTING]: { type: "boolean", - label: "Show Git changes and Commit button", - description: - "Show changed files above the composer, and Commit in the header.", + label: "Show Git changes above the composer", + description: "Show changed files and the merge base above the composer.", default: true, }, + [GIT_SHOW_COMMIT_BUTTON_SETTING]: { + type: "boolean", + label: "Show Commit button", + description: "Show Commit in the thread header and actions menu.", + default: false, + }, }); const watchedEnvironments = new Map(); const generations = createReadGenerations((environmentId) => diff --git a/plugins/git/skills/git/SKILL.md b/plugins/git/skills/git/SKILL.md index a779aa055f3..d91ff01250d 100644 --- a/plugins/git/skills/git/SKILL.md +++ b/plugins/git/skills/git/SKILL.md @@ -39,9 +39,10 @@ bb git viewed list|mark|unmark|clear --target ... - The old `bb environment status|diff|diff-files|diff-file|diff-patch|branches|diff-viewed` commands still run and print the `bb git` command that replaced them. -The `showGitChanges` setting (default true) shows the composer's changed-files -segment and the thread header's Commit action. Turn them off with -`bb plugin config bb--git set showGitChanges false`. +`showGitChanges` (default true) shows the composer's changed-files segment; +turn it off with `bb plugin config bb--git set showGitChanges false`. +`showCommitButton` (default false) shows the thread header's Commit action; +turn it on with `bb plugin config bb--git set showCommitButton true`. Other plugins read the same data through RPC. `status` is a keyed read: pass environment ids and get one row per id, refreshed after the workspace's files diff --git a/plugins/git/ui/commit/commit-action.test.tsx b/plugins/git/ui/commit/commit-action.test.tsx index c9044824384..53ebd905137 100644 --- a/plugins/git/ui/commit/commit-action.test.tsx +++ b/plugins/git/ui/commit/commit-action.test.tsx @@ -102,7 +102,7 @@ function Probe({ onItem }: { onItem(item: ItemFor): void }) { function renderAction({ workspace = DIRTY, - settings = { showGitChanges: true }, + settings = { showCommitButton: true }, }: { workspace?: WorkspaceStatus; settings?: Record; @@ -156,8 +156,8 @@ describe("commit header action", () => { expect(dirty.item({ environment: { id: "env-2", path: "/x" } })).toBeNull(); }); - it("hides Commit while the Show Git changes setting is off", async () => { - const action = renderAction({ settings: { showGitChanges: false } }); + it("hides Commit while the Show Commit button setting is off", async () => { + const action = renderAction({ settings: { showCommitButton: false } }); await new Promise((resolve) => setTimeout(resolve, 20)); expect(action.item()).toBeNull(); }); diff --git a/plugins/git/ui/commit/commit-action.ts b/plugins/git/ui/commit/commit-action.ts index 8f0099f21e4..4fea0f8190a 100644 --- a/plugins/git/ui/commit/commit-action.ts +++ b/plugins/git/ui/commit/commit-action.ts @@ -5,14 +5,14 @@ import { type PluginThreadActionDataInput, type PluginThreadActionRegistration, } from "@get-bb/plugin-sdk/app"; -import { useGitWorkspaces, useShowGitChanges } from "../queries.js"; +import { useGitWorkspaces, useShowCommitButton } from "../queries.js"; import { closeCommitDialogUnlessShown, openCommitDialog, } from "./commit-store.js"; export interface CommitActionData { - showGitChanges: boolean; + showCommitButton: boolean; environmentIdsWithChanges: ReadonlySet; } @@ -72,7 +72,7 @@ function useCommitActionData({ threadIds, }: PluginThreadActionDataInput): CommitActionData { const sdk = useSdk(); - const showGitChanges = useShowGitChanges(); + const showCommitButton = useShowCommitButton(); const threadEnvironmentIds = useThreadEnvironmentIds(sdk, threadIds); const environmentIds = useMemo( () => [ @@ -85,13 +85,13 @@ function useCommitActionData({ ], [threadEnvironmentIds, threadIds], ); - const workspaces = useGitWorkspaces(showGitChanges ? environmentIds : []); + const workspaces = useGitWorkspaces(showCommitButton ? environmentIds : []); useEffect(() => { closeCommitDialogUnlessShown(threadIds); }, [threadIds]); return useMemo( () => ({ - showGitChanges, + showCommitButton, environmentIdsWithChanges: new Set( [...workspaces] .filter( @@ -100,7 +100,7 @@ function useCommitActionData({ .map(([environmentId]) => environmentId), ), }), - [showGitChanges, workspaces], + [showCommitButton, workspaces], ); } @@ -115,7 +115,7 @@ export const commitThreadAction: PluginThreadActionRegistration { const environment = thread.environment; if ( - !data.showGitChanges || + !data.showCommitButton || thread.archivedAt !== null || environment === null || !data.environmentIdsWithChanges.has(environment.id) diff --git a/plugins/git/ui/queries.ts b/plugins/git/ui/queries.ts index d42944e3c89..5cbbf5df9f8 100644 --- a/plugins/git/ui/queries.ts +++ b/plugins/git/ui/queries.ts @@ -15,6 +15,7 @@ import { import { gitRpcContract } from "../rpc-contract.js"; import { GIT_SHOW_CHANGES_SETTING, + GIT_SHOW_COMMIT_BUTTON_SETTING, type WorkspaceDiffTarget, } from "../contract.js"; @@ -29,6 +30,10 @@ export function useShowGitChanges(): boolean { return useSettings().values?.[GIT_SHOW_CHANGES_SETTING] === true; } +export function useShowCommitButton(): boolean { + return useSettings().values?.[GIT_SHOW_COMMIT_BUTTON_SETTING] === true; +} + const workspacePaths = new Map(); export function useWorkspacePath(environmentId: string): string | null {