Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat: pick the agent's own mode under Permissions, Auto by default
leepokai813410866167
diff --git a/apps/android/WhatsNew.md b/apps/android/WhatsNew.mdindex 9506a148..97db6816 100644--- a/apps/android/WhatsNew.md+++ b/apps/android/WhatsNew.md@@ -18,12 +18,14 @@ else a generic "Bug fixes and improvements" line. Delete old sections.- 長按 App 圖示選「Talk to Codync」直接和 lead bot 通話;從其他 App 分享文字可送到 bot 的訊息框。- 掃描配對 QR code 更容易對焦。- 自訂圖示現在只用在 bot 上;只用 Cursor CLI 登入時也能看到 Cursor 用量。+- 「權限」列出代理程式自己的模式;新 bot 預設 Auto,安全的直接做,其餘才問你。### en-US-- Pair several computers, each with a heading and filter in Bots.+- Pair several computers, each with a heading in Bots.- Bot details gain a Memory page; keep or edit a new chat's handoff.- Dictate on device or with your own OpenAI or Gemini key.-- Calls show as Android calls; new Claude Code and Codex usage widgets.-- Talk to Codync, an icon shortcut, calls your lead; share text to a bot.-- Rate on Google Play, Report an issue, update notes; easier QR focus.+- Android-style calls; Claude Code and Codex usage widgets.+- Talk to Codync (icon shortcut) calls your lead; share text to bots.+- Rate the app, report issues, update notes; easier QR focus.- Custom icons are for bots only; Cursor usage shows with a CLI sign-in.+- New bots start in your agent's Auto mode.diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ApprovalRow.kt b/apps/android/app/src/main/kotlin/com/codync/android/ApprovalRow.ktnew file mode 100644index 00000000..6ffbe2a8--- /dev/null+++ b/apps/android/app/src/main/kotlin/com/codync/android/ApprovalRow.kt@@ -0,0 +1,37 @@+package com.codync.android++import android.util.Log+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import com.codync.android.core.AgentModels+import com.codync.android.core.ApprovalChoice+import com.codync.android.core.BotDraft+import com.codync.android.core.LinkState+import com.codync.android.core.withApproval+import com.codync.android.design.ChoicePicker+import com.codync.android.design.ValueRow+import com.codync.android.design.tr+import kotlinx.coroutines.CancellationException++/** Permissions: the modes the bot's agent offers (its model list), its Auto mode first, then approving everything. */+@Composable internal fun ApprovalRow(state: AppState, load: suspend (String) -> AgentModels, draft: BotDraft, change: (BotDraft) -> Unit) {+ val online = state.actualConnection is LinkState.Ready+ var catalog by remember(draft.backend) { mutableStateOf<AgentModels?>(null) }+ // The host shares one model list asked for from several places at once (the model picker, here).+ LaunchedEffect(state.computer.id, draft.backend, online) {+ if (draft.backend == "custom" || !online) return@LaunchedEffect+ try { catalog = load(draft.backend) }+ catch (cancelled: CancellationException) { throw cancelled }+ // The model picker says why; Auto, Ask me and Approve automatically stay on offer meanwhile.+ catch (error: Exception) { Log.i("Codync", "no agent modes for ${draft.backend}: ${error.message}") }+ }+ val choices = ApprovalChoice.all(catalog)+ val selected = ApprovalChoice.selected(draft, choices, catalog)+ ValueRow("Permissions", detail = selected?.let { listOfNotNull(it.note, tr(it.detail)).joinToString(" ") }) {+ ChoicePicker(selected?.id.orEmpty(), choices.map { it.id to it.label }, { change(draft.withApproval(it)) }, label = "Permissions")+ }+}diff --git a/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt b/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.ktindex f3be51e0..9936cba1 100644--- a/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt+++ b/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt@@ -56,7 +56,7 @@ internal enum class FormPart { All, Often, Rarely }}CardSection("Agent") {fallbackBanner(state, store, bot); computerRow(state, online)- agentRows(state, store, draft, change, bot) { addingFallback = true }; placeRows(draft, change) { folders = true }+ agentRows(state, store, draft, change, bot) { addingFallback = true }; placeRows(state, store, draft, change) { folders = true }}CardSection("Activity") {notifyRow(draft, change); computerUseRow(state, draft, change); manageTeamRow(state, draft, change); reachRows(state, draft, change)@@ -77,7 +77,7 @@ internal enum class FormPart { All, Often, Rarely }nameRow(draft, change); createdByRow(state, bot)}// The agent and its model are on the Details page; what's left is where it works.- CardSection("Workspace") { computerRow(state, online); placeRows(draft, change) { folders = true } }+ CardSection("Workspace") { computerRow(state, online); placeRows(state, store, draft, change) { folders = true } }CardSection("Activity") { notifyRow(draft, change); manageTeamRow(state, draft, change); reachRows(state, draft, change) }Plugins(state, draft, change) { viewingSkill = it }}@@ -171,7 +171,7 @@ private fun CardRows.agentRows(state: AppState, store: AppStore, draft: BotDraft}/** Where the bot works and what it may do there without asking. */-private fun CardRows.placeRows(draft: BotDraft, change: (BotDraft) -> Unit, chooseFolder: () -> Unit) {+private fun CardRows.placeRows(state: AppState, store: AppStore, draft: BotDraft, change: (BotDraft) -> Unit, chooseFolder: () -> Unit) {row {ValueRow("Workspace", detail = if (draft.cwd.isEmpty()) "This bot has its own space for files. It can work in other folders when you ask."else "This project is the default starting folder. The bot can work elsewhere when you ask.") {@@ -188,14 +188,7 @@ private fun CardRows.placeRows(draft: BotDraft, change: (BotDraft) -> Unit, choo}}}- row {- ValueRow("Permissions", detail = if (draft.permission == "auto")- "Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply."- else "You'll get an approval card and a notification whenever the agent asks.") {- ChoicePicker(draft.permission, listOf("ask" to "Ask me", "auto" to "Approve automatically"), { change(draft.copy(permission = it)) },- label = "Permissions")- }- }+ row { ApprovalRow(state, store::agentModels, draft, change) }}private fun CardRows.notifyRow(draft: BotDraft, change: (BotDraft) -> Unit) =diff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.ktindex 614b96e3..3818abfb 100644--- a/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.kt+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.kt@@ -8,8 +8,10 @@ import kotlinx.serialization.Serializable}@Serializable data class ModelOptionValue(val id: String, val name: String)@Serializable data class AgentModel(val id: String, val name: String, val description: String? = null, val options: List<ModelOption>? = null, val optionsError: String? = null)-/** `fastMode`: the agent offers Fast mode (absent on older hosts). */-@Serializable data class AgentModels(val models: List<AgentModel>, val currentModelId: String? = null, val fastMode: Boolean? = null, val defaultModelOptions: Boolean? = null) {+/** `fastMode`: the agent offers Fast mode (absent on older hosts). `modes`: its modes, Auto first and listed as `auto`+ * (absent on older hosts); `currentModeId`: the one its sessions start in. */+@Serializable data class AgentModels(val models: List<AgentModel>, val currentModelId: String? = null, val fastMode: Boolean? = null, val defaultModelOptions: Boolean? = null,+ val modes: List<AgentMode>? = null, val currentModeId: String? = null) {val agentDefault: AgentModel? get() = models.firstOrNull { it.name.lowercase().startsWith("default") }fun options(selected: String?): List<ModelChoice> {val default = agentDefaultdiff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/Approvals.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/Approvals.ktnew file mode 100644index 00000000..ca78fd7a--- /dev/null+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/Approvals.kt@@ -0,0 +1,48 @@+package com.codync.android.core++import kotlinx.serialization.Serializable++/** One of the modes an agent works in (Claude's Manual / Plan / Auto, Codex's Read-only / Auto review…). */+@Serializable data class AgentMode(val id: String, val name: String, val description: String? = null) {+ companion object {+ /** Codync's id for the agent's Auto mode, whatever the agent calls it: new bots start there. */+ const val AUTO = "auto"+ }+}++/** A bot's Approvals choice: [note] is the agent's own words, untranslated; [detail] is Codync's, to translate. */+data class ApprovalChoice(val id: String, val label: String, val note: String?, val detail: String) {+ companion object {+ const val ASK = "ask"+ const val APPROVE = "approve"+ private fun modeId(mode: String) = "mode:$mode"++ /**+ * The agent's modes, its Auto mode first, then Codync approving everything. An agent without modes offers Ask me+ * instead; while its list loads (or from an older host), Auto and Ask me.+ */+ fun all(catalog: AgentModels?): List<ApprovalChoice> {+ val ask = ApprovalChoice(ASK, "Ask me", null, "You'll get an approval card and a notification whenever the agent asks.")+ val approve = ApprovalChoice(APPROVE, "Approve automatically", null,+ "Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply.")+ val modes = catalog?.modes+ ?: return listOf(ApprovalChoice(modeId(AgentMode.AUTO), "Auto", null, "The agent decides what's safe and asks you about the rest."), ask, approve)+ if (modes.isEmpty()) return listOf(ask, approve)+ return modes.map { ApprovalChoice(modeId(it.id), it.name, it.description, "Anything the agent still asks about comes to you as an approval card.") } + approve+ }++ /** The choice a bot's setting shows as: an unset mode is the one the agent starts in. */+ fun selected(draft: BotDraft, choices: List<ApprovalChoice>, catalog: AgentModels?): ApprovalChoice? {+ if (draft.permission == "auto") return choices.firstOrNull { it.id == APPROVE }+ val mode = draft.mode ?: catalog?.currentModeId+ return mode?.let { m -> choices.firstOrNull { it.id == modeId(m) } } ?: choices.firstOrNull { it.id == ASK } ?: choices.firstOrNull()+ }+ }+}++/** The draft with an Approvals choice picked. */+fun BotDraft.withApproval(id: String): BotDraft = when (id) {+ ApprovalChoice.APPROVE -> copy(permission = "auto", mode = null)+ ApprovalChoice.ASK -> copy(permission = "ask", mode = null)+ else -> copy(permission = "ask", mode = id.removePrefix("mode:"))+}diff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/BotDraft.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/BotDraft.ktindex 47b8b791..c0c82664 100644--- a/apps/android/core/src/main/kotlin/com/codync/android/core/BotDraft.kt+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/BotDraft.kt@@ -18,7 +18,8 @@ data class BotDraft(val backend: String = "claude",val command: String? = null,val cwd: String = "",- val permission: String = "auto",+ /** `ask` or `auto`: whether Codync asks about what the agent asks, or approves it. */+ val permission: String = "ask",val model: String? = null,val modelOptions: Map<String, String> = emptyMap(),val fastMode: Boolean? = null,@@ -36,12 +37,16 @@ data class BotDraft(/** Null where the host has none, or on a new bot, so it isn't sent. */val offeredToNetwork: Boolean? = null,val reachableByAssistants: Boolean? = null,+ /** The agent mode it works in ([AgentMode]); null, sent as null, keeps the agent's default. */+ val mode: String? = AgentMode.AUTO,) {/** A saved bot keeps a name; only a new one goes without (the host names it after its first conversations). */val isValid: Boolean get() = name.isNotBlank()fun toggleNotifications(): BotDraft = copy(notify = !(notify ?: true))/** On agent [id]: its model starts over, and it leaves the fallbacks (each agent appears once in the chain). */- fun withAgent(id: String): BotDraft = copy(backend = id, model = null, modelOptions = emptyMap(), fallbacks = fallbacks?.filter { it.backend != id })+ fun withAgent(id: String): BotDraft = copy(backend = id, model = null, modelOptions = emptyMap(), fallbacks = fallbacks?.filter { it.backend != id },+ // A picked mode becomes the new agent's Auto mode (or, without one, asking).+ mode = mode?.let { AgentMode.AUTO })fun body(): JsonObject {val normalized = if (backend == "custom") this else copy(command = null)// updateBot merges a patch: null clears model, command or the connector choice, but an unset@@ -75,6 +80,6 @@ data class BotDraft(fun from(bot: Bot): BotDraft = BotDraft(bot.id, bot.name, bot.description, bot.avatarColor, bot.avatarShape,bot.backend, bot.command, if (bot.managedWorkspace) "" else bot.cwd, bot.permission, bot.model,bot.modelOptions, bot.fastMode, bot.pinned, bot.hidden, bot.notify, bot.connectors, bot.skills, bot.computer, bot.manageTeam ?: false, bot.fallbacks, bot.selfFallbacks,- bot.offeredToNetwork, bot.reachableByAssistants)+ bot.offeredToNetwork, bot.reachableByAssistants, bot.mode)}}diff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/HostClient.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/HostClient.ktindex 10be89cc..0406744e 100644--- a/apps/android/core/src/main/kotlin/com/codync/android/core/HostClient.kt+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/HostClient.kt@@ -21,6 +21,8 @@ data class Bot(val cwd: String = "",val managedWorkspace: Boolean = false,val permission: String = "ask",+ /** The agent mode it works in ([AgentMode]); null for the agent's default. */+ val mode: String? = null,val model: String? = null,/** The model's own settings (effort, fast…): agent option id → value. */val modelOptions: Map<String, String> = emptyMap(),diff --git a/apps/android/core/src/test/kotlin/com/codync/android/core/ApprovalsTest.kt b/apps/android/core/src/test/kotlin/com/codync/android/core/ApprovalsTest.ktnew file mode 100644index 00000000..748905fa--- /dev/null+++ b/apps/android/core/src/test/kotlin/com/codync/android/core/ApprovalsTest.kt@@ -0,0 +1,45 @@+package com.codync.android.core++import kotlinx.serialization.json.JsonNull+import kotlinx.serialization.json.jsonPrimitive+import org.junit.Assert.assertEquals+import org.junit.Test++class ApprovalsTest {+ private val codex = AgentModels(emptyList(), modes = listOf(+ AgentMode("auto", "Auto review", "Only ask for actions detected as potentially unsafe"), AgentMode("read-only", "Read-only")),+ currentModeId = "auto")++ @Test fun newBotsStartInTheAgentsAutoModeAndAsk() {+ val draft = BotDraft(name = "New")+ assertEquals("ask" to "auto", draft.permission to draft.mode)+ assertEquals("auto", draft.body().getValue("mode").jsonPrimitive.content)+ }++ @Test fun approvalsListTheAgentsModesThenApproveAutomatically() {+ val choices = ApprovalChoice.all(codex)+ assertEquals(listOf("Auto review", "Read-only", "Approve automatically"), choices.map { it.label })+ assertEquals("Only ask for actions detected as potentially unsafe", choices.first().note)+ var draft = BotDraft(name = "Bot", backend = "codex")+ assertEquals("Auto review", ApprovalChoice.selected(draft, choices, codex)?.label)+ assertEquals("Auto review", ApprovalChoice.selected(draft.copy(mode = null), choices, codex)?.label)+ draft = draft.withApproval(choices[1].id)+ assertEquals("ask" to "read-only", draft.permission to draft.mode)+ draft = draft.withApproval(ApprovalChoice.APPROVE)+ assertEquals("auto" to null, draft.permission to draft.mode)+ // Approve automatically clears the mode on the host too.+ assertEquals(JsonNull, draft.copy(id = "b").body()["mode"])+ assertEquals("Approve automatically", ApprovalChoice.selected(draft, choices, codex)?.label)+ }++ @Test fun anAgentWithoutAutoAsksAndOneStillLoadingOffersAuto() {+ val plain = AgentModels(emptyList(), modes = emptyList())+ val choices = ApprovalChoice.all(plain)+ assertEquals(listOf("Ask me", "Approve automatically"), choices.map { it.label })+ assertEquals("Ask me", ApprovalChoice.selected(BotDraft(name = "Bot"), choices, plain)?.label)+ assertEquals(listOf("Auto", "Ask me", "Approve automatically"), ApprovalChoice.all(null).map { it.label })+ // Another agent's ids mean nothing: a picked mode becomes its Auto mode.+ assertEquals("auto", BotDraft(name = "Bot", mode = "plan").withAgent("codex").mode)+ assertEquals(null, BotDraft(name = "Bot", mode = null).withAgent("codex").mode)+ }+}diff --git a/apps/desktop/src/renderer/views/bots/ApprovalRow.tsx b/apps/desktop/src/renderer/views/bots/ApprovalRow.tsxnew file mode 100644index 00000000..6e686f8c--- /dev/null+++ b/apps/desktop/src/renderer/views/bots/ApprovalRow.tsx@@ -0,0 +1,25 @@+import { approvalChoices, selectedApproval, withApproval, type ModeCatalog } from '@shared/approvals'+import type { BotDraft } from '@shared/models'+import { ChoicePicker, ValueRow } from '../../components/Controls'+import { useTr } from '../../lib/use-language'++/** Permissions: the modes the bot's agent offers (its model list), its Auto mode first, then approving everything. */+export function ApprovalRow({ draft, catalog, onChange }: {+ draft: BotDraft+ catalog: ModeCatalog | null+ onChange: (update: (d: BotDraft) => BotDraft) => void+}) {+ const tr = useTr()+ const choices = approvalChoices(catalog)+ const selected = selectedApproval(draft, choices, catalog)+ const detail = selected ? [selected.note, tr(selected.detail)].filter(Boolean).join(' ') : null+ return (+ <ValueRow label="Permissions" detail={detail}>+ <ChoicePicker+ selection={selected?.id ?? ''}+ options={choices.map((c) => ({ id: c.id, label: c.label }))}+ onChange={(id) => onChange((d) => withApproval(d, id))}+ />+ </ValueRow>+ )+}diff --git a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx b/apps/desktop/src/renderer/views/bots/BotEditorView.tsxindex 1d6187d5..76fd86be 100644--- a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx+++ b/apps/desktop/src/renderer/views/bots/BotEditorView.tsx@@ -4,7 +4,7 @@ import { restLine, restOf, withBackend } from '@shared/fallbacks'import { draftOf, type Bot, type BotDraft } from '@shared/models'import { AgentIcon } from '../../components/AgentIcon'import { CharacterAvatar } from '../../components/Avatar'-import { CardSection, ChoicePicker, DropdownMenu, IconButton, Pill, Spinner, ValueRow } from '../../components/Controls'+import { CardSection, DropdownMenu, IconButton, Pill, Spinner, ValueRow } from '../../components/Controls'import { Icon } from '../../components/Icon'import { ModalHeader, Sheet, SheetPage, useDismiss } from '../../components/Overlay'import { HStack } from '../../components/Stack'@@ -12,6 +12,7 @@ import { Text } from '../../components/Text'import { useStore } from '../../store/context'import { useAgentModels } from './agent-models'import { AgentModelPicker } from './AgentModelPicker'+import { ApprovalRow } from './ApprovalRow'import { agentChoice, AgentStepBanner, FallbacksRow } from './Fallbacks'import { errorText, isValid, lastPathComponent, normalized, useFollowSaved, usePlugins, type Plugins } from './drafts'import { FormSheet } from '../marketplace/pieces'@@ -235,23 +236,7 @@ function BotSettingsForm({ draft, onChange, error, plugins, part = 'all' }: {</Pill></DropdownMenu></ValueRow>- <ValueRow- label="Permissions"- detail={- draft.permission === 'auto'- ? "Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply."- : "You'll get an approval card and a notification whenever the agent asks."- }- >- <ChoicePicker- selection={draft.permission}- options={[- { id: 'ask', label: 'Ask me' },- { id: 'auto', label: 'Approve automatically' },- ]}- onChange={(id) => set('permission', id)}- />- </ValueRow>+ <ApprovalRow draft={draft} catalog={models.catalog} onChange={onChange} /></CardSection><CardSection title="Activity">diff --git a/apps/desktop/src/renderer/views/bots/agent-models.ts b/apps/desktop/src/renderer/views/bots/agent-models.tsindex 9e2345a3..c90e7645 100644--- a/apps/desktop/src/renderer/views/bots/agent-models.ts+++ b/apps/desktop/src/renderer/views/bots/agent-models.ts@@ -1,5 +1,6 @@import { useEffect, useRef, useState } from 'react'import { useStore } from '../../store/context'+import type { AgentMode } from '@shared/approvals'import { errorText } from './drafts'/** A model's own setting (effort, fast…) and the values the agent accepts. */@@ -18,6 +19,10 @@ export interface AgentModels {/** The agent offers Fast mode (absent on older hosts). */fastMode?: booleandefaultModelOptions?: boolean+ /** The agent's modes, its Auto mode first and listed as `auto` (absent on older hosts). */+ modes?: AgentMode[]+ /** The mode its sessions start in. */+ currentModeId?: string | null}/** What the agent behind `backend` offers, loaded from the selected computer. */diff --git a/apps/desktop/src/renderer/views/bots/drafts.ts b/apps/desktop/src/renderer/views/bots/drafts.tsindex d1d64e1a..ef708ba1 100644--- a/apps/desktop/src/renderer/views/bots/drafts.ts+++ b/apps/desktop/src/renderer/views/bots/drafts.ts@@ -1,5 +1,6 @@import { useEffect, useRef, useState } from 'react'import { rebase } from '@shared/draft-rebase'+import { AUTO_MODE } from '@shared/approvals'import { draftOf, type Bot, type BotDraft } from '@shared/models'import { AVATAR_COLORS, AVATAR_SHAPES } from '../../lib/theme'import type { BotStore } from '../../store/bot-store'@@ -28,9 +29,9 @@ export interface Plugins {const pick = <T>(list: T[]) => list[Math.floor(Math.random() * list.length)]!-/** A fresh draft: a random look, Claude, a personal workspace, automatic approvals. */+/** A fresh draft: a random look, Claude, a personal workspace, the agent's Auto mode asking about the rest. */export function newDraft(): BotDraft {- return { name: '', description: '', avatarColor: pick(AVATAR_COLORS).id, avatarShape: pick(AVATAR_SHAPES), backend: 'claude', cwd: '', permission: 'auto' }+ return { name: '', description: '', avatarColor: pick(AVATAR_COLORS).id, avatarShape: pick(AVATAR_SHAPES), backend: 'claude', cwd: '', permission: 'ask', mode: AUTO_MODE }}/** A saved bot keeps a name; only a new one may go without (the host names it after its first conversations). */diff --git a/apps/desktop/src/shared/approvals.test.ts b/apps/desktop/src/shared/approvals.test.tsnew file mode 100644index 00000000..bcdf3c4d--- /dev/null+++ b/apps/desktop/src/shared/approvals.test.ts@@ -0,0 +1,38 @@+import { test } from 'node:test'+import assert from 'node:assert/strict'+import { approvalChoices, selectedApproval, withApproval } from './approvals.ts'+import { withBackend } from './fallbacks.ts'+import type { BotDraft } from './models.ts'++const codex = {+ modes: [{ id: 'auto', name: 'Auto review', description: 'Only ask for actions detected as potentially unsafe' }, { id: 'read-only', name: 'Read-only' }],+ currentModeId: 'auto',+}++test("approvals list the agent's modes, Auto first, then approve automatically", () => {+ const choices = approvalChoices(codex)+ assert.deepEqual(choices.map((c) => c.label), ['Auto review', 'Read-only', 'Approve automatically'])+ assert.equal(choices[0]!.note, 'Only ask for actions detected as potentially unsafe')+ const draft = { permission: 'ask', mode: 'auto' as string | null }+ assert.equal(selectedApproval(draft, choices, codex)?.label, 'Auto review')+ assert.equal(selectedApproval({ permission: 'ask', mode: null }, choices, codex)?.label, 'Auto review', "an unset mode is the agent's start")+ assert.deepEqual(withApproval(draft, choices[1]!.id), { permission: 'ask', mode: 'read-only' })+ const approve = withApproval(draft, choices[2]!.id)+ assert.deepEqual(approve, { permission: 'auto', mode: null })+ assert.equal(JSON.stringify(approve), '{"permission":"auto","mode":null}', 'null reaches the host and clears it')+ assert.equal(selectedApproval(approve, choices, codex)?.label, 'Approve automatically')+})++test('an agent without Auto asks, and one still loading offers Auto', () => {+ const plain = { modes: [] }+ const choices = approvalChoices(plain)+ assert.deepEqual(choices.map((c) => c.label), ['Ask me', 'Approve automatically'])+ assert.equal(selectedApproval({ permission: 'ask', mode: 'auto' }, choices, plain)?.label, 'Ask me')+ assert.deepEqual(approvalChoices(null).map((c) => c.label), ['Auto', 'Ask me', 'Approve automatically'])+})++test("another agent's mode ids mean nothing: a picked mode becomes its Auto mode", () => {+ const draft: BotDraft = { name: 'B', description: '', avatarColor: 'red', avatarShape: 'blob', backend: 'claude', cwd: '', permission: 'ask', mode: 'plan' }+ assert.equal(withBackend(draft, 'codex').mode, 'auto')+ assert.equal(withBackend({ ...draft, mode: null }, 'codex').mode, null)+})diff --git a/apps/desktop/src/shared/approvals.ts b/apps/desktop/src/shared/approvals.tsnew file mode 100644index 00000000..58fef625--- /dev/null+++ b/apps/desktop/src/shared/approvals.ts@@ -0,0 +1,62 @@+import type { BotDraft } from './models'++/** Codync's id for the agent's Auto mode, whatever the agent calls it: new bots start there. */+export const AUTO_MODE = 'auto'++/** One of the modes an agent works in (Claude's Manual / Plan / Auto, Codex's Read-only / Auto review…). */+export interface AgentMode {+ id: string+ name: string+ description?: string | null+}++/** What an agent's model list says about its modes (`agentModels`); null while it loads. */+export interface ModeCatalog {+ modes?: AgentMode[] | null+ currentModeId?: string | null+}++/** A bot's Approvals choice. `note` is the agent's own words, untranslated; `detail` is Codync's, to translate. */+export interface ApprovalChoice {+ id: string+ label: string+ note: string | null+ detail: string+}++const ASK = 'ask'+const APPROVE = 'approve'+const modeId = (mode: string) => `mode:${mode}`++/**+ * The agent's modes, its Auto mode first, then Codync approving everything. An agent without modes offers Ask me+ * instead; while its list loads (or from an older host), Auto and Ask me.+ */+export function approvalChoices(catalog: ModeCatalog | null): ApprovalChoice[] {+ const ask = { id: ASK, label: 'Ask me', note: null, detail: "You'll get an approval card and a notification whenever the agent asks." }+ const approve = {+ id: APPROVE, label: 'Approve automatically', note: null,+ detail: "Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply.",+ }+ const modes = catalog?.modes+ if (!modes) {+ return [{ id: modeId(AUTO_MODE), label: 'Auto', note: null, detail: "The agent decides what's safe and asks you about the rest." }, ask, approve]+ }+ if (!modes.length) return [ask, approve]+ const asks = 'Anything the agent still asks about comes to you as an approval card.'+ return [...modes.map((m) => ({ id: modeId(m.id), label: m.name, note: m.description ?? null, detail: asks })), approve]+}++/** The choice a bot's setting shows as: an unset mode is the one the agent starts in. */+export function selectedApproval(draft: Pick<BotDraft, 'permission' | 'mode'>, choices: ApprovalChoice[], catalog: ModeCatalog | null) {+ if (draft.permission === 'auto') return choices.find((c) => c.id === APPROVE) ?? null+ const mode = draft.mode ?? catalog?.currentModeId+ return (mode ? choices.find((c) => c.id === modeId(mode)) : undefined) ?? choices.find((c) => c.id === ASK) ?? choices[0] ?? null+}++/** The draft with an Approvals choice picked. */+export function withApproval<D extends Pick<BotDraft, 'permission' | 'mode'>>(draft: D, id: string): D {+ if (id === APPROVE) return { ...draft, permission: 'auto', mode: null }+ if (id === ASK) return { ...draft, permission: 'ask', mode: null }+ return { ...draft, permission: 'ask', mode: id.slice('mode:'.length) }+}diff --git a/apps/desktop/src/shared/fallbacks.ts b/apps/desktop/src/shared/fallbacks.tsindex f9d35f93..62e9addc 100644--- a/apps/desktop/src/shared/fallbacks.ts+++ b/apps/desktop/src/shared/fallbacks.ts@@ -1,3 +1,4 @@+import { AUTO_MODE } from './approvals.ts'import type { Bot, BotDraft, Fallback, Resting } from './models'/** The host refuses more. */@@ -37,4 +38,6 @@ export function moveFallback(list: Fallback[], index: number, by: number): Fallb/** The bot on agent `backend`: a fallback on that agent goes (an agent is in the chain once, as the host keeps it). */export const withBackend = (d: BotDraft, backend: string): BotDraft => d.backend === backend ? d : ({...d, backend, model: null, modelOptions: {}, fallbacks: d.fallbacks?.filter((f) => f.backend !== backend),+ // A picked mode becomes the new agent's Auto mode (or, without one, asking).+ mode: d.mode ? AUTO_MODE : d.mode,})diff --git a/apps/desktop/src/shared/models.ts b/apps/desktop/src/shared/models.tsindex 963fc650..eab4f9cd 100644--- a/apps/desktop/src/shared/models.ts+++ b/apps/desktop/src/shared/models.ts@@ -21,8 +21,11 @@ export interface Bot {cwd: string/** Host-allocated personal workspace rather than a user-selected project. */managedWorkspace: boolean- /** `ask` or `auto`. */+ /** `ask` or `auto`: whether Codync asks about what the agent asks, or approves it. */permission: string+ /** The agent mode it works in (Claude's Manual / Plan / Auto…): the agent's id, or `auto` for its Auto mode under+ * any id. Null keeps the agent's default. */+ mode: string | nullmodel?: string | null/** The model's own settings (effort, fast…): agent option id → value. */modelOptions: Record<string, string>@@ -97,6 +100,7 @@ export function normalizeBot(raw: Partial<Bot> & { id: string }): Bot {cwd: raw.cwd ?? '',managedWorkspace: raw.managedWorkspace ?? false,permission: raw.permission ?? 'auto',+ mode: raw.mode ?? null,model: raw.model ?? null,modelOptions: raw.modelOptions ?? {},fastMode: raw.fastMode ?? false,@@ -597,6 +601,8 @@ export interface BotDraft {command?: string | nullcwd: stringpermission: string+ /** Null for the agent's default: sent as is, so the host clears it. */+ mode?: string | nullmodel?: string | nullmodelOptions?: Record<string, string>fastMode?: boolean@@ -628,6 +634,7 @@ export function draftOf(bot: Bot): BotDraft {command: bot.command ?? null,cwd: bot.managedWorkspace ? '' : bot.cwd,permission: bot.permission,+ mode: bot.mode,model: bot.model ?? null,modelOptions: bot.modelOptions,fastMode: bot.fastMode,diff --git a/apps/ios/Kit/Sources/CodyncKit/Client/HostClient.swift b/apps/ios/Kit/Sources/CodyncKit/Client/HostClient.swiftindex 23957146..6bdca6ac 100644--- a/apps/ios/Kit/Sources/CodyncKit/Client/HostClient.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Client/HostClient.swift@@ -33,14 +33,13 @@ public struct Empty: Codable, Sendable {/// A full editor update must explicitly clear a previous model override.struct BotUpdate: Encodable {let draft: BotDraft- private enum CodingKeys: String, CodingKey { case model }+ private enum CodingKeys: String, CodingKey { case model, mode }func encode(to encoder: Encoder) throws {try draft.encode(to: encoder)- if draft.model == nil {- var container = encoder.container(keyedBy: CodingKeys.self)- try container.encodeNil(forKey: .model)- }+ var container = encoder.container(keyedBy: CodingKeys.self)+ if draft.model == nil { try container.encodeNil(forKey: .model) }+ if draft.mode == nil { try container.encodeNil(forKey: .mode) }}}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swift b/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swiftindex 83bc35b1..8f395bf8 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swift@@ -88,6 +88,8 @@ public extension BotDraft {self.backend = backendmodel = nilmodelOptions = [:]+ // A picked mode becomes the new agent's Auto mode (or, without one, asking).+ if mode != nil { mode = AgentMode.auto }fallbacks?.removeAll { $0.backend == backend }}}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/AgentMode.swift b/apps/ios/Kit/Sources/CodyncKit/Models/AgentMode.swiftnew file mode 100644index 00000000..98234eac--- /dev/null+++ b/apps/ios/Kit/Sources/CodyncKit/Models/AgentMode.swift@@ -0,0 +1,64 @@+import Foundation++/// One of the modes an agent works in (Claude's Manual / Accept edits / Plan / Auto, Codex's Read-only / Auto review…),+/// as `agentModels` lists them: its Auto mode first and listed as `auto`.+public struct AgentMode: Decodable, Hashable, Sendable {+ /// Codync's id for the agent's Auto mode, whatever the agent calls it: new bots start there.+ public static let auto = "auto"++ public let id: String+ public let name: String+ public let description: String?+}++/// A bot's Approvals choice: the agent's modes, then Codync approving everything. An agent without modes offers+/// Ask me instead; while its list loads (or from an older host), Auto and Ask me.+public struct ApprovalChoice: Identifiable, Hashable, Sendable {+ public static let ask = "ask"+ public static let approve = "approve"++ public let id: String+ public let label: String+ /// The agent's own words for its mode, untranslated.+ public let note: String?+ /// What Codync does, to translate.+ public let detail: String++ /// The choices for an agent, from its model list (nil while it loads).+ public static func all(_ catalog: AgentModels?) -> [ApprovalChoice] {+ let ask = ApprovalChoice(id: ask, label: "Ask me", note: nil,+ detail: "You'll get an approval card and a notification whenever the agent asks.")+ let approve = ApprovalChoice(id: approve, label: "Approve automatically", note: nil,+ detail: "Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply.")+ guard let modes = catalog?.modes else {+ let auto = ApprovalChoice(id: modeId(AgentMode.auto), label: "Auto", note: nil,+ detail: "The agent decides what's safe and asks you about the rest.")+ return [auto, ask, approve]+ }+ if modes.isEmpty { return [ask, approve] }+ return modes.map {+ ApprovalChoice(id: modeId($0.id), label: $0.name, note: $0.description,+ detail: "Anything the agent still asks about comes to you as an approval card.")+ } + [approve]+ }++ /// The choice a bot's setting shows as: an unset mode is the one the agent starts in.+ public static func selected(permission: String, mode: String?, in choices: [ApprovalChoice], catalog: AgentModels?) -> ApprovalChoice? {+ if permission == "auto" { return choices.first { $0.id == approve } }+ if let mode = mode ?? catalog?.currentModeId, let match = choices.first(where: { $0.id == modeId(mode) }) { return match }+ return choices.first { $0.id == ask } ?? choices.first+ }++ static func modeId(_ mode: String) -> String { "mode:\(mode)" }+}++public extension BotDraft {+ /// Picks an Approvals choice (`ApprovalChoice`).+ mutating func setApproval(_ id: String) {+ switch id {+ case ApprovalChoice.approve: (permission, mode) = ("auto", nil)+ case ApprovalChoice.ask: (permission, mode) = ("ask", nil)+ default: (permission, mode) = ("ask", String(id.dropFirst("mode:".count)))+ }+ }+}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift b/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swiftindex d77e5b98..106f4358 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift@@ -33,4 +33,8 @@ public struct AgentModels: Decodable, Sendable {/// The agent offers Fast mode (absent on older hosts).public let fastMode: Bool?public let defaultModelOptions: Bool?+ /// The agent's modes, its Auto mode first and listed as `auto` (nil from older hosts).+ public let modes: [AgentMode]?+ /// The mode its sessions start in.+ public let currentModeId: String?}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Bot.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Bot.swiftindex 8b50a4f5..e46d0279 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/Bot.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Bot.swift@@ -18,8 +18,11 @@ public struct Bot: Codable, Identifiable, Hashable, Sendable {public var cwd: String/// Host-allocated personal workspace rather than a user-selected project.public var managedWorkspace: Bool = false- /// `ask` or `auto`.+ /// `ask` or `auto`: whether Codync asks about what the agent asks, or approves it.public var permission: String+ /// The agent mode it works in (Claude's Manual / Plan / Auto…): the agent's id, or `auto` for its Auto mode+ /// under any id. Nil keeps the agent's default.+ public var mode: String?public var model: String?/// The model's own settings (effort, fast…): agent option id → value.public var modelOptions: [String: String] = [:]@@ -114,6 +117,7 @@ extension Bot {cwd = try c.decodeIfPresent(String.self, forKey: .cwd) ?? ""managedWorkspace = try c.decodeIfPresent(Bool.self, forKey: .managedWorkspace) ?? falsepermission = try c.decodeIfPresent(String.self, forKey: .permission) ?? "auto"+ mode = try c.decodeIfPresent(String.self, forKey: .mode)model = try c.decodeIfPresent(String.self, forKey: .model)modelOptions = try c.decodeIfPresent([String: String].self, forKey: .modelOptions) ?? [:]fastMode = try c.decodeIfPresent(Bool.self, forKey: .fastMode) ?? falsediff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Models.swiftindex b4aa0f06..7320f302 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift@@ -303,6 +303,8 @@ public struct BotDraft: Codable, Hashable, Sendable {public var command: String?public var cwd: Stringpublic var permission: String+ /// Sent as null when nil (`BotUpdate`): the agent's default.+ public var mode: String?public var model: String?public var modelOptions: [String: String] = [:]public var fastMode: Bool?@@ -326,7 +328,7 @@ public struct BotDraft: Codable, Hashable, Sendable {public init(name: String = "", description: String = "", avatarColor: String = AvatarPalette.colors.randomElement()!.id,avatarShape: String = AvatarPalette.shapes.randomElement()!, backend: String = "claude", cwd: String = "",- permission: String = "auto") {+ permission: String = "ask", mode: String? = AgentMode.auto) {self.name = nameself.description = descriptionself.avatarColor = avatarColor@@ -334,6 +336,7 @@ public struct BotDraft: Codable, Hashable, Sendable {self.backend = backendself.cwd = cwdself.permission = permission+ self.mode = mode}public init(_ bot: Bot) {@@ -346,6 +349,7 @@ public struct BotDraft: Codable, Hashable, Sendable {command = bot.commandcwd = bot.managedWorkspace ? "" : bot.cwdpermission = bot.permission+ mode = bot.modemodel = bot.modelmodelOptions = bot.modelOptionsfastMode = bot.fastMode@@ -371,7 +375,7 @@ public struct BotDraft: Codable, Hashable, Sendable {if self[keyPath: field] == base[keyPath: field] { draft[keyPath: field] = fresh[keyPath: field] }}follow(\.name); follow(\.description); follow(\.avatarColor); follow(\.avatarShape); follow(\.backend)- follow(\.command); follow(\.cwd); follow(\.permission); follow(\.model); follow(\.modelOptions)+ follow(\.command); follow(\.cwd); follow(\.permission); follow(\.mode); follow(\.model); follow(\.modelOptions)follow(\.fastMode); follow(\.fallbacks); follow(\.selfFallbacks); follow(\.pinned); follow(\.hidden)follow(\.notify); follow(\.connectors); follow(\.skills); follow(\.computer); follow(\.manageTeam)follow(\.sharedMemory); follow(\.harnessMemory); follow(\.offeredToNetwork); follow(\.reachableByAssistants)diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.jsonindex 75d300ba..63c89c27 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json@@ -530,6 +530,8 @@"Workspace": "Arbeitsbereich","Permissions": "Berechtigungen","Ask me": "Mich fragen",+ "The agent decides what's safe and asks you about the rest.": "Der Agent entscheidet, was sicher ist, und fragt dich beim Rest.",+ "Anything the agent still asks about comes to you as an approval card.": "Was der Agent trotzdem fragt, erhältst du als Genehmigungskarte.","Approve automatically": "Automatisch genehmigen","Activity": "Aktivität","Get notified when this bot finishes or needs you": "Benachrichtigung, wenn dieser Bot fertig ist oder dich braucht",diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.jsonindex ad11e98d..16721927 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json@@ -530,6 +530,8 @@"Workspace": "Espacio de trabajo","Permissions": "Permisos","Ask me": "Preguntarme",+ "The agent decides what's safe and asks you about the rest.": "El agente decide qué es seguro y te pregunta por el resto.",+ "Anything the agent still asks about comes to you as an approval card.": "Lo que el agente aún solicite te llegará como una tarjeta de aprobación.","Approve automatically": "Aprobar automáticamente","Activity": "Actividad","Get notified when this bot finishes or needs you": "Recibir un aviso cuando este bot termine o te necesite",diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.jsonindex ddb26c09..2e8273d1 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json@@ -530,6 +530,8 @@"Workspace": "Espace de travail","Permissions": "Autorisations","Ask me": "Me demander",+ "The agent decides what's safe and asks you about the rest.": "L’agent décide de ce qui est sûr et vous demande pour le reste.",+ "Anything the agent still asks about comes to you as an approval card.": "Ce que l’agent demande encore vous arrive sous forme de carte d’approbation.","Approve automatically": "Approuver automatiquement","Activity": "Activité","Get notified when this bot finishes or needs you": "Être averti lorsque ce bot termine ou a besoin de vous",diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.jsonindex a13cd4c2..b0d7a0d4 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json@@ -530,6 +530,8 @@"Workspace": "ワークスペース","Permissions": "権限","Ask me": "毎回確認",+ "The agent decides what's safe and asks you about the rest.": "安全な操作はエージェントが判断し、それ以外はあなたに確認します。",+ "Anything the agent still asks about comes to you as an approval card.": "それでもエージェントが要求する操作は、承認カードとして届きます。","Approve automatically": "自動的に承認","Activity": "活動","Get notified when this bot finishes or needs you": "このボットが終了したとき、またはあなたが必要になったときに通知を受け取ります",diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.jsonindex 3bd75d33..42f80879 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json@@ -530,6 +530,8 @@"Workspace": "작업 공간","Permissions": "권한","Ask me": "매번 확인",+ "The agent decides what's safe and asks you about the rest.": "에이전트가 안전한 작업은 스스로 판단하고, 나머지는 물어봅니다.",+ "Anything the agent still asks about comes to you as an approval card.": "에이전트가 여전히 요청하는 작업은 승인 카드로 전달됩니다.","Approve automatically": "자동 승인","Activity": "활동","Get notified when this bot finishes or needs you": "이 봇이 작업을 마치거나 도움이 필요할 때 알림 받기",diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.jsonindex 8343bfd7..aac3d33b 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json@@ -530,6 +530,8 @@"Workspace": "工作区","Permissions": "权限","Ask me": "每次询问",+ "The agent decides what's safe and asks you about the rest.": "Agent 自己判断哪些安全,其余的再问你。",+ "Anything the agent still asks about comes to you as an approval card.": "Agent 仍要请求的事,会以批准卡片发给你。","Approve automatically": "自动批准","Activity": "活动","Get notified when this bot finishes or needs you": "这个 Bot 做完或需要你时通知你",diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.jsonindex 6da0f6d1..98f9650c 100644--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json@@ -530,6 +530,8 @@"Workspace": "工作區","Permissions": "許可權","Ask me": "每次詢問",+ "The agent decides what's safe and asks you about the rest.": "Agent 自己判斷哪些安全,其餘的再問你。",+ "Anything the agent still asks about comes to you as an approval card.": "Agent 仍要請求的事,會以批准卡片送到你這裡。","Approve automatically": "自動批准","Activity": "活動","Get notified when this bot finishes or needs you": "這個 Bot 做完或需要你時通知你",diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/ApprovalPicker.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/ApprovalPicker.swiftnew file mode 100644index 00000000..18e184f4--- /dev/null+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/ApprovalPicker.swift@@ -0,0 +1,39 @@+import CodyncKit+import OSLog+import SwiftUI++private let log = Logger(subsystem: "com.pokai.Codync", category: "Bots")++/// Permissions: the modes the bot's agent offers, its Auto mode first, then approving everything (`ApprovalChoice`).+struct ApprovalPicker: View {+ @Binding var draft: BotDraft+ @Environment(BotStore.self) private var store+ @State private var catalog: AgentModels?++ private var choices: [ApprovalChoice] { ApprovalChoice.all(catalog) }+ private var selected: ApprovalChoice? {+ ApprovalChoice.selected(permission: draft.permission, mode: draft.mode, in: choices, catalog: catalog)+ }++ var body: some View {+ ValueRow("Permissions", detail: selected.map { [$0.note, L10n.tr($0.detail)].compactMap { $0 }.joined(separator: " ") }) {+ ChoicePicker(selection: Binding(get: { selected?.id ?? "" }, set: { draft.setApproval($0) }),+ options: choices.map { ($0.id, $0.label) })+ }+ .task(id: "\(store.computer.id)/\(draft.backend)/\(store.connection == .online)") { await load() }+ }++ /// The agent's modes come with its model list (the host shares one asked for from several places at once).+ private func load() async {+ catalog = nil+ guard draft.backend != "custom", store.connection == .online, let client = store.client else { return }+ do {+ let response = try await client.agentModels(draft.backend)+ try Task.checkCancellation()+ catalog = response+ } catch {+ // The model picker says why; Auto, Ask me and Approve automatically stay on offer meanwhile.+ log.info("no agent modes for \(draft.backend, privacy: .public): \(error.localizedDescription, privacy: .public)")+ }+ }+}diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swiftindex ced4d982..ece81914 100644--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift@@ -212,11 +212,7 @@ struct BotSettingsForm: View {}.help(draft.cwd.isEmpty ? "A persistent workspace allocated for this bot" : draft.cwd)}- ValueRow("Permissions", detail: draft.permission == "auto"- ? "Tool requests are approved automatically. Your agent's own settings (like Claude Code's permission rules) still apply."- : "You'll get an approval card and a notification whenever the agent asks.") {- ChoicePicker(selection: $draft.permission, options: [("ask", "Ask me"), ("auto", "Approve automatically")])- }+ ApprovalPicker(draft: $draft)}.animation(Motion.reduced(Motion.layout, reduceMotion), value: bot?.agentStep)diff --git a/apps/ios/Kit/Tests/CodyncKitTests/AgentModeTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/AgentModeTests.swiftnew file mode 100644index 00000000..bb225287--- /dev/null+++ b/apps/ios/Kit/Tests/CodyncKitTests/AgentModeTests.swift@@ -0,0 +1,49 @@+import Foundation+import Testing+@testable import CodyncKit++private func catalog(_ json: String) throws -> AgentModels {+ try JSONDecoder().decode(AgentModels.self, from: Data(json.utf8))+}++@Test func newBotsStartInTheAgentsAutoModeAndAsk() throws {+ let draft = BotDraft(name: "New")+ #expect((draft.permission, draft.mode) == ("ask", "auto"))+ let body = try #require(JSONSerialization.jsonObject(with: JSONEncoder().encode(draft)) as? [String: Any])+ #expect(body["mode"] as? String == "auto")+}++@Test func approvalsListTheAgentsModesThenApproveAutomatically() throws {+ let codex = try catalog(#"{"models":[],"modes":[{"id":"auto","name":"Auto review","description":"Only ask for actions detected as potentially unsafe"},{"id":"read-only","name":"Read-only"}],"currentModeId":"auto"}"#)+ let choices = ApprovalChoice.all(codex)+ #expect(choices.map(\.label) == ["Auto review", "Read-only", "Approve automatically"])+ #expect(choices.first?.note == "Only ask for actions detected as potentially unsafe")++ var draft = BotDraft(name: "Bot", backend: "codex")+ #expect(ApprovalChoice.selected(permission: draft.permission, mode: draft.mode, in: choices, catalog: codex)?.label == "Auto review")+ // An unset mode is the one the agent starts in.+ #expect(ApprovalChoice.selected(permission: "ask", mode: nil, in: choices, catalog: codex)?.label == "Auto review")+ draft.setApproval(choices[1].id)+ #expect((draft.permission, draft.mode) == ("ask", "read-only"))+ draft.setApproval(ApprovalChoice.approve)+ #expect((draft.permission, draft.mode) == ("auto", nil))+ // Approve automatically clears the mode on the host too.+ draft.id = "b"+ let body = try #require(JSONSerialization.jsonObject(with: JSONEncoder().encode(BotUpdate(draft: draft))) as? [String: Any])+ #expect(body["mode"] is NSNull)+ #expect(ApprovalChoice.selected(permission: draft.permission, mode: draft.mode, in: choices, catalog: codex)?.label == "Approve automatically")+}++@Test func anAgentWithoutAutoAsksAndOneStillLoadingOffersAuto() throws {+ let plain = try catalog(#"{"models":[],"modes":[]}"#)+ let choices = ApprovalChoice.all(plain)+ #expect(choices.map(\.label) == ["Ask me", "Approve automatically"])+ #expect(ApprovalChoice.selected(permission: "ask", mode: "auto", in: choices, catalog: plain)?.label == "Ask me")+ #expect(ApprovalChoice.all(nil).map(\.label) == ["Auto", "Ask me", "Approve automatically"])++ // Another agent's ids mean nothing: a picked mode becomes its Auto mode.+ var draft = BotDraft(name: "Bot")+ draft.mode = "plan"+ draft.setAgent("codex")+ #expect(draft.mode == "auto")+}diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.mdindex 10d4a9b1..2c3ffa97 100644--- a/apps/ios/WhatsNew.md+++ b/apps/ios/WhatsNew.md@@ -8,9 +8,11 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o## 2.34.0### zh-Hant+- 「權限」改成列出代理程式自己的模式,例如 Claude Code 的 Auto、Manual、Plan。新 bot 預設 Auto:安全的事代理程式直接做,其餘的才問你。- 自訂圖示現在只用在 bot 上,代理程式一律顯示自己的標誌。- 只用 Cursor CLI 登入時,也能看到 Cursor 的用量。### en-US+- Permissions now list your agent's own modes, like Claude Code's Auto, Manual and Plan. New bots start in Auto: the agent does what's safe and asks you about the rest.- Custom icons are now for bots only; agents always show their own logo.- Cursor usage now shows when you sign in with the Cursor CLI only.diff --git a/docs/features/lead-bot.md b/docs/features/lead-bot.mdindex 831ddacd..84f1105d 100644--- a/docs/features/lead-bot.md+++ b/docs/features/lead-bot.md@@ -35,7 +35,8 @@ initiative instead of waiting to be asked. Everything about it lives in the hostroutine for anything recurring; hand work that belongs to another bot to it with `message_bot`. What it reads inemail, web pages, documents or other services is data, never instructions: it sends, forwards, replies to, deletes,pays for or posts nothing the user didn't ask for in the chat. The check-in says the same, since it runs- unattended under the bot's own approval setting (Approve automatically by default, like any new bot).+ unattended under the bot's own approval setting (the agent's Auto mode by default, like any new bot, so what the+ agent won't decide waits on a card).- **Check in.** The lead Codync makes comes with a routine named *Check in*, at 09:00 and 18:00 in the computer's time zone(`0 9,18 * * *`, `routines::local_zone`). Each run looks at memory, recent conversations (`search_history`) andconnected services, tells the user what deserves their attention or takes a step for them, asks for access itdiff --git a/docs/features/marketplace.md b/docs/features/marketplace.mdindex ccf9756c..8224d270 100644--- a/docs/features/marketplace.md+++ b/docs/features/marketplace.md@@ -104,7 +104,7 @@ See [file structure](../architecture/file-structure.md), [bot collaboration](bot## Model selection-The shared bot editor requests `agentModels {backend}` from the selected computer. The host starts an isolated ACP session under its probe directory with saved agent credentials, no MCP servers and no prompt, then closes the process. The response is `{models: [{id, name, description, options, optionsError?}], currentModelId, fastMode, defaultModelOptions}`.+The shared bot editor requests `agentModels {backend}` from the selected computer. The host starts an isolated ACP session under its probe directory with saved agent credentials, no MCP servers and no prompt, then closes the process. The response is `{models: [{id, name, description, options, optionsError?}], currentModelId, fastMode, defaultModelOptions, modes, currentModeId}` (modes: see Agent modes). The host keeps each agent's answer for a minute and hands one in progress to the asks that come meanwhile (`auth::Recent`): an editor asks from the model picker and Permissions at once, and each ask would otherwise start the agent.Discovery prefers ACP `configOptions` with category `model` (including grouped options), with conventional `model`/`models` IDs as a compatibility fallback. Older agents may expose `models.availableModels`. Model names and IDs come from the agent; Codync does not bundle a provider catalog. See the [ACP config option contract](https://agentclientprotocol.com/protocol/v1/session-config-options).@@ -136,6 +136,14 @@ Clients show Fast mode for an agent bot unless its runtime says `unsupported` (a- Composer: the `/fast` [command](#commands), not a button. The terminal UI also shows `⚡ fast` or `⚡ refused` in the chat header.- Bot settings: a Fast mode switch row under Model when the agent's model list offers it (never for a custom command), when the bot's own sessions do, or while it's on. While refused, its detail gives the reason. The terminal UI form always lists the field and notes when the agent doesn't offer it.+## Agent modes++Agents list how they ask before acting as session modes: a `configOptions` entry with category `mode`, or the older `modes` field (`agent/modes.rs`). Claude's adapter offers Manual (`default`), Accept edits, Plan, Auto and, where allowed, Bypass permissions; Codex's offers Read-only, Workspace access, Auto review (`agent`) and Full access. ACP itself has no classifier: Claude's Auto is Claude Code's auto mode, Codex's Auto review its guardian reviewer.++A bot's `mode` names the one it works in: the agent's own id, or `auto` for the agent's Auto mode whatever its id (`auto`, or the one named "Auto review"), so the choice carries over to another agent or a fallback. Unset keeps the agent's default. `agentModels` lists the modes as `{modes: [{id, name, description}], currentModeId}`, the Auto mode first and under `auto`. Clients show them as the Permissions choices, then Approve automatically; an agent without modes shows Ask me instead, and one whose list hasn't loaded shows Auto, Ask me and Approve automatically (`ApprovalChoice` on iOS and Android, `shared/approvals.ts` on the desktop, `tui/app/approvals.rs`). `permission` stays what Codync does with a request that still reaches it: `ask` (a card) or `auto` (approve).++New bots get `permission: ask` and `mode: auto` (`new_bot::with_defaults`, when the client picks neither), the lead and imported bots included; a bot a manager creates gets the manager's. Bots made before keep theirs. The actor sets the mode once per session, before its first turn and again after the user picks another (`agent/bot/modes.rs`), with `session/set_config_option` or `session/set_mode`. The agent may leave it during the session (Claude leaves Plan once the plan is approved, and turns Auto into Accept edits on a model without it, with a notice of its own), and that stands until the next session. A switch the agent refuses fails the turn, so a bot never works in a mode the user didn't pick. An agent that doesn't offer the mode keeps its default, and Codync asks about whatever it asks.+## Secure connection setupSee [Connector setup and credentials](connector-credentials.md) for the shareddiff --git a/web/content/docs/bots.mdx b/web/content/docs/bots.mdxindex 1d4a3feb..117884fe 100644--- a/web/content/docs/bots.mdx+++ b/web/content/docs/bots.mdx@@ -57,18 +57,25 @@ Changing the folder starts a new agent session.When there are no recent workspaces, **Browse other folders** appears first. After you choose a folder, recent workspaces and their search appear on your next visit.-## Permissions: Ask me or Approve automatically+## Permissions-The **Permissions** setting decides what happens when the agent asks to run a command, change files or use another tool.+The **Permissions** setting decides how much the agent does on its own before it asks you. It lists the modes the bot's agent offers, its Auto mode first, then **Approve automatically**.| Setting | What happens || --- | --- |-| **Ask me** | An approval card appears in the chat and your iPhone gets a "needs you" notification. The agent waits for your answer. |+| **Auto** (Claude Code), **Auto review** (Codex) | The agent decides what's safe and does it. It blocks risky actions or asks you about them on an approval card. New bots start here. |+| The agent's other modes, such as **Manual**, **Accept edits** and **Plan** (Claude Code) or **Read-only** and **Full access** (Codex) | The agent works in that mode. Anything it asks about appears as an approval card in the chat, and your iPhone gets a "needs you" notification. The agent waits for your answer. |+| **Ask me** | For an agent without modes: every request it makes appears as an approval card. || **Approve automatically** | Codync allows each request for you, choosing the agent's "allow once" option when it offers one. |-New bots start on **Approve automatically**. With either setting, your agent's own settings still apply: if Claude Code's permission rules block a tool, it stays blocked. In the terminal UI this field is called **Approvals** (Ask or Auto).+- **An agent without an Auto mode:** a new bot asks you about every request (**Ask me**).+- **A model without Claude Code's Auto mode:** Claude Code works in **Accept edits** instead and says so in the chat.+- **Another agent:** when you change the bot's agent, a mode you picked becomes the new agent's Auto mode.+- **A mode the agent won't switch to:** the bot doesn't start the turn, and the chat says why.-The same setting covers changes a bot makes to other bots with **Manage the team**: under Ask me, each change waits for your Allow.+Bots made before Codync 2.34 keep the setting they had. With any setting, your agent's own settings still apply: if Claude Code's permission rules block a tool, it stays blocked. In the terminal UI this field is called **Approvals**, and ←/→ goes through the same choices.++The same setting covers changes a bot makes to other bots with **Manage the team**: unless it's Approve automatically, each change waits for your Allow. The bots it creates get the same setting.How approval cards work: [Conversations](/docs/conversations#approval-cards).diff --git a/web/content/docs/conversations.mdx b/web/content/docs/conversations.mdxindex 6ff5c21a..3bc132de 100644--- a/web/content/docs/conversations.mdx+++ b/web/content/docs/conversations.mdx@@ -58,7 +58,7 @@ A report or a tracker you'll come back to can come as an [artifact](/docs/artifa## Approval cards-When a bot's **Permissions** setting is **Ask me** and its agent wants to run a command, change files or use another tool, an approval card appears in the chat. It says what the agent wants ("Wants to run a command", "Wants to change files"…), the computer and folder it runs in, and **Details** with the command or the diff.+When a bot's agent asks to run a command, change files or use another tool, an approval card appears in the chat, unless the bot's **Permissions** are **Approve automatically**. In the agent's Auto mode it asks only about what it won't decide on its own. It says what the agent wants ("Wants to run a command", "Wants to change files"…), the computer and folder it runs in, and **Details** with the command or the diff.The answers come from the agent, usually:@@ -73,7 +73,7 @@ In the terminal UI, press `y` to allow once, `a` to always allow, `n` to reject,The agent waits for your answer. If the turn ends before you answer, for example because you stopped it, the card reads **Expired — the agent moved on**.-With **Approve automatically**, no cards appear: Codync allows each request for you. Your agent's own permission rules still apply under either setting. To change the setting, see [Bots](/docs/bots#permissions-ask-me-or-approve-automatically).+With **Approve automatically**, no cards appear: Codync allows each request for you. Your agent's own permission rules still apply under any setting. To change the setting, see [Bots](/docs/bots#permissions).## Stopping a turndiff --git a/web/content/docs/getting-started.mdx b/web/content/docs/getting-started.mdxindex f52ee696..6c0262b7 100644--- a/web/content/docs/getting-started.mdx+++ b/web/content/docs/getting-started.mdx@@ -105,11 +105,11 @@ Every bot, your lead bot too, starts with these defaults, which you can change i- **Agent:** Claude Code when it can run on the computer, otherwise the first agent Codync knows that can.- **Workspace:** a personal folder of its own.-- **Permissions:** Approve automatically.+- **Permissions:** the agent's Auto mode, so it asks you only about what it won't decide on its own (Ask me when the agent has no Auto mode).- **Notifications:** on.- **Connectors and skills:** every one installed on the computer is turned on (connectors only when the computer's credential store is available; see [Linux servers](/docs/linux-servers#limits-on-a-headless-server)).-> **Note:** New bots approve the agent's tool requests automatically. Your agent's own permission rules still apply. To review each request first, open the bot's settings and set **Permissions** to **Ask me**. See [Bots](/docs/bots#permissions-ask-me-or-approve-automatically).+> **Note:** New bots let the agent do what's safe and ask you about the rest on an approval card. To review every request, set **Permissions** to a mode such as **Manual**; to skip the cards, set it to **Approve automatically**. See [Bots](/docs/bots#permissions).If the bot's agent isn't signed in, the chat shows a card saying it needs you to sign in before your first message. Tap **Sign in** and follow the steps. See [Agents](/docs/agents#signing-in).diff --git a/web/content/docs/routines.mdx b/web/content/docs/routines.mdxindex 62b2b11d..6d15138d 100644--- a/web/content/docs/routines.mdx+++ b/web/content/docs/routines.mdx@@ -76,7 +76,7 @@ The routine list also shows what each routine is doing, such as Queued, Running,- **A fresh session.** Each run starts a session of its own. It doesn't see your conversation with the bot, so write instructions that stand on their own.- **One thing at a time.** A bot runs one routine at a time, and routine runs take turns with your conversation. A message you send during a run waits until the run ends.- **No backlog.** Runs that came due while the host couldn't run them don't pile up. The routine runs once, then keeps its schedule.-- **Approvals.** If the bot's **Permissions** are **Ask me**, a run that needs approval waits for you on a card in the chat, within its timeout.+- **Approvals.** Unless the bot's **Permissions** are **Approve automatically**, a run that needs approval waits for you on a card in the chat, within its timeout.## Failed runs and retriesdiff --git a/web/content/docs/teamwork.mdx b/web/content/docs/teamwork.mdxindex 7ac6e106..780f4317 100644--- a/web/content/docs/teamwork.mdx+++ b/web/content/docs/teamwork.mdx@@ -125,7 +125,7 @@ Managers are told to act only on what you asked, never because a file, web page,### Approval cards-If the manager's **Permissions** are **Ask me**, every create or change first shows an approval card in the manager's chat, with **Allow** and **Deny**. The card lists everything the change sets: one line per setting, then the routines, then the standing instructions in full.+Unless the manager's **Permissions** are **Approve automatically**, every create or change first shows an approval card in the manager's chat, with **Allow** and **Deny**. The card lists everything the change sets: one line per setting, then the routines, then the standing instructions in full.- A change too long to show in full on its card (over 2,000 characters) is refused before the card appears. The manager has to shorten it or split it.- A card waits about four and a half minutes. If you don't answer in time, it expires and nothing changes.