diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx index 51fe125bf087e..69af993a41529 100644 --- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx +++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx @@ -543,6 +543,7 @@ function ThreadSettingsSessionProvider( const compatibleRuntimeMode = compatibleRuntimeModeForChoices( props.runtimeMode, runtimeModeChoices, + config?.managedPolicy, ); const hasLegacyModels = props.providerGroups.some((group) => diff --git a/apps/mobile/src/features/threads/thread-settings-options.ts b/apps/mobile/src/features/threads/thread-settings-options.ts index 49a1dd84656a5..8f779caa44f50 100644 --- a/apps/mobile/src/features/threads/thread-settings-options.ts +++ b/apps/mobile/src/features/threads/thread-settings-options.ts @@ -1,5 +1,9 @@ import { managedRuntimeModeDenial } from "@t3tools/client-runtime/contract-labels"; -import type { ManagedPolicySummary, RuntimeMode } from "@t3tools/contracts"; +import { + type ManagedPolicySummary, + providerRuntimeMode, + type RuntimeMode, +} from "@t3tools/contracts"; import { msg } from "gt-react-native"; import { m, type MessageResolver } from "../../i18n/messages"; @@ -22,7 +26,9 @@ export const RUNTIME_MODE_CHOICES: ReadonlyArray<{ { mode: "auto", label: msg("Auto"), - description: msg("Supported providers approve routine actions; others still ask."), + description: msg( + "Supported providers approve routine actions; providers without Auto get Full access.", + ), }, { mode: "full-access", @@ -78,10 +84,13 @@ export function resolveNewThreadRuntimeMode( export function compatibleRuntimeModeForChoices( runtimeMode: RuntimeMode, choices: ReadonlyArray<{ readonly mode: RuntimeMode }>, + managedPolicy: ManagedPolicySummary | undefined, ): RuntimeMode { - return choices.some((choice) => choice.mode === runtimeMode) - ? runtimeMode - : (choices[0]?.mode ?? runtimeMode); + return providerRuntimeMode( + runtimeMode, + choices.map((choice) => choice.mode), + managedPolicy?.limits?.maxRuntimeMode, + ); } export { selectableProviderOptionChoices as selectableChoices } from "@t3tools/client-runtime/model-traits"; diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 1fe7fdc60bce9..3be25ea46f26b 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -4917,7 +4917,7 @@ "cceea5cef0684b31": "Änderungen automatisch annehmen", "3fe210c30bf00152": "Änderungen automatisch genehmigen, vor anderen Aktionen nachfragen.", "fd064d8807f0aaa2": "Auto", - "451204c240ead696": "Unterstützte Anbieter genehmigen Routineaktionen; andere fragen weiterhin nach.", + "d9efd017a6b1f019": "Unterstützte Anbieter genehmigen Routineaktionen; Anbieter ohne Auto erhalten Vollzugriff.", "1eed3d794eed6b65": "Vollzugriff", "7f284f51644bb125": "Befehle und Änderungen ohne Nachfrage erlauben.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 84c6fd8dfd893..828747853e078 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -4919,7 +4919,7 @@ "cceea5cef0684b31": "Auto-accept edits", "3fe210c30bf00152": "Auto-approve edits, ask before other actions.", "fd064d8807f0aaa2": "Auto", - "451204c240ead696": "Supported providers approve routine actions; others still ask.", + "d9efd017a6b1f019": "Supported providers approve routine actions; providers without Auto get Full access.", "1eed3d794eed6b65": "Full access", "7f284f51644bb125": "Allow commands and edits without prompts.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index d3fb1c8188ddb..79cb806a7f267 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -4910,7 +4910,7 @@ "cceea5cef0684b31": "Aceptar ediciones automáticamente", "3fe210c30bf00152": "Aprueba las ediciones automáticamente y pregunta antes de otras acciones.", "fd064d8807f0aaa2": "Automático", - "451204c240ead696": "Los proveedores compatibles aprueban las acciones rutinarias; los demás siguen preguntando.", + "d9efd017a6b1f019": "Los proveedores compatibles aprueban las acciones rutinarias; los que no tienen Automático obtienen Acceso completo.", "1eed3d794eed6b65": "Acceso completo", "7f284f51644bb125": "Permite comandos y ediciones sin preguntar.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 2d4f3cb8084fc..a19d26cefc5d9 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -4911,7 +4911,7 @@ "cceea5cef0684b31": "Accepter les modifications automatiquement", "3fe210c30bf00152": "Approuver automatiquement les modifications, demander avant les autres actions.", "fd064d8807f0aaa2": "Auto", - "451204c240ead696": "Les fournisseurs compatibles approuvent les actions courantes ; les autres demandent toujours.", + "d9efd017a6b1f019": "Les fournisseurs compatibles approuvent les actions courantes ; ceux sans Auto obtiennent un Accès complet.", "1eed3d794eed6b65": "Accès complet", "7f284f51644bb125": "Autoriser les commandes et les modifications sans demander.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 68bcbddda6f02..1168a25a83120 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -4891,7 +4891,7 @@ "cceea5cef0684b31": "編集を自動承認", "3fe210c30bf00152": "編集は自動承認し、その他の操作の前に確認します。", "fd064d8807f0aaa2": "自動", - "451204c240ead696": "対応しているプロバイダーは日常的な操作を承認し、それ以外は確認します。", + "d9efd017a6b1f019": "対応しているプロバイダーは日常的な操作を承認し、自動に対応していないプロバイダーはフルアクセスになります。", "1eed3d794eed6b65": "フルアクセス", "7f284f51644bb125": "確認なしでコマンドと編集を許可します。", "3bb848279618550f": "{label}、{summary}", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index ce3e8aba332c7..e17df8610b9e4 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -4896,7 +4896,7 @@ "cceea5cef0684b31": "편집 자동 수락", "3fe210c30bf00152": "편집은 자동 승인하고 다른 작업 전에는 확인합니다.", "fd064d8807f0aaa2": "자동", - "451204c240ead696": "지원되는 제공자는 일상적인 작업을 승인하고, 나머지는 계속 확인합니다.", + "d9efd017a6b1f019": "지원되는 제공자는 일상적인 작업을 승인하고, 자동을 지원하지 않는 제공자는 전체 액세스로 실행됩니다.", "1eed3d794eed6b65": "전체 액세스", "7f284f51644bb125": "확인 없이 명령과 편집을 허용합니다.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 8cb5744485eaa..3376a51e39c46 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -4911,7 +4911,7 @@ "cceea5cef0684b31": "Aceitar edições automaticamente", "3fe210c30bf00152": "Aprova edições automaticamente e pergunta antes de outras ações.", "fd064d8807f0aaa2": "Automático", - "451204c240ead696": "Os provedores compatíveis aprovam ações rotineiras; os outros continuam perguntando.", + "d9efd017a6b1f019": "Os provedores compatíveis aprovam ações rotineiras; os que não têm Auto recebem Acesso total.", "1eed3d794eed6b65": "Acesso total", "7f284f51644bb125": "Permite comandos e edições sem perguntar.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index 7dcacfc04efc6..dc70038bce762 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -4989,7 +4989,7 @@ "cceea5cef0684b31": "Автопринятие правок", "3fe210c30bf00152": "Автоматически подтверждать правки, спрашивать перед другими действиями.", "fd064d8807f0aaa2": "Авто", - "451204c240ead696": "Поддерживаемые провайдеры подтверждают рутинные действия; остальные всё равно спрашивают.", + "d9efd017a6b1f019": "Поддерживаемые провайдеры подтверждают рутинные действия; провайдеры без режима «Авто» получают полный доступ.", "1eed3d794eed6b65": "Полный доступ", "7f284f51644bb125": "Разрешать команды и правки без запросов.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 6e18ff09a8318..89f6a6881ae97 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -4917,7 +4917,7 @@ "cceea5cef0684b31": "Godkänn ändringar automatiskt", "3fe210c30bf00152": "Godkänn ändringar automatiskt, fråga före andra åtgärder.", "fd064d8807f0aaa2": "Auto", - "451204c240ead696": "Leverantörer som stöder det godkänner rutinåtgärder; andra frågar fortfarande.", + "d9efd017a6b1f019": "Leverantörer som stöder det godkänner rutinåtgärder; leverantörer utan Auto får full åtkomst.", "1eed3d794eed6b65": "Full åtkomst", "7f284f51644bb125": "Tillåt kommandon och ändringar utan att fråga.", "3bb848279618550f": "{label}, {summary}", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 1bea8cf8142f2..31f8ba966e20f 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -4900,7 +4900,7 @@ "cceea5cef0684b31": "自动接受编辑", "3fe210c30bf00152": "自动批准编辑,其他操作前询问。", "fd064d8807f0aaa2": "自动", - "451204c240ead696": "支持此模式的提供方会自动批准常规操作,其他提供方仍会询问。", + "d9efd017a6b1f019": "支持此模式的提供方会自动批准常规操作,不支持自动模式的提供方将获得完全访问。", "1eed3d794eed6b65": "完全访问", "7f284f51644bb125": "允许执行命令和编辑,无需确认。", "3bb848279618550f": "{label},{summary}", diff --git a/apps/server/src/mcp/OrchestratorMcpService.test.ts b/apps/server/src/mcp/OrchestratorMcpService.test.ts index 551a84109cfa2..ba1e22d6df693 100644 --- a/apps/server/src/mcp/OrchestratorMcpService.test.ts +++ b/apps/server/src/mcp/OrchestratorMcpService.test.ts @@ -5020,7 +5020,10 @@ describe("OrchestratorMcpService provider resolution", () => { it.effect("steps an inherited mode down to the broadest one the provider offers", () => Effect.gen(function* () { assert.equal(yield* resolveRuntimeMode("full-access", "inherit", muse), "full-access"); - assert.equal(yield* resolveRuntimeMode("auto", undefined, muse), "approval-required"); + assert.equal( + yield* resolveRuntimeMode("auto-accept-edits", undefined, muse), + "approval-required", + ); }), ); }); diff --git a/apps/server/src/mcp/delegatedTaskModes.ts b/apps/server/src/mcp/delegatedTaskModes.ts index 54d25bbb36e02..cecdcbc8085e1 100644 --- a/apps/server/src/mcp/delegatedTaskModes.ts +++ b/apps/server/src/mcp/delegatedTaskModes.ts @@ -30,8 +30,9 @@ export function interactionModeRank(mode: ProviderInteractionMode): number { /** * The mode a child runs at: the one asked for, never broader than its parent's. - * An inherited mode the target provider does not offer steps down to the - * broadest one it does; an explicitly requested one is refused instead. + * Auto is kept where the target lacks it: RuntimePolicy runs it as that + * provider's broadest mode. Any other inherited mode the target does not offer + * steps down to the broadest one it does; an explicit one is refused instead. */ export function resolveRuntimeMode( parentMode: RuntimeMode, @@ -52,7 +53,12 @@ export function resolveRuntimeMode( ); } const supported = target?.supportedRuntimeModes; - if (supported === undefined || supported.length === 0 || supported.includes(resolved)) { + if ( + supported === undefined || + supported.length === 0 || + supported.includes(resolved) || + resolved === "auto" + ) { return Effect.succeed(resolved); } if (!inherited) { diff --git a/apps/server/src/mcp/toolkits/project/handlers.test.ts b/apps/server/src/mcp/toolkits/project/handlers.test.ts index d03b038ee0780..01b23601c1251 100644 --- a/apps/server/src/mcp/toolkits/project/handlers.test.ts +++ b/apps/server/src/mcp/toolkits/project/handlers.test.ts @@ -324,9 +324,9 @@ it.effect( }), ); -it.effect("a launch steps an inherited mode down to the provider's, and refuses one it lacks", () => +it.effect("a launch keeps auto on a provider without it", () => Effect.gen(function* () { - // Pi offers no Auto; a mode a provider lacks would run as Supervised. + // Pi offers no Auto; RuntimePolicy runs an Auto thread there in Full access. const pi = ProviderInstanceId.make("pi"); const launchPi = Effect.fn("test.launchPi")(function* (runtimeMode?: RuntimeMode) { const launched: Array = []; @@ -369,11 +369,10 @@ it.effect("a launch steps an inherited mode down to the provider's, and refuses }); const inherited = yield* launchPi(); - expect(inherited.launched[0]?.runtimeMode).toBe("auto-accept-edits"); + expect(inherited.launched[0]?.runtimeMode).toBe("auto"); const requested = yield* launchPi("auto"); - expect(requested.result).toMatchObject({ code: "invalid_request" }); - expect(requested.launched).toHaveLength(0); + expect(requested.launched[0]?.runtimeMode).toBe("auto"); const offered = yield* launchPi("approval-required"); expect(offered.launched[0]?.runtimeMode).toBe("approval-required"); diff --git a/apps/server/src/orchestration-v2/RuntimePolicy.test.ts b/apps/server/src/orchestration-v2/RuntimePolicy.test.ts index cc73719010ea8..ff07b570804cc 100644 --- a/apps/server/src/orchestration-v2/RuntimePolicy.test.ts +++ b/apps/server/src/orchestration-v2/RuntimePolicy.test.ts @@ -6,6 +6,7 @@ import { type OrchestrationV2AppThread, ProjectId, ProviderInstanceId, + providerRuntimeMode, type RuntimeMode, type ServerProvider, ThreadId, @@ -166,7 +167,7 @@ const layerTaskFolderPolicy = layerWithPolicy( ).pipe(Layer.provideMerge(layerTaskFolderStore)); it.layer(layerTest)("RuntimePolicyV2", (it) => { - it.effect("asks for Antigravity command approval when a stored Auto thread falls back", () => + it.effect("runs a stored Auto thread on Antigravity without Auto in Full access", () => Effect.gen(function* () { const policy = yield* RuntimePolicy.RuntimePolicyV2; const now = yield* DateTime.now; @@ -181,8 +182,16 @@ it.layer(layerTest)("RuntimePolicyV2", (it) => { options: [{ optionId: "allow", name: "Allow", kind: "allow_once" as const }], }; const auto = yield* resolve("auto"); - assert.equal(auto.runtimeMode, "approval-required"); - assert.equal(acpPermissionDisposition(auto, request), "ask"); + assert.equal(auto.runtimeMode, "full-access"); + assert.equal(acpPermissionDisposition(auto, request), "allow"); + assert.equal( + providerRuntimeMode( + "auto", + supportedRuntimeModesByInstance.get(antigravityInstanceId), + "auto", + ), + "auto-accept-edits", + ); assert.equal(acpPermissionDisposition(yield* resolve("auto-accept-edits"), request), "ask"); assert.equal(acpPermissionDisposition(yield* resolve("full-access"), request), "allow"); }), diff --git a/apps/server/src/orchestration-v2/RuntimePolicy.ts b/apps/server/src/orchestration-v2/RuntimePolicy.ts index aac7a859423fb..024982023e215 100644 --- a/apps/server/src/orchestration-v2/RuntimePolicy.ts +++ b/apps/server/src/orchestration-v2/RuntimePolicy.ts @@ -5,6 +5,7 @@ import { OrchestrationV2AppThread, ProjectId, ProviderInstanceId, + providerRuntimeMode, RuntimeMode, ThreadId, } from "@t3tools/contracts"; @@ -89,17 +90,6 @@ export const layer: Layer.Layer = Layer.succeed(RuntimePolicyV2 }), }); -export function providerRuntimeMode( - runtimeMode: RuntimeMode, - supportedRuntimeModes: ReadonlyArray | undefined, -): RuntimeMode { - return supportedRuntimeModes === undefined || - supportedRuntimeModes.length === 0 || - supportedRuntimeModes.includes(runtimeMode) - ? runtimeMode - : "approval-required"; -} - const refuseAboveCeiling = ( managedPolicy: ServerSettings.ServerSettingsService["Service"]["managedPolicy"], thread: OrchestrationV2AppThread, @@ -201,7 +191,11 @@ export const layerFromProjectStore: Layer.Layer< ), ); return ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({ - runtimeMode: providerRuntimeMode(input.thread.runtimeMode, supportedRuntimeModes), + runtimeMode: providerRuntimeMode( + input.thread.runtimeMode, + supportedRuntimeModes, + maxRuntimeMode, + ), interactionMode: input.thread.interactionMode, cwd, ...(maxRuntimeMode === undefined ? {} : { maxRuntimeMode }), diff --git a/apps/server/src/orchestration-v2/testkit/FxReplayFixtures.integration.test.ts b/apps/server/src/orchestration-v2/testkit/FxReplayFixtures.integration.test.ts index c226c2ba0f350..f58397cdc3120 100644 --- a/apps/server/src/orchestration-v2/testkit/FxReplayFixtures.integration.test.ts +++ b/apps/server/src/orchestration-v2/testkit/FxReplayFixtures.integration.test.ts @@ -1,8 +1,8 @@ import { describe } from "@effect/vitest"; +import { providerRuntimeMode } from "@t3tools/contracts"; import { FX_SUPPORTED_RUNTIME_MODES } from "@t3tools/provider-fx/testing"; import { FxOrchestratorReplayHarness } from "../Adapters/FxAdapterV2.testkit.ts"; -import { providerRuntimeMode } from "../RuntimePolicy.ts"; import { itRunsReplayFixtures, runReplayFixture } from "./ProviderReplayFixtures.ts"; describe("fx replay fixtures", () => { diff --git a/apps/server/src/provider/AntigravityProvider.test.ts b/apps/server/src/provider/AntigravityProvider.test.ts index 88589d1c9a773..1acde07ef0036 100644 --- a/apps/server/src/provider/AntigravityProvider.test.ts +++ b/apps/server/src/provider/AntigravityProvider.test.ts @@ -355,7 +355,7 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => { }), ); - it.effect("offers Auto only while the signed-in session advertises agy's own Auto", () => + it.effect("offers Auto until a signed-in session reports it lacks agy's own Auto", () => Effect.gen(function* () { const harness = yield* makeHarness(); yield* harness.initialize; @@ -363,6 +363,12 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => { Effect.map((snapshot) => snapshot.supportedRuntimeModes), ); const withoutAuto = ["approval-required", "auto-accept-edits", "full-access"]; + const withAuto: ReadonlyArray = [ + "approval-required", + "auto-accept-edits", + "auto", + "full-access", + ]; const startedWithAuto = { ...started, sessionSetupResult: { @@ -376,30 +382,21 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => { }, }, }; + expect(yield* supportedModes).toEqual(withAuto); + yield* harness.provider.onSessionStarted(started); expect(yield* supportedModes).toEqual(withoutAuto); yield* harness.provider.onSessionStarted(startedWithAuto); - expect(yield* supportedModes).toEqual([ - "approval-required", - "auto-accept-edits", - "auto", - "full-access", - ]); + expect(yield* supportedModes).toEqual(withAuto); yield* harness.provider.onSessionStarted(started); expect(yield* supportedModes).toEqual(withoutAuto); yield* harness.provider.onSessionStarted(startedWithAuto); yield* harness.provider.onSignedOut; - expect(yield* supportedModes).toEqual(withoutAuto); - const withAuto: ReadonlyArray = [ - "approval-required", - "auto-accept-edits", - "auto", - "full-access", - ]; + expect(yield* supportedModes).toEqual(withAuto); expect(yield* Ref.get(harness.savedRuntimeModes)).toEqual([ - withAuto, withoutAuto, withAuto, withoutAuto, + withAuto, ]); // A restart offers what the last session advertised before any session starts. diff --git a/apps/server/src/provider/AntigravityProvider.ts b/apps/server/src/provider/AntigravityProvider.ts index f5e18f6bece9d..541d29f898a8e 100644 --- a/apps/server/src/provider/AntigravityProvider.ts +++ b/apps/server/src/provider/AntigravityProvider.ts @@ -182,8 +182,16 @@ const RUNTIME_MODES_WITHOUT_AUTO = [ "auto-accept-edits", "full-access", ] as const; +// Before a session reports agy's Auto, Auto is offered: Full access could exceed a native Auto, and a +// session without it asks about each request under an Auto policy. +const RUNTIME_MODES_UNKNOWN = [ + "approval-required", + "auto-accept-edits", + "auto", + "full-access", +] as const; -/** Auto is offered only where the session advertises agy's own Auto; elsewhere it runs Supervised. */ +/** Auto is offered only where the session advertises agy's own Auto; elsewhere it runs Full access. */ function antigravityRuntimeModes( sessionSetupResult: AcpSessionRuntime.AcpSessionRuntimeStartResult["sessionSetupResult"], ): ReadonlyArray { @@ -212,7 +220,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func presentation: { displayName: "Antigravity", showInteractionModeToggle: false, - supportedRuntimeModes: options.rememberedRuntimeModes ?? RUNTIME_MODES_WITHOUT_AUTO, + supportedRuntimeModes: options.rememberedRuntimeModes ?? RUNTIME_MODES_UNKNOWN, }, enabled: settings.enabled, checkedAt, @@ -526,13 +534,13 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func slashCommands: [], skills: [], workspaceSnapshots: [], - supportedRuntimeModes: RUNTIME_MODES_WITHOUT_AUTO, + supportedRuntimeModes: RUNTIME_MODES_UNKNOWN, supportsTextGeneration: false, usageLimits: undefined, }, } satisfies AntigravityProviderState, ]); - yield* rememberRuntimeModes(previousModes, RUNTIME_MODES_WITHOUT_AUTO); + yield* rememberRuntimeModes(previousModes, RUNTIME_MODES_UNKNOWN); discoveredSkills.clear(); thinkingLevels.clear(); }); diff --git a/apps/web/src/components/ComposerContextPermissions.tsx b/apps/web/src/components/ComposerContextPermissions.tsx index deaa59662f1d7..15612aacf5acf 100644 --- a/apps/web/src/components/ComposerContextPermissions.tsx +++ b/apps/web/src/components/ComposerContextPermissions.tsx @@ -29,11 +29,13 @@ export function ComposerContextPermissions(props: { useAtomValue(primaryServerKeybindingsAtom), "composer.mode", ); + const managedPolicy = useManagedPolicy(props.environmentId); const { mode, modes } = resolveCompatibleRuntimeMode( props.runtimeMode, props.supportedRuntimeModes, + managedPolicy, ); - const options = resolveRuntimeModeOptions(modes, useManagedPolicy(props.environmentId), messages); + const options = resolveRuntimeModeOptions(modes, managedPolicy, messages); const composerMenuProps = useComposerMenuProps(); const { icon: Icon } = runtimeModeConfig[mode]; const label = messages(runtimeModeConfig[mode].label); diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index 5b540f48c483e..799e2819ef00e 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -1001,6 +1001,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) resolveCompatibleRuntimeMode( runtimeMode, selectedProviderEntry?.snapshot.supportedRuntimeModes, + managedPolicy, ); // Modes above an administrator's ceiling stay listed, disabled with the reason. const compatibleRuntimeModeOptions = resolveRuntimeModeOptions( @@ -1009,11 +1010,12 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) m, ); // A thread or draft already above the ceiling would be refused; offer the broadest mode left. - const runtimeModeCeilingDenial = runtimeModeDenial(managedPolicy, compatibleRuntimeMode, m); + // The server checks the stored mode, not the one a provider without it runs. + const runtimeModeCeilingDenial = runtimeModeDenial(managedPolicy, runtimeMode, m); const runtimeModeCeilingFallback = runtimeModeCeilingDenial === undefined ? undefined - : clampManagedRuntimeMode(managedPolicy, compatibleRuntimeMode, compatibleRuntimeModes); + : clampManagedRuntimeMode(managedPolicy, runtimeMode, compatibleRuntimeModes); const providerSendBlockReason = getAntigravitySendBlockReason( selectedProviderEntry?.snapshot, diff --git a/apps/web/src/components/chat/runtimeModeConfig.ts b/apps/web/src/components/chat/runtimeModeConfig.ts index b4f77f2ca5d62..a5bd63a498e6b 100644 --- a/apps/web/src/components/chat/runtimeModeConfig.ts +++ b/apps/web/src/components/chat/runtimeModeConfig.ts @@ -1,5 +1,9 @@ import { managedRuntimeModeDenial } from "@t3tools/client-runtime/contract-labels"; -import type { ManagedPolicySummary, RuntimeMode } from "@t3tools/contracts"; +import { + type ManagedPolicySummary, + providerRuntimeMode, + type RuntimeMode, +} from "@t3tools/contracts"; import { msg } from "gt-react"; import { m, type MessageResolver } from "~/i18n/messages"; import { @@ -26,7 +30,9 @@ export const runtimeModeConfig: Record< }, auto: { label: msg("Auto", { $context: "permission mode, provider approves routine actions" }), - description: msg("Supported providers approve routine actions; others still ask."), + description: msg( + "Supported providers approve routine actions; providers without Auto get Full access.", + ), icon: ShieldCheckIcon, }, "full-access": { @@ -43,12 +49,16 @@ export const runtimeModeOptions = Object.keys(runtimeModeConfig) as RuntimeMode[ export function resolveCompatibleRuntimeMode( runtimeMode: RuntimeMode, supportedRuntimeModes: ReadonlyArray | undefined, + managedPolicy: ManagedPolicySummary | undefined, ) { const modes = supportedRuntimeModes && supportedRuntimeModes.length > 0 ? runtimeModeOptions.filter((mode) => supportedRuntimeModes.includes(mode)) : runtimeModeOptions; - return { modes, mode: modes.includes(runtimeMode) ? runtimeMode : (modes[0] ?? runtimeMode) }; + return { + modes, + mode: providerRuntimeMode(runtimeMode, modes, managedPolicy?.limits?.maxRuntimeMode), + }; } export function resolveRuntimeModeOption( diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 8d5cb7d817bb1..f0dd5c2d49a16 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -4754,7 +4754,7 @@ "cceea5cef0684b31": "Änderungen automatisch annehmen", "3fe210c30bf00152": "Änderungen automatisch genehmigen, vor anderen Aktionen nachfragen.", "468986e98d947cb7": "Auto", - "451204c240ead696": "Unterstützte Anbieter genehmigen Routineaktionen; andere fragen weiterhin nach.", + "d9efd017a6b1f019": "Unterstützte Anbieter genehmigen Routineaktionen; Anbieter ohne Auto erhalten Vollzugriff.", "1eed3d794eed6b65": "Vollzugriff", "7f284f51644bb125": "Befehle und Änderungen ohne Nachfrage erlauben.", "4f402027a24d31c4": "{organization} beschränkt Threads auf {mode}.", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 6c5ef49b77f43..2c354601c7eb3 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -4753,7 +4753,7 @@ "cceea5cef0684b31": "Auto-accept edits", "3fe210c30bf00152": "Auto-approve edits, ask before other actions.", "468986e98d947cb7": "Auto", - "451204c240ead696": "Supported providers approve routine actions; others still ask.", + "d9efd017a6b1f019": "Supported providers approve routine actions; providers without Auto get Full access.", "1eed3d794eed6b65": "Full access", "7f284f51644bb125": "Allow commands and edits without prompts.", "4f402027a24d31c4": "{organization} limits threads to {mode}.", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 1f4ed2cf548ee..fc629ed07f1cf 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -4751,7 +4751,7 @@ "cceea5cef0684b31": "Aceptar ediciones automáticamente", "3fe210c30bf00152": "Aprueba las ediciones automáticamente y pregunta antes de otras acciones.", "468986e98d947cb7": "Automático", - "451204c240ead696": "Los proveedores compatibles aprueban las acciones rutinarias; los demás siguen preguntando.", + "d9efd017a6b1f019": "Los proveedores compatibles aprueban las acciones rutinarias; los que no tienen Automático obtienen Acceso completo.", "1eed3d794eed6b65": "Acceso completo", "7f284f51644bb125": "Permite comandos y ediciones sin preguntar.", "4f402027a24d31c4": "{organization} limita los hilos a {mode}.", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 72da8bf8e23b2..66de5c32fc618 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -4752,7 +4752,7 @@ "cceea5cef0684b31": "Accepter les modifications automatiquement", "3fe210c30bf00152": "Approuver automatiquement les modifications, demander avant les autres actions.", "468986e98d947cb7": "Auto", - "451204c240ead696": "Les fournisseurs compatibles approuvent les actions courantes ; les autres demandent toujours.", + "d9efd017a6b1f019": "Les fournisseurs compatibles approuvent les actions courantes ; ceux sans Auto obtiennent un Accès complet.", "1eed3d794eed6b65": "Accès complet", "7f284f51644bb125": "Autoriser les commandes et les modifications sans demander.", "4f402027a24d31c4": "{organization} limite les fils au mode {mode}.", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 28945ae29dca3..3911d8772056c 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -4741,7 +4741,7 @@ "cceea5cef0684b31": "編集を自動承認", "3fe210c30bf00152": "編集は自動承認し、その他の操作の前に確認します。", "468986e98d947cb7": "自動", - "451204c240ead696": "対応しているプロバイダーは日常的な操作を承認し、それ以外は確認します。", + "d9efd017a6b1f019": "対応しているプロバイダーは日常的な操作を承認し、自動に対応していないプロバイダーはフルアクセスになります。", "1eed3d794eed6b65": "フルアクセス", "7f284f51644bb125": "確認なしでコマンドと編集を許可します。", "4f402027a24d31c4": "{organization} により、スレッドは「{mode}」に制限されています。", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 35f6cc3549436..c69f57df068aa 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -4738,7 +4738,7 @@ "cceea5cef0684b31": "편집 자동 수락", "3fe210c30bf00152": "편집은 자동 승인하고 다른 작업 전에는 확인합니다.", "468986e98d947cb7": "자동", - "451204c240ead696": "지원되는 제공자는 일상적인 작업을 승인하고, 나머지는 계속 확인합니다.", + "d9efd017a6b1f019": "지원되는 제공자는 일상적인 작업을 승인하고, 자동을 지원하지 않는 제공자는 전체 액세스로 실행됩니다.", "1eed3d794eed6b65": "전체 액세스", "7f284f51644bb125": "확인 없이 명령과 편집을 허용합니다.", "4f402027a24d31c4": "{organization}에서 스레드를 {mode} 모드로 제한합니다.", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 85fefb672d30c..fe14382d4d4dd 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -4751,7 +4751,7 @@ "cceea5cef0684b31": "Aceitar edições automaticamente", "3fe210c30bf00152": "Aprova edições automaticamente e pergunta antes de outras ações.", "468986e98d947cb7": "Auto", - "451204c240ead696": "Os provedores compatíveis aprovam ações rotineiras; os outros continuam perguntando.", + "d9efd017a6b1f019": "Os provedores compatíveis aprovam ações rotineiras; os que não têm Auto recebem Acesso total.", "1eed3d794eed6b65": "Acesso total", "7f284f51644bb125": "Permite comandos e edições sem perguntar.", "4f402027a24d31c4": "{organization} limita as threads a {mode}.", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index f4d45a79d0b52..229d3b3a5599b 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -4751,7 +4751,7 @@ "cceea5cef0684b31": "Автопринятие правок", "3fe210c30bf00152": "Автоматически подтверждать правки, спрашивать перед другими действиями.", "468986e98d947cb7": "Авто", - "451204c240ead696": "Поддерживаемые провайдеры подтверждают рутинные действия; остальные всё равно спрашивают.", + "d9efd017a6b1f019": "Поддерживаемые провайдеры подтверждают рутинные действия; провайдеры без режима «Авто» получают полный доступ.", "1eed3d794eed6b65": "Полный доступ", "7f284f51644bb125": "Разрешать команды и правки без запросов.", "4f402027a24d31c4": "{organization} ограничивает треды режимом «{mode}».", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 99818c1f2ed37..520ef7fd9f944 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -4752,7 +4752,7 @@ "cceea5cef0684b31": "Godkänn ändringar automatiskt", "3fe210c30bf00152": "Godkänn ändringar automatiskt, fråga före andra åtgärder.", "468986e98d947cb7": "Auto", - "451204c240ead696": "Leverantörer som stöder det godkänner rutinåtgärder; andra frågar fortfarande.", + "d9efd017a6b1f019": "Leverantörer som stöder det godkänner rutinåtgärder; leverantörer utan Auto får full åtkomst.", "1eed3d794eed6b65": "Full åtkomst", "7f284f51644bb125": "Tillåt kommandon och ändringar utan att fråga.", "4f402027a24d31c4": "{organization} begränsar trådar till {mode}.", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 09d04201cd2f8..312c025ad4b26 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -4758,7 +4758,7 @@ "cceea5cef0684b31": "自动接受编辑", "3fe210c30bf00152": "自动批准编辑,其他操作前询问。", "468986e98d947cb7": "自动", - "451204c240ead696": "支持此模式的提供方会自动批准常规操作,其他提供方仍会询问。", + "d9efd017a6b1f019": "支持此模式的提供方会自动批准常规操作,不支持自动模式的提供方将获得完全访问。", "1eed3d794eed6b65": "完全访问", "7f284f51644bb125": "允许执行命令和编辑,无需确认。", "4f402027a24d31c4": "{organization} 将会话权限限制为 {mode}。", diff --git a/docs/internals/adding-a-provider.md b/docs/internals/adding-a-provider.md index 14ac6db1eb68c..735304478e793 100644 --- a/docs/internals/adding-a-provider.md +++ b/docs/internals/adding-a-provider.md @@ -29,8 +29,9 @@ capabilities, never the driver kind. `supportedRuntimeModes` in the provider presentation ([Grok](../../packages/provider-grok/src/server/status.ts) and [Pi](../../packages/provider-pi/src/server/status.ts) are examples). Do not imitate a missing mode by answering approvals in T3: T3's check is weaker than the agent's own enforcement. The - server runs an unoffered stored mode as Supervised - ([`RuntimePolicy.ts`](../../apps/server/src/orchestration-v2/RuntimePolicy.ts)). + server runs an unoffered stored mode as Supervised, except Auto, which runs as the broadest + offered mode under the managed ceiling + ([`providerRuntimeMode`](../../packages/contracts/src/providerPolicy.ts)). - **Approval and question options.** Pass the provider's own option IDs through unchanged. Every request needs a way to decline that the provider honors. - **Interaction modes.** Hide the plan toggle (`showInteractionModeToggle: false`) unless the diff --git a/docs/orchestration-v2/orchestrator-mcp-server.md b/docs/orchestration-v2/orchestrator-mcp-server.md index 71d8845e74c75..b9769a31ec920 100644 --- a/docs/orchestration-v2/orchestrator-mcp-server.md +++ b/docs/orchestration-v2/orchestrator-mcp-server.md @@ -260,12 +260,15 @@ edits are not copied. A linked-environment target (`target.environmentId`) runs project's checkout and rejects worktree isolation. To launch an isolated thread there, use `t3_thread_launch` with `environmentId` and a worktree `workspaceStrategy`. -A provider runs a runtime mode it does not offer as `approval-required`, so a -child would ask for approval on every command. `orchestrator_capabilities` -lists `runtimeModes` only for a provider that offers some of the modes, and -omits it for a provider that offers all of them. When the target lists -`runtimeModes`, an explicit `runtimeMode` outside that list is refused, and an -inherited mode steps down to the broadest mode the target offers. +A provider runs `auto` it does not offer in its broadest mode the managed +ceiling allows, usually `full-access`, and any other mode it does not offer as +`approval-required`, so a child would ask for approval on every command. +`orchestrator_capabilities` lists `runtimeModes` only for a provider that offers +some of the modes, and omits it for a provider that offers all of them. When the +target lists `runtimeModes`, `auto` is always kept, an explicit `runtimeMode` +outside that list is refused, and an inherited mode steps down to the broadest +mode the target offers. The child's stored mode stays its delegated authority, +so an `auto` child cannot delegate or act above `auto`. Each independent delegated review round uses a new `delegate_task` call with the original brief, prior findings, responses, and unresolved objections. Track each @@ -352,11 +355,11 @@ this binding. Pass the task in `message`. Project, model, and modes inherit when omitted; workspace does not. `scratch: true` launches without a project, in a folder of its own under the environment's Scratch project. A new worktree with `startFromOrigin` omitted follows the new-worktree setting. For stacked PRs, use the parent branch as `baseRef` with -`startFromOrigin: false`. The new thread may not run with broader runtime or -interaction modes than the caller. As for `delegate_task`, a runtime mode the -provider does not offer is refused, and an inherited or default one steps down -to the broadest mode it offers. `create_threads` remains the batch option for a -shared checkout. +`startFromOrigin: false`. The new thread's stored runtime and interaction modes +may not be broader than the caller's. As for `delegate_task`, `auto` is always +kept, any other runtime mode the provider does not offer is refused, and an +inherited or default one steps down to the broadest mode it offers. +`create_threads` remains the batch option for a shared checkout. Set `clientRequestId` on the initial launch to make it retryable. After an error or a lost reply, resend the same request with the same key from the same diff --git a/docs/user/permission-modes.md b/docs/user/permission-modes.md index a8f1cf8391221..aaa567d2aa472 100644 --- a/docs/user/permission-modes.md +++ b/docs/user/permission-modes.md @@ -29,14 +29,16 @@ the parent conversation with the subagent's name, so you can respond without swi Providers enforce permissions differently. Some read-only actions can proceed in **Supervised**. **Auto** uses automatic review on Codex, Claude, Cursor, Grok, Antigravity, and fx; providers without an equivalent, including OpenCode, fall back to asking. On Grok and Antigravity, actions their review -does not approve come to you for approval. On fx, prompts it still sends also come to you. +does not approve come to you for approval. On fx, prompts it still sends also come to you. A +thread set to **Auto** on a provider that does not offer it runs in **Full access**, or the broadest +mode your organization allows. Antigravity offers **Auto** only when your Antigravity sign-in provides its Auto mode; some accounts, including some personal Google accounts, do not. Without it, an Antigravity thread already set to -**Auto** runs in **Supervised**. +**Auto** runs in **Full access**. -Muse Code offers only **Supervised** and **Full access**. A Muse thread already set to another mode -runs in **Supervised**. +Muse Code offers only **Supervised** and **Full access**. A Muse thread already set to +**Auto-accept edits** runs in **Supervised**. T3 Code offers no **Auto-accept edits** for fx, and **Full access** only with fx 0.0.14 or later. An fx thread set to a mode its fx lacks runs in **Supervised**. diff --git a/docs/user/providers-pi.md b/docs/user/providers-pi.md index b434250e9a12d..8ff346d0848a1 100644 --- a/docs/user/providers-pi.md +++ b/docs/user/providers-pi.md @@ -65,7 +65,8 @@ T3 Code applies the composer permission mode through Pi's blocking tool hook: - **Full access** allows tools without T3 Code approval prompts. The **Auto** option is not shown for Pi because Pi does not expose an AI approval reviewer. -Threads that already stored Auto before Pi support was added behave and display as Supervised. +Threads that already stored Auto run and display as Full access, or as **Auto-accept edits** under +an organization limit of Auto. Changing the mode restarts the Pi provider session and resumes the same native conversation. The policy covers Pi tool calls; it is not an operating-system sandbox, and code that a trusted Pi diff --git a/packages/contracts/src/providerPolicy.ts b/packages/contracts/src/providerPolicy.ts index 1b94f43aabd5c..0551e3b43c8db 100644 --- a/packages/contracts/src/providerPolicy.ts +++ b/packages/contracts/src/providerPolicy.ts @@ -42,6 +42,30 @@ const RUNTIME_MODE_RANK: Record = { export const isRuntimeModeAbove = (mode: RuntimeMode, ceiling: RuntimeMode | undefined): boolean => ceiling !== undefined && RUNTIME_MODE_RANK[mode] > RUNTIME_MODE_RANK[ceiling]; +/** + * The mode a provider really runs `mode` in. Auto means "run without asking", so a provider without + * it runs its broadest mode under `ceiling`; any other mode it lacks runs Supervised. + */ +export const providerRuntimeMode = ( + mode: RuntimeMode, + supportedModes: ReadonlyArray | undefined, + ceiling?: RuntimeMode, +): RuntimeMode => { + if ( + supportedModes === undefined || + supportedModes.length === 0 || + supportedModes.includes(mode) + ) { + return mode; + } + if (mode !== "auto") return "approval-required"; + return ( + (["full-access", "auto-accept-edits"] as const).find( + (fallback) => supportedModes.includes(fallback) && !isRuntimeModeAbove(fallback, ceiling), + ) ?? "approval-required" + ); +}; + export const ProviderInteractionMode = Schema.Literals(["default", "plan"]); export type ProviderInteractionMode = typeof ProviderInteractionMode.Type; export const DEFAULT_PROVIDER_INTERACTION_MODE: ProviderInteractionMode = "default";