Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
feat(chat): add omit thinking level that sends no provider override
vastsa3e6ddb3904b9
diff --git a/apps/desktop/electron/main/ipc/agent-ipc.ts b/apps/desktop/electron/main/ipc/agent-ipc.tsindex 320f118f3..809a24354 100644--- a/apps/desktop/electron/main/ipc/agent-ipc.ts+++ b/apps/desktop/electron/main/ipc/agent-ipc.ts@@ -1,4 +1,4 @@-import { IPC, ErrorCodes, isGlobalPermissionMode, type AgentEventEnvelope, type AgentPromptRequest, type AgentSteerRequest, type UiMessage, type AgentQueuePushRequest, type AgentStopRequest, type AskToolResolution, type GlobalPermissionMode, type MessageUsage, type PlanExecutionFinishStatus, type PlanResolutionResult, type PlanResolveRequest, type PromptEnhancementRequest, type SessionSummarizeTitleRequest, type ThinkingLevel } from "@pi-desktop/shared";+import { IPC, ErrorCodes, isGlobalPermissionMode, type AgentEventEnvelope, type AgentPromptRequest, type AgentSteerRequest, type UiMessage, type AgentQueuePushRequest, type AgentStopRequest, type AskToolResolution, type GlobalPermissionMode, type MessageUsage, type PlanExecutionFinishStatus, type PlanResolutionResult, type PlanResolveRequest, type PromptEnhancementRequest, type SessionSummarizeTitleRequest, canonicalThinkingLevel, type ThinkingLevel } from "@pi-desktop/shared";import type { FinishTurn } from "../runtime/plans";import { expandSlashInvocation, enhancePromptDraft, summarizeSessionTitle, visionFromModelConfig, type ComposerTemplate, type RuntimeProviderConfig } from "@pi-desktop/agent-runtime";import { OAUTH_AUTH_KIND, type VendorOAuth } from "../oauth";@@ -181,7 +181,7 @@ export function registerAgentIpc({// consults the signal between provider retries); racing the promise is what// actually guarantees the caller is released on time.const enhancedDraft = await withPromptEnhancementTimeout((signal) =>- enhancePromptDraft(runtimeProvider, draft, launch.sidecarParams.thinkingLevel, {+ enhancePromptDraft(runtimeProvider, draft, canonicalThinkingLevel(launch.sidecarParams.thinkingLevel), {signal,sessionId: launchSessionId,customTemplate: settings?.promptEnhancementCustomTemplate === true,diff --git a/apps/desktop/electron/main/ipc/session-ipc.ts b/apps/desktop/electron/main/ipc/session-ipc.tsindex 36062f749..1ced88424 100644--- a/apps/desktop/electron/main/ipc/session-ipc.ts+++ b/apps/desktop/electron/main/ipc/session-ipc.ts@@ -12,7 +12,7 @@ import {type ActivationScope,type ModelConfigImportDraft,type Mode,- type ThinkingLevel,+ type SessionThinkingLevel,} from "@pi-desktop/shared";import {convertSession,@@ -35,7 +35,7 @@ type RuntimeSession = {projectPath?: string | null;providerId?: string;modelId?: string;- thinkingLevel?: ThinkingLevel;+ thinkingLevel?: SessionThinkingLevel;[key: string]: unknown;};@@ -532,7 +532,7 @@ export function registerSessionIpc({mode: Mode;providerId?: string;modelId?: string;- thinkingLevel?: ThinkingLevel;+ thinkingLevel?: SessionThinkingLevel;permissionMode?: "inherit" | "ask" | "accept-edits" | "auto";},) => {diff --git a/apps/desktop/electron/main/runtime/provider-catalog.ts b/apps/desktop/electron/main/runtime/provider-catalog.tsindex 6d3c37c5b..013b24962 100644--- a/apps/desktop/electron/main/runtime/provider-catalog.ts+++ b/apps/desktop/electron/main/runtime/provider-catalog.ts@@ -1,6 +1,6 @@import {ErrorCodes as SharedErrorCodes,- THINKING_LEVELS,+ SESSION_THINKING_LEVELS,defaultCommandShellForPlatform,isCommandShellId,modelIdsMatch,@@ -9,7 +9,7 @@ import {validateSpeechSettings,type CommandShellId,type ModelBinding,- type ThinkingLevel,+ type SessionThinkingLevel,} from "@pi-desktop/shared";import {capabilitiesFromModelConfig,@@ -53,7 +53,7 @@ export type RuntimeProvider = {export type RuntimeSession = {providerId?: string;modelId?: string;- thinkingLevel?: ThinkingLevel;+ thinkingLevel?: SessionThinkingLevel;};export type SessionCapabilityDefaults = {@@ -166,10 +166,10 @@ export function createProviderCatalogRuntime({};};- const normalizeThinkingLevel = (value: unknown): ThinkingLevel =>+ const normalizeThinkingLevel = (value: unknown): SessionThinkingLevel =>typeof value === "string" &&- (THINKING_LEVELS as readonly string[]).includes(value)- ? (value as ThinkingLevel)+ (SESSION_THINKING_LEVELS as readonly string[]).includes(value)+ ? (value as SessionThinkingLevel): "off";const normalizeSettings = <T>(diff --git a/apps/desktop/electron/main/runtime/session-launch.ts b/apps/desktop/electron/main/runtime/session-launch.tsindex f7d7bd5e6..827c38431 100644--- a/apps/desktop/electron/main/runtime/session-launch.ts+++ b/apps/desktop/electron/main/runtime/session-launch.ts@@ -11,7 +11,7 @@ import {type ModelBinding,type Mode,type Risk,- type ThinkingLevel,+ type SessionThinkingLevel,type UserSkillRecord,type UserSubagentRecord,} from "@pi-desktop/shared";@@ -78,7 +78,7 @@ export type SessionLaunchRuntimeDependencies = {modelConfig: ReturnType<typeof modelConfigWithBinding>;capabilities: ReturnType<typeof capabilitiesFromModelConfig>;};- normalizeThinkingLevel: (value: unknown) => ThinkingLevel;+ normalizeThinkingLevel: (value: unknown) => SessionThinkingLevel;};export function createSessionLaunchRuntime({@@ -263,7 +263,7 @@ export function createSessionLaunchRuntime({turnId?: string;providerId?: string;modelId?: string;- thinkingLevel?: ThinkingLevel;+ thinkingLevel?: SessionThinkingLevel;} = {},) {if (!runtimeState.host) throw new Error("host unavailable");diff --git a/apps/desktop/src/components/settings/EnhancementModelCard.tsx b/apps/desktop/src/components/settings/EnhancementModelCard.tsxindex 45671aa6b..e0d486c38 100644--- a/apps/desktop/src/components/settings/EnhancementModelCard.tsx+++ b/apps/desktop/src/components/settings/EnhancementModelCard.tsx@@ -13,6 +13,7 @@ import { useMemo, useState } from "react";import { useTranslation } from "react-i18next";import {THINKING_LEVELS,+ canonicalThinkingLevel,modelIdsMatch,type AppSettings,type ThinkingLevel,@@ -114,7 +115,7 @@ export function EnhancementModelCard() {const storedReasoning = settings?.promptEnhancementThinkingLevel ?? "off";const reasoning = useMemo(() => {if (!reasoningProvider) return storedReasoning;- return thinkingLevelForProvider(reasoningProvider, storedReasoning);+ return canonicalThinkingLevel(thinkingLevelForProvider(reasoningProvider, storedReasoning));}, [reasoningProvider, storedReasoning]);// Every hook runs before this: `settings` arrives after the first bootstrap,@@ -148,7 +149,7 @@ export function EnhancementModelCard() {promptEnhancementProviderId: providerId,promptEnhancementModelId: modelId,promptEnhancementThinkingLevel: nextProvider- ? thinkingLevelForProvider(nextProvider, stored)+ ? canonicalThinkingLevel(thinkingLevelForProvider(nextProvider, stored)): stored,});setPicking(false);@@ -304,7 +305,9 @@ export function EnhancementModelCard() {// Clamp through the same resolver the row displays, so the value// stored is always one this model can run.promptEnhancementThinkingLevel: reasoningProvider- ? thinkingLevelForProvider(reasoningProvider, id as ThinkingLevel)+ ? canonicalThinkingLevel(+ thinkingLevelForProvider(reasoningProvider, id as ThinkingLevel),+ ): (id as ThinkingLevel),})}diff --git a/apps/desktop/src/features/chat/composer/ComposerToolbar.tsx b/apps/desktop/src/features/chat/composer/ComposerToolbar.tsxindex d2c899052..ce81a9f81 100644--- a/apps/desktop/src/features/chat/composer/ComposerToolbar.tsx+++ b/apps/desktop/src/features/chat/composer/ComposerToolbar.tsx@@ -5,7 +5,7 @@ import {type Mode,type PermissionMode,type ShortcutPlatform,- type ThinkingLevel,+ type SessionThinkingLevel,} from "@pi-desktop/shared";import type { AppState } from "../../../stores/app-store";import { AnchoredMenu } from "../../../components/settings/AnchoredMenu";@@ -38,7 +38,7 @@ export type ComposerToolbarProps = {planningLive: boolean;providerId?: string;modelId?: string;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;composerPermissionMode: Exclude<PermissionMode, "inherit">;permissionOpen: boolean;setPermissionOpen: Dispatch<SetStateAction<boolean>>;diff --git a/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts b/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.tsindex 32adf0605..61e639d18 100644--- a/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts+++ b/apps/desktop/src/features/chat/composer/hooks/useComposerModelMenu.ts@@ -2,7 +2,7 @@ import { useEffect, useMemo, useRef, useState, type KeyboardEvent } from "react"import type {Mode,ProviderPublic,- ThinkingLevel,+ SessionThinkingLevel,} from "@pi-desktop/shared";import {initialThinkingLevelForBinding,@@ -17,6 +17,7 @@ import {} from "../../../../lib/composer-models";import { providerThinkingLevels } from "../../../../lib/session-thinking";import {+ sessionThinkingMenuLevels,thinkingLevelForProvider,thinkingProviderForModel,type ComposerMenuView,@@ -28,7 +29,7 @@ type UseComposerModelMenuOptions = {provider: ProviderPublic | undefined;modelId: string | undefined;thinkingProvider: ProviderPublic | null | undefined;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;controlsBlocked: boolean;};@@ -64,9 +65,7 @@ export function useComposerModelMenu({provider ? providerModels[provider.id] : undefined,);const availableThinkingLevels = providerThinkingLevels(thinkingProvider);- const thinkingMenuLevels: ThinkingLevel[] = availableThinkingLevels.length- ? availableThinkingLevels- : ["off"];+ const thinkingMenuLevels = sessionThinkingMenuLevels(availableThinkingLevels);const modelGroups = useMemo(() =>providers@@ -236,7 +235,7 @@ export function useComposerModelMenu({}};- const selectThinkingLevel = async (level: ThinkingLevel) => {+ const selectThinkingLevel = async (level: SessionThinkingLevel) => {try {await configureActiveSession({mode,diff --git a/apps/desktop/src/features/chat/composer/hooks/useComposerSubmit.ts b/apps/desktop/src/features/chat/composer/hooks/useComposerSubmit.tsindex 7aa8bbaf3..777c0a686 100644--- a/apps/desktop/src/features/chat/composer/hooks/useComposerSubmit.ts+++ b/apps/desktop/src/features/chat/composer/hooks/useComposerSubmit.ts@@ -1,6 +1,7 @@import { useRef, useState } from "react";import type { TFunction } from "i18next";import {+ canonicalThinkingLevel,restoreInlineComposerFileReferenceTokens,serializeComposerFileReferences,serializeInlineComposerFileReferences,@@ -119,7 +120,7 @@ export function useComposerSubmit({draft: textToEnhance,providerId,modelId,- thinkingLevel,+ thinkingLevel: canonicalThinkingLevel(thinkingLevel),});const currentKey = draftKeyForSession(useAppStore.getState().activeSessionId);if (diff --git a/apps/desktop/src/features/chat/composer/model.ts b/apps/desktop/src/features/chat/composer/model.tsindex a2dac7c19..a19cfa190 100644--- a/apps/desktop/src/features/chat/composer/model.ts+++ b/apps/desktop/src/features/chat/composer/model.ts@@ -3,11 +3,14 @@ import type {Mode,PermissionMode,ProviderPublic,+ SessionThinkingLevel,ThinkingLevel,} from "@pi-desktop/shared";import {+ isSessionThinkingLevel,modelIdsMatch,PERMISSION_MODES,+ sessionThinkingMenuLevels,} from "@pi-desktop/shared";import { providerThinkingLevels } from "../../../lib/session-thinking";@@ -79,8 +82,8 @@ export function nextMode(mode: Mode): Mode {return MODE_CYCLE[(index + 1) % MODE_CYCLE.length] ?? "agent";}-export function isThinkingLevel(value: unknown): value is ThinkingLevel {- return typeof value === "string" && THINKING_LEVELS.includes(value as ThinkingLevel);+export function isThinkingLevel(value: unknown): value is SessionThinkingLevel {+ return isSessionThinkingLevel(value);}export function isPermissionMode(value: unknown): value is PermissionMode {@@ -96,10 +99,11 @@ export function isPermissionMode(value: unknown): value is PermissionMode {*/export function thinkingLevelForProvider(provider: ProviderPublic | null | undefined,- current: ThinkingLevel,-): ThinkingLevel {+ current: SessionThinkingLevel,+): SessionThinkingLevel {const available = providerThinkingLevels(provider);if (!provider?.supportsReasoning) return "off";+ if (current === "omit") return "omit";if (available.includes(current)) return current;const requestedIndex = THINKING_LEVELS.indexOf(current);for (let index = requestedIndex; index < THINKING_LEVELS.length; index += 1) {@@ -151,3 +155,5 @@ export function cssPixels(value: string): number {const parsed = Number.parseFloat(value);return Number.isFinite(parsed) ? parsed : 0;}++export { sessionThinkingMenuLevels };diff --git a/apps/desktop/src/lib/session-thinking.ts b/apps/desktop/src/lib/session-thinking.tsindex eadf78585..d4b4655e7 100644--- a/apps/desktop/src/lib/session-thinking.ts+++ b/apps/desktop/src/lib/session-thinking.ts@@ -10,6 +10,7 @@ const THINKING_LEVELS = [] as const;type ThinkingLevel = (typeof THINKING_LEVELS)[number];+type SessionThinkingLevel = ThinkingLevel | "omit";export type SessionThinkingSnapshot = {providerId?: string;@@ -22,7 +23,7 @@ export type SessionThinkingSnapshot = {export type OptimisticSessionConfiguration = {providerId?: string;modelId?: string;- thinkingLevel?: ThinkingLevel;+ thinkingLevel?: SessionThinkingLevel;mode?: unknown;permissionMode?: unknown;};diff --git a/apps/desktop/src/stores/app-state.ts b/apps/desktop/src/stores/app-state.tsindex 7df47228e..093175da1 100644--- a/apps/desktop/src/stores/app-state.ts+++ b/apps/desktop/src/stores/app-state.ts@@ -23,7 +23,7 @@ import type {ProviderPublic,ReviewRollbackResult,SessionSummary,- ThinkingLevel,+ SessionThinkingLevel,UiMessage,} from "@pi-desktop/shared";import type { SettingsTabId } from "../lib/settings-search";@@ -95,7 +95,7 @@ export type RefreshSessionsOptions = {/** Toolbar selections retained on the unpersisted new-task draft. */export type DraftSessionConfiguration = {mode: Mode;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;providerId?: string;modelId?: string;permissionMode?: PermissionMode;@@ -198,7 +198,7 @@ export type AppState = {mode: Mode;providerId?: string;modelId?: string;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;permissionMode?: PermissionMode;}) => Promise<void>;/** Returns true once accepted unless concurrent smart Stop restores it. */diff --git a/apps/desktop/test/composer-model-thinking-menu.test.mjs b/apps/desktop/test/composer-model-thinking-menu.test.mjsindex de45ba3a0..b80d6bff1 100644--- a/apps/desktop/test/composer-model-thinking-menu.test.mjs+++ b/apps/desktop/test/composer-model-thinking-menu.test.mjs@@ -28,7 +28,7 @@ test("model and reasoning selection return to the root without closing", () => {assert.match(composerSource, /setQuery\(""\);[\s\S]*?setView\("root"\)/);assert.match(composerSource, /const selectThinkingLevel = async/);assert.match(composerSource, /setView\("root"\);[\s\S]*?setThinkingHighlight\(-1\)/);- assert.match(composerSource, /const thinkingMenuLevels: ThinkingLevel\[\] = availableThinkingLevels\.length/);+ assert.match(composerSource, /const thinkingMenuLevels = sessionThinkingMenuLevels\(availableThinkingLevels\)/);});test("opening the combined menu preloads model metadata before its submenu", () => {diff --git a/apps/desktop/test/thinking-ui.test.mjs b/apps/desktop/test/thinking-ui.test.mjsindex 8125110e5..f972c4719 100644--- a/apps/desktop/test/thinking-ui.test.mjs+++ b/apps/desktop/test/thinking-ui.test.mjs@@ -51,7 +51,7 @@ const settingsSource = (const stylesSource = await loadStyles();test("composer exposes the runtime thinking level order and provider filtering", () => {- for (const level of ["off", "minimal", "low", "medium", "high", "xhigh", "max"]) {+ for (const level of ["off", "minimal", "low", "medium", "high", "xhigh", "max", "omit"]) {assert.match(composerSource, new RegExp(`"${level}"`));}assert.match(composerSource, /supportedThinkingLevels/);diff --git a/crates/host-core/src/db.rs b/crates/host-core/src/db.rsindex 5954569b8..92474d9e2 100644--- a/crates/host-core/src/db.rs+++ b/crates/host-core/src/db.rs@@ -7,7 +7,7 @@ pub(crate) use serde_json::Value;pub(crate) use std::path::{Path, PathBuf};/// Current SQLite schema version.-pub const SCHEMA_VERSION: i64 = 18;+pub const SCHEMA_VERSION: i64 = 19;/// Absolute approval deadline for a newly submitted Plan or Goal proposal.pub const PLAN_APPROVAL_TIMEOUT_MS: i64 = 30 * 60 * 1000;@@ -25,7 +25,7 @@ mod session_collaboration_migration;pub(crate) use migrations::{archive_legacy_db, create_migration_backup, migrate_and_validate_top_level_mode,migrate_app_settings, migrate_v10_to_v15, migrate_v11_to_v15, migrate_v12_to_v15,- migrate_v13_to_v15, migrate_v14_to_v15, migrate_v17_to_v18, migrate_v7_to_v8,+ migrate_v13_to_v15, migrate_v14_to_v15, migrate_v17_to_v18, migrate_v18_to_v19, migrate_v7_to_v8,migrate_v8_to_v15, migrate_v9_to_v15, migration_backup_path, validate_session_modes,};pub(crate) use model::PlanWorkRow;diff --git a/crates/host-core/src/db/migrations.rs b/crates/host-core/src/db/migrations.rsindex 9a0977279..c1acad8a0 100644--- a/crates/host-core/src/db/migrations.rs+++ b/crates/host-core/src/db/migrations.rs@@ -781,3 +781,62 @@ pub(crate) fn migrate_v17_to_v18(conn: &Connection, path: &Path) -> Result<()> {})?;Ok(())}++/// v19 widens the session thinking-level CHECK to include `omit` (ADR 0295).+/// SQLite cannot ALTER a CHECK, so the sessions table is rebuilt in place.+pub(crate) fn migrate_v18_to_v19_tx(tx: &rusqlite::Transaction<'_>) -> Result<()> {+ tx.execute_batch(+ "CREATE TABLE sessions_v19 (+ id TEXT PRIMARY KEY,+ title TEXT NOT NULL DEFAULT '',+ project_id INTEGER REFERENCES projects(id) ON DELETE SET NULL,+ provider_id TEXT,+ model_id TEXT,+ mode TEXT NOT NULL DEFAULT 'agent',+ thinking_level TEXT NOT NULL DEFAULT 'off'+ CHECK (thinking_level IN ('off', 'minimal', 'low', 'medium',+ 'high', 'xhigh', 'max', 'omit')),+ permission_mode TEXT NOT NULL DEFAULT 'inherit'+ CHECK (permission_mode IN ('inherit', 'ask', 'accept-edits', 'auto')),+ source TEXT,+ deleted_at INTEGER,+ pinned INTEGER NOT NULL DEFAULT 0,+ last_seq INTEGER NOT NULL DEFAULT 0,+ created_at INTEGER NOT NULL,+ updated_at INTEGER NOT NULL+);+INSERT INTO sessions_v19 (+ id, title, project_id, provider_id, model_id, mode, thinking_level,+ permission_mode, source, deleted_at, pinned, last_seq, created_at, updated_at+)+SELECT+ id, title, project_id, provider_id, model_id, mode, thinking_level,+ permission_mode, source, deleted_at, pinned, last_seq, created_at, updated_at+FROM sessions;+DROP TABLE sessions;+ALTER TABLE sessions_v19 RENAME TO sessions;+CREATE INDEX idx_sessions_updated ON sessions(updated_at DESC);+CREATE INDEX idx_sessions_project ON sessions(project_id) WHERE project_id IS NOT NULL;+CREATE INDEX idx_sessions_deleted ON sessions(deleted_at) WHERE deleted_at IS NOT NULL;",+ )?;+ tx.pragma_update(None, "user_version", 19i64)?;+ Ok(())+}++pub(crate) fn migrate_v18_to_v19(conn: &Connection, path: &Path) -> Result<()> {+ let backup = create_migration_backup(conn, path, 18)?;+ conn.pragma_update(None, "foreign_keys", false)?;+ let result = (|| {+ let tx = conn.unchecked_transaction()?;+ migrate_v18_to_v19_tx(&tx)?;+ tx.commit().with_context(|| {+ format!(+ "commit schema v18 to v19 migration; backup {} remains",+ backup.display()+ )+ })+ })();+ let _ = conn.pragma_update(None, "foreign_keys", true);+ result+}+diff --git a/crates/host-core/src/db/repositories.rs b/crates/host-core/src/db/repositories.rsindex b0d8e18f7..b15d978f1 100644--- a/crates/host-core/src/db/repositories.rs+++ b/crates/host-core/src/db/repositories.rs@@ -177,6 +177,9 @@ impl Database {17 => {migrate_v17_to_v18(&conn, path)?;}+ 18 => {+ migrate_v18_to_v19(&conn, path)?;+ }legacy @ 1..=6 => {let _ = conn.execute_batch("PRAGMA wal_checkpoint(TRUNCATE);");drop(conn);@@ -203,6 +206,10 @@ impl Database {}if migrated_version == 17 {migrate_v17_to_v18(&conn, path)?;+ migrated_version = conn.query_row("PRAGMA user_version", [], |r| r.get(0))?;+ }+ if migrated_version == 18 {+ migrate_v18_to_v19(&conn, path)?;}let db = Self { conn, data_dir };db.boot_maintenance()?;diff --git a/crates/host-core/src/db/schema.rs b/crates/host-core/src/db/schema.rsindex deca484a0..424639aa0 100644--- a/crates/host-core/src/db/schema.rs+++ b/crates/host-core/src/db/schema.rs@@ -62,7 +62,7 @@ CREATE TABLE sessions (mode TEXT NOT NULL DEFAULT 'agent',thinking_level TEXT NOT NULL DEFAULT 'off'CHECK (thinking_level IN ('off', 'minimal', 'low', 'medium',- 'high', 'xhigh', 'max')),+ 'high', 'xhigh', 'max', 'omit')),permission_mode TEXT NOT NULL DEFAULT 'inherit'CHECK (permission_mode IN ('inherit', 'ask', 'accept-edits', 'auto')),source TEXT,diff --git a/crates/host-core/src/db/tests.rs b/crates/host-core/src/db/tests.rsindex 29a06a137..25d5d8fd1 100644--- a/crates/host-core/src/db/tests.rs+++ b/crates/host-core/src/db/tests.rs@@ -100,6 +100,28 @@ fn v14_database_migrates_to_v15_with_the_turn_queue() {assert!(migration_backup_path(&path, 14).exists());}+#[test]+fn v18_database_migrates_session_thinking_omit() {+ let dir = tempfile::tempdir().unwrap();+ let path = dir.path().join("pi.sqlite");+ {+ let db = Database::open(&path).unwrap();+ db.conn().pragma_update(None, "user_version", 18).unwrap();+ }+ let db = Database::open(&path).unwrap();+ assert_eq!(schema_version(db.conn()), SCHEMA_VERSION);+ assert!(migration_backup_path(&path, 18).exists());+ let sql: String = db+ .conn()+ .query_row(+ "SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'sessions'",+ [],+ |row| row.get(0),+ )+ .unwrap();+ assert!(sql.contains("'omit'"), "{sql}");+}+fn schema_version(conn: &Connection) -> i64 {conn.query_row("PRAGMA user_version", [], |row| row.get(0)).unwrap()diff --git a/crates/host-core/src/plugins/providers/tests.rs b/crates/host-core/src/plugins/providers/tests.rsindex e0ff84af2..3bf5249ce 100644--- a/crates/host-core/src/plugins/providers/tests.rs+++ b/crates/host-core/src/plugins/providers/tests.rs@@ -91,9 +91,9 @@ fn declaration_manifest(providers: Value, permissions: Value) -> Value {#[test]fn a_new_database_carries_the_owner_column_at_the_current_schema_version() {let (_dir, db, _secrets) = test_context();- // v17 added the owner column and v18 the turn-queue priority column; a fresh+ // v17 added the owner column, v18 the turn-queue priority column, v19 session omit; a fresh// database is stamped with the newest, so the column set is the current one.- assert_eq!(SCHEMA_VERSION, 18);+ assert_eq!(SCHEMA_VERSION, 19);let version: i64 = db.conn().query_row("PRAGMA user_version", [], |row| row.get(0))diff --git a/crates/host-core/src/sessions.rs b/crates/host-core/src/sessions.rsindex 5ab628632..293fd8e12 100644--- a/crates/host-core/src/sessions.rs+++ b/crates/host-core/src/sessions.rs@@ -39,8 +39,11 @@ pub fn is_contract_mode(mode: &str) -> bool {/// Values accepted by the persisted per-session thinking selector. Keep this/// list in the host boundary so old clients cannot write arbitrary provider-/// options into the session row.-pub const THINKING_LEVELS: [&str; 7] = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];+/// options into the session row. `omit` is a client choice to send no thinking+/// override; it is not a catalog/binding capability (ADR 0295).+pub const THINKING_LEVELS: [&str; 8] = [+ "off", "minimal", "low", "medium", "high", "xhigh", "max", "omit",+];pub fn is_valid_thinking_level(level: &str) -> bool {THINKING_LEVELS.contains(&level)@@ -3663,6 +3666,18 @@ mod tests {None,).is_err());+ let omitted = configure_session_with_thinking(+ &db,+ &session.id,+ "chat",+ None,+ None,+ Some("omit"),+ None,+ )+ .unwrap()+ .unwrap();+ assert_eq!(omitted.thinking_level, "omit");}#[test]diff --git a/docs/adr/0295-session-thinking-parameter-omission.md b/docs/adr/0295-session-thinking-parameter-omission.mdnew file mode 100644index 000000000..768617874--- /dev/null+++ b/docs/adr/0295-session-thinking-parameter-omission.md@@ -0,0 +1,38 @@+# ADR 0295: Session thinking-parameter omission++- Status: Accepted+- Date: 2026-09-20+- Deciders: PI-Desktop runtime and UX maintainers+- Amends: ADR 0194, ADR 0144, ADR 0221+- Related: D456, E2E-203a++## Context++Subagents already offer `thinkingLevel: omit` (ADR 0194): the agent bookkeeping+state stays `off`, but the request uses the low-level provider stream so no+thinking override is synthesized. Sessions only accepted the seven canonical+levels. Explicit `off` is not equivalent to omitting the parameter; adapters+often serialize `off` as `reasoning_effort: "none"` or `thinking: disabled`.+Users need that third choice on the Composer model × reasoning menu.++## Decision++1. Persist `omit` as a session `thinkingLevel` alongside the seven canonical+ levels. Model-binding `thinkingLevels` and catalog capability lists remain+ the seven canonical values; `omit` is a client selector, not a published+ capability.+2. The Composer reasoning menu prepends `omit` whenever the selected model+ exposes at least one enabled canonical level. The chip renders the+ canonical string `omit` (ADR 0221). Non-reasoning models keep an `off`-only+ menu.+3. Runtime clamping preserves `omit` on a reasoning model and maps it to `off`+ otherwise. Agent bookkeeping stays `off`; the parent stream uses the same+ low-level omit path as subagents (`thinkingLevelMap.off = null`).+4. Schema v19 rebuilds `sessions` so the CHECK includes `omit`. Handshake protocol version is unchanged.++## Consequences++- Composer can leave the provider adapter's default thinking behavior in+ control without disabling thinking.+- Existing sessions keep their stored canonical levels.+- Subagent inherit of a parent `omit` continues to omit.diff --git a/docs/adr/README.md b/docs/adr/README.mdindex b1f43915c..f31fb6e6d 100644--- a/docs/adr/README.md+++ b/docs/adr/README.md@@ -321,4 +321,5 @@ Each ADR includes:| 0292 | [SSH bootstrap for remote hosts](0292-ssh-remote-host-bootstrap.md) | Accepted for implementation (D453; ADR 0205 R2b, extends ADR 0286) || 0293 | [SSH password authentication for the remote-host bootstrap](0293-ssh-password-authentication.md) | Accepted (D454; amends ADR 0292) || 0294 | [Project archive is a list + inspector workbench](0294-project-archive-list-inspector.md) | Accepted (D455; amends D267 / D168) |+| 0295 | [Session thinking-parameter omission](0295-session-thinking-parameter-omission.md) | Accepted (D456; amends ADR 0194 / ADR 0144 / ADR 0221) || turn-process-and-thinking-display | [Turn process and thinking presentation](turn-process-and-thinking-display.md) | Accepted |diff --git a/docs/spec/03-runtime/01-ipc-protocol.md b/docs/spec/03-runtime/01-ipc-protocol.mdindex b2bc09da5..4652c6841 100644--- a/docs/spec/03-runtime/01-ipc-protocol.md+++ b/docs/spec/03-runtime/01-ipc-protocol.md@@ -168,13 +168,14 @@ The renderer changes those values throughtype ThinkingLevel =| "off" | "minimal" | "low" | "medium"| "high" | "xhigh" | "max";+type SessionThinkingLevel = ThinkingLevel | "omit";type SessionConfigureRequest = {id: string;mode: "plan" | "goal" | "agent";providerId?: string;modelId?: string;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;};```@@ -867,7 +868,7 @@ type SessionSummary = {modelId?: string;providerId?: string;mode: "plan" | "goal" | "agent";- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;supportsReasoning?: boolean;supportedThinkingLevels?: ThinkingLevel[];updatedAt: string;diff --git a/docs/spec/03-runtime/02-agent-runtime.md b/docs/spec/03-runtime/02-agent-runtime.mdindex 31d0f67bd..c39871745 100644--- a/docs/spec/03-runtime/02-agent-runtime.md+++ b/docs/spec/03-runtime/02-agent-runtime.md@@ -587,7 +587,10 @@ criterion-by-criterion report of what was met and the evidence observed.## 5c. Thinking capability and stream contract- Canonical levels are `off`, `minimal`, `low`, `medium`, `high`, `xhigh`,- and `max`.+ and `max`. Session (and subagent) selectors also accept `omit`, which is+ not a catalog/binding capability: the runtime keeps agent bookkeeping at+ `off` and uses the low-level provider stream so no thinking override is+ synthesized (ADR 0194 / ADR 0295).- The bundled models.dev release snapshot is authoritative for publishedreasoning support, thinking-level mapping, limits, input/output modalities,pricing, and other model metadata. pi-ai remains responsible for requestdiff --git a/docs/spec/03-runtime/04-data-storage.md b/docs/spec/03-runtime/04-data-storage.mdindex 748e44df6..8fbc297ad 100644--- a/docs/spec/03-runtime/04-data-storage.md+++ b/docs/spec/03-runtime/04-data-storage.md@@ -392,7 +392,7 @@ CREATE TABLE sessions (mode TEXT NOT NULL DEFAULT 'agent', -- plan | agentthinking_level TEXT NOT NULL DEFAULT 'off'CHECK (thinking_level IN ('off', 'minimal', 'low', 'medium',- 'high', 'xhigh', 'max')),+ 'high', 'xhigh', 'max', 'omit')),permission_mode TEXT NOT NULL DEFAULT 'inherit' -- D115: inherit follows settingsCHECK (permission_mode IN ('inherit', 'ask', 'accept-edits', 'auto')),source TEXT, -- import origin: claude-code | codex | opencode | pi@@ -431,7 +431,9 @@ CREATE INDEX idx_session_import_origins_pluginallowed, and built-in runtimes (e.g. `pi`) never exist in `providers`.- `thinking_level` is the durable session selector. New and v2-migratedsessions default to `off`; capability resolution may clamp the effective- request without rewriting the stored preference.+ request without rewriting the stored preference. Schema v19 adds `omit`+ (ADR 0295): send no thinking override. Existing rows keep their stored+ canonical values.- `project_id` normalizes v1's free-text `project_path` (grouping, badges,hover-`+` new-session-in-project all become indexed lookups).diff --git a/docs/spec/03-runtime/06-host-rpc-protocol.md b/docs/spec/03-runtime/06-host-rpc-protocol.mdindex 90aa1ce1e..d1ab5b3a1 100644--- a/docs/spec/03-runtime/06-host-rpc-protocol.md+++ b/docs/spec/03-runtime/06-host-rpc-protocol.md@@ -324,7 +324,8 @@ to later refresh and inference; the vendor picker does not collect them.only session metadata and does not update `updated_at`, transcript content,message count, or historical notification title snapshots.- `session.configure` — atomically persists `mode`, `providerId`, `modelId`,- and optional `thinkingLevel` for the next pi turn; omitting/null+ and optional `thinkingLevel` (`off|minimal|low|medium|high|xhigh|max|omit`)+ for the next pi turn; omitting/null`thinkingLevel` preserves the current value; invalid modes or levels return`INVALID_PARAMS`; mode is `plan | goal | agent` and changing any sessionconfiguration is allowed only while idle and without a pending/queued/runningdiff --git a/docs/spec/03-runtime/13-model-catalog-and-selection.md b/docs/spec/03-runtime/13-model-catalog-and-selection.mdindex 6474581f0..c9d9af2fd 100644--- a/docs/spec/03-runtime/13-model-catalog-and-selection.md+++ b/docs/spec/03-runtime/13-model-catalog-and-selection.md@@ -158,12 +158,14 @@ Each session stores:- `providerId`- `modelId`-- `thinkingLevel` (`off|minimal|low|medium|high|xhigh|max`)+- `thinkingLevel` (`off|minimal|low|medium|high|xhigh|max|omit`)Changing model or thinking level mid-session affects subsequent turns only.The stored thinking preference survives restart; the effective request levelis clamped against the selected model binding's enabled levels at execution-time. An empty binding or a binding containing only `off` resolves to `off`.+time, except `omit`, which is preserved on a reasoning model and sends no+thinking override. An empty binding or a binding containing only `off`+resolves to `off`.For a newly created session, the renderer resolves the selected (or app-default)model's `ModelBinding`. A reasoning model starts at that binding'sdiff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex acd30986d..10856478c 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -2716,8 +2716,9 @@ reasoning-level control.`role="menu"`. Its root has exactly two `role="menuitem"` entries. The Modelsubmenu has a search input and sticky provider headings, while the Reasoninglevel submenu starts with `Current model <model> supports these reasoning- levels` and lists the selected model binding's enabled levels in canonical- order.+ levels` and lists `omit` then the selected model binding's enabled levels in+ canonical order. `omit` persists as the session thinking level and sends no+ provider thinking override (ADR 0295).Model-row reasoning badges use published reasoning metadata; vision badgesuse the effective image-input capability for the row's provider binding(`supportsImages` when explicitly set, published image input otherwise).diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 3f878276d..12fcadd46 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -10955,6 +10955,24 @@ are withdrawn with ADR 0165.- **Milestone**: M6+- **Status**: Unit/source-contract-covered; full UI journey Draft (run only in a capable environment when this surface changes)+#### E2E-203a: Session thinking omit sends no provider override++- **Preconditions**: A configured reasoning model is selected in Composer.+- **Steps**: 1) Open the model × reasoning menu and confirm `omit` is the first+ reasoning option, followed by the binding's enabled canonical levels.+ 2) Choose `omit` and confirm the chip shows `omit` and the session stores+ `thinkingLevel: omit`. 3) Send a turn and inspect the outbound request.+ 4) Choose explicit `off` and send again.+- **Expected**: `omit` persists and the request has no thinking/reasoning field.+ Explicit `off` still serializes a disable. A non-reasoning model keeps an+ `off`-only menu.+- **Specs linked**: `03-runtime/01-ipc-protocol.md`,+ `03-runtime/02-agent-runtime.md`, `03-runtime/13-model-catalog-and-selection.md`,+ ADR 0295 / D456+- **Acceptance**: C (chat/stream) + Quality+- **Milestone**: M6++- **Status**: Unit/source-contract-covered; full UI journey Draft+#### E2E-211: Windows portable exe launches without an installer (D364)- **Preconditions**: A Windows x64 tag or `dist:win` package has produced bothdiff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 6a610da64..512b295be 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -171,6 +171,7 @@ Gold source: local Codex electron captures; latest row wins where rows conflict.| D168 | Project archive presentation redesign | *(band layout and per-section panels superseded by D267)* **Project archive renders three stacked bands: an overview banner (intent sentence, primary Add project, and four derived counters for projects, open, archived, sessions), a toolbar (search with clear affordance and live match count, plus a Recent/Name sort segmented control), and a grouped index whose always-visible sections run Pinned / All projects / Archived with per-section counts, one settings panel per section, and hairline row separators. Rows carry a disclosure control, glyph, name with Active/Open/pinned/Archived tags, one meta line (shortened monospace path, branch, session count), relative last-active time, and hover/focus-revealed New task plus row menu; the menu groups create/edit above pin, archive/restore, and destructive Close, and dismisses on Escape or outside press. Archived rows are grouped and softened, never hidden or filtered, so D133's no-visibility-toggle rule still holds. This supersedes D133's flat-list presentation without changing project storage, search matching, session batching, or activation semantics.** | The flat single-list archive gave equal weight to pinned, working, and archived records and hid its disclosure and row actions behind hover, so scanning a long durable index meant reading every row. Grouping with derived counters and an explicit sort makes state legible at a glance while keeping archived history permanently reachable. || D267 | Project archive is one workbench, not three bands | *(row anatomy and inline expansion superseded by D455)* **Revise D168's band layout: Settings → Project archive renders the D257 one-workbench composition — a quiet intro line carrying only the page description, one toolbar (Recent/Name sort on the shared `settings-segment` primitive, search with clear affordance and live match count, primary Add project), and one settings panel whose always-visible Pinned / All projects / Archived groups are non-interactive in-panel header strips with per-section counts instead of one panel per section. The decorative gradient hero band is removed together with the four page-level overview counters it carried, retiring the `project.statProjects`, `project.statOpen`, `project.statArchived`, and `project.statSessions` keys; the per-group counts on the panel's header strips are now the only totals. The external uppercase section labels are removed as well; row geometry matches the capability rows (32px controls, 14px list gap, 28px row glyph). Beyond dropping the four retired counter keys this is presentation only: D168's row anatomy, row menu grouping, search matching, session batching, activation semantics, and accessibility semantics are unchanged, and no ADR is required.** | D168's overview banner used a decorative gradient and `--text-xl` counter tiles, which the design system forbids, and its per-section panels repeated the same elevated frame three times. Demoting the counters to an inline run kept the clutter without earning it: every total they showed is already legible from the per-group strip counts, so restating them above the toolbar duplicated numbers and gave the destination a header no sibling page has. Dropping them leaves the durable index looking and behaving like the agent capability pages. || D455 | Project archive is a list + inspector | **Revise D267's expanding rows: Settings → Project archive keeps the quiet intro and toolbar, then a one-column workbench. The index remains Pinned / All projects / Archived with per-section counts and no visibility toggle (D133). Compact rows show glyph, name, one status tag, session count, and relative time. A click selects and stays in Settings; double-click, Enter, or the inspector Open action activates and returns to chat. Folders, chats (batches of eight), and the row menu open under the selected row at full width. Search still matches session titles and selects the owning project. Presentation only: no IPC, storage, or host change. See ADR 0294 and E2E-038.** | Inline expansion and per-row menus made a long durable index hard to scan, and clicking a name left Settings instead of managing the project. |+| D456 | Session thinking-parameter omission | **Amend ADR 0194 / ADR 0144 / ADR 0221: session `thinkingLevel` accepts `omit` in addition to the seven canonical levels. Composer prepends `omit` on a reasoning model. Runtime bookkeeping stays `off` and uses the low-level provider stream so no thinking override is synthesized. Binding/catalog capability lists stay canonical. Schema v19 widens the session CHECK to include `omit`. Handshake protocol version is unchanged. See ADR 0295 and E2E-203a.** | Explicit `off` still serializes a disable; users need a session-level do-not-send matching subagents. |## E. M5 hardening decisions (0.4.0)@@ -6230,3 +6231,16 @@ that was sitting at the bottom — including after the turn had finished.model, and reasoning rows share one heading. Settings search still indexes`promptEnhancementModelTitle` so "增强提示词" finds the AI tab. Presentationonly: no IPC, storage, or host-protocol change.++## 2026-09-20 — Session thinking-parameter omission (D456)++- Composer, session storage, and host validation accept `thinkingLevel: omit`+ next to the seven canonical levels. Binding chips and catalog capability+ lists stay canonical; `omit` is a client selector, not a published level.+- Runtime clamping keeps `omit` on a reasoning model. Agent bookkeeping stays+ `off` and the parent stream uses the same low-level omit path as subagents,+ so adapters send no thinking field. Explicit `off` still disables thinking.+- The Composer reasoning menu prepends `omit` whenever the selected model+ exposes enabled canonical levels, and the chip renders the canonical string.+ Schema v19 rebuilds `sessions` so the CHECK includes `omit`.+ See ADR 0295 and E2E-203a.diff --git a/docs/zh-CN/adr/index.md b/docs/zh-CN/adr/index.mdindex 206150023..b58b1b5df 100644--- a/docs/zh-CN/adr/index.md+++ b/docs/zh-CN/adr/index.md@@ -300,6 +300,7 @@ ADR 记录那些不应被静默改变的架构选择。中文入口与英文索| 0291 | [移除设置页面的语音界面](/adr/0291-remove-speech-settings-ui) | 已接受(修订 ADR 0281) || 0292 | [远端主机的 SSH 引导](/adr/0292-ssh-remote-host-bootstrap) | 已接受实施(D453;ADR 0205 R2b,扩展 ADR 0286) || 0294 | [项目存档改为列表 + 检查器](/adr/0294-project-archive-list-inspector) | 已接受(D455;修订 D267 / D168) |+| 0295 | [会话思考参数不发送](/adr/0295-session-thinking-parameter-omission) | 已接受(D456;修订 ADR 0194 / ADR 0144 / ADR 0221) |## 什么时候看 ADRdiff --git a/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md b/docs/zh-CN/spec/03-runtime/01-ipc-protocol.mdindex d067d97ea..19612b382 100644--- a/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md+++ b/docs/zh-CN/spec/03-runtime/01-ipc-protocol.md@@ -149,13 +149,14 @@ Bash 的方言。type ThinkingLevel =| "off" | "minimal" | "low" | "medium"| "high" | "xhigh" | "max";+type SessionThinkingLevel = ThinkingLevel | "omit";type SessionConfigureRequest = {id: string;mode: "plan" | "goal" | "agent";providerId?: string;modelId?: string;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;};```diff --git a/docs/zh-CN/spec/03-runtime/02-agent-runtime.md b/docs/zh-CN/spec/03-runtime/02-agent-runtime.mdindex 32014ba69..c5ff9a9c2 100644--- a/docs/zh-CN/spec/03-runtime/02-agent-runtime.md+++ b/docs/zh-CN/spec/03-runtime/02-agent-runtime.md@@ -480,7 +480,9 @@ Goal 批准所承诺的内容与 Plan 批准所承诺的内容完全相同:`mo## 5c。思维能力与流契约- 规范级别为 `off`、`minimal`、`low`、`medium`、`high`、`xhigh`、- 和 `max`。+ 和 `max`。会话(及子智能体)选择器还接受 `omit`,它不是目录/绑定能力:+ 运行时把智能体记账保持为 `off`,走低层 provider 流,不合成思考覆盖+ (ADR 0194 / ADR 0295)。- 随包的 models.dev 发布快照对于已发布的推理支持具有权威性,思维层面的映射、限制、输入模式、定价、标题和适配器每个已解决的已知模型的兼容性。diff --git a/docs/zh-CN/spec/03-runtime/04-data-storage.md b/docs/zh-CN/spec/03-runtime/04-data-storage.mdindex 7e20d7dca..cf32a8fec 100644--- a/docs/zh-CN/spec/03-runtime/04-data-storage.md+++ b/docs/zh-CN/spec/03-runtime/04-data-storage.md@@ -348,7 +348,7 @@ CREATE TABLE sessions (mode TEXT NOT NULL DEFAULT 'agent', -- plan | agentthinking_level TEXT NOT NULL DEFAULT 'off'CHECK (thinking_level IN ('off', 'minimal', 'low', 'medium',- 'high', 'xhigh', 'max')),+ 'high', 'xhigh', 'max', 'omit')),permission_mode TEXT NOT NULL DEFAULT 'inherit' -- D115: inherit follows settingsCHECK (permission_mode IN ('inherit', 'ask', 'accept-edits', 'auto')),source TEXT, -- import origin: claude-code | codex | opencode | pidiff --git a/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.md b/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.mdindex f67221841..72c4b4567 100644--- a/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.md+++ b/docs/zh-CN/spec/03-runtime/13-model-catalog-and-selection.md@@ -86,11 +86,12 @@ type RecentModelRef = {- `providerId`- `modelId`-- `thinkingLevel`(`off|minimal|low|medium|high|xhigh|max`)+- `thinkingLevel`(`off|minimal|low|medium|high|xhigh|max|omit`)在会话中改变模型或思维水平只会影响后续回合。存储的思维偏好在重启后仍然存在;有效请求级别-在执行时对所选模型进行能力限制。+在执行时对所选模型绑定的已启用档位钳位,但 `omit` 在推理模型上保留,+且不发送思考覆盖。对于新创建的会话,渲染器会解析所选(或应用默认)模型的 `ModelBinding`。具有推理能力的模型始于该绑定的 `defaultThinkingLevel`,并钳位到已启用档位;diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 479d3ab43..389921317 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -6899,6 +6899,16 @@ IPC 请求无法关闭。- **里程碑**:M6+- **状态**:单元/源合约已覆盖;完整 UI 旅程为草稿+#### E2E-203a:会话思考 omit 不发送提供商覆盖++- **前提条件**:Composer 已选中支持推理的已配置模型。+- **步骤**:1) 打开模型 × 推理菜单,确认 `omit` 是第一项,其后是绑定已启用的规范档位。2) 选择 `omit`,确认芯片显示 `omit` 且会话存 `thinkingLevel: omit`。3) 发送一回合并检查出站请求。4) 再选显式 `off` 并发送。+- **预期**:`omit` 会持久化,且请求不含思考/推理字段。显式 `off` 仍序列化为关闭思考。非推理模型菜单仍只有 `off`。+- **链接规格**:`03-runtime/01-ipc-protocol.md`、`03-runtime/02-agent-runtime.md`、`03-runtime/13-model-catalog-and-selection.md`、ADR 0295 / D456+- **验收**:C + 质量+- **里程碑**:M6++- **状态**:单元/源合约已覆盖;完整 UI 旅程为草稿+#### E2E-204:显式退出在关机前确认(D363)- **前提条件**:普通交互会话正在运行(不是 boot / supervision / capture 探针)。主窗口可见或已藏到托盘。diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex 969adb04a..e7a88982d 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -174,6 +174,7 @@| D168 | 项目档案演示重新设计 | *(堆叠带布局与每部分面板被 D267 取代)* **项目存档呈现三个堆叠带:一个概述横幅(意图句、主要添加项目以及用于项目、打开、存档、会话的四个派生计数器)、一个工具栏(具有清晰的可见性和实时匹配计数的搜索,以及 Recent/Name 排序分段控件),以及一个分组索引,其始终可见的部分运行“固定/所有项目/存档”,每个部分计数、每个部分一个设置面板和细线行分隔符。行包含公开控件、字形、带有 Active/Open/pinned/Archived 标签的名称、一条元行(缩短的等宽路径、分支、会话计数)、相对最后活动时间和 hover/focus-revealed 新任务加行菜单;菜单将 create/edit 置于引脚上方、archive/restore 和破坏性关闭中,并在 Escape 或外部按下时关闭。存档的行被分组和软化,从不隐藏或过滤,因此 D133 的不可见性切换规则仍然有效。这取代了 D133 的平面列表演示,而无需更改项目存储、搜索匹配、会话批处理或激活语义。** | 平面单列表存档对固定、工作和存档记录给予同等重视,并将其披露和行操作隐藏在悬停后面,因此扫描长期持久索引意味着读取每一行。使用派生计数器进行分组并进行显式排序,使状态一目了然,同时保持存档历史记录永久可访问。 || D267 | 项目存档是一个工作台,而不是三个堆叠带 | *(行剖析与行内展开被 D455 取代)* **修订 D168 的堆叠带布局:设置 → 项目存档改为呈现 D257 的一个工作台构成 —— 一条仅承载页面说明的安静引导行、一个工具栏(使用共享 `settings-segment` 基元的“最近/名称”排序、带清除可供性与实时匹配计数的搜索、主要“添加项目”),以及一个设置面板,其始终可见的固定/所有项目/存档分组是面板内带每部分计数的非交互标题条,而不是每部分一个面板。装饰渐变英雄带被移除,它承载的四个页面级概览计数器也一并移除,并停用 `project.statProjects`、`project.statOpen`、`project.statArchived` 和 `project.statSessions` 键;面板标题条上的分组计数现在是唯一的总计。外部大写部分标签也被移除;行几何与能力页面行一致(32px 控件、14px 列表间距、28px 行字形)。除停用上述四个计数器键外,其余仅为演示层变更:D168 的行剖析、行菜单分组、搜索匹配、会话批处理、激活语义和无障碍语义均不变,且不需要新的 ADR。** | D168 的概述横幅使用了装饰渐变和 `--text-xl` 计数器格,而设计系统明确禁止两者,且其每部分面板把同一个高架框重复了三次。把计数器降级为内联串只是保留了杂乱而没有换来价值:它们展示的每个总计都已能从分组条计数中读出,因此在工具栏上方重述这些数字既重复了数字,也让该目的地拥有了兄弟页面都没有的页头。移除它们后,持久索引在外观和行为上都与智能体能力页面一致。 || D455 | 项目存档改为列表 + 检查器 | **修订 D267 的展开行:设置 → 项目存档保留安静引导行和工具栏,随后是单列工作台。索引仍按已置顶 / 全部项目 / 已归档分组并显示计数,且没有可见性开关(D133)。精简行显示字形、名称、一个状态标签、会话计数和相对时间。单击选中并留在设置页;双击、Enter 或检查器的打开操作激活项目并返回聊天。文件夹、对话(每批 8 条)和行菜单在选中行下方铺满宽度打开。搜索仍匹配会话标题并选中所属项目。仅演示层:无 IPC、存储或宿主改动。见 ADR 0294 与 E2E-038。** | 行内展开和行菜单让长索引难以扫读,单击名称还会离开设置页,不利于管理。 |+| D456 | 会话思考参数不发送 | **修订 ADR 0194 / ADR 0144 / ADR 0221:会话 `thinkingLevel` 在七个规范档位之外接受 `omit`。Composer 在推理模型上把 `omit` 放在菜单最前。运行时记账仍为 `off`,走低层 provider 流,不合成思考覆盖。绑定/目录能力列表保持规范档位。Schema v19 把会话 CHECK 扩到包含 `omit`。握手协议版本不变。见 ADR 0295 与 E2E-203a。** | 显式 `off` 仍会序列化为关闭思考;用户需要与子智能体一致的会话级不发送。 |## E.M5 强化决策 (0.4.0)@@ -4468,3 +4469,12 @@ that amendment are retired by ADR 0268; the upstream work-panel lifecycle stays.## 2026-09-20 —— 提示词增强合成一张设置 → AI 卡- 修订同日的两卡放置:增强提示词卡并入设置 → AI 的提示词增强。自定义模板开关、默认模型与思考强度共用一个标题。设置搜索仍索引 `promptEnhancementModelTitle`,因此搜「增强提示词」仍会落到 AI。仅演示层:无 IPC、存储或宿主协议改动。++## 2026-09-20 —— 会话思考参数不发送(D456)++- Composer、会话存储和宿主校验在七个规范档位之外接受 `thinkingLevel: omit`。+ 绑定芯片与目录能力列表保持规范档位;`omit` 是客户端选择,不是已发布档位。+- 运行时钳位在推理模型上保留 `omit`。智能体记账仍为 `off`,父级流与子智能体+ 共用低层 omit 路径,适配器不发送思考字段。显式 `off` 仍关闭思考。+- Composer 推理菜单在所选模型有已启用规范档位时把 `omit` 放在最前,芯片渲染+ 规范字符串。Schema v19 重建 `sessions` 以使 CHECK 包含 `omit`。见 ADR 0295 与 E2E-203a。diff --git a/packages/agent-runtime/src/model-capabilities.ts b/packages/agent-runtime/src/model-capabilities.tsindex 780610fc5..e7319664a 100644--- a/packages/agent-runtime/src/model-capabilities.ts+++ b/packages/agent-runtime/src/model-capabilities.ts@@ -9,7 +9,9 @@ import {import type { ModelConfig, ThinkingCapabilitySet } from "./thinking-level.js";export {+ agentThinkingLevel,clampThinkingLevel,+ omitThinkingModel,type ModelConfig,type ThinkingCapabilitySet,} from "./thinking-level.js";diff --git a/packages/agent-runtime/src/runtime.test.ts b/packages/agent-runtime/src/runtime.test.tsindex 5e60d2430..0871d78e1 100644--- a/packages/agent-runtime/src/runtime.test.ts+++ b/packages/agent-runtime/src/runtime.test.ts@@ -100,8 +100,8 @@ import type {CommandShellOption,Mode,PlanExecution,+ SessionThinkingLevel,SubagentDefinition,- ThinkingLevel,UiMessage,} from "@pi-desktop/shared";@@ -139,7 +139,7 @@ function createRuntime(overrides: Partial<{provider: RuntimeProviderConfig;mode: Mode | "chat";- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;history: UiMessage[];compaction: ContextCompactionRecord;compactionSettings: ContextCompactionSettings;@@ -2706,6 +2706,43 @@ describe("DesktopAgentRuntime thinking configuration", () => {await runtime.dispose();});+ it("omits the provider thinking override when the session level is omit", async () => {+ const responseProvider: RuntimeProviderConfig = {+ ...provider,+ id: "responses",+ name: "Responses",+ apiStyle: "responses",+ baseUrl: "https://example.invalid/v1",+ apiKey: "test-key",+ supportsReasoning: true,+ supportedThinkingLevels: ["off", "high"],+ modelConfig: {+ source: "generic",+ name: "Responses model",+ baseUrl: "https://example.invalid/v1",+ reasoning: true,+ thinkingLevelMap: { off: "none", high: "high" },+ input: ["text"],+ contextWindow: 128_000,+ maxTokens: 8_192,+ },+ };+ const runtime = createRuntime({ provider: responseProvider, thinkingLevel: "omit" });+ const agent = (runtime as any).agent;+ expect(agent.state.thinkingLevel).toBe("off");+ expect((runtime as any).thinkingLevel).toBe("omit");+ const requests: Record<string, unknown>[] = [];+ const fetch = vi.fn(async (_input: RequestInfo | URL, init?: RequestInit) => {+ requests.push(JSON.parse(typeof init?.body === "string" ? init.body : "{}"));+ return new Response("bad request", { status: 400 });+ });+ const stream = agent.streamFunction(agent.state.model, { systemPrompt: "system", messages: [], tools: [] }, { fetch });+ await stream.result();+ expect(requests).toHaveLength(1);+ expect(requests[0].reasoning).toBeUndefined();+ await runtime.dispose();+ });+it("applies the complete models.dev model record while preserving endpoint identity", async () => {const mimo: RuntimeProviderConfig = {...provider,diff --git a/packages/agent-runtime/src/runtime.ts b/packages/agent-runtime/src/runtime.tsindex 565c5e70f..92a8bfeba 100644--- a/packages/agent-runtime/src/runtime.ts+++ b/packages/agent-runtime/src/runtime.ts@@ -82,6 +82,7 @@ import type {Risk,SubagentDefinition,SubagentRunStatus,+ SessionThinkingLevel,SubagentThinkingLevel,ThinkingLevel,ToolTokenUsage,@@ -154,7 +155,7 @@ import {composeModeSystemPrompt,DEFAULT_RUNTIME_SYSTEM_PROMPT,} from "./mode-prompts.js";-import { clampThinkingLevel } from "./thinking-level.js";+import { agentThinkingLevel, clampThinkingLevel, omitThinkingModel } from "./thinking-level.js";import {alignRetainedReasoningIdentity,harvestRetainedReasoning,@@ -836,7 +837,7 @@ export type AgentRuntimeOptions = {/** Durable host turn ID for the current prompt, used by plan identity. */turnId?: string;provider: RuntimeProviderConfig;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;systemPrompt?: string;/** Session-bound workspace root used for path-scoped instruction requests. */projectPath?: string;@@ -888,7 +889,7 @@ export type AgentRuntimeOptions = {export type RuntimeMatchConfig = {mode: Mode;provider: RuntimeProviderConfig;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;pluginTools?: PluginToolDef[];pluginSkills?: PluginSkillDef[];trustedExtensions?: TrustedExtensionSpec[];@@ -1471,7 +1472,7 @@ export class DesktopAgentRuntime {readonly sessionId: string;private mode: Mode;private provider: RuntimeProviderConfig;- private thinkingLevel: ThinkingLevel;+ private thinkingLevel: SessionThinkingLevel;private host: RuntimeHost;private onEvent: (envelope: AgentEventEnvelope) => void;private streamSink: StreamCoalescer;@@ -1835,7 +1836,10 @@ Delegation rules:m,context,hookedOptions,- (retryOptions) => this.models.streamSimple(m, context, retryOptions),+ (retryOptions) =>+ this.thinkingLevel === "omit"+ ? this.models.stream(omitThinkingModel(m), context, retryOptions)+ : this.models.streamSimple(m, context, retryOptions),{claim: (error, phase) => this.claimProviderRetry(error, phase),headers: () => this.providerRetryHeaders,@@ -1868,7 +1872,7 @@ Delegation rules:systemPrompt: this.composeSystemPrompt(),model,tools,- thinkingLevel: this.thinkingLevel,+ thinkingLevel: agentThinkingLevel(this.thinkingLevel),messages: this.liveSessionContext().messages,},// Plan transitions must be the only tool call in an assistant batch.@@ -2278,7 +2282,7 @@ Delegation rules:});this.thinkingLevel = clampThinkingLevel(this.provider, this.thinkingLevel);this.agent.state.model = model;- this.agent.state.thinkingLevel = this.thinkingLevel;+ this.agent.state.thinkingLevel = agentThinkingLevel(this.thinkingLevel);}async activateTrustedExtensionAgent(agentKey: string, modelId: string): Promise<boolean> {@@ -2349,7 +2353,7 @@ Delegation rules:getModel: () => runtime.model,setModel: (model) => runtime.setExtensionModel(model),modelRegistry: runtime.extensionModelRegistry(),- getThinkingLevel: () => runtime.thinkingLevel,+ getThinkingLevel: () => agentThinkingLevel(runtime.thinkingLevel),setThinkingLevel: (level) => {runtime.thinkingLevel = clampThinkingLevel(runtime.provider, level as ThinkingLevel);},@@ -6346,7 +6350,7 @@ Delegation rules:withCompactionRequestHeaders(this.models, this.provider, this.sessionId),this.model,undefined,- this.thinkingLevel,+ agentThinkingLevel(this.thinkingLevel),// Without a policy pi-ai returns the first failed response as-is, which// made a single dropped stream or 503 discard the whole summary (#543).// pi's classifier decides what is transient; the waits honour `signal`.diff --git a/packages/agent-runtime/src/sidecar-config.test.ts b/packages/agent-runtime/src/sidecar-config.test.tsindex 7ad89a53e..f19a28168 100644--- a/packages/agent-runtime/src/sidecar-config.test.ts+++ b/packages/agent-runtime/src/sidecar-config.test.ts@@ -8,6 +8,7 @@ describe("sidecar thinking-level boundary", () => {it("preserves supported levels from IPC params", () => {expect(normalizeThinkingLevel("high")).toBe("high");expect(normalizeThinkingLevel("off")).toBe("off");+ expect(normalizeThinkingLevel("omit")).toBe("omit");});it("fails closed to off for malformed or absent params", () => {diff --git a/packages/agent-runtime/src/sidecar-config.ts b/packages/agent-runtime/src/sidecar-config.tsindex 565174179..56cec003e 100644--- a/packages/agent-runtime/src/sidecar-config.ts+++ b/packages/agent-runtime/src/sidecar-config.ts@@ -1,4 +1,8 @@-import type { ThinkingLevel } from "@pi-desktop/shared";+import {+ SESSION_THINKING_LEVELS,+ type SessionThinkingLevel,+ type ThinkingLevel,+} from "@pi-desktop/shared";const THINKING_LEVELS: ThinkingLevel[] = ["off",@@ -18,10 +22,10 @@ const DEFAULT_REASONING_LEVELS: ThinkingLevel[] = ["high",];-export function normalizeThinkingLevel(value: unknown): ThinkingLevel {+export function normalizeThinkingLevel(value: unknown): SessionThinkingLevel {return typeof value === "string" &&- THINKING_LEVELS.includes(value as ThinkingLevel)- ? (value as ThinkingLevel)+ (SESSION_THINKING_LEVELS as readonly string[]).includes(value)+ ? (value as SessionThinkingLevel): "off";}diff --git a/packages/agent-runtime/src/sidecar.ts b/packages/agent-runtime/src/sidecar.tsindex 93ffc35fa..5a4e227f2 100644--- a/packages/agent-runtime/src/sidecar.ts+++ b/packages/agent-runtime/src/sidecar.ts@@ -46,7 +46,7 @@ import type {Mode,MessageAttachment,PlanExecution,- ThinkingLevel,+ SessionThinkingLevel,UiMessage,} from "@pi-desktop/shared";@@ -94,7 +94,7 @@ type RuntimeParams = {mode?: Mode;/** Durable host turn ID for the prompt currently being executed. */turnId?: string;- thinkingLevel?: ThinkingLevel;+ thinkingLevel?: SessionThinkingLevel;provider: RuntimeProviderConfig;commandShell: CommandShellOption;pluginTools?: PluginToolDef[];diff --git a/packages/agent-runtime/src/subagent-model-binding.ts b/packages/agent-runtime/src/subagent-model-binding.tsindex 49b301603..65fbbfe6f 100644--- a/packages/agent-runtime/src/subagent-model-binding.ts+++ b/packages/agent-runtime/src/subagent-model-binding.ts@@ -10,6 +10,7 @@ import {withOpenCodeSessionHeaders,} from "./opencode-session-headers.js";import { mergeProviderHeaders, withProviderHeaders } from "./provider-headers.js";+import { agentThinkingLevel as agentThinkingLevelFor, omitThinkingModel as withOmittedThinking } from "./thinking-level.js";import { captureProviderResponse, carriesRetryDelayHeaders, createProviderRetryStream } from "./provider-retry.js";import type { AgentOptions } from "@earendil-works/pi-agent-core";import type { SubagentThinkingLevel } from "@pi-desktop/shared";@@ -41,17 +42,11 @@ export function subagentModelBinding(opts: {: builtModel;const models = createProviderModels(opts.provider, model);const omitThinking = opts.thinkingLevel === "omit";- const agentThinkingLevel =- opts.thinkingLevel === "omit" ? "off" : opts.thinkingLevel;+ const agentThinkingLevel = agentThinkingLevelFor(opts.thinkingLevel);// The Responses adapter's low-level stream still uses a model-level// `off` mapping as its fallback. Null it only for the omit path so the// provider receives no synthesized reasoning setting at all.- const omitThinkingModel = omitThinking- ? {- ...model,- thinkingLevelMap: { ...model.thinkingLevelMap, off: null },- }- : model;+ const omitThinkingModel = omitThinking ? withOmittedThinking(model) : model;const requestKey = providerRequestKey(opts.provider);return {model,diff --git a/packages/agent-runtime/src/thinking-level.test.ts b/packages/agent-runtime/src/thinking-level.test.tsnew file mode 100644index 000000000..673f466aa--- /dev/null+++ b/packages/agent-runtime/src/thinking-level.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from "vitest";+import { agentThinkingLevel, clampThinkingLevel, omitThinkingModel } from "./thinking-level.js";++const reasoning = {+ supportsReasoning: true,+ supportedThinkingLevels: ["off", "low", "high"] as const,+};++describe("session thinking omit", () => {+ it("keeps omit on a reasoning model and maps bookkeeping to off", () => {+ expect(clampThinkingLevel(reasoning, "omit")).toBe("omit");+ expect(agentThinkingLevel("omit")).toBe("off");+ expect(agentThinkingLevel("high")).toBe("high");+ });++ it("forces omit to off when the model cannot reason", () => {+ expect(clampThinkingLevel({ supportsReasoning: false, supportedThinkingLevels: ["off"] }, "omit")).toBe("off");+ });++ it("nulls the off mapping so adapters send no thinking field", () => {+ expect(omitThinkingModel({ thinkingLevelMap: { off: "none", high: "high" } }).thinkingLevelMap).toEqual({+ off: null,+ high: "high",+ });+ });+});diff --git a/packages/agent-runtime/src/thinking-level.ts b/packages/agent-runtime/src/thinking-level.tsindex 3ba6ad745..36072a1b3 100644--- a/packages/agent-runtime/src/thinking-level.ts+++ b/packages/agent-runtime/src/thinking-level.ts@@ -6,6 +6,7 @@ import type {ModelModalities,ModelProviderMetadata,ModelReasoningOption,+ SessionThinkingLevel,ThinkingLevel,} from "@pi-desktop/shared";@@ -74,12 +75,28 @@ const THINKING_LEVELS: ThinkingLevel[] = ["max",];+/** Agent bookkeeping value: omit is stored as off so pi-ai does not synthesize a level. */+export function agentThinkingLevel(level: SessionThinkingLevel): ThinkingLevel {+ return level === "omit" ? "off" : level;+}++/** Null the Responses/simple-stream `off` fallback so omit sends no thinking field. */+export function omitThinkingModel<T extends { thinkingLevelMap?: Partial<Record<string, string | null>> }>(+ model: T,+): T {+ return {+ ...model,+ thinkingLevelMap: { ...model.thinkingLevelMap, off: null },+ };+}+/** Apply the canonical nearest-supported-level rule to catalog metadata. */export function clampThinkingLevel(capabilities: ThinkingCapabilitySet,- requested: ThinkingLevel,-): ThinkingLevel {+ requested: SessionThinkingLevel,+): SessionThinkingLevel {if (!capabilities.supportsReasoning) return "off";+ if (requested === "omit") return "omit";const supported = new Set(capabilities.supportedThinkingLevels ?? ["off"]);if (supported.has(requested)) return requested;diff --git a/packages/host-runtime/src/launch-resolver.ts b/packages/host-runtime/src/launch-resolver.tsindex 1beefe90d..423a22f60 100644--- a/packages/host-runtime/src/launch-resolver.ts+++ b/packages/host-runtime/src/launch-resolver.ts@@ -12,7 +12,7 @@ import {type CommandShellCatalog,type ModelBinding,type Mode,- type ThinkingLevel,+ type SessionThinkingLevel,type UserSkillRecord,type UserSubagentRecord,} from "@pi-desktop/shared";@@ -54,7 +54,7 @@ export type LaunchOverrides = {turnId?: string;providerId?: string;modelId?: string;- thinkingLevel?: ThinkingLevel;+ thinkingLevel?: SessionThinkingLevel;};/** What a turn needs to start: the provider identity and the sidecar payload. */@@ -94,11 +94,12 @@ export type HeadlessLaunchResolverOptions = {catalog?: ModelCatalogPort;};-const THINKING_LEVELS: ThinkingLevel[] = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];+const SESSION_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max", "omit"] as const;-function normalizeThinkingLevel(value: unknown): ThinkingLevel {- return typeof value === "string" && THINKING_LEVELS.includes(value as ThinkingLevel)- ? (value as ThinkingLevel)+function normalizeThinkingLevel(value: unknown): SessionThinkingLevel {+ return typeof value === "string" &&+ (SESSION_THINKING_LEVELS as readonly string[]).includes(value)+ ? (value as SessionThinkingLevel): "off";}diff --git a/packages/shared/src/thinking-levels.test.ts b/packages/shared/src/thinking-levels.test.tsindex c540e1f30..35ef5d0ff 100644--- a/packages/shared/src/thinking-levels.test.ts+++ b/packages/shared/src/thinking-levels.test.ts@@ -2,8 +2,11 @@ import { describe, expect, it } from "vitest";import {highestSupportedThinkingLevel,initialThinkingLevelForBinding,+ canonicalThinkingLevel,+ isSessionThinkingLevel,nearestSupportedThinkingLevel,publishedThinkingLevels,+ sessionThinkingMenuLevels,} from "./thinking-levels.js";describe("highestSupportedThinkingLevel", () => {@@ -109,3 +112,15 @@ describe("publishedThinkingLevels", () => {expect(publishedThinkingLevels(undefined)).toEqual([]);});});++describe("session thinking omit", () => {+ it("accepts omit as a session selector without treating it as a capability", () => {+ expect(isSessionThinkingLevel("omit")).toBe(true);+ expect(isSessionThinkingLevel("high")).toBe(true);+ expect(isSessionThinkingLevel("turbo")).toBe(false);+ expect(sessionThinkingMenuLevels(["low", "high"])).toEqual(["omit", "low", "high"]);+ expect(sessionThinkingMenuLevels([])).toEqual(["off"]);+ expect(canonicalThinkingLevel("omit")).toBe("off");+ expect(canonicalThinkingLevel("high")).toBe("high");+ });+});diff --git a/packages/shared/src/thinking-levels.ts b/packages/shared/src/thinking-levels.tsindex c9aec8495..989b5dc7f 100644--- a/packages/shared/src/thinking-levels.ts+++ b/packages/shared/src/thinking-levels.ts@@ -1,4 +1,26 @@-import { THINKING_LEVELS, type ThinkingLevel } from "./types.js";+import {+ SESSION_THINKING_LEVELS,+ THINKING_LEVELS,+ type SessionThinkingLevel,+ type ThinkingLevel,+} from "./types.js";++export function isSessionThinkingLevel(value: unknown): value is SessionThinkingLevel {+ return typeof value === "string" && (SESSION_THINKING_LEVELS as readonly string[]).includes(value);+}++/** Map omit onto bookkeeping `off` for APIs that only accept canonical levels. */+export function canonicalThinkingLevel(level: SessionThinkingLevel): ThinkingLevel {+ return level === "omit" ? "off" : level;+}++/** Composer menu: do-not-send first, then the binding's enabled canonical levels. */+export function sessionThinkingMenuLevels(+ available: readonly ThinkingLevel[] | undefined,+): SessionThinkingLevel[] {+ if (!available || available.length === 0) return ["off"];+ return ["omit", ...available];+}export function highestSupportedThinkingLevel(levels: readonly ThinkingLevel[] | undefined,diff --git a/packages/shared/src/types/models.ts b/packages/shared/src/types/models.tsindex ff8710ce8..b0ea5dff2 100644--- a/packages/shared/src/types/models.ts+++ b/packages/shared/src/types/models.ts@@ -9,9 +9,14 @@ export const THINKING_LEVELS = ["max",] as const;export type ThinkingLevel = (typeof THINKING_LEVELS)[number];-/** Per-subagent selector values; omit leaves the provider's default untouched. */-export const SUBAGENT_THINKING_LEVELS = [...THINKING_LEVELS, "omit"] as const;-export type SubagentThinkingLevel = (typeof SUBAGENT_THINKING_LEVELS)[number];+/**+ * Session and subagent selector values. `omit` leaves the provider default+ * untouched and is not a catalog/binding capability.+ */+export const SESSION_THINKING_LEVELS = [...THINKING_LEVELS, "omit"] as const;+export type SessionThinkingLevel = (typeof SESSION_THINKING_LEVELS)[number];+export const SUBAGENT_THINKING_LEVELS = SESSION_THINKING_LEVELS;+export type SubagentThinkingLevel = SessionThinkingLevel;export type ModelProviderMetadata = string | Record<string, unknown>;export type ModelExperimentalMetadata = boolean | Record<string, unknown>;diff --git a/packages/shared/src/types/sessions.ts b/packages/shared/src/types/sessions.tsindex bb7f24724..24e87febc 100644--- a/packages/shared/src/types/sessions.ts+++ b/packages/shared/src/types/sessions.ts@@ -1,6 +1,6 @@/** Shared public types grouped by the owning application domain. */import type { Mode } from "./common.js";-import type { ThinkingLevel } from "./models.js";+import type { SessionThinkingLevel, ThinkingLevel } from "./models.js";import type { PermissionMode } from "./permissions.js";import type { UiMessage } from "./messages.js";import type { PlanningState } from "./plans.js";@@ -38,7 +38,7 @@ export type SessionSummary = {modelId?: string;providerId?: string;mode: Mode;- thinkingLevel: ThinkingLevel;+ thinkingLevel: SessionThinkingLevel;/** Per-session permission mode; `inherit` follows the global default (D115). */permissionMode: PermissionMode;/** Effective capability for this session's exact provider/model pair. */