Upgrade Swift to 0.7
Every breaking change in `CosmoAI` 0.7.0, with the replacement for each.
Breaking changes when moving CosmoAI from v0.6.0 to v0.7.0. The changelog has the full release notes; more than one version behind, chain the pages.
-
ModelOptions.groknow carriessilenceDurationMsandprefixPaddingMs, both defaulted tonil. Spell the untuned case.grok()— a bare.grokno longer typechecks as a value. -
Sessions now start through an agent, matching the Python and TypeScript SDKs.
RealtimeSession.start(_:config:micMuted:rpcHandlers:)andclient.start(config:)are removed, as is directRealtimeAgent(...)construction — build the agent withclient.agent(...)orclient.catalogAgent(_:inputs:)and open the run withagent.start(...).Before:
let config = SessionConfig(instructions: "You are a helpful assistant.") let session = try await client.start(config: config)After:
let agent = try client.agent(instructions: "You are a helpful assistant.") let session = try await agent.start()The full signatures, every parameter defaulted:
client.agent(instructions:model:modelOptions:voice:audio:tools:interruptionSensitivity:greeting:skills:mcp:hooks:),client.catalogAgent(_:inputs:voice:tools:mcp:hooks:), andagent.start(resumeSessionId:maxSessionSeconds:storeRecording:storeAudio:storeTranscript:storeVideo:micMuted:rpcHandlers:). -
SessionConfigis removed, its fields split by scope:- Agent-scoped (instructions, model,
modelOptions, voice, audio, tools,interruptionSensitivity, greeting, hooks) → parameters ofclient.agent(...). - A catalog run's
agentName/agentInputs→client.catalogAgent(name, inputs:). - Per-run (
resumeSessionId,maxSessionSeconds,storeRecording,storeAudio,storeTranscript,storeVideo, plusmicMutedandrpcHandlers) → parameters ofagent.start(...).
- Agent-scoped (instructions, model,
-
SessionConfig's nested types are now top level; cases and fields are unchanged — only the spelling of the type names moves:SessionConfig.Tool→AgentTool(andSessionConfig.sdkToolNamePrefix→AgentTool.sdkToolNamePrefix)SessionConfig.Voice→VoiceConfigSessionConfig.Audio→AudioConfigSessionConfig.Ambience→AmbienceConfigSessionConfig.ModelOptions→ModelOptions, with the turn-detection enums nested there (ModelOptions.GeminiTurnDetection,ModelOptions.OpenAITurnDetection)- The enum aliases
InterruptionSensitivity,ThinkingLevel,EndOfSpeechSensitivity,SemanticEagerness, andTurnDetectionModeare top level under the same names.
-
RealtimeSession.Options→RealtimeClient.Options, unchanged in shape: the credential is client-level configuration, not per-session. -
RealtimeSession.installConnectTracing()→RealtimeClient.installConnectTracing().RealtimeSession.setRecordingAlwaysPrepared(_:)is no longer public —MicPrewarmCoordinator.set(_:)/.settle()remain the supported mic-prewarm entry points. -
RealtimeAgent's fields andRealtimeClient.Options' fields are nowlet: an agent and a client's options are configured entirely at creation. Code that mutated a field after construction passes the value toclient.agent(...)/catalogAgent(...)or theOptionsinitializer instead. -
The pre-cutover event and error types are removed:
Ready,Transcript,ToolCall,ToolResult,ToolInvocation,Role,ServerError,VoiceClientError, andConnectionCloseReason. Sessions surface events as theRealtimeSession.Eventenum viasession.events—Ready→.ready(RealtimeSession.Ready),Transcript→.transcript(RealtimeSession.TranscriptDelta)(fieldsisFinal,role,text),ToolCall→.toolCall(RealtimeSession.ToolCall),ToolResult→.toolResult(RealtimeSession.ToolResult),ToolInvocation→.toolInvocation(RealtimeSession.ToolInvocation)— and failures throwRealtimeSessionError; code still holding the other removed payload shapes should declare its own copies.