Add OpenCode auto accept feature

This commit is contained in:
Mohamed Boudra
2026-05-26 21:51:04 +07:00
parent 0ab41fbd9a
commit 6d205f8853
11 changed files with 265 additions and 65 deletions
@@ -19,7 +19,7 @@ import {
} from "react-native";
import { StyleSheet, useUnistyles } from "react-native-unistyles";
import { useShallow } from "zustand/shallow";
import { Brain, ChevronDown, ListTodo, Settings2, Zap } from "lucide-react-native";
import { Brain, ChevronDown, ListTodo, Settings2, ShieldCheck, Zap } from "lucide-react-native";
import { getProviderIcon } from "@/components/provider-icons";
import { CombinedModelSelector } from "@/components/combined-model-selector";
import {
@@ -139,6 +139,7 @@ function findOptionLabel(
const FEATURE_ICONS: Record<string, typeof Zap> = {
"list-todo": ListTodo,
"shield-check": ShieldCheck,
zap: Zap,
};
@@ -151,6 +152,7 @@ function getFeatureIconColor(
enabled: boolean,
palette: {
blue: { 400: string };
green: { 400: string };
yellow: { 400: string };
},
foregroundMuted: string,
@@ -162,6 +164,8 @@ function getFeatureIconColor(
switch (getFeatureHighlightColor(featureId)) {
case "blue":
return palette.blue[400];
case "green":
return palette.green[400];
case "yellow":
return palette.yellow[400];
default:
@@ -4,6 +4,7 @@ import { StyleSheet, useUnistyles } from "react-native-unistyles";
import { useShallow } from "zustand/shallow";
import { useStoreWithEqualityFn } from "zustand/traditional";
import {
Bot,
ChevronDown,
ShieldAlert,
ShieldCheck,
@@ -33,6 +34,7 @@ function shouldRenderForPlacement(placement: AgentModeControlPlacement, isCompac
}
const MODE_ICONS = {
Bot,
ShieldCheck,
ShieldAlert,
ShieldOff,
@@ -1,7 +1,7 @@
import type { AgentFeature, AgentModelDefinition } from "@server/server/agent/agent-sdk-types";
export type ExplainedAgentControl = "mode" | "model" | "thinking";
export type FeatureHighlightColor = "blue" | "default" | "yellow";
export type FeatureHighlightColor = "blue" | "default" | "green" | "yellow";
export function getAgentControlHint(selector: ExplainedAgentControl): string {
switch (selector) {
@@ -32,6 +32,8 @@ export function getFeatureHighlightColor(featureId: string): FeatureHighlightCol
switch (featureId) {
case "fast_mode":
return "yellow";
case "auto_accept":
return "green";
case "plan_mode":
return "blue";
default: