Skip to content

Latest commit

 

History

History
1184 lines (1101 loc) · 103 KB

ai.md

File metadata and controls

1184 lines (1101 loc) · 103 KB

AI providers and chat

Tinycast has one app-wide provider layer for features that need text generation. Chat chooses its model from Quick AI's header or the AI Chat composer, and AIChatCoordinator.provider(for:) builds that chat's route through AIProviderFactory to stream an AIRequest. Chat is the first consumer and Quick Actions the second; the provider layer depends on neither, and Quick Actions carries its own route rather than borrowing this one.

Chat has two surfaces over one history. Quick AI is the palette screen: Tab from the launcher asks what you typed, and the answer appears in place. AI Chat is a window: saved conversations in a sidebar on the left, the open one on the right, and a composer at the bottom with the model picker. ⌘J hands a Quick AI conversation to the window.

Invariants

  • AI is off out of the box, and off means fully off. AppSettings.aiEnabled is the flag: no Quick AI or AI Chat command in the launcher, no history database opened or created, no chat-presets.json read, no Codex helper for chat, no stop for it on Tab's ring, the palette leaves .ai and the window closes. Installed providers may still remain available for Quick Actions, which has its own switch and route. Turning AI off cancels every streaming reply and drops both transcripts, but touches neither the saved conversations in ai-chats.sqlite3 nor a Keychain key. aiEnabled is excluded from settings backups like every other AI key, so an import can never arm a feature it cannot configure.
  • Installed model discovery is per-provider. Settings → AI → Providers keeps Codex, Claude, Grok, OpenCode and Cursor visible with an individual toggle for each, all off by default. Turning one off cancels its check, clears its catalog and releases its process; Apple Intelligence is the default route when available, and saved API connections stay available.
  • A route that is off is off everywhere. The on-device model and every API connection have the same switch an installed tool has (aiDisabledRoutes, by AIModelSource.storageKey). Off leaves the route configured (a connection keeps its key), but AIModelOption.availableGroups drops it from every picker, AIProviderFactory refuses it with a message, and a default that pointed at it moves to a route still on. AISettingsStore.isRouteEnabled is the one place that answers.
  • A picker lists what the reader ticked, and an untouched route lists everything. aiShownModels holds, per route, the models its pickers show. No entry means all of them, including one the route starts offering later; ticking every box again drops the entry rather than storing the full list. The default model is always listed, since a picker must be able to show what it holds, and a removed connection takes its entry with it.
  • A set command path wins or fails. InstalledAILaunch.command answers .automatic, .executable or .missing, and .missing fails the check and the turn. The lookup is never a fallback for a path that was set: falling back would run another copy and hide the mistake the path was set to fix.
  • A reader's variable never replaces one Tinycast sets. InstalledAIKind.managedEnvironment is what keeps a tool inside the chat, including OpenCode's scoped permissions and Claude's account MCP switch, and InstalledAILaunch.inherited(for:) drops a reader's variable of the same name, along with NO_COLOR and the TC_MCP_ names that carry MCP secrets to Codex. Names are stored in aiInstalledOverrides and values in the login Keychain (KeychainSecretStore.installedAIEnvironment), read only for a tool that has variables.
  • Every off-device request carries Tinycast's own preamble, and the user's text goes after it. AIInstructions.compose builds AIRequest.instructions: a fixed preamble that tells the model where it is running and what the app can do, then whatever Settings → AI holds. The preamble keeps the model a general-purpose assistant (the app facts are reference for when the user asks, never a scope limit) and asks for honest comparisons; it does not instruct the model to favour Tinycast over anything else. It is not shown in the pane, and AIPreamble.swift holds the only copy of it. Edit the prompt there, not here. compose returns nil when the user has turned the system prompt off or the chat is on Apple Intelligence, and every transport drops a nil instruction, so a turn then carries none. A preset's text still rides with the switch off, never on device. The on-device model is small enough that any standing instruction (the preamble, the choices request or the user's own text) steers every answer toward it, so that route always gets the conversation alone.
  • API keys live only in the login Keychain. AIConnection persists the provider, endpoint and model identifiers in UserDefaults; it never contains a key. Keys are addressed by connection UUID through KeychainSecretStore.aiAPIKeys, and never enter logs, errors or settings backups. A key is issued for one endpoint and never follows a connection retargeted at another: change the provider or base URL and both model discovery and Save ask for a new key, rather than introduce the saved one to a host it was never meant to reach (AIEndpointPolicy.sameDestination). A connection's custom request headers are one JSON item per connection in KeychainSecretStore.aiRequestHeaders. They are visible rows in the editor rather than a hidden saved value, so they are saved with whatever endpoint the connection is saved with, and removing a connection deletes them with its key.
  • Remote endpoints require HTTPS. Plain HTTP is accepted only for localhost, 127.0.0.1 and ::1, where a key is optional, and any other scheme is rejected outright; a loopback host does not excuse ftp://. AIEndpointPolicy is the one place that decides this.
  • MCP OAuth is separate from the model provider's login. The HTTP MCP client can sign into a hosted server from Settings and keep its client credentials and tokens in that server's Keychain item. API chat uses this session without receiving its credentials. A rejected refresh becomes Sign-in required on the server, an unserved one does not end the session, and either way a running tool loop receives an explainable failure result. The same session is lent to the Codex and Claude routes as a bearer header, so a hosted server is signed into once for every route. See MCP.
  • The chat model is the routing decision. It names the on-device model, a model exposed by the installed Codex, Claude, Grok, OpenCode or Cursor command, or one saved API connection and model. Installed routes also carry their reasoning effort when the selected model supports one. A removed route falls forward to the on-device model when this Mac has one, then to another usable API model, then to no selection. Discovering an installed command never silently selects a networked model.
  • Every chat keeps its own model. ChatSession.model is stamped on the first send and changed by either surface's picker; conversation_details stores it, so reopening a chat reopens its model and effort. A pick also moves the app default, which is only what a new chat starts on. A chat whose route was removed in Settings answers on the default rather than failing (AIChatCoordinator.model(for:)), and keeps its stored pick in case the route comes back.
  • Reasoning is shown, folded, and never rebuilt from history. AIStreamEvent.reasoning carries the text a route shares (OpenAI-shaped reasoning / reasoning_content / reasoning_details, Anthropic and Claude-CLI thinking_delta, Codex's reasoning summary) into ChatMessage.reasoning, a list of ChatReasoning blocks. Thinking that resumes after answer text opens a new block pinned at that text offset, so segments places it where it happened, like a search or a tool call; each block is timed until the answer resumes. The transcript folds each under "Thought for Ns", drawing ChatReasoning.displayText, the stored text without the blank lines a route closes it with; message_thinking keeps them; requestMessages never sends them back. Settings → AI → Expand thinking (aiExpandsReasoning, off by default) starts every fold open, so thinking streams in the open; it rides the chatExpandsReasoning environment value from each transcript's host, and a fold the reader has clicked keeps their choice over it. A route that only says it is thinking still just shows "Thinking…". How much there is to read is the route's call: Claude streams full summaries, while Grok's CLI sends a line or two in the clear and the rest of its reasoning encrypted, so a Grok fold is short by design, not by truncation. An OpenAI-shaped route also counts a <think>…</think> block that opens its content, and only there, so a literal <think> later in an answer stays text.
  • A chat is named by its harness. As soon as a chat's first question is sent (so the title lands while the answer streams), again after an answer if that failed, and never over a rename, AIChatCoordinator.nameIfNeeded asks for a title: Claude's CLI through its own generate_session_title control request (persist: false, so nothing enters its history), every other route with one side request to the chat's own model (ChatTitle.instructions). The Claude request holds stdin open and reads with availableData until the answering line is whole: a read(upToCount:) waits for a full chunk or EOF, which left every title waiting on the watchdog. ChatTitle.sanitize strips labels, quotes and full stops; conversation_details keeps the result, and displayTitle prefers a rename, then this, then the first question.
  • A reply's links are its sources. ChatReferences.extract gathers the web links of a finished reply (Markdown links by their own names, bare URLs by host and path) in the order cited, one per page, skipping code, and both surfaces list them under the reply as glass capsules, each led by its number, that open in the browser and share chatChip() with the suggested replies. The same numbers close the sentence that cited each source, as a raised, linked [n]: ChatCitations finds each link's sentence end in the drawn text and inserts after it, two sources in one sentence sharing it, so prose and chips always agree. The preamble asks the model to link a page it relies on inline, so a cited answer carries its sources without a second request.
  • Tools are chosen per chat. The Tools submenu under the composer's + switches MCP off for the chat or turns single servers off (ChatToolScope, held on AIChatState, not stored; only a preset chat's stamp keeps the scope of its last send and restores it on reopen); @server still narrows one turn inside that. The scope binds both shapes alike: Tinycast's loop is offered only the allowed servers' tools, and a Codex or Claude turn is handed only the allowed servers. A route that cannot call tools shows the menu disabled and says why.
  • A preset is stamped on the chat it starts, never linked. AIChatState.usePreset copies the preset's name, glyph, instructions and tools into ChatSession.preset (ChatPreset.Stamp) and its model into ChatSession.model, and refuses once the chat has a message. Until then the empty chat follows its preset: AIChatCoordinator hands every edit and deletion to followPreset, so the first send carries the preset as it stands. conversation_presets keeps the stamp, so editing or deleting the preset never changes what a started chat sends; only the stamp's tools move, to the scope of the chat's last send. The stamp's instructions take the user prompt's place in AIInstructions.compose(presetInstructions:…) and are sent even with the system prompt off (picking a preset is the reader asking for them), while the preamble still follows its own switch. Apple Intelligence has no presets: compose returns nil on device, the composer hides the preset menu while the chat's route is on device, and the preset editor never offers that route as a preset's model. See Chat presets.
  • A reply can end on choices, and a choice is only ever a message. The preamble lets the model close a reply with a fenced choices block, one option per line. ChatChoices.split lifts the fence out of the prose (an unclosed one mid-stream too, so it never flashes as code). A small model tends to drop the fence and write a bare choices line over a list, so a label on its own line with nothing but list items after it, to the reply's end, counts too. It sometimes wraps that label in a bare fence of its own and adds a stray one after the list, so the bare fence right on the label and any fence closing or trailing the list go with them, and no empty code box is left behind. A label inside a fence with a language, or any other open code block, is code and stays. ChatSuggestionChips draws the options as glass capsules in a leading-aligned ChatFlowLayout: in the window they rise out of the composer, sitting on its top edge until the reader starts typing; in Quick AI they close the transcript. A click sends the option as the reader's next message, through the same send a typed one takes. Older replies lose their chips, since only the last question is still open. It is text in, text out, so it works on every route but Apple Intelligence, and not at all with the system prompt switched off, which drops the preamble that describes it. Settings → AI → Suggested replies (aiChoices, on by default) turns them off on purpose: AIInstructions.compose leaves AIPreamble.choices out, so no turn asks for them, and neither surface draws chips. A fence a model writes anyway is still lifted out of the prose.
  • Token usage belongs to the reply that reported it. AIUsage carries input, output, cached prompt and thinking tokens, and the model's window and cost where a route says them: Claude's CLI reports all of it, the Anthropic API its cache, OpenAI-shaped routes their reasoning tokens and OpenRouter its cost. ChatMessage.usage holds it and message_details keeps it, so a reopened chat still knows its last turn.
  • The on-device route is configured by having a Mac. .appleIntelligence takes no key, opens no socket and names no endpoint, so the Keychain, HTTPS and ephemeral-session rules below have nothing to bind to; the Settings pane must never grow a credential field for it. It is text-only and offers no web search, no instructions ride ahead of its turns, and history is bounded to AppleIntelligence.contextBudget rather than the cloud routes' ~100 KB because the on-device window holds a prompt and its reply together. Availability is asked for each time, never cached at launch: the model finishes downloading mid-session, and reading it inside a view body leaves SwiftUI observing the framework's own state. modelNotReady is also what a Mac whose profile switches Apple Intelligence off reports, so its copy says only that the model is not available and never promises a download.
  • An unavailable on-device model is reported, never rerouted. Fall-forward exists for a route the reader removed; a Mac with Apple Intelligence switched off keeps its stored selection and is told why, because silently moving someone from a free, private, local model onto a billed endpoint is the one redirection this feature must never perform.
  • Installed commands reuse their own login. Tinycast launches the user's codex, claude, grok or opencode executable without asking for or storing another key. Codex inherits the user's normal home and credential-store setting; Claude, Grok, OpenCode and Cursor inherit their normal configuration. Tinycast never reads those credential files, browser cookies or undocumented web endpoints. A Codex route with no account is ready only when account/read explicitly says requiresOpenaiAuth: false.
  • Codex runs Tinycast's MCP servers and nothing else. The app-server still launches with every feature flag off and a read-only, network-disabled sandbox, and every server request but one is declined. What changed is the list: the servers the reader configured for their own Codex are disabled by name at launch (which they were not before, so they used to start inside Tinycast threads), and the servers MCP supplies take their place when a chat has any, under names of their own (tinycast-<handle>) so that no table of the reader's merges into one. A launch that cannot read the reader's list, or cannot address a name on it, does not start. A turn that arms none keeps approvalPolicy: "never"; a turn that arms some uses "untrusted", where a tool call becomes an elicitation Tinycast answers from the reader's own trust setting.
  • Tool calling is a decorator, except where the CLI is the client. AIToolLoopProvider wraps a route and re-streams the turn until the model stops asking, so a route with no tools behaves exactly as it did and AIChatState reduces one more pair of events. Codex and the Claude command run that loop themselves, so AIModelSelection.runsItsOwnTools hands them an AIToolServerSession instead of a wrapper: same servers, same trust, same rows, and the same round cap counted in whatever unit the CLI counts in. Only chat wraps or arms: quickActionProvider() rewrites the reader's own selected text and has nothing to call. A turn's tool messages stay inside the loop: what the transcript keeps is a ChatToolUse record, pinned at a text offset like a search, so boundedContext can never separate a stored call from its result. The direct OpenAI API uses Responses. Its complete output items, including encrypted reasoning, assistant phase and function-call IDs, travel with the next tool round inside AIMessage.responseItems. They count against the turn's history ceiling and are discarded when the turn ends. Responses requests set store: false; no response ID or server-side conversation becomes part of saved chat state.
  • Every HTTP request uses a private ephemeral URLSession with no URL cache. Provider traffic must not create a second credential or response cache on disk.
  • A refusal shows what the provider said. HTTPAIProvider reads a non-200 body before the turn fails, up to AIProviderFailure.bodyLimit (8,000 bytes) and for at most five seconds, and the failed reply is the status's own line with the provider's message under it. AIProviderFailure.providerMessage finds that message in OpenAI's shape and its copies', Anthropic's, Gemini's array, vLLM's and OpenRouter's nested metadata.raw; a plain-text body is shown as sent, an HTML error page is left out wherever it sits, and a JSON body the cap cut gives up only a message that is still whole. The connection's key, bearer tokens and key-shaped strings are replaced with [redacted], and then the message is cut at messageLimit (600 characters). A key under eight characters is redacted only as a whole word, so it cannot eat into a longer one; a local server's placeholder key is redacted like any other. Custom header values are redacted the same way. A mid-stream error is treated the same way: the decoder is handed the key and header values, an Anthropic error event shows its message under its line, and an OpenAI-compatible one reads through metadata.raw too, or says the provider stopped the response when there is no sentence to show.
  • Model/ stays Foundation-only. AIProviderTests pins the shipped provider models' endpoints, request bodies, stream parsing, persistence repair, Codex protocol framing and both CLI routes' MCP launch encodings. Request bodies are AIRequestBody's, in Model/, precisely so a wrong shape fails a test rather than a conversation.
  • Grok and Cursor are text transports, not agents, and so is Claude with no server to run. Claude runs one turn with no tools, browser integration, slash commands or persisted session, but never --bare, which reads neither OAuth nor the keychain and so refuses the very sign-in this route reuses. Given servers by MCP it becomes an agent for that turn and only over those: --tools "" still withholds every built-in, the turn keeps its stream-json stdin open so consent has a pipe to answer on, --disallowedTools "*" comes off because it removes the MCP tools too, --max-turns carries the round cap instead of the constant 1, or is left out on Unlimited, and --permission-mode default with an ask rule per server keeps the reader's own allow rules and default mode from answering before Tinycast does. Grok runs with --deny *, dontAsk permissions and a workspace sandbox, and never --always-approve, so a user's always-approve config cannot arm tools for this route. OpenCode 2 runs --standalone, so its private server takes Tinycast's inline configuration, as a tinycast agent with sharing and snapshots off and a private working directory. Its deny-all rule drops every built-in and user-configured tool. A chat with MCP enabled adds exact allow rules for a private per-turn loopback bridge, with codemode: false so those tools do not require enabling execute. The bridge offers only the chat's selected tools and routes calls through Tinycast's existing consent and execution path. Cursor runs agent -p --mode ask with --trust against Tinycast's private workspace and never --force / --yolo / --approve-mcps; ask mode blocks edits. Each deletes the session or chat it created once the child exits, and Tinycast never reaches into the user's own config to do it. Only Claude keeps the user's MCP servers out of the process, through --strict-mcp-config (whether the config it names is empty or Tinycast's own), and even that yields to an installed managed MCP policy, which makes the CLI reject both flags and leaves MCP on that route the organization's decision; the Providers row says so. Grok, OpenCode and Cursor load the global config either way, because their configs merge with no opt-out; what refuses the call is --deny * for Grok, the tinycast agent's deny-all rule for OpenCode and withheld MCP approval for Cursor. Cursor's is the only one resting on an approval prompt rather than an explicit deny, which is why its Providers row says so and the others do not. Grok and Cursor are never handed a server. OpenCode's exact allow rules name only the turn's randomly named, authenticated bridge, never the user's servers. None of these routes offer web search, and only Claude and OpenCode take images: every Claude turn is one --input-format stream-json user message, the newest question's pictures as base64 image blocks beside the framed prompt. OpenCode gets the same pictures as private 0600 files in the workspace, one --file each, and only for a model whose catalog entry lists image input. Claude also runs with --thinking-display summarized, a hidden flag, and the only switch that works: a -p run forces its display to omitted unless one is named explicitly, and the showThinkingSummaries setting is read only by an interactive session. Without it Sonnet and Opus stream every thinking block empty, so the fold would show one opening line.
  • A conversation is live in one place at a time. AIChatSurfacesState holds Quick AI's AIChatState, the window's, and any window chat left mid-reply. Opening a chat anywhere takes the live state from wherever it already is (⌘J moves Quick AI's whole state object, reply, staged files and all, into the window), and Quick AI will not take a chat the window has: its open policy starts fresh instead, and Chat History opens that chat in the window. Two states editing one transcript would each save over the other, and ChatHistoryStore.save rewrites the stored tail from memory.
  • Leaving a chat never cancels it. Switching the window to another conversation, or starting a new one, parks a streaming reply rather than stopping it; it saves itself when it ends, the sidebar shows its spinner meanwhile, and reopening it resumes the same live state. Only Stop, deleting the chat, turning AI off or quitting cut a reply short. A reply is the conversation's, which is AppCore's, so closing the window cancels nothing either. Codex chats run side by side too: each conversation keeps its own ephemeral app-server thread, and CodexTurnRunner routes every notification and every tool-call question to its turn by threadId, so a Stop ends only its own. The app-server's server list is fixed at launch, so a turn armed with a different one relaunches it and ends the other chats' live threads with a reason, rather than leaving them waiting on a process that is gone.
  • Quick AI's lifetime is decided on the way in. Pop to Root forgets the screen and the query; whether the next summon resumes the transcript is Settings → AI's Opens to, applied in QuickAICoordinator.applyOpenPolicy on the way into .ai. That used to be Pop to Root's job by accident (it fires on every hide, so a chat never survived Escape), and deciding at open time from a timestamp leaves one clock instead of two racing over the same state, and a verdict that still holds after a relaunch. A reply still streaming is never reset out from under the reader (it was asked for), and the transcript is saved regardless, so the old conversation is one ⌘K → Chat History away, and in the window's sidebar. The window follows the same setting: opened from the launcher or its shortcut while closed, toggleWindow applies it through AIChatSurfacesState.applyWindowOpenPolicy. A reply still arriving, a half-typed line or staged files are never replaced by a reopen, and a chat Quick AI holds is not taken from it. ⌘J and Chat History's ⌘J put their chat in the window first and call plain showWindow, which never applies the setting, so the chat placed there is the one that opens.
  • Arriving with a question skips the open policy entirely. ask(_:) (⇥ from the launcher, and the Quick AI fallback row) always starts a new chat and submits the text, because a question asked outright is not a summon: resuming a transcript to append an unrelated line to it would be the one reading of Opens to nobody wants. It is showPalette(mode: .ai) and send, never show.
  • Staged files survive a re-summon; only the typed draft does not. applyOpenPolicy treats a pasted-but-unsent attachment as resident state: Recent Conversation will not open a saved chat over one, and A New Conversation resets only a chat that actually has messages, since an empty chat is already new and resetting it would drop the file for nothing. A file cost a read and a decode, which is not the same as a half-typed line; that is still dropped by prepare. ⌘J carries them into the window with the conversation; opening another chat there still disowns a state's own, which is the rule they belong to.
  • AIConversationOpenPolicy is the whole rule for both surfaces, and it is pure. Recent Conversation resumes the resident transcript, or reopens the newest saved one when nothing is resident, unless it has been idle past Start a new conversation after; A New Conversation always starts fresh. There is no third setting for "immediately" because that is A New Conversation: two controls able to express one state would only ever disagree.
  • History is local and lazy. Conversation summaries stay in memory while transcripts load from the system SQLite database only for the opened chat. Empty chats are never saved.
  • A failed reply ends on a note saying why, and only the note reads as an error. A cancel, an error and a reply cut off by a quit each close the reply's text with a last paragraph (Cancelled, the error, Response interrupted., which ChatHistoryStore adds on load). The transcript hands the markdown renderer failedFrom, the first block of that note, so what was written before the stop is never red; a note on its own is the whole text.
  • A rename and a pin are the reader's, and nothing derived overwrites them. Both live in conversation_details beside conversations, whose title stays the first question: every save rewrites that summary, so a rename stored there would be undone by the next turn. A blank rename hands the title back. The same row holds the harness's title and the chat's model, each column upserted on its own so no write clobbers another; message_details is its per-message twin, for a question's @server scope and a reply's usage. Both tables are CREATE TABLE IF NOT EXISTS with ON DELETE CASCADE, so they needed no migration and a deleted chat takes its facts with it.
  • Pinned chats are the ones asked to be kept. Retention skips them, and so does Delete All Chats (which says so in its confirmation), the way a clipboard clear keeps its pins.
  • Retention is enforced only while AI is on. Keep conversations prunes on the enable transition and whenever the setting changes, through AIChatCoordinator.applyRetention, never on a schedule and never while aiEnabled is false, because age passes while the feature is off and "off means fully off" promises the file is untouched. A Mac left off for four months keeps its chats. ChatHistoryStore.prune(before:) is one DELETE, sparing pinned chats, that cascades to messages, images and searches, and it VACUUMs only when something actually went: pictures live inline as BLOBs, so this is the one store where a delete alone frees pages without ever shrinking the file.
  • Everything but the newest message is bounded. ChatSession.boundedContext sends that message whole (truncating what someone just typed is worse than the provider's own error), keeps images and documents only on that turn and only up to AIAttachmentBudget, inlining an attached text file into that turn alone, and walks older text newest-first into a budget the route names: ~100 KB for a cloud endpoint, AppleIntelligence.contextBudget for the on-device model. Every transport funnels through requestMessages(textBudget:), so no route can resend every image each turn or let history grow the payload as a chat goes on. The composer refuses a picture past the budget and says so, rather than letting send time drop it silently.
  • Plan usage is read from the signed-in command, never from its credentials. Claude's windows come from the CLI's own get_usage control request, which answers without starting a turn, and ChatGPT's from Codex's account/rateLimits/read. Tinycast never opens either tool's credential store or calls a usage endpoint itself. A plan is read only while its route is on and ready, and ChatGPT only when it is signed in with an account rather than an API key.
  • Usage polling never holds the chat's Codex server. ChatGPTSubscriptionManager.readUsage() and consumeResetCredit() each start a server of their own and stop it on return, so a poll every three minutes neither keeps the chat's server resident nor relaunches it mid-turn. A chat turn that ends reads limits on its own server and hands them over through onUsage.

Connections and routing

AIModelSelection has seven cases: .appleIntelligence, .codex, .claude, .grok, .openCode, .cursor and .api. The first needs no connection at all. The next five name a model from an installed command and carry no credential. .api points at one AIConnection; AIProviderKind exposes four named presets plus a custom OpenAI-compatible route. Decoding still accepts the old .chatGPT spelling and writes it back as .codex, so an existing selection survives the rename.

Setting Transport Default base URL
Apple Intelligence Foundation Models, on device none
Codex installed codex app-server user's Codex account
Claude installed claude -p user's Claude login
Grok installed grok --prompt-file user's Grok login
OpenCode installed opencode run --standalone (OpenCode 2) providers already configured in OpenCode
Cursor installed agent -p --mode ask user's Cursor login
OpenAI API OpenAI Responses https://api.openai.com/v1
Anthropic Claude Anthropic Messages https://api.anthropic.com
Google Gemini Gemini's OpenAI-compatible API https://generativelanguage.googleapis.com/v1beta/openai
OpenRouter OpenAI-compatible https://openrouter.ai/api/v1
OpenAI Compatible OpenAI-compatible user-editable

The base URL stays editable for every preset because gateways and organization proxies are legitimate destinations. AIHTTPConfiguration.endpointURL accepts a complete endpoint or appends the transport's completion path. Gemini requests identify Tinycast through x-goog-api-client; OpenRouter requests carry the app title.

Only the OpenAI preset directed at api.openai.com uses Responses. An OpenAI preset pointed at a gateway, and the OpenAI Compatible preset at any address, retain Chat Completions. A saved direct OpenAI /chat/completions endpoint resolves to /responses without rewriting the saved connection. Model discovery also accepts a full /responses endpoint and still requests /models.

A connection can also carry custom request headers for gateways that route or authenticate by header. They go to model discovery and every chat request after the route's own headers, so a custom name replaces a default regardless of case. With headers set, the API key is optional and an empty key sends no credential header. AIRequestHeaders.validated drops blank rows and refuses a name outside the HTTP token set, a name repeated in any case, and a value with a line break or control character.

Each connection has an ordered, deduplicated list of exact model identifiers. While its editor is open, Tinycast asks the configured provider for the models available to the entered key and uses the result for search-as-you-type completion and validation. It never renders the whole provider catalog at once; selected models stay visible and search shows at most twelve additions. Discovery is debounced, cacheless and never persists the typed key. A custom gateway may not implement a model-list endpoint, so exact identifiers can always be entered manually. A gateway can also list an incomplete catalog under any preset, so search offers the typed identifier whenever no loaded model is named by it exactly, even beside partial matches; Return still adds only an exact catalog match, so a typed prefix never becomes a stored identifier. Tinycast does not ship or guess an API catalog that can become stale. Codex gets its models and reasoning efforts from model/list; OpenCode gets identifiers, variants, input modalities and tool support from its server's model.list, and an OpenCode older than 2 fails the check with a message rather than reading as signed out. Claude answers an initialize control request (written to a stream-json -p run that then gets no prompt, so no model is called) with its own /model list; InstalledAIModel.claudeCatalog keeps one row per resolved model (dropping default, which restates another), names each by the version its alias points at today ("Claude Opus 5.5"), and takes each one's supportedEffortLevels. The version is in description before a " · " on an older CLI and in displayName on a newer one, which describes a model without it; the name is read from whichever has it. The same answer carries the account, which claudeAccount reads for the Overview page. A model the CLI starts offering appears without a Tinycast release. Cursor lists models from agent --list-models after agent status --format json confirms a login.

Turning thinking off is a reasoning effort, not a second control: reasoningOptions(for:) answers with the connection's catalogued or declared efforts, or, for a gateway with nothing declared, Default and None. takesThinkingField decides who gets that pair: an OpenAI-shaped preset whose base URL is not that preset's own, because a preset pointed away from its own API is a gateway, and a gateway is the only destination Tinycast can offer the switch to honestly. Picking a gateway's None sends "thinking": {"type": "disabled"}, which is how DeepSeek and the endpoints that copied its contract answer without reasoning first. Every connection but OpenRouter (takesDeclaredLevels) takes levels the reader declares per model in the connection editor, kept after Default; OpenRouter is left out at any URL because its catalog already names each model's levels. declarableLevels is the ladder each destination defines, so no vendor is sent a field it does not: a gateway takes minimal through max with its None always appended; OpenAI takes minimal through max plus its own none; Gemini minimal through high plus none; Anthropic low through max and no None. Anthropic's /v1/models names each model's supported efforts under capabilities.effort, so adding a model from its catalog, or opening the editor on one saved earlier (adoptCatalog), pre-ticks them; OpenAI's and Gemini's catalogs do not, so their levels are never inferred. The same answer states each model's max_tokens, kept in AIConnection.outputLimits and sent as the Anthropic body's max_tokens, so a thinking model is never cut off by a cap below its own; a model whose ceiling was never read gets AIRequest.defaultMaxOutputTokens (32,000, the highest every Claude model accepts). max_tokens does not count against Anthropic's output rate limit, so the ceiling costs nothing unused. A picked level is sent as Responses' reasoning.effort, Chat Completions' reasoning_effort or Anthropic's output_config.effort; Default sends nothing, so the model keeps the provider's own default. Levels and output limits are dropped whenever the base URL or provider changes, because they describe one destination. A chat and a Quick Action keep their own effort, so AIProviderFactory sends only one the model still offers (offeredEffort): an unticked level, or one left behind by a changed provider, is dropped rather than sent. The choice rides in AIModelSelection.effort like every other route's.

Provider interface

AIProvider.stream(_:) accepts provider-neutral messages, optional instructions, a maximum output token count and the tools the turn may call. It returns an AsyncThrowingStream of text, thinking state, tool activity, usage and completion. OpenAI-compatible reasoning fields and a response's leading <think>…</think> content block are surfaced as .thinking and .reasoning, never mixed into answer text. AIThinkTagDecoder holds back a tag split across deltas, drops the whitespace between the closing tag and the answer, and flushes an unclosed block as reasoning. Anthropic system messages are lifted into its top-level system field; the other HTTP routes keep system messages in the OpenAI message array.

AIResponsesDecoder handles Responses text and refusal deltas, thinking activity, usage and terminal failures behind the same SSE parser. It releases function calls only after response.completed, using the complete response.output items rather than partially streamed arguments. A failed, incomplete or truncated response cannot release a tool call. Tool definitions set strict: false so the MCP server's optional parameters retain their existing meaning. The direct OpenAI route sends a declared reasoning effort and does not request visible summaries; its encrypted reasoning items are replayed between tool rounds independently of the thinking indicator.

AIProviderFactory resolves the selection, validates an API endpoint, reads an API key at the last possible moment and returns AppleIntelligenceProvider, HTTPAIProvider, CodexInstalledProvider or InstalledCLIProvider. A consumer should hold neither settings nor credentials itself. The selection and guardrails overload lets Quick Actions pick its own route and ask for permissive content transformations without a second factory.

AIModelOption.groupedCatalog is the Settings picker catalog for both AI and Quick Actions. Provider sections, ordering and model labels therefore cannot drift between the panes. Each route stores its own complete AIModelSelection, including the selected reasoning effort for installed models and OpenRouter models that offer one.

AppleIntelligenceProvider is the only route whose model is a local process. It builds a Transcript from the turns ahead of the newest user message and streams the rest as the prompt, so a conversation resumes rather than being replayed as one blob. Foundation Models reports the whole answer so far in every snapshot while every other transport speaks in deltas; AppleIntelligenceDelta is the one place that difference lives. Guardrails are a construction parameter rather than a constant: chat writes fresh prose, where the default filter belongs, and a later text-rewrite feature transforms text the reader already wrote, which is what permissiveContentTransformations exists for, so that feature needs no second provider. GenerationError never reaches the transcript as-is; its Context carries a debug description written for a log, so each case maps to a plain sentence instead.

Chat surfaces

Quick AI

The built-in Quick AI launcher command enters AIScreen, and carries a bindable global shortcut (HotKeyAction.command(.quickAI)) that does the same thing from any app; Tab from the launcher is the third way in. Settings → AI holds the recorder and a checkbox for the command's place in launcher search, beside AI Chat's; either shortcut keeps working while its command is hidden, and does nothing at all while the feature is off. The palette search field becomes the single-line composer. The footer pill and Return are one action, activate: Send, or Stop while a response streams; an empty composer sends nothing, so the pill never needs a disabled state. The header's trailing model switcher opens by click or ⌘P, uses the same in-window menu control as Clipboard's type filter and changes the chat route for the next message. For installed routes and OpenRouter models whose catalog reports the capability, it also shows the supported reasoning efforts and changes the chat effort for the next message. Other API routes keep their provider default because their model catalogs expose no portable effort contract. Neither change interrupts a response already streaming; stopping one is the pill's job, so the header never has to fit a third control beside the switcher.

The second footer control is the palette's normal Actions (⌘K) menu. It owns Continue in AI Chat (⌘J; Open AI Chat while the chat is empty), New Chat (⌘N), Chat History (⌘Y) and AI Settings (⌥⌘,), plus Stop Response (⌘.), Regenerate Response (⌘R), Copy Last Response (⇧⌘C) and Remove Attachments when those apply. AIScreen.perform maps each PaletteShortcut to its action. AI Settings takes ⌥⌘, because ⌘, stays the app's own Settings on every screen. Continuing closes the palette and carries the half-typed line into the window's composer with the conversation. Chat History is the palette's own browser over the same saved chats the window's sidebar lists: ↵ opens one in Quick AI, or in the window when the window already holds it, and Continue in AI Chat (⌘J) takes it to the window either way.

AI Chat

The AI Chat command (command:ai-chat-window, HotKeyAction.command(.aiChat)) opens a titled AppWindowController window owned by AIChatCoordinator, autosaved as AIChatWindow, and closes it again when it is already key, the way Escape does. It is built the way Settings is (an AIChatSplitViewController with a native sidebar item, here collapsible, and a unified toolbar whose title is the open chat's), so it takes the system's own sidebar, toolbar and menus rather than the palette's scrim. AIChatWindowChrome owns the toolbar (the sidebar toggle and New Chat as two round buttons at the sidebar's trailing edge, then Find in Chat and Actions alone at the window's), the title, and one key monitor for ⌘V, ⌘B, ⌃⇥ / ⌃⇧⇥, ⌘F, ⌘G / ⇧⌘G, ⌘K and the Actions menu's own chords, and dies with the window.

  • Find in Chat (⌘F): the system's NSSearchToolbarItem, as is. ChatFindState is one per window and steps match by match, not message by message: ChatFindIndex walks each message exactly as the transcript draws it (reasoning folds, every paragraph, list item, code block and table cell, in order) and lists every occurrence as (message, drawn text, index within it). A reply's hidden choices fence never matches. A drawn text is named by its position path (segment, block, item or cell), not its content, so two identical table cells are two matches. An equation draws as one character, so find never matches inside its source. ChatTextHighlight rides the environment into every text a message draws, which marks all its matches in the Mac's find yellow and the current one solid; a clear marker over the current match takes the scroll anchor, so the transcript centres on the word itself.

  • A reply's text is one selectable text view. SwiftUI's Text selects within itself only, so a reply drawn paragraph by paragraph could be dragged across one paragraph at most. ChatMarkdownText draws each text segment into one read-only NSTextView, and ChatMarkdownRenderer builds its single attributed string: lists with hanging indents, quotes, code as NSTextBlocks, tables as an NSTextTable, with find's marks and the citation numbers in it. Its leaf paths are ChatFindIndex.leaves's, which ChatMarkdownTests pins. A code block's NSTextBlock only lays it out: ChatSelectableTextView.drawBackground(in:) draws its box, a continuous rounded rectangle (Theme.Radius.codeBlock) over the block's bounds less its margin (the list or quote indent), because a text block paints only around the glyphs being redrawn and a scroll that redraws just its header strip left that strip bare. The language and Copy sit in that strip, above the code. The text view's tracking area hears the pointer under that strip and under anything floated over the transcript, such as Jump to Latest, and NSTextView would claim an I-beam there; its mouseMoved and cursorUpdate set the arrow unless the window's hit test lands on the text itself. Thinking folds, search and tool rows stay separate views, so a drag spans one segment's text. A fold holding a match opens. A glass counter at the transcript's top edge says "3 of 17" with the same steps as Return / ⇧↩ in the field and ⌘G / ⇧⌘G anywhere. The sidebar's own filter is still there, by click.

  • Math is typeset natively, in that same text. \(…\) and $…$ are inline math, \[…\] and $$…$$ display math. MarkdownMath finds them before Foundation's Markdown parse, which would eat their backslashes. A $ pairs only by Pandoc's rule (hugging its content, no digit after the closer), so "$5 and $10" stays prose, and code spans and \$ are never math. MathNode parses a bounded LaTeX subset: at a command it does not know, past 40 levels of nesting or past 4,000 characters, a formula shows as its source (a display one as a latex code block) rather than as a guess. MathLayoutEngine sets it by TeX's rules in STIX Two Math, which macOS ships, reading sizes, gaps and stretchy glyphs from the font's OpenType MATH table, so no dependency is involved. Each formula is one MathAttachmentCell character carrying its source: selection, citations and find keep their offsets, copying or dragging gives back the LaTeX as written (ChatSelectableTextView.writeSelection), and a formula wider than its line scales down to fit. While a reply streams, MarkdownBlock.parse(_:midStream:) holds back an equation still open at the very end (a display one as a centred, muted …, an inline one withheld), so it neither flashes as source nor jumps from the left to the centre. Only the last segment of a streaming reply is mid-stream, an opener the stream has passed stays visible, and a lone $ is never held back, since it may be a price.

  • Code is coloured by a small lexer, not a dependency. SyntaxHighlighter.tokens(in:language:) (Features/AI/Model/Syntax*.swift, Foundation-only) walks a fenced block's UTF-16 once and returns non-overlapping SyntaxTokens, which ChatMarkdownRenderer paints from Theme.Colors.Syntax. SyntaxLanguage(named:) maps the fence's name and its usual aliases: Swift, JavaScript, TypeScript, Python, Java, Kotlin, C, C++, Objective-C, C#, Go, Rust, Ruby, PHP, Lua, SQL, shell, Dockerfile, JSON, YAML, TOML and INI through one table-driven SyntaxGrammar, and markup, stylesheets and diffs through their own lexers. An unknown language, a fence without one, a block over SyntaxHighlighter.sizeLimit (40,000 UTF-16 units) or a failed reply's note stays plain. A streaming block is re-scanned as it grows, so an unclosed string or comment colours to the end of what has arrived. It is a lexer, not a parser: it never rejects input, so what it cannot classify stays plain.

  • Actions (⌘K): Quick AI's ⌘K menu for a window, on the same chords: Stop Response (⌘.), New Chat (⌘N), Regenerate (⌘R), Copy Last Response (⇧⌘C), Remove Attachments, Find in Chat (⌘F) and AI Settings (⌥⌘,), plus what only a saved chat has: Copy Chat, Pin and Delete. AIChatActionsMenu builds it per open from the chat's state, as an NSMenu hung under the toolbar button whether the click or ⌘K opened it. Escape closes the window; an open menu, active search or rename takes Escape first. The sidebar clears a nonempty filter before a second Escape closes. Closing leaves a reply streaming; the next open follows Opens to, except that a chat holding a draft or staged files is kept.

  • Sidebar (AIChatSidebarView): a filter field over a List of every saved chat, Pinned first and then bucketed by day like Clipboard. The open chat is the selected row; ⌃⇥ / ⌃⇧⇥ open the next or previous one, wrapping, over every saved chat whatever the filter shows. ⌘B shows or hides the sidebar. A new chat has none until its first message saves it, so starting one or leaving an empty one never adds or drops a row under the pointer. A row shows a spinner while its reply streams, else a pin when pinned. Its content fills the whole cell, so hover (a fainter fill in the selection's own shape) never blinks off crossing between rows. The context menu pins, renames in place, copies or exports the chat as Markdown (ChatSession.markdownTranscript), and deletes one or all through DialogController; ⌫ deletes the selected chat the same way. Renaming swaps only the row's title for a field: a ForEach row that is itself an if/else makes the sidebar List diff in quadratic time, which held the main thread for seconds on opening the window and on every selection with a few thousand chats.

  • Transcript: ChatTranscriptView with surface: .window, which drops the palette's edge dissolve and thin scrollbar (both are measured against the palette's bars) and centres the column at aiChatReadingWidth. The last finished reply offers Regenerate beside Copy: AIChatState drops only a trailing reply and asks again with the question and its attachments, of whichever model is selected now.

  • Composer (AIChatDetailView): one pane of untinted Liquid Glass at Radius.dialog, stacked under the transcript rather than floated over it, holding the staged files, the text and one row of controls, the glass on a background layer. The title bar keeps the system's own band, as a native document window's does. Transcript text runs spacing.chatLine apart, both surfaces. ChatComposerTextView is an NSTextView, not a TextEditor: its delegate sees insertNewline: only outside input-method composition, so Return sends and ⇧↩ or ⌥↩ breaks the line without Return ever stealing an IME's confirm. It grows with its text to 15 lines or 30% of the pane's height, whichever is fewer, in whole lines, then scrolls; resizing the window recomputes the cap. The row: a + menu (Attach Files…, an NSOpenPanel; Web Search when the route offers it; the Tools submenu), an accent Search pill while web search is on, whose click turns it off, then the model menu, the reasoning menu (a word with no glyph, always shown, disabled for a model with no efforts, so the row never changes shape), the context ring, the mic while Dictation is on, and Send/Stop. Every control is aiChatComposerControl tall with one aiChatComposerGlyph slot and bare until hovered; Search gives up its word before the model's name truncates. One Attach Files… takes every kind; its help names what this chat's model can read. The gauge is the last reply's contextTokens against the model's window when the route reported one, and ChatSession.historyBytes against Tinycast's history budget otherwise: orange from 80%, red at 100%. Hovering it raises Tinycast's own card (never a popover), drawn inside the transcript's frame at its bottom edge (just above the composer and inside the window whatever its size), and solid under its glass so the transcript cannot show through. ChatContextReport lays it out: tokens in context of the window, input with its cached share, output with its thinking share and cost; then what the next message sends: model, history of budget, messages sent of total, staged files, and whether the system prompt, web search and tools ride along. The model and reasoning menus are this chat's, as Quick AI's header is Quick AI's. Files arrive by ⌘V, a drop anywhere on the pane, or Attach Files…, and all three take the refusals a paste does. The text field takes a file drop itself and hands it to the same attach, since an NSTextView would otherwise type the file's path. The unsent text lives on AIChatState.draft, so it survives closing the window.

  • The composer's mic is Dictation's, and only shown while Dictation is on. A click runs DictationCoordinator.toggle(into:) for this field whatever the shortcut's hold-or-toggle mode or the window's focus; a second click or Return finishes, Escape cancels, and the transcript goes in at the caret, never to the clipboard. With no model installed the click opens Settings → Dictation. The field is a ComposerTextView, an InjectableTextView, so the Dictation shortcut, snippets and Quick Actions write into it in process, as they do into a note. Switching chats or closing the window cancels dictation targeting its composer before the editor is rebound or torn down; a queued transcript cannot land in another chat or a closed editor.

AIChatState turns provider-neutral stream events into one live assistant message. Thinking state is shown without entering the transcript, partial text is preserved on failure, cancellation invalidates the active generation, and only completed assistant messages become context for the next request. Assistant replies render Markdown and LaTeX math; user messages remain literal. A reply keeps streaming while the palette is hidden, the window is closed or showing another chat (the state is AppCore's, not the view's), and is saved when it finishes.

Tool activity persists in message_tools beside message_searches, and ChatMessage.segments interleaves the two by text offset so a reply renders what it did in the order it did it. Offsets tie whenever no text arrived between two of them, so each search and call also takes a sequence (its place among the reply's searches and calls) as it is created, and that breaks the tie. Both tables store it as their position, so no column was added; a chat saved earlier holds each table's own index there, so its ties go by that index and then to the search. Consecutive tool calls render as one run: the latest running call while live, then an expandable count with any failures once done. Text and searches separate runs; a single call keeps its own row. A call loaded still marked running belonged to a process that is gone, so it reads back as failed, the same repair a message left streaming gets.

ChatHistoryStore writes ai-chats.sqlite3 below the bundle-specific Application Support directory. It uses the system SQLite already linked by Tinycast, stores no provider credentials, and repairs a reply left streaming by a prior process into an interrupted failure when loaded.

Palette integration

Two palette modes carry Quick AI, and neither changes the shell's rules:

Mode Screen Body
.ai AIScreen ChatTranscriptView (surface: .palette)
.aiHistory ChatHistoryScreen ChatHistoryList + preview, bucketed by day like Clipboard

Chat History backs out to Quick AI; both are sub-screens, so the header shows the back chevron. Quick AI keeps the command:ai-chat id it shipped with while it was the only chat, so a hotkey, alias or fallback order recorded then still reaches it with nothing migrated; the window's command is the new id. The search field is the composer: Return submits, or stops a streaming response, and the footer pill reads Send ↵ / Stop ↵ to match. The model switcher is a HeaderMenuButton (the active label, glyph and disclosure chevron layered over BarButton), which is also what Clipboard's type filter is now, so the two header menus hover and open identically. Its menu is the palette's fourth OpenMenu case, .topTrailing like the type filter, and it opens on the selected model. Each row leads with the vendor's mark; AIBrand resolves it from a native connection's provider, or for OpenRouter and OpenAI-compatible endpoints from the model id (anthropic/claude-…, deepseek-chat, o4-mini). The marks are ~300 B–2 KB monochrome template SVGs in Assets.xcassets (AIBrand*), thirteen from Simple Icons, Grok and Z.ai from @lobehub/icons and OpenCode drawn after its own, so they tint with the row like a symbol. OpenCode's inner block is the one second tone among them, and is drawn with opacity: the asset compiler drops fill-opacity without a warning. An unrecognised model keeps the generic sparkle. Provenance, the MIT notice and the trademark position are recorded in NOTICE.md; the CC0 on the Simple Icons project does not extend to the brands it depicts. The header's model switcher shows the selected model's mark the same way.

The palette's click-away catcher is mounted permanently and only toggles allowsHitTesting with the open menu. Inserting it on open and removing it on close could strand SwiftUI's hover target on the header button underneath: AppKit kept delivering clicks, but neither the button nor the catcher saw them until an unrelated render or a window exit/re-enter recomputed hover. It dismisses on a DragGesture(minimumDistance: 0) rather than a tap, so a press that drifts a few points still closes the menu, as a native menu's click-away does.

Eight more @MainActor @Observable types join the shared state: AISettingsStore, ChatPresetStore, ChatGPTSubscriptionManager, InstalledAIManager, ChatHistoryStore, AIChatSurfacesState (which owns every live AIChatState), MCPSettingsStore and MCPServerManager. AIChatCoordinator (the window, and every chat action either surface sends) is the nineteenth feature coordinator, MCPCoordinator the twentieth and QuickAICoordinator the twenty-first.

Manual sweep

  • The selected model appears at the right of the composer and truncates without crowding typed text.
  • An @server chip (the tools glyph alone, since the handle is still in the text) or a staged pill follows the typed text with a clear gap, and a long draft stops it right before the model name, the same gap with a reasoning menu and without.
  • Clicking it or pressing ⌘P opens the same anchored menu shape as Clipboard's type filter; arrows, Return and Escape operate the menu without changing the draft.
  • Pressing ⌘P again closes the model menu and returns focus to the composer.
  • Repeatedly clicking either the model switcher or the type filter opens and closes every time, even when the next click lands immediately after dismissal or a few points off the first one.
  • Selecting a model updates the button immediately and the next message reaches that route.
  • Switching while a response streams does not stop or reroute that response; the new model applies to the following message.
  • With no available model, the menu offers Configure AI and opens the AI Settings pane.
  • With Apple Intelligence available and nothing else configured, opening chat or the AI pane leaves the selection reading Apple Intelligence without asking for anything.
  • With it switched off in System Settings, the pane says so and chat says so; neither moves the reader onto a configured API connection. Both the AI pane and the providers panel offer Open System Settings…, which lands on the Apple Intelligence & Siri pane.
  • On a Mac that does not support Apple Intelligence, its toggle in the providers panel reads off and cannot be changed, and no Open System Settings… button appears.
  • Install and sign in to each supported command outside Tinycast, choose one of its discovered models, and confirm Chat and each model-backed Quick Action use it without showing a credential field.
  • Sign out of an installed command, press Check Again, and confirm its models leave both pickers while the stored selection is repaired according to the normal routing rule.
  • On Codex and on the Claude command, with an MCP server enabled, a question answered with a tool shows the same rows the API routes show and the reply continues after them; with MCP off, both routes stream exactly as they did before.
  • With Opens to: Recent Conversation and a five-minute window, Escape out and summon again inside five minutes resumes the transcript; past it, the composer is empty. Quitting and relaunching still reopens the last conversation. A New Conversation is always empty. The AI Chat window does the same, opened from the launcher: close it with half a line typed and open it again, and the line is still there whichever way the setting points.
  • Setting Keep conversations to 7 days drops older unpinned chats from the window's sidebar and shrinks ai-chats.sqlite3; a pinned one stays. Switching AI off, waiting past a boundary and switching back on prunes nothing that was saved before it went off.
  • Ask in Quick AI, press ⌘J while it streams: the window opens on that chat, still streaming, with the unsent line in its composer, and Quick AI is empty on the next summon.
  • In the window, send, then press ⌘N before the reply ends: the old chat keeps its sidebar spinner, finishes, and reopens complete. Rename one, send another turn in it, and the name holds.
  • Ask for the quadratic formula in LaTeX: while the reply streams, its display equation is a centred … that turns into the equation in place; selecting across it and copying pastes its $$…$$ source. A reply that mentions "$5 and $10" keeps both prices as prose, and in a narrow Quick AI a long equation shrinks to fit rather than running off the edge.
  • Return sends, ⇧↩ breaks the line, and a Japanese IME's Return confirms its text without sending.
  • Drop a PDF on the pane with a text-only model selected: the HUD refuses it, as a paste would.
  • A long reply streams with the transcript pinned to its end, through a growing composer, a window resize and the chips arriving; scrolling up stops it at once, and Jump to Latest resumes it.
  • A reasoning fold ends on its last line of text, with no empty stretch under it, in both surfaces.
  • Suggested replies are leading-aligned glass capsules, and wrapped rows start at the same edge. Source chips under a cited reply match them, the number first in its own disc.
  • A failed reply keeps what was written in the normal colour; only the closing note is red.
  • Code blocks have rounded corners, in Dark and Light, and are coloured: ask for a snippet each in Swift, Python, shell, JSON, SQL, a diff and HTML; a diff shows additions green and removals red, and an unlabelled block stays plain. Switching appearance recolours them without a relaunch.
  • Scroll up until only a code block's top edge shows, then a little more: its rounded top and the strip holding its language and Copy draw whole. A code block inside a list starts at the list's indent, with its header over the code.
  • Full screen and a narrow window: a reply, its code blocks, the chips and the composer share the same left and right edges, the user's bubble ends on the right one, and the column grows to aiChatReadingWidth before the gutters widen.
  • Move the pointer across a code block's header and its text: an arrow over the header and its Copy button, an I-beam over the text, with no flicker between them. Jump to Latest, a round arrow button, shows an arrow too while it sits over reply text.
  • Collapse the sidebar with the toolbar button or ⌘B; ⌘N and ⌘Q (Close Window) still work, and ⌘Q with Settings in front closes Settings instead.
  • Escape closes AI Chat with the composer focused, preserving its draft and any streaming reply. Menus and rename fields cancel first; the sidebar clears a nonempty filter, then closes on the next Escape. Find in Chat cancels before a second Escape closes the window.
  • On a fresh install, an empty chat's preset menu offers only Add Chat Preset…, which opens Settings → AI on the Chat Presets section.
  • Add a chat preset with its own model and one tool server switched off, and pick it from an empty chat's preset menu: the composer names the preset, the model and the tools menu match it, and asking "what are your instructions?" quotes the preset. After a relaunch the chat reopens on the same instructions, model and tools.
  • Edit that preset's instructions: the old chat still answers with the old ones; a new one, and an empty chat that had already picked it, gets the new ones. With Send a system prompt off, a preset chat still follows its instructions.
  • In a preset chat, switch a server the preset turned off back on and send. After a relaunch the chat reopens with that server on.
  • Switch an empty chat to Apple Intelligence: the preset menu goes away, and the preset editor's model menu offers no Apple Intelligence.
  • Pick a preset in an empty chat and press ⌘N: the chat goes back to No Preset. Pick it again, close the window and reopen it with Recent Conversation set: the preset is still picked.
  • In an empty chat, pick a preset from the composer menu, then No Preset: the model and tools go back to the defaults. After the first message the menu is a label and cannot be changed.
  • Delete a preset: the dialog asks first, the row leaves Settings and the composer menu, and chats it started keep their instructions.
  • Suites: AIProviderTests (instruction composition and its enable/disable setting, a preset's instructions, ChatPresetStore's validation and unreadable-file refusal, endpoints, request bodies, stream decoding including leading think tags across content and SSE splits, persistence repair, Codex framing, on-device routing, the two MCP launch encodings and the two consent channels, the shown-model and switched-off-route rules, and a tool's override from settings to launch), AIResponsesTests (endpoint routing, native request parts, stream completion and failures, tool continuation, turn budgets and cancellation), OpenCodeMCPTests (bridge authentication, scoped catalog, exact permissions, calls and limits, and an installed turn against the opencode-stub.js peer), OpenCodeCatalogTests (the wait for plugins, sign-in and failure, and that the server always stops), ChatMarkdownTests (selectable replies, find highlights, safe links and native equation layout), SyntaxHighlightTests (every grammar's tokens, language aliases, the size limit, and that every prefix of a streaming block scans in order and inside its own bounds), AIChatTests (ChatSession, MarkdownBlock with its math delimiters, LaTeX subset and mid-stream hold-back, ChatHistoryStore with renames, pins and preset stamps, an empty chat following its preset, AIToolLoopProvider, regenerate, ChatReasoning's display text, the window's open policy and AIChatSurfacesState's one-live-place rule), and AppleIntelligenceTests (status copy, snapshot deltas, transcript assembly and error mapping, plus an optional real generation enabled with TINYCAST_TEST_APPLE_INTELLIGENCE=1 when this Mac can run one), all in the TinycastTests target.

Installed commands

ExecutableLocator finds codex, claude, grok, opencode and agent by asking the account's login shell, so a stale copy in another prefix never shadows the one Terminal runs. zsh, bash and fish are asked in their own syntax, any other shell through zsh, and the answer comes back behind a marker, so an rc or logout file that prints cannot hide it. Only when the shell names no absolute executable does it fall back to the app's PATH, the normal Homebrew and local-bin locations, mise's and asdf's shims and every nvm Node version, newest first, a fallback that can pick a different copy. What a found command runs under is ExecutableLocator.environment: its own folder, /opt/homebrew/bin and /usr/local/bin ahead of the inherited PATH, for every probe, turn, Codex mcp list read and local MCP server: a Finder-launched app's PATH is /usr/bin:/bin:/usr/sbin:/sbin, and an npm or Homebrew CLI is #!/usr/bin/env node, which would find no node on it.

A reader can replace the lookup and add to that environment, per tool, on the tool's Advanced page. The path is used as written, a leading ~ expanded, and never searched for. The variables lie over the app's own before ExecutableLocator.environment builds the PATH, so a reader's PATH is the one the tool's folder is put ahead of. Both reach every spawn: the probes, a CLI turn and the session it deletes afterwards, Claude's title request, and Codex's app-server and its mcp list read. InstalledAIManager and CodexAppServerClient ask for them at each launch through launchSettings, so an edit takes the next one, and AISettingsStore.launchRevisions lets AppCore check again only the tool that was edited (Codex by stopping its server, which restarts on demand). The commands are never installed by Tinycast; Settings links to their own install docs and offers a sign-in command to copy. InstalledAIManager probes Claude, Grok, OpenCode and Cursor off-main, in parallel. Claude's auth status gates an initialize control request, and InstalledAIModel.claudeCatalog builds its model list from the answer. OpenCode answers before its plugins load and its models come from them, so OpenCodeCatalogService runs one private opencode serve --stdio (OpenCodeServer), polls plugin.list until it lists a plugin, then reads model.list. That list is both its auth check and catalog: empty then means signed out, while a server that fails or stays silent for 30 seconds is a failure. Grok's models output is the catalog, but a signed-out CLI still exits 0 and prints that catalog under "You are not authenticated." That banner is the auth check, not the exit status. Cursor's status --format json gates --list-models.

ChatGPTSubscriptionManager retains its historical type name but now owns only the installed Codex app-server lifecycle and discovered account metadata. Production never sets CODEX_HOME, so the server uses the same login and credential store as the user's normal Codex command. Tinycast supplies only a private working directory. The server stops after ten idle minutes, when AI is switched off or when the app terminates, and restarts on demand. Account state, model availability and rate-limit windows come from the supported app-server protocol. A custom Codex provider can report no account and requiresOpenaiAuth: false; Tinycast then loads its models and runs turns without inventing an account or asking for codex login. A missing or true flag still requires sign-in. A running server rereads config.toml at every account/read, but Tinycast keeps what a check found, account or provider, beside the models and rate limits it read with it, until the next check; a turn that finds nothing to run on leaves Codex signed out and stops the server, as a check does.

MCP is the one thing about that server that is fixed at exec: its overrides and its environment both are, so CodexAppServerClient remembers the list it was launched with and relaunches when the next turn wants a different one: a server added or removed, or an OAuth token refreshed. A check is not a turn and keeps whatever is already running. The account survives the relaunch because it was never the process's to begin with. See MCP for what goes on the launch line.

Stdin writes run on a serial queue so a blocked server leaves the UI and request timeouts responsive. Cancelling, timing out or stopping a request releases its queued payload before the write begins. An in-flight frame finishes whole so the following JSON line remains readable.

CodexTurnRunner is the generation half behind CodexInstalledProvider.

It keeps an ephemeral thread per conversation while the helper stays running, preserving the web search context for follow-ups. A successful reply allows the next request to continue that thread only when its prior transcript, model, instructions and web-search permission still match. A regenerated, failed or cancelled reply, a trimmed transcript or a changed configuration starts a fresh thread and injects the supplied user/assistant history. Turns with attachments are not retained, so older attachments still leave the next request. Titles and Quick Actions have no conversation ID and always start fresh. Deleting a chat drops its retained context, and resetting or restarting the helper clears every retained thread.

It streams agent-message deltas, plus item/started for the reasoning and web-search items that feed the bubble's status line. System messages become developer instructions alongside Tinycast's fixed boundary, which permits only enabled web search and the MCP tools an armed turn supplies. Follow-ups use existing sources and search for further detail or verification when needed. Cancellation interrupts the active turn, including one the server has started but not yet named: Stop arms that thread, and whichever of turn/started or the turn/start response names the turn first spends a single turn/interrupt on it.

Web search is thread-scoped config (thread/start.config.web_search, live or disabled) and reasoning effort belongs to turn/start; neither is written to the user's Codex configuration. The developer instructions say whether the model may reach the web so the two cannot disagree. Images go out as image input parts with data URLs, and as input_image when prior turns are injected.

InstalledCLITurnRunner handles Claude, Grok, OpenCode and Cursor behind the same provider protocol. It frames Tinycast's instructions and bounded conversation history as stdin (or a private --prompt-file for Grok, whose CLI requires a path), consumes newline-delimited JSON, and never puts prompt text on the process command line. Claude uses stream JSON, --effort and no session persistence, and takes every turn as one framed stream-json user line. With servers armed it keeps stdin open for the consent channel and closes it on the CLI's own result frame; writes are chained rather than concurrent, because two racing the same pipe would interleave a line. Grok uses streaming-messages-json and --effort, with --deny * so tools cannot run even when the user's Grok config is always-approve; it captures the session id, then calls grok sessions delete. An error result omits result and carries the cause in errors; that text is the failure, not Claude's missing-result fallback. OpenCode runs --standalone with the tinycast agent from its inline configuration, joins a variant to the model as provider/model#variant, and passes --thinking so reasoning reaches the fold. PWD is the workspace, because run takes its directory from it ahead of the real one. Its JSON stream has no closing line, so its turn finishes on a clean exit once stdout has closed; it captures the session identifier, then calls opencode session delete --standalone. Cursor runs ask mode with --trust, stream-json and --stream-partial-output, never --force / --yolo / --approve-mcps, then removes the local chat under ~/.cursor/chats/<workspace>/<session_id> because the CLI has no delete-chat. Every other turn finishes on its own completion frame; the cleanups run detached after the child exits, so housekeeping never holds the composer shut. Cancellation terminates the child process; only one installed-CLI turn can own a runner at a time.

For OpenCode chat tools, AIChatCoordinator supplies an AIToolSession rather than a second AIToolLoopProvider. OpenCodeMCPBridge binds an ephemeral IPv4 loopback port for that turn and requires a random bearer credential carried only in OPENCODE_CONFIG_CONTENT. It rejects browser origins and offers only initialize, ping, tool listing and tool calls. Short indexed aliases keep OpenCode's prefixed tool names under provider limits while retaining the original tool routing and transcript labels. Calls run serially through Tinycast so permission dialogs cannot compete. The reader's round setting caps calls, and the normal tool-result size budgets still apply. Completion, failure and cancellation stop the listener and its pending calls. Rewrites and title requests get no tool session and retain the deny-all configuration.

Plan usage in the menu bar

Settings → AI → Usage → Show usage in menu bar (aiUsageMenuBar, off by default, and off with AI) adds a status item owned by PlanUsageCoordinator. Its gauge is a ring around the provider's mark, filled to one window: the fullest by default, or the one picked under Show in Menu Bar. The pick is menu state in UserDefaults (aiUsageMenuBarPin), not a preference, and a picked window that is gone leaves the gauge on the fullest. The ring is a template image while every limit is comfortable and turns orange at 80% and red at 95%, the same PlanUsage.Level that colours each meter.

The menu is a native NSMenu: a hosted PlanUsageSection per provider (mark, plan, and per window a meter with the share used, the countdown and the clock time of the reset), then native items. Each meter carries a pace mark at the share of the window already gone, so fill past it is use ahead of pace; once a tenth of the window has passed, a window on course to run out before its reset says when. Reset ChatGPT Limits… appears when Codex identifies an available credit. Tinycast confirms that credit through DialogController and verifies it is still available on the server that redeems it.

PlanUsageMonitor reads every ready provider every three minutes, again when the menu opens (no provider more than once in 30 seconds), when a provider finishes its check or is switched off, and on wake; it stops polling while the Mac sleeps. A failed read keeps the last numbers and says Couldn't refresh; numbers older than fifteen minutes say how old. Claude is read again when a chat reply on Claude lands, and Codex hands over what each turn read. Older reads cannot replace newer results, and a forced refresh requested during a read runs as soon as it completes. Nothing is cached on disk. The first read takes about a second.

Usage alerts (aiUsageAlerts, on by default) shows a HUD when a window crosses 80% or 95%, and when one that was at least 80% falls below half of where it was, which only a reset does. PlanUsageAlertPolicy compares one read with the one before it, so a limit already high at launch stays quiet, and each refresh earns one notice at most, the most severe.

PlanUsageTests covers both providers' replies, reset credits, window thresholds and pace, pinning, alerts, display text and the order of overlapping reads.

Usage sweep

  • With Show usage in menu bar on and Claude or Codex ready, the gauge appears within a second of launch, its ring and mark ink like the neighbouring items on a light and a dark menu bar, and its tooltip names the window it follows.
  • The usage menu's sections line up with the native items below them, and its meters' pace marks sit inside the meter's height on both appearances.
  • Picking a window under Show in Menu Bar moves the gauge to it; switching that provider off in Providers moves the gauge back to the fullest remaining window.

Web search and attachments

AIRequest.webSearch, AIMessage.images and AIMessage.documents are provider-neutral; each route maps them itself:

A text-ish file is deliberately absent from this table: it is inlined as text before any transport sees the turn, so every route (the on-device model and all installed CLI transports included) takes one with no transport code at all.

Route Web search Images PDFs MCP tools
Apple Intelligence never: it reaches nothing never: the model is text-only never never
Codex thread-scoped web_search config image input part never: the app-server takes no document part Tinycast's servers, added as launch overrides; the reader's own are disabled by name
Claude command never base64 image block in its stream-json user message never Tinycast's servers, through --strict-mcp-config and a private config file: an empty one when there are none, and neither flag under a managed MCP policy
Grok command never never never the global config still loads; --deny * refuses the call
OpenCode command never a private file per picture, through --file, only for models whose catalog lists image input never selected Tinycast tools through a per-turn authenticated loopback bridge; all other tools denied
Cursor command never never never the global config still loads; ask mode and withheld approval refuse the call
OpenRouter plugins: [{id: "web"}] (OpenRouter's own layer, any model) image_url part, only for models whose catalog lists the image modality never yet: its catalog publishes a file modality Tinycast does not read tools + role: "tool" turns
OpenAI the hosted web_search tool on the Responses route, never on a gateway image_url part, assumed supported file part with filename and a file_data data URL tools + role: "tool" turns
Gemini / compatible not offered image_url part, assumed supported never: a gateway that has not implemented the part bills the upload before rejecting it tools + role: "tool" turns; a call's extra_content.google.thought_signature goes back unchanged, or Gemini 3 rejects the next turn
Anthropic the web_search_20250305 server tool, five searches a turn, at api.anthropic.com only base64 image block base64 document block, ahead of the text block tools + tool_use / tool_result blocks

A search is part of the reply, not a status: item/started for a webSearch item appends a ChatSearch to the streaming message pinned at the text length so far, item/completed (or the next text delta, or the turn ending) marks it finished and fills in the query if the start didn't carry it. ChatMessage.segments splits the text around its searches so the transcript renders text, a search row (spinner → globe, "Searching web" → "Searched web · query"), then the rest, in the order it happened. Searches persist in message_searches. OpenRouter's web plugin is invisible to the stream, so it shows none. OpenAI's web_search_call items and Anthropic's server_tool_use / web_search_tool_result blocks map to the same start and finish. Both APIs report citations beside the text (url_citation annotations and citations_delta), so AICitationLinker inlines each as a host-labelled Markdown link after the span it cites, unless the reply already links that page, which is what ChatReferences reads as a source. Gemini's OpenAI-compatible endpoint has no search parameter, so it offers none. An Anthropic pause_turn ends the reply where it paused. The web-search instructions ask for citations linked by the publication's name; the model otherwise labels them "Read more".

AIModelCapabilities says what the footer may offer for the selected model. OpenRouter is the only catalog that reports architecture.input_modalities, so it is the only provider gated on it: Settings records a model into AIConnection.visionModels when it is added from that catalog, and a model added by hand is assumed text-only. A vendor API is assumed to take images; a model that doesn't simply returns the provider's error.

Web search is a Settings → AI toggle, aiWebSearch, off by default: a prompt reaches a search engine only once the user has opted in. It's still excluded from backups: which Mac may send prompts to a search engine is that Mac's call. Nothing guesses at a capability: images ride on what the model's own catalog said, and a vendor API that does not take one simply returns its error. What is gated is only what a route provably cannot carry (a PDF to a text transport), refused at the composer with a HUD naming the reason. AIModelCapabilities.documents is true only for the two HTTP shapes whose bodies Tinycast writes; a gateway that has not implemented the file part would bill the upload before rejecting it, which is why documents are not assumed the way images are. An attachment is never dropped on the way out: answering a question about a document the model never received is the one outcome this must not produce.

In Quick AI attachments arrive by ⌘V; the window also takes a drop and the paperclip. They come in three kinds: an image, a PDF sent as a native document block, and a text-ish file whose contents are inlined as fenced, named text. PaletteWindowController's command-shortcut hook gives chat the chord first; a pasteboard holding file URLs or a bare image (a screenshot) stages them, while anything else carrying text falls through to the field editor as a normal paste. Only isFileURL URLs are read: without that filter a copied https://…/a.png reaches Data(contentsOf:), turning a keystroke into a network request. Every file is sized before it is read, so a huge CSV can never be slurped into memory.

A text file is inlined by ChatSession.boundedContext, never into ChatMessage.text. That seam is load-bearing: ChatSession.title summarises the first user message, so folding a CSV into the stored text would make the dump the conversation's title in the AI Chat sidebar, its preview, and what the user bubble renders back. Inlining after the transcript and before the transport also means only the newest turn carries it, so a chat's payload cannot grow turn on turn. The block names the file and fences it with a run longer than any inside it, so a Markdown file holding its own fence cannot escape; a staged name is stripped of newlines and capped, so a file called a\nAttached file: passwd cannot forge a second header. Undecodable bytes are refused rather than guessed at, and a file past AIAttachmentBudget.maxInlinedTextBytes is refused rather than truncated: a silently truncated CSV is a lie the model then answers confidently.

AIAttachmentPolicy is the one place deciding what may be attached and as what. It is pure and Foundation-only, so AIChatTests pins it. It uses extension allowlists rather than UTType.conforms(to:): a machine's installed apps declare types, so a conformance answer differs between two Macs and would make a test machine-dependent, the exact environment coupling Model/ exists to keep out. Adding a type is a one-line change; a type answer that differs per Mac is a bug you cannot reproduce. Images are re-encoded to PNG and bounded to 1568px on the long edge, off-main on a detached task so a display-sized screenshot does not decode on the keystroke; one past AIAttachmentBudget is refused with a HUD instead of being staged. Because that decode outlives the keystroke, it shares the staged images' lifetime exactly: whatever consumes or clears them (a send, a new chat, Remove Attachments, or leaving the conversation for another in the window) disowns one still in flight and says so, rather than letting it surface on a later message. The counter that decides this sits on AIChatState beside the staged images, so a route that drops them cannot forget to move it. Staged attachments share one pill beside the typed text: the newest one's kind as a glyph (a photo, a PDF, a text file) and +N for the rest, because the strip's width is taken out of the search field and a named pill per file left too little room to read what you are typing. The names are a hover away, one per line, and clicking the pill opens a header menu listing every file, an image by its own thumbnail, with its ✕, so a mispaste is taken back without clearing the rest; ⌘K → Remove Attachments and bare backspace stay as the bulk and last-one routes. A row runs by its index, so the open menu is re-laid whenever the staged list changes and closes once it empties; left stale, a file decoded under it would shift the rows, and clicking Remove All would take back only that file. The menu's thumbnail is the ~1 KB PNG downsampled on the same detached task that encodes the attachment and carried on the staged attachment itself, decoded once per row, so there is no cache whose lifetime could drift from the staging counter's. The strip states its own width (AttachmentsPill.width(for:), the @ chip's, and every gap it lays out, the one between the two chips included), which RootPaletteView.searchFieldWidth(for:) subtracts from the search field, so they must move together or the caret drifts. Pills ride the same headerAccessory the launcher's argument fields use, so the field shrinks to its text and the chip follows it rather than the composer growing. Nothing is reserved for the model menu: the row itself squeezes a long draft, so the strip stops right before that menu however wide its title is. Bare backspace on an empty composer removes the last chip before it backs out of chat; ⌘K → Remove Attachments clears them all. Sent images persist in message_images and sent PDFs in message_documents beside their message; the bubble renders images as thumbnails and documents as named chips. A text file is already in the message's text and needs no table. The schema is CREATE TABLE IF NOT EXISTS re-applied on every open, so the table needed no migration, and its ON DELETE CASCADE leaves prune unchanged.

The switcher's glyph comes from the selection. Codex uses OpenAI's mark; Claude and Grok use their own marks; OpenCode resolves a brand from the model id or falls back to a sparkle; Cursor uses an SF Symbol; an API model resolves through its connection. It never depends on modelOptions, which for Codex is empty until the app-server has answered model/list; opening the chat on a Codex model warms that list so the title is the display name from the first frame. Tab hands Quick AI on to the clipboard, and Escape on an empty composer takes its own back step: to whatever opened it, or out of the palette when its hotkey did; either way the unsent draft is dropped rather than carried into a field that would search it. History is pushed over Quick AI and pops back to it, and Tab carries its query to the launcher because there the field really is a search. Neither exit touches the conversation: it lives on AIChatState, so Tab away and back resumes the same transcript.

The model switcher is fixedSize with its title shortened in AIChatCoordinator (26 characters, middle ellipsis) rather than truncated by layout: a flexible label claimed the row up to its max width and clipped the search field well short of the button.

Chat presets

A preset is a name, a glyph, instructions, an optional model (nil follows AI Chat's default) and a ChatToolScope. ChatPresetStore keeps them as chat-presets.json in Application Support, ordered by createdAt, under the same rules as CustomQuickActionStore: name and instructions must be non-empty, a write lands on disk before the list moves, and a file that will not decode makes every mutation refuse rather than write over it.

Settings → AI → Chat Presets lists them; the pencil opens ChatPresetEditorPanel and the trash asks through a confirmationDialog first. Chats a deleted preset started keep their stamp.

A preset is picked only from the composer's preset menu, beside +, while the chat has no message, never from the launcher, a shortcut or a deep link. The menu offers No Preset, every preset and Manage Presets…; with none saved it offers only Add Chat Preset…, which reveals the Settings section. Once the first message is sent the menu becomes a plain label naming the chat's preset. Neither shows while the chat's route is Apple Intelligence.

A plain chat started after a preset chat, in the same state, goes back to every tool server on. ⌘N in an empty chat drops the preset picked in it, and the window's open policy never replaces an empty chat that has one. Presets live outside UserDefaults and so never travel in a settings backup or settings.json, for the reason the system prompt stays out of backups: standing instructions must not arrive on another Mac unread. iCloud Sync is the exception the user turns on: presets, the system prompt, chats and their retention reach only that user's own Macs, and a chat's attachments stay on the Mac they were added on.

Settings and backup boundary

Settings → AI is a normal grouped Form inside Tinycast's existing Settings window. Its top AI section owns the feature switch and the Providers → Manage… action, and Default model below it picks the app-wide route and its reasoning effort. A pick in Quick AI's header or the AI Chat composer sets that chat's model and moves this default with it, while Quick Actions keeps its own model selection.

Provider management opens as an editor panel laid out like Mail's Accounts: every route in a list on the left (On This Mac, Installed, API Connections), each with its mark and a one-line state, and the selected one's detail on the right. + under the list is a menu of the five connection presets and − removes the selected connection; an installed tool cannot be removed, only switched off, from the switch in its detail header. The detail has pages behind a segmented control (AIProviderTab), and the chosen page is kept from one provider to the next:

  • Overview reports an installed tool as checking, ready, sign-in required, missing or failed, with the account, Codex's usage windows and the command that ran. It never contains a credential field: installation and sign-in happen in each command's own flow. For a connection it shows the provider, base URL, whether a key is stored and whether request headers are; Edit… in the header opens the connection editor, which remains the explicit Keychain-backed path.
  • Models is the checklist behind the second invariant above, with Show All, Hide All and a filter once a route offers more than eight. The rows are an NSTableView in one Form row (AIModelChecklist): a Form realizes every row it holds, and OpenCode offers over four hundred.
  • Advanced, on an installed tool only, holds the command path and the variables, saved as each field is left. It stays while the tool is off, so a wrong path can be fixed before it is switched on. A name Tinycast sets itself says its value is not used.

An API connection has the first two pages, and the on-device model, with one, shows no control. The panel draws its Liquid Glass behind its content rather than around it (settingsEditorPanelSurface(controlsOnGlass: false)), because the page control sits directly on the surface and a segmented control drawn on glass loses its accent colour.

The signed-in Codex or Claude address is the one thing on the pane that names a person, and a Settings pane is what gets screenshotted into a bug report or left on screen in a recording, so RedactedText shows it scrambled and blurred until it is clicked. RedactedPlaceholder derives the stand-in from the address itself (stable across redraws, same length, @ . - _ left in place) because a blurred real address can be recovered from a still frame while a blurred fake one cannot. It hides an address from a camera, not a secret from an attacker: the length still shows and one click undoes it. The scramble is not selectable, since dragging it out would only ever yield the stand-in.

The System prompt box appends to the preamble rather than replacing it, so the model never loses the ground truth about where it is. SystemPromptEditor opens blurred and non-editable whenever it already holds something (a Settings pane is exactly what ends up in a screenshot or a stream), and opens plain when it is empty, since a blurred empty box is only a puzzle. The footer says the text rides along on every turn, because it is billed on every turn and nothing else in the pane is.

Send a system prompt governs the whole instruction, not just the half the user typed. Clearing the box already withholds their own text, so a switch that spared the preamble would add nothing; the preamble is the part that is billed on every turn for every user and has no other way off. Off disables the editor rather than hiding it, so what is being withheld stays readable. One thing it deliberately cannot reach: every installed CLI route prepends its own instruction never to run commands or touch files, and never to invoke a tool beyond the MCP tools an armed Codex or Claude turn supplies. That is a sandbox boundary on a local CLI, not Tinycast describing itself, and a user switch must not be able to lift it. An armed turn's instruction lets those MCP tools do anything they offer, commands and files included: the CLI's own tools are already off by flag and every call passes consent, so forbidding it there would only make the model refuse a server the user chose.

mcpEnabled and mcpServers are excluded for the reasons in mcp.md. aiConnections, aiDefaultModel, aiSystemPrompt and aiSystemPromptEnabled are deliberately excluded from settings backups. The first is meaningless without machine-local Keychain items; the second names an external destination and must not silently redirect AI traffic after an import; the last two are standing instructions and the switch that sends them, both of which change every answer and must not arrive on another Mac unread. aiRetention, aiOpensTo and aiNewChatAfter join them: all three are decisions about conversations that never leave the Mac that had them, and an import must not arrive carrying an instruction to delete them. aiToolRounds stays behind too: it limits what a tool-driven reply may spend, and an import must not raise that unasked. aiUsageMenuBar and aiUsageAlerts stay behind as well: they read the commands signed in on this Mac, and no other AI setting travels. aiShownModels and aiDisabledRoutes name this Mac's own tools, connections and their models, which another Mac may not have. aiInstalledOverrides names a command to run and the variables to run it with, and an import must never decide which program a Mac launches. None of the three has a settings.json key, for the same reasons: they are machine state, and the last grants a capability.