diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift index c9dd54d5f23c..84613453228f 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactFailurePresentation.swift @@ -258,6 +258,13 @@ public struct ChatArtifactFailurePresentation: Equatable, Sendable { systemImage: "doc.badge.ellipsis", allowsRetry: false ) + case .unknown(let code): + self = Self( + title: Self.localized("chat.artifact.failure.unknown.title", defaultValue: "Unrecognized file error"), + message: Self.unknownMessage(code: code), + systemImage: "questionmark.circle", + allowsRetry: true + ) } } @@ -291,6 +298,20 @@ public struct ChatArtifactFailurePresentation: Equatable, Sendable { String(localized: key, defaultValue: defaultValue, bundle: .module) } + private static func unknownMessage(code: String?) -> String { + guard let code, !code.isEmpty else { + return localized( + "chat.artifact.failure.unknown.message", + defaultValue: "The Mac reported an error this version of cmux doesn't recognize. Try again, then update cmux on both devices." + ) + } + let format = localized( + "chat.artifact.failure.unknown.coded_message", + defaultValue: "The Mac reported an error this version of cmux doesn't recognize (%@). Try again, then update cmux on both devices." + ) + return String.localizedStringWithFormat(format, code) + } + private static func tooLargeMessage(actualSize: Int64?, limit: Int64) -> String { let limitText = ByteCountFormatter.string(fromByteCount: limit, countStyle: .file) guard let actualSize else { diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift index b0c6afac4676..31afaf54743c 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactInlineViewer.swift @@ -165,6 +165,8 @@ public struct ChatArtifactInlineViewer: View { .chat case .terminal: .terminal + case .panel: + .panel case .workspaceChanges: .workspaceChanges case .unsupported: diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift index a9918cf7d0f0..2776b6372bb1 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Artifacts/ChatArtifactViewerModel.swift @@ -339,7 +339,7 @@ final class ChatArtifactViewerModel { await temporaryFileStore.remove(temporaryFileURL) } - private static func state( + static func state( for error: any Error, stat: ChatArtifactStat? ) -> ChatArtifactViewerState { diff --git a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings index febcf4b84000..e27cea8391d3 100644 --- a/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings +++ b/Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Resources/Localizable.xcstrings @@ -330,6 +330,27 @@ "ja": { "stringUnit": { "state": "translated", "value": "転送が中断されました" } } } }, + "chat.artifact.failure.unknown.coded_message": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", "value": "The Mac reported an error this version of cmux doesn't recognize (%@). Try again, then update cmux on both devices." } }, + "ja": { "stringUnit": { "state": "translated", "value": "Macがこのバージョンのcmuxでは認識できないエラーを報告しました(%@)。もう一度お試しのうえ、両方のデバイスでcmuxをアップデートしてください。" } } + } + }, + "chat.artifact.failure.unknown.message": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", "value": "The Mac reported an error this version of cmux doesn't recognize. Try again, then update cmux on both devices." } }, + "ja": { "stringUnit": { "state": "translated", "value": "Macがこのバージョンのcmuxでは認識できないエラーを報告しました。もう一度お試しのうえ、両方のデバイスでcmuxをアップデートしてください。" } } + } + }, + "chat.artifact.failure.unknown.title": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", "value": "Unrecognized file error" } }, + "ja": { "stringUnit": { "state": "translated", "value": "認識できないファイルエラー" } } + } + }, "chat.artifact.failure.unsupported.message": { "extractionState": "manual", "localizations": { diff --git a/Packages/iOS/CmuxAgentChatUI/Tests/CmuxAgentChatUITests/ChatArtifactFailurePresentationTests.swift b/Packages/iOS/CmuxAgentChatUI/Tests/CmuxAgentChatUITests/ChatArtifactFailurePresentationTests.swift index 03f57c2fb10a..e883962eae21 100644 --- a/Packages/iOS/CmuxAgentChatUI/Tests/CmuxAgentChatUITests/ChatArtifactFailurePresentationTests.swift +++ b/Packages/iOS/CmuxAgentChatUI/Tests/CmuxAgentChatUITests/ChatArtifactFailurePresentationTests.swift @@ -43,6 +43,8 @@ struct ChatArtifactFailurePresentationTests { (.localStorageUnavailable, "Local storage unavailable", true), (.loadFailed, "Couldn't load file", true), (.tooLarge(limitBytes: 1_024), "File too large to preview", false), + (.unknown(code: "future_error"), "Unrecognized file error", true), + (.unknown(code: nil), "Unrecognized file error", true), ] #expect(unreachable.title == "Mac unreachable")