Repository navigation
This release makes connection problems visible and recoverable, moves file storage to temporary media that belong to a conversation thread, and removes the retired push-device APIs.
Breaking changes. Several calls now throw, and storage needs a thread ID. Swift Package Manager installs this version automatically for apps that depend on
from: "1.0.2", so read Upgrading before you update.
Highlights
- Connection failures you can handle. The new
connectionFailedevent delivers aConnectionErrorwith a readablemessage, acodeand the HTTPstatuswhen there is one. The ADK then stops reconnecting until you callconnect()again. connect()tells you when it fails. It returns once ART has accepted the connection, and throws aConnectionErrorsuch asAUTHENTICATION_FAILEDorCONNECTION_TIMEOUTwhen it can't connect.AdkConfig.connectionTimeoutMs(default 30 seconds) sets how long it waits.- Agent runs end when the connection fails. The run ends with an
AgentErrorwhose details havesource: connection, so your app doesn't wait forever. - Rejected credentials stop reconnecting. The new
authenticationFailedevent fires, and sign-in rejections throwAuthHttpErrorwith the HTTP status. - No hidden resends. Messages are never queued for later: without a connection,
pushandrunthrow and nothing is sent. Encrypted channels now wait for ART to confirm delivery, like targeted channels. - Files belong to a conversation thread. Uploads, lists and
getFiletake a thread ID, which threaduploadandlistFilesfill in for you. Attach files to a message withMediaRef. - Also new:
AgentThread.dispose(), execution origin for runs started from the ART playground,multipart/form-datarequests withFormDataPayload, andNotificationChannelvalues for notification delivery. Theopenevent now fires only once the WebSocket is really open, and the ADK falls back to server-sent events if it can't open.
Upgrading
- Write
try await adk.connect()andtry await adk.resume(), and handle theConnectionError. - Write
try adk.agent(...)andtry adk.orchestrator(...). Agent and orchestrator IDs must be lowercase slugs, optionally with a build name (my-agent@release2). - Write
try await thread.listen { ... }andtry await thread.listenState { ... }on agent threads. The error tells you why the channel can't be used, for example when ART refuses access to the agent. - Write
try await channel.subscribe()where you call it directly. - Pass a thread ID when you use storage directly:
UploadOptions(threadId:),ListOptions(threadId:)andgetFile(fileId:threadId:). - Replace
FileMeta(file)withMediaRef(file).FileMeta(id:scope:)andscopeare gone: useMediaRef(id:name:contentType:). HandleUploadError.step == .uploadwhere you checked.signedURL,.putor.confirm. - Catch
ConnectionErrorwith the codeACK_TIMEOUTwhere you caughtARTError.ackTimeout. - If you
switchoverARTError, handle the new.invalidArgumentcase or add adefaultcase. - If you implement
IWebsocketHandleror callwait()orsendMessage(_:)on the socket yourself, add the new requirements and handle the errors. - Remove calls to
registerDevice,unregisterDeviceandlistDevices, because ART no longer offers these APIs. Use a notifier configured on a connector instead. - Replace notification channel strings with
NotificationChannelvalues, for examplechannels: [.inApp, .email].
Installation
.package(url: "https://github.com/aiotrixdev/art-swift-adk.git", from: "1.0.3")Full changelog: CHANGELOG.md · 1.0.2...1.0.3