Skip to content

ART Swift ADK 1.0.3

Latest

Choose a tag to compare

@sachin854 sachin854 released this 13 Nov 06:04
ba4b9b0

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 connectionFailed event delivers a ConnectionError with a readable message, a code and the HTTP status when there is one. The ADK then stops reconnecting until you call connect() again.
  • connect() tells you when it fails. It returns once ART has accepted the connection, and throws a ConnectionError such as AUTHENTICATION_FAILED or CONNECTION_TIMEOUT when 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 AgentError whose details have source: connection, so your app doesn't wait forever.
  • Rejected credentials stop reconnecting. The new authenticationFailed event fires, and sign-in rejections throw AuthHttpError with the HTTP status.
  • No hidden resends. Messages are never queued for later: without a connection, push and run throw 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 getFile take a thread ID, which thread upload and listFiles fill in for you. Attach files to a message with MediaRef.
  • Also new: AgentThread.dispose(), execution origin for runs started from the ART playground, multipart/form-data requests with FormDataPayload, and NotificationChannel values for notification delivery. The open event 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() and try await adk.resume(), and handle the ConnectionError.
  • Write try adk.agent(...) and try adk.orchestrator(...). Agent and orchestrator IDs must be lowercase slugs, optionally with a build name (my-agent@release2).
  • Write try await thread.listen { ... } and try 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:) and getFile(fileId:threadId:).
  • Replace FileMeta(file) with MediaRef(file). FileMeta(id:scope:) and scope are gone: use MediaRef(id:name:contentType:). Handle UploadError.step == .upload where you checked .signedURL, .put or .confirm.
  • Catch ConnectionError with the code ACK_TIMEOUT where you caught ARTError.ackTimeout.
  • If you switch over ARTError, handle the new .invalidArgument case or add a default case.
  • If you implement IWebsocketHandler or call wait() or sendMessage(_:) on the socket yourself, add the new requirements and handle the errors.
  • Remove calls to registerDevice, unregisterDevice and listDevices, because ART no longer offers these APIs. Use a notifier configured on a connector instead.
  • Replace notification channel strings with NotificationChannel values, for example channels: [.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