diff --git a/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualHost.swift b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualHost.swift new file mode 100644 index 000000000000..f25a180a8a45 --- /dev/null +++ b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualHost.swift @@ -0,0 +1,48 @@ +import Foundation + +/// A normalized user-entered host for explicit manual mobile pairing routes. +/// +/// Manual hosts are DNS names or IP literals that a user deliberately chooses +/// outside automatic Tailscale discovery. The value is only a host, never a URL: +/// schemes, paths, query/fragment markers, user-info markers, bare colon host +/// text, non-QR-safe characters, whitespace, and control characters are rejected +/// before the host is advertised or dialed. +public struct CmxManualHost: Equatable, Sendable { + /// The normalized bare host, with IPv6 brackets removed when present. + public let rawValue: String + + /// Whether this host may be published as a remote manual pairing route. + /// + /// Loopback names the publishing machine itself, so advertising it to a + /// phone would make the phone dial its own local process instead of the Mac. + public var isAdvertisable: Bool { + !CmxLoopbackHost().matches(rawValue) + } + + /// Creates a normalized manual host. + /// + /// - Parameter rawHost: A DNS name or IP literal. IPv6 literals must be + /// bracketed (`[fd00::1]`) so ordinary hostnames cannot hide colons. + public init?(_ rawHost: String) { + guard let host = CmxManualHostParser( + rawHost: rawHost, + acceptsBareIPv6: false + ).normalizedHost else { return nil } + self.rawValue = host + } + + /// Creates a manual host from attach-route endpoint form. + /// + /// User-entered IPv6 must be bracketed so a typo like `my:host` is rejected + /// up front. Attach routes store IPv6 without brackets, so route/reconnect + /// paths use this initializer when they are validating an already-normalized + /// endpoint host. + /// - Parameter rawHost: A DNS name, IP literal, or already-normalized bare IPv6 endpoint host. + public init?(routeHost rawHost: String) { + guard let host = CmxManualHostParser( + rawHost: rawHost, + acceptsBareIPv6: true + ).normalizedHost else { return nil } + self.rawValue = host + } +} diff --git a/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualHostParser.swift b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualHostParser.swift new file mode 100644 index 000000000000..589a26883050 --- /dev/null +++ b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualHostParser.swift @@ -0,0 +1,59 @@ +import Darwin +import Foundation + +struct CmxManualHostParser { + let rawHost: String + let acceptsBareIPv6: Bool + + var normalizedHost: String? { + let trimmed = rawHost.trimmingCharacters(in: .whitespacesAndNewlines) + guard !trimmed.isEmpty else { + return nil + } + + let host: String + let isBracketedHost: Bool + if trimmed.hasPrefix("[") || trimmed.hasSuffix("]") { + guard trimmed.hasPrefix("["), + trimmed.hasSuffix("]"), + trimmed.count > 2 else { + return nil + } + host = String(trimmed.dropFirst().dropLast()) + isBracketedHost = true + } else { + host = trimmed + isBracketedHost = false + } + + guard !host.isEmpty, + host.rangeOfCharacter(from: .whitespacesAndNewlines) == nil, + host.rangeOfCharacter(from: .controlCharacters) == nil, + host.range(of: "://") == nil else { + return nil + } + if isBracketedHost || acceptsBareIPv6, isIPv6Literal(host) { + return host + } + guard !isBracketedHost, isUnbracketedQRHost(host) else { + return nil + } + return host + } + + private func isUnbracketedQRHost(_ host: String) -> Bool { + host.utf8.allSatisfy { byte in + (48...57).contains(byte) // 0-9 + || (65...90).contains(byte) // A-Z + || (97...122).contains(byte) // a-z + || byte == UInt8(ascii: ".") + || byte == UInt8(ascii: "-") + || byte == UInt8(ascii: "_") + } + } + + private func isIPv6Literal(_ host: String) -> Bool { + var address = in6_addr() + return host.withCString { inet_pton(AF_INET6, $0, &address) } == 1 + } +} diff --git a/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualPairingEntry.swift b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualPairingEntry.swift index ba26f2786e64..e5ff42e88f99 100644 --- a/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualPairingEntry.swift +++ b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxManualPairingEntry.swift @@ -16,6 +16,17 @@ public struct CmxManualPairingEntry: Equatable, Sendable { /// The port the user types into the phone's port field. public let port: Int + /// The host value copied into the phone's manual-entry field. + /// + /// IPv6 endpoint hosts are stored bare in attach routes, but the iOS manual + /// host parser requires brackets so the host/port boundary stays + /// unambiguous. + public var hostFieldValue: String { + host.contains(":") && !(host.hasPrefix("[") && host.hasSuffix("]")) + ? "[\(host)]" + : host + } + /// Creates a manual-entry pair. /// - Parameters: /// - host: The address for the phone's host field. diff --git a/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxPairingQRCode.swift b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxPairingQRCode.swift index 64618468c23e..d431e7c082b7 100644 --- a/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxPairingQRCode.swift +++ b/Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/CmxPairingQRCode.swift @@ -1,9 +1,10 @@ import Foundation /// The minimal pairing-QR grammar: expected Mac account/build metadata plus -/// plain `host:port` routes in the URL query. +/// explicit `host:port` routes in the URL query. /// -/// `cmux-ios://attach?v=2&ub=&pc=&av=&ab=&r=:[&r=:...]` +/// `cmux-ios://attach?v=2&ub=&pc=&av=&ab=&r=:` +/// `cmux-ios://attach?v=3&ub=&pc=&av=&ab=&r=:[&m=:]` /// /// A pairing QR needs to tell the phone where to dial and which non-secret /// account/build context to check before dialing. The account value is the @@ -17,16 +18,17 @@ import Foundation /// - **No display name, no device id.** Both arrive post-handshake from /// `mobile.host.status`; the decoder leaves `macDeviceID` empty and the /// shell adopts the host-reported identity once connected. -/// - **No loopback, ever.** Routes are Tailscale `host:port` only: the -/// encoder drops a DEBUG Mac's dev loopback route instead of encoding it, -/// the Mac refuses to mint a QR without a Tailscale route (it shows the -/// set-up-Tailscale guidance instead), and the decoder rejects loopback -/// hosts outright, so a scanned code can never point a phone at itself. +/// - **No loopback, ever.** The encoder drops a DEBUG Mac's dev loopback route +/// instead of encoding it, and the decoder rejects loopback hosts outright, +/// so a scanned code can never point a phone at itself. /// Loopback pairing for the simulator/dev flows uses the injected attach /// URL path, not a QR. Dropping loopback is also the pairing-latency fix: /// a scanned loopback route sorted first and made the phone dial itself /// into an `NWConnection` `.waiting` black hole for the full request /// timeout before the Tailscale route was ever tried. +/// - **Manual hosts stay explicit.** `m=` carries a user-configured LAN/DNS +/// manual-host route, decoded as ``CmxAttachTransportKind/manualHost`` so +/// the iOS app can require per-host trust before sending Stack credentials. /// /// The payload is deliberately *not* wrapped in base64 JSON: anyone can read /// the URL off the QR and see for themselves that it carries only an address. @@ -40,8 +42,11 @@ import Foundation public struct CmxPairingQRCode: Sendable { /// The grammar version carried in the URL's `v` query item. Distinct from /// ``CmxAttachTicket/currentVersion`` (the ticket *structure* version): - /// `v=1` URLs carry a base64 JSON `payload`, `v=2` URLs carry bare routes. - public static let version = 2 + /// `v=1` URLs carry a base64 JSON `payload`, `v=2` URLs carry bare Tailscale + /// routes, and `v=3` adds explicit manual-host routes. + public static let version = 3 + + private static let tailscaleOnlyRouteVersion = 2 /// Defensive cap on routes accepted from a scanned code. The Mac's route /// resolver emits at most a couple (MagicDNS name + Tailscale IP); a QR @@ -50,15 +55,17 @@ public struct CmxPairingQRCode: Sendable { public static let maximumRouteCount = 8 /// Creates the codec. It is stateless: construct one inline at the call - /// site; every instance speaks the same grammar version. + /// site; every instance speaks the same grammar set. public init() {} - /// Encode `ticket` as a v2 pairing URL, or `nil` when the ticket does not + /// Encode `ticket` as a minimal pairing URL, or `nil` when the ticket does not /// qualify (see ``canEncode(_:routeDisclosureMode:)``); callers fall back /// to the compact v1 payload so every ticket still has an attach URL. /// - /// Only the ticket's Tailscale routes are encoded: a DEBUG Mac's dev - /// loopback route is dropped, never written into a scannable code. + /// Only the ticket's Tailscale and explicit manual-host routes are encoded: + /// a DEBUG Mac's dev loopback route is dropped, never written into a + /// scannable code. The caller must explicitly allow legacy private-network + /// disclosure; Iroh identity-only payloads use the compact coder instead. public func encode( _ ticket: CmxAttachTicket, routeDisclosureMode: CmxPairingRouteDisclosureMode @@ -67,7 +74,7 @@ public struct CmxPairingQRCode: Sendable { let routes = encodableRoutes(of: ticket) else { return nil } - var items: [String] = ["v=\(Self.version)"] + var items: [String] = ["v=\(grammarVersion(for: routes))"] if let userID = normalizedNonEmpty(ticket.macUserID) { items.append("ub=\(percentEncodeQueryValue(userID))") } @@ -85,7 +92,7 @@ public struct CmxPairingQRCode: Sendable { // Unreachable: `encodableRoutes` admits host/port endpoints only. return "" } - return "r=\(hostPortString(host: host, port: port))" + return "\(routeQueryName(for: route.kind))=\(hostPortString(host: host, port: port))" } items.append(contentsOf: routeItems) // The scheme is channel-specific (see ``CmxPairingURLScheme``): a dev @@ -95,6 +102,14 @@ public struct CmxPairingQRCode: Sendable { return "\(CmxPairingURLScheme.current)://attach?" + items.joined(separator: "&") } + /// Encodes using the legacy private-network disclosure mode. + /// + /// Kept for source compatibility with callers that predate explicit route + /// disclosure. New call sites should select a disclosure mode explicitly. + public func encode(_ ticket: CmxAttachTicket) -> String? { + encode(ticket, routeDisclosureMode: .legacyPrivateNetworkCompatibility) + } + /// Whether `ticket` is expressible in the minimal grammar under the /// explicitly selected disclosure mode; see ``encodableRoutes(of:)`` for /// the rules. @@ -106,38 +121,47 @@ public struct CmxPairingQRCode: Sendable { && encodableRoutes(of: ticket) != nil } - /// The route subsequence a v2 pairing URL would carry for `ticket`, or + /// Checks expressibility using the legacy private-network disclosure mode. + public func canEncode(_ ticket: CmxAttachTicket) -> Bool { + canEncode(ticket, routeDisclosureMode: .legacyPrivateNetworkCompatibility) + } + + /// The route subsequence a minimal pairing URL would carry for `ticket`, or /// `nil` when the ticket is not expressible in the minimal grammar. /// - /// Expressible means: an unscoped pairing ticket whose Tailscale routes - /// are exactly the canonical `host:port` sequence the decoder - /// resynthesizes (ids `tailscale`, `tailscale_2`, ... and priorities 10, - /// 20, ...), with no loopback host and no host that needs escaping. + /// Expressible means: an unscoped pairing ticket whose Tailscale/manual-host + /// routes are exactly the canonical `host:port` sequence the decoder + /// resynthesizes (ids `tailscale`, `manual_host`, `tailscale_2`, ... and + /// priorities 10, 20, ...), with no loopback host and no host that needs + /// escaping. /// The only routes this grammar may silently drop are loopback ones (a /// DEBUG Mac's dev loopback route), which no phone may ever dial anyway. - /// Anything else (workspace-scoped tickets, custom route ids, no - /// Tailscale route at all, or a non-Tailscale fallback route such as an - /// iroh peer that the bare `host:port` grammar cannot express) keeps the - /// compact v1 payload so the mapping stays lossless. + /// Anything else (workspace-scoped tickets, custom route ids, or a fallback + /// route such as an iroh peer that the bare `host:port` grammar cannot + /// express) keeps the compact v1 payload so the mapping stays lossless. private func encodableRoutes(of ticket: CmxAttachTicket) -> [CmxAttachRoute]? { guard ticket.version == CmxAttachTicket.currentVersion, ticket.workspaceID.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, ticket.terminalID?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty != false else { return nil } - guard ticket.routes.allSatisfy({ $0.kind == .tailscale || CmxLoopbackHost().matches($0) }) else { + guard ticket.routes.allSatisfy({ isMinimalQRRoute($0) || CmxLoopbackHost().matches($0) }) else { return nil } - let routes = ticket.routes.filter { $0.kind == .tailscale } + let routes = ticket.routes.filter { isMinimalQRRoute($0) } guard !routes.isEmpty, routes.count <= Self.maximumRouteCount else { return nil } + var occurrences: [String: Int] = [:] for (index, route) in routes.enumerated() { - guard route.id == synthesizedRouteID(index: index), + let occurrence = occurrences[route.kind.rawValue] ?? 0 + occurrences[route.kind.rawValue] = occurrence + 1 + guard route.id == synthesizedRouteID(kind: route.kind, occurrence: occurrence), route.priority == synthesizedRoutePriority(index: index), case let .hostPort(host, _) = route.endpoint, !CmxLoopbackHost().matches(host), - isPlainHost(host) else { + isPlainHost(host), + route.kind != .manualHost || CmxManualHost(routeHost: host) != nil else { return nil } } @@ -147,7 +171,10 @@ public struct CmxPairingQRCode: Sendable { /// Whether `components` (an already-parsed `cmux-ios://attach` URL) speaks /// this grammar. v1 URLs carry the base64 `payload` item instead. public func isPairingCodeURL(_ components: URLComponents) -> Bool { - components.queryItems?.first(where: { $0.name == "v" })?.value == "\(Self.version)" + guard let version = Self.attachURLVersion(components) else { + return false + } + return (Self.tailscaleOnlyRouteVersion...Self.version).contains(version) } /// The integer grammar version declared by an attach URL's `v` query item, @@ -161,7 +188,7 @@ public struct CmxPairingQRCode: Sendable { return Int(raw) } - /// Whether `rawValue` is a v2 pairing URL. String-level convenience for + /// Whether `rawValue` is a minimal pairing URL. String-level convenience for /// callers that hold the encoded URL (the Mac's pairing window asserting /// the code it is about to display speaks the minimal grammar). public func isPairingCodeURLString(_ rawValue: String) -> Bool { @@ -174,7 +201,7 @@ public struct CmxPairingQRCode: Sendable { return isPairingCodeURL(components) } - /// Decode a v2 pairing URL into a validated ``CmxAttachTicket``. + /// Decode a minimal pairing URL into a validated ``CmxAttachTicket``. /// /// The ticket comes back unscoped with an empty `macDeviceID`; the shell /// recovers the Mac's identity post-handshake from `mobile.host.status`. @@ -184,23 +211,39 @@ public struct CmxPairingQRCode: Sendable { /// when any route names a loopback host (a scanned code must never /// point the phone at itself). public func decode(_ components: URLComponents) throws -> CmxAttachTicket { - guard isPairingCodeURL(components) else { + guard isPairingCodeURL(components), + let version = Self.attachURLVersion(components) else { throw MobileSyncPairingPayloadError.invalidURL } let rawRoutes = (components.queryItems ?? []) - .filter { $0.name == "r" } - .compactMap(\.value) + .compactMap { item -> (kind: CmxAttachTransportKind, value: String)? in + guard let kind = routeKind(forQueryName: item.name), + let value = item.value else { + return nil + } + return (kind, value) + } guard !rawRoutes.isEmpty, rawRoutes.count <= Self.maximumRouteCount else { throw MobileSyncPairingPayloadError.invalidURL } + if version < Self.version, rawRoutes.contains(where: { $0.kind == .manualHost }) { + throw MobileSyncPairingPayloadError.invalidURL + } + var occurrences: [String: Int] = [:] let routes = try rawRoutes.enumerated().map { index, rawRoute -> CmxAttachRoute in - let (host, port) = try parseHostPort(rawRoute) + let occurrence = occurrences[rawRoute.kind.rawValue] ?? 0 + occurrences[rawRoute.kind.rawValue] = occurrence + 1 + let (host, port, isBracketedHost) = try parseHostPort(rawRoute.value) + if rawRoute.kind == .manualHost, + CmxManualHost(isBracketedHost ? "[\(host)]" : host) == nil { + throw MobileSyncPairingPayloadError.invalidURL + } guard !CmxLoopbackHost().matches(host) else { throw MobileSyncPairingPayloadError.loopbackRouteRejected } return try CmxAttachRoute( - id: synthesizedRouteID(index: index), - kind: .tailscale, + id: synthesizedRouteID(kind: rawRoute.kind, occurrence: occurrence), + kind: rawRoute.kind, endpoint: .hostPort(host: host, port: port), priority: synthesizedRoutePriority(index: index) ) @@ -224,12 +267,51 @@ public struct CmxPairingQRCode: Sendable { } } private extension CmxPairingQRCode { - /// The route id the Mac's route resolver mints for the route at `index` - /// (`tailscale` for the first, `tailscale_N` after). - func synthesizedRouteID(index: Int) -> String { - index == 0 - ? CmxAttachTransportKind.tailscale.rawValue - : "\(CmxAttachTransportKind.tailscale.rawValue)_\(index + 1)" + func grammarVersion(for routes: [CmxAttachRoute]) -> Int { + routes.contains(where: { $0.kind == .manualHost }) + ? Self.version + : Self.tailscaleOnlyRouteVersion + } + + /// Whether `route` can be represented by the minimal query grammar. + func isMinimalQRRoute(_ route: CmxAttachRoute) -> Bool { + switch route.kind { + case .tailscale, .manualHost: + return true + case .debugLoopback, .iroh, .websocket: + return false + } + } + + /// The query item name for a minimal route kind. + func routeQueryName(for kind: CmxAttachTransportKind) -> String { + switch kind { + case .tailscale: + return "r" + case .manualHost: + return "m" + case .debugLoopback, .iroh, .websocket: + return "" + } + } + + /// The route kind represented by a minimal route query item name. + func routeKind(forQueryName name: String) -> CmxAttachTransportKind? { + switch name { + case "r": + return .tailscale + case "m": + return .manualHost + default: + return nil + } + } + + /// The route id the Mac's route resolver mints for this kind occurrence. + func synthesizedRouteID(kind: CmxAttachTransportKind, occurrence: Int) -> String { + occurrence == 0 + ? kind.rawValue + : "\(kind.rawValue)_\(occurrence + 1)" } /// The priority the Mac's route resolver assigns the route at `index`. @@ -243,16 +325,18 @@ private extension CmxPairingQRCode { } /// Parse `host:port` (with optional IPv6 brackets) from a query value. - func parseHostPort(_ rawValue: String) throws -> (String, Int) { + func parseHostPort(_ rawValue: String) throws -> (String, Int, Bool) { let trimmed = rawValue.trimmingCharacters(in: .whitespacesAndNewlines) let host: Substring let portText: Substring + let isBracketedHost: Bool if trimmed.hasPrefix("[") { guard let closing = trimmed.firstIndex(of: "]"), closing > trimmed.startIndex else { throw MobileSyncPairingPayloadError.invalidURL } host = trimmed[trimmed.index(after: trimmed.startIndex).. CmxAttachRoute { + try CmxAttachRoute( + id: index == 0 ? "manual_host" : "manual_host_\(index + 1)", + kind: .manualHost, + endpoint: .hostPort(host: host, port: port), + priority: 10 + index * 10 + ) + } + private func pairingTicket(routes: [CmxAttachRoute]) throws -> CmxAttachTicket { // Exactly what the Mac's ticket store mints for the pairing window: // unscoped, with identity/expiry/token fields the QR must NOT carry. @@ -89,6 +102,38 @@ import Testing #expect(decoded.routes.map(\.priority) == [10, 20]) } + @Test func roundTripsManualHostRouteExplicitly() throws { + let route = try manualHostRoute(index: 0, host: "studio-mac.corp.example") + let ticket = try pairingTicket(routes: [route]) + + let url = try #require(CmxPairingQRCode().encode(ticket)) + #expect(url == "\(CmxPairingURLScheme.current)://attach?v=3&m=studio-mac.corp.example:58465") + + let decoded = try CmxPairingQRCode().decode(try components(url)) + #expect(decoded.routes == [route]) + #expect(decoded.routes.first?.kind == .manualHost) + } + + @Test func roundTripsTailscaleAndManualHostRoutesInOrder() throws { + let routes = [ + try tailscaleRoute(index: 0, host: "100.64.0.5"), + try CmxAttachRoute( + id: "manual_host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.4.12", port: 58465), + priority: 20 + ), + ] + let ticket = try pairingTicket(routes: routes) + + let url = try #require(CmxPairingQRCode().encode(ticket)) + #expect(url == "\(CmxPairingURLScheme.current)://attach?v=3&r=100.64.0.5:58465&m=192.168.4.12:58465") + + let decoded = try CmxPairingQRCode().decode(try components(url)) + #expect(decoded.routes == routes) + #expect(decoded.routes.map(\.kind) == [.tailscale, .manualHost]) + } + @Test func roundTripsUserIDAndBuildMetadataWithoutExposingEmail() throws { let ticket = try CmxAttachTicket( workspaceID: "", @@ -135,7 +180,7 @@ import Testing @Test func encodeDropsDevLoopbackRouteFromDebugMacTicket() throws { // A DEBUG Mac's pairing ticket always carries the dev loopback route. - // The QR must encode only the Tailscale routes: a scanned code + // The QR must encode only the Tailscale/manual-host routes: a scanned code // pointing at 127.0.0.1 makes the phone dial itself (and dialing it // first added the whole request timeout to scan-to-pair latency). let loopback = try CmxAttachRoute( @@ -205,6 +250,15 @@ import Testing ]) #expect(encodeLegacy(loopbackTailscale) == nil) + // Manual-host routes must use the same route-host grammar on encode + // that the v3 decoder enforces, otherwise the codec can emit QR URLs + // it later refuses to scan. + let invalidManualHost = try pairingTicket(routes: [ + try manualHostRoute(index: 0, host: "my:host"), + ]) + #expect(CmxPairingQRCode().encode(invalidManualHost) == nil) + #expect(!CmxPairingQRCode().canEncode(invalidManualHost)) + // A non-Tailscale fallback route the bare host:port grammar cannot // express (an iroh peer) must NOT be silently dropped: the ticket // keeps the lossless compact payload instead. Only loopback routes, @@ -227,6 +281,34 @@ import Testing #expect(!canEncodeLegacy(withIrohFallback)) } + @Test func decodeRejectsManualHostLoopback() throws { + let url = "cmux-ios://attach?v=3&m=127.0.0.1:58465" + #expect(throws: MobileSyncPairingPayloadError.loopbackRouteRejected) { + try CmxPairingQRCode().decode(try components(url)) + } + } + + @Test func decodeRejectsManualHostBareColonText() throws { + let url = "cmux-ios://attach?v=3&m=my:host:58465" + #expect(throws: MobileSyncPairingPayloadError.invalidURL) { + try CmxPairingQRCode().decode(try components(url)) + } + } + + @Test func decodeRejectsManualHostMalformedBrackets() throws { + let url = "cmux-ios://attach?v=3&m=[abc]def]:58465" + #expect(throws: MobileSyncPairingPayloadError.invalidURL) { + try CmxPairingQRCode().decode(try components(url)) + } + } + + @Test func decodeRejectsManualHostInVersionTwoGrammar() throws { + let url = "cmux-ios://attach?v=2&m=studio-mac.local:58465" + #expect(throws: MobileSyncPairingPayloadError.invalidURL) { + try CmxPairingQRCode().decode(try components(url)) + } + } + @Test(arguments: [ "127.0.0.1", "127.0.0.2", @@ -291,7 +373,9 @@ import Testing @Test func versionedURLDetectionDistinguishesGrammars() throws { #expect(CmxPairingQRCode().isPairingCodeURLString("cmux-ios://attach?v=2&r=100.64.0.5:58465")) + #expect(CmxPairingQRCode().isPairingCodeURLString("cmux-ios://attach?v=3&m=studio-mac.local:58465")) #expect(!CmxPairingQRCode().isPairingCodeURLString("cmux-ios://attach?v=1&payload=abc")) + #expect(!CmxPairingQRCode().isPairingCodeURLString("cmux-ios://attach?v=4&r=100.64.0.5:58465")) #expect(!CmxPairingQRCode().isPairingCodeURLString("cmux-ios://pair?v=1&payload=abc")) #expect(!CmxPairingQRCode().isPairingCodeURLString("https://example.com?v=2")) #expect(!CmxPairingQRCode().isPairingCodeURLString("not a url")) diff --git a/Packages/Shared/CmuxIrohTransport/Sources/CmuxIrohTransport/CmxIrohTCPFirstActivation.swift b/Packages/Shared/CmuxIrohTransport/Sources/CmuxIrohTransport/CmxIrohTCPFirstActivation.swift index 136963a6df7f..4b46efbcd712 100644 --- a/Packages/Shared/CmuxIrohTransport/Sources/CmuxIrohTransport/CmxIrohTCPFirstActivation.swift +++ b/Packages/Shared/CmuxIrohTransport/Sources/CmuxIrohTransport/CmxIrohTCPFirstActivation.swift @@ -4,8 +4,18 @@ /// `scheduleIroh` must enqueue asynchronous activation and return immediately. /// Keeping that boundary synchronous makes it impossible for a relay-policy or /// Keychain suspension to delay the existing TCP listener. -public enum CmxIrohTCPFirstActivation { - public static func start( +public struct CmxIrohTCPFirstActivation { + /// Creates a TCP-first activation sequencer. + public init() {} + + /// Starts the required TCP listener synchronously, then schedules the + /// optional Iroh activation work. + /// + /// - Parameters: + /// - startTCP: Synchronously starts the required TCP listener. + /// - scheduleIroh: Enqueues asynchronous Iroh activation and returns + /// immediately without blocking on policy or credential work. + public func start( startTCP: () -> Void, scheduleIroh: () -> Void ) { diff --git a/Packages/Shared/CmuxIrohTransport/Tests/CmuxIrohTransportTests/CmxIrohRelayPolicyServiceTests.swift b/Packages/Shared/CmuxIrohTransport/Tests/CmuxIrohTransportTests/CmxIrohRelayPolicyServiceTests.swift index 9f36651a5b2a..1b610679e103 100644 --- a/Packages/Shared/CmuxIrohTransport/Tests/CmuxIrohTransportTests/CmxIrohRelayPolicyServiceTests.swift +++ b/Packages/Shared/CmuxIrohTransport/Tests/CmuxIrohTransportTests/CmxIrohRelayPolicyServiceTests.swift @@ -155,7 +155,7 @@ struct CmxIrohRelayPolicyServiceTests { let tcpState = RelayPolicyServiceTCPState() var activation: Task? - CmxIrohTCPFirstActivation.start( + CmxIrohTCPFirstActivation().start( startTCP: { tcpState.markStarted() }, scheduleIroh: { activation = Task { diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/CmxAttachTicketInput.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/CmxAttachTicketInput.swift index 5859885f6067..6d6185dbabc7 100644 --- a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/CmxAttachTicketInput.swift +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/CmxAttachTicketInput.swift @@ -16,7 +16,7 @@ public struct CmxAttachTicketInput { /// - Returns: A validated attach ticket. /// - Throws: `MobileSyncPairingPayloadError.invalidURL` or any ticket /// validation error if the input is malformed, or - /// `MobileSyncPairingPayloadError.loopbackRouteRejected` for a v2 + /// `MobileSyncPairingPayloadError.loopbackRouteRejected` for a minimal /// pairing code whose routes point at the phone itself. public static func decode(_ rawValue: String) throws -> CmxAttachTicket { guard let url = URL(string: rawValue) else { @@ -42,8 +42,8 @@ public struct CmxAttachTicketInput { version > CmxPairingQRCode.version { throw MobileSyncPairingPayloadError.unrecognizedURLVersion(version) } - // The minimal v2 pairing-code grammar (bare Tailscale routes, loopback - // rejected). v1 URLs carry a base64 JSON `payload` item instead. + // The minimal pairing-code grammar (bare Tailscale/manual-host routes, + // loopback rejected). v1 URLs carry a base64 JSON `payload` item instead. if CmxPairingQRCode().isPairingCodeURL(components) { return try CmxPairingQRCode().decode(components) } diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCClient+RequestAuthorization.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCClient+RequestAuthorization.swift new file mode 100644 index 000000000000..99a93773bb2f --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCClient+RequestAuthorization.swift @@ -0,0 +1,90 @@ +import CMUXMobileCore +import Foundation + +extension MobileCoreRPCClient { + static func requestNeedsStackAuthFallback( + _ request: [String: Any], + ticket: CmxAttachTicket + ) -> Bool { + guard requestRequiresAuth(request) else { + return false + } + let method = (request["method"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) + let params = request["params"] as? [String: Any] ?? [:] + let workspaceSelection = stringParamSelection(params, keys: ["workspace_id"]) + let terminalSelection = stringParamSelection(params, keys: ["surface_id", "terminal_id", "tab_id"]) + let ticketCoverage = MobileCoreRPCAttachTicketCoverage() + if workspaceSelection.hasConflict + || terminalSelection.hasConflict + || ticketCoverage.containsIgnoredAliasParameters(params) { + return true + } + + switch method { + case "mobile.workspace.list", "workspace.list": + return false + case "workspace.create": + return false + case "workspace.action", "workspace.close": + return !ticketCoverage.ticketCoversWorkspaceRequest( + ticket: ticket, + workspaceSelection: workspaceSelection.value + ) + case "workspace.move", "workspace.group.action", "workspace.group.create": + // These mutations are Mac-scoped. Preserve attach-ticket context so + // the host can reject workspace-scoped tickets rather than receiving + // a Stack-only request. + return false + case "mobile.terminal.create", "terminal.create": + return false + case "mobile.terminal.input", "terminal.input", + "mobile.terminal.paste", "terminal.paste", + "mobile.terminal.paste_image", "terminal.paste_image", + "mobile.terminal.replay", "terminal.replay", + "mobile.terminal.viewport", "terminal.viewport", + "mobile.terminal.artifact.scan", + "mobile.terminal.artifact.stat", + "mobile.terminal.artifact.fetch", + "mobile.terminal.artifact.thumbnail": + return !ticketCoverage.ticketCoversTerminalRequest( + ticket: ticket, + workspaceSelection: workspaceSelection.value, + terminalSelection: terminalSelection.value + ) + case "mobile.events.subscribe", "mobile.events.unsubscribe": + return false + default: + return true + } + } + + static func requestRequiresAuth(_ request: [String: Any]) -> Bool { + let method = (request["method"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) + return method != "mobile.host.status" + } + +} + +private func stringParamSelection( + _ params: [String: Any], + keys: [String] +) -> StringParamSelection { + var selected: String? + for key in keys { + if let value = params[key] as? String { + let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines) + if !trimmed.isEmpty { + if let selected, selected != trimmed { + return StringParamSelection(value: selected, hasConflict: true) + } + selected = selected ?? trimmed + } + } + } + return StringParamSelection(value: selected, hasConflict: false) +} + +private struct StringParamSelection { + let value: String? + let hasConflict: Bool +} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCClient.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCClient.swift index 1f21d5c42f93..1feff5be4bbf 100644 --- a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCClient.swift +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCClient.swift @@ -17,6 +17,9 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { /// The attach ticket this client uses to authorize RPC requests. public var attachTicket: CmxAttachTicket { ticket } private let allowsStackAuthFallback: Bool + private let manualHostStackAuthTrustProvider: @Sendable () async -> Bool + private let authScope: MobileRPCAuthScope + private let authScopeValidator: @Sendable () async -> Bool // `internal` (not `private`) so `@testable import` can observe session // queue state from tests, instead of exposing a debug hook in production. let session: MobileCoreRPCSession @@ -31,6 +34,12 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { /// - ticket: The attach ticket authorizing requests. /// - allowsStackAuthFallback: When `true`, falls back to a Stack Auth token /// on routes that allow it once the attach ticket no longer covers a request. + /// - manualHostStackAuthTrustProvider: Revalidates whether this client's + /// exact `.manualHost` route may carry Stack auth. The provider is called + /// for every token-bearing request so approval expiry or revocation takes + /// effect without replacing the client. + /// - authScope: Immutable signed-in authorization epoch for token-task isolation. + /// - authScopeValidator: Revalidates that `authScope` still owns the live session. /// - transportConnectObserver: Optional synchronous sink for privacy-safe /// transport dial lifecycle events. The observer must return immediately. public init( @@ -38,6 +47,9 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { route: CmxAttachRoute, ticket: CmxAttachTicket, allowsStackAuthFallback: Bool = false, + manualHostStackAuthTrustProvider: @escaping @Sendable () async -> Bool = { false }, + authScope: MobileRPCAuthScope, + authScopeValidator: @escaping @Sendable () async -> Bool, connectAttemptRegistry: MobileRPCConnectAttemptRegistry = MobileRPCConnectAttemptRegistry(), stackTokenGate: RPCStackTokenGate? = nil, stackTokenForceRefreshGate: RPCStackTokenGate? = nil, @@ -56,6 +68,9 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { ) self.transportRequest = transportRequest self.allowsStackAuthFallback = allowsStackAuthFallback + self.manualHostStackAuthTrustProvider = manualHostStackAuthTrustProvider + self.authScope = authScope + self.authScopeValidator = authScopeValidator let lifecycleGate = MobileRPCClientLifecycleGate() self.lifecycleGate = lifecycleGate self.stackTokenGate = stackTokenGate @@ -262,12 +277,22 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { /// not trip the re-auth prompt; a definitive failure surfaces as /// `.authorizationFailed` to drive re-auth. private func forceRefreshStackTokenForRetry(deadline: RPCRequestDeadline) async throws { + try await validateAuthScope() + guard allowsStackAuthFallback, + await routeAllowsStackAuth() else { + throw MobileShellConnectionError.insecureManualRoute + } do { _ = try await stackTokenForceRefreshGate.token( + scope: authScope, timeoutNanoseconds: try deadline.remainingNanoseconds() ) { [runtime] in try await runtime.stackAccessTokenForceRefresher() } + try await validateAuthScope() + guard await routeAllowsStackAuth() else { + throw MobileShellConnectionError.insecureManualRoute + } } catch let error as MobileShellConnectionError { throw error } catch is CancellationError { @@ -303,10 +328,25 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { hostStatusStackToken: hostStatusStackToken ) try Task.checkCancellation() + let preEnqueueValidator: MobileCoreRPCSession.PreEnqueueValidator? + let sendAuthorizer: MobileCoreRPCSession.SendAuthorizer? + if authenticated.stackAccessToken != nil { + preEnqueueValidator = { @Sendable [self] in + try await validateTokenBearingRequestBeforeEnqueue() + } + sendAuthorizer = { @Sendable [self] in + try await authorizeTokenBearingSend() + } + } else { + preEnqueueValidator = nil + sendAuthorizer = nil + } let response = try await session.send( payload: authenticated.data, requestID: id, - deadlineUptimeNanoseconds: deadline.uptimeNanoseconds + deadlineUptimeNanoseconds: deadline.uptimeNanoseconds, + preEnqueueValidator: preEnqueueValidator, + sendAuthorizer: sendAuthorizer ) return AuthenticatedRequestResult( response: response, @@ -362,7 +402,9 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { // expiry), so they never reach this branch. if !ticket.isExpired(at: runtime.now()) { auth["attach_token"] = attachToken - } else if !allowsStackAuthFallback || !MobileShellRouteAuthPolicy.routeAllowsStackAuth(route) { + } else if !allowsStackAuthFallback { + throw MobileShellConnectionError.attachTicketExpired + } else if !(await routeAllowsStackAuth()) { throw MobileShellConnectionError.attachTicketExpired } } @@ -376,12 +418,19 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { // supplementary route/workspace context. let shouldSendStackAuth = requestNeedsAuth if shouldSendStackAuth { + try await validateAuthScope() guard allowsStackAuthFallback, - MobileShellRouteAuthPolicy.routeAllowsStackAuth(route) else { + await routeAllowsStackAuth() else { throw MobileShellConnectionError.insecureManualRoute } do { let token = try await stackAccessToken(deadline: deadline) + // Re-validate after the token await: the auth scope or the + // manual-host trust can be revoked while the fetch is in flight. + try await validateAuthScope() + guard await routeAllowsStackAuth() else { + throw MobileShellConnectionError.insecureManualRoute + } auth["stack_access_token"] = token requestStackAccessToken = token } catch let error as MobileShellConnectionError { @@ -407,15 +456,24 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { } if !requestNeedsAuth, isHostStatusRequest(request), - allowsStackAuthFallback, - MobileShellRouteAuthPolicy.routeAllowsStackAuth(route) { - let stackAccessToken: String? + allowsStackAuthFallback { + try await validateAuthScope() + let hostStatusToken: String? if let hostStatusStackToken { - stackAccessToken = hostStatusStackToken + hostStatusToken = hostStatusStackToken + } else if await routeAllowsStackAuth() { + hostStatusToken = try await stackAccessTokenForStatus(deadline: deadline) } else { - stackAccessToken = try await stackAccessTokenForStatus(deadline: deadline) + hostStatusToken = nil } - if let stackAccessToken { + if let stackAccessToken = hostStatusToken { + // Re-validate after the token await: the auth scope or the + // manual-host trust can be revoked while the fetch is in flight. + try await validateAuthScope() + guard await routeAllowsStackAuth() else { + throw MobileShellConnectionError.insecureManualRoute + } + requestStackAccessToken = stackAccessToken auth["stack_access_token"] = stackAccessToken } } @@ -428,6 +486,17 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { ) } + private func routeAllowsStackAuth() async -> Bool { + let policy = MobileShellRouteAuthPolicy() + guard policy.routeRequiresManualHostTrust(route) else { + return policy.routeAllowsStackAuth(route) + } + return policy.routeAllowsStackAuth( + route, + manualHostTrusted: await manualHostStackAuthTrustProvider() + ) + } + private func stackAccessTokenForStatus(deadline: RPCRequestDeadline) async throws -> String? { let task = Task { [runtime] in await runtime.stackAccessTokenForStatusProvider() @@ -444,94 +513,32 @@ public final class MobileCoreRPCClient: MobileSyncing, Sendable { } private func stackAccessToken(deadline: RPCRequestDeadline) async throws -> String { - try await stackTokenGate.token(timeoutNanoseconds: try deadline.remainingNanoseconds()) { [runtime] in + try await stackTokenGate.token( + scope: authScope, + timeoutNanoseconds: try deadline.remainingNanoseconds() + ) { [runtime] in try await runtime.stackAccessTokenProvider() } } - private static func requestNeedsStackAuthFallback(_ request: [String: Any], ticket: CmxAttachTicket) -> Bool { - guard requestRequiresAuth(request) else { - return false - } - let method = (request["method"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) - let params = request["params"] as? [String: Any] ?? [:] - let workspaceSelection = stringParamSelection(params, keys: ["workspace_id"]) - let terminalSelection = stringParamSelection(params, keys: ["surface_id", "terminal_id", "tab_id"]) - let ticketCoverage = MobileCoreRPCAttachTicketCoverage() - if workspaceSelection.hasConflict || - terminalSelection.hasConflict || - ticketCoverage.containsIgnoredAliasParameters(params) { - return true - } - - switch method { - case "mobile.workspace.list", "workspace.list": - return false - case "workspace.create": - return false - case "workspace.action", "workspace.close": - return !ticketCoverage.ticketCoversWorkspaceRequest( - ticket: ticket, - workspaceSelection: workspaceSelection.value - ) - case "workspace.move", "workspace.group.action", "workspace.group.create": - // These mutations are Mac-scoped. Always preserve the attach-ticket - // context when one exists so the host can reject workspace-scoped - // tickets instead of receiving a Stack-only request. - return false - case "mobile.terminal.create", "terminal.create": - return false - case "mobile.terminal.input", "terminal.input", - "mobile.terminal.paste", "terminal.paste", - "mobile.terminal.paste_image", "terminal.paste_image", - "mobile.terminal.replay", "terminal.replay", - "mobile.terminal.viewport", "terminal.viewport", - "mobile.terminal.artifact.scan", - "mobile.terminal.artifact.stat", - "mobile.terminal.artifact.fetch", - "mobile.terminal.artifact.thumbnail": - return !ticketCoverage.ticketCoversTerminalRequest( - ticket: ticket, - workspaceSelection: workspaceSelection.value, - terminalSelection: terminalSelection.value - ) - case "mobile.events.subscribe", "mobile.events.unsubscribe": - return false - default: - return true - } + private func validateAuthScope() async throws { + guard await authScopeValidator() else { throw CancellationError() } } - private static func requestRequiresAuth(_ request: [String: Any]) -> Bool { - let method = (request["method"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) - // Only the unauthenticated host probe is exempt. attach_ticket.create has no - // attach token yet (it mints the ticket), so requiring auth routes it through - // the Stack Auth account token: a ticket can only be created by a signed-in user. - return method != "mobile.host.status" - } - - private static func stringParamSelection( - _ params: [String: Any], - keys: [String] - ) -> StringParamSelection { - var selected: String? - for key in keys { - if let value = params[key] as? String { - let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines) - if !trimmed.isEmpty { - if let selected, selected != trimmed { - return StringParamSelection(value: selected, hasConflict: true) - } - selected = selected ?? trimmed - } - } + private func validateTokenBearingRequestBeforeEnqueue() async throws { + try await validateAuthScope() + guard await routeAllowsStackAuth() else { + throw MobileShellConnectionError.insecureManualRoute } - return StringParamSelection(value: selected, hasConflict: false) + try await validateAuthScope() } - private struct StringParamSelection { - let value: String? - let hasConflict: Bool + private func authorizeTokenBearingSend() async throws -> MobileRPCSendLease { + try await validateTokenBearingRequestBeforeEnqueue() + guard let lease = authScope.beginSend() else { + throw CancellationError() + } + return lease } private struct AuthenticatedRequestPayload { diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCEventListener.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCEventListener.swift new file mode 100644 index 000000000000..a940994c9d81 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCEventListener.swift @@ -0,0 +1,6 @@ +import Foundation + +struct MobileCoreRPCEventListener { + let topics: Set + let continuation: AsyncStream.Continuation +} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCEventSubscription.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCEventSubscription.swift new file mode 100644 index 000000000000..3f60f5f5f128 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCEventSubscription.swift @@ -0,0 +1,6 @@ +import Foundation + +struct MobileCoreRPCEventSubscription { + let id: UUID + let stream: AsyncStream +} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCPendingFailure.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCPendingFailure.swift new file mode 100644 index 000000000000..2184d137e329 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCPendingFailure.swift @@ -0,0 +1,32 @@ +/// Preserves the exact underlying error carried by a pending RPC continuation. +struct MobileCoreRPCPendingFailure: Error { + let underlying: any Error + + static var invalidResponse: Self { + Self(underlying: MobileShellConnectionError.invalidResponse) + } + + static var connectionClosed: Self { + Self(underlying: MobileShellConnectionError.connectionClosed) + } + + static var requestTimedOut: Self { + Self(underlying: MobileShellConnectionError.requestTimedOut) + } + + static var transportWriteTimedOut: Self { + Self(underlying: MobileShellConnectionError.transportWriteTimedOut) + } + + static func authorizationFailed(_ message: String) -> Self { + Self(underlying: MobileShellConnectionError.authorizationFailed(message)) + } + + static func accountMismatch(_ message: String) -> Self { + Self(underlying: MobileShellConnectionError.accountMismatch(message)) + } + + static func rpcError(_ code: String?, _ message: String) -> Self { + Self(underlying: MobileShellConnectionError.rpcError(code, message)) + } +} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCPendingWrite.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCPendingWrite.swift new file mode 100644 index 000000000000..a3d468347367 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCPendingWrite.swift @@ -0,0 +1,8 @@ +import Foundation + +struct MobileCoreRPCPendingWrite: Sendable { + let id: UUID + let requestID: String + let frame: Data + let authorizeSend: (@Sendable () async throws -> MobileRPCSendLease)? +} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCSession.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCSession.swift index 9763afffe60f..c52ba1034fb1 100644 --- a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCSession.swift +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileCoreRPCSession.swift @@ -1,12 +1,13 @@ internal import CMUXMobileCore import Foundation - actor MobileCoreRPCSession { typealias TransportFactory = @Sendable () throws -> any CmxByteTransport typealias IndependentEventByteStreamFactory = @Sendable () async throws -> CmxIndependentEventByteStream typealias ConnectedCandidateHook = @Sendable (_ candidate: any CmxByteTransport) async -> Void + typealias PreEnqueueValidator = @Sendable () async throws -> Void + typealias SendAuthorizer = @Sendable () async throws -> MobileRPCSendLease typealias TransportConnectObserver = @Sendable (MobileRPCTransportConnectEvent) -> Void - typealias PendingContinuation = CheckedContinuation, Never> + typealias PendingContinuation = CheckedContinuation, Never> typealias ConnectingTask = (id: UUID, lease: MobileRPCConnectAttemptLease?, task: Task, waiters: Set, completed: Bool) static let defaultAbandonedConnectCleanupTimeoutNanoseconds: UInt64 = 1_000_000_000 static let defaultLateAbandonedConnectCloseTimeoutNanoseconds: UInt64 = 5_000_000_000 @@ -15,22 +16,6 @@ actor MobileCoreRPCSession { + MobileSyncFrameCodec.headerByteCount static let maximumDecodedFrameCountPerRead = 256 - struct EventSubscription { - let id: UUID - let stream: AsyncStream - } - - struct EventListener { - let topics: Set - let continuation: AsyncStream.Continuation - } - - private struct PendingWrite: Sendable { - let id: UUID - let requestID: String - let frame: Data - } - struct IndependentEventPreparation: Sendable { let id: UUID let task: Task @@ -67,9 +52,9 @@ actor MobileCoreRPCSession { // `internal` so cancellation tests can observe the writer-queue gate via // `@testable import` without adding a production debug hook. var queuedRequestIDs: Set { Set(queuedWriteIDs.keys) } - var listeners: [UUID: EventListener] = [:] + var listeners: [UUID: MobileCoreRPCEventListener] = [:] var isTearingDown: Bool = false - private var writeQueue: AsyncStream.Continuation? + private var writeQueue: AsyncStream.Continuation? private var writerTask: Task? private var activeWrite: ( connectionID: UUID, @@ -113,14 +98,24 @@ actor MobileCoreRPCSession { writeQueue?.finish() } - func send(payload: Data, requestID: String, deadlineUptimeNanoseconds: UInt64) async throws -> Data { - _ = try await ensureConnected( - timeoutNanoseconds: try taskTimeout.remainingNanoseconds(until: deadlineUptimeNanoseconds) - ) + func send( + payload: Data, + requestID: String, + deadlineUptimeNanoseconds: UInt64, + preEnqueueValidator: PreEnqueueValidator? = nil, + sendAuthorizer: SendAuthorizer? = nil + ) async throws -> Data { + _ = try await ensureConnected(timeoutNanoseconds: try taskTimeout.remainingNanoseconds( + until: deadlineUptimeNanoseconds + )) + if let preEnqueueValidator { + try await preEnqueueValidator() + } + try Task.checkCancellation() let frame = try MobileSyncFrameCodec.encodeFrame(payload) let responseTimeoutNanoseconds = try taskTimeout.remainingNanoseconds(until: deadlineUptimeNanoseconds) - let result: Result = await withTaskCancellationHandler { + let result: Result = await withTaskCancellationHandler { await withCheckedContinuation { continuation in guard pending[requestID] == nil, queuedWriteIDs[requestID] == nil else { continuation.resume(returning: .failure(.invalidResponse)) @@ -130,11 +125,7 @@ actor MobileCoreRPCSession { pending[requestID] = continuation requestTimeoutTasks[requestID]?.cancel() requestTimeoutTasks[requestID] = Task { [weak self, taskTimeout] in - do { - try await taskTimeout.sleep(nanoseconds: responseTimeoutNanoseconds) - } catch { - return - } + do { try await taskTimeout.sleep(nanoseconds: responseTimeoutNanoseconds) } catch { return } guard let self else { return } await self.timeoutPendingRequest(requestID: requestID) } @@ -145,36 +136,34 @@ actor MobileCoreRPCSession { return } queuedWriteIDs[requestID] = queuedWriteID - _ = queue.yield(PendingWrite(id: queuedWriteID, requestID: requestID, frame: frame)) + _ = queue.yield(MobileCoreRPCPendingWrite( + id: queuedWriteID, requestID: requestID, frame: frame, authorizeSend: sendAuthorizer + )) } } onCancel: { - Task { - await self.cancelPendingRequest(requestID: requestID) - } + Task { await self.cancelPendingRequest(requestID: requestID) } } if Task.isCancelled { throw CancellationError() } switch result { - case .success(let data): - return data - case .failure(let error): - throw error + case .success(let data): return data + case .failure(let failure): throw failure.underlying } } - func addEventListener(topics: Set) -> EventSubscription { + func addEventListener(topics: Set) -> MobileCoreRPCEventSubscription { let id = UUID() var continuation: AsyncStream.Continuation! let stream = AsyncStream(bufferingPolicy: .bufferingNewest(256)) { cont in continuation = cont } - listeners[id] = EventListener(topics: topics, continuation: continuation) + listeners[id] = MobileCoreRPCEventListener(topics: topics, continuation: continuation) continuation.onTermination = { @Sendable [weak self] _ in guard let self else { return } Task { await self.removeListener(id: id) } } - return EventSubscription(id: id, stream: stream) + return MobileCoreRPCEventSubscription(id: id, stream: stream) } func removeListener(id: UUID) { @@ -194,7 +183,7 @@ actor MobileCoreRPCSession { task.cancel() } for (_, cont) in pendingSnapshot { - cont.resume(returning: .failure(error)) + cont.resume(returning: .failure(MobileCoreRPCPendingFailure(underlying: error))) } let listenerSnapshot = listeners listeners.removeAll() @@ -412,7 +401,7 @@ actor MobileCoreRPCSession { throw CancellationError() } - let (stream, continuation) = AsyncStream.makeStream( + let (stream, continuation) = AsyncStream.makeStream( bufferingPolicy: .unbounded ) let nextReaderTask = Task { [weak self] in @@ -537,13 +526,20 @@ actor MobileCoreRPCSession { private func writeLoop( transport: any CmxByteTransport, connectionID: UUID, - frames: AsyncStream + frames: AsyncStream ) async { for await write in frames { if Task.isCancelled { return } - guard shouldSendQueuedWrite(write) else { - continue + guard shouldSendQueuedWrite(write, claim: false) else { continue } + if let authorizeSend = write.authorizeSend { + do { + _ = try await authorizeSend() + } catch { + failQueuedWriteAuthorization(write, error: error) + continue + } } + guard shouldSendQueuedWrite(write, claim: true) else { continue } let sendTask = Task { try await transport.send(write.frame) } @@ -568,6 +564,13 @@ actor MobileCoreRPCSession { } } + private func failQueuedWriteAuthorization(_ write: MobileCoreRPCPendingWrite, error: any Error) { + if cancelledQueuedWriteIDs.remove(write.id) != nil { return } + guard queuedWriteIDs[write.requestID] == write.id else { return } + queuedWriteIDs[write.requestID] = nil + failPending(requestID: write.requestID, error: error) + } + private func readLoop( transport: any CmxByteTransport, connectionID: UUID @@ -625,10 +628,10 @@ actor MobileCoreRPCSession { } } - private func failPending(requestID: String, error: MobileShellConnectionError) { + private func failPending(requestID: String, error: any Error) { guard let cont = pending.removeValue(forKey: requestID) else { return } requestTimeoutTasks.removeValue(forKey: requestID)?.cancel() - cont.resume(returning: .failure(error)) + cont.resume(returning: .failure(MobileCoreRPCPendingFailure(underlying: error))) } private func cancelPendingRequest(requestID: String) async { guard let cont = pending.removeValue(forKey: requestID) else { return } @@ -646,7 +649,7 @@ actor MobileCoreRPCSession { if let queuedWriteID = queuedWriteIDs.removeValue(forKey: requestID) { cancelledQueuedWriteIDs.insert(queuedWriteID) } - let error: MobileShellConnectionError = if await recycleTransportIfActiveWrite( + let error: MobileCoreRPCPendingFailure = if await recycleTransportIfActiveWrite( requestID: requestID ) { .transportWriteTimedOut @@ -656,15 +659,14 @@ actor MobileCoreRPCSession { cont.resume(returning: .failure(error)) } - private func shouldSendQueuedWrite(_ write: PendingWrite) -> Bool { - if cancelledQueuedWriteIDs.remove(write.id) != nil { - return false - } - guard queuedWriteIDs[write.requestID] == write.id else { + private func shouldSendQueuedWrite(_ write: MobileCoreRPCPendingWrite, claim: Bool) -> Bool { + if cancelledQueuedWriteIDs.remove(write.id) != nil { return false } + guard queuedWriteIDs[write.requestID] == write.id, + pending[write.requestID] != nil else { return false } - queuedWriteIDs[write.requestID] = nil - return pending[write.requestID] != nil + if claim { queuedWriteIDs[write.requestID] = nil } + return true } private func clearActiveWrite(connectionID: UUID, requestID: String) { diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileHostStatusResponse.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileHostStatusResponse.swift index ca4d910fd3b4..6684d068e16d 100644 --- a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileHostStatusResponse.swift +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileHostStatusResponse.swift @@ -17,7 +17,7 @@ public struct MobileHostStatusResponse: Decodable, Sendable { /// so this is where a freshly paired phone learns what to call the Mac. /// `nil` from older Macs that predate the field. public let macDisplayName: String? - /// The Mac's stable pairing device id. The minimal v2 pairing QR no + /// The Mac's stable pairing device id. The minimal pairing QR no /// longer carries it, so this is where a freshly paired phone learns /// which paired-Mac record the connection belongs to (reconnect-on-launch /// and the host switcher key on it). `nil` from older Macs. diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileRPCAuthScope.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileRPCAuthScope.swift new file mode 100644 index 000000000000..b0e17bfa2349 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileRPCAuthScope.swift @@ -0,0 +1,46 @@ +import Foundation +import os + +/// Revocable identity for one signed-in RPC authorization epoch. +/// +/// The shell rotates the relevant value synchronously when the signed-in account +/// or manual-host network trust epoch changes. Token acquisition and transport enqueue use +/// it as a non-secret key so requests from different auth epochs never share an +/// in-flight credential task. +/// +/// `rawValue` is immutable and the only mutable field is accessed exclusively +/// through `isRevokedLock`, so the unchecked sendability has no cross-task race. +public final class MobileRPCAuthScope: @unchecked Sendable, Hashable { + private let rawValue: UUID + // lint:allow lock - scope revocation and writer admission must be synchronous; + // an actor hop would recreate the authorization TOCTOU this flag closes. + private let isRevokedLock = OSAllocatedUnfairLock(initialState: false) + + /// Creates a fresh authorization-scope identity. + public init() { + rawValue = UUID() + } + + /// Revokes this epoch synchronously so no later queued write can begin sending. + public func revoke() { + isRevokedLock.withLock { $0 = true } + } + + /// Acquires authorization for one send if revocation has not linearized first. + func beginSend() -> MobileRPCSendLease? { + isRevokedLock.withLock { isRevoked in + guard !isRevoked else { return nil } + return MobileRPCSendLease() + } + } + + /// Returns whether two scopes represent the same authorization epoch. + public static func == (lhs: MobileRPCAuthScope, rhs: MobileRPCAuthScope) -> Bool { + lhs.rawValue == rhs.rawValue + } + + /// Hashes the authorization epoch identity into the supplied hasher. + public func hash(into hasher: inout Hasher) { + hasher.combine(rawValue) + } +} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileRPCSendLease.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileRPCSendLease.swift new file mode 100644 index 000000000000..68c183f35b74 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileRPCSendLease.swift @@ -0,0 +1,2 @@ +/// A one-send capability acquired at the writer's authorization linearization point. +struct MobileRPCSendLease: Sendable {} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileShellConnectionError.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileShellConnectionError.swift index e44cd58f636c..b71ee828f8df 100644 --- a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileShellConnectionError.swift +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/MobileShellConnectionError.swift @@ -1,6 +1,7 @@ public import CMUXMobileCore internal import CmuxMobileSupport public import Foundation +import CmuxMobileSupport /// Errors surfaced while connecting to or talking with a paired Mac over the /// mobile-sync RPC transport. @@ -13,7 +14,7 @@ public enum MobileShellConnectionError: LocalizedError, DiagnosticFailureProvidi case requestTimedOut /// A request timed out while its frame was blocked in the transport write. case transportWriteTimedOut - /// A manual host did not advertise a secure route. + /// A manual-host route was not approved for Stack-authenticated mobile sync. case insecureManualRoute /// The attach ticket expired and no fallback was available. case attachTicketExpired @@ -29,18 +30,30 @@ public enum MobileShellConnectionError: LocalizedError, DiagnosticFailureProvidi public var errorDescription: String? { switch self { case .invalidResponse: - return "Invalid mobile sync response" + return L10n.string( + "mobile.connection.invalidResponse", + defaultValue: "Invalid mobile sync response" + ) case .connectionClosed: - return "Mobile sync connection closed" + return L10n.string( + "mobile.connection.closed", + defaultValue: "Mobile sync connection closed" + ) case .requestTimedOut, .transportWriteTimedOut: return L10n.string( "mobile.connection.requestTimedOut", defaultValue: "Mobile sync request timed out" ) case .insecureManualRoute: - return "Manual host did not advertise a secure mobile sync route" + return L10n.string( + "mobile.connection.insecureManualRoute", + defaultValue: "Manual host route needs approval before mobile sync can send account credentials" + ) case .attachTicketExpired: - return "Mobile attach ticket expired" + return L10n.string( + "mobile.connection.attachTicketExpired", + defaultValue: "Mobile attach ticket expired" + ) case let .authorizationFailed(message): return message case let .accountMismatch(message): diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenGate.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenGate.swift index b700957d41fc..3c8ea5553d38 100644 --- a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenGate.swift +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenGate.swift @@ -2,8 +2,8 @@ import Foundation /// Deduplicates Stack access-token acquisition across mobile RPC clients owned by the same shell. public actor RPCStackTokenGate { - private var current: (id: UUID, task: Task, waiters: Int, timedOutUntil: UInt64?)? - private var abandoned: [UUID: Task] = [:] + private var currentByScope: [RPCStackTokenScopeKey: RPCStackTokenTaskState] = [:] + private var abandonedByScope: [RPCStackTokenScopeKey: [UUID: Task]] = [:] private let taskTimeout = RPCTaskTimeout() private let timedOutResetNanoseconds: UInt64 @@ -13,85 +13,108 @@ public actor RPCStackTokenGate { } func token( + scope: MobileRPCAuthScope? = nil, timeoutNanoseconds: UInt64, provider: @escaping @Sendable () async throws -> String ) async throws -> String { + let scopeKey = scope.map(RPCStackTokenScopeKey.scoped) ?? .unscoped let id: UUID let task: Task - if let existing = current, let timedOutUntil = existing.timedOutUntil { + if let existing = currentByScope[scopeKey], let timedOutUntil = existing.timedOutUntil { guard DispatchTime.now().uptimeNanoseconds >= timedOutUntil else { throw MobileShellConnectionError.requestTimedOut } - guard abandoned.isEmpty else { + guard abandonedByScope[scopeKey]?.isEmpty != false else { throw MobileShellConnectionError.requestTimedOut } - abandoned[existing.id] = existing.task - current = nil + abandonedByScope[scopeKey, default: [:]][existing.id] = existing.task + currentByScope[scopeKey] = nil } - if let existing = current { + if var existing = currentByScope[scopeKey] { id = existing.id task = existing.task - current?.waiters += 1 + existing.waiters += 1 + currentByScope[scopeKey] = existing } else { id = UUID() task = Task { try await provider() } - current = (id: id, task: task, waiters: 1, timedOutUntil: nil) + currentByScope[scopeKey] = RPCStackTokenTaskState( + id: id, + task: task, + waiters: 1, + timedOutUntil: nil + ) Task.detached { [weak self] in _ = await task.result - await self?.clear(id: id) + await self?.clear(scopeKey: scopeKey, id: id) } } do { let token = try await taskTimeout.value(task, timeoutNanoseconds: timeoutNanoseconds) - clear(id: id) + clear(scopeKey: scopeKey, id: id) return token } catch MobileShellConnectionError.requestTimedOut { - timeoutWaiter(id: id) + timeoutWaiter(scopeKey: scopeKey, id: id) throw MobileShellConnectionError.requestTimedOut } catch is CancellationError { - cancelWaiter(id: id) + cancelWaiter(scopeKey: scopeKey, id: id) throw CancellationError() } catch { - clear(id: id) + clear(scopeKey: scopeKey, id: id) throw error } } - private func timeoutWaiter(id: UUID) { - guard current?.id == id, let task = current?.task else { return } - current?.waiters -= 1 - guard let waiters = current?.waiters, waiters <= 0 else { + /// Cancels credential work owned by one invalidated auth scope without + /// disturbing requests from another signed-in scope. + public func invalidate(scope: MobileRPCAuthScope) { + scope.revoke() + let scopeKey = RPCStackTokenScopeKey.scoped(scope) + currentByScope.removeValue(forKey: scopeKey)?.task.cancel() + let abandoned = abandonedByScope.removeValue(forKey: scopeKey)?.values ?? [:].values + for task in abandoned { task.cancel() } + } + + private func timeoutWaiter(scopeKey: RPCStackTokenScopeKey, id: UUID) { + guard var current = currentByScope[scopeKey], current.id == id else { return } + current.waiters -= 1 + guard current.waiters <= 0 else { + currentByScope[scopeKey] = current return } - current = ( + currentByScope[scopeKey] = RPCStackTokenTaskState( id: id, - task: task, + task: current.task, waiters: 0, timedOutUntil: DispatchTime.now().uptimeNanoseconds &+ timedOutResetNanoseconds ) - task.cancel() + current.task.cancel() } - private func cancelWaiter(id: UUID) { - guard current?.id == id, let task = current?.task else { return } - current?.waiters -= 1 - guard let waiters = current?.waiters, waiters <= 0 else { + private func cancelWaiter(scopeKey: RPCStackTokenScopeKey, id: UUID) { + guard var current = currentByScope[scopeKey], current.id == id else { return } + current.waiters -= 1 + guard current.waiters <= 0 else { + currentByScope[scopeKey] = current return } - current = ( + currentByScope[scopeKey] = RPCStackTokenTaskState( id: id, - task: task, + task: current.task, waiters: 0, timedOutUntil: DispatchTime.now().uptimeNanoseconds &+ timedOutResetNanoseconds ) - task.cancel() + current.task.cancel() } - private func clear(id: UUID) { - if current?.id == id { - current = nil + private func clear(scopeKey: RPCStackTokenScopeKey, id: UUID) { + if currentByScope[scopeKey]?.id == id { + currentByScope[scopeKey] = nil + } + abandonedByScope[scopeKey]?[id] = nil + if abandonedByScope[scopeKey]?.isEmpty == true { + abandonedByScope[scopeKey] = nil } - abandoned[id] = nil } } diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenScopeKey.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenScopeKey.swift new file mode 100644 index 000000000000..701a5797c7d2 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenScopeKey.swift @@ -0,0 +1,4 @@ +enum RPCStackTokenScopeKey: Hashable, Sendable { + case unscoped + case scoped(MobileRPCAuthScope) +} diff --git a/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenTaskState.swift b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenTaskState.swift new file mode 100644 index 000000000000..5f345a0ef466 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Sources/CmuxMobileRPC/RPCStackTokenTaskState.swift @@ -0,0 +1,8 @@ +import Foundation + +struct RPCStackTokenTaskState { + let id: UUID + let task: Task + var waiters: Int + var timedOutUntil: UInt64? +} diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/CmxAttachTicketInputTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/CmxAttachTicketInputTests.swift index 8e160e312624..59b9a3c88ee9 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/CmxAttachTicketInputTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/CmxAttachTicketInputTests.swift @@ -160,7 +160,7 @@ import Testing } @Test func decodesMinimalPairingCodeURL() throws { - // New-phone-scans-new-QR: the minimal v2 grammar (bare routes, no + // New-phone-scans-new-QR: the minimal v2 Tailscale grammar (bare routes, no // payload blob) routes through the same input decoder as everything // else the scanner or a deep link can hand us. let decoded = try CmxAttachTicketInput.decode( @@ -181,6 +181,20 @@ import Testing #expect(decoded.routes.allSatisfy { $0.kind == .tailscale }) } + @Test func decodesManualHostPairingCodeOnlyInVersionThree() throws { + let decoded = try CmxAttachTicketInput.decode( + "cmux-ios://attach?v=3&ub=user_mac_123&pc=1&m=studio-mac.local:58465" + ) + #expect(decoded.routes.count == 1) + #expect(decoded.routes.first?.kind == .manualHost) + + #expect(throws: MobileSyncPairingPayloadError.invalidURL) { + try CmxAttachTicketInput.decode( + "cmux-ios://attach?v=2&ub=user_mac_123&pc=1&m=studio-mac.local:58465" + ) + } + } + @Test func minimalPairingCodeRejectsLoopback() { // A scanned v2 code must never point the phone at itself. The legacy // v1 payload grammar is intentionally NOT gated: the dev/simulator diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/ImmediateResponseRecordingTransport.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/ImmediateResponseRecordingTransport.swift new file mode 100644 index 000000000000..3a3e4c6be87d --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/ImmediateResponseRecordingTransport.swift @@ -0,0 +1,56 @@ +import CMUXMobileCore +import Foundation +@testable import CmuxMobileRPC + +actor ImmediateResponseRecordingTransport: CmxByteTransport { + private var sentPayloads: [Data] = [] + private var queuedResponses: [Data] = [] + private var receiveWaiters: [CheckedContinuation] = [] + private var isClosed = false + + func connect() async throws {} + + func receive() async throws -> Data? { + if !queuedResponses.isEmpty { + return queuedResponses.removeFirst() + } + if isClosed { return nil } + return await withCheckedContinuation { receiveWaiters.append($0) } + } + + func send(_ data: Data) async throws { + var buffer = data + let payloads = try MobileSyncFrameCodec.decodeFrames(from: &buffer) + sentPayloads.append(contentsOf: payloads) + for payload in payloads { + let request = try recordedRPCRequest(from: payload) + try deliverResponse(id: request.id) + } + } + + func close() async { + isClosed = true + let waiters = receiveWaiters + receiveWaiters.removeAll() + for waiter in waiters { waiter.resume(returning: nil) } + } + + func sentRequests() throws -> [RecordedRPCRequest] { + try sentPayloads.map(recordedRPCRequest(from:)) + } + + private func deliverResponse(id: String?) throws { + let response: [String: Any] = [ + "id": id ?? "", + "ok": true, + "result": ["status": "ok"], + ] + let payload = try JSONSerialization.data(withJSONObject: response) + let frame = try MobileSyncFrameCodec.encodeFrame(payload) + if !receiveWaiters.isEmpty { + receiveWaiters.removeFirst().resume(returning: frame) + } else { + queuedResponses.append(frame) + } + } +} diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCAbandonedConnectTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCAbandonedConnectTests.swift index d5aa8794149e..dadf787b54aa 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCAbandonedConnectTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCAbandonedConnectTests.swift @@ -20,7 +20,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -64,7 +64,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -132,7 +132,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -188,7 +188,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -235,7 +235,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -305,7 +305,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -460,7 +460,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCAuthScopeTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCAuthScopeTests.swift new file mode 100644 index 000000000000..481b06bf5f72 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCAuthScopeTests.swift @@ -0,0 +1,164 @@ +import CMUXMobileCore +import Foundation +import Testing +@testable import CmuxMobileRPC + +@Suite struct MobileCoreRPCAuthScopeTests { + @Test func sharedTokenGateDoesNotJoinDifferentScopes() async throws { + let gate = RPCStackTokenGate() + let provider = CancellationIgnoringTokenProvider() + let firstScope = MobileRPCAuthScope() + let secondScope = MobileRPCAuthScope() + let first = Task { + try await gate.token(scope: firstScope, timeoutNanoseconds: 30_000_000_000) { + try await provider.token() + } + } + await provider.waitUntilStartCount(1) + let second = Task { + try await gate.token(scope: secondScope, timeoutNanoseconds: 30_000_000_000) { + try await provider.token() + } + } + await provider.waitUntilStartCount(2) + + #expect(await provider.startCount == 2) + await provider.release() + #expect(try await first.value == "released-token") + #expect(try await second.value == "released-token") + } + + @Test func invalidatedScopeCannotReuseItsOldTokenTask() async throws { + let gate = RPCStackTokenGate() + let provider = CancellationIgnoringTokenProvider() + let scope = MobileRPCAuthScope() + let first = Task { + try await gate.token(scope: scope, timeoutNanoseconds: 30_000_000_000) { + try await provider.token() + } + } + await provider.waitUntilStartCount(1) + await gate.invalidate(scope: scope) + let second = Task { + try await gate.token(scope: scope, timeoutNanoseconds: 30_000_000_000) { + try await provider.token() + } + } + await provider.waitUntilStartCount(2) + + #expect(await provider.startCount == 2) + await provider.release() + _ = try? await first.value + #expect(try await second.value == "released-token") + } + + @Test(arguments: ["workspace.list", "mobile.host.status"]) + func invalidatedAuthScopeBeforeSessionEnqueueSendsNothing(method: String) async throws { + let validation = ScopedRPCValidationGate(blockedCall: 3) + let transport = ImmediateResponseRecordingTransport() + let route = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: 58_465) + let runtime = TestMobileSyncRuntime( + transportFactory: FixedTransportFactory(transport: transport), + stackAccessToken: "scoped-token", + stackAccessTokenForStatus: "status-token" + ) + let client = MobileCoreRPCClient.testClient( + runtime: runtime, + route: route, + ticket: try ticket(route: route), + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { await validation.validate() } + ) + let request = try MobileCoreRPCClient.requestData(method: method) + let send = Task { try await client.sendRequest(request) } + await validation.waitUntilBlocked() + await validation.invalidateAndRelease() + + do { + _ = try await send.value + Issue.record("Expected invalid auth scope to cancel before enqueue") + } catch is CancellationError { + } catch { + Issue.record("Expected CancellationError, got \(error)") + } + #expect(try await transport.sentRequests().isEmpty) + } + + @Test func invalidatedAuthScopeWhileConnectionEstablishesSendsNothing() async throws { + let validation = ScopedRPCValidationGate(blockedCall: .max) + let transport = ReleasableConnectTransport() + let route = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: 58_465) + let client = MobileCoreRPCClient.testClient( + runtime: TestMobileSyncRuntime( + transportFactory: ReleasableConnectTransportFactory(transport: transport), + stackAccessToken: "scoped-token" + ), + route: route, + ticket: try ticket(route: route), + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { await validation.validate() } + ) + let request = try MobileCoreRPCClient.requestData(method: "workspace.list") + let send = Task { try await client.sendRequest(request) } + #expect(await transport.waitUntilConnectStarted()) + + await validation.invalidateAndRelease() + await transport.releaseConnect() + + do { + _ = try await send.value + Issue.record("Expected invalid auth scope to cancel before enqueue") + } catch is CancellationError { + } catch { + Issue.record("Expected CancellationError, got \(error)") + } + #expect(try await transport.sentRequests().isEmpty) + } + + @Test func revokedManualTrustBeforeSessionEnqueueSendsNothing() async throws { + let trust = ScopedRPCValidationGate(blockedCall: 3) + let transport = ImmediateResponseRecordingTransport() + let route = try hostPortRoute(kind: .manualHost, host: "192.168.1.77", port: 58_465) + let client = MobileCoreRPCClient.testClient( + runtime: TestMobileSyncRuntime( + transportFactory: FixedTransportFactory(transport: transport), + supportedRouteKinds: [.manualHost], + stackAccessToken: "manual-token" + ), + route: route, + ticket: try ticket(route: route), + allowsStackAuthFallback: true, + manualHostStackAuthTrustProvider: { await trust.validate() }, + authScope: MobileRPCAuthScope() + ) + let request = try MobileCoreRPCClient.requestData(method: "workspace.list") + let send = Task { try await client.sendRequest(request) } + await trust.waitUntilBlocked() + await trust.invalidateAndRelease() + + do { + _ = try await send.value + Issue.record("Expected revoked trust to block session enqueue") + } catch let error as MobileShellConnectionError { + guard case .insecureManualRoute = error else { + Issue.record("Expected insecureManualRoute, got \(error)") + return + } + } + #expect(try await transport.sentRequests().isEmpty) + } + + private func ticket(route: CmxAttachRoute) throws -> CmxAttachTicket { + try CmxAttachTicket( + workspaceID: "", + terminalID: nil, + macDeviceID: "", + macDisplayName: nil, + routes: [route], + expiresAt: nil, + authToken: nil + ) + } +} diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCClient+TestFactory.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCClient+TestFactory.swift new file mode 100644 index 000000000000..b478c50d984d --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCClient+TestFactory.swift @@ -0,0 +1,38 @@ +import CMUXMobileCore +import CmuxMobileShellModel +import Foundation +@testable import CmuxMobileRPC + +extension MobileCoreRPCClient { + static func testClient( + runtime: any MobileSyncRuntime, + route: CmxAttachRoute, + ticket: CmxAttachTicket, + allowsStackAuthFallback: Bool = false, + manualHostStackAuthTrustProvider: @escaping @Sendable () async -> Bool = { false }, + authScope: MobileRPCAuthScope = MobileRPCAuthScope(), + authScopeValidator: @escaping @Sendable () async -> Bool = { true }, + connectAttemptRegistry: MobileRPCConnectAttemptRegistry = MobileRPCConnectAttemptRegistry(), + stackTokenGate: RPCStackTokenGate? = nil, + stackTokenForceRefreshGate: RPCStackTokenGate? = nil, + abandonedConnectCleanupTimeoutNanoseconds: UInt64 = 1_000_000_000, + lateAbandonedConnectCloseTimeoutNanoseconds: UInt64 = 5_000_000_000, + stackTokenGateResetNanoseconds: UInt64 = 30_000_000_000 + ) -> MobileCoreRPCClient { + MobileCoreRPCClient( + runtime: runtime, + route: route, + ticket: ticket, + allowsStackAuthFallback: allowsStackAuthFallback, + manualHostStackAuthTrustProvider: manualHostStackAuthTrustProvider, + authScope: authScope, + authScopeValidator: authScopeValidator, + connectAttemptRegistry: connectAttemptRegistry, + stackTokenGate: stackTokenGate, + stackTokenForceRefreshGate: stackTokenForceRefreshGate, + abandonedConnectCleanupTimeoutNanoseconds: abandonedConnectCleanupTimeoutNanoseconds, + lateAbandonedConnectCloseTimeoutNanoseconds: lateAbandonedConnectCloseTimeoutNanoseconds, + stackTokenGateResetNanoseconds: stackTokenGateResetNanoseconds + ) + } +} diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCClientTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCClientTests.swift index 453eb5fb1cd7..6a5447fa6547 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCClientTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCClientTests.swift @@ -27,7 +27,7 @@ import Testing // Stack token unconditionally and would otherwise throw `insecureManualRoute` // before reaching the transport. This is a transport queue/cancellation test, // so enable fallback to match the real trusted-route path. - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -345,7 +345,7 @@ import Testing stackAccessToken: stackAccessToken, stackAccessTokenForStatus: stackAccessTokenForStatus ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: try qrPairingTicket(route: route), @@ -387,7 +387,7 @@ import Testing // A manually-entered plain-LAN host is dialed over unencrypted TCP; // the account bearer token must never ride it, even opportunistically. // The probe itself still goes out tokenless instead of throwing. - let route = try hostPortRoute(kind: .tailscale, host: "192.168.1.20", port: 58465) + let route = try hostPortRoute(kind: .manualHost, host: "192.168.1.20", port: 58465) let probe = try await sentHostStatusProbe(route: route, stackAccessToken: "test-stack-token") #expect(probe?.hasAuth == false) } @@ -408,7 +408,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -465,7 +465,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "must-not-cross-iroh-either" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCConnectWaiterTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCConnectWaiterTests.swift index 1e94ef548e6d..72698ed08297 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCConnectWaiterTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCConnectWaiterTests.swift @@ -75,7 +75,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCGroupActionAuthTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCGroupActionAuthTests.swift index a81b8d352e70..1f2239f13455 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCGroupActionAuthTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCGroupActionAuthTests.swift @@ -20,7 +20,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -61,7 +61,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -103,7 +103,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -149,7 +149,9 @@ import Testing runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) let request = try MobileCoreRPCClient.requestData( method: "workspace.group.create", diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCHostStatusTokenTimeoutTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCHostStatusTokenTimeoutTests.swift index 9fe3d230605e..048aaf63b0fd 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCHostStatusTokenTimeoutTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCHostStatusTokenTimeoutTests.swift @@ -24,7 +24,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -68,7 +68,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -115,7 +115,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -164,7 +164,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -206,59 +206,6 @@ private actor ReleasableStatusTokenProvider { } } -private actor ImmediateResponseRecordingTransport: CmxByteTransport { - private var sentPayloads: [Data] = [] - private var queuedResponses: [Data] = [] - private var receiveWaiters: [CheckedContinuation] = [] - private var isClosed = false - - func connect() async throws {} - - func receive() async throws -> Data? { - guard !isClosed else { return nil } - if !queuedResponses.isEmpty { - return queuedResponses.removeFirst() - } - return await withCheckedContinuation { continuation in - receiveWaiters.append(continuation) - } - } - - func send(_ data: Data) async throws { - var buffer = data - let payloads = try MobileSyncFrameCodec.decodeFrames(from: &buffer) - sentPayloads.append(contentsOf: payloads) - for payload in payloads { - let request = try recordedRPCRequest(from: payload) - let response = try JSONSerialization.data(withJSONObject: [ - "id": request.id ?? "", - "ok": true, - "result": ["status": "ok"], - ]) - let frame = try MobileSyncFrameCodec.encodeFrame(response) - if let waiter = receiveWaiters.first { - receiveWaiters.removeFirst() - waiter.resume(returning: frame) - } else { - queuedResponses.append(frame) - } - } - } - - func close() async { - isClosed = true - let waiters = receiveWaiters - receiveWaiters = [] - for waiter in waiters { - waiter.resume(returning: nil) - } - } - - func sentRequests() throws -> [RecordedRPCRequest] { - try sentPayloads.map(recordedRPCRequest(from:)) - } -} - private struct ImmediateResponseRecordingTransportFactory: CmxByteTransportFactory { let transport: ImmediateResponseRecordingTransport diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCIndependentEventTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCIndependentEventTests.swift index 64b94d95e781..1406944a2a35 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCIndependentEventTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCIndependentEventTests.swift @@ -11,7 +11,7 @@ struct MobileCoreRPCIndependentEventTests { let transport = CloseTrackingNeverConnectedTransport() let factory = BlockingTransportFactory(transport: transport) let runtime = TestMobileSyncRuntime(transportFactory: factory) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: try ticket(route: route, deviceSuffix: "001") @@ -43,7 +43,7 @@ struct MobileCoreRPCIndependentEventTests { transportFactory: FixedTransportFactory(transport: NeverConnectedTransport()), independentEventByteStreamProvider: { _ in try await source.makeStream() } ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: try ticket(route: route, deviceSuffix: "002") @@ -68,7 +68,7 @@ struct MobileCoreRPCIndependentEventTests { transportFactory: FixedTransportFactory(transport: transport), independentEventByteStreamProvider: { _ in await source.makeStream() } ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: try ticket(route: route, deviceSuffix: "003") @@ -101,7 +101,7 @@ struct MobileCoreRPCIndependentEventTests { return await source.makeStream() } ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: try ticket(route: route, deviceSuffix: "004") @@ -139,7 +139,7 @@ struct MobileCoreRPCIndependentEventTests { transportFactory: FixedTransportFactory(transport: NeverConnectedTransport()), independentEventByteStreamProvider: { _ in await source.makeStream() } ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: try ticket(route: route, deviceSuffix: "005") @@ -168,7 +168,7 @@ struct MobileCoreRPCIndependentEventTests { transportFactory: FixedTransportFactory(transport: transport), independentEventByteStreamProvider: { _ in try await source.makeStream() } ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: try ticket(route: route, deviceSuffix: "006") diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCManualHostTrustTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCManualHostTrustTests.swift new file mode 100644 index 000000000000..df481578e0e3 --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCManualHostTrustTests.swift @@ -0,0 +1,122 @@ +import CMUXMobileCore +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileRPC + +@Suite struct MobileCoreRPCManualHostTrustTests { + @Test func revokingTrustBlocksTokenBearingWriteAlreadyQueuedBehindBlockedSend() async throws { + let route = try hostPortRoute(kind: .manualHost, host: "192.168.1.20", port: 58_465) + let scope = try #require( + MobileManualHostTrustScope(route: route, stackUserID: "phone-user") + ) + let trustStore = InMemoryMobileManualHostTrustStore() + await trustStore.trust(scope) + let transport = QueuedCancellationProbeTransport() + let runtime = TestMobileSyncRuntime( + transportFactory: QueuedCancellationProbeTransportFactory(transport: transport), + stackAccessToken: "trusted-manual-token", + rpcRequestTimeoutNanoseconds: 60 * 1_000_000_000 + ) + let client = MobileCoreRPCClient.testClient( + runtime: runtime, + route: route, + ticket: try qrPairingTicket(route: route), + allowsStackAuthFallback: true, + manualHostStackAuthTrustProvider: { + await trustStore.isTrusted(scope) + } + ) + let blockingID = "trusted-blocking-write" + let queuedID = "revoked-queued-write" + let blockingRequest = try MobileCoreRPCClient.requestData( + method: "workspace.list", + id: blockingID + ) + let queuedRequest = try MobileCoreRPCClient.requestData( + method: "workspace.list", + id: queuedID + ) + + let blockingTask = Task { try await client.sendRequest(blockingRequest) } + let initiallySent = try await transport.waitForSentRequestCount(1) + #expect(initiallySent.map(\.id) == [blockingID]) + + let queuedTask = Task { try await client.sendRequest(queuedRequest) } + for _ in 0..<1_000 { + if await client.session.queuedRequestIDs.contains(queuedID) { break } + await Task.yield() + } + #expect(await client.session.queuedRequestIDs.contains(queuedID)) + + await trustStore.removeAll() + await transport.releaseFirstSend() + for _ in 0..<1_000 { + if !(await client.session.queuedRequestIDs.contains(queuedID)) { break } + await Task.yield() + } + + #expect(!(await client.session.queuedRequestIDs.contains(queuedID))) + #expect(try await transport.sentRequests().map(\.id) == [blockingID]) + + queuedTask.cancel() + blockingTask.cancel() + _ = try? await queuedTask.value + _ = try? await blockingTask.value + } + + @Test func revokingTrustBlocksNextRequestOnExistingManualHostClient() async throws { + let route = try hostPortRoute(kind: .manualHost, host: "192.168.1.20", port: 58_465) + let scope = try #require( + MobileManualHostTrustScope(route: route, stackUserID: "phone-user") + ) + let trustStore = InMemoryMobileManualHostTrustStore() + await trustStore.trust(scope) + let transport = QueuedCancellationProbeTransport() + let runtime = TestMobileSyncRuntime( + transportFactory: QueuedCancellationProbeTransportFactory(transport: transport), + stackAccessToken: "trusted-manual-token" + ) + let client = MobileCoreRPCClient.testClient( + runtime: runtime, + route: route, + ticket: try qrPairingTicket(route: route), + allowsStackAuthFallback: true, + manualHostStackAuthTrustProvider: { + await trustStore.isTrusted(scope) + } + ) + let request = try MobileCoreRPCClient.requestData(method: "workspace.list") + let trustedRequest = Task { try await client.sendRequest(request) } + let sentWhileTrusted = try await transport.waitForSentRequestCount(1) + trustedRequest.cancel() + _ = try? await trustedRequest.value + + #expect(sentWhileTrusted.first?.stackAccessToken == "trusted-manual-token") + + await trustStore.removeAll() + + do { + _ = try await client.sendRequest(request) + Issue.record("Expected revoked manual-host trust to block Stack auth") + } catch let error as MobileShellConnectionError { + guard case .insecureManualRoute = error else { + Issue.record("Expected insecureManualRoute, got \(error)") + return + } + } + #expect(try await transport.sentRequests().count == 1) + } + + private func qrPairingTicket(route: CmxAttachRoute) throws -> CmxAttachTicket { + try CmxAttachTicket( + workspaceID: "", + terminalID: nil, + macDeviceID: "", + macDisplayName: nil, + routes: [route], + expiresAt: nil, + authToken: nil + ) + } +} diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCRequestQueueTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCRequestQueueTests.swift index fc8e31597d72..58e1d75c1d82 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCRequestQueueTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCRequestQueueTests.swift @@ -4,6 +4,101 @@ import Testing @testable import CmuxMobileRPC @Suite struct MobileCoreRPCRequestQueueTests { + @Test func cancelledQueuedSendSkipsAuthorizationWork() async throws { + let transport = QueuedCancellationProbeTransport() + let session = MobileCoreRPCSession(makeTransport: { transport }) + let deadline = DispatchTime.now().uptimeNanoseconds + 60_000_000_000 + let firstID = "first-blocking-send" + let cancelledID = "cancelled-queued-send" + let liveID = "live-queued-send" + let authorizationRecorder = SendAuthorizationInvocationRecorder() + let first = Task { + try await session.send( + payload: try MobileCoreRPCClient.requestData(method: "workspace.list", id: firstID), + requestID: firstID, + deadlineUptimeNanoseconds: deadline + ) + } + #expect(try await transport.waitForSentRequestCount(1).map(\.id) == [firstID]) + + let cancelled = Task { + try await session.send( + payload: try MobileCoreRPCClient.requestData(method: "workspace.list", id: cancelledID), + requestID: cancelledID, + deadlineUptimeNanoseconds: deadline, + sendAuthorizer: { await authorizationRecorder.authorize() } + ) + } + #expect(await waitUntilQueued(cancelledID, in: session)) + cancelled.cancel() + do { + _ = try await cancelled.value + Issue.record("Expected queued send cancellation") + } catch is CancellationError { + } catch { + Issue.record("Expected CancellationError, got \(error)") + } + + let live = Task { + try await session.send( + payload: try MobileCoreRPCClient.requestData(method: "workspace.list", id: liveID), + requestID: liveID, + deadlineUptimeNanoseconds: deadline + ) + } + #expect(await waitUntilQueued(liveID, in: session)) + + await transport.releaseFirstSend() + #expect(try await transport.waitForSentRequestCount(2).map(\.id) == [firstID, liveID]) + #expect(await authorizationRecorder.invocationCount() == 0) + + first.cancel() + live.cancel() + _ = try? await first.value + _ = try? await live.value + await session.tearDown(error: .connectionClosed) + } + + @Test func revokedQueuedSendPreservesCancellationWithoutClosingSession() async throws { + let transport = QueuedCancellationProbeTransport() + let session = MobileCoreRPCSession(makeTransport: { transport }) + let deadline = DispatchTime.now().uptimeNanoseconds + 60_000_000_000 + let firstID = "first-blocking-send" + let revokedID = "revoked-queued-send" + let first = Task { + try await session.send( + payload: try MobileCoreRPCClient.requestData(method: "workspace.list", id: firstID), + requestID: firstID, + deadlineUptimeNanoseconds: deadline + ) + } + #expect(try await transport.waitForSentRequestCount(1).map(\.id) == [firstID]) + let revoked = Task { + try await session.send( + payload: try MobileCoreRPCClient.requestData(method: "workspace.list", id: revokedID), + requestID: revokedID, + deadlineUptimeNanoseconds: deadline, + sendAuthorizer: { throw CancellationError() } + ) + } + #expect(await waitUntilQueued(revokedID, in: session)) + + await transport.releaseFirstSend() + do { + _ = try await revoked.value + Issue.record("Expected revoked queued send to preserve cancellation") + } catch is CancellationError { + } catch { + Issue.record("Expected CancellationError, got \(error)") + } + + #expect(try await transport.sentRequests().map(\.id) == [firstID]) + #expect(!(await transport.closed())) + first.cancel() + _ = try? await first.value + await session.tearDown(error: .connectionClosed) + } + @Test func timedOutQueuedSameIDRetryIsNotConsumedByOldTombstone() async throws { let transport = QueuedCancellationProbeTransport() let route = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: 59133) @@ -20,7 +115,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -97,7 +192,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -154,7 +249,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -196,4 +291,19 @@ import Testing } } + private func waitUntilQueued( + _ requestID: String, + in session: MobileCoreRPCSession + ) async -> Bool { + let clock = ContinuousClock() + let deadline = clock.now.advanced(by: .seconds(1)) + while clock.now < deadline { + if await session.queuedRequestIDs.contains(requestID) { + return true + } + await Task.yield() + } + return await session.queuedRequestIDs.contains(requestID) + } + } diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStaleReaderRecoveryTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStaleReaderRecoveryTests.swift index 7d531a5d3d06..c95d34070832 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStaleReaderRecoveryTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStaleReaderRecoveryTests.swift @@ -84,7 +84,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - return MobileCoreRPCClient( + return MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStalledWriteRecoveryTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStalledWriteRecoveryTests.swift index 15817316899d..6f9be95b1840 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStalledWriteRecoveryTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCStalledWriteRecoveryTests.swift @@ -29,7 +29,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -282,7 +282,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - return MobileCoreRPCClient( + return MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCTokenTimeoutTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCTokenTimeoutTests.swift index e6dfaa80cf5c..1299c50ebcc1 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCTokenTimeoutTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCTokenTimeoutTests.swift @@ -26,7 +26,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -74,7 +74,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -128,7 +128,8 @@ import Testing authToken: "ticket-secret" ) let sharedGate = RPCStackTokenGate(timedOutResetNanoseconds: 30_000_000_000) - let firstClient = MobileCoreRPCClient( + let sharedScope = MobileRPCAuthScope() + let firstClient = MobileCoreRPCClient.testClient( runtime: TestMobileSyncRuntime( transportFactory: QueuedCancellationProbeTransportFactory(transport: firstTransport), stackAccessTokenProvider: { try await tokenProvider.token() }, @@ -137,9 +138,10 @@ import Testing route: route, ticket: ticket, allowsStackAuthFallback: true, + authScope: sharedScope, stackTokenGate: sharedGate ) - let secondClient = MobileCoreRPCClient( + let secondClient = MobileCoreRPCClient.testClient( runtime: TestMobileSyncRuntime( transportFactory: QueuedCancellationProbeTransportFactory(transport: secondTransport), stackAccessTokenProvider: { try await tokenProvider.token() }, @@ -148,6 +150,7 @@ import Testing route: route, ticket: ticket, allowsStackAuthFallback: true, + authScope: sharedScope, stackTokenGate: sharedGate ) let request = try MobileCoreRPCClient.requestData( @@ -246,7 +249,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, @@ -325,7 +328,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCWorkspaceMoveTests.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCWorkspaceMoveTests.swift index 786cfd2abfc5..113f85d6e8ff 100644 --- a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCWorkspaceMoveTests.swift +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/MobileCoreRPCWorkspaceMoveTests.swift @@ -20,7 +20,7 @@ import Testing expiresAt: Date().addingTimeInterval(60), authToken: "ticket-secret" ) - let client = MobileCoreRPCClient( + let client = MobileCoreRPCClient.testClient( runtime: runtime, route: route, ticket: ticket, diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/ScopedRPCValidationGate.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/ScopedRPCValidationGate.swift new file mode 100644 index 000000000000..56e1e4ff7ddc --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/ScopedRPCValidationGate.swift @@ -0,0 +1,36 @@ +import Foundation + +actor ScopedRPCValidationGate { + private let blockedCall: Int + private var callCount = 0 + private var isValid = true + private var blockedWaiters: [CheckedContinuation] = [] + private var releaseWaiters: [CheckedContinuation] = [] + + init(blockedCall: Int) { + self.blockedCall = blockedCall + } + + func validate() async -> Bool { + callCount += 1 + if callCount == blockedCall { + let waiters = blockedWaiters + blockedWaiters.removeAll() + for waiter in waiters { waiter.resume() } + await withCheckedContinuation { releaseWaiters.append($0) } + } + return isValid + } + + func waitUntilBlocked() async { + if callCount >= blockedCall { return } + await withCheckedContinuation { blockedWaiters.append($0) } + } + + func invalidateAndRelease() { + isValid = false + let waiters = releaseWaiters + releaseWaiters.removeAll() + for waiter in waiters { waiter.resume() } + } +} diff --git a/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/SendAuthorizationInvocationRecorder.swift b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/SendAuthorizationInvocationRecorder.swift new file mode 100644 index 000000000000..803fd1b4e81f --- /dev/null +++ b/Packages/iOS/CmuxMobileRPC/Tests/CmuxMobileRPCTests/SendAuthorizationInvocationRecorder.swift @@ -0,0 +1,14 @@ +@testable import CmuxMobileRPC + +actor SendAuthorizationInvocationRecorder { + private var count = 0 + + func authorize() -> MobileRPCSendLease { + count += 1 + return MobileRPCSendLease() + } + + func invocationCount() -> Int { + count + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/ManualHostTrustApprovalQueued.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/ManualHostTrustApprovalQueued.swift new file mode 100644 index 000000000000..854ebec9dc63 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/ManualHostTrustApprovalQueued.swift @@ -0,0 +1,3 @@ +enum ManualHostTrustApprovalQueued: Error { + case required +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/ManualHostTrustExpirationOwner.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/ManualHostTrustExpirationOwner.swift new file mode 100644 index 000000000000..8d10126e6212 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/ManualHostTrustExpirationOwner.swift @@ -0,0 +1,21 @@ +import CMUXMobileCore +import CmuxMobileRPC +import CmuxMobileShellModel +import Foundation + +/// Identifies the foreground connection that owns one manual-host trust deadline. +struct ManualHostTrustExpirationOwner: Equatable { + let scope: MobileManualHostTrustScope + let route: CmxAttachRoute + let client: MobileCoreRPCClient + let generation: UUID + let authScope: MobileRPCAuthScope + + static func == (lhs: Self, rhs: Self) -> Bool { + lhs.scope == rhs.scope + && lhs.route == rhs.route + && lhs.client === rhs.client + && lhs.generation == rhs.generation + && lhs.authScope == rhs.authScope + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileDeleteComputersVerifier.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileDeleteComputersVerifier.swift index 1e7f68f4fba2..8a87c71436c7 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileDeleteComputersVerifier.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileDeleteComputersVerifier.swift @@ -92,7 +92,8 @@ public struct MobileDeleteComputersVerifier { ) await shell.loadPairedMacs() - shell.setWorkspaceStatesForTesting(seededWorkspaceStates(), foregroundMacDeviceID: "mac-a") + shell.foregroundMacDeviceID = "mac-a" + shell.workspacesByMac = seededWorkspaceStates() let initial = checkpoint("initial", shell: shell) let halfDeleteIDs = ["mac-a", "mac-b"] diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellAuthorizationFailureOwner.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellAuthorizationFailureOwner.swift new file mode 100644 index 000000000000..d2812ec0f4ba --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellAuthorizationFailureOwner.swift @@ -0,0 +1,30 @@ +import CMUXMobileCore +import CmuxMobileRPC +import Foundation + +/// The connection whose request produced an authorization failure. +enum MobileShellAuthorizationFailureOwner { + case foreground(client: MobileCoreRPCClient, generation: UUID, route: CmxAttachRoute?) + case connectionAttempt(route: CmxAttachRoute?, preservingActiveConnection: Bool) + case secondary(macDeviceID: String, client: MobileCoreRPCClient, route: CmxAttachRoute) + + var route: CmxAttachRoute? { + switch self { + case let .foreground(_, _, route), let .connectionAttempt(route, _): + route + case let .secondary(_, _, route): + route + } + } + + var preservesActiveConnection: Bool { + switch self { + case .foreground: + false + case let .connectionAttempt(_, preservingActiveConnection): + preservingActiveConnection + case .secondary: + true + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+AuthorizationFailure.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+AuthorizationFailure.swift new file mode 100644 index 000000000000..a4d477b9cb25 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+AuthorizationFailure.swift @@ -0,0 +1,119 @@ +import CMUXMobileCore +import CmuxMobileRPC +import CmuxMobileShellModel +import Foundation + +@MainActor +extension MobileShellComposite { + func handleAuthorizationFailureIfNeeded( + _ error: any Error, + owner: MobileShellAuthorizationFailureOwner + ) -> Bool { + guard requiresAuthorizationFailureHandling(error) else { + return false + } + if case let .foreground(client, generation, _) = owner, + (remoteClient !== client || connectionGeneration != generation) { + return true + } + if let connectionError = error as? MobileShellConnectionError, + case .insecureManualRoute = connectionError { + switch owner { + case let .foreground(_, _, route): + if queueForegroundManualHostReapproval(route: route) { + return true + } + case let .connectionAttempt(route, preservingActiveConnection): + if !preservingActiveConnection, + queueForegroundManualHostReapproval(route: route) { + return true + } + case let .secondary(macDeviceID, client, _): + invalidateSecondaryConnection(macDeviceID: macDeviceID, client: client) + return true + } + } + if case let .secondary(macDeviceID, client, _) = owner { + invalidateSecondaryConnection(macDeviceID: macDeviceID, client: client) + return true + } + let category = MobilePairingFailureCategory.classify(error: error, route: owner.route) + applyAuthorizationFailure( + category, + preservingActiveConnection: owner.preservesActiveConnection + ) + return true + } + + func queueForegroundManualHostReapproval(route: CmxAttachRoute?) -> Bool { + guard let route, + MobileShellRouteAuthPolicy().routeRequiresManualHostTrust(route), + case let .hostPort(host, port) = route.endpoint else { + return false + } + let displayName = connectedHostName.trimmingCharacters(in: .whitespacesAndNewlines) + let pairedMacDeviceID = foregroundMacDeviceID ?? activeTicket?.macDeviceID + let attemptID = beginPairingValidationAttempt() + queueManualHostTrustWarning( + route: route, + displayHost: host, + pending: .manual( + attemptID: attemptID, + name: displayName.isEmpty ? host : displayName, + host: host, + port: port, + route: route, + pairedMacDeviceID: pairedMacDeviceID, + instanceTagExpectation: MobileMacInstanceTagAuthority.expectation( + storedInstanceTag: activeMacInstanceTag + ), + recordsPairingAttempt: false, + macSwitchAttemptID: nil, + ifStillCurrent: nil + ) + ) + disconnectForegroundForManualHostReapproval() + return true + } + + func invalidateSecondaryConnection( + macDeviceID: String, + client: MobileCoreRPCClient + ) { + guard let subscription = secondaryMacSubscriptions[macDeviceID], + subscription.client === client else { + return + } + subscription.cancel() + secondaryMacSubscriptions[macDeviceID] = nil + removeSecondaryConnectionFromPool(macDeviceID: macDeviceID) + if var state = workspacesByMac[macDeviceID] { + state.status = .unavailable + workspacesByMac[macDeviceID] = state + } + } + + func requiresAuthorizationFailureHandling(_ error: any Error) -> Bool { + guard let connectionError = error as? MobileShellConnectionError else { + return false + } + switch connectionError { + case .attachTicketExpired, .authorizationFailed, .accountMismatch, .insecureManualRoute: + return true + case let .rpcError(code, message): + let normalizedCode = code?.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() + if let normalizedCode, + ["unauthorized", "forbidden", "invalid_token", "token_expired", "expired_token", "auth_required"].contains(normalizedCode) { + return true + } + let normalizedMessage = message.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() + return normalizedMessage.contains("unauthorized") + || normalizedMessage.contains("forbidden") + || normalizedMessage.contains("invalid token") + || normalizedMessage.contains("expired token") + || normalizedMessage.contains("token expired") + case .invalidResponse, .connectionClosed, .requestTimedOut, .transportWriteTimedOut: + return false + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ConnectionRecovery.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ConnectionRecovery.swift index c556f826a3e4..cc345da63c53 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ConnectionRecovery.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ConnectionRecovery.swift @@ -35,6 +35,11 @@ extension MobileShellComposite { // connection so a moving network repaints instead of going stale. for await _ in reachability.pathChanges() { guard let self, !Task.isCancelled else { return } + // Every callback is also a plaintext-trust boundary. Public + // path attributes can look identical across different LANs. + if self.invalidateManualHostTrustForNetworkBoundary() { + continue + } self.recoverMobileConnection(trigger: .networkChange) } } @@ -167,7 +172,15 @@ extension MobileShellComposite { sourceConnectionGeneration: connectionGeneration, probing: probeCurrentConnection ) - guard let attempt else { return } + guard let attempt else { + // Newest-wins trailing network recovery: a path change that lands + // while an attempt is in flight must not be dropped, or a network + // that comes back mid-redial strands the user on Retry. + if trigger == .networkChange { + pendingNetworkRecoveryTrigger = true + } + return + } diagnosticLog?.record(DiagnosticEvent( .recoveryStarted, a: activeRoute.map { DiagnosticTransportKind($0.kind).rawValue } @@ -250,10 +263,19 @@ extension MobileShellComposite { "connection.recovery cancelled trigger=\(trigger.description) attempt=\(attempt.id.uuidString)" ) } + self.drainPendingNetworkRecoveryTriggerIfIdle() } connectionRecoveryOwner.install(task, for: attempt) } + /// Runs the network recovery that was parked behind an in-flight attempt. + func drainPendingNetworkRecoveryTriggerIfIdle() { + guard pendingNetworkRecoveryTrigger, + !connectionRecoveryOwner.isActive else { return } + pendingNetworkRecoveryTrigger = false + recoverMobileConnection(trigger: .networkChange) + } + @discardableResult func completeConnectionRecovery( _ attempt: MobileConnectionRecoveryOwner.Attempt @@ -376,131 +398,6 @@ extension MobileShellComposite { ) } - /// Reconnects an already-paired Mac through its full route set. - /// - /// This path is used only when the set contains an authenticated Iroh peer - /// route. `connect(ticket:)` pins the pairing to Iroh, so an admission or - /// revocation failure cannot downgrade to raw Tailscale/custom-network RPC. - /// The synthetic ticket names the already-paired device; it is never used to - /// discover or create a new pairing. - func connectStoredMacRoutes( - name: String, - routes: [CmxAttachRoute], - pairedMacDeviceID: String, - ifStillCurrent: (() -> Bool)? = nil - ) async { - let ticket: CmxAttachTicket - do { - ticket = try Self.storedMacTicket( - name: name, - routes: routes, - pairedMacDeviceID: pairedMacDeviceID - ) - _ = try await connect( - ticket: ticket, - pairedMacDeviceID: pairedMacDeviceID, - ifStillCurrent: ifStillCurrent - ) - } catch { - guard ifStillCurrent?() ?? true else { return } - mobileShellLog.warning( - "stored route reconnect failed mac=\(pairedMacDeviceID, privacy: .public) error=\(String(describing: error), privacy: .private)" - ) - if disconnectForAuthorizationFailureIfNeeded(error) { return } - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() - } - } - - /// Connects an existing pairing through its strongest supported transport. - /// A supported Iroh identity pins the attempt to Iroh. Raw Tailscale/custom - /// host routes remain available only for legacy pairings without Iroh. - @discardableResult - func connectStoredMac( - name: String, - routes: [CmxAttachRoute], - pairedMacDeviceID: String, - recordsPairingAttempt: Bool = false, - ifStillCurrent: (() -> Bool)? = nil - ) async -> Bool { - guard ifStillCurrent?() ?? true else { return false } - let supportedKinds = runtime?.supportedRouteKinds ?? [] - let pinnedRoutes = Self.storedReconnectRoutes( - routes, - supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes - ) - guard let firstRoute = pinnedRoutes.first else { return false } - - if firstRoute.kind == .iroh { - await connectStoredMacRoutes( - name: name, - routes: pinnedRoutes, - pairedMacDeviceID: pairedMacDeviceID, - ifStillCurrent: ifStillCurrent - ) - } else { - let candidates = Self.reconnectHostPortRoutes( - pinnedRoutes, - supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes - ).filter { MobileShellRouteAuthPolicy.normalizedManualHost($0.host) != nil } - for route in candidates { - guard ifStillCurrent?() ?? true else { return false } - if recordsPairingAttempt { - await connectManualHost( - name: name, - host: route.host, - port: route.port, - pairedMacDeviceID: pairedMacDeviceID, - recordsPairingAttempt: true, - ifStillCurrent: ifStillCurrent - ) - } else { - await connectStoredMacHost( - name: name, - host: route.host, - port: route.port, - pairedMacDeviceID: pairedMacDeviceID, - ifStillCurrent: ifStillCurrent - ) - } - if connectionState == .connected, - remoteClient != nil, - foregroundMacDeviceID == pairedMacDeviceID { - break - } - } - } - - return (ifStillCurrent?() ?? true) - && connectionState == .connected - && remoteClient != nil - && foregroundMacDeviceID == pairedMacDeviceID - } - - func connectStoredMacHost( - name: String, - host: String, - port: Int, - pairedMacDeviceID: String, - instanceTag: String? = nil, - ifStillCurrent: (() -> Bool)? = nil - ) async { - await connectManualHost( - name: name, - host: host, - port: port, - pairedMacDeviceID: pairedMacDeviceID, - instanceTagExpectation: MobileMacInstanceTagAuthority.expectation( - storedInstanceTag: instanceTag - ), - recordsPairingAttempt: false, - ifStillCurrent: ifStillCurrent - ) - } - /// Reconnects a stored Mac through its Iroh-pinned route set while also /// enforcing the authenticated app-instance authority captured by storage. @discardableResult @@ -511,6 +408,7 @@ extension MobileShellComposite { instanceTag: String?, automaticReconnectAccountID: String? = nil, recordsPairingAttempt: Bool = false, + pendingMacSwitchAttemptID: UUID? = nil, ifStillCurrent: (() -> Bool)? = nil ) async -> Bool { (await connectStoredMacOutcome( @@ -520,6 +418,7 @@ extension MobileShellComposite { instanceTag: instanceTag, automaticReconnectAccountID: automaticReconnectAccountID, recordsPairingAttempt: recordsPairingAttempt, + pendingMacSwitchAttemptID: pendingMacSwitchAttemptID, ifStillCurrent: ifStillCurrent )).didConnect } @@ -531,6 +430,7 @@ extension MobileShellComposite { instanceTag: String?, automaticReconnectAccountID: String? = nil, recordsPairingAttempt: Bool = false, + pendingMacSwitchAttemptID: UUID? = nil, ifStillCurrent: (() -> Bool)? = nil ) async -> StoredMacReconnectOutcome { await connectStoredMacOutcome( @@ -542,6 +442,7 @@ extension MobileShellComposite { ), automaticReconnectAccountID: automaticReconnectAccountID, recordsPairingAttempt: recordsPairingAttempt, + pendingMacSwitchAttemptID: pendingMacSwitchAttemptID, ifStillCurrent: ifStillCurrent ) } @@ -556,6 +457,7 @@ extension MobileShellComposite { instanceTagExpectation: MobileMacInstanceTagExpectation, automaticReconnectAccountID: String? = nil, recordsPairingAttempt: Bool = false, + pendingMacSwitchAttemptID: UUID? = nil, ifStillCurrent: (() -> Bool)? = nil ) async -> StoredMacReconnectOutcome { guard ifStillCurrent?() ?? true else { return .superseded } @@ -563,13 +465,14 @@ extension MobileShellComposite { let pinnedRoutes = Self.storedReconnectRoutes( routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) guard let firstRoute = pinnedRoutes.first else { return .failed(.unsupportedRoute) } var outcome: StoredMacReconnectOutcome = .failed(.unknown) if firstRoute.kind == .iroh { + let preservesActiveConnection = hasActiveMacConnection do { let ticket = try Self.storedMacTicket( name: name, @@ -578,6 +481,7 @@ extension MobileShellComposite { ) let noThrowFailure = try await connect( ticket: ticket, + authContext: currentRPCAuthContext(), pairedMacDeviceID: pairedMacDeviceID, instanceTagExpectation: instanceTagExpectation, ifStillCurrent: ifStillCurrent @@ -588,14 +492,23 @@ extension MobileShellComposite { } } catch { guard ifStillCurrent?() ?? true else { return .superseded } - outcome = .failed(Self.diagnosticFailureKind(for: error)) + let routedError = error as? MobileShellRoutedConnectionError + let underlyingError = routedError?.underlying ?? error + let failureRoute = routedError?.route ?? firstRoute + outcome = .failed(Self.diagnosticFailureKind(for: underlyingError)) if let automaticReconnectAccountID { recordAutomaticReconnectBackoff( - error: error, + error: underlyingError, accountID: automaticReconnectAccountID ) } - if !disconnectForAuthorizationFailureIfNeeded(error) { + if !handleAuthorizationFailureIfNeeded( + underlyingError, + owner: .connectionAttempt( + route: failureRoute, + preservingActiveConnection: preservesActiveConnection + ) + ) { connectionState = .disconnected macConnectionStatus = .unavailable clearRemoteConnectionContext() @@ -605,24 +518,26 @@ extension MobileShellComposite { let candidates = Self.reconnectHostPortRoutes( pinnedRoutes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) for route in candidates { guard ifStillCurrent?() ?? true else { return .superseded } - await connectManualHost( + let result = await connectManualHost( name: name, host: route.host, port: route.port, pairedMacDeviceID: pairedMacDeviceID, instanceTagExpectation: instanceTagExpectation, recordsPairingAttempt: recordsPairingAttempt, + route: route.route, + pendingMacSwitchAttemptID: pendingMacSwitchAttemptID, ifStillCurrent: ifStillCurrent ) - if connectionState == .connected, - remoteClient != nil, - foregroundMacDeviceID == pairedMacDeviceID { - break - } + // Only a plain failure moves on to the next candidate. A + // pending user approval owns this attempt's continuation: + // dialing the next candidate would rotate the pairing attempt, + // supersede the queued trust warning, and strand the approval. + guard result == .failed else { break } } } @@ -759,7 +674,7 @@ extension MobileShellComposite { let candidateRoutes = Self.storedReconnectRoutes( instance.routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) guard !candidateRoutes.isEmpty else { mobileShellLog.error( @@ -802,6 +717,7 @@ extension MobileShellComposite { timeoutNanoseconds: UInt64? = nil ) async -> Bool { guard let client = remoteClient else { return false } + let generation = connectionGeneration do { let request = try MobileCoreRPCClient.requestData( method: "mobile.workspace.list", @@ -812,7 +728,7 @@ extension MobileShellComposite { timeoutNanoseconds: timeoutNanoseconds ?? runtime?.rpcRequestTimeoutNanoseconds ) let response = try MobileSyncWorkspaceListResponse.decode(data) - guard remoteClient === client, connectionState == .connected else { return false } + guard isCurrentRemoteOperation(client: client, generation: generation) else { return false } applyRemoteWorkspaceList(response, preferActiveTicketTarget: false) syncSelectedTerminalForWorkspace() return true @@ -821,7 +737,10 @@ extension MobileShellComposite { "workspace list event refresh failed: \(String(describing: error), privacy: .private)" ) if remoteClient === client { - _ = disconnectForAuthorizationFailureIfNeeded(error) + _ = handleAuthorizationFailureIfNeeded( + error, + owner: .foreground(client: client, generation: generation, route: activeRoute) + ) } return false } diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+MacSwitchState.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+MacSwitchState.swift index 69ca15ad3461..e0e1ae32ebb8 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+MacSwitchState.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+MacSwitchState.swift @@ -28,6 +28,18 @@ extension MobileShellComposite { ) } + /// Whether the live foreground connection has the stored target's device and instance authority. + func foregroundConnectionMatches(_ mac: MobilePairedMac) -> Bool { + guard connectionState == .connected, + remoteClient != nil, + foregroundMacDeviceID == mac.macDeviceID else { return false } + guard mac.instanceTag != nil else { return true } + return MobileMacInstanceTagAuthority.sameStoredAuthority( + mac.instanceTag, + activeMacInstanceTag + ) + } + /// Resolves the live foreground Mac that a failed destructive switch should restore. func previousForegroundMacForSwitchRestore( previousForegroundMacDeviceID: String?, @@ -51,7 +63,7 @@ extension MobileShellComposite { let aliasSetsByMacID = macDeviceIDAliasSetsByPairedMacID( in: candidates, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + routeSelection: routeSelection ) return candidates.first { candidate in guard candidate.macDeviceID != macDeviceID else { return false } diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualAttachTicket.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualAttachTicket.swift index 602cb640ad5f..52cfea3d81ba 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualAttachTicket.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualAttachTicket.swift @@ -36,7 +36,7 @@ extension MobileShellComposite { macDeviceID: macDeviceID, macDisplayName: displayName, routes: [route], - expiresAt: Date().addingTimeInterval(60 * 60) + expiresAt: Date.now.addingTimeInterval(60 * 60) ) } @@ -44,16 +44,23 @@ extension MobileShellComposite { name: String, host: String, port: Int, - attemptStartedAt: Date? + route: CmxAttachRoute? = nil, + attemptStartedAt: Date?, + manualHostTrusted: Bool = false, + authContext: MobileShellRPCAuthContext ) async throws -> CmxAttachTicket { - let directRoute = try Self.manualHostRoute(host: host, port: port) + let directRoute = try routeSelection.manualHostRoute(host: host, port: port, preserving: route) let displayName = name.isEmpty ? host : name - if MobileShellRouteAuthPolicy.routeAllowsStackAuth(directRoute) { + if MobileShellRouteAuthPolicy().routeAllowsStackAuth( + directRoute, + manualHostTrusted: manualHostTrusted + ) { do { let ticket = try await requestManualAttachTicket( route: directRoute, displayName: displayName, - attemptStartedAt: attemptStartedAt + attemptStartedAt: attemptStartedAt, + authContext: authContext ) return ticket } catch { @@ -94,7 +101,8 @@ extension MobileShellComposite { func requestManualAttachTicket( route: CmxAttachRoute, displayName: String, - attemptStartedAt: Date? + attemptStartedAt: Date?, + authContext: MobileShellRPCAuthContext ) async throws -> CmxAttachTicket { guard let runtime else { throw MobileShellConnectionError.insecureManualRoute @@ -109,6 +117,12 @@ extension MobileShellComposite { route: route, ticket: probeTicket, allowsStackAuthFallback: true, + manualHostStackAuthTrustProvider: manualHostStackAuthTrustProvider( + for: route, + stackUserID: authContext.stackUserID + ), + authScope: rpcAuthScopeForRoute(for: route, context: authContext), + authScopeValidator: rpcAuthScopeValidator(for: route, context: authContext), connectAttemptRegistry: connectAttemptRegistry, stackTokenGate: stackTokenGate, stackTokenForceRefreshGate: stackTokenForceRefreshGate, diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualHostConnection.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualHostConnection.swift new file mode 100644 index 000000000000..43bc7dd53dd7 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualHostConnection.swift @@ -0,0 +1,179 @@ +import CMUXMobileCore +import CmuxMobileRPC +import CmuxMobileShellModel +import CmuxMobileSupport +import Foundation +import OSLog + +private let mobileShellManualHostConnectionLog = Logger( + subsystem: Bundle.main.bundleIdentifier ?? "dev.cmux.ios", + category: "mobile-shell" +) + +@MainActor +extension MobileShellComposite { + /// Connects to one explicit host while preserving the current foreground + /// connection until trust and ownership validation have completed. + /// + /// - Parameter pairedMacDeviceID: The real paired-Mac device ID when the caller + /// knows it. A manual host whose Mac lacks `mobile.attach_ticket.create` + /// connects through a synthetic ticket; passing the real ID keeps aggregate + /// state keyed to the paired Mac. Pass `nil` for an unknown manual host. + @discardableResult + func connectManualHost( + name: String, + host: String, + port: Int, + pairedMacDeviceID: String? = nil, + instanceTagExpectation: MobileMacInstanceTagExpectation = .adopt, + recordsPairingAttempt: Bool, + route: CmxAttachRoute? = nil, + pendingMacSwitchAttemptID: UUID? = nil, + ifStillCurrent: (() -> Bool)? = nil + ) async -> MobilePairingURLConnectionResult { + let trimmedName = name.trimmingCharacters(in: .whitespacesAndNewlines) + let preservesActiveConnection = hasActiveMacConnection + let authContext = currentRPCAuthContext() + guard let normalizedHost = MobileShellRouteAuthPolicy().normalizedManualRouteHost(host) else { + connectionError = L10n.string("mobile.addDevice.invalidHost", defaultValue: "Enter a host or IP address, without spaces or URL paths.") + connectionErrorGuidance = nil + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) + analytics.capture("ios_pairing_failed", [ + "method": .string("manual"), + "reason": .string("invalid_host"), + "failure_phase": .string("validation"), + "is_first_pair": .bool(!hasKnownPairedMac), + ]) + return .failed + } + guard (1...65535).contains(port) else { + connectionError = L10n.string("mobile.addDevice.invalidPort", defaultValue: "Enter a port from 1 to 65535.") + connectionErrorGuidance = nil + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) + analytics.capture("ios_pairing_failed", [ + "method": .string("manual"), + "reason": .string("invalid_port"), + "failure_phase": .string("validation"), + "is_first_pair": .bool(!hasKnownPairedMac), + ]) + return .failed + } + + guard authContext.hasStackUserID else { + applyAuthorizationFailure(.authFailed, preservingActiveConnection: preservesActiveConnection) + return .failed + } + let directRoute = try? routeSelection.manualHostRoute(host: normalizedHost, port: port, preserving: route) + let approvalAttemptID = beginPairingValidationAttempt() + if let directRoute { + let needsApproval = await manualHostRouteNeedsApproval( + directRoute, + stackUserID: authContext.stackUserID + ) + guard isCurrentPairingAttempt(approvalAttemptID), + isRPCAuthContextCurrent(authContext) else { return .superseded } + if needsApproval { + queueManualHostTrustWarning( + route: directRoute, + displayHost: normalizedHost, + pending: .manual( + attemptID: approvalAttemptID, + name: name, + host: normalizedHost, + port: port, + route: directRoute, + pairedMacDeviceID: pairedMacDeviceID, + instanceTagExpectation: instanceTagExpectation, + recordsPairingAttempt: recordsPairingAttempt, + macSwitchAttemptID: pendingMacSwitchAttemptID, + ifStillCurrent: ifStillCurrent + ) + ) + return .needsUserApproval + } + } + let attemptID = recordsPairingAttempt + ? beginPairingAttempt(method: "manual") + : approvalAttemptID + guard isCurrentPairingAttempt(attemptID) else { return .superseded } + if !preservesActiveConnection { + activeRoute = directRoute + } + switch await failPairingIfOffline( + attemptID: attemptID, + phase: "preflight", + routes: directRoute.map { [$0] } ?? [], + preservesActiveConnection: preservesActiveConnection + ) { + case .failedOffline: return .failed + case .superseded: return .superseded + case .proceed: break + } + do { + guard ifStillCurrent?() != false else { return .superseded } + let manualHostTrusted = await manualHostStackAuthTrusted( + for: directRoute, + stackUserID: authContext.stackUserID + ) + guard isCurrentPairingAttempt(attemptID), + isRPCAuthContextCurrent(authContext), + ifStillCurrent?() != false else { return .superseded } + let ticket = try await manualHostTicket( + name: trimmedName, + host: normalizedHost, + port: port, + route: directRoute, + attemptStartedAt: pairingAttemptStartedAt, + manualHostTrusted: manualHostTrusted, + authContext: authContext + ) + guard isCurrentPairingAttempt(attemptID) else { return .superseded } + let noThrowFailure = try await connect( + ticket: ticket, + authContext: authContext, + allowsStackAuthFallback: directRoute.map { + MobileShellRouteAuthPolicy().routeAllowsStackAuth( + $0, + manualHostTrusted: manualHostTrusted + ) + }, + pairedMacDeviceID: pairedMacDeviceID, + instanceTagExpectation: instanceTagExpectation, + ifStillCurrent: { + self.isCurrentPairingAttempt(attemptID) + && (ifStillCurrent?() ?? true) + } + ) + guard isCurrentPairingAttempt(attemptID) else { return .superseded } + if noThrowFailure == nil, connectionState == .connected { + recordPairingSucceeded() + return .connected + } + recordFailureForCurrentConnectionError(phase: "connect", category: noThrowFailure) + return .failed + } catch is CancellationError { + guard isCurrentPairingAttempt(attemptID) else { return .superseded } + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) + return .failed + } catch { + guard isCurrentPairingAttempt(attemptID) else { return .superseded } + let routedError = error as? MobileShellRoutedConnectionError + let underlyingError = routedError?.underlying ?? error + let failureRoute = routedError?.route ?? directRoute ?? activeRoute + mobileShellManualHostConnectionLog.error( + "manual host pairing failed: \(String(describing: error), privacy: .private)" + ) + if handleAuthorizationFailureIfNeeded( + underlyingError, + owner: .connectionAttempt( + route: failureRoute, + preservingActiveConnection: preservesActiveConnection + ) + ) { return .failed } + let category = MobilePairingFailureCategory.classify(error: underlyingError, route: failureRoute) + applyPairingFailure(category, phase: "connect") + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) + return .failed + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualHostTrust.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualHostTrust.swift new file mode 100644 index 000000000000..5fff26339d34 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ManualHostTrust.swift @@ -0,0 +1,387 @@ +import CMUXMobileCore +import CmuxMobileRPC +public import CmuxMobileShellModel +import Foundation + +private struct ManualHostReapproval { + let name: String + let host: String + let port: Int + let route: CmxAttachRoute + let pairedMacDeviceID: String? + let instanceTagExpectation: MobileMacInstanceTagExpectation +} + +@MainActor +extension MobileShellComposite { + func clearManualHostTrustWarning() { + cancelPendingWorkspaceOpenIntent() + manualHostTrustWarning = nil + pendingManualHostTrust = nil + } + + func clearSupersededManualHostTrustWarning() { + let pending = pendingManualHostTrust + clearManualHostTrustWarning() + if let pending { + finishPendingManualHostSwitchAttempt(pending) + } + } + + func manualHostTrustScope( + for route: CmxAttachRoute?, + stackUserID: String? = nil + ) -> MobileManualHostTrustScope? { + guard let route, + MobileShellRouteAuthPolicy().routeRequiresManualHostTrust(route) else { + return nil + } + return MobileManualHostTrustScope( + route: route, + stackUserID: stackUserID ?? identityProvider?.currentUserID + ) + } + + func manualHostStackAuthTrusted( + for route: CmxAttachRoute?, + stackUserID: String? = nil + ) async -> Bool { + guard let scope = manualHostTrustScope(for: route, stackUserID: stackUserID) else { + return false + } + return await manualHostTrustIsAvailable(scope) + } + + func manualHostStackAuthTrustProvider( + for route: CmxAttachRoute?, + stackUserID: String? = nil + ) -> @Sendable () async -> Bool { + guard let scope = manualHostTrustScope(for: route, stackUserID: stackUserID) else { + return { false } + } + return { [weak self] in + guard let self else { return false } + return await self.manualHostTrustIsAvailable(scope) + } + } + + func manualHostRouteNeedsApproval( + _ route: CmxAttachRoute, + stackUserID: String? = nil + ) async -> Bool { + guard let scope = manualHostTrustScope(for: route, stackUserID: stackUserID) else { + return false + } + return !(await manualHostTrustIsAvailable(scope)) + } + + func firstManualHostRouteNeedingApproval( + in routes: [CmxAttachRoute], + stackUserID: String? + ) async -> (route: CmxAttachRoute, scope: MobileManualHostTrustScope)? { + let routeAuthPolicy = MobileShellRouteAuthPolicy() + for route in routes { + if let scope = manualHostTrustScope(for: route, stackUserID: stackUserID) { + if !(await manualHostTrustIsAvailable(scope)) { + return (route, scope) + } + return nil + } + if routeAuthPolicy.routeAllowsStackAuth(route) { + // A safer route will be selected before any later manual-host fallback. + // Do not train the user to approve plaintext LAN unless it is needed. + return nil + } + } + return nil + } + + func queueManualHostTrustWarning( + route: CmxAttachRoute, + displayHost: String, + pending: PendingManualHostTrust + ) { + guard let scope = manualHostTrustScope(for: route) else { + return + } + clearPairingError() + clearPairingVersionWarning() + if let currentPending = pendingManualHostTrust, + currentPending.attemptID != pending.attemptID { + cancelPendingWorkspaceOpenIntent() + finishPendingManualHostSwitchAttempt(currentPending) + } + pendingManualHostTrust = pending + manualHostTrustWarning = MobileManualHostTrustWarning( + scope: scope, + displayHost: displayHost + ) + } + + /// Persists the queued manual-host trust approval and resumes the pending pairing attempt. + /// - Returns: The resumed result, or `.superseded` when the warning is no longer current. + @discardableResult + public func acceptManualHostTrustWarning() async -> MobilePairingURLConnectionResult { + guard let approvalAttemptID = pendingManualHostTrust?.attemptID else { + clearManualHostTrustWarning() + return .superseded + } + if let resetTask = manualHostTrustResetTask { + await resetTask.value + } + guard let warning = manualHostTrustWarning, + let pending = pendingManualHostTrust, + pending.attemptID == approvalAttemptID else { + if pendingManualHostTrust?.attemptID == approvalAttemptID { + clearManualHostTrustWarning() + } + return .superseded + } + guard isPendingManualHostTrustCurrent(pending) else { + finishPendingManualHostSwitchAttempt(pending) + clearManualHostTrustWarning() + return .superseded + } + let workspaceOpenIntent = takePendingWorkspaceOpenIntent(for: pending) + let approvalAuthScope = manualHostRPCAuthScope + clearManualHostTrustWarning() + await manualHostTrustStore.trust(warning.scope) + guard approvalAuthScope == manualHostRPCAuthScope else { + // A path change can race persistence. Remove again after the write so + // trust from the previous network epoch cannot survive the boundary. + await manualHostTrustStore.removeAll() + if let workspaceOpenIntent { + cancelWorkspaceOpen(workspaceOpenIntent) + } + finishPendingManualHostSwitchAttempt(pending) + return .superseded + } + guard isPendingManualHostTrustCurrent(pending) else { + if let workspaceOpenIntent { + cancelWorkspaceOpen(workspaceOpenIntent) + } + finishPendingManualHostSwitchAttempt(pending) + return .superseded + } + switch pending { + case let .manual( + _, name, host, port, route, pairedMacDeviceID, instanceTagExpectation, + recordsPairingAttempt, macSwitchAttemptID, ifStillCurrent + ): + let result = await connectManualHost( + name: name, + host: host, + port: port, + pairedMacDeviceID: pairedMacDeviceID, + instanceTagExpectation: instanceTagExpectation, + recordsPairingAttempt: recordsPairingAttempt, + route: route, + pendingMacSwitchAttemptID: macSwitchAttemptID, + ifStillCurrent: ifStillCurrent + ) + if result == .needsUserApproval { + pendingWorkspaceOpenIntent = workspaceOpenIntent + return result + } + finishPendingManualHostSwitchAttempt(pending) + if result == .connected, let workspaceOpenIntent { + await resumePendingWorkspaceOpen(workspaceOpenIntent) + } else if let workspaceOpenIntent { + cancelWorkspaceOpen(workspaceOpenIntent) + } + return result + case let .pairingURL(_, rawURL, acceptedVersionWarning, approvedRouteID): + return await connectPairingURLResult( + rawURL, + acceptedVersionWarning: acceptedVersionWarning, + approvedManualRouteID: approvedRouteID + ) + } + } + + private func isPendingManualHostTrustCurrent(_ pending: PendingManualHostTrust) -> Bool { + guard !Task.isCancelled, + isCurrentPairingAttempt(pending.attemptID), + pending.ifStillCurrent?() != false else { + return false + } + return true + } + + private func finishPendingManualHostSwitchAttempt(_ pending: PendingManualHostTrust) { + guard let attemptID = pending.macSwitchAttemptID else { return } + finishMacSwitchAttempt(attemptID) + } + + private func manualHostTrustIsAvailable(_ scope: MobileManualHostTrustScope) async -> Bool { + guard manualHostTrustResetTask == nil else { return false } + return await manualHostTrustStore.isTrusted(scope) + } + + func cancelManualHostTrustExpiration() { + manualHostTrustExpirationTask?.cancel() + manualHostTrustExpirationTask = nil + manualHostTrustExpirationOwner = nil + } + + func scheduleManualHostTrustExpirationForActiveRoute() { + guard let route = activeRoute, + let client = remoteClient, + connectionState == .connected, + let scope = manualHostTrustScope(for: route) else { + cancelManualHostTrustExpiration() + return + } + let owner = ManualHostTrustExpirationOwner( + scope: scope, + route: route, + client: client, + generation: connectionGeneration, + authScope: manualHostRPCAuthScope + ) + guard manualHostTrustExpirationOwner != owner else { return } + cancelManualHostTrustExpiration() + manualHostTrustExpirationOwner = owner + let trustStore = manualHostTrustStore + manualHostTrustExpirationTask = Task { @MainActor [weak self] in + guard let expiration = await trustStore.expirationDate(for: scope), + let self, + self.manualHostTrustExpirationIsCurrent(owner) else { return } + let delay = expiration.timeIntervalSince(self.runtime?.now() ?? Date()) + if delay > 0 { + try? await ContinuousClock().sleep(for: .seconds(delay)) + } + guard !Task.isCancelled, + self.manualHostTrustExpirationIsCurrent(owner), + !(await trustStore.isTrusted(scope)), + self.manualHostTrustExpirationIsCurrent(owner) else { return } + self.rotateManualHostRPCAuthScope() + _ = self.queueForegroundManualHostReapproval(route: route) + } + } + + private func manualHostTrustExpirationIsCurrent(_ owner: ManualHostTrustExpirationOwner) -> Bool { + connectionState == .connected + && manualHostTrustExpirationOwner == owner + && remoteClient === owner.client + && connectionGeneration == owner.generation + && activeRoute == owner.route + && manualHostRPCAuthScope == owner.authScope + } + + func scheduleManualHostTrustExpirationForSecondarySubscription( + _ subscription: SecondaryMacSubscription, + stackUserID: String + ) { + subscription.trustExpirationTask?.cancel() + subscription.trustExpirationTask = nil + guard let scope = manualHostTrustScope( + for: subscription.route, + stackUserID: stackUserID + ) else { return } + let trustStore = manualHostTrustStore + subscription.trustExpirationTask = Task { @MainActor [weak self, weak subscription] in + guard let expiration = await trustStore.expirationDate(for: scope), + let self, + let subscription, + self.secondaryMacSubscriptions[subscription.macDeviceID] === subscription else { + return + } + let delay = expiration.timeIntervalSince(self.runtime?.now() ?? Date()) + if delay > 0 { + // Trust expiry is an intentional bounded deadline tied to this subscription's lifecycle. + try? await ContinuousClock().sleep(for: .seconds(delay)) + } + guard !Task.isCancelled, + self.secondaryMacSubscriptions[subscription.macDeviceID] === subscription, + !(await trustStore.isTrusted(scope)), + self.secondaryMacSubscriptions[subscription.macDeviceID] === subscription else { + return + } + self.invalidateSecondaryConnection( + macDeviceID: subscription.macDeviceID, + client: subscription.client + ) + } + } + + /// Revokes plaintext-route credentials at any boundary that may represent a new network. + /// - Returns: Whether an active manual-host connection was queued for reapproval. + @discardableResult + func invalidateManualHostTrustForNetworkBoundary() -> Bool { + let reapproval = reissuableManualHostApproval() + revokeSecondaryManualHostSubscriptions() + rotateManualHostRPCAuthScope() + invalidatePairingAttempt() + clearSupersededManualHostTrustWarning() + + if manualHostTrustResetTask == nil { + manualHostTrustResetGeneration &+= 1 + let resetGeneration = manualHostTrustResetGeneration + let trustStore = manualHostTrustStore + manualHostTrustResetTask = Task { @MainActor [weak self] in + await trustStore.removeAll() + guard let self, + self.manualHostTrustResetGeneration == resetGeneration else { return } + self.manualHostTrustResetTask = nil + } + } + + if let reapproval { + let attemptID = beginPairingValidationAttempt() + queueManualHostTrustWarning( + route: reapproval.route, + displayHost: reapproval.host, + pending: .manual( + attemptID: attemptID, + name: reapproval.name, + host: reapproval.host, + port: reapproval.port, + route: reapproval.route, + pairedMacDeviceID: reapproval.pairedMacDeviceID, + instanceTagExpectation: reapproval.instanceTagExpectation, + recordsPairingAttempt: false, + macSwitchAttemptID: nil, + ifStillCurrent: nil + ) + ) + return true + } + + guard remoteClient != nil else { return false } + return queueForegroundManualHostReapproval(route: activeRoute) + } + + private func reissuableManualHostApproval() -> ManualHostReapproval? { + guard manualHostTrustWarning != nil, + case let .manual( + _, name, host, port, route, pairedMacDeviceID, instanceTagExpectation, + recordsPairingAttempt, macSwitchAttemptID, ifStillCurrent + )? = pendingManualHostTrust, + !recordsPairingAttempt, + macSwitchAttemptID == nil, + ifStillCurrent == nil else { + return nil + } + return ManualHostReapproval( + name: name, + host: host, + port: port, + route: route, + pairedMacDeviceID: pairedMacDeviceID, + instanceTagExpectation: instanceTagExpectation + ) + } + + private func revokeSecondaryManualHostSubscriptions() { + let subscriptions = secondaryMacSubscriptions.values.filter { + $0.route.kind == .manualHost + } + for subscription in subscriptions { + invalidateSecondaryConnection( + macDeviceID: subscription.macDeviceID, + client: subscription.client + ) + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacAliases.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacAliases.swift index 0fc6d834784a..c1e3c566bd6f 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacAliases.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacAliases.swift @@ -8,7 +8,7 @@ extension MobileShellComposite { Self.coalescePairedMacsByDialEndpoint( pairedMacs, supportedKinds: runtime?.supportedRouteKinds ?? [], - preferNonLoopback: Self.prefersNonLoopbackRoutes + routeSelection: routeSelection ) } diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacCoalescing.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacCoalescing.swift index fada10c141b9..9f9e952e158e 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacCoalescing.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacCoalescing.swift @@ -15,7 +15,7 @@ extension MobileShellComposite { static func coalescePairedMacsByDialEndpoint( _ macs: [MobilePairedMac], supportedKinds: [CmxAttachTransportKind], - preferNonLoopback: Bool + routeSelection: MobileShellRouteSelection ) -> [MobilePairedMac] { var selectedByKey: [String: MobilePairedMac] = [:] var orderByKey: [String: Int] = [:] @@ -23,7 +23,7 @@ extension MobileShellComposite { for (index, mac) in macs.enumerated() { let key = mac.dialEndpointKey( supportedKinds: supportedKinds, - preferNonLoopback: preferNonLoopback + routeSelection: routeSelection ) ?? "device:\(mac.id)" orderByKey[key] = min(orderByKey[key] ?? index, index) guard let existing = selectedByKey[key] else { @@ -99,14 +99,20 @@ extension MobileShellComposite { _ macDeviceID: String, in macs: [MobilePairedMac], supportedKinds: [CmxAttachTransportKind], - preferNonLoopback: Bool + routeSelection: MobileShellRouteSelection ) -> [String] { guard let target = macs.first(where: { $0.macDeviceID == macDeviceID }), - let key = target.dialEndpointKey(supportedKinds: supportedKinds, preferNonLoopback: preferNonLoopback) else { + let key = target.dialEndpointKey( + supportedKinds: supportedKinds, + routeSelection: routeSelection + ) else { return [macDeviceID] } let matching = macs.filter { - $0.dialEndpointKey(supportedKinds: supportedKinds, preferNonLoopback: preferNonLoopback) == key + $0.dialEndpointKey( + supportedKinds: supportedKinds, + routeSelection: routeSelection + ) == key }.map(\.macDeviceID) return matching.isEmpty ? [macDeviceID] : matching } @@ -114,26 +120,26 @@ extension MobileShellComposite { func macDeviceIDAliasSetsByPairedMacID( in macs: [MobilePairedMac], supportedKinds: [CmxAttachTransportKind], - preferNonLoopback: Bool + routeSelection: MobileShellRouteSelection ) -> [String: Set] { macDeviceIDAliasesByPairedMacID( in: macs, supportedKinds: supportedKinds, - preferNonLoopback: preferNonLoopback + routeSelection: routeSelection ).mapValues(Set.init) } func macDeviceIDAliasesByPairedMacID( in macs: [MobilePairedMac], supportedKinds: [CmxAttachTransportKind], - preferNonLoopback: Bool + routeSelection: MobileShellRouteSelection ) -> [String: [String]] { var groupKeyByPairingID: [String: String] = [:] var idsByGroupKey: [String: [String]] = [:] for mac in macs { let key = mac.dialEndpointKey( supportedKinds: supportedKinds, - preferNonLoopback: preferNonLoopback + routeSelection: routeSelection ) ?? "device:\(mac.id)" groupKeyByPairingID[mac.id] = key idsByGroupKey[key, default: []].append(mac.macDeviceID) @@ -151,25 +157,24 @@ private extension MobilePairedMac { @MainActor func dialEndpointKey( supportedKinds: [CmxAttachTransportKind], - preferNonLoopback: Bool + routeSelection: MobileShellRouteSelection ) -> String? { guard let displayName = displayName?.trimmingCharacters(in: .whitespacesAndNewlines), !displayName.isEmpty else { return nil } - let reconnectRoutes = MobileShellComposite.storedReconnectRoutes( + let supportedRoutes = MobileShellComposite.storedReconnectRoutes( routes, - supportedKinds: supportedKinds, - preferNonLoopback: preferNonLoopback + supportedKinds: supportedKinds ) - if case let .peer(identity, _)? = reconnectRoutes.first?.endpoint { + if case let .peer(identity, _)? = supportedRoutes.first(where: { $0.kind == .iroh })?.endpoint { return "iroh:\(identity.endpointID):name:\(displayName.lowercased()):instance:\(instanceTag ?? "")" } - guard let (host, port) = MobileShellComposite.firstReconnectHostPortRoute( - reconnectRoutes, + guard let (host, port) = routeSelection.firstReconnectHostPortRoute( + routes, supportedKinds: supportedKinds, - preferNonLoopback: preferNonLoopback - ), let normalizedHost = MobileShellRouteAuthPolicy.normalizedManualHost(host) else { + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes + ), let normalizedHost = MobileShellRouteAuthPolicy().normalizedManualRouteHost(host) else { return nil } return "host:\(normalizedHost.lowercased()):\(port):name:\(displayName.lowercased()):instance:\(instanceTag ?? "")" diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacPersistence.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacPersistence.swift index 596c7e6e339a..a4e301fed772 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacPersistence.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairedMacPersistence.swift @@ -26,6 +26,7 @@ extension MobileShellComposite { _ ticket: CmxAttachTicket, instanceTagUpdate: PairedMacInstanceTagUpdate = .preserve, displayNameOverride: String? = nil, + markActive: Bool = true, ifStillCurrent: (() -> Bool)? = nil ) async -> Bool { guard let pairedMacStore, @@ -101,6 +102,8 @@ extension MobileShellComposite { ticketRoutes: ticket.routes, storedRoutes: storedRoutes ) : ticket.routes + if let scope, await !self.isScopeCurrent(scope) { return } + guard ifStillCurrent?() != false else { return } do { if case .preserveOnlyIfUnclaimed = instanceTagUpdate { accepted = try await pairedMacStore.upsertRoutesIfAuthorized( @@ -108,7 +111,7 @@ extension MobileShellComposite { displayName: displayName, routes: routes, condition: .unclaimed, - markActive: true, + markActive: markActive, stackUserID: stackUserID, teamID: scope?.teamID, now: Date() @@ -120,12 +123,14 @@ extension MobileShellComposite { displayName: displayName, routes: routes, instanceTag: instanceTag, - markActive: true, + markActive: markActive, stackUserID: stackUserID, teamID: scope?.teamID, now: Date() ) } + guard ifStillCurrent?() != false else { return } + if let scope, await !self.isScopeCurrent(scope) { return } await self.clearForgottenMacDeviceID( ticket.macDeviceID, instanceTag: instanceTag, diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairingEntryPoints.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairingEntryPoints.swift new file mode 100644 index 000000000000..4ce25d0b1912 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PairingEntryPoints.swift @@ -0,0 +1,37 @@ +import CMUXMobileCore +public import CmuxMobileShellModel +import Foundation + +extension MobileShellComposite { + /// Connect using the current pairing input, accepting either a code or pairing URL. + @discardableResult + public func connectPairingInput() async -> MobilePairingURLConnectionResult { + let trimmedCode = pairingCode.trimmingCharacters(in: .whitespacesAndNewlines) + guard !trimmedCode.isEmpty else { + return .failed + } + if CmxPairingURLScheme.hasPairingScheme(trimmedCode) { + return await connectPairingURLResult(trimmedCode) + } + connectPreviewHost() + return connectionState == .connected ? .connected : .failed + } + + /// Connect to a manually-entered Mac host and optionally associate the + /// resulting session with an existing paired-Mac device id. + @discardableResult + public func connectManualHost( + name: String, + host: String, + port: Int, + pairedMacDeviceID: String? = nil + ) async -> MobilePairingURLConnectionResult { + await connectManualHost( + name: name, + host: host, + port: port, + pairedMacDeviceID: pairedMacDeviceID, + recordsPairingAttempt: true + ) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PlaceholderHostName.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PlaceholderHostName.swift new file mode 100644 index 000000000000..6d6fa9237aca --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+PlaceholderHostName.swift @@ -0,0 +1,23 @@ +import CMUXMobileCore + +extension MobileShellComposite { + /// The name shown for the Mac until `mobile.host.status` reports the real + /// one: the ticket's display name, then its device id, then the dialed + /// route's host (a minimal pairing code carries neither name nor id, so the + /// route hostname is the best available placeholder). + func placeholderHostName( + for ticket: CmxAttachTicket, + firstRoute: CmxAttachRoute + ) -> String { + if let name = ticket.macDisplayName, !name.isEmpty { + return name + } + if !ticket.macDeviceID.isEmpty { + return ticket.macDeviceID + } + if case let .hostPort(host, _) = firstRoute.endpoint { + return host + } + return "" + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ReconnectRoutes.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ReconnectRoutes.swift index cd5b5a926467..8d3f8f04919e 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ReconnectRoutes.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ReconnectRoutes.swift @@ -175,13 +175,11 @@ extension MobileShellComposite { /// The first reachable host/port route to a Mac, in priority order. /// - /// When `preferNonLoopback` is set (physical devices), a real route - /// (`.tailscale` etc.) is always chosen over a `.debugLoopback` route even - /// if the loopback route has a lower (more-preferred) priority, because a - /// loopback route can never reach a remote Mac from a physical phone. A - /// loopback route is used only when it is the sole supported route — the - /// on-device XCUITest mock host, which serves a real listener on `127.0.0.1` - /// inside the test runner. + /// When `preferNonLoopback` is set (physical devices), `.debugLoopback` + /// routes are excluded entirely — even as the sole route — because on a + /// phone `127.0.0.1` names the phone itself and can never reach the Mac. + /// Mock/simulator harnesses pass `false` to retain their in-process + /// loopback host. static func firstReconnectHostPortRoute( _ routes: [CmxAttachRoute], supportedKinds: [CmxAttachTransportKind], @@ -196,6 +194,8 @@ extension MobileShellComposite { /// Resume foreground-only refresh loops after the app becomes active. public func resumeForegroundRefresh() { + let queuedManualHostReapproval = lastBackgroundedAt != nil + && invalidateManualHostTrustForNetworkBoundary() startObservingNetworkPathChanges() // Covers stores constructed already-signed-in (no isSignedIn edge) and // restarts a subscription torn down while backgrounded. @@ -207,7 +207,8 @@ extension MobileShellComposite { // transport before the probe decides to replace it, creating two owners // for one foreground transition. Preview/legacy clients have no stored // route to redial, so retain their same-client resubscribe fallback. - if shouldResync, pairedMacStore == nil { + // A queued manual-host reapproval owns the teardown instead. + if shouldResync, pairedMacStore == nil, !queuedManualHostReapproval { resyncTerminalOutput(reason: "foreground", restartEventStream: true) } recoverForegroundConnectionIfNeeded(resyncAfterHealthy: shouldResync) @@ -220,7 +221,8 @@ extension MobileShellComposite { } } - /// Record that the app left the active scene phase. + /// Record that the app entered the background. Temporary `.inactive` + /// interruptions do not call this and therefore do not revoke trust. public func suspendForegroundRefresh() { guard lastBackgroundedAt == nil else { return } lastBackgroundedAt = runtime?.now() ?? Date() @@ -311,7 +313,7 @@ extension MobileShellComposite { let localRoutes = Self.storedReconnectRoutes( currentMac.routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) let requiresIroh = localRoutes.contains { $0.kind == .iroh } || mac.routes.contains { $0.kind == .iroh } @@ -323,7 +325,7 @@ extension MobileShellComposite { let reconnectRoutes = Self.storedReconnectRoutes( currentMac.routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) if !reconnectRoutes.isEmpty, reconnectRoutes.contains(where: { @@ -350,7 +352,7 @@ extension MobileShellComposite { let reconnectRoutes = Self.storedReconnectRoutes( updatedRoutes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) // Once this pairing has used Iroh, a cloud refresh that omits Iroh is // stale or downgraded input. Keep the local Iroh capability pin instead @@ -395,6 +397,14 @@ extension MobileShellComposite { didFinishStoredMacReconnectAttempt = true } + func clearSavedMacHintAfterDeletingLastVisibleMacIfNeeded() { + guard pairedMacs.isEmpty else { return } + storedMacReconnectGeneration &+= 1 + hasKnownPairedMac = false + isReconnectingStoredMac = false + didFinishStoredMacReconnectAttempt = false + } + /// Returns the completed result when an async stored reconnect must stop. /// A newer generation owns the work (`false`); an already-live foreground /// client satisfies the request without another dial (`true`). @@ -419,48 +429,18 @@ extension MobileShellComposite { _ routes: [CmxAttachRoute], supportedKinds: [CmxAttachTransportKind], preferNonLoopback: Bool = false - ) -> [(host: String, port: Int, routeID: String)] { - let supportedKinds = Set(supportedKinds) - let hasSupportedIrohRoute = routes.contains { route in - route.kind == .iroh - && (supportedKinds.isEmpty || supportedKinds.contains(.iroh)) - } - guard !hasSupportedIrohRoute else { - return [] - } - let ordered = routes.sorted(by: Self.routeSortsBefore) - var seenEndpoints = Set() - - func appendCandidates( - where predicate: (CmxAttachRoute) -> Bool, - to candidates: inout [(host: String, port: Int, routeID: String)] - ) { - for route in ordered { - if !supportedKinds.isEmpty, !supportedKinds.contains(route.kind) { - continue - } - guard predicate(route), - case let .hostPort(host, port) = route.endpoint else { - continue - } - let endpointKey = "\(host)\u{1F}\(port)" - guard seenEndpoints.insert(endpointKey).inserted else { continue } - candidates.append((host: host, port: port, routeID: route.id)) - } - } - - var candidates: [(host: String, port: Int, routeID: String)] = [] - if preferNonLoopback { - appendCandidates(where: { route in - guard route.kind != .debugLoopback, - case let .hostPort(host, _) = route.endpoint else { return false } - return Self.isIPLiteralHost(host) - }, to: &candidates) - appendCandidates(where: { $0.kind != .debugLoopback }, to: &candidates) - return candidates - } - appendCandidates(where: { _ in true }, to: &candidates) - return candidates + ) -> [MobileShellReconnectRouteCandidate] { + let pinnedRoutes = storedReconnectRoutes( + routes, + supportedKinds: supportedKinds, + preferNonLoopback: preferNonLoopback + ) + guard !pinnedRoutes.contains(where: { $0.kind == .iroh }) else { return [] } + return MobileShellRouteSelection().reconnectHostPortRoutes( + pinnedRoutes, + supportedKinds: supportedKinds, + preferNonLoopback: preferNonLoopback + ) } /// Merges a constrained reconnect ticket with the previously persisted route set. diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+Scope.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+Scope.swift index e3b59807066d..363b3401772a 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+Scope.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+Scope.swift @@ -1,7 +1,95 @@ +import CMUXMobileCore +import CmuxMobileRPC +import CmuxMobileShellModel import Foundation @MainActor extension MobileShellComposite { + /// Resets the complete shell boundary if Stack replaces A with B without a signed-out edge. + func prepareRPCAuthForSignIn() -> Bool { + let currentUserID = identityProvider?.currentUserID?.trimmingCharacters(in: .whitespacesAndNewlines) + let normalizedUserID = currentUserID?.isEmpty == false ? currentUserID : nil + let replacedAuthenticatedUser = isSignedIn && rpcAuthStackUserID != normalizedUserID + if replacedAuthenticatedUser { + signOut() + } + rpcAuthStackUserID = normalizedUserID + return replacedAuthenticatedUser + } + + func rotateRPCAuthScope() { + cancelManualHostTrustExpiration() + let invalidatedScopes = [rpcAuthScope, manualHostRPCAuthScope] + for scope in invalidatedScopes { scope.revoke() } + rpcAuthScope = MobileRPCAuthScope() + manualHostRPCAuthScope = MobileRPCAuthScope() + let tokenGate = stackTokenGate + let forceRefreshGate = stackTokenForceRefreshGate + Task { + for scope in invalidatedScopes { + await tokenGate.invalidate(scope: scope) + await forceRefreshGate.invalidate(scope: scope) + } + } + } + + /// Invalidates only plaintext manual-host credentials after a network-path change. + func rotateManualHostRPCAuthScope() { + cancelManualHostTrustExpiration() + let invalidatedScope = manualHostRPCAuthScope + invalidatedScope.revoke() + manualHostRPCAuthScope = MobileRPCAuthScope() + let tokenGate = stackTokenGate + let forceRefreshGate = stackTokenForceRefreshGate + Task { + await tokenGate.invalidate(scope: invalidatedScope) + await forceRefreshGate.invalidate(scope: invalidatedScope) + } + } + + func currentRPCAuthContext() -> MobileShellRPCAuthContext { + MobileShellRPCAuthContext( + stackUserID: identityProvider?.currentUserID, + accountScope: rpcAuthScope, + manualHostScope: manualHostRPCAuthScope + ) + } + + func isRPCAuthContextCurrent( + _ context: MobileShellRPCAuthContext, + requiresManualHostScope: Bool = true + ) -> Bool { + guard isSignedIn, + identityProvider?.currentUserID == context.stackUserID, + rpcAuthScope == context.accountScope else { + return false + } + return !requiresManualHostScope || manualHostRPCAuthScope == context.manualHostScope + } + + func rpcAuthScopeForRoute( + for route: CmxAttachRoute, + context: MobileShellRPCAuthContext + ) -> MobileRPCAuthScope { + MobileShellRouteAuthPolicy().routeRequiresManualHostTrust(route) + ? context.manualHostScope + : context.accountScope + } + + func rpcAuthScopeValidator( + for route: CmxAttachRoute, + context: MobileShellRPCAuthContext + ) -> @Sendable () async -> Bool { + let requiresManualHostScope = MobileShellRouteAuthPolicy().routeRequiresManualHostTrust(route) + return { [weak self] in + guard let self else { return false } + return await self.isRPCAuthContextCurrent( + context, + requiresManualHostScope: requiresManualHostScope + ) + } + } + /// Capture the current signed-in account/team scope for async list loads and /// route writes. func currentScopeSnapshot(userID explicitUserID: String? = nil) async -> MobileShellScopeSnapshot? { @@ -14,10 +102,23 @@ extension MobileShellComposite { currentUserID != userID { return nil } + let generation = secondaryAggregationScopeGeneration + let signInGeneration = currentSessionGeneration + let rpcAuthContext = currentRPCAuthContext() + let teamID = await teamIDProvider() + guard isSignedIn, + identityProvider?.currentUserID == userID, + generation == secondaryAggregationScopeGeneration, + signInGeneration == currentSessionGeneration, + isRPCAuthContextCurrent(rpcAuthContext) else { + return nil + } return MobileShellScopeSnapshot( userID: userID, - teamID: await teamIDProvider(), - generation: secondaryAggregationScopeGeneration + teamID: teamID, + generation: generation, + signInGeneration: signInGeneration, + rpcAuthContext: rpcAuthContext ) } @@ -30,13 +131,21 @@ extension MobileShellComposite { } func userWideScope(from scope: MobileShellScopeSnapshot) -> MobileShellScopeSnapshot { - MobileShellScopeSnapshot(userID: scope.userID, teamID: nil, generation: scope.generation) + MobileShellScopeSnapshot( + userID: scope.userID, + teamID: nil, + generation: scope.generation, + signInGeneration: scope.signInGeneration, + rpcAuthContext: scope.rpcAuthContext + ) } /// Whether a previously-captured list-load scope is still current. func isScopeCurrent(_ scope: MobileShellScopeSnapshot) async -> Bool { guard isSignedIn, - secondaryAggregationScopeGeneration == scope.generation else { + secondaryAggregationScopeGeneration == scope.generation, + currentSessionGeneration == scope.signInGeneration, + isRPCAuthContextCurrent(scope.rpcAuthContext) else { return false } if let currentUserID = identityProvider?.currentUserID, @@ -45,4 +154,5 @@ extension MobileShellComposite { } return await teamIDProvider() == scope.teamID } + } diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceActions.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceActions.swift index b7b8360ea197..754c59128f71 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceActions.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceActions.swift @@ -240,6 +240,8 @@ extension MobileShellComposite { ) async -> Result { let target = WorkspaceMutationTarget( client: remoteClient, + route: activeRoute, + connectionGeneration: connectionGeneration, isForeground: true, macDeviceID: foregroundMacDeviceID ) @@ -364,7 +366,25 @@ extension MobileShellComposite { let request = try MobileCoreRPCClient.requestData(method: method, params: params) _ = try await client.sendRequest(request) } catch { - if disconnectForAuthorizationFailureIfNeeded(error) { + let failureOwner: MobileShellAuthorizationFailureOwner + if !target.isForeground, + let macDeviceID = target.macDeviceID, + let route = target.route { + failureOwner = .secondary( + macDeviceID: macDeviceID, + client: client, + route: route + ) + } else if let generation = target.connectionGeneration { + failureOwner = .foreground( + client: client, + generation: generation, + route: target.route + ) + } else { + return .failure(.notConnected(hostDisplayName: hostDisplayName)) + } + if handleAuthorizationFailureIfNeeded(error, owner: failureOwner) { return .failure(.authorizationFailed(hostDisplayName: hostDisplayName)) } // Only the foreground connection's health drives the foreground @@ -401,6 +421,8 @@ extension MobileShellComposite { guard let anchorWorkspaceID = workspaceGroups.first(where: { $0.id == id })?.anchorWorkspaceID else { return WorkspaceMutationTarget( client: remoteClient, + route: activeRoute, + connectionGeneration: connectionGeneration, isForeground: true, macDeviceID: foregroundMacDeviceID ) @@ -474,22 +496,4 @@ extension MobileShellComposite { ) } - /// Collapse or expand a workspace group on THIS device only. - /// - /// Folder collapse is a per-device UI preference, not shared state: collapsing - /// a group on the phone must not collapse it on the Mac. So this records the - /// choice in the device-local `groupCollapseStore` and updates the in-memory - /// `workspaceGroups` for an immediate, authoritative render. Nothing is sent to - /// the Mac, and a later Mac `workspace.updated` will not override it (the - /// workspace-list ingest re-applies this store). The `async` signature is kept - /// for call-site compatibility; the work is synchronous on the main actor. - /// - Parameters: - /// - id: The group to collapse or expand. - /// - collapsed: `true` to collapse (hide members), `false` to expand. - public func setWorkspaceGroupCollapsed(id: MobileWorkspaceGroupPreview.ID, _ collapsed: Bool) async { - groupCollapseStore.set(id.rawValue, collapsed: collapsed) - if let index = workspaceGroups.firstIndex(where: { $0.id == id }) { - workspaceGroups[index].isCollapsed = collapsed - } - } } diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceCreateRequest.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceCreateRequest.swift index f48d146359f4..c71a2135f5ba 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceCreateRequest.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceCreateRequest.swift @@ -79,7 +79,14 @@ extension MobileShellComposite { return .success(()) } catch { guard generation == connectionGeneration, !Task.isCancelled else { return .success(()) } - if disconnectForAuthorizationFailureIfNeeded(error) { + if handleAuthorizationFailureIfNeeded( + error, + owner: .foreground( + client: client, + generation: generation, + route: activeRoute + ) + ) { return .failure(.authorizationFailed(hostDisplayName: connectedHostName)) } handleMacAvailabilityFailureIfCurrent( diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceGroupCollapse.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceGroupCollapse.swift new file mode 100644 index 000000000000..21a57cbccffb --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceGroupCollapse.swift @@ -0,0 +1,22 @@ +public import CmuxMobileShellModel + +extension MobileShellComposite { + /// Collapse or expand a workspace group on THIS device only. + /// + /// Folder collapse is a per-device UI preference, not shared state: collapsing + /// a group on the phone must not collapse it on the Mac. So this records the + /// choice in the device-local `groupCollapseStore` and updates the in-memory + /// `workspaceGroups` for an immediate, authoritative render. Nothing is sent to + /// the Mac, and a later Mac `workspace.updated` will not override it (the + /// workspace-list ingest re-applies this store). The `async` signature is kept + /// for call-site compatibility; the work is synchronous on the main actor. + /// - Parameters: + /// - id: The group to collapse or expand. + /// - collapsed: `true` to collapse (hide members), `false` to expand. + public func setWorkspaceGroupCollapsed(id: MobileWorkspaceGroupPreview.ID, _ collapsed: Bool) async { + groupCollapseStore.set(id.rawValue, collapsed: collapsed) + if let index = workspaceGroups.firstIndex(where: { $0.id == id }) { + workspaceGroups[index].isCollapsed = collapsed + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceMutationTarget.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceMutationTarget.swift new file mode 100644 index 000000000000..5a6237bf49fb --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceMutationTarget.swift @@ -0,0 +1,34 @@ +import CmuxMobileShellModel + +@MainActor +extension MobileShellComposite { + /// Returns the live client that owns a workspace row in the aggregated list. + func workspaceMutationTarget(for id: MobileWorkspacePreview.ID) -> WorkspaceMutationTarget { + let owner = workspaces.first(where: { $0.id == id })?.macDeviceID + if owner == nil || owner == foregroundMacDeviceID || owner == Self.foregroundAnonymousKey { + return WorkspaceMutationTarget( + client: remoteClient, + route: activeRoute, + connectionGeneration: connectionGeneration, + isForeground: true, + macDeviceID: foregroundMacDeviceID + ) + } + if let owner, let subscription = secondaryMacSubscriptions[owner] { + return WorkspaceMutationTarget( + client: subscription.client, + route: subscription.route, + connectionGeneration: nil, + isForeground: false, + macDeviceID: owner + ) + } + return WorkspaceMutationTarget( + client: nil, + route: nil, + connectionGeneration: nil, + isForeground: false, + macDeviceID: owner + ) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceOpening.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceOpening.swift new file mode 100644 index 000000000000..fca6de3f5a6b --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+WorkspaceOpening.swift @@ -0,0 +1,120 @@ +public import CmuxMobileShellModel +import Foundation +internal import OSLog + +private let mobileShellWorkspaceOpeningLog = Logger( + subsystem: "com.cmuxterm.app", + category: "mobile-shell" +) + +@MainActor +extension MobileShellComposite { + /// Opens a workspace preview, switching the foreground Mac first when needed. + /// - Parameter id: The aggregated workspace-row identifier to open. + public func openWorkspace(_ id: MobileWorkspacePreview.ID) async { + let workspace = workspaces.first { $0.id == id } + let remoteWorkspaceID = workspace?.rpcWorkspaceID ?? id + let ownerMacDeviceID = workspace?.macDeviceID + let workspaceHadUnread = workspace?.hasUnread == true + if multiMacAggregationEnabled, + let macDeviceID = ownerMacDeviceID, + !macDeviceID.isEmpty, + macDeviceID != foregroundMacDeviceID { + guard await switchToMac(macDeviceID: macDeviceID) else { + // Approval is a suspended switch, not a failed switch. Keep the + // selected row and bind its navigation intent to that exact attempt. + if let pending = pendingManualHostTrust, + pending.pairedMacDeviceID == macDeviceID, + let macSwitchAttemptID = pending.macSwitchAttemptID { + pendingWorkspaceOpenIntent = PendingWorkspaceOpenIntent( + rowWorkspaceID: id, + remoteWorkspaceID: remoteWorkspaceID, + ownerMacDeviceID: ownerMacDeviceID, + workspaceHadUnread: workspaceHadUnread, + terminalCount: workspace?.terminals.count ?? 0, + isPinned: workspace?.isPinned ?? false, + macSwitchAttemptID: macSwitchAttemptID + ) + return + } + mobileShellWorkspaceOpeningLog.error("openWorkspace: switch to mac failed, popping mac=\(macDeviceID, privacy: .public)") + rollbackPendingWorkspaceOpen(rowWorkspaceID: id) + return + } + } + await finishWorkspaceOpen( + requestedRowID: id, + remoteWorkspaceID: remoteWorkspaceID, + ownerMacDeviceID: ownerMacDeviceID, + workspaceHadUnread: workspaceHadUnread, + terminalCount: workspace?.terminals.count ?? 0, + isPinned: workspace?.isPinned ?? false + ) + } + + func takePendingWorkspaceOpenIntent( + for pending: PendingManualHostTrust + ) -> PendingWorkspaceOpenIntent? { + guard let intent = pendingWorkspaceOpenIntent, + pending.macSwitchAttemptID == intent.macSwitchAttemptID else { + return nil + } + pendingWorkspaceOpenIntent = nil + return intent + } + + func cancelPendingWorkspaceOpenIntent() { + guard let intent = pendingWorkspaceOpenIntent else { return } + cancelWorkspaceOpen(intent) + } + + func cancelWorkspaceOpen(_ intent: PendingWorkspaceOpenIntent) { + pendingWorkspaceOpenIntent = nil + rollbackPendingWorkspaceOpen(rowWorkspaceID: intent.rowWorkspaceID) + } + + func resumePendingWorkspaceOpen(_ intent: PendingWorkspaceOpenIntent) async { + await finishWorkspaceOpen( + requestedRowID: intent.rowWorkspaceID, + remoteWorkspaceID: intent.remoteWorkspaceID, + ownerMacDeviceID: intent.ownerMacDeviceID, + workspaceHadUnread: intent.workspaceHadUnread, + terminalCount: intent.terminalCount, + isPinned: intent.isPinned + ) + } + + private func finishWorkspaceOpen( + requestedRowID: MobileWorkspacePreview.ID, + remoteWorkspaceID: MobileWorkspacePreview.ID, + ownerMacDeviceID: String?, + workspaceHadUnread: Bool, + terminalCount: Int, + isPinned: Bool + ) async { + let resolvedRowID = rowWorkspaceID( + forRemoteWorkspaceID: remoteWorkspaceID, + macDeviceID: ownerMacDeviceID + ) ?? (workspaces.contains(where: { $0.id == requestedRowID }) ? requestedRowID : nil) + guard let resolvedRowID else { + mobileShellWorkspaceOpeningLog.error("openWorkspace: workspace disappeared after switch id=\(remoteWorkspaceID.rawValue, privacy: .private) mac=\(ownerMacDeviceID ?? "", privacy: .public)") + rollbackPendingWorkspaceOpen(rowWorkspaceID: requestedRowID) + return + } + analytics.capture("ios_workspace_opened", [ + "terminal_count": .int(terminalCount), + "is_pinned": .bool(isPinned), + "source": .string("list_tap"), + ]) + setSelectedWorkspaceID(resolvedRowID) + if supportsWorkspaceReadStateActions, workspaceHadUnread { + await setWorkspaceUnread(id: resolvedRowID, false) + } + } + + private func rollbackPendingWorkspaceOpen(rowWorkspaceID: MobileWorkspacePreview.ID) { + if selectedWorkspaceID == rowWorkspaceID { + setSelectedWorkspaceID(nil) + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift index 42cd17c3e065..875c25d3b421 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift @@ -174,14 +174,19 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } public internal(set) var macConnectionStatus: MobileMacConnectionStatus public internal(set) var connectedHostName: String - public private(set) var connectionError: String? + /// User-facing description of the most recent connection failure, or `nil` + /// while no failure is being surfaced. + public internal(set) var connectionError: String? /// Actionable next-step line shown beneath ``connectionError`` (for example /// "Check that both devices are on the same Tailscale"). Set and cleared /// together with the error by the pairing-failure classifier sink. - public private(set) var connectionErrorGuidance: String? + public internal(set) var connectionErrorGuidance: String? /// A warning that must be accepted before pairing continues, currently used /// for Mac/iPhone app-version skew. public private(set) var pairingVersionWarning: String? + /// A warning that must be accepted before a non-Tailscale manual host can + /// carry Stack auth over plaintext LAN transport. + public internal(set) var manualHostTrustWarning: MobileManualHostTrustWarning? public internal(set) var activeTicket: CmxAttachTicket? public internal(set) var activeRoute: CmxAttachRoute? { didSet { @@ -250,7 +255,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { activeTicket.authToken?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false else { return false } - return Self.attachTicketIsUnexpired(activeTicket, now: runtime?.now() ?? Date()) + return routeSelection.attachTicketIsUnexpired(activeTicket, now: runtime?.now() ?? Date()) } /// User-entered pairing code or pairing URL text for the current connection attempt. public var pairingCode: String @@ -315,6 +320,8 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// stateless infrastructure, not observed state. @ObservationIgnored private let routePinger: any CmxRoutePinging + @ObservationIgnored + let routeSelection = MobileShellRouteSelection() /// Probe whether the phone can reach this route right now (a direct TCP /// connect, independent of the live subscription). See ``CmxRoutePinging``. @@ -612,6 +619,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { private let pairingHintDefaults: UserDefaults private let multiMacAggregationDefaults: UserDefaults let forgottenMacStore: any PairedMacForgottenStoring + let manualHostTrustStore: any MobileManualHostTrustStoring let clientID: String /// Delivers the email path of Send Feedback (`/api/feedback`). `nil` when the /// web API base URL is unavailable; the email path then fails closed and the @@ -627,6 +635,13 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { let connectAttemptRegistry = MobileRPCConnectAttemptRegistry() let stackTokenGate = RPCStackTokenGate() let stackTokenForceRefreshGate = RPCStackTokenGate() + var rpcAuthScope = MobileRPCAuthScope() + var manualHostRPCAuthScope = MobileRPCAuthScope() + var manualHostTrustResetTask: Task? + var manualHostTrustExpirationTask: Task? + var manualHostTrustExpirationOwner: ManualHostTrustExpirationOwner? + var manualHostTrustResetGeneration = 0 + var rpcAuthStackUserID: String? /// Collapses connection-state edges into one-per-outage lost/recovered events. private var connectionOutageThrottle = ConnectionOutageThrottle() /// When the current outage began, for the recovered event's duration. @@ -636,7 +651,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { private var suppressNextConnectionOutageEdge = false /// When the in-flight pairing attempt began, for `*_succeeded`/`_failed` /// `duration_ms`. Keyed implicitly by ``pairingAttemptID``. - private var pairingAttemptStartedAt: Date? + private(set) var pairingAttemptStartedAt: Date? /// The method (`qr`/`manual`/`attach_url`) of the in-flight pairing attempt. private var pairingAttemptMethod: String? /// Whether this install had no known paired Mac at the *start* of the in-flight @@ -647,6 +662,8 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// false` and break the first-pair funnel. private var pairingAttemptIsFirstPair = false private var pendingPairingVersionWarningURL: String? + @ObservationIgnored var pendingManualHostTrust: PendingManualHostTrust? + @ObservationIgnored var pendingWorkspaceOpenIntent: PendingWorkspaceOpenIntent? /// The structured diagnostic log, injected from the app composition root. /// @@ -677,7 +694,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { var terminalEventListenerTask: Task? private var terminalEventListenerID: UUID? /// Recovers the Mac's identity post-handshake for tickets that arrived - /// without one (the minimal v2 pairing QR). Owned separately from the + /// without one (the minimal pairing QR). Owned separately from the /// short capability probe; see ``scheduleHostIdentityAdoptionIfNeeded(client:)``. /// Cancelled on disconnect via ``cancelRemoteOperationTasks()``. private var hostIdentityAdoptionTask: Task? @@ -922,6 +939,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { pairingHintDefaults: UserDefaults = .standard, multiMacAggregationDefaults: UserDefaults = .standard, forgottenMacStore: any PairedMacForgottenStoring = InMemoryPairedMacForgottenStore(), + manualHostTrustStore: any MobileManualHostTrustStoring = UserDefaultsMobileManualHostTrustStore(), analytics: any AnalyticsEmitting = NoopAnalytics(), diagnosticLog: DiagnosticLog? = nil, feedbackEmailSubmitter: (any MobileFeedbackEmailSubmitting)? = nil, @@ -947,6 +965,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { self.pairingHintDefaults = pairingHintDefaults self.multiMacAggregationDefaults = multiMacAggregationDefaults self.forgottenMacStore = forgottenMacStore + self.manualHostTrustStore = manualHostTrustStore self.analytics = analytics self.diagnosticLog = diagnosticLog self.feedbackEmailSubmitter = feedbackEmailSubmitter @@ -980,6 +999,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { self.connectionError = nil self.connectionErrorGuidance = nil self.pairingVersionWarning = nil + self.manualHostTrustWarning = nil self.activeTicket = nil self.activeRoute = nil self.activeMacInstanceTag = nil @@ -1049,11 +1069,19 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { self.pairingAttemptID = UUID() } - isolated deinit { + #if compiler(>=6.2) + isolated deinit { cleanupForDeinit() } + #else + deinit { cleanupForDeinit() } + #endif + + private func cleanupForDeinit() { connectionRecoveryOwner.cancel() automaticReconnectRetryTask?.cancel() presenceTask?.cancel() networkPathObservationTask?.cancel() + manualHostTrustResetTask?.cancel() + manualHostTrustExpirationTask?.cancel() terminalEventListenerTask?.cancel() terminalSubscriptionStartTask?.cancel() renderGridLivenessTimer?.cancel() @@ -1074,15 +1102,15 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } public static func preview(runtime: (any MobileSyncRuntime)? = nil) -> CMUXMobileShellStore { - CMUXMobileShellStore( - runtime: runtime, - workspaces: PreviewMobileHost.workspaces, - deliveredNotificationClearer: NoopDeliveredNotificationClearer() - ) + MobileShellPreviewFactory(runtime: runtime).makeStore() } public func signIn() { + let replacedAuthenticatedUser = prepareRPCAuthForSignIn() let wasSignedIn = isSignedIn + if !wasSignedIn && !replacedAuthenticatedUser { + rotateRPCAuthScope() + } isSignedIn = true clearPairingError() // Fire only on the signed-out→signed-in edge (this is called on every @@ -1101,6 +1129,8 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } public func signOut() { + rotateRPCAuthScope() + rpcAuthStackUserID = nil // Reset analytics identity to anonymous on the signed-in→signed-out edge // only (this is called on every unauthenticated auth-state sync). if isSignedIn { @@ -1115,13 +1145,13 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { invalidatePairingAttempt() clearMacSwitchAttemptState() connectionGeneration = UUID() - connectionAttemptGeneration = UUID() isSignedIn = false connectionState = .disconnected macConnectionStatus = .unavailable connectedHostName = "" pairingCode = "" clearPairingVersionWarning() + clearSupersededManualHostTrustWarning() // Wipe every saved draft so the next account never sees the previous // user's unsent text. Guard the in-memory clear (and the selection resets // below) so the per-terminal draft hooks do not write partial state into a @@ -1244,6 +1274,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// lists" behavior). public func currentTeamDidChange() { secondaryAggregationScopeGeneration &+= 1 + clearSupersededManualHostTrustWarning() let teamScopeGeneration = secondaryAggregationScopeGeneration // Presence: cancel + re-subscribe so the online dots reflect the new team // (the subscribe reads the team live). Cheap live socket; the only eager bit. @@ -1481,6 +1512,9 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { var networkPathObservationStarted = false var networkPathObservationTask: Task? let connectionRecoveryOwner = MobileConnectionRecoveryOwner() + /// Newest-wins trailing network recovery. A later path callback must rotate + /// trust immediately, but cannot strand the reconnect it just superseded. + var pendingNetworkRecoveryTrigger = false var lastReconnectStackUserID: String? enum RecoveryTrigger: CustomStringConvertible { @@ -1542,127 +1576,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { syncSelectedTerminalForWorkspace() } - /// Connect using the current pairing input, accepting either a code or pairing URL. - public func connectPairingInput() async { - let trimmedCode = pairingCode.trimmingCharacters(in: .whitespacesAndNewlines) - guard !trimmedCode.isEmpty else { - return - } - if CmxPairingURLScheme.hasPairingScheme(trimmedCode) { - await connectPairingURL(trimmedCode) - return - } - connectPreviewHost() - } - - /// Connect to a manually-entered Mac host and optionally associate the - /// resulting session with an existing paired-Mac device id. - public func connectManualHost( - name: String, - host: String, - port: Int, - pairedMacDeviceID: String? = nil - ) async { - await connectManualHost( - name: name, - host: host, - port: port, - pairedMacDeviceID: pairedMacDeviceID, - recordsPairingAttempt: true - ) - } - - func connectManualHost( - name: String, - host: String, - port: Int, - pairedMacDeviceID: String? = nil, - instanceTagExpectation: MobileMacInstanceTagExpectation = .adopt, - recordsPairingAttempt: Bool, - ifStillCurrent: (() -> Bool)? = nil - ) async { - let trimmedName = name.trimmingCharacters(in: .whitespacesAndNewlines) - guard let normalizedHost = MobileShellRouteAuthPolicy.normalizedManualHost(host) else { - connectionError = L10n.string("mobile.addDevice.invalidHost", defaultValue: "Enter a host or IP address, without spaces or URL paths.") - connectionErrorGuidance = nil - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() - analytics.capture("ios_pairing_failed", [ - "method": .string("manual"), - "reason": .string("invalid_host"), - "failure_phase": .string("validation"), - "is_first_pair": .bool(!hasKnownPairedMac), - ]) - return - } - guard (1...65535).contains(port) else { - connectionError = L10n.string("mobile.addDevice.invalidPort", defaultValue: "Enter a port from 1 to 65535.") - connectionErrorGuidance = nil - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() - analytics.capture("ios_pairing_failed", [ - "method": .string("manual"), - "reason": .string("invalid_port"), - "failure_phase": .string("validation"), - "is_first_pair": .bool(!hasKnownPairedMac), - ]) - return - } - - let directRoute = try? Self.manualHostRoute(host: normalizedHost, port: port) - activeRoute = directRoute - let attemptID = recordsPairingAttempt ? beginPairingAttempt(method: "manual") : beginPairingValidationAttempt() - // Fast offline preflight: fail immediately instead of stacking - // per-route timeouts into the opaque ~60s blob. - let manualRoutes = directRoute.map { [$0] } ?? [] - guard await failPairingIfOffline(attemptID: attemptID, phase: "preflight", routes: manualRoutes) == .proceed else { return } - do { - let ticket = try await manualHostTicket( - name: trimmedName, - host: normalizedHost, - port: port, - attemptStartedAt: pairingAttemptStartedAt - ) - guard isCurrentPairingAttempt(attemptID) else { return } - let noThrowFailure = try await connect( - ticket: ticket, - allowsStackAuthFallback: true, - pairedMacDeviceID: pairedMacDeviceID, - instanceTagExpectation: instanceTagExpectation, - ifStillCurrent: ifStillCurrent - ) - guard isCurrentPairingAttempt(attemptID) else { return } - if connectionState == .connected { - recordPairingSucceeded() - } else { - // `connect()` returned without connecting and already set a - // specific error; record without overwriting that message. - recordFailureForCurrentConnectionError(phase: "connect", category: noThrowFailure) - } - } catch is CancellationError { - guard isCurrentPairingAttempt(attemptID) else { return } - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() - } catch { - guard isCurrentPairingAttempt(attemptID) else { return } - mobileShellLog.error("manual host pairing failed: \(String(describing: error), privacy: .private)") - // A definitive auth failure (expired/invalid token after the - // refresh-then-retry in the RPC layer already gave up) must drive the - // re-auth prompt, not the generic "could not connect / Retry" banner. - if disconnectForAuthorizationFailureIfNeeded(error) { - return - } - let category = MobilePairingFailureCategory.classify(error: error, route: activeRoute ?? directRoute) - applyPairingFailure(category, phase: "connect") - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() - } - } - /// On launch (after StackAuth has bootstrapped), call this to reconnect /// to the last-active paired Mac. Pulls (route, displayName, macDeviceID) /// from SQLite and re-mints an attach ticket via the StackAuth-authenticated @@ -1693,6 +1606,9 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { didFinishStoredMacReconnectAttempt = true return .connected } + // A fresh reconnect pass never inherits manual-host trust: any grant + // from a previous launch or superseded session must be re-approved. + await manualHostTrustStore.removeAll() // Claim this attempt's generation. Only the current generation may resolve // the restoring-gate flags, so an older superseded attempt can't clear the // gate (or clobber the hint) while a newer reconnect is still running. @@ -1737,7 +1653,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { Self.storedReconnectRoutes( mac.routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) } let loadedActiveMac: MobilePairedMac? @@ -1881,14 +1797,19 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { !irohReconnectIsBlocked || $0.kind != .iroh } let localHasIroh = localRoutes.contains { $0.kind == .iroh } + // An explicitly approved manual host stays dialable without Iroh: + // its plaintext trust is owned by the per-host approval flow, and + // connectStoredMac re-runs that policy before any credential is sent. let localCanConnectSecurely = localHasIroh || localRoutes.contains { $0.kind == .debugLoopback } + || localRoutes.contains { $0.kind == .manualHost } let isLegacyPrivateNetworkPairing = !mac.routes.contains { $0.kind == .iroh } && mac.routes.contains { $0.kind == .tailscale } // New clients never send a Stack bearer directly over a raw // Tailscale/TCP route. Such a saved route is a migration hint only; // consult the authenticated registry for the Mac's Iroh identity. + var shouldStopRouteIteration = false if localCanConnectSecurely { attemptedAutomaticIroh = attemptedAutomaticIroh || localHasIroh lastDialOutcome = await connectStoredMacOutcome( @@ -1901,8 +1822,12 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { self?.storedMacReconnectGeneration == generation } ) + if !lastDialOutcome.didConnect, manualHostTrustWarning != nil { + shouldStopRouteIteration = true + } } - if connectionState != .connected, + if !shouldStopRouteIteration, + connectionState != .connected, !automaticIrohReconnectIsBlocked(accountID: scope.userID), !zeroTouchCandidateIDs.contains(mac.id) { switch await freshReconnectRoutesAfterLocalFailure( @@ -1933,7 +1858,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { break } } - if connectionState == .connected { break } + if connectionState == .connected || shouldStopRouteIteration { break } } restoringDeadline.cancel() // A newer attempt may have started during the connect; it now owns the flags. @@ -2256,12 +2181,12 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { let coalesced = Self.coalescePairedMacsByDialEndpoint( visibleLoaded, supportedKinds: supportedRouteKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + routeSelection: routeSelection ) let aliasIDsByPairingID = macDeviceIDAliasesByPairedMacID( in: visibleLoaded, supportedKinds: supportedRouteKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + routeSelection: routeSelection ) pairedMacAliasIDsByRepresentativeID = coalesced.reduce(into: [String: [String]]()) { result, mac in result[mac.id] = aliasIDsByPairingID[mac.id] ?? [mac.macDeviceID] @@ -2290,7 +2215,8 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { guard let pairedMacStore else { return false } let switchAttemptID = beginMacSwitchAttempt() let liveForegroundRestoreBaseline = liveForegroundMacForSwitchRestore() - defer { finishMacSwitchAttempt(switchAttemptID) } + var shouldFinishSwitchAttempt = true + defer { if shouldFinishSwitchAttempt { finishMacSwitchAttempt(switchAttemptID) } } // FAST PATH: if a live read-only connection to this Mac already exists, // promote it to the foreground (reuse the client) instead of re-dialing. if instanceTag == nil, @@ -2302,13 +2228,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { await restoreMacSwitchBaselineIfCancelled(switchAttemptID) return false } - // Refresh routes from the per-user backup so a Mac that relaunched on a - // new port is reachable — the same freshness guarantee auto-connect and - // aggregation use — then resolve the target from the STORE (authoritative). - // The multi-Mac aggregation reads Macs straight from the store and can - // surface a Mac (a freshly restored secondary) that the in-memory - // `pairedMacs` cache has not loaded yet; gating on that cache would no-op - // the open and strand the user on a workspace whose Mac never connected. + // Refresh routes and resolve the target from the store before dialing. if let refresher = pairedMacStore as? any PairedMacBackupRefreshing { await refresher.refreshFromBackup(stackUserID: identityProvider?.currentUserID) guard isCurrentMacSwitchAttempt(switchAttemptID) else { @@ -2340,26 +2260,10 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } return false } - // Already foreground on this exact Mac: skip the re-dial. Gate on the LIVE - // foreground identity, not the persisted `isActive` flag — `isActive` is - // stored preference state that can lag the real connection (e.g. - // `promoteSecondaryToForeground` writes it via an unawaited Task, and it is - // stale during reconnect/switch races). Trusting it could make `openWorkspace` - // proceed without switching and route input/mutations to the wrong Mac. - if foregroundMacDeviceID == macDeviceID, - connectionState == .connected, - remoteClient != nil, - refreshedTarget.instanceTag == nil - || MobileMacInstanceTagAuthority.sameStoredAuthority( - refreshedTarget.instanceTag, - activeMacInstanceTag - ) { + if foregroundConnectionMatches(refreshedTarget) { macSwitchRestoreBaseline = nil return true } - // The LIVE foreground Mac to fall back to if the destructive switch fails. - // Persisted `isActive` can lag the connection, so use the foreground id - // captured before `connectManualHost` clears/replaces the live context. let previousForegroundMacDeviceID = foregroundMacDeviceID let previousForegroundMac = liveForegroundRestoreBaseline ?? previousForegroundMacForSwitchRestore( @@ -2376,11 +2280,15 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { let candidateRoutes = Self.storedReconnectRoutes( refreshedTarget.routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) let localHasIroh = candidateRoutes.contains { $0.kind == .iroh } + // An explicitly approved manual host stays dialable without Iroh: its + // plaintext trust is owned by the per-host approval flow, and + // connectStoredMac re-runs that policy before any credential is sent. let localCanConnectSecurely = localHasIroh || candidateRoutes.contains { $0.kind == .debugLoopback } + || candidateRoutes.contains { $0.kind == .manualHost } let isLegacyPrivateNetworkPairing = !refreshedTarget.routes.contains { $0.kind == .iroh } && refreshedTarget.routes.contains { $0.kind == .tailscale } var refreshOutcome = ReconnectRouteRefreshOutcome.inconclusive @@ -2392,24 +2300,28 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { pairedMacDeviceID: macDeviceID, instanceTag: refreshedTarget.instanceTag, recordsPairingAttempt: true, + pendingMacSwitchAttemptID: switchAttemptID, ifStillCurrent: { [weak self] in self?.isCurrentMacSwitchAttempt(switchAttemptID) == true } ) + if pendingManualHostTrust?.macSwitchAttemptID == switchAttemptID { + shouldFinishSwitchAttempt = false + return false + } } guard isCurrentMacSwitchAttempt(switchAttemptID) else { await restoreMacSwitchBaselineIfCancelled(switchAttemptID, fallback: previousForegroundMac) return false } - var switched = connectionState == .connected - && remoteClient != nil - && foregroundMacDeviceID == macDeviceID - && (refreshedTarget.instanceTag == nil - || MobileMacInstanceTagAuthority.sameStoredAuthority( - refreshedTarget.instanceTag, - activeMacInstanceTag - )) + // The switch succeeded only if the live foreground identity is THIS Mac + // (device and authenticated instance). `connect(..., pairedMacDeviceID:)` + // stamps the foreground state with the target id after a successful + // connection, while a superseding switch leaves a different foreground + // id. Trust that identity instead of exact host/port text equality, + // which can differ across normalized routes. + var switched = foregroundConnectionMatches(refreshedTarget) if !switched, let scope { refreshOutcome = await freshReconnectRoutesAfterLocalFailure( for: refreshedTarget, @@ -2417,35 +2329,28 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { snapshot: await loadReconnectRefreshSnapshot(scope: scope) ) if case .refreshedRoutes(let refreshedRoutes) = refreshOutcome { - _ = await connectStoredMac( - name: refreshedTarget.displayName ?? macDeviceID, - routes: refreshedRoutes, - pairedMacDeviceID: macDeviceID, - instanceTag: refreshedTarget.instanceTag, - recordsPairingAttempt: true, - ifStillCurrent: { [weak self] in - self?.isCurrentMacSwitchAttempt(switchAttemptID) == true - } - ) + _ = await connectStoredMac( + name: refreshedTarget.displayName ?? macDeviceID, + routes: refreshedRoutes, + pairedMacDeviceID: macDeviceID, + instanceTag: refreshedTarget.instanceTag, + recordsPairingAttempt: true, + pendingMacSwitchAttemptID: switchAttemptID, + ifStillCurrent: { [weak self] in + self?.isCurrentMacSwitchAttempt(switchAttemptID) == true + } + ) + if pendingManualHostTrust?.macSwitchAttemptID == switchAttemptID { + shouldFinishSwitchAttempt = false + return false + } } guard isCurrentMacSwitchAttempt(switchAttemptID) else { await restoreMacSwitchBaselineIfCancelled(switchAttemptID, fallback: previousForegroundMac) return false } - switched = connectionState == .connected - && remoteClient != nil - && foregroundMacDeviceID == macDeviceID - && (refreshedTarget.instanceTag == nil - || MobileMacInstanceTagAuthority.sameStoredAuthority( - refreshedTarget.instanceTag, - activeMacInstanceTag - )) + switched = foregroundConnectionMatches(refreshedTarget) } - // The switch succeeded only if the live foreground identity is THIS Mac. - // `connect(..., pairedMacDeviceID:)` stamps the foreground state with the - // target id after a successful connection, while a superseding switch leaves - // a different foreground id. Trust that identity instead of exact host/port - // text equality, which can differ across normalized routes. if switched { macSwitchRestoreBaseline = nil finishMacSwitchAttempt(switchAttemptID) @@ -2457,23 +2362,22 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { ) { await task.value } - return connectionState == .connected - && remoteClient != nil - && foregroundMacDeviceID == macDeviceID - && (refreshedTarget.instanceTag == nil - || MobileMacInstanceTagAuthority.sameStoredAuthority( - refreshedTarget.instanceTag, - activeMacInstanceTag - )) - } else if macSwitchRestoreBaseline != nil || previousForegroundMac != nil, !hasActiveMacConnection { - // The switch did not connect and the destructive connect path dropped - // the previous session; reconnect to the still-active previous Mac so - // the user is not left stranded on a failed switch. - // Keep the attempt alive through the restore so a rapid follow-up - // picker selection can either cancel this rollback while preserving - // its baseline, or replace it with a new live foreground baseline. + return foregroundConnectionMatches(refreshedTarget) + } else if macSwitchRestoreBaseline != nil || previousForegroundMac != nil { + // The switch did not connect. When the destructive connect path + // dropped the previous session, reconnect to the previous Mac so the + // user is not left stranded; when the previous session is still the + // live foreground, restorePreviousMacIfNeeded only re-persists that + // baseline (no dial), so a stale switch target can't stay marked + // active. Keep the attempt alive through the restore so a rapid + // follow-up picker selection can either cancel this rollback while + // preserving its baseline, or replace it with a new live baseline. let restoreTarget = macSwitchRestoreBaseline ?? previousForegroundMac - if await restorePreviousMacIfNeeded(restoreTarget, switchAttemptID: switchAttemptID) { + if await restorePreviousMacIfNeeded( + restoreTarget, + switchAttemptID: switchAttemptID, + reconcilePersistedBaseline: true + ) { macSwitchRestoreBaseline = nil } } @@ -2509,7 +2413,8 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { private func restorePreviousMacIfNeeded( _ previousActive: MobilePairedMac?, switchAttemptID: UUID? = nil, - cancelRestoreGeneration: UInt64? = nil + cancelRestoreGeneration: UInt64? = nil, + reconcilePersistedBaseline: Bool = false ) async -> Bool { func isRestoreCurrent() -> Bool { guard isSignedIn else { return false } @@ -2536,12 +2441,30 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { previousActive.instanceTag, activeMacInstanceTag )) - guard !previousStillForeground else { return true } + if previousStillForeground { + guard reconcilePersistedBaseline else { return true } + guard let liveTicket = activeTicket else { return true } + let liveClient = remoteClient + let instanceTagUpdate: PairedMacInstanceTagUpdate = previousActive.instanceTag.map { + .replace($0) + } ?? .preserve + _ = await persistPairedMacFromTicket( + liveTicket, + instanceTagUpdate: instanceTagUpdate, + displayNameOverride: previousActive.displayName, + ifStillCurrent: { + isRestoreCurrent() + && self.remoteClient === liveClient + && self.foregroundConnectionMatches(previousActive) + } + ) + return isRestoreCurrent() && foregroundConnectionMatches(previousActive) + } let supportedKinds = runtime?.supportedRouteKinds ?? [] let candidateRoutes = Self.storedReconnectRoutes( previousActive.routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) guard !candidateRoutes.isEmpty else { mobileShellLog.error("restorePreviousMacIfNeeded: no reconnectable route mac=\(previousActive.macDeviceID, privacy: .private)") @@ -2584,40 +2507,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { return restored } - func clearSavedMacHintAfterDeletingLastVisibleMacIfNeeded() { - guard pairedMacs.isEmpty else { return } - storedMacReconnectGeneration &+= 1 - hasKnownPairedMac = false - isReconnectingStoredMac = false - didFinishStoredMacReconnectAttempt = false - } - - /// Whether stored-route selection must reject loopback routes. A loopback route - /// (`.debugLoopback`, `127.0.0.1`) names the host it runs on, so on a - /// physical device it can only ever reach the phone itself, never a remote - /// Mac. Simulators and explicit mock-data UI tests host their test server at - /// loopback, so those harnesses opt into it instead of weakening real-device - /// reconnect for every debug build. - static var prefersNonLoopbackRoutes: Bool { - #if os(iOS) && !targetEnvironment(simulator) - !UITestConfig.mockDataEnabled - #else - false - #endif - } - - /// Whether `host` is a numeric IP literal (IPv4 or IPv6) rather than a name - /// that needs DNS resolution. Used to prefer directly-dialable IP routes over - /// MagicDNS hostnames, which fail to resolve on some clients. - static func isIPLiteralHost(_ host: String) -> Bool { - if host.contains(":") { return true } // IPv6 literal - let octets = host.split(separator: ".", omittingEmptySubsequences: false) - return octets.count == 4 && octets.allSatisfy { part in - guard let value = Int(part), (0...255).contains(value), !part.isEmpty else { return false } - return String(value) == part // reject leading zeros / non-canonical - } - } - /// Enqueues one paired-Mac store mutation on the serialized write chain. /// /// All `markActive` writes go through here so they execute strictly in @@ -2695,7 +2584,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } /// Recovers the Mac's identity for a connection whose ticket arrived - /// without a device id (the minimal v2 pairing QR), as its own + /// without a device id (the minimal pairing QR), as its own /// `mobile.host.status` request with the default RPC timeout. /// /// Identity recovery must not depend on the terminal-output capability @@ -2852,28 +2741,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { clearRemoteConnectionContext() } - /// `true` on a physical iPhone/iPad; `false` in the simulator and in - /// macOS-hosted package tests. Drives the loopback-pairing rejection: - /// the simulator's 127.0.0.1 is the host Mac and dev auto-pair depends - /// on it, while a physical device dialing loopback only ever reaches - /// itself. - private static var isPhysicalDevice: Bool { - #if os(iOS) && !targetEnvironment(simulator) - true - #else - false - #endif - } - - static func manualHostRoute(host: String, port: Int) throws -> CmxAttachRoute { - let routeKind = MobileShellRouteAuthPolicy.manualRouteKind(for: host) - return try CmxAttachRoute( - id: routeKind.rawValue, - kind: routeKind, - endpoint: .hostPort(host: host, port: port) - ) - } - @discardableResult public func connectPairingURL(_ rawValue: String? = nil) async -> Bool { await connectPairingURLResult(rawValue).didConnect @@ -2885,12 +2752,15 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } @discardableResult - private func connectPairingURLResult( + func connectPairingURLResult( _ rawValue: String? = nil, - acceptedVersionWarning: Bool + acceptedVersionWarning: Bool, + approvedManualRouteID: String? = nil ) async -> MobilePairingURLConnectionResult { let rawURL = Self.normalizedPairingURL(rawValue ?? pairingCode) - _ = beginPairingValidationAttempt() + let authContext = currentRPCAuthContext() + let validationAttemptID = beginPairingValidationAttempt() + let preservesActiveConnection = hasActiveMacConnection connectionAttemptGeneration = UUID() if connectionState != .connected { clearActiveConnectionContext() @@ -2899,34 +2769,20 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } clearPairingError() clearPairingVersionWarning() + clearSupersededManualHostTrustWarning() let ticket: CmxAttachTicket do { ticket = try CmxAttachTicketInput.decode(rawURL) - // The v2 grammar rejects loopback inside the decoder; the legacy - // grammars must keep decoding loopback for the simulator dev flow - // (where 127.0.0.1 IS the host Mac). On a physical phone no - // grammar may pair to loopback: the route would dial the phone - // itself, and loopback is Stack-auth-trusted, so the bearer token - // would be handed to whatever local process answers. Pure policy, - // unit tested for both device values; only this wiring is - // compile-time. - if MobileShellRouteAuthPolicy.ticketRejectsLoopbackRoutes( + if MobileShellRouteAuthPolicy().ticketRejectsLoopbackRoutes( ticket.routes, - isPhysicalDevice: Self.isPhysicalDevice + isPhysicalDevice: routeSelection.isPhysicalDevice ) { throw MobileSyncPairingPayloadError.loopbackRouteRejected } } catch { if case MobileSyncPairingPayloadError.loopbackRouteRejected = error { - // A scanned/pasted code that only points back at the Mac - // itself (127.0.0.1) would make the phone dial itself. Name - // the actual fix (Tailscale on the Mac) instead of the - // generic invalid-code copy. applyPairingValidationFailure(.loopbackRejected) } else if case MobileSyncPairingPayloadError.unrecognizedURLVersion = error { - // A real cmux QR whose grammar version this build predates: the - // fix is updating the app, not re-scanning, so say so instead of - // the generic "not a valid code" copy. applyPairingValidationFailure(.unrecognizedVersion) } else { applyPairingValidationFailure(.invalidCode) @@ -2962,18 +2818,56 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { return .needsUserApproval } + let candidateRoutes = routeSelection.supportedRoutes(for: ticket, supportedKinds: runtime?.supportedRouteKinds ?? []) + let routesForAttempt: [CmxAttachRoute] + if let approvedManualRouteID, + let approvedIndex = candidateRoutes.firstIndex(where: { $0.id == approvedManualRouteID }) { + routesForAttempt = Array(candidateRoutes[approvedIndex...]) + } else { + routesForAttempt = candidateRoutes + } + let ticketForAttempt = (routesForAttempt == candidateRoutes) + ? ticket + : try? ticket.constrainingRoutes(to: routesForAttempt, fallbackDisplayName: ticket.macDisplayName ?? "") + guard let ticketForAttempt else { + applyPairingValidationFailure(.invalidCode) + return .failed + } + if routesForAttempt.first.map(MobileShellRouteAuthPolicy().routeRequiresManualHostTrust) == true, + !authContext.hasStackUserID { + applyAuthorizationFailure(.authFailed, preservingActiveConnection: preservesActiveConnection) + return .failed + } + let manualHostApproval = await firstManualHostRouteNeedingApproval( + in: routesForAttempt, + stackUserID: authContext.stackUserID + ) + guard isCurrentPairingAttempt(validationAttemptID), + isRPCAuthContextCurrent(authContext) else { return .superseded } + if let approval = manualHostApproval, + case let .hostPort(host, _) = approval.route.endpoint { + queueManualHostTrustWarning( + route: approval.route, + displayHost: host, + pending: .pairingURL( + attemptID: validationAttemptID, + rawURL: rawURL, + acceptedVersionWarning: acceptedVersionWarning, + approvedRouteID: approval.route.id + ) + ) + return .needsUserApproval + } + let attemptID = beginPairingAttempt(method: "qr") - // Offline preflight: fail fast instead of stacking per-route connect - // timeouts into the opaque ~60s wait. Skipped only when no route is - // dialable so `connect()` classifies that as `no_supported_route`. - // Ticket expiry deliberately does NOT gate this: a stale QR is a valid - // pairing input now (expiry is enforced solely where the RPC attach - // token is used), so an expired legacy code scanned offline must say - // "offline", not crawl the route loop's stacked timeouts. - let candidateRoutes = Self.supportedRoutes(for: ticket, supportedKinds: runtime?.supportedRouteKinds ?? []) - if !candidateRoutes.isEmpty { - switch await failPairingIfOffline(attemptID: attemptID, phase: "preflight", routes: candidateRoutes) { + if !routesForAttempt.isEmpty { + switch await failPairingIfOffline( + attemptID: attemptID, + phase: "preflight", + routes: routesForAttempt, + preservesActiveConnection: preservesActiveConnection + ) { case .failedOffline: return .failed case .superseded: return .superseded case .proceed: break @@ -2982,9 +2876,19 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { do { guard isCurrentPairingAttempt(attemptID) else { return .superseded } - let noThrowFailure = try await connect(ticket: ticket) + let noThrowFailure = try await connect( + ticket: ticketForAttempt, + authContext: authContext, + pendingManualHostTrust: .pairingURL( + attemptID: attemptID, + rawURL: rawURL, + acceptedVersionWarning: acceptedVersionWarning, + approvedRouteID: approvedManualRouteID + ), + ifStillCurrent: { self.isCurrentPairingAttempt(attemptID) } + ) guard isCurrentPairingAttempt(attemptID) else { return .superseded } - if connectionState == .connected && activeTicket != nil { + if noThrowFailure == nil, connectionState == .connected && activeTicket != nil { recordPairingSucceeded() return .connected } @@ -2994,34 +2898,42 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { return .failed } catch is CancellationError { guard isCurrentPairingAttempt(attemptID) else { return .superseded } - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) return .failed + } catch is ManualHostTrustApprovalQueued { + guard isCurrentPairingAttempt(attemptID) else { return .superseded } + return .needsUserApproval } catch { guard isCurrentPairingAttempt(attemptID) else { return .superseded } + let routedError = error as? MobileShellRoutedConnectionError + let underlyingError = routedError?.underlying ?? error + let failureRoute = routedError?.route ?? activeRoute mobileShellLog.error("pairing failed: \(String(describing: error), privacy: .private)") // Definitive auth failures drive the re-auth prompt rather than a // generic connection error (matches the manual-host path); the // helper records the analytics failure + guidance. - if disconnectForAuthorizationFailureIfNeeded(error) { return .failed } - let category = MobilePairingFailureCategory.classify(error: error, route: activeRoute) + if handleAuthorizationFailureIfNeeded( + underlyingError, + owner: .connectionAttempt( + route: failureRoute, + preservingActiveConnection: preservesActiveConnection + ) + ) { return .failed } + let category = MobilePairingFailureCategory.classify(error: underlyingError, route: failureRoute) applyPairingFailure(category, phase: "connect") - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) return .failed } } + /// Cancels the active pairing attempt and clears transient pairing prompts. public func cancelPairing() { + let preservesActiveConnection = hasActiveMacConnection invalidatePairingAttempt() clearPairingError() - if pairingVersionWarning != nil || pendingPairingVersionWarningURL != nil { - clearPairingVersionWarning() - return - } clearPairingVersionWarning() + clearSupersededManualHostTrustWarning() + if preservesActiveConnection { return } connectionState = .disconnected macConnectionStatus = .unavailable clearRemoteConnectionContext() @@ -3044,7 +2956,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { macSwitchAttemptID = nil macSwitchAttemptSignInGeneration = nil invalidatePairingAttempt() - connectionAttemptGeneration = UUID() if let restoreTarget { return Task { @MainActor [weak self] in guard let self else { return false } @@ -3135,98 +3046,166 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } /// Build a persistent read-only client to one OTHER Mac (route + manual - /// ticket), or nil if it has no reachable route / the ticket fails. The caller + /// ticket), trying every reconnect candidate until one succeeds. The caller /// owns disconnecting it. Routes are loopback-deprioritized on device. Never /// touches the foreground connection. - private func makeSecondaryClient(for mac: MobilePairedMac) async -> SecondaryClientHandle? { - guard let runtime else { return nil } + private func makeSecondaryClient( + for mac: MobilePairedMac, + scope: MobileShellScopeSnapshot + ) async -> SecondaryClientHandle? { + guard let runtime, await isScopeCurrent(scope) else { return nil } let supportedKinds = runtime.supportedRouteKinds let pinnedRoutes = Self.storedReconnectRoutes( mac.routes, supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) guard let firstRoute = pinnedRoutes.first else { return nil } - let ticket: CmxAttachTicket - let route: CmxAttachRoute - do { - if firstRoute.kind == .iroh { - ticket = try Self.storedMacTicket( + + func authenticatedHandle( + ticket: CmxAttachTicket, + route: CmxAttachRoute, + manualHostTrusted: Bool + ) async -> SecondaryClientHandle? { + let allowsStackAuth = MobileShellRouteAuthPolicy().routeAllowsStackAuth( + route, + manualHostTrusted: manualHostTrusted + ) + guard route.kind == .iroh || allowsStackAuth else { return nil } + let client = MobileCoreRPCClient( + runtime: runtime, + route: route, + ticket: ticket, + allowsStackAuthFallback: allowsStackAuth, + manualHostStackAuthTrustProvider: manualHostStackAuthTrustProvider( + for: route, + stackUserID: scope.userID + ), + authScope: rpcAuthScopeForRoute(for: route, context: scope.rpcAuthContext), + authScopeValidator: rpcAuthScopeValidator(for: route, context: scope.rpcAuthContext), + connectAttemptRegistry: connectAttemptRegistry, + stackTokenGate: stackTokenGate, + stackTokenForceRefreshGate: stackTokenForceRefreshGate, + transportConnectObserver: transportConnectDiagnosticObserver + ) + guard let status = await fetchSecondaryHostStatus(on: client), + MobileMacInstanceTagAuthority.secondaryStatusMatches( + expectedDeviceID: mac.macDeviceID, + storedInstanceTag: mac.instanceTag, + reportedDeviceID: status.macDeviceID, + reportedInstanceTag: status.macInstanceTag + ) else { + mobileShellLog.warning( + "secondary client rejected mismatched authenticated identity mac=\(mac.macDeviceID, privacy: .private)" + ) + await client.disconnect() + return nil + } + guard await isScopeCurrent(scope) else { + await client.disconnect() + return nil + } + let capabilities = Set(status.capabilities) + return SecondaryClientHandle( + client: client, + route: route, + ticket: ticket, + storedInstanceTag: MobileMacInstanceTagAuthority.normalized(mac.instanceTag), + authenticatedInstanceTag: MobileMacInstanceTagAuthority.normalized( + status.macInstanceTag + ), + supportedHostCapabilities: capabilities, + actionCapabilities: Self.workspaceActionCapabilities( + from: capabilities, + allowsMacScopedMutations: MobileShellWorkspaceMutationTicketPolicy(now: runtime.now()) + .allowsMacScopedWorkspaceMutations(ticket) + ) + ) + } + + if firstRoute.kind == .iroh { + do { + let ticket = try Self.storedMacTicket( name: mac.displayName ?? mac.macDeviceID, routes: pinnedRoutes, pairedMacDeviceID: mac.macDeviceID ) - route = firstRoute - } else { - guard let (host, port) = Self.firstReconnectHostPortRoute( - pinnedRoutes, - supportedKinds: supportedKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes - ) else { return nil } - ticket = try await manualHostTicket( + return await authenticatedHandle( + ticket: ticket, + route: firstRoute, + manualHostTrusted: false + ) + } catch { + mobileShellLog.warning( + "secondary Iroh client: ticket failed mac=\(mac.macDeviceID, privacy: .private) error=\(String(describing: error), privacy: .private)" + ) + return nil + } + } + + let candidates = routeSelection.reconnectHostPortRoutes( + pinnedRoutes, + supportedKinds: supportedKinds, + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes + ) + for candidate in candidates { + guard await isScopeCurrent(scope) else { return nil } + guard candidate.route.kind == .manualHost + || candidate.route.kind == .debugLoopback else { + continue + } + let host = candidate.host + let port = candidate.port + do { + let directRoute = try routeSelection.manualHostRoute( + host: host, + port: port, + preserving: candidate.route + ) + let manualHostTrusted = await manualHostStackAuthTrusted( + for: directRoute, + stackUserID: scope.userID + ) + guard await isScopeCurrent(scope) else { return nil } + let ticket = try await manualHostTicket( name: mac.displayName ?? host, host: host, port: port, - attemptStartedAt: nil + route: directRoute, + attemptStartedAt: nil, + manualHostTrusted: manualHostTrusted, + authContext: scope.rpcAuthContext ) - let supportedRoutes = Self.supportedRoutes( + let supportedRoutes = routeSelection.supportedRoutes( for: ticket, supportedKinds: supportedKinds ) - guard let selectedRoute = supportedRoutes.first(where: { candidate in - if case let .hostPort(routeHost, routePort) = candidate.endpoint { + let route = supportedRoutes.first(where: { route in + if case let .hostPort(routeHost, routePort) = route.endpoint { return routeHost == host && routePort == port } return false }) ?? supportedRoutes.first(where: { $0.kind != .debugLoopback }) - ?? supportedRoutes.first else { return nil } - route = selectedRoute + ?? supportedRoutes.first + guard let route else { continue } + let routeTrusted = await manualHostStackAuthTrusted( + for: route, + stackUserID: scope.userID + ) + if let handle = await authenticatedHandle( + ticket: ticket, + route: route, + manualHostTrusted: routeTrusted + ) { + return handle + } + } catch { + mobileShellLog.warning( + "secondary client: ticket failed mac=\(mac.macDeviceID, privacy: .private) route=\(candidate.routeID, privacy: .private) error=\(String(describing: error), privacy: .private)" + ) } - } catch { - mobileShellLog.warning( - "secondary client: ticket failed mac=\(mac.macDeviceID, privacy: .public) error=\(String(describing: error), privacy: .public)" - ) - return nil - } - let client = MobileCoreRPCClient( - runtime: runtime, - route: route, - ticket: ticket, - allowsStackAuthFallback: MobileShellRouteAuthPolicy.routeAllowsStackAuth(route), - connectAttemptRegistry: connectAttemptRegistry, - stackTokenGate: stackTokenGate, - stackTokenForceRefreshGate: stackTokenForceRefreshGate, - transportConnectObserver: transportConnectDiagnosticObserver - ) - guard let status = await fetchSecondaryHostStatus(on: client), - MobileMacInstanceTagAuthority.secondaryStatusMatches( - expectedDeviceID: mac.macDeviceID, - storedInstanceTag: mac.instanceTag, - reportedDeviceID: status.macDeviceID, - reportedInstanceTag: status.macInstanceTag - ) else { - mobileShellLog.warning( - "secondary client rejected mismatched authenticated identity mac=\(mac.macDeviceID, privacy: .private)" - ) - await client.disconnect() - return nil } - let capabilities = Set(status.capabilities) - return SecondaryClientHandle( - client: client, - route: route, - ticket: ticket, - storedInstanceTag: MobileMacInstanceTagAuthority.normalized(mac.instanceTag), - authenticatedInstanceTag: MobileMacInstanceTagAuthority.normalized( - status.macInstanceTag - ), - supportedHostCapabilities: capabilities, - actionCapabilities: Self.workspaceActionCapabilities( - from: capabilities, - allowsMacScopedMutations: MobileShellWorkspaceMutationTicketPolicy(now: runtime.now()) - .allowsMacScopedWorkspaceMutations(ticket) - ) - ) + return nil } private func fetchSecondaryHostStatus( @@ -3295,9 +3274,20 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// write). Replaces any prior in-flight pass. func scheduleSecondaryAggregation() { secondaryAggregationTask?.cancel() - secondaryAggregationTask = Task { [weak self] in await self?.refreshSecondaryMacWorkspaces() } + secondaryAggregationTask = Task { [weak self] in + await self?.performSecondaryMacWorkspaceRefresh() + } } func refreshSecondaryMacWorkspaces() async { + secondaryAggregationTask?.cancel() + secondaryAggregationTask = Task { [weak self] in + guard let self else { return } + await self.performSecondaryMacWorkspaceRefresh() + } + await secondaryAggregationTask?.value + } + + private func performSecondaryMacWorkspaceRefresh() async { guard let pairedMacStore, multiMacAggregationEnabled else { return } // Require a concrete signed-in user before any load/connection: a nil/empty // account would make `loadAll(stackUserID: nil)` read EVERY locally stored @@ -3438,7 +3428,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { let endpointDistinctMacs = Self.coalescePairedMacsByDialEndpoint( visibleLoadedMacs, supportedKinds: supportedRouteKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + routeSelection: routeSelection ) var selectedByPhysicalMac: [String: MobilePairedMac] = [:] var physicalMacOrder: [String] = [] @@ -3460,12 +3450,12 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { let macs = Self.coalescePairedMacsByIrohEndpointAuthority( physicalMacOrder.compactMap { selectedByPhysicalMac[$0] }, supportedKinds: supportedRouteKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) let aliasIDsByMacID = macDeviceIDAliasesByPairedMacID( in: visibleLoadedMacs, supportedKinds: supportedRouteKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + routeSelection: routeSelection ) let foregroundMacDeviceIDs = foregroundMacDeviceID.map { aliasIDsByMacID[$0] ?? [$0] @@ -3480,7 +3470,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { if let endpointID = Self.irohEndpointID( for: mac, supportedKinds: supportedRouteKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) { foregroundIrohEndpointIDs.insert(endpointID) } @@ -3492,7 +3482,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { guard let endpointID = Self.irohEndpointID( for: mac, supportedKinds: supportedRouteKinds, - preferNonLoopback: Self.prefersNonLoopbackRoutes + preferNonLoopback: routeSelection.prefersNonLoopbackRoutes ) else { return true } return !foregroundIrohEndpointIDs.contains(endpointID) } @@ -3510,7 +3500,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { let macID = mac.macDeviceID guard let pairedMacStore, secondaryMacSubscriptions[macID] == nil else { return } - guard let handle = await makeSecondaryClient(for: mac) else { + guard let handle = await makeSecondaryClient(for: mac, scope: scope) else { guard await isSecondaryMacStillVisible( macID, instanceTag: mac.instanceTag, @@ -3561,6 +3551,10 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { actionCapabilities: handle.actionCapabilities ) secondaryMacSubscriptions[macID] = subscription + scheduleManualHostTrustExpirationForSecondarySubscription( + subscription, + stackUserID: scope.userID + ) let displayName = mac.displayName let previews = await fetchSecondaryWorkspaces(on: client, macDeviceID: macID) // The fetch await is another sign-out window: drop the just-opened @@ -3710,27 +3704,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } } - /// Routing target for a workspace mutation (rename / pin / unread / close): the - /// connection that owns `id` in the aggregated multi-Mac list. - /// - /// - `client == remoteClient`, `isForeground == true` for a foreground-owned - /// row, a single-Mac session, or an anonymous/manual host (owner unknown). - /// - the live secondary connection for a row owned by another aggregated Mac. - /// - `client == nil` when the owner is a known non-foreground Mac that has no - /// live connection right now, so the caller must NOT fall back to the - /// foreground client (that is exactly the wrong-Mac bug this avoids). - func workspaceMutationTarget(for id: MobileWorkspacePreview.ID) -> WorkspaceMutationTarget { - let owner = workspaces.first(where: { $0.id == id })?.macDeviceID - if owner == nil || owner == foregroundMacDeviceID || owner == Self.foregroundAnonymousKey { - return WorkspaceMutationTarget( - client: remoteClient, isForeground: true, macDeviceID: foregroundMacDeviceID) - } - if let owner, let sub = secondaryMacSubscriptions[owner] { - return WorkspaceMutationTarget(client: sub.client, isForeground: false, macDeviceID: owner) - } - return WorkspaceMutationTarget(client: nil, isForeground: false, macDeviceID: owner) - } - /// Re-sync the authoritative workspace list for the Mac a mutation actually hit: /// the foreground's coalesced refresh, or the owning secondary's coalesced /// re-fetch (so a pin/close on a secondary row snaps to the Mac's real state). @@ -3961,16 +3934,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { setForegroundWorkspaceState(workspaces: workspaces, groups: groups, merge: false) } - /// Test seam: seed the full per-Mac workspace source of truth so aggregation - /// edge cases can be tested without opening live secondary transports. - func setWorkspaceStatesForTesting( - _ states: [String: MacWorkspaceState], - foregroundMacDeviceID: String? - ) { - self.foregroundMacDeviceID = foregroundMacDeviceID - workspacesByMac = states - } - /// Test seam for the secondary-refresh failure path: stale rows should stay /// visible but become unavailable when a secondary Mac cannot be reached. func markSecondaryMacUnavailableForTesting(_ macID: String) { @@ -4193,61 +4156,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { reportedViewportSizesByTerminalKey[key] = viewportSize } - /// Open the workspace preview, switching the foreground Mac first when the workspace belongs to another paired Mac. - public func openWorkspace(_ id: MobileWorkspacePreview.ID) async { - let workspace = workspaces.first { $0.id == id } - let remoteWorkspaceID = workspace?.rpcWorkspaceID ?? id - let ownerMacDeviceID = workspace?.macDeviceID - let workspaceHadUnread = workspace?.hasUnread == true - // Cross-Mac open (P5): a workspace from the aggregated list may belong to - // a Mac other than the current foreground connection. Switch the - // foreground to that Mac first so the terminal attaches to the right one. - if multiMacAggregationEnabled, - let macDeviceID = ownerMacDeviceID, - !macDeviceID.isEmpty, - macDeviceID != foregroundMacDeviceID { - // Only proceed if that Mac actually became the foreground connection. - // The tap already selected this workspace and pushed its detail - // synchronously (this runs from the detail's task), so on a failed - // switch ROLL BACK the selection — popping the compact stack back to the - // list — instead of leaving the user in a workspace whose Mac is not the - // live connection (terminal input would route to the wrong client). The - // offline row's Reconnect / the next aggregation pass recovers it. - guard await switchToMac(macDeviceID: macDeviceID) else { - mobileShellLog.error("openWorkspace: switch to mac failed, popping mac=\(macDeviceID, privacy: .public)") - if selectedWorkspaceID == id { - setSelectedWorkspaceID(nil) - } - return - } - } - let resolvedRowID = rowWorkspaceID( - forRemoteWorkspaceID: remoteWorkspaceID, - macDeviceID: ownerMacDeviceID - ) ?? (workspaces.contains(where: { $0.id == id }) ? id : nil) - guard let resolvedRowID else { - mobileShellLog.error("openWorkspace: workspace disappeared after switch id=\(remoteWorkspaceID.rawValue, privacy: .private) mac=\(ownerMacDeviceID ?? "", privacy: .public)") - if selectedWorkspaceID == id { - setSelectedWorkspaceID(nil) - } - return - } - analytics.capture("ios_workspace_opened", [ - "terminal_count": .int(workspace?.terminals.count ?? 0), - "is_pinned": .bool(workspace?.isPinned ?? false), - "source": .string("list_tap"), - ]) - setSelectedWorkspaceID(resolvedRowID) - // Tapping into a workspace is a read receipt: clear its unread on the Mac - // (like opening a thread marks it read), so it drops out of the unread - // list and the back-button count. Only when the Mac advertises read-state - // actions and the workspace is actually unread, so older Macs and - // already-read workspaces send nothing. - if supportsWorkspaceReadStateActions, workspaceHadUnread { - await setWorkspaceUnread(id: resolvedRowID, false) - } - } - /// Submit the current terminal input text from a synchronous UI action. public func sendTerminalInput() { Task { @MainActor [weak self] in @@ -4904,7 +4812,9 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { @discardableResult func connect( ticket: CmxAttachTicket, + authContext: MobileShellRPCAuthContext, allowsStackAuthFallback: Bool? = nil, + pendingManualHostTrust: PendingManualHostTrust? = nil, pairedMacDeviceID: String? = nil, instanceTagExpectation: MobileMacInstanceTagExpectation = .adopt, ifStillCurrent: (() -> Bool)? = nil @@ -4913,36 +4823,33 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { func isConnectCurrent() -> Bool { isCurrentConnectionAttempt(generation) && (ifStillCurrent?() ?? true) } + let preservesActiveConnection = hasActiveMacConnection connectionAttemptGeneration = generation - connectionGeneration = generation diagnosticLog?.record(DiagnosticEvent(.connect)) - cancelRemoteOperationTasks() - rawTerminalInputBuffer.clear() + if !preservesActiveConnection { + connectionGeneration = generation + cancelRemoteOperationTasks() + rawTerminalInputBuffer.clear() + } let supportedKinds = runtime?.supportedRouteKinds ?? [] - let supportedRoutes = Self.supportedRoutes(for: ticket, supportedKinds: supportedKinds) + let supportedRoutes = routeSelection.supportedRoutes(for: ticket, supportedKinds: supportedKinds) guard let firstRoute = supportedRoutes.first else { - // No route kind this build can dial: set the specific category; - // the caller records the matching analytics reason from it. connectionError = MobilePairingFailureCategory.noSupportedRoute.message connectionErrorGuidance = MobilePairingFailureCategory.noSupportedRoute.guidance - connectionState = .disconnected - macConnectionStatus = .unavailable diagnosticLog?.record(DiagnosticEvent( .routeUnavailable, a: DiagnosticTransportKind.unknown.rawValue, b: DiagnosticFailureKind.unsupportedRoute.rawValue )) - clearRemoteConnectionContext() + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) return .noSupportedRoute } - // No connect-time expiry gate: a pairing QR never expires (new QRs - // carry no expiry at all), and the host authorizes by Stack account, - // not ticket age. Expiry still gates the RPC-minted attach token at - // its point of use (`MobileCoreRPCClient.requestDataWithAuth`). - activeTicket = ticket - activeRoute = firstRoute - connectedHostName = placeholderHostName(for: ticket, firstRoute: firstRoute) - replaceRemoteClient(with: nil) + if !preservesActiveConnection { + activeTicket = ticket + activeRoute = firstRoute + connectedHostName = placeholderHostName(for: ticket, firstRoute: firstRoute) + replaceRemoteClient(with: nil) + } guard let runtime else { guard isConnectCurrent() else { return nil } @@ -4950,25 +4857,58 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { applyPreviewTicket(ticket, route: firstRoute) connectionState = .connected markMacConnectionHealthy() + clearManualHostTrustWarning() return nil } let workspaceListRequests = try Self.initialWorkspaceListRequests(for: ticket) - // Stack auth is now the authorization gate for every request. Decide the - // fallback per attempted route so an untrusted fallback route cannot - // disable auth for a trusted Tailscale/loopback/iroh route. let routeAllowsStackAuthFallbackOverride = allowsStackAuthFallback let connectionAttemptStartedAt = pairingAttemptStartedAt var lastError: (any Error)? + var lastErrorRoute: CmxAttachRoute? routeLoop: for route in supportedRoutes { - activeRoute = route + if !preservesActiveConnection { + activeRoute = route + } mobileShellLog.info("pairing trying route kind=\(route.kind.rawValue, privacy: .public) endpoint=\(route.endpoint.logDescription, privacy: .private)") + if let pendingManualHostTrust { + let needsApproval = await manualHostRouteNeedsApproval( + route, + stackUserID: authContext.stackUserID + ) + guard isConnectCurrent(), + isRPCAuthContextCurrent(authContext) else { return nil } + if needsApproval, case let .hostPort(host, _) = route.endpoint { + queueManualHostTrustWarning( + route: route, + displayHost: host, + pending: pendingManualHostTrust.approving(route: route) + ) + throw ManualHostTrustApprovalQueued.required + } + } + let manualHostTrusted = await manualHostStackAuthTrusted( + for: route, + stackUserID: authContext.stackUserID + ) + guard isConnectCurrent(), + isRPCAuthContextCurrent(authContext) else { return nil } + let routeAllowsStackAuth = MobileShellRouteAuthPolicy().routeAllowsStackAuth( + route, + manualHostTrusted: manualHostTrusted + ) let client = MobileCoreRPCClient( runtime: runtime, route: route, ticket: ticket, allowsStackAuthFallback: routeAllowsStackAuthFallbackOverride - ?? MobileShellRouteAuthPolicy.routeAllowsStackAuth(route), + ?? routeAllowsStackAuth, + manualHostStackAuthTrustProvider: manualHostStackAuthTrustProvider( + for: route, + stackUserID: authContext.stackUserID + ), + authScope: rpcAuthScopeForRoute(for: route, context: authContext), + authScopeValidator: rpcAuthScopeValidator(for: route, context: authContext), connectAttemptRegistry: connectAttemptRegistry, stackTokenGate: stackTokenGate, stackTokenForceRefreshGate: stackTokenForceRefreshGate, @@ -5090,13 +5030,12 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { ticket, adoptingReportedDeviceID: reportedDeviceID ) - activeTicket = resolvedTicket - let reportedName = hasAuthenticatedIdentity ? status.macDisplayName : nil - if let reportedName = reportedName? - .trimmingCharacters(in: .whitespacesAndNewlines), - !reportedName.isEmpty { - connectedHostName = reportedName - } + // Foreground identity (activeTicket / connectedHostName) + // is installed only after currentness validation below, so + // a superseded connect can't overwrite a newer session. + let reportedName = hasAuthenticatedIdentity + ? status.macDisplayName?.trimmingCharacters(in: .whitespacesAndNewlines) + : nil let tagUpdate: PairedMacInstanceTagUpdate if reportedInstanceTag != nil { tagUpdate = .replace(resolvedInstanceTag) @@ -5105,11 +5044,19 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } else { tagUpdate = .preserve } + let persistedPairingScope = await currentScopeSnapshot( + userID: authContext.stackUserID + ) + guard isConnectCurrent(), + isRPCAuthContextCurrent(authContext) else { return nil } let accepted = await persistPairedMacFromTicket( resolvedTicket, instanceTagUpdate: tagUpdate, - displayNameOverride: reportedName, - ifStillCurrent: isConnectCurrent + displayNameOverride: reportedName?.isEmpty == false ? reportedName : nil, + markActive: false, + ifStillCurrent: { + isConnectCurrent() && self.isRPCAuthContextCurrent(authContext) + } ) guard accepted else { await client.disconnect() @@ -5120,10 +5067,28 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { .hostAuthenticated, a: DiagnosticTransportKind(route.kind).rawValue )) - guard isConnectCurrent() else { + guard isConnectCurrent(), + isRPCAuthContextCurrent(authContext) else { await client.disconnect() return nil } + if preservesActiveConnection { + connectionGeneration = generation + cancelRemoteOperationTasks() + stopTerminalRefreshPolling() + rawTerminalInputBuffer.clear() + resetTerminalOutputTracking() + } + activeTicket = resolvedTicket + activeRoute = route + if let reportedName, !reportedName.isEmpty { + connectedHostName = reportedName + } else { + connectedHostName = placeholderHostName( + for: resolvedTicket, + firstRoute: route + ) + } replaceRemoteClient(with: client) activeMacInstanceTag = resolvedInstanceTag prepareTerminalThemeRevisionAuthority( @@ -5165,13 +5130,8 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { applyRemoteWorkspaceList( response, preferActiveTicketTarget: workspaceListRequest.preferActiveTicketTarget, - // Scoped requests omit groups; only a non-scoped (full) list - // is authoritative for the device-local collapse store. groupsAreAuthoritative: !workspaceListRequest.isScoped ) - // Drop the now-stale previous-foreground/anonymous snapshot so it - // doesn't linger in the aggregate (it's re-added as a secondary - // below if still reachable). dropStalePreviousForeground(previousForegroundKey) syncSelectedTerminalForWorkspace() connectionState = .connected @@ -5194,12 +5154,11 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { generation: generation ) } - // Aggregate the user's other Macs' workspaces in the background. - // Best-effort; never blocks the foreground connect. if multiMacAggregationEnabled { self.scheduleSecondaryAggregation() } diagnosticLog?.record(DiagnosticEvent(.pairOk)) + clearManualHostTrustWarning() if workspaceListRequest.isScoped { scheduleFullWorkspaceListRefreshIfAvailable( client: client, @@ -5207,10 +5166,23 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { generation: generation ) } + if !resolvedTicket.macDeviceID.isEmpty, + resolvedTicket.macDeviceID != "manual-ticket-request", + !resolvedTicket.macDeviceID.hasPrefix("manual-"), + let activeWrite = enqueueActivePairedMacWrite( + macDeviceID: resolvedTicket.macDeviceID, + instanceTag: activeMacInstanceTag, + scope: persistedPairingScope, + reloadAfterWrite: false + ) { + await activeWrite.value + } return nil } catch { lastError = error - guard isConnectCurrent() else { + lastErrorRoute = route + guard isConnectCurrent(), + isRPCAuthContextCurrent(authContext) else { await client.disconnect() return nil } @@ -5224,6 +5196,16 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { || failure == .accountMismatch { recordHostAuthenticationFailure(route: route, failure: failure) } + // Definitive authorization-boundary failures terminate + // route fallback: continuing would retry a lower-trust + // route after the host already rejected this identity. + if requiresAuthorizationFailureHandling(error) + || MobilePairingFailureCategory.classify( + error: error, + route: route + ).isAuthorizationFailure { + throw MobileShellRoutedConnectionError(underlying: error, route: route) + } } } // This route exhausted every workspace-list request without being @@ -5239,6 +5221,12 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { ?? DiagnosticTransportKind.unknown.rawValue, b: Self.diagnosticFailureKind(for: lastError).rawValue )) + if let lastError, let lastErrorRoute { + if lastError is CancellationError { + throw lastError + } + throw MobileShellRoutedConnectionError(underlying: lastError, route: lastErrorRoute) + } throw lastError ?? MobileShellConnectionError.connectionClosed } @@ -5376,7 +5364,11 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { generation: UUID, timeoutNanoseconds: UInt64? = nil ) async -> Bool { - guard MobileShellRouteAuthPolicy.routeAllowsStackAuth(route), + let manualHostTrusted = await manualHostStackAuthTrusted(for: route) + guard MobileShellRouteAuthPolicy().routeAllowsStackAuth( + route, + manualHostTrusted: manualHostTrusted + ), let attachToken = activeTicket?.authToken?.trimmingCharacters(in: .whitespacesAndNewlines), !attachToken.isEmpty else { return false @@ -5402,19 +5394,36 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } catch { mobileShellLog.info("full mobile workspace list unavailable after scoped attach: \(String(describing: error), privacy: .private)") if isCurrentRemoteConnection(client: client, generation: generation) { - _ = disconnectForAuthorizationFailureIfNeeded(error) + _ = handleAuthorizationFailureIfNeeded( + error, + owner: .foreground(client: client, generation: generation, route: activeRoute) + ) } return false } } private func clearActiveConnectionContext() { + cancelManualHostTrustExpiration() activeTicket = nil activeRoute = nil activeMacInstanceTag = nil connectedHostName = "" } + /// Tears down only the foreground session while keeping account auth valid for host reapproval. + func disconnectForegroundForManualHostReapproval() { + connectionRequiresReauth = false + connectionState = .disconnected + macConnectionStatus = .unavailable + clearRemoteConnectionContext(preservingOtherMacWorkspaceState: true) + } + + /// Removes a failed secondary client from the internal connection pool. + func removeSecondaryConnectionFromPool(macDeviceID: String) { + connections[macDeviceID] = nil + } + func clearRemoteConnectionContext(preservingOtherMacWorkspaceState: Bool = false) { connectionGeneration = UUID() connectionAttemptGeneration = UUID() @@ -5538,23 +5547,26 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// The one shared entry every pairing flow funnels through, so it is also the /// single `ios_pairing_started` fire-site. `method` is `qr`/`manual`/ /// `attach_url`; pass `nil` for non-instrumented internal flows (preview). - private func beginPairingAttempt(method: String? = nil) -> UUID { + func beginPairingAttempt(method: String? = nil) -> UUID { // Any explicit connect supersedes launch/network recovery, including a // recovery suspended in a registry refresh for the same device id. connectionRecoveryOwner.cancel() applyConnectionRecoveryOwnerState() storedMacReconnectGeneration &+= 1 let attemptID = beginPairingValidationAttempt(method: method) - connectionGeneration = UUID() connectionAttemptGeneration = UUID() - cancelRemoteOperationTasks() - rawTerminalInputBuffer.clear() + if !hasActiveMacConnection { + connectionGeneration = UUID() + cancelRemoteOperationTasks() + rawTerminalInputBuffer.clear() + } clearPairingError() clearPairingVersionWarning() + clearManualHostTrustWarning() return attemptID } - private func beginPairingValidationAttempt(method: String? = nil) -> UUID { + func beginPairingValidationAttempt(method: String? = nil) -> UUID { let attemptID = UUID() pairingAttemptID = attemptID if let method { @@ -5577,7 +5589,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// Emits `ios_pairing_succeeded` once for the in-flight attempt, then clears /// the attempt timing so a later state change can't double-fire. - private func recordPairingSucceeded() { + func recordPairingSucceeded() { guard let method = pairingAttemptMethod else { return } var props: [String: AnalyticsValue] = [ "method": .string(method), @@ -5598,7 +5610,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// Emits `ios_pairing_failed` once for the in-flight attempt with a reason + /// phase, then clears the attempt timing so it can't double-fire. - private func recordPairingFailed(reason: String, phase: String) { + func recordPairingFailed(reason: String, phase: String) { guard let method = pairingAttemptMethod else { return } var props: [String: AnalyticsValue] = [ "method": .string(method), @@ -5616,7 +5628,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { pairingAttemptMethod = nil } - private func isCurrentPairingAttempt(_ attemptID: UUID) -> Bool { + func isCurrentPairingAttempt(_ attemptID: UUID) -> Bool { pairingAttemptID == attemptID && isSignedIn } @@ -5634,7 +5646,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { macSwitchRestoreBaseline = nil } invalidatePairingAttempt() - connectionAttemptGeneration = UUID() return attemptID } @@ -5644,7 +5655,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { && isSignedIn } - private func finishMacSwitchAttempt(_ attemptID: UUID) { + func finishMacSwitchAttempt(_ attemptID: UUID) { if macSwitchAttemptID == attemptID { macSwitchAttemptID = nil macSwitchAttemptSignInGeneration = nil @@ -5661,7 +5672,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { macSwitchRestoreBaseline = nil if invalidateUnderlyingConnectionAttempt { invalidatePairingAttempt() - connectionAttemptGeneration = UUID() } } @@ -5686,11 +5696,13 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// Invalidate the in-flight attempt outside ``beginPairingAttempt(method:)`` /// (cancel, sign-out, live-connection teardown), dropping its instrumentation - /// so a stale attempt can never emit `ios_pairing_*` via a later auth eviction. - private func invalidatePairingAttempt() { + /// and rotating the inner connection generation so no stale attempt can + /// commit a replacement client or emit `ios_pairing_*` later. + func invalidatePairingAttempt() { pairingAttemptID = UUID() pairingAttemptStartedAt = nil pairingAttemptMethod = nil + connectionAttemptGeneration = UUID() } /// Apply a classified pairing failure to the user-visible error surface and @@ -5700,7 +5712,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// line and one `ios_pairing_failed` whose `reason` matches the message. /// ``connectionState``/``macConnectionStatus`` teardown stays at the call /// sites because some paths (auth re-auth) also flip ``connectionRequiresReauth``. - private func applyPairingFailure(_ category: MobilePairingFailureCategory, phase: String) { + func applyPairingFailure(_ category: MobilePairingFailureCategory, phase: String) { // `.cancelled` (the only empty-message category) must be handled by // `catch is CancellationError` branches before classification. assert(!category.message.isEmpty, "applyPairingFailure must not receive .cancelled") @@ -5734,12 +5746,12 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// Clear the error and its guidance together (never bare `connectionError /// = nil`) so guidance cannot linger under a cleared headline. - private func clearPairingError() { + func clearPairingError() { connectionError = nil connectionErrorGuidance = nil } - private func clearPairingVersionWarning() { + func clearPairingVersionWarning() { pairingVersionWarning = nil pendingPairingVersionWarningURL = nil } @@ -5774,7 +5786,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// Record an `ios_pairing_failed` for a `connect()` that returned without /// connecting and already set a specific ``connectionError``: emits the reason /// `connect()` reported (fallback `other`) without overwriting the message. - private func recordFailureForCurrentConnectionError( + func recordFailureForCurrentConnectionError( phase: String, category: MobilePairingFailureCategory? = nil ) { @@ -5798,8 +5810,25 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { connectionErrorGuidance = category.guidance } + func applyAuthorizationFailure( + _ category: MobilePairingFailureCategory, + preservingActiveConnection: Bool + ) { + connectionError = category.message.isEmpty + ? L10n.string("mobile.pairing.runtimeUnavailable", defaultValue: "Could not connect to your computer.") + : category.message + connectionErrorGuidance = category.guidance + if !preservingActiveConnection { + connectionRequiresReauth = true + connectionState = .disconnected + macConnectionStatus = .unavailable + clearRemoteConnectionContext() + } + recordPairingFailed(reason: category.analyticsReason, phase: "auth") + } + /// How the preflight resolved: proceed, ``.offline`` applied, or superseded. - private enum PairingPreflightOutcome { + enum PairingPreflightOutcome { case proceed case failedOffline case superseded @@ -5810,21 +5839,27 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { /// timeouts into an opaque ~60s wait. Loopback candidate routes skip it (they /// stay reachable offline; simulator/dev pairing to 127.0.0.1). Records a /// ``DiagnosticEventCode/pairUnreachable`` diagnostic (no host/secret). - private func failPairingIfOffline( + func failPairingIfOffline( attemptID: UUID, phase: String, - routes: [CmxAttachRoute] + routes: [CmxAttachRoute], + preservesActiveConnection: Bool = false ) async -> PairingPreflightOutcome { - if routes.contains(where: MobileShellRouteAuthPolicy.routeIsLoopback) { return .proceed } + if routes.contains(where: MobileShellRouteAuthPolicy().routeIsLoopback) { return .proceed } guard await reachability.isOnline == false else { return .proceed } guard isCurrentPairingAttempt(attemptID) else { return .superseded } mobileShellLog.info("pairing preflight: device offline, short-circuiting") diagnosticLog?.record(DiagnosticEvent(.pairUnreachable)) applyPairingFailure(.offline, phase: phase) + clearFailedPairingConnection(preservingActiveConnection: preservesActiveConnection) + return .failedOffline + } + + func clearFailedPairingConnection(preservingActiveConnection: Bool) { + guard !preservingActiveConnection else { return } connectionState = .disconnected macConnectionStatus = .unavailable clearRemoteConnectionContext() - return .failedOffline } func clearCreateWorkspaceTask(id: UUID) { @@ -5854,12 +5889,14 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { func markMacConnectionHealthy() { guard connectionState == .connected else { macConnectionStatus = .unavailable + isRecoveringConnection = false return } macConnectionStatus = .connected isRecoveringConnection = false connectionRecoveryFailed = false connectionRequiresReauth = false + scheduleManualHostTrustExpirationForActiveRoute() } func markMacConnectionReconnecting() { @@ -5875,6 +5912,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { private func markMacConnectionUnavailable() { guard connectionState == .connected else { macConnectionStatus = .unavailable + isRecoveringConnection = false return } macConnectionStatus = .unavailable @@ -6086,7 +6124,10 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { } } catch { guard generation == connectionGeneration, !Task.isCancelled else { return } - guard !disconnectForAuthorizationFailureIfNeeded(error) else { return } + guard !handleAuthorizationFailureIfNeeded( + error, + owner: .foreground(client: client, generation: generation, route: activeRoute) + ) else { return } handleMacAvailabilityFailureIfCurrent( after: error, expectedClient: client, @@ -6167,7 +6208,10 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { handleTerminalInputResponse(responseData, surfaceID: terminalID.rawValue) } catch { guard generation == connectionGeneration else { return } - guard !disconnectForAuthorizationFailureIfNeeded(error) else { return } + guard !handleAuthorizationFailureIfNeeded( + error, + owner: .foreground(client: client, generation: generation, route: activeRoute) + ) else { return } handleMacAvailabilityFailureIfCurrent( after: error, expectedClient: client, @@ -6255,7 +6299,10 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { return true } catch { guard generation == connectionGeneration else { return false } - guard !disconnectForAuthorizationFailureIfNeeded(error) else { return false } + guard !handleAuthorizationFailureIfNeeded( + error, + owner: .foreground(client: client, generation: generation, route: activeRoute) + ) else { return false } handleMacAvailabilityFailureIfCurrent( after: error, expectedClient: client, @@ -6356,7 +6403,10 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { return true } catch { guard generation == connectionGeneration else { return false } - guard !disconnectForAuthorizationFailureIfNeeded(error) else { return false } + guard !handleAuthorizationFailureIfNeeded( + error, + owner: .foreground(client: client, generation: generation, route: activeRoute) + ) else { return false } handleMacAvailabilityFailureIfCurrent( after: error, expectedClient: client, @@ -6393,6 +6443,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { topics: [String], timeoutNanoseconds: UInt64? = nil ) async -> TerminalEventSubscriptionAck { + let generation = connectionGeneration let requestData: Data do { requestData = try MobileCoreRPCClient.requestData( @@ -6426,8 +6477,11 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { // A definitive auth failure here (RPC layer already tried a // force-refresh + retry) must drive the re-auth prompt instead of a // silently stale live frame. - if remoteClient === client { - _ = disconnectForAuthorizationFailureIfNeeded(error) + if isCurrentRemoteConnection(client: client, generation: generation) { + _ = handleAuthorizationFailureIfNeeded( + error, + owner: .foreground(client: client, generation: generation, route: activeRoute) + ) } return .failed } @@ -7196,6 +7250,7 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { #endif return } + let generation = connectionGeneration guard let workspaceID = workspaceID(forTerminalID: surfaceID) else { clearTerminalReplayBarrierIfCurrent( surfaceID: surfaceID, @@ -7504,7 +7559,14 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { // definitive auth failure here (after the RPC layer's // force-refresh-and-retry already gave up) must drive the re-auth // prompt instead of silently leaving a stale frame. - guard !self.disconnectForAuthorizationFailureIfNeeded(error) else { return } + guard !self.handleAuthorizationFailureIfNeeded( + error, + owner: .foreground( + client: client, + generation: generation, + route: self.activeRoute + ) + ) else { return } if let retryToken = self.prepareTerminalReplayFailureRetry( surfaceID: surfaceID, replayBarrierToken: replayBarrierTokenForRequest @@ -7851,55 +7913,6 @@ public final class MobileShellComposite: MobileTerminalOutputSinking { return true } - func disconnectForAuthorizationFailureIfNeeded(_ error: any Error) -> Bool { - guard Self.shouldDisconnectForAuthorizationFailure(error) else { - return false - } - let category = MobilePairingFailureCategory.classify(error: error, route: activeRoute) - // Not `applyPairingFailure`: this path also sets `connectionRequiresReauth`, - // uses fallback-if-empty, and gates analytics on `pairingAttemptMethod` so - // live-connection auth evictions never emit `ios_pairing_failed`. - connectionError = category.message.isEmpty - ? L10n.string("mobile.pairing.runtimeUnavailable", defaultValue: "Could not connect to your computer.") - : category.message - connectionErrorGuidance = category.guidance - connectionRequiresReauth = true - connectionState = .disconnected - macConnectionStatus = .unavailable - clearRemoteConnectionContext() - // Only emits while a pairing attempt is in flight: `recordPairingFailed` - // no-ops once `pairingAttemptMethod` is nil (cleared on success and by - // `invalidatePairingAttempt`), so live-connection auth failures that - // also route through here never emit `ios_pairing_failed`. - recordPairingFailed(reason: category.analyticsReason, phase: "auth") - return true - } - - private static func shouldDisconnectForAuthorizationFailure(_ error: any Error) -> Bool { - guard let connectionError = error as? MobileShellConnectionError else { - return false - } - switch connectionError { - case .attachTicketExpired, .authorizationFailed, .accountMismatch: - return true - case let .rpcError(code, message): - let normalizedCode = code?.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() - if let normalizedCode, - ["unauthorized", "forbidden", "invalid_token", "token_expired", "expired_token", "auth_required"].contains(normalizedCode) { - return true - } - let normalizedMessage = message.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() - return normalizedMessage.contains("unauthorized") - || normalizedMessage.contains("forbidden") - || normalizedMessage.contains("invalid token") - || normalizedMessage.contains("expired token") - || normalizedMessage.contains("token expired") - case .invalidResponse, .connectionClosed, .requestTimedOut, - .transportWriteTimedOut, .insecureManualRoute: - return false - } - } - private func applyPreviewTicket(_ ticket: CmxAttachTicket, route: CmxAttachRoute) { let terminalID = ticket.terminalID ?? "attached-terminal" setForegroundWorkspaceState( @@ -7935,24 +7948,3 @@ private extension MobileWorkspacePreview { terminals.contains(where: \.isReady) } } -extension MobileShellComposite { - /// The name shown for the Mac until `mobile.host.status` reports the real - /// one: the ticket's display name, then its device id, then the dialed - /// route's host (a minimal v2 pairing code carries neither name nor id, - /// so the Tailscale hostname is the best available placeholder). - func placeholderHostName( - for ticket: CmxAttachTicket, - firstRoute: CmxAttachRoute - ) -> String { - if let name = ticket.macDisplayName, !name.isEmpty { - return name - } - if !ticket.macDeviceID.isEmpty { - return ticket.macDeviceID - } - if case let .hostPort(host, _) = firstRoute.endpoint { - return host - } - return "" - } -} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellPreviewFactory.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellPreviewFactory.swift new file mode 100644 index 000000000000..810fef2b6b3b --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellPreviewFactory.swift @@ -0,0 +1,33 @@ +public import CmuxMobileRPC +public import CmuxMobileShellModel + +/// Builds preview and test shell stores with explicit preview-only dependencies. +public struct MobileShellPreviewFactory { + private let runtime: (any MobileSyncRuntime)? + private let manualHostTrustStore: any MobileManualHostTrustStoring + + /// Creates a preview shell factory. + /// - Parameters: + /// - runtime: Optional runtime used by previews or package tests. + /// - manualHostTrustStore: Store used to persist manual-host approvals in the preview shell. + public init( + runtime: (any MobileSyncRuntime)? = nil, + manualHostTrustStore: any MobileManualHostTrustStoring = InMemoryMobileManualHostTrustStore() + ) { + self.runtime = runtime + self.manualHostTrustStore = manualHostTrustStore + } + + /// Creates a shell store seeded with preview workspaces. + /// - Returns: A shell store configured for previews or package tests. + @MainActor + public func makeStore() -> CMUXMobileShellStore { + CMUXMobileShellStore( + runtime: runtime, + workspaces: PreviewMobileHost.workspaces, + identityProvider: MobileShellPreviewIdentityProvider(), + deliveredNotificationClearer: NoopDeliveredNotificationClearer(), + manualHostTrustStore: manualHostTrustStore + ) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellPreviewIdentityProvider.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellPreviewIdentityProvider.swift new file mode 100644 index 000000000000..64300d05466c --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellPreviewIdentityProvider.swift @@ -0,0 +1,7 @@ +import CmuxMobileShellModel + +/// Supplies one stable signed-in account scope to preview and package-test shells. +@MainActor +struct MobileShellPreviewIdentityProvider: MobileIdentityProviding { + let currentUserID: String? = "cmux-mobile-shell-preview-user" +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRPCAuthContext.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRPCAuthContext.swift new file mode 100644 index 000000000000..d344cdb735db --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRPCAuthContext.swift @@ -0,0 +1,13 @@ +import CmuxMobileRPC +import Foundation + +/// Immutable credential owner captured before an asynchronous mobile RPC flow begins. +struct MobileShellRPCAuthContext: Equatable, Sendable { + let stackUserID: String? + let accountScope: MobileRPCAuthScope + let manualHostScope: MobileRPCAuthScope + + var hasStackUserID: Bool { + stackUserID?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellReconnectRouteCandidate.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellReconnectRouteCandidate.swift new file mode 100644 index 000000000000..8374657283e7 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellReconnectRouteCandidate.swift @@ -0,0 +1,8 @@ +import CMUXMobileCore + +struct MobileShellReconnectRouteCandidate: Equatable, Sendable { + let route: CmxAttachRoute + let host: String + let port: Int + var routeID: String { route.id } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRouteSelection.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRouteSelection.swift new file mode 100644 index 000000000000..b6400a1af2c7 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRouteSelection.swift @@ -0,0 +1,231 @@ +import CMUXMobileCore +import CmuxMobileShellModel +import CmuxMobileSupport +import Darwin +import Foundation + +struct MobileShellRouteSelection: Sendable { + let routeAuthPolicy: MobileShellRouteAuthPolicy + + init(routeAuthPolicy: MobileShellRouteAuthPolicy = MobileShellRouteAuthPolicy()) { + self.routeAuthPolicy = routeAuthPolicy + } + + /// Whether route selection must reject loopback routes. A loopback route + /// (`.debugLoopback`, `127.0.0.1`) names the host it runs on, so on a + /// physical device it can only ever reach the phone itself, never a remote + /// Mac. Simulators and explicit mock-data UI tests host their test server at + /// loopback, so those harnesses opt into it instead of weakening real-device + /// reconnect for every debug build. + var prefersNonLoopbackRoutes: Bool { + #if os(iOS) && !targetEnvironment(simulator) + !UITestConfig.mockDataEnabled + #else + false + #endif + } + + /// The first reachable host/port route to a Mac, in priority order. + /// + /// When `preferNonLoopback` is set (physical devices), a real route + /// (`.tailscale` etc.) is always chosen over a `.debugLoopback` route even + /// if the loopback route has a lower (more-preferred) priority, because a + /// loopback route can never reach a remote Mac from a physical phone. A + /// loopback route is used only when it is the sole supported route - the + /// on-device XCUITest mock host, which serves a real listener on `127.0.0.1` + /// inside the test runner. This is what lets a restored Mac (whose published + /// routes include both `debug_loopback` and `tailscale`) actually connect + /// over Tailscale instead of dialing the phone's own loopback and failing. + func firstReconnectHostPortRoute( + _ routes: [CmxAttachRoute], + supportedKinds: [CmxAttachTransportKind], + preferNonLoopback: Bool = false + ) -> (String, Int)? { + reconnectHostPortRoutes( + routes, + supportedKinds: supportedKinds, + preferNonLoopback: preferNonLoopback + ).first.map { ($0.host, $0.port) } + } + + /// Ordered host/port reconnect candidates for a Mac, preserving the single-route + /// preference policy but keeping fallbacks available for the same Mac. + /// + /// With `preferNonLoopback` (physical devices) the list never contains a + /// `.debugLoopback` route — not even as the sole route. On a phone that + /// address names the phone itself, so a stale backup carrying only the + /// Mac's debug loopback route must fail closed instead of dialing a local + /// port that can never reach the Mac. Explicit mock/simulator harnesses + /// pass `false` and retain loopback for their in-process host. + func reconnectHostPortRoutes( + _ routes: [CmxAttachRoute], + supportedKinds: [CmxAttachTransportKind], + preferNonLoopback: Bool = false + ) -> [MobileShellReconnectRouteCandidate] { + let supportedKinds = Set(supportedKinds) + let ordered = routes.sorted(by: routeSortsBefore) + var seenEndpoints = Set() + + func appendCandidates( + where predicate: (CmxAttachRoute) -> Bool, + to candidates: inout [MobileShellReconnectRouteCandidate] + ) { + for route in ordered { + if !supportedKinds.isEmpty, !supportedKinds.contains(route.kind) { + continue + } + guard predicate(route), case let .hostPort(host, port) = route.endpoint else { + continue + } + let endpointKey = "\(host)\u{1F}\(port)" + guard seenEndpoints.insert(endpointKey).inserted else { continue } + candidates.append(MobileShellReconnectRouteCandidate(route: route, host: host, port: port)) + } + } + + var candidates: [MobileShellReconnectRouteCandidate] = [] + if preferNonLoopback { + // Prefer a Tailscale numeric IP over MagicDNS because it dials + // without client DNS. Keep encrypted Tailscale routes ahead of + // explicit plaintext manual-host fallbacks even when the manual + // host is also a numeric IP. + appendCandidates(where: { route in + guard routeHasVerifiedTailscaleProvenance(route), + case let .hostPort(host, _) = route.endpoint else { return false } + return CmxTailscalePeerAddress(host) != nil + }, to: &candidates) + appendCandidates(where: routeHasVerifiedTailscaleProvenance, to: &candidates) + appendCandidates(where: { $0.kind != .debugLoopback }, to: &candidates) + return candidates + } + appendCandidates(where: { _ in true }, to: &candidates) + return candidates + } + + /// Whether `host` is a numeric IP literal (IPv4 or IPv6) rather than a name + /// that needs DNS resolution. Used to prefer directly-dialable IP routes over + /// MagicDNS hostnames, which fail to resolve on some clients. + func isIPLiteralHost(_ host: String) -> Bool { + let trimmed = host.trimmingCharacters(in: .whitespacesAndNewlines) + let unbracketed = if trimmed.hasPrefix("[") && trimmed.hasSuffix("]") { + String(trimmed.dropFirst().dropLast()) + } else { + trimmed + } + + var ipv4 = in_addr() + if unbracketed.withCString({ inet_pton(AF_INET, $0, &ipv4) }) == 1 { + return true + } + var ipv6 = in6_addr() + return unbracketed.withCString { inet_pton(AF_INET6, $0, &ipv6) } == 1 + } + + /// `true` on a physical iPhone/iPad; `false` in the simulator and in + /// macOS-hosted package tests. Drives the loopback-pairing rejection. + var isPhysicalDevice: Bool { + #if os(iOS) && !targetEnvironment(simulator) + true + #else + false + #endif + } + + func manualHostRoute( + host: String, + port: Int, + isPhysicalDevice: Bool? = nil + ) throws -> CmxAttachRoute { + guard let normalizedHost = routeAuthPolicy.normalizedManualRouteHost(host) else { + throw URLError(.badURL) + } + guard let routeKind = routeAuthPolicy.manualRouteKind( + for: normalizedHost, + allowsDebugLoopback: !(isPhysicalDevice ?? self.isPhysicalDevice) + ) else { + throw URLError(.badURL) + } + return try CmxAttachRoute( + id: routeKind.rawValue, + kind: routeKind, + endpoint: .hostPort(host: normalizedHost, port: port) + ) + } + + func manualHostRoute( + host: String, + port: Int, + preserving sourceRoute: CmxAttachRoute?, + isPhysicalDevice: Bool? = nil + ) throws -> CmxAttachRoute { + let inferredRoute = try manualHostRoute(host: host, port: port, isPhysicalDevice: isPhysicalDevice) + guard let sourceRoute, + case let .hostPort(sourceHost, sourcePort) = sourceRoute.endpoint, + sourcePort == port, + routeAuthPolicy.normalizedManualRouteHost(sourceHost) == routeAuthPolicy.normalizedManualRouteHost(host) else { + return inferredRoute + } + if sourceRoute.kind == .manualHost + || sourceRoute.kind == inferredRoute.kind + || routeHasVerifiedTailscaleProvenance(sourceRoute) { + return sourceRoute + } + return inferredRoute + } + + func supportedRoutes( + for ticket: CmxAttachTicket, + supportedKinds: [CmxAttachTransportKind] + ) -> [CmxAttachRoute] { + let orderedRoutes = ticket.routes.sorted(by: routeSortsBefore) + guard !supportedKinds.isEmpty else { + return orderedRoutes + } + let supportedKinds = Set(supportedKinds) + return orderedRoutes.filter { route in + supportedKinds.contains(route.kind) + } + } + + func attachTicketIsUnexpired(_ ticket: CmxAttachTicket, now: Date) -> Bool { + !ticket.isExpired(at: now) + } + + private func routeSortsBefore(_ left: CmxAttachRoute, _ right: CmxAttachRoute) -> Bool { + if left.priority == right.priority { + return left.id < right.id + } + return left.priority < right.priority + } + + /// Whether a structured route still carries a recognizable Tailscale endpoint. + /// This is a provenance/ordering decision only; Tailscale routes remain + /// ineligible for Stack bearer auth under ``MobileShellRouteAuthPolicy``. + private func routeHasVerifiedTailscaleProvenance(_ route: CmxAttachRoute) -> Bool { + guard route.kind == .tailscale, + case let .hostPort(host, _) = route.endpoint else { + return false + } + if CmxTailscalePeerAddress(host) != nil { + return true + } + + let normalized = host.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() + let name = normalized.hasSuffix(".") ? String(normalized.dropLast()) : normalized + let labels = name.split(separator: ".", omittingEmptySubsequences: false) + guard name.hasSuffix(".ts.net"), labels.count >= 3, name.count <= 253 else { + return false + } + return labels.allSatisfy { label in + !label.isEmpty + && label.count <= 63 + && label.first != "-" + && label.last != "-" + && label.utf8.allSatisfy { byte in + (byte >= 0x61 && byte <= 0x7A) + || (byte >= 0x30 && byte <= 0x39) + || byte == 0x2D + } + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRoutedConnectionError.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRoutedConnectionError.swift new file mode 100644 index 000000000000..43e2b186c04b --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellRoutedConnectionError.swift @@ -0,0 +1,6 @@ +import CMUXMobileCore + +struct MobileShellRoutedConnectionError: Error { + let underlying: any Error + let route: CmxAttachRoute +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellScopeSnapshot.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellScopeSnapshot.swift index 2d1bb8390130..a2146cc89741 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellScopeSnapshot.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellScopeSnapshot.swift @@ -6,4 +6,6 @@ struct MobileShellScopeSnapshot: Equatable, Sendable { let userID: String let teamID: String? let generation: Int + let signInGeneration: Int + let rpcAuthContext: MobileShellRPCAuthContext } diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/PendingManualHostTrust.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/PendingManualHostTrust.swift new file mode 100644 index 000000000000..4adad53650c9 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/PendingManualHostTrust.swift @@ -0,0 +1,73 @@ +import CMUXMobileCore +import Foundation + +enum PendingManualHostTrust { + case manual( + attemptID: UUID, + name: String, + host: String, + port: Int, + route: CmxAttachRoute, + pairedMacDeviceID: String?, + instanceTagExpectation: MobileMacInstanceTagExpectation, + recordsPairingAttempt: Bool, + macSwitchAttemptID: UUID?, + ifStillCurrent: (() -> Bool)? + ) + case pairingURL( + attemptID: UUID, + rawURL: String, + acceptedVersionWarning: Bool, + approvedRouteID: String? + ) + + var attemptID: UUID { + switch self { + case let .manual(attemptID, _, _, _, _, _, _, _, _, _): + attemptID + case let .pairingURL(attemptID, _, _, _): + attemptID + } + } + + var macSwitchAttemptID: UUID? { + switch self { + case let .manual(_, _, _, _, _, _, _, _, macSwitchAttemptID, _): + macSwitchAttemptID + case .pairingURL: + nil + } + } + + var ifStillCurrent: (() -> Bool)? { + switch self { + case let .manual(_, _, _, _, _, _, _, _, _, ifStillCurrent): + ifStillCurrent + case .pairingURL: + nil + } + } + + var pairedMacDeviceID: String? { + switch self { + case let .manual(_, _, _, _, _, pairedMacDeviceID, _, _, _, _): + pairedMacDeviceID + case .pairingURL: + nil + } + } + + func approving(route: CmxAttachRoute) -> PendingManualHostTrust { + switch self { + case .manual: + self + case let .pairingURL(attemptID, rawURL, acceptedVersionWarning, _): + .pairingURL( + attemptID: attemptID, + rawURL: rawURL, + acceptedVersionWarning: acceptedVersionWarning, + approvedRouteID: route.id + ) + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/PendingWorkspaceOpenIntent.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/PendingWorkspaceOpenIntent.swift new file mode 100644 index 000000000000..cd537844c663 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/PendingWorkspaceOpenIntent.swift @@ -0,0 +1,13 @@ +import CmuxMobileShellModel +import Foundation + +/// A workspace tap suspended while its owning Mac waits for manual-host approval. +struct PendingWorkspaceOpenIntent { + let rowWorkspaceID: MobileWorkspacePreview.ID + let remoteWorkspaceID: MobileWorkspacePreview.ID + let ownerMacDeviceID: String? + let workspaceHadUnread: Bool + let terminalCount: Int + let isPinned: Bool + let macSwitchAttemptID: UUID +} diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/SecondaryMacSubscription.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/SecondaryMacSubscription.swift index 5dcec23d6c35..5ebd6eaa3a6e 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/SecondaryMacSubscription.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/SecondaryMacSubscription.swift @@ -25,6 +25,7 @@ final class SecondaryMacSubscription { /// Coalesces hot `workspace.updated` bursts to one leading and one trailing fetch. var refreshTask: Task? var refreshPending = false + var trustExpirationTask: Task? init( macDeviceID: String, @@ -52,6 +53,8 @@ final class SecondaryMacSubscription { task = nil refreshTask?.cancel() refreshTask = nil + trustExpirationTask?.cancel() + trustExpirationTask = nil let client = self.client Task { await client.disconnect() } } @@ -62,5 +65,7 @@ final class SecondaryMacSubscription { task = nil refreshTask?.cancel() refreshTask = nil + trustExpirationTask?.cancel() + trustExpirationTask = nil } } diff --git a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/WorkspaceMutationTarget.swift b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/WorkspaceMutationTarget.swift index 045fb796fc1f..c35d615a8bc6 100644 --- a/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/WorkspaceMutationTarget.swift +++ b/Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/WorkspaceMutationTarget.swift @@ -1,10 +1,13 @@ import CMUXMobileCore import CmuxMobileRPC import CmuxMobileShellModel +import Foundation /// Routing target for a workspace mutation in the aggregated multi-Mac list. struct WorkspaceMutationTarget { let client: MobileCoreRPCClient? + let route: CmxAttachRoute? + let connectionGeneration: UUID? let isForeground: Bool let macDeviceID: String? } diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AccountReplacementTokenProvider.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AccountReplacementTokenProvider.swift new file mode 100644 index 000000000000..636b54dfdd2c --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AccountReplacementTokenProvider.swift @@ -0,0 +1,36 @@ +actor AccountReplacementTokenProvider { + private var requestCount = 0 + private var requestCountWaiters: [( + expected: Int, + continuation: CheckedContinuation + )] = [] + private var releaseContinuations: [Int: CheckedContinuation] = [:] + + func token() async throws -> String { + requestCount += 1 + let requestIndex = requestCount + let readyWaiters = requestCountWaiters.filter { $0.expected <= requestCount } + requestCountWaiters.removeAll { $0.expected <= requestCount } + for waiter in readyWaiters { + waiter.continuation.resume() + } + return await withCheckedContinuation { continuation in + releaseContinuations[requestIndex] = continuation + } + } + + func waitUntilRequestCount(_ expected: Int) async { + if requestCount >= expected { return } + await withCheckedContinuation { continuation in + requestCountWaiters.append((expected, continuation)) + } + } + + func currentRequestCount() -> Int { + requestCount + } + + func releaseRequest(_ requestIndex: Int, with token: String) { + releaseContinuations.removeValue(forKey: requestIndex)?.resume(returning: token) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AttachTicketReconnectTransport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AttachTicketReconnectTransport.swift new file mode 100644 index 000000000000..51659cce696c --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AttachTicketReconnectTransport.swift @@ -0,0 +1,101 @@ +import CMUXMobileCore +import CmuxMobileRPC +import Foundation + +actor AttachTicketReconnectTransport: CmxByteTransportFactory, CmxByteTransport { + private nonisolated let ticketRoute: CmxAttachRoute + private var pendingFrames: [Data] = [] + private var receiveWaiters: [CheckedContinuation] = [] + + init(ticketRoute: CmxAttachRoute) { + self.ticketRoute = ticketRoute + } + + nonisolated func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + AttachTicketReconnectTransport(ticketRoute: ticketRoute) + } + + func connect() async throws {} + + func receive() async throws -> Data? { + if !pendingFrames.isEmpty { + return pendingFrames.removeFirst() + } + return await withCheckedContinuation { continuation in + receiveWaiters.append(continuation) + } + } + + func send(_ data: Data) async throws { + var buffer = data + let payloads = try MobileSyncFrameCodec.decodeFrames(from: &buffer) + for payload in payloads { + guard let parsed = (try? JSONSerialization.jsonObject(with: payload)) as? [String: Any], + let response = try response(method: parsed["method"] as? String, id: parsed["id"] as? String) else { + continue + } + deliver(response) + } + } + + func close() async {} + + private func response(method: String?, id: String?) throws -> Data? { + switch method { + case "mobile.attach_ticket.create": + return try Self.resultFrame(id: id, result: ["ticket": ticketObject()]) + case "workspace.list", "mobile.workspace.list": + return try Self.resultFrame(id: id, result: [ + "workspaces": [ + [ + "id": "trusted-workspace", + "title": "Trusted Workspace", + "is_selected": true, + "terminals": [], + ], + ], + ]) + case "mobile.host.status": + return try Self.resultFrame(id: id, result: [ + "terminal_fidelity": "render_grid", + "capabilities": [:], + ]) + default: + return nil + } + } + + private func ticketObject() throws -> Any { + let ticket = try CmxAttachTicket( + workspaceID: "trusted-workspace", + terminalID: nil, + macDeviceID: "trusted-mac", + macDisplayName: "Trusted Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [ticketRoute], + expiresAt: Date().addingTimeInterval(3600), + authToken: "ticket-secret" + ) + let encoder = JSONEncoder() + encoder.dateEncodingStrategy = .iso8601 + return try JSONSerialization.jsonObject(with: encoder.encode(ticket)) + } + + private func deliver(_ frame: Data) { + if receiveWaiters.isEmpty { + pendingFrames.append(frame) + return + } + let waiter = receiveWaiters.removeFirst() + waiter.resume(returning: frame) + } + + private static func resultFrame(id: String?, result: [String: Any]) throws -> Data { + let envelope: [String: Any] = [ + "id": id ?? UUID().uuidString, + "ok": true, + "result": result, + ] + return try MobileSyncFrameCodec.encodeFrame(JSONSerialization.data(withJSONObject: envelope)) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationFailingTransport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationFailingTransport.swift new file mode 100644 index 000000000000..8c282b7c5df7 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationFailingTransport.swift @@ -0,0 +1,19 @@ +import CMUXMobileCore +import CmuxMobileRPC +import Foundation + +actor AuthorizationFailingTransport: CmxByteTransport { + func connect() async throws { + throw MobileShellConnectionError.authorizationFailed("Authorization failed") + } + + func receive() async throws -> Data? { + nil + } + + func send(_ data: Data) async throws { + _ = data + } + + func close() async {} +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationFailingTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationFailingTransportFactory.swift new file mode 100644 index 000000000000..40530b044239 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationFailingTransportFactory.swift @@ -0,0 +1,9 @@ +import CMUXMobileCore +import CmuxMobileRPC + +struct AuthorizationFailingTransportFactory: CmxByteTransportFactory { + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + _ = route + return AuthorizationFailingTransport() + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationThenManualFallbackTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationThenManualFallbackTransportFactory.swift new file mode 100644 index 000000000000..252d5f93777c --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/AuthorizationThenManualFallbackTransportFactory.swift @@ -0,0 +1,17 @@ +import CMUXMobileCore + +struct AuthorizationThenManualFallbackTransportFactory: CmxByteTransportFactory { + let router: LivenessHostRouter + let box: TransportBox + let attempts: RouteAttemptRecorder + + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + attempts.record(route.kind) + if route.kind == .tailscale { + return AuthorizationFailingTransport() + } + let transport = LivenessTransport(router: router) + box.set(transport) + return transport + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingAccountSwitchTokenProvider.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingAccountSwitchTokenProvider.swift new file mode 100644 index 000000000000..c1d80039b4a4 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingAccountSwitchTokenProvider.swift @@ -0,0 +1,27 @@ +actor BlockingAccountSwitchTokenProvider { + private var didEnter = false + private var enteredWaiters: [CheckedContinuation] = [] + private var releaseWaiters: [CheckedContinuation] = [] + private var token = "user-a-token" + + func waitUntilRequested() async { + if didEnter { return } + await withCheckedContinuation { enteredWaiters.append($0) } + } + + func tokenIgnoringCancellation() async throws -> String { + didEnter = true + let waiters = enteredWaiters + enteredWaiters.removeAll() + for waiter in waiters { waiter.resume() } + await withCheckedContinuation { releaseWaiters.append($0) } + return token + } + + func release(with token: String) { + self.token = token + let waiters = releaseWaiters + releaseWaiters.removeAll() + for waiter in waiters { waiter.resume() } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingManualHostTrustPersistenceStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingManualHostTrustPersistenceStore.swift new file mode 100644 index 000000000000..215892a78fba --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingManualHostTrustPersistenceStore.swift @@ -0,0 +1,41 @@ +import CmuxMobileShellModel + +actor BlockingManualHostTrustPersistenceStore: MobileManualHostTrustStoring { + private var trustedScopes: Set = [] + private var didEnterTrust = false + private var enteredContinuation: CheckedContinuation? + private var releaseContinuation: CheckedContinuation? + + func waitUntilTrustIsBlocked() async { + if didEnterTrust { + return + } + await withCheckedContinuation { continuation in + enteredContinuation = continuation + } + } + + func releaseTrust() { + releaseContinuation?.resume() + releaseContinuation = nil + } + + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + trustedScopes.contains(scope) + } + + func trust(_ scope: MobileManualHostTrustScope) async { + didEnterTrust = true + enteredContinuation?.resume() + enteredContinuation = nil + await withCheckedContinuation { continuation in + releaseContinuation = continuation + } + guard !Task.isCancelled else { return } + trustedScopes.insert(scope) + } + + func removeAll() async { + trustedScopes.removeAll() + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingManualHostTrustStore.swift new file mode 100644 index 000000000000..ad17ecf7b8ec --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingManualHostTrustStore.swift @@ -0,0 +1,42 @@ +import CmuxMobileShellModel + +actor BlockingManualHostTrustStore: MobileManualHostTrustStoring { + private var didBlockFirstLookup = false + private var didEnterFirstLookup = false + private var enteredContinuation: CheckedContinuation? + private var releaseContinuation: CheckedContinuation? + + func waitUntilFirstLookupIsBlocked() async { + if didEnterFirstLookup { + return + } + await withCheckedContinuation { continuation in + enteredContinuation = continuation + } + } + + func releaseFirstLookup() { + releaseContinuation?.resume() + releaseContinuation = nil + } + + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + _ = scope + if !didBlockFirstLookup { + didBlockFirstLookup = true + didEnterFirstLookup = true + enteredContinuation?.resume() + enteredContinuation = nil + await withCheckedContinuation { continuation in + releaseContinuation = continuation + } + } + return false + } + + func trust(_ scope: MobileManualHostTrustScope) async { + _ = scope + } + + func removeAll() async {} +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingNetworkEpochTrustStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingNetworkEpochTrustStore.swift new file mode 100644 index 000000000000..2c7d89e42f43 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/BlockingNetworkEpochTrustStore.swift @@ -0,0 +1,48 @@ +import CmuxMobileShellModel + +actor BlockingNetworkEpochTrustStore: MobileManualHostTrustStoring { + private var removeCount = 0 + private var trustCount = 0 + private var removeWaiters: [( + expected: Int, + continuation: CheckedContinuation + )] = [] + private var releaseWaiters: [CheckedContinuation] = [] + + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + _ = scope + return false + } + + func trust(_ scope: MobileManualHostTrustScope) async { + _ = scope + trustCount += 1 + } + + func removeAll() async { + removeCount += 1 + let readyWaiters = removeWaiters.filter { $0.expected <= removeCount } + removeWaiters.removeAll { $0.expected <= removeCount } + for waiter in readyWaiters { waiter.continuation.resume() } + await withCheckedContinuation { releaseWaiters.append($0) } + } + + func waitUntilRemoveCount(_ expected: Int) async { + if removeCount >= expected { return } + await withCheckedContinuation { removeWaiters.append((expected, $0)) } + } + + func currentRemoveCount() -> Int { + removeCount + } + + func currentTrustCount() -> Int { + trustCount + } + + func releaseRemovals() { + let waiters = releaseWaiters + releaseWaiters.removeAll() + for waiter in waiters { waiter.resume() } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerSubmitRoutingTestSupport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerSubmitRoutingTestSupport.swift index 550aa6cde020..714015d39987 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerSubmitRoutingTestSupport.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerSubmitRoutingTestSupport.swift @@ -406,7 +406,9 @@ func makeRoutingConnectedStore( runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) store.foregroundMacDeviceID = "test-mac" return store @@ -438,7 +440,9 @@ func installFreshRemoteClient(on store: MobileShellComposite, router: RoutingHos runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) store.foregroundMacDeviceID = "test-mac-2" } @@ -470,7 +474,9 @@ func installSecondaryClient( runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) store.secondaryMacSubscriptions[macDeviceID] = SecondaryMacSubscription( macDeviceID: macDeviceID, diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ControllablePathChangeReachability.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ControllablePathChangeReachability.swift new file mode 100644 index 000000000000..1b2c3828c918 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ControllablePathChangeReachability.swift @@ -0,0 +1,19 @@ +import CmuxMobileShellModel +import CmuxMobileTransport + +struct ControllablePathChangeReachability: ReachabilityProviding, Sendable { + private let stream: AsyncStream + private let continuation: AsyncStream.Continuation + + init() { + let pair = AsyncStream.makeStream() + stream = pair.stream + continuation = pair.continuation + } + + var isOnline: Bool { get async { true } } + + func pathChanges() -> AsyncStream { stream } + + func emitPathChange() { continuation.yield(()) } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/CountingExpirationManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/CountingExpirationManualHostTrustStore.swift new file mode 100644 index 000000000000..ec7f0c361743 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/CountingExpirationManualHostTrustStore.swift @@ -0,0 +1,29 @@ +import CmuxMobileShellModel +import Foundation + +actor CountingExpirationManualHostTrustStore: MobileManualHostTrustStoring { + private var scopes: Set = [] + private var expirationQueries = 0 + + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + scopes.contains(scope) + } + + func trust(_ scope: MobileManualHostTrustScope) async { + scopes.insert(scope) + } + + func expirationDate(for scope: MobileManualHostTrustScope) async -> Date? { + guard scopes.contains(scope) else { return nil } + expirationQueries += 1 + return Date().addingTimeInterval(3_600) + } + + func removeAll() async { + scopes.removeAll() + } + + func expirationQueryCount() -> Int { + expirationQueries + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/CountingSlowIgnoringCancellationTransport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/CountingSlowIgnoringCancellationTransport.swift index 666509bf6069..81576bd750c6 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/CountingSlowIgnoringCancellationTransport.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/CountingSlowIgnoringCancellationTransport.swift @@ -4,11 +4,17 @@ import Foundation actor CountingSlowIgnoringCancellationTransport: CmxByteTransport { private var connects = 0 + private var connectWaiters: [CheckedContinuation] = [] private var releaseContinuations: [CheckedContinuation] = [] private var isReleased = false func connect() async throws { connects += 1 + let waiters = connectWaiters + connectWaiters.removeAll() + for waiter in waiters { + waiter.resume() + } await waitUntilReleased() throw MobileShellConnectionError.requestTimedOut } @@ -25,6 +31,11 @@ actor CountingSlowIgnoringCancellationTransport: CmxByteTransport { connects } + func waitUntilConnectStarted() async { + if connects > 0 { return } + await withCheckedContinuation { connectWaiters.append($0) } + } + func releaseStuckConnects() { isReleased = true let continuations = releaseContinuations diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureGate.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureGate.swift new file mode 100644 index 000000000000..cb834f44ec9f --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureGate.swift @@ -0,0 +1,24 @@ +actor HeldAuthorizationFailureGate { + private var didReachHeldRequest = false + private var reachedWaiters: [CheckedContinuation] = [] + private var releaseWaiters: [CheckedContinuation] = [] + + func waitUntilReached() async { + if didReachHeldRequest { return } + await withCheckedContinuation { reachedWaiters.append($0) } + } + + func holdUntilReleased() async { + didReachHeldRequest = true + let waiters = reachedWaiters + reachedWaiters.removeAll() + for waiter in waiters { waiter.resume() } + await withCheckedContinuation { releaseWaiters.append($0) } + } + + func release() { + let waiters = releaseWaiters + releaseWaiters.removeAll() + for waiter in waiters { waiter.resume() } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureTransport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureTransport.swift new file mode 100644 index 000000000000..c88cf31c7428 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureTransport.swift @@ -0,0 +1,74 @@ +import CMUXMobileCore +import CmuxMobileRPC +import Foundation + +actor HeldAuthorizationFailureTransport: CmxByteTransport { + private let method: String + private let gate: HeldAuthorizationFailureGate + private let router: LivenessHostRouter + private var pendingFrames: [Data] = [] + private var receiveWaiters: [CheckedContinuation] = [] + private var isClosed = false + + init(method: String, gate: HeldAuthorizationFailureGate, router: LivenessHostRouter) { + self.method = method + self.gate = gate + self.router = router + } + + func connect() async throws {} + + func receive() async throws -> Data? { + if !pendingFrames.isEmpty { return pendingFrames.removeFirst() } + if isClosed { return nil } + return await withCheckedContinuation { receiveWaiters.append($0) } + } + + func send(_ data: Data) async throws { + var buffer = data + let payloads = try MobileSyncFrameCodec.decodeFrames(from: &buffer) + for payload in payloads { + let request = (try? JSONSerialization.jsonObject(with: payload)) as? [String: Any] + let requestMethod = request?["method"] as? String + let requestID = request?["id"] as? String + let params = request?["params"] as? [String: Any] + let topics = params?["topics"] as? [String] + await router.record(method: requestMethod, topics: topics) + Task { [method, gate, router, weak self] in + let response: Data? + if requestMethod == method { + await gate.holdUntilReleased() + response = try? Self.errorFrame(id: requestID, message: "Unauthorized") + } else { + response = await router.response(method: requestMethod, id: requestID) + } + guard let response else { return } + await self?.deliver(response) + } + } + } + + func close() async { + isClosed = true + let waiters = receiveWaiters + receiveWaiters.removeAll() + for waiter in waiters { waiter.resume(returning: nil) } + } + + private func deliver(_ frame: Data) { + if !receiveWaiters.isEmpty { + receiveWaiters.removeFirst().resume(returning: frame) + } else { + pendingFrames.append(frame) + } + } + + private static func errorFrame(id: String?, message: String) throws -> Data { + let envelope: [String: Any] = [ + "id": id ?? UUID().uuidString, + "ok": false, + "error": ["message": message], + ] + return try MobileSyncFrameCodec.encodeFrame(JSONSerialization.data(withJSONObject: envelope)) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureTransportFactory.swift new file mode 100644 index 000000000000..5f28cfeb9dba --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldAuthorizationFailureTransportFactory.swift @@ -0,0 +1,12 @@ +import CMUXMobileCore + +struct HeldAuthorizationFailureTransportFactory: CmxByteTransportFactory { + let method: String + let gate: HeldAuthorizationFailureGate + let router: LivenessHostRouter + + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + _ = route + return HeldAuthorizationFailureTransport(method: method, gate: gate, router: router) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldFailingConnectTransport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldFailingConnectTransport.swift new file mode 100644 index 000000000000..9b27358c5ebc --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/HeldFailingConnectTransport.swift @@ -0,0 +1,19 @@ +import CMUXMobileCore +import Foundation + +actor HeldFailingConnectTransport: CmxByteTransport { + private let factory: RouteRecordingTransportFactory + + init(factory: RouteRecordingTransportFactory) { + self.factory = factory + } + + func connect() async throws { + await factory.waitUntilHeldConnectReleased() + throw RouteRecordingTransportError.routeFailed + } + + func receive() async throws -> Data? { nil } + func send(_ data: Data) async throws {} + func close() async {} +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ImmediateExpiryManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ImmediateExpiryManualHostTrustStore.swift new file mode 100644 index 000000000000..bb0fb764cc14 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ImmediateExpiryManualHostTrustStore.swift @@ -0,0 +1,25 @@ +import CmuxMobileShellModel +import Foundation + +actor ImmediateExpiryManualHostTrustStore: MobileManualHostTrustStoring { + private var expirationWasRequested = false + + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + _ = scope + return !expirationWasRequested + } + + func trust(_ scope: MobileManualHostTrustScope) async { + _ = scope + } + + func removeAll() async { + expirationWasRequested = true + } + + func expirationDate(for scope: MobileManualHostTrustScope) async -> Date? { + _ = scope + expirationWasRequested = true + return .distantPast + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualFallbackApprovalTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualFallbackApprovalTransportFactory.swift new file mode 100644 index 000000000000..7d99a80808d5 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualFallbackApprovalTransportFactory.swift @@ -0,0 +1,19 @@ +import CMUXMobileCore +import Foundation + +struct ManualFallbackApprovalTransportFactory: CmxByteTransportFactory { + let router: LivenessHostRouter + let box: TransportBox + var attempts: RouteAttemptRecorder? + var failingRouteKind: CmxAttachTransportKind = .tailscale + + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + attempts?.record(route.kind) + if route.kind == failingRouteKind { + return SlowIgnoringCancellationTransport() + } + let transport = LivenessTransport(router: router) + box.set(transport) + return transport + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualHostSwitchApprovalRegressionTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualHostSwitchApprovalRegressionTests.swift new file mode 100644 index 000000000000..e76ccb42bf3e --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualHostSwitchApprovalRegressionTests.swift @@ -0,0 +1,125 @@ +import CMUXMobileCore +import CmuxMobilePairedMac +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +/// Regressions for manual-host trust approval during a Mac switch: a queued +/// approval must survive the remaining route candidates, and the approved +/// switch must persist its target as the active Mac. +@MainActor +@Suite struct ManualHostSwitchApprovalRegressionTests { + @Test func secondManualCandidateDoesNotClobberPendingSwitchApproval() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + // Two untrusted manual-host candidates for ONE Mac. Dialing the second + // must not supersede the approval the first already queued. + try await pairedMacStore.upsert( + macDeviceID: "lan-mac", + displayName: "LAN Mac", + routes: [ + try manualRoute(host: "192.168.89.10", port: 58_465, priority: 10), + try manualRoute(host: "192.168.89.11", port: 58_466, priority: 20), + ], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let store = try await makeStore(pairedMacStore: pairedMacStore) + + let switched = await store.switchToMac(macDeviceID: "lan-mac") + + #expect(!switched) + // The FIRST candidate owns the pending approval; iterating on to the + // second candidate would rotate the pairing attempt and finish the + // switch attempt, stranding the user's approval as `.superseded`. + #expect(store.manualHostTrustWarning?.endpoint == "192.168.89.10:58465") + #expect(store.isMacSwitchInFlight) + + let approved = await store.acceptManualHostTrustWarning() + + #expect(approved == .connected) + #expect(store.connectionState == .connected) + #expect(!store.isMacSwitchInFlight) + } + + @Test func approvedManualHostSwitchPersistsTheConnectedMacAsActive() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + // The router fixture identifies the host as "test-mac"; the stored row + // uses the same real device id, as a paired manual host does after its + // first identity recovery. + try await pairedMacStore.upsert( + macDeviceID: "test-mac", + displayName: "Test Mac", + routes: [try manualRoute(host: "192.168.89.21", port: 58_465, priority: 10)], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let store = try await makeStore(pairedMacStore: pairedMacStore, deviceID: "test-mac") + + let switched = await store.switchToMac(macDeviceID: "test-mac") + #expect(!switched) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.89.21:58465") + + let approved = await store.acceptManualHostTrustWarning() + + #expect(approved == .connected) + #expect(store.connectionState == .connected) + // The approved switch is a switch success: identity recovery during the + // resumed connect must leave the connected Mac persisted as active, or + // the next relaunch reconnects to the previously-active Mac instead. + let activeMac = try await pairedMacStore.activeMac( + stackUserID: "phone-user", + teamID: nil + ) + #expect(activeMac?.macDeviceID == "test-mac") + } + + private func makeStore( + pairedMacStore: MobilePairedMacStore, + deviceID: String = "lan-mac" + ) async throws -> MobileShellComposite { + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: deviceID, instanceTag: nil, displayName: "LAN Mac") + let clock = TestClock() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { clock.now }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + store.signIn() + await store.loadPairedMacs() + return store + } + + private func manualRoute(host: String, port: Int, priority: Int) throws -> CmxAttachRoute { + try CmxAttachRoute( + id: "manual-\(host)-\(port)", + kind: .manualHost, + endpoint: .hostPort(host: host, port: port), + priority: priority + ) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualHostTrustExpirationSchedulingTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualHostTrustExpirationSchedulingTests.swift new file mode 100644 index 000000000000..8582ad81e0f8 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ManualHostTrustExpirationSchedulingTests.swift @@ -0,0 +1,51 @@ +import CMUXMobileCore +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct ManualHostTrustExpirationSchedulingTests { + @Test func repeatedHealthSchedulingKeepsOneExpirationLookup() async throws { + let router = LivenessHostRouter() + let trustStore = CountingExpirationManualHostTrustStore() + let clock = TestClock() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { clock.now }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: trustStore + ) + store.signIn() + + let queued = await store.connectManualHost( + name: "Studio Mac", + host: "192.168.1.77", + port: 58_465 + ) + let connected = await store.acceptManualHostTrustWarning() + let armed = try await pollUntil { + await trustStore.expirationQueryCount() >= 1 + } + + #expect(queued == .needsUserApproval) + #expect(connected == .connected) + #expect(armed) + let initialQueries = await trustStore.expirationQueryCount() + + for _ in 0..<20 { + store.scheduleManualHostTrustExpirationForActiveRoute() + } + let rearmed = try await pollUntil(attempts: 30) { + await trustStore.expirationQueryCount() > initialQueries + } + + #expect(!rearmed) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileMacInstanceRouteRaceTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileMacInstanceRouteRaceTests.swift index e4f834722c3a..1b6a93a69703 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileMacInstanceRouteRaceTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileMacInstanceRouteRaceTests.swift @@ -25,7 +25,7 @@ import Testing ) await shell.loadPairedMacs() let cachedA = try #require(shell.pairedMacs.first) - let scope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let scope = accountScope(for: shell) shell.refreshRoutesFromRegistryForTesting(for: cachedA, scope: scope) await registry.waitUntilStarted() @@ -74,7 +74,7 @@ import Testing teamID: "team-a", now: Date(timeIntervalSince1970: 20) ) - let scope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let scope = accountScope(for: shell) shell.applyPresenceUpdate(.online(PresenceInstance( deviceId: "shared-mac", @@ -107,6 +107,16 @@ import Testing ) } + private func accountScope(for shell: MobileShellComposite) -> MobileShellScopeSnapshot { + MobileShellScopeSnapshot( + userID: "user-1", + teamID: "team-a", + generation: 0, + signInGeneration: shell.currentSessionGeneration, + rpcAuthContext: shell.currentRPCAuthContext() + ) + } + private func route(id: String, port: Int) throws -> CmxAttachRoute { try CmxAttachRoute( id: id, diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileManualHostTrustPersistenceTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileManualHostTrustPersistenceTests.swift new file mode 100644 index 000000000000..bca7816819d4 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileManualHostTrustPersistenceTests.swift @@ -0,0 +1,42 @@ +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct MobileManualHostTrustPersistenceTests { + @Test func approvalThatWasNotPersistedPromptsAgainWithoutSendingCredentials() async { + let router = LivenessHostRouter() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory( + router: router, + box: TransportBox() + ), + now: { Date() }, + supportedRouteKinds: [.manualHost] + ) + let store = MobileShellComposite( + runtime: runtime, + isSignedIn: true, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults( + suiteName: "manual-host-refused-trust-\(UUID().uuidString)" + )!, + manualHostTrustStore: RefusingManualHostTrustStore() + ) + + let queued = await store.connectManualHost( + name: "LAN Mac", + host: "192.168.1.77", + port: 58_465 + ) + let resumed = await store.acceptManualHostTrustWarning() + + #expect(queued == .needsUserApproval) + #expect(resumed == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + #expect(await router.count(of: "mobile.attach_ticket.create") == 0) + #expect(await router.count(of: "workspace.list") == 0) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests+ConnectedReplacement.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests+ConnectedReplacement.swift new file mode 100644 index 000000000000..2d7738b2eee4 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests+ConnectedReplacement.swift @@ -0,0 +1,55 @@ +import Testing +@testable import CmuxMobileShell + +@MainActor +extension MobilePairingAttemptDeadlineTests { + @Test func failedPairingWhileConnectedReportsAttemptedRoute() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let runtime = PairingDeadlineRuntime() + let store = makeStore(runtime: runtime, connectionState: .connected) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + + let result = await store.connectPairingURLResult(try Self.pairingURL()) + + #expect(result == .failed) + #expect(store.connectionState == .connected) + #expect(store.connectionError?.contains("127.0.0.1") == true) + } + + @Test func authFailureDuringPairingWhileConnectedKeepsExistingConnection() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let runtime = PairingDeadlineRuntime( + transportFactory: AuthorizationFailingTransportFactory() + ) + let store = makeStore(runtime: runtime, connectionState: .connected) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + let originalClient = try #require(store.remoteClient) + + let result = await store.connectPairingURLResult(try Self.pairingURL()) + + #expect(result == .failed) + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + #expect(store.connectionRequiresReauth == false) + #expect(store.connectionError?.isEmpty == false) + } + + @Test func successfulPairingWhileConnectedStartsReplacementEventStream() async throws { + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + let store = try await makeConnectedStore(router: router, box: box, clock: clock) + await router.waitForCount(of: "mobile.events.subscribe", atLeast: 1) + let initialSubscribeCount = await router.count(of: "mobile.events.subscribe") + let ticket = try makeTicket(clock: clock) + + let result = await store.connectPairingURLResult(try attachURL(for: ticket)) + + #expect(result == .connected) + await router.waitForCount(of: "mobile.events.subscribe", atLeast: initialSubscribeCount + 1) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests+HostStatus.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests+HostStatus.swift new file mode 100644 index 000000000000..5e6100010d22 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests+HostStatus.swift @@ -0,0 +1,30 @@ +import CmuxMobileShellModel +import Testing +@testable import CmuxMobileShell + +@MainActor +extension MobilePairingAttemptDeadlineTests { + @Test func hostStatusUsesOnlyTheRemainingPairingAttemptBudget() async throws { + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + await router.setWorkspaceListResponseHook { + clock.advance(by: 2) + } + var runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: box), + now: { clock.now } + ) + runtime.pairingAttemptTimeoutNanoseconds = 1_000_000_000 + let store = makeStore(runtime: runtime) + + let result = await store.connectPairingURLResult( + try attachURL(for: makeTicket(clock: clock)) + ) + + #expect(result == .failed) + #expect(await router.count(of: "workspace.list") == 1) + #expect(await router.count(of: "mobile.host.status") == 0) + #expect(store.connectionState == .disconnected) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests.swift index 0203acd04ccd..a892f1027442 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingAttemptDeadlineTests.swift @@ -1,5 +1,6 @@ import CMUXMobileCore import CmuxMobileRPC +import CmuxMobileShellModel import Foundation import Testing @testable import CmuxMobileShell @@ -30,10 +31,10 @@ import Testing @Test func immediatePairingRetryDoesNotStartSecondStuckConnect() async throws { let transport = CountingSlowIgnoringCancellationTransport() let runtime = PairingDeadlineRuntime( - transportFactory: CountingSlowIgnoringCancellationTransportFactory(transport: transport) + transportFactory: CountingSlowIgnoringCancellationTransportFactory(transport: transport), + pairingAttemptTimeoutNanoseconds: 1_000_000_000 ) let store = makeStore(runtime: runtime) - let pairingURL = try Self.pairingURL() let first = await store.connectPairingURLResult(pairingURL) let second = await store.connectPairingURLResult(pairingURL) @@ -45,7 +46,6 @@ import Testing #expect(connectCount == 1) #expect(store.connectionState == .disconnected) } - @Test func mixedTrustedAndUntrustedRoutesStillConnectOverTrustedRoute() async throws { let clock = TestClock() let router = LivenessHostRouter() @@ -53,7 +53,7 @@ import Testing let runtime = LivenessTestRuntime( transportFactory: LivenessTransportFactory(router: router, box: box), now: { clock.now }, - supportedRouteKinds: [.debugLoopback, .tailscale] + supportedRouteKinds: [.debugLoopback, .manualHost] ) let store = makeStore(runtime: runtime) let trustedRoute = try CmxAttachRoute( @@ -62,10 +62,10 @@ import Testing endpoint: .hostPort(host: "127.0.0.1", port: 58_465), priority: 0 ) - let untrustedRoute = try CmxAttachRoute( - id: "b-public-fallback", - kind: .tailscale, - endpoint: .hostPort(host: "203.0.113.10", port: 58_465), + let manualFallbackRoute = try CmxAttachRoute( + id: "b-manual-fallback", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465), priority: 1 ) let ticket = try CmxAttachTicket( @@ -74,7 +74,7 @@ import Testing macDeviceID: "test-mac", macDisplayName: "Test Mac", macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, - routes: [trustedRoute, untrustedRoute], + routes: [trustedRoute, manualFallbackRoute], expiresAt: clock.now.addingTimeInterval(3600) ) @@ -82,34 +82,347 @@ import Testing #expect(result == .connected) #expect(store.connectionState == .connected) + #expect(store.manualHostTrustWarning == nil) #expect(store.selectedWorkspace?.id.rawValue == "live-workspace") } - @Test func hostStatusUsesOnlyTheRemainingPairingAttemptBudget() async throws { + @Test func manualFallbackPromptsOnlyAfterTrustedRouteFails() async throws { let clock = TestClock() let router = LivenessHostRouter() let box = TransportBox() - await router.setWorkspaceListResponseHook { - clock.advance(by: 2) - } - var runtime = LivenessTestRuntime( - transportFactory: LivenessTransportFactory(router: router, box: box), - now: { clock.now } + let attempts = RouteAttemptRecorder() + let runtime = LivenessTestRuntime( + transportFactory: ManualFallbackApprovalTransportFactory( + router: router, + box: box, + attempts: attempts, + failingRouteKind: .debugLoopback + ), + now: { clock.now }, + supportedRouteKinds: [.debugLoopback, .manualHost] ) - runtime.pairingAttemptTimeoutNanoseconds = 1_000_000_000 let store = makeStore(runtime: runtime) + let trustedRoute = try CmxAttachRoute( + id: "a-trusted-loopback", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: 58_465), + priority: 0 + ) + let manualFallbackRoute = try CmxAttachRoute( + id: "b-manual-fallback", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465), + priority: 1 + ) + let ticket = try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "test-mac", + macDisplayName: "Test Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [trustedRoute, manualFallbackRoute], + expiresAt: clock.now.addingTimeInterval(3600) + ) + + let result = await store.connectPairingURLResult(try attachURL(for: ticket)) + + #expect(result == .needsUserApproval) + #expect(store.connectionState != .connected) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + #expect(await router.count(of: "workspace.list") == 0) + #expect(attempts.count(.debugLoopback) == 1) + #expect(attempts.count(.manualHost) == 0) + + let approvedResult = await store.acceptManualHostTrustWarning() - let result = await store.connectPairingURLResult( - try attachURL(for: makeTicket(clock: clock)) + #expect(approvedResult == .connected) + #expect(store.connectionState == .connected) + #expect(store.manualHostTrustWarning == nil) + #expect(store.selectedWorkspace?.id.rawValue == "live-workspace") + #expect(attempts.count(.debugLoopback) == 1) + #expect(attempts.count(.manualHost) == 1) + #expect(await router.count(of: "workspace.list") >= 1) + } + + @Test func manualFallbackApprovalKeepsExistingConnectionUntilConsent() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let newRouter = LivenessHostRouter() + let newBox = TransportBox() + let runtime = LivenessTestRuntime( + transportFactory: ManualFallbackApprovalTransportFactory( + router: newRouter, + box: newBox, + failingRouteKind: .debugLoopback + ), + now: { clock.now }, + supportedRouteKinds: [.debugLoopback, .manualHost] + ) + let store = makeStore(runtime: runtime, connectionState: .connected) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + let originalClient = try #require(store.remoteClient) + let trustedRoute = try CmxAttachRoute( + id: "a-trusted-loopback", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: 58_465), + priority: 0 + ) + let manualFallbackRoute = try CmxAttachRoute( + id: "b-manual-fallback", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465), + priority: 1 + ) + let ticket = try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "test-mac", + macDisplayName: "Test Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [trustedRoute, manualFallbackRoute], + expiresAt: clock.now.addingTimeInterval(3600) ) - #expect(result == .failed) - #expect(await router.count(of: "workspace.list") == 1) - #expect(await router.count(of: "mobile.host.status") == 0) + let result = await store.connectPairingURLResult(try attachURL(for: ticket)) + + #expect(result == .needsUserApproval) + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + #expect(await newRouter.count(of: "workspace.list") == 0) + + store.cancelPairing() + + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + #expect(store.manualHostTrustWarning == nil) + } + + @Test func manualFallbackCancelClearsDisconnectedStagedContext() async throws { + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + let runtime = LivenessTestRuntime( + transportFactory: ManualFallbackApprovalTransportFactory( + router: router, + box: box, + failingRouteKind: .debugLoopback + ), + now: { clock.now }, + supportedRouteKinds: [.debugLoopback, .manualHost] + ) + let store = makeStore(runtime: runtime) + let trustedRoute = try CmxAttachRoute( + id: "a-trusted-loopback", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: 58_465), + priority: 0 + ) + let manualFallbackRoute = try CmxAttachRoute( + id: "b-manual-fallback", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465), + priority: 1 + ) + let ticket = try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "test-mac", + macDisplayName: "Test Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [trustedRoute, manualFallbackRoute], + expiresAt: clock.now.addingTimeInterval(3600), + authToken: "ticket-secret" + ) + + let result = await store.connectPairingURLResult(try attachURL(for: ticket)) + + #expect(result == .needsUserApproval) + #expect(store.connectionState == .disconnected) + #expect(store.activeTicket != nil) + #expect(store.activeRoute?.kind == .manualHost) + #expect(store.hasActiveUnexpiredAttachTicket) + + store.cancelPairing() + #expect(store.connectionState == .disconnected) + #expect(store.manualHostTrustWarning == nil) + #expect(store.activeTicket == nil) + #expect(store.activeRoute == nil) + #expect(!store.hasActiveUnexpiredAttachTicket) } - private static func pairingURL() throws -> String { + @Test func failedManualHostAttemptKeepsExistingConnection() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let runtime = PairingDeadlineRuntime() + let store = makeStore(runtime: runtime, connectionState: .connected) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + let originalClient = try #require(store.remoteClient) + + await store.connectManualHost(name: "Bad Route", host: "https://bad.example/path", port: 58_465) + + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + #expect(store.connectionError?.isEmpty == false) + } + + @Test func failedManualHostApprovalReportsFailureWhileKeepingExistingConnection() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let runtime = PairingDeadlineRuntime(supportedRouteKinds: [.manualHost]) + let store = makeStore(runtime: runtime, connectionState: .connected) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + let originalClient = try #require(store.remoteClient) + + await store.connectManualHost(name: "Bad LAN", host: "192.168.1.77", port: 58_465) + let result = await store.acceptManualHostTrustWarning() + + #expect(result == .failed) + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + #expect(store.connectionError?.isEmpty == false) + } + + @Test func staleManualHostApprovalDoesNotPersistTrustOrRequestTicket() async throws { + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: box), + now: { clock.now }, + supportedRouteKinds: [.manualHost] + ) + let trustStore = InMemoryMobileManualHostTrustStore() + let store = makeStore(runtime: runtime, manualHostTrustStore: trustStore) + var isCurrent = true + + let queued = await store.connectManualHost( + name: "Stale LAN", + host: "192.168.1.77", + port: 58_465, + recordsPairingAttempt: true, + ifStillCurrent: { isCurrent } + ) + + #expect(queued == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + + isCurrent = false + let approved = await store.acceptManualHostTrustWarning() + let route = try CmxAttachRoute( + id: "manual_host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465) + ) + let scope = try #require(MobileManualHostTrustScope(route: route, stackUserID: "test-user")) + + #expect(approved == .superseded) + #expect(store.manualHostTrustWarning == nil) + #expect(await trustStore.isTrusted(scope) == false) + #expect(await router.count(of: "mobile.attach_ticket.create") == 0) + } + @Test func staleManualHostApprovalLookupCannotReplaceCurrentPrompt() async throws { + let trustStore = BlockingManualHostTrustStore() + let store = makeStore( + runtime: PairingDeadlineRuntime(supportedRouteKinds: [.manualHost]), + manualHostTrustStore: trustStore + ) + + let first = Task { @MainActor in + await store.connectManualHost( + name: "Old LAN", + host: "192.168.1.77", + port: 58_465, + recordsPairingAttempt: true + ) + } + await trustStore.waitUntilFirstLookupIsBlocked() + + let second = await store.connectManualHost( + name: "New LAN", + host: "192.168.1.88", + port: 58_465, + recordsPairingAttempt: true + ) + + #expect(second == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.88:58465") + + await trustStore.releaseFirstLookup() + let firstResult = await first.value + + #expect(firstResult == .superseded) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.88:58465") + } + + @Test func stalePairingURLManualHostApprovalLookupCannotReplaceCurrentPrompt() async throws { + let trustStore = BlockingManualHostTrustStore() + let store = makeStore( + runtime: PairingDeadlineRuntime(supportedRouteKinds: [.manualHost]), + manualHostTrustStore: trustStore + ) + let firstURL = try attachURL(for: manualHostTicket(host: "192.168.1.77")) + let secondURL = try attachURL(for: manualHostTicket(host: "192.168.1.88")) + + let first = Task { @MainActor in + await store.connectPairingURLResult(firstURL) + } + await trustStore.waitUntilFirstLookupIsBlocked() + + let second = await store.connectPairingURLResult(secondURL) + + #expect(second == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.88:58465") + + await trustStore.releaseFirstLookup() + let firstResult = await first.value + + #expect(firstResult == .superseded) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.88:58465") + } + + @Test func cancelledPairingURLApprovalDoesNotPersistTrustOrConnect() async throws { + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: box), + now: { clock.now }, + supportedRouteKinds: [.manualHost] + ) + let trustStore = BlockingManualHostTrustPersistenceStore() + let store = makeStore(runtime: runtime, manualHostTrustStore: trustStore) + let route = try CmxAttachRoute( + id: "manual", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465) + ) + let scope = try #require(MobileManualHostTrustScope(route: route, stackUserID: "test-user")) + let url = try attachURL(for: manualHostTicket(host: "192.168.1.77")) + + let queued = await store.connectPairingURLResult(url) + #expect(queued == .needsUserApproval) + + let approval = Task { @MainActor in + await store.acceptManualHostTrustWarning() + } + await trustStore.waitUntilTrustIsBlocked() + approval.cancel() + store.cancelPairing() + await trustStore.releaseTrust() + let result = await approval.value + + #expect(result == .superseded) + #expect(store.manualHostTrustWarning == nil) + #expect(await trustStore.isTrusted(scope) == false) + #expect(await router.count(of: "workspace.list") == 0) + } + + static func pairingURL() throws -> String { let route = try CmxAttachRoute( id: "deadline-loopback", kind: .debugLoopback, @@ -126,16 +439,39 @@ import Testing )) } - private func makeStore( + private func manualHostTicket(host: String) throws -> CmxAttachTicket { + let route = try CmxAttachRoute( + id: "manual-\(host)", + kind: .manualHost, + endpoint: .hostPort(host: host, port: 58_465), + priority: 0 + ) + return try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "test-mac", + macDisplayName: "Test Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [route], + expiresAt: Date().addingTimeInterval(3600) + ) + } + + func makeStore( runtime: any MobileSyncRuntime = PairingDeadlineRuntime(), - pairingCode: String = "" + pairingCode: String = "", + connectionState: MobileConnectionState = .disconnected, + manualHostTrustStore: any MobileManualHostTrustStoring = InMemoryMobileManualHostTrustStore() ) -> MobileShellComposite { MobileShellComposite( runtime: runtime, isSignedIn: true, + connectionState: connectionState, pairingCode: pairingCode, + identityProvider: StaticIdentityProvider(userID: "test-user"), reachability: AlwaysOnlineReachability(), - pairingHintDefaults: UserDefaults(suiteName: "pairing-deadline-\(UUID().uuidString)")! + pairingHintDefaults: UserDefaults(suiteName: "pairing-deadline-\(UUID().uuidString)")!, + manualHostTrustStore: manualHostTrustStore ) } } diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingCancellationPreservesForegroundTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingCancellationPreservesForegroundTests.swift new file mode 100644 index 000000000000..a77e38efe20a --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobilePairingCancellationPreservesForegroundTests.swift @@ -0,0 +1,215 @@ +import CMUXMobileCore +import CmuxMobilePairedMac +import CmuxMobileRPC +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct MobilePairingCancellationPreservesForegroundTests { + @Test func cancelInFlightPairingKeepsExistingConnection() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let transport = CountingSlowIgnoringCancellationTransport() + let runtime = PairingDeadlineRuntime( + transportFactory: CountingSlowIgnoringCancellationTransportFactory(transport: transport), + pairingAttemptTimeoutNanoseconds: 30 * 1_000_000_000 + ) + let store = MobileShellComposite( + runtime: runtime, + isSignedIn: true, + connectionState: .connected, + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults(suiteName: "pairing-cancel-\(UUID().uuidString)")! + ) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + let originalClient = try #require(store.remoteClient) + + let pairingURL = try attachURL(for: makeTicket(clock: clock)) + let pairing = Task { @MainActor in + await store.connectPairingURLResult(pairingURL) + } + await transport.waitUntilConnectStarted() + store.cancelPairing() + await transport.releaseStuckConnects() + _ = await pairing.value + + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + } + + @Test func cancelPairingBeforeAuthorizedResponseKeepsExistingConnection() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let newRouter = LivenessHostRouter() + let newBox = TransportBox() + let tokenProvider = BlockingAccountSwitchTokenProvider() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: newRouter, box: newBox), + stackAccessTokenProvider: { try await tokenProvider.tokenIgnoringCancellation() }, + now: { clock.now }, + supportedRouteKinds: [.debugLoopback], + supportsServerPushEvents: false + ) + let store = makeConnectedStore(runtime: runtime) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + let originalClient = try #require(store.remoteClient) + + let pairingURL = try attachURL(for: makeTicket(clock: clock)) + let pairing = Task { @MainActor in + await store.connectPairingURLResult(pairingURL) + } + await tokenProvider.waitUntilRequested() + store.cancelPairing() + await tokenProvider.release(with: "authorized-token") + let result = await pairing.value + + #expect(result == .superseded) + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + } + + @Test func cancelPairingDuringPairedMacLookupDoesNotActivateCandidate() async throws { + let clock = TestClock() + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let newRouter = LivenessHostRouter() + let newBox = TransportBox() + let oldRoute = try CmxAttachRoute( + id: "old-loopback", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: 56_583) + ) + let pairedMacStore = DelayedTeamPairedMacStore( + recordsByTeam: [ + "team-a": [ + MobilePairedMac( + macDeviceID: "old-mac", + displayName: "Old Mac", + routes: [oldRoute], + createdAt: clock.now, + lastSeenAt: clock.now, + isActive: true, + stackUserID: "test-user", + teamID: "team-a" + ), + ], + ], + blockedTeams: ["team-a"] + ) + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: newRouter, box: newBox), + now: { clock.now }, + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + isSignedIn: true, + connectionState: .connected, + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "test-user"), + teamIDProvider: { "team-a" }, + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults(suiteName: "pairing-cancel-persistence-\(UUID().uuidString)")! + ) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + store.setWorkspaceStatesForTesting([:], foregroundMacDeviceID: "old-mac") + let originalClient = try #require(store.remoteClient) + let ticket = try makeTicket(clock: clock) + let url = try attachURL(for: ticket) + + let pairing = Task { @MainActor in + await store.connectPairingURLResult(url) + } + await pairedMacStore.waitUntilLoadStarted(teamID: "team-a") + store.cancelPairing() + await pairedMacStore.release(teamID: "team-a") + let result = await pairing.value + + #expect(result == .superseded) + #expect(await pairedMacStore.currentUpsertCount() == 0) + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + } + + @Test func cancelPairingDuringPairedMacUpsertKeepsPreviousMacActive() async throws { + let directory = FileManager.default.temporaryDirectory + .appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let innerStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let clock = TestClock() + let oldRoute = try CmxAttachRoute( + id: "old-loopback", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: 56_583) + ) + try await innerStore.upsert( + macDeviceID: "old-mac", + displayName: "Old Mac", + routes: [oldRoute], + markActive: true, + stackUserID: "test-user", + teamID: nil, + now: clock.now + ) + let gatedStore = GatedUpsertStore(inner: innerStore) + let oldRouter = LivenessHostRouter() + let oldBox = TransportBox() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory( + router: LivenessHostRouter(), + box: TransportBox() + ), + now: { clock.now }, + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + isSignedIn: true, + connectionState: .connected, + pairedMacStore: gatedStore, + identityProvider: StaticIdentityProvider(userID: "test-user"), + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults(suiteName: "pairing-cancel-upsert-\(UUID().uuidString)")! + ) + try installFreshLivenessRemoteClient(on: store, router: oldRouter, box: oldBox, clock: clock) + store.setWorkspaceStatesForTesting([:], foregroundMacDeviceID: "old-mac") + let originalClient = try #require(store.remoteClient) + let ticket = try makeTicket(clock: clock) + let url = try attachURL(for: ticket) + + let pairing = Task { @MainActor in + await store.connectPairingURLResult(url) + } + await gatedStore.waitUntilUpsertEntered() + store.cancelPairing() + await gatedStore.release() + let result = await pairing.value + let activeMac = try await gatedStore.activeMac( + stackUserID: "test-user", + teamID: nil + ) + + #expect(result == .superseded) + #expect(activeMac?.macDeviceID == "old-mac") + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) + } + + private func makeConnectedStore(runtime: any MobileSyncRuntime) -> MobileShellComposite { + MobileShellComposite( + runtime: runtime, + isSignedIn: true, + connectionState: .connected, + identityProvider: StaticIdentityProvider(userID: "test-user"), + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults(suiteName: "pairing-cancel-\(UUID().uuidString)")! + ) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileSecondaryInstanceAuthorityTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileSecondaryInstanceAuthorityTests.swift index 2320cd91c55b..3fa3ce730a23 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileSecondaryInstanceAuthorityTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileSecondaryInstanceAuthorityTests.swift @@ -53,7 +53,9 @@ import Testing runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) let shell = MobileShellComposite( runtime: runtime, @@ -138,7 +140,9 @@ import Testing runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) let shell = MobileShellComposite( runtime: runtime, @@ -234,7 +238,9 @@ import Testing runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) let shell = MobileShellComposite( runtime: runtime, diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellAuthScopeIsolationTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellAuthScopeIsolationTests.swift new file mode 100644 index 000000000000..920881d89642 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellAuthScopeIsolationTests.swift @@ -0,0 +1,204 @@ +import CMUXMobileCore +import CmuxMobilePairedMac +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct MobileShellAuthScopeIsolationTests { + @Test func manualHostApprovalFailsClosedWithoutConcreteAccount() async { + let store = MobileShellComposite( + runtime: PairingDeadlineRuntime(supportedRouteKinds: [.manualHost]), + isSignedIn: true, + identityProvider: StaticIdentityProvider(userID: nil), + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults(suiteName: "nil-auth-scope-\(UUID().uuidString)")! + ) + + let result = await store.connectManualHost( + name: "LAN Mac", + host: "192.168.1.77", + port: 58_465 + ) + + #expect(result == .failed) + #expect(store.manualHostTrustWarning == nil) + #expect(store.connectionRequiresReauth) + } + + @Test func accountSwitchDuringDirectSecondaryRefreshNeverSendsNewTokenToOldManualHost() async throws { + try await assertSessionChangeNeverSendsNewToken( + replacementUserID: "user-b", + replacementToken: "user-b-token" + ) + } + + @Test func sameAccountSignOutAndSignInInvalidatesOldSecondaryRefresh() async throws { + try await assertSessionChangeNeverSendsNewToken( + replacementUserID: "user-a", + replacementToken: "new-user-a-session-token" + ) + } + + @Test func authenticatedUserReplacementNeverSharesPreviousAccountsTokenTask() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent( + UUID().uuidString, + isDirectory: true + ) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let route = try CmxAttachRoute( + id: "shared-manual-host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465) + ) + try await pairedMacStore.upsert( + macDeviceID: "user-a-mac", + displayName: "User A Mac", + routes: [route], + markActive: false, + stackUserID: "user-a", + teamID: nil, + now: Date() + ) + let trustStore = SignalingManualHostTrustStore() + let userAScope = try #require( + MobileManualHostTrustScope(route: route, stackUserID: "user-a") + ) + let userBScope = try #require( + MobileManualHostTrustScope(route: route, stackUserID: "user-b") + ) + await trustStore.trust(userAScope) + await trustStore.trust(userBScope) + let tokenProvider = AccountReplacementTokenProvider() + let tokenSink = RecordedAuthTokenSink() + let router = LivenessHostRouter() + let runtime = LivenessTestRuntime( + transportFactory: RecordedAuthLivenessTransportFactory( + router: router, + tokenSink: tokenSink + ), + stackAccessTokenProvider: { try await tokenProvider.token() }, + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let identity = StaticIdentityProvider(userID: "user-a") + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: identity, + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults(suiteName: "replacement-pairing-\(UUID().uuidString)")!, + multiMacAggregationDefaults: UserDefaults(suiteName: "replacement-aggregation-\(UUID().uuidString)")!, + manualHostTrustStore: trustStore + ) + store.signIn() + + let oldAccountRefresh = Task { @MainActor in + await store.refreshSecondaryMacWorkspaces() + } + await tokenProvider.waitUntilRequestCount(1) + + identity.currentUserID = "user-b" + store.signIn() + let replacementConnect = Task { @MainActor in + await store.connectManualHost( + name: "User B Mac", + host: "192.168.1.77", + port: 58_465 + ) + } + await trustStore.waitUntilChecked(userBScope, count: 3) + for _ in 0..<1_000 { await Task.yield() } + + await tokenProvider.releaseRequest(1, with: "user-a-token") + for _ in 0..<1_000 { + if await tokenProvider.currentRequestCount() >= 2 { break } + if await tokenSink.recordedTokens().contains("user-a-token") { break } + await Task.yield() + } + #expect(await tokenProvider.currentRequestCount() == 2) + await tokenProvider.releaseRequest(2, with: "user-b-token") + _ = await replacementConnect.value + await oldAccountRefresh.value + + #expect(!(await tokenSink.recordedTokens().contains("user-a-token"))) + #expect(await tokenSink.recordedTokens().contains("user-b-token")) + } + + private func assertSessionChangeNeverSendsNewToken( + replacementUserID: String, + replacementToken: String + ) async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent( + UUID().uuidString, + isDirectory: true + ) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let route = try CmxAttachRoute( + id: "manual-host-a", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465) + ) + try await pairedMacStore.upsert( + macDeviceID: "user-a-mac", + displayName: "User A Mac", + routes: [route], + markActive: false, + stackUserID: "user-a", + teamID: nil, + now: Date() + ) + let trustStore = InMemoryMobileManualHostTrustStore() + let trustScope = try #require(MobileManualHostTrustScope(route: route, stackUserID: "user-a")) + await trustStore.trust(trustScope) + let tokenProvider = BlockingAccountSwitchTokenProvider() + let tokenSink = RecordedAuthTokenSink() + let router = LivenessHostRouter() + let runtime = LivenessTestRuntime( + transportFactory: RecordedAuthLivenessTransportFactory( + router: router, + tokenSink: tokenSink + ), + stackAccessTokenProvider: { try await tokenProvider.tokenIgnoringCancellation() }, + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let identity = StaticIdentityProvider(userID: "user-a") + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: identity, + reachability: AlwaysOnlineReachability(), + pairingHintDefaults: UserDefaults(suiteName: "auth-scope-pairing-\(UUID().uuidString)")!, + multiMacAggregationDefaults: UserDefaults(suiteName: "auth-scope-aggregation-\(UUID().uuidString)")!, + manualHostTrustStore: trustStore + ) + store.signIn() + + let refresh = Task { @MainActor in + await store.refreshSecondaryMacWorkspaces() + } + await tokenProvider.waitUntilRequested() + store.signOut() + identity.currentUserID = replacementUserID + store.signIn() + await tokenProvider.release(with: replacementToken) + await refresh.value + + #expect(await tokenSink.recordedTokens().isEmpty) + #expect(store.secondaryMacSubscriptions["user-a-mac"] == nil) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellComposite+TestState.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellComposite+TestState.swift new file mode 100644 index 000000000000..5fd0b89eec0e --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellComposite+TestState.swift @@ -0,0 +1,16 @@ +import CmuxMobileShellModel +@testable import CmuxMobileShell + +@MainActor +extension MobileShellComposite { + func setWorkspaceStatesForTesting( + _ states: [String: MacWorkspaceState], + foregroundMacDeviceID: String? + ) { + self.foregroundMacDeviceID = foregroundMacDeviceID + workspacesByMac = states + } + + func foregroundMacDeviceIDForTesting() -> String? { foregroundMacDeviceID } + func storedMacReconnectGenerationForTesting() -> Int { storedMacReconnectGeneration } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePairedMacCoalescingTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePairedMacCoalescingTests.swift index 409cad4019d3..74d796b63022 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePairedMacCoalescingTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePairedMacCoalescingTests.swift @@ -163,7 +163,13 @@ import Testing lastSeenAt: 1_000, routes: [freshRoute] )), - scope: MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + scope: MobileShellScopeSnapshot( + userID: "user-1", + teamID: "team-a", + generation: 0, + signInGeneration: store.currentSessionGeneration, + rpcAuthContext: store.currentRPCAuthContext() + ) ) await pairedStore.waitUntilUpsertCount(1) @@ -267,7 +273,13 @@ import Testing lastSeenAt: 1_000, routes: [freshRoute] )), - scope: MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + scope: MobileShellScopeSnapshot( + userID: "user-1", + teamID: "team-a", + generation: 0, + signInGeneration: store.currentSessionGeneration, + rpcAuthContext: store.currentRPCAuthContext() + ) ) await pairedStore.waitUntilUpsertStarted(macDeviceID: "mac-a") await store.forgetMac(macDeviceID: "mac-a") @@ -364,7 +376,13 @@ import Testing ), ] )), - scope: MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + scope: MobileShellScopeSnapshot( + userID: "user-1", + teamID: "team-a", + generation: 0, + signInGeneration: store.currentSessionGeneration, + rpcAuthContext: store.currentRPCAuthContext() + ) ) await store.pushedRouteSyncTask?.value diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePreviewTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePreviewTests.swift index 72d0640c3afd..732b730d8715 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePreviewTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellCompositePreviewTests.swift @@ -87,7 +87,9 @@ import Testing runtime: PairingDeadlineRuntime(), route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) store.recoverMobileConnection(trigger: .networkChange) @@ -551,7 +553,7 @@ import Testing port: CmxMobileDefaults.defaultHostPort ) - let route = MobileShellComposite.firstReconnectHostPortRoute( + let route = MobileShellRouteSelection().firstReconnectHostPortRoute( [loopback, tailscale], supportedKinds: [.tailscale] ) diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostAuthorizationOwnershipTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostAuthorizationOwnershipTests.swift new file mode 100644 index 000000000000..2ff841eb30db --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostAuthorizationOwnershipTests.swift @@ -0,0 +1,354 @@ +import CMUXMobileCore +import CmuxMobileRPC +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct MobileShellManualHostAuthorizationOwnershipTests { + @Test func expiredActiveManualTrustQueuesReapprovalWithoutAnotherRPC() async throws { + let trustStore = ImmediateExpiryManualHostTrustStore() + let router = LivenessHostRouter() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: trustStore + ) + store.signIn() + + let connected = await store.connectManualHost( + name: "Expiring LAN Mac", + host: "192.168.1.77", + port: 58_465 + ) + let reapprovalQueued = try await pollUntil(attempts: 50) { + store.manualHostTrustWarning != nil + } + + #expect(connected == .connected) + #expect(reapprovalQueued) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + #expect(store.connectionState == .disconnected) + #expect(store.remoteClient == nil) + } + + @Test func revokedForegroundTrustQueuesHostApprovalWithoutAccountReauth() async throws { + let route = try hostPortRoute(kind: .manualHost, host: "192.168.1.77", port: 58_465) + let trustStore = InMemoryMobileManualHostTrustStore() + let router = LivenessHostRouter() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: trustStore + ) + store.signIn() + + let queued = await store.connectManualHost( + name: "Studio Mac", + host: "192.168.1.77", + port: 58_465 + ) + let connected = await store.acceptManualHostTrustWarning() + #expect(queued == .needsUserApproval) + #expect(connected == .connected) + #expect(store.activeRoute?.kind == route.kind) + + let secondaryRoute = try hostPortRoute( + kind: .debugLoopback, + host: "127.0.0.1", + port: 56_585 + ) + let secondaryTicket = try ticket( + route: secondaryRoute, + macDeviceID: "secondary-mac", + authToken: "secondary-ticket" + ) + let secondaryClient = MobileCoreRPCClient( + runtime: runtime, + route: secondaryRoute, + ticket: secondaryTicket, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } + ) + let secondarySubscription = SecondaryMacSubscription( + macDeviceID: "secondary-mac", + client: secondaryClient, + route: secondaryRoute, + ticket: secondaryTicket, + supportedHostCapabilities: [], + actionCapabilities: MobileWorkspaceActionCapabilities() + ) + store.secondaryMacSubscriptions["secondary-mac"] = secondarySubscription + + await trustStore.removeAll() + store.terminalInputText = "pwd" + await store.submitTerminalInput() + + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + #expect(!store.connectionRequiresReauth) + #expect(store.connectionState == .disconnected) + #expect(store.secondaryMacSubscriptions["secondary-mac"] === secondarySubscription) + + let reconnected = await store.acceptManualHostTrustWarning() + #expect(reconnected == .connected) + #expect(!store.connectionRequiresReauth) + } + + @Test func secondaryTrustFailureDoesNotDisconnectForegroundConnection() async throws { + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "foreground-mac", instanceTag: nil, displayName: "Foreground Mac") + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.debugLoopback, .manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite.preview(runtime: runtime) + store.signIn() + let foregroundRoute = try hostPortRoute( + kind: .debugLoopback, + host: "127.0.0.1", + port: 56_584 + ) + let foregroundTicket = try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "foreground-mac", + macDisplayName: "Foreground Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [foregroundRoute], + expiresAt: Date().addingTimeInterval(3_600), + authToken: "foreground-ticket" + ) + #expect(await store.connectPairingURL(try attachURL(for: foregroundTicket))) + let foregroundClient = try #require(store.remoteClient) + + let secondaryRoute = try hostPortRoute( + kind: .manualHost, + host: "192.168.1.88", + port: 58_465 + ) + let secondaryTicket = try CmxAttachTicket( + workspaceID: "", + terminalID: nil, + macDeviceID: "secondary-mac", + macDisplayName: "Secondary Mac", + routes: [secondaryRoute], + expiresAt: Date().addingTimeInterval(3_600) + ) + let secondaryClient = MobileCoreRPCClient( + runtime: runtime, + route: secondaryRoute, + ticket: secondaryTicket, + allowsStackAuthFallback: true, + manualHostStackAuthTrustProvider: { false }, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } + ) + let actionCapabilities = MobileWorkspaceActionCapabilities(supportsWorkspaceActions: true) + store.secondaryMacSubscriptions["secondary-mac"] = SecondaryMacSubscription( + macDeviceID: "secondary-mac", + client: secondaryClient, + route: secondaryRoute, + ticket: secondaryTicket, + supportedHostCapabilities: ["workspace.actions.v1"], + actionCapabilities: actionCapabilities + ) + let foregroundWorkspace = MobileWorkspacePreview( + id: "live-workspace", + macDeviceID: "foreground-mac", + name: "Foreground Workspace", + terminals: [] + ) + let secondaryWorkspace = MobileWorkspacePreview( + id: "secondary-workspace", + macDeviceID: "secondary-mac", + name: "Secondary Workspace", + terminals: [] + ) + store.setWorkspaceStatesForTesting([ + "foreground-mac": MacWorkspaceState( + macDeviceID: "foreground-mac", + workspaces: [foregroundWorkspace], + status: .connected + ), + "secondary-mac": MacWorkspaceState( + macDeviceID: "secondary-mac", + workspaces: [secondaryWorkspace], + status: .connected, + actionCapabilities: actionCapabilities + ), + ], foregroundMacDeviceID: "foreground-mac") + let secondaryRowID = try #require( + store.workspaces.first(where: { $0.macDeviceID == "secondary-mac" })?.id + ) + + let result = await store.renameWorkspace(id: secondaryRowID, title: "Renamed") + + guard case .failure(.authorizationFailed) = result else { + Issue.record("Expected the secondary mutation to report authorization failure") + return + } + #expect(store.connectionState == .connected) + #expect(store.remoteClient === foregroundClient) + #expect(store.connectedMacDeviceID == "foreground-mac") + #expect(!store.connectionRequiresReauth) + #expect(store.secondaryMacSubscriptions["secondary-mac"] == nil) + } + + @Test func staleForegroundAuthorizationFailureDoesNotDisconnectReplacementClient() async throws { + let oldRouter = LivenessHostRouter() + await oldRouter.setHostIdentity(deviceID: "old-mac", instanceTag: nil, displayName: "Old Mac") + let failureGate = HeldAuthorizationFailureGate() + let oldRuntime = LivenessTestRuntime( + transportFactory: HeldAuthorizationFailureTransportFactory( + method: "workspace.action", + gate: failureGate, + router: oldRouter + ), + now: { Date() }, + supportedRouteKinds: [.debugLoopback], + supportsServerPushEvents: false + ) + let oldRoute = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: 56_584) + let newRoute = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: 56_585) + let oldTicket = try ticket(route: oldRoute, macDeviceID: "old-mac", authToken: "old-ticket") + let newTicket = try ticket(route: newRoute, macDeviceID: "new-mac", authToken: "new-ticket") + let newClient = MobileCoreRPCClient( + runtime: oldRuntime, + route: newRoute, + ticket: newTicket, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } + ) + let store = MobileShellComposite.preview(runtime: oldRuntime) + store.signIn() + #expect(await store.connectPairingURL(try attachURL(for: oldTicket))) + let capabilities = MobileWorkspaceActionCapabilities(supportsWorkspaceActions: true) + let workspace = MobileWorkspacePreview( + id: "old-workspace", + macDeviceID: "old-mac", + name: "Old Workspace", + terminals: [] + ) + store.setWorkspaceStatesForTesting([ + "old-mac": MacWorkspaceState( + macDeviceID: "old-mac", + workspaces: [workspace], + status: .connected, + actionCapabilities: capabilities + ), + ], foregroundMacDeviceID: "old-mac") + let rowID = try #require(store.workspaces.first?.id) + let rename = Task { @MainActor in + await store.renameWorkspace(id: rowID, title: "Renamed") + } + await failureGate.waitUntilReached() + store.remoteClient = newClient + store.setWorkspaceStatesForTesting([:], foregroundMacDeviceID: "new-mac") + await failureGate.release() + _ = await rename.value + + #expect(store.connectionState == .connected) + #expect(store.remoteClient === newClient) + #expect(store.foregroundMacDeviceIDForTesting() == "new-mac") + #expect(store.manualHostTrustWarning == nil) + #expect(!store.connectionRequiresReauth) + } + + @Test func staleForegroundAuthorizationFailureDoesNotDisconnectNewConnectionGeneration() async throws { + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "foreground-mac", instanceTag: nil, displayName: "Foreground Mac") + let failureGate = HeldAuthorizationFailureGate() + let runtime = LivenessTestRuntime( + transportFactory: HeldAuthorizationFailureTransportFactory( + method: "workspace.action", + gate: failureGate, + router: router + ), + now: { Date() }, + supportedRouteKinds: [.debugLoopback], + supportsServerPushEvents: false + ) + let route = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: 56_584) + let attachTicket = try ticket(route: route, macDeviceID: "foreground-mac", authToken: "ticket") + let store = MobileShellComposite.preview(runtime: runtime) + store.signIn() + #expect(await store.connectPairingURL(try attachURL(for: attachTicket))) + let client = try #require(store.remoteClient) + let capabilities = MobileWorkspaceActionCapabilities(supportsWorkspaceActions: true) + let workspace = MobileWorkspacePreview( + id: "workspace", + macDeviceID: "foreground-mac", + name: "Workspace", + terminals: [] + ) + store.setWorkspaceStatesForTesting([ + "foreground-mac": MacWorkspaceState( + macDeviceID: "foreground-mac", + workspaces: [workspace], + status: .connected, + actionCapabilities: capabilities + ), + ], foregroundMacDeviceID: "foreground-mac") + let rowID = try #require(store.workspaces.first?.id) + let rename = Task { @MainActor in + await store.renameWorkspace(id: rowID, title: "Renamed") + } + await failureGate.waitUntilReached() + store.connectionGeneration = UUID() + await failureGate.release() + _ = await rename.value + + #expect(store.connectionState == .connected) + #expect(store.remoteClient === client) + #expect(store.foregroundMacDeviceIDForTesting() == "foreground-mac") + #expect(!store.connectionRequiresReauth) + } + + private func ticket( + route: CmxAttachRoute, + macDeviceID: String, + authToken: String + ) throws -> CmxAttachTicket { + try CmxAttachTicket( + workspaceID: "", + terminalID: nil, + macDeviceID: macDeviceID, + macDisplayName: macDeviceID, + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [route], + expiresAt: Date().addingTimeInterval(3_600), + authToken: authToken + ) + } + + private func hostPortRoute( + kind: CmxAttachTransportKind, + host: String, + port: Int + ) throws -> CmxAttachRoute { + try CmxAttachRoute( + id: "\(kind.rawValue)-\(host)-\(port)", + kind: kind, + endpoint: .hostPort(host: host, port: port) + ) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostNetworkEpochTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostNetworkEpochTests.swift new file mode 100644 index 000000000000..72a0764cc420 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostNetworkEpochTests.swift @@ -0,0 +1,346 @@ +import CMUXMobileCore +import CmuxMobileRPC +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct MobileShellManualHostNetworkEpochTests { + @Test func networkBoundaryRevokesSecondaryManualHostWithoutDroppingSecureForeground() async throws { + let reachability = ControllablePathChangeReachability() + let trustStore = NetworkEpochManualHostTrustStore() + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "foreground-mac", instanceTag: nil, displayName: "Foreground Mac") + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.debugLoopback, .manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: reachability, + manualHostTrustStore: trustStore + ) + store.signIn() + let foregroundRoute = try CmxAttachRoute( + id: "secure-foreground", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: 56_584) + ) + let foregroundTicket = try CmxAttachTicket( + workspaceID: "foreground-workspace", + terminalID: "foreground-terminal", + macDeviceID: "foreground-mac", + macDisplayName: "Foreground Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [foregroundRoute], + expiresAt: Date().addingTimeInterval(3_600), + authToken: "foreground-ticket" + ) + #expect(await store.connectPairingURL(try attachURL(for: foregroundTicket))) + let foregroundClient = try #require(store.remoteClient) + let secondaryRoute = try CmxAttachRoute( + id: "manual-secondary", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.88", port: 58_465) + ) + let secondaryTicket = try CmxAttachTicket( + workspaceID: "secondary-workspace", + terminalID: nil, + macDeviceID: "secondary-mac", + macDisplayName: "Secondary Mac", + routes: [secondaryRoute], + expiresAt: Date().addingTimeInterval(3_600) + ) + let secondaryClient = MobileCoreRPCClient( + runtime: runtime, + route: secondaryRoute, + ticket: secondaryTicket, + allowsStackAuthFallback: true, + manualHostStackAuthTrustProvider: { true }, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } + ) + store.secondaryMacSubscriptions["secondary-mac"] = SecondaryMacSubscription( + macDeviceID: "secondary-mac", + client: secondaryClient, + route: secondaryRoute, + ticket: secondaryTicket, + supportedHostCapabilities: [], + actionCapabilities: .none + ) + store.setWorkspaceStatesForTesting([ + "foreground-mac": MacWorkspaceState( + macDeviceID: "foreground-mac", + workspaces: [], + status: .connected + ), + "secondary-mac": MacWorkspaceState( + macDeviceID: "secondary-mac", + workspaces: [], + status: .connected + ), + ], foregroundMacDeviceID: "foreground-mac") + store.startObservingNetworkPathChanges() + + reachability.emitPathChange() + await trustStore.waitUntilRemoved() + + #expect(store.remoteClient === foregroundClient) + #expect(store.connectionState == .connected) + #expect(store.secondaryMacSubscriptions["secondary-mac"] == nil) + #expect(store.workspacesByMac["secondary-mac"]?.status == .unavailable) + } + + @Test func repeatedBoundaryWhileTrustResetIsPendingDoesNotRestartReset() async { + let trustStore = BlockingNetworkEpochTrustStore() + let store = MobileShellComposite( + identityProvider: StaticIdentityProvider(userID: "phone-user"), + manualHostTrustStore: trustStore + ) + store.signIn() + + store.invalidateManualHostTrustForNetworkBoundary() + await trustStore.waitUntilRemoveCount(1) + store.invalidateManualHostTrustForNetworkBoundary() + + #expect(store.manualHostTrustResetGeneration == 1) + #expect(await trustStore.currentRemoveCount() == 1) + await trustStore.releaseRemovals() + } + + @Test func secondBoundarySupersedesApprovalWaitingForTrustReset() async throws { + let trustStore = BlockingNetworkEpochTrustStore() + let store = MobileShellComposite( + identityProvider: StaticIdentityProvider(userID: "phone-user"), + manualHostTrustStore: trustStore + ) + store.signIn() + store.invalidateManualHostTrustForNetworkBoundary() + await trustStore.waitUntilRemoveCount(1) + let route = try CmxAttachRoute( + id: "waiting-manual-host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465) + ) + let firstAttemptID = store.beginPairingValidationAttempt() + store.queueManualHostTrustWarning( + route: route, + displayHost: "192.168.1.77", + pending: .manual( + attemptID: firstAttemptID, + name: "LAN Mac", + host: "192.168.1.77", + port: 58_465, + route: route, + pairedMacDeviceID: "manual-mac", + instanceTagExpectation: .adopt, + recordsPairingAttempt: false, + macSwitchAttemptID: nil, + ifStillCurrent: nil + ) + ) + let firstAuthScope = store.manualHostRPCAuthScope + let (approvalStarted, approvalStartedContinuation) = + AsyncStream.makeStream(bufferingPolicy: .bufferingNewest(1)) + var approvalStartedIterator = approvalStarted.makeAsyncIterator() + let approval = Task { @MainActor in + approvalStartedContinuation.yield(()) + return await store.acceptManualHostTrustWarning() + } + _ = await approvalStartedIterator.next() + + store.invalidateManualHostTrustForNetworkBoundary() + let reissuedAttemptID = store.pendingManualHostTrust?.attemptID + + #expect(store.manualHostRPCAuthScope != firstAuthScope) + #expect(reissuedAttemptID != nil) + #expect(reissuedAttemptID != firstAttemptID) + #expect(await trustStore.currentRemoveCount() == 1) + await trustStore.releaseRemovals() + let result = await approval.value + + #expect(result == .superseded) + #expect(await trustStore.currentTrustCount() == 0) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + store.cancelPairing() + } + + @Test func foregroundResumeDisconnectsActiveManualHostWithoutAPathEvent() async throws { + let reachability = ControllablePathChangeReachability() + let trustStore = NetworkEpochManualHostTrustStore() + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "manual-mac", instanceTag: nil, displayName: "LAN Mac") + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let route = try CmxAttachRoute( + id: "foreground-resume-manual-host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465) + ) + let trustScope = try #require( + MobileManualHostTrustScope(route: route, stackUserID: "phone-user") + ) + await trustStore.trust(trustScope) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: reachability, + manualHostTrustStore: trustStore + ) + store.signIn() + let ticket = try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "manual-mac", + macDisplayName: "LAN Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [route], + expiresAt: Date().addingTimeInterval(3_600), + authToken: "manual-ticket" + ) + #expect(await store.connectPairingURL(try attachURL(for: ticket))) + #expect(store.connectionState == .connected) + + store.suspendForegroundRefresh() + store.resumeForegroundRefresh() + + try #require(store.connectionState == .disconnected) + #expect(store.remoteClient == nil) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + await trustStore.waitUntilRemoved() + #expect(await trustStore.isTrusted(trustScope) == false) + } + + @Test func pathChangeDisconnectsActiveManualHostAndQueuesExactRouteForReapproval() async throws { + let reachability = ControllablePathChangeReachability() + let trustStore = NetworkEpochManualHostTrustStore() + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "manual-mac", instanceTag: nil, displayName: "LAN Mac") + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let route = try CmxAttachRoute( + id: "active-manual-host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 58_465) + ) + let trustScope = try #require( + MobileManualHostTrustScope(route: route, stackUserID: "phone-user") + ) + await trustStore.trust(trustScope) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: reachability, + manualHostTrustStore: trustStore + ) + store.signIn() + let ticket = try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "manual-mac", + macDisplayName: "LAN Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [route], + expiresAt: Date().addingTimeInterval(3_600), + authToken: "manual-ticket" + ) + #expect(await store.connectPairingURL(try attachURL(for: ticket))) + #expect(store.connectionState == .connected) + #expect(store.remoteClient != nil) + store.startObservingNetworkPathChanges() + + reachability.emitPathChange() + await trustStore.waitUntilRemoved() + + #expect(store.connectionState == .disconnected) + #expect(store.remoteClient == nil) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + #expect(await trustStore.isTrusted(trustScope) == false) + + let resumed = await store.acceptManualHostTrustWarning() + + #expect(resumed == .connected) + #expect(store.connectionState == .connected) + #expect(store.remoteClient != nil) + } + + @Test func pathChangeSupersedesPendingManualHostApprovalWithoutTouchingForeground() async throws { + let reachability = ControllablePathChangeReachability() + let trustStore = NetworkEpochManualHostTrustStore() + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "foreground-mac", instanceTag: nil, displayName: "Foreground Mac") + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.debugLoopback, .manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: reachability, + manualHostTrustStore: trustStore + ) + store.signIn() + let foregroundRoute = try CmxAttachRoute( + id: "foreground", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: 56_584) + ) + let foregroundTicket = try CmxAttachTicket( + workspaceID: "live-workspace", + terminalID: "live-terminal", + macDeviceID: "foreground-mac", + macDisplayName: "Foreground Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [foregroundRoute], + expiresAt: Date().addingTimeInterval(3_600), + authToken: "foreground-ticket" + ) + #expect(await store.connectPairingURL(try attachURL(for: foregroundTicket))) + let foregroundClient = try #require(store.remoteClient) + let queued = await store.connectManualHost( + name: "LAN Mac", + host: "192.168.1.77", + port: 58_465 + ) + let scope = try #require(MobileManualHostTrustScope( + host: "192.168.1.77", + port: 58_465, + stackUserID: "phone-user" + )) + #expect(queued == .needsUserApproval) + store.startObservingNetworkPathChanges() + + reachability.emitPathChange() + await trustStore.waitUntilRemoved() + let result = await store.acceptManualHostTrustWarning() + + #expect(result == .superseded) + #expect(store.manualHostTrustWarning == nil) + #expect(await trustStore.isTrusted(scope) == false) + #expect(await router.count(of: "mobile.attach_ticket.create") == 0) + #expect(store.connectionState == .connected) + #expect(store.remoteClient === foregroundClient) + + store.terminalInputText = "pwd" + await store.submitTerminalInput() + #expect(await router.count(of: "terminal.input") == 1) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostReconnectTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostReconnectTests.swift new file mode 100644 index 000000000000..a73c0d391dca --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellManualHostReconnectTests.swift @@ -0,0 +1,449 @@ +import CMUXMobileCore +import CmuxMobilePairedMac +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct MobileShellManualHostReconnectTests { + @Test(arguments: ["100.64.0.5", "copied-manual.tailnet.ts.net"]) + func tailscaleLookingManualEntryStillRequiresApproval(host: String) async { + let router = LivenessHostRouter() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.manualHost, .tailscale], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + store.signIn() + + let result = await store.connectManualHost( + name: "Copied Manual Mac", + host: host, + port: CmxMobileDefaults.defaultHostPort + ) + + #expect(result == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "\(host):58465") + #expect(await router.count(of: "mobile.attach_ticket.create") == 0) + #expect(await router.count(of: "workspace.list") == 0) + } + + @Test func activeManualHostReconnectWaitsForApprovalInsteadOfSwitchingMacs() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let manualRoute = try hostPortRoute(kind: .manualHost, host: "192.168.1.77") + let trustedRoute = try hostPortRoute(kind: .tailscale, host: "100.64.0.5") + let now = Date() + try await pairedMacStore.upsert( + macDeviceID: "manual-mac", + displayName: "Manual Mac", + routes: [manualRoute], + markActive: true, + stackUserID: "phone-user", + teamID: nil, + now: now.addingTimeInterval(-10) + ) + try await pairedMacStore.upsert( + macDeviceID: "trusted-mac", + displayName: "Trusted Mac", + routes: [trustedRoute], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: now + ) + let clock = TestClock() + let runtime = LivenessTestRuntime( + transportFactory: AttachTicketReconnectTransport(ticketRoute: trustedRoute), + now: { clock.now }, + supportedRouteKinds: [.manualHost, .tailscale], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + + store.signIn() + let connected = await store.reconnectActiveMacIfAvailable(stackUserID: "phone-user") + + #expect(!connected) + #expect(store.connectionState == .disconnected) + #expect(store.connectedMacDeviceID == nil) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:58465") + } + + @Test func switchToManualHostMacResumesAfterApproval() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let manualRoute = try hostPortRoute(kind: .manualHost, host: "192.168.89.1") + try await pairedMacStore.upsert( + macDeviceID: "manual-mac", + displayName: "Manual Mac", + routes: [manualRoute], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let clock = TestClock() + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "manual-mac", instanceTag: nil, displayName: "Manual Mac") + let box = TransportBox() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: box), + now: { clock.now }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + store.signIn() + await store.loadPairedMacs() + + let switched = await store.switchToMac(macDeviceID: "manual-mac") + + #expect(!switched) + #expect(store.isMacSwitchInFlight) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.89.1:58465") + #expect(await router.count(of: "mobile.attach_ticket.create") == 0) + #expect(await router.count(of: "workspace.list") == 0) + + let approved = await store.acceptManualHostTrustWarning() + + #expect(approved == .connected) + #expect(!store.isMacSwitchInFlight) + #expect(store.connectionState == .connected) + #expect(store.manualHostTrustWarning == nil) + #expect(await router.count(of: "mobile.attach_ticket.create") == 1) + #expect(await router.count(of: "workspace.list") >= 1) + } + + @Test func workspaceOpenWaitsForManualHostApprovalAndResumesTheOriginalSelection() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let manualRoute = try hostPortRoute(kind: .manualHost, host: "192.168.89.2") + try await pairedMacStore.upsert( + macDeviceID: "manual-mac", + displayName: "Manual Mac", + routes: [manualRoute], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let clock = TestClock() + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "manual-mac", instanceTag: nil, displayName: "Manual Mac") + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: TransportBox()), + now: { clock.now }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + store.signIn() + await store.loadPairedMacs() + store.setWorkspaceStatesForTesting([ + "manual-mac": MacWorkspaceState( + macDeviceID: "manual-mac", + displayName: "Manual Mac", + workspaces: [ + MobileWorkspacePreview( + id: "live-workspace", + macDeviceID: "manual-mac", + name: "Requested Workspace", + terminals: [] + ), + ], + status: .connected + ), + ], foregroundMacDeviceID: "other-mac") + let requestedWorkspaceID = try #require(store.workspaces.first?.id) + store.selectedWorkspaceID = requestedWorkspaceID + + await store.openWorkspace(requestedWorkspaceID) + + #expect(store.manualHostTrustWarning?.endpoint == "192.168.89.2:58465") + #expect(store.selectedWorkspaceID == requestedWorkspaceID) + + let approved = await store.acceptManualHostTrustWarning() + + #expect(approved == .connected) + #expect(store.selectedWorkspace?.rpcWorkspaceID == "live-workspace") + } + + @Test func newPairingURLSupersedesPendingManualHostSwitchApproval() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let manualRoute = try hostPortRoute(kind: .manualHost, host: "192.168.89.1") + try await pairedMacStore.upsert( + macDeviceID: "manual-mac", + displayName: "Manual Mac", + routes: [manualRoute], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: LivenessHostRouter(), box: TransportBox()), + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + store.signIn() + await store.loadPairedMacs() + + let switched = await store.switchToMac(macDeviceID: "manual-mac") + let supersedingResult = await store.connectPairingURLResult("not a cmux pairing url") + + #expect(!switched) + #expect(supersedingResult == .failed) + #expect(store.manualHostTrustWarning == nil) + #expect(!store.isMacSwitchInFlight) + } + + @Test func tailscaleLookingStoredManualHostStillRequiresApprovalBeforeReconnect() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let manualRoute = try hostPortRoute(kind: .manualHost, host: "100.64.0.5") + try await pairedMacStore.upsert( + macDeviceID: "manual-mac", + displayName: "Manual Mac", + routes: [manualRoute], + markActive: true, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + let runtime = LivenessTestRuntime( + transportFactory: LivenessTransportFactory(router: router, box: box), + now: { clock.now }, + supportedRouteKinds: [.manualHost, .tailscale], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + + store.signIn() + let connected = await store.reconnectActiveMacIfAvailable(stackUserID: "phone-user") + + #expect(!connected) + #expect(store.manualHostTrustWarning?.endpoint == "100.64.0.5:58465") + #expect(await router.count(of: "mobile.attach_ticket.create") == 0) + #expect(await router.count(of: "workspace.list") == 0) + } + + @Test func approvedTailscaleLookingStoredManualHostKeepsManualRouteKind() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let manualRoute = try hostPortRoute(kind: .manualHost, host: "100.64.0.5") + try await pairedMacStore.upsert( + macDeviceID: "manual-mac", + displayName: "Manual Mac", + routes: [manualRoute], + markActive: true, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + let attempts = RouteAttemptRecorder() + await router.setHostIdentity(deviceID: "manual-mac", instanceTag: nil, displayName: "Manual Mac") + let runtime = LivenessTestRuntime( + transportFactory: ManualFallbackApprovalTransportFactory(router: router, box: box, attempts: attempts), + now: { clock.now }, + supportedRouteKinds: [.manualHost, .tailscale], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + + store.signIn() + let queued = await store.reconnectActiveMacIfAvailable(stackUserID: "phone-user") + + #expect(!queued) + #expect(store.manualHostTrustWarning?.endpoint == "100.64.0.5:58465") + #expect(attempts.count(.manualHost) == 0) + #expect(attempts.count(.tailscale) == 0) + + let approved = await store.acceptManualHostTrustWarning() + + #expect(approved == .connected) + #expect(store.activeRoute?.kind == .manualHost) + #expect(attempts.count(.manualHost) >= 1) + #expect(attempts.count(.tailscale) == 0) + } + + @Test func failedRegistryConnectDoesNotAcceptExistingConnectionAtSameEndpoint() async throws { + let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let oldRoute = try CmxAttachRoute( + id: "old-route", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: CmxMobileDefaults.defaultHostPort) + ) + let targetRoute = try CmxAttachRoute( + id: "target-route", + kind: .debugLoopback, + endpoint: .hostPort(host: "127.0.0.1", port: CmxMobileDefaults.defaultHostPort) + ) + try await pairedMacStore.upsert( + macDeviceID: "old-mac", + displayName: "Old Mac", + routes: [oldRoute], + markActive: true, + stackUserID: "phone-user", + teamID: nil, + now: Date().addingTimeInterval(-10) + ) + try await pairedMacStore.upsert( + macDeviceID: "target-mac", + displayName: "Target Mac", + routes: [targetRoute], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "old-mac", instanceTag: nil, displayName: "Old Mac") + let runtime = LivenessTestRuntime( + transportFactory: RouteSelectiveFailureTransportFactory( + failingRouteID: targetRoute.id, + router: router, + box: TransportBox() + ), + now: { Date() }, + supportedRouteKinds: [.debugLoopback], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + workspaces: [], + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ) + store.signIn() + await store.loadPairedMacs() + let oldTicket = try CmxAttachTicket( + workspaceID: "", + terminalID: nil, + macDeviceID: "old-mac", + macDisplayName: "Old Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [oldRoute], + expiresAt: Date().addingTimeInterval(3_600), + authToken: "old-ticket" + ) + #expect(await store.connectPairingURL(try attachURL(for: oldTicket))) + let device = RegistryDevice( + deviceId: "target-mac", + platform: "mac", + displayName: "Target Mac", + lastSeenAt: Date(), + instances: [] + ) + let instance = RegistryAppInstance(tag: "stale", routes: [targetRoute], lastSeenAt: Date()) + + await store.connectToRegistryInstance(device: device, instance: instance) + + let activeIDs = try await pairedMacStore + .loadAll(stackUserID: "phone-user", teamID: nil) + .filter(\.isActive) + .map(\.macDeviceID) + #expect(activeIDs == ["old-mac"]) + #expect(store.connectionState == .connected) + #expect(store.foregroundMacDeviceIDForTesting() == "old-mac") + } + + private func hostPortRoute(kind: CmxAttachTransportKind, host: String) throws -> CmxAttachRoute { + try CmxAttachRoute( + id: kind.rawValue, + kind: kind, + endpoint: .hostPort(host: host, port: CmxMobileDefaults.defaultHostPort) + ) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellRenderGridLivenessTestSupport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellRenderGridLivenessTestSupport.swift index 18760ef2b79a..2a064b3dd430 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellRenderGridLivenessTestSupport.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellRenderGridLivenessTestSupport.swift @@ -5,9 +5,8 @@ import Foundation import Testing @testable import CmuxMobileShell -// Shared fixtures for the render-grid liveness watchdog tests -// (MobileShellRenderGridLivenessTests.swift): injected clock, scripted -// host router, transport mocks, and the connected-store builder. +// Shared fixtures for MobileShellRenderGridLivenessTests.swift: injected clock, +// scripted host router, transport mocks, and the connected-store builder. // MARK: - Scripted host (router + transport) @@ -47,10 +46,9 @@ actor LivenessHostRouter { private var hasActiveSubscription = false private var heldContinuations: [CheckedContinuation] = [] private var capabilities = ["events.v1", "terminal.bytes.v1", "terminal.render_grid.v1", "terminal.replay.v1"] - // This router models the current authenticated Mac host by default. Tests - // for legacy identity omission opt out explicitly via `setHostIdentity`. - // Supplying the matching instance identity also keeps unrelated liveness - // tests from exercising the one-shot legacy identity recovery request. + // This router models the current authenticated Mac host by default. Legacy + // identity tests opt out via `setHostIdentity`; matching instance identity + // avoids the one-shot legacy recovery request in unrelated liveness tests. private var macDeviceID: String? = "test-mac" private var macInstanceTag: String? = "default" private var macDisplayName: String? = "Test Mac" @@ -647,6 +645,8 @@ func installFreshLivenessRemoteClient( runtime: runtime, route: route, ticket: ticket, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) } diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellTeamSwitchAuthorizationTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellTeamSwitchAuthorizationTests.swift new file mode 100644 index 000000000000..844fb71c29d2 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellTeamSwitchAuthorizationTests.swift @@ -0,0 +1,21 @@ +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct MobileShellTeamSwitchAuthorizationTests { + @Test func teamSwitchKeepsForegroundAuthorizationUsable() async throws { + let router = LivenessHostRouter() + let store = try await makeConnectedStore( + router: router, + box: TransportBox(), + clock: TestClock() + ) + let requestsBeforeSwitch = await router.count(of: "mobile.workspace.list") + + store.currentTeamDidChange() + await store.refreshWorkspaces() + + #expect(store.connectionState == .connected) + #expect(await router.count(of: "mobile.workspace.list") == requestsBeforeSwitch + 1) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/NetworkEpochManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/NetworkEpochManualHostTrustStore.swift new file mode 100644 index 000000000000..6a59b1046490 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/NetworkEpochManualHostTrustStore.swift @@ -0,0 +1,28 @@ +import CmuxMobileShellModel + +actor NetworkEpochManualHostTrustStore: MobileManualHostTrustStoring { + private var scopes: Set = [] + private var didRemoveAll = false + private var removeWaiters: [CheckedContinuation] = [] + + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + scopes.contains(scope) + } + + func trust(_ scope: MobileManualHostTrustScope) async { + scopes.insert(scope) + } + + func removeAll() async { + scopes.removeAll() + didRemoveAll = true + let waiters = removeWaiters + removeWaiters.removeAll() + for waiter in waiters { waiter.resume() } + } + + func waitUntilRemoved() async { + if didRemoveAll { return } + await withCheckedContinuation { removeWaiters.append($0) } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/NetworkRecoveryCoalescingTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/NetworkRecoveryCoalescingTests.swift new file mode 100644 index 000000000000..6375626a191d --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/NetworkRecoveryCoalescingTests.swift @@ -0,0 +1,54 @@ +import CMUXMobileCore +import Testing +@testable import CmuxMobileShell + +@MainActor +extension ReconnectRouteSelectionTests { + @Test func repeatedPathChangeDuringReconnectRunsTrailingAttempt() async throws { + let clock = TestClock() + let router = LivenessHostRouter() + let box = TransportBox() + let reachability = ControllablePathChangeReachability() + let factory = RouteRecordingTransportFactory( + router: router, + box: box, + failingPorts: [], + holdFirstFailingPort: 51002 + ) + let store = try await makeReconnectStore( + routes: [try loopbackRoute(id: "settling-network", port: 51002)], + runtime: LivenessTestRuntime( + transportFactory: factory, + now: { clock.now }, + supportedRouteKinds: [.debugLoopback] + ), + reachability: reachability + ) + store.startObservingNetworkPathChanges() + + reachability.emitPathChange() + let firstAttemptStarted = try await pollUntil { + factory.attemptedPorts() == [51002] + } + #expect(firstAttemptStarted) + let firstBoundaryScope = store.manualHostRPCAuthScope + reachability.emitPathChange() + let secondBoundaryApplied = try await pollUntil { + store.manualHostRPCAuthScope != firstBoundaryScope + } + #expect(secondBoundaryApplied) + factory.releaseHeldConnect() + let connected = try await pollUntil { + store.connectionState == .connected + } + + #expect(connected) + // The held first dial fails on release, so reaching .connected proves + // the path change that landed mid-attempt was not dropped: the parked + // trailing recovery re-dialed the same (only) route. The exact dial + // count is an implementation detail of the recovery owner. + let ports = factory.attemptedPorts() + #expect(Set(ports) == [51_002]) + #expect(ports.count >= 2) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/PrimaryRouteAuthorizationFallbackTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/PrimaryRouteAuthorizationFallbackTests.swift new file mode 100644 index 000000000000..dbdf083b3e05 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/PrimaryRouteAuthorizationFallbackTests.swift @@ -0,0 +1,64 @@ +import CMUXMobileCore +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct PrimaryRouteAuthorizationFallbackTests { + @Test func authorizationFailureDoesNotFallBackToTrustedManualHost() async throws { + let clock = TestClock() + let tailscaleRoute = try CmxAttachRoute( + id: "preferred-tailscale", + kind: .tailscale, + endpoint: .hostPort(host: "100.82.214.112", port: 50_922), + priority: 0 + ) + let manualRoute = try CmxAttachRoute( + id: "approved-manual-host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 50_923), + priority: 10 + ) + let ticket = try CmxAttachTicket( + workspaceID: "candidate-workspace", + terminalID: nil, + macDeviceID: "candidate-mac", + macDisplayName: "Candidate Mac", + macPairingCompatibilityVersion: CmxMobileDefaults.pairingCompatibilityVersion, + routes: [tailscaleRoute, manualRoute], + expiresAt: clock.now.addingTimeInterval(3_600) + ) + let trustStore = InMemoryMobileManualHostTrustStore() + let manualScope = try #require( + MobileManualHostTrustScope(route: manualRoute, stackUserID: "phone-user") + ) + await trustStore.trust(manualScope) + let attempts = RouteAttemptRecorder() + let runtime = LivenessTestRuntime( + transportFactory: AuthorizationThenManualFallbackTransportFactory( + router: LivenessHostRouter(), + box: TransportBox(), + attempts: attempts + ), + now: { clock.now }, + supportedRouteKinds: [.tailscale, .manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: trustStore + ) + store.signIn() + + let result = await store.connectPairingURLResult(try attachURL(for: ticket)) + + #expect(result == .failed) + #expect(attempts.count(.tailscale) == 0) + #expect(attempts.count(.manualHost) == 0) + #expect(store.remoteClient == nil) + #expect(store.manualHostTrustWarning == nil) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests+Preferences.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests+Preferences.swift new file mode 100644 index 000000000000..78a058cfe519 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests+Preferences.swift @@ -0,0 +1,79 @@ +import CMUXMobileCore +import Testing +@testable import CmuxMobileShell + +@MainActor +extension ReconnectRouteSelectionTests { + private func manualHost(_ port: Int = 50906) throws -> CmxAttachRoute { + try CmxAttachRoute( + id: "manual_host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: port), + priority: 2 + ) + } + + private func magicDNS(_ port: Int = 50906) throws -> CmxAttachRoute { + try CmxAttachRoute( + id: "tailscale", + kind: .tailscale, + endpoint: .hostPort(host: "lawrences-macbook-pro-2.tail137216.ts.net", port: port), + priority: 5 + ) + } + + @Test func physicalDevicePrefersIPLiteralOverMagicDNSHostname() throws { + let ip = try CmxAttachRoute( + id: "tailscale_2", + kind: .tailscale, + endpoint: .hostPort(host: "100.82.214.112", port: 50922), + priority: 10 + ) + let pick = MobileShellRouteSelection().firstReconnectHostPortRoute( + [try loopback(50922), try magicDNS(50922), ip], + supportedKinds: [.debugLoopback, .tailscale], + preferNonLoopback: true + ) + #expect(pick?.0 == "100.82.214.112") + } + + @Test func magicDNSHostnameStillUsedWhenNoIPRouteExists() throws { + let pick = MobileShellRouteSelection().firstReconnectHostPortRoute( + [try loopback(50922), try magicDNS(50922)], + supportedKinds: [.debugLoopback, .tailscale], + preferNonLoopback: true + ) + #expect(pick?.0 == "lawrences-macbook-pro-2.tail137216.ts.net") + } + + @Test func tailscaleDNSBeatsManualHostIPFallback() throws { + let pick = MobileShellRouteSelection().firstReconnectHostPortRoute( + [try loopback(50922), try manualHost(50922), try magicDNS(50922)], + supportedKinds: [.debugLoopback, .manualHost, .tailscale], + preferNonLoopback: true + ) + #expect(pick?.0 == "lawrences-macbook-pro-2.tail137216.ts.net") + } + + @Test func tailscaleDNSBeatsLegacyLANRouteStoredAsTailscale() throws { + let pick = MobileShellRouteSelection().firstReconnectHostPortRoute( + [try loopback(50922), try legacyLANStoredAsTailscale(50922), try magicDNS(50922)], + supportedKinds: [.debugLoopback, .manualHost, .tailscale], + preferNonLoopback: true + ) + #expect(pick?.0 == "lawrences-macbook-pro-2.tail137216.ts.net") + } + + @Test func ipLiteralHostClassification() { + #expect(MobileShellRouteSelection().isIPLiteralHost("100.82.214.112")) + #expect(MobileShellRouteSelection().isIPLiteralHost("127.0.0.1")) + #expect(MobileShellRouteSelection().isIPLiteralHost("fd7a:115c:a1e0::4b36:d670")) + #expect(MobileShellRouteSelection().isIPLiteralHost("::ffff:192.168.0.1")) + #expect(MobileShellRouteSelection().isIPLiteralHost("[fd7a:115c:a1e0::4b36:d670]")) + #expect(!MobileShellRouteSelection().isIPLiteralHost("lawrences-macbook-pro-2.tail137216.ts.net")) + #expect(!MobileShellRouteSelection().isIPLiteralHost("example.com")) + #expect(!MobileShellRouteSelection().isIPLiteralHost("my:host")) + #expect(!MobileShellRouteSelection().isIPLiteralHost("100.82.214")) + #expect(!MobileShellRouteSelection().isIPLiteralHost("256.1.1.1")) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests+Support.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests+Support.swift index f9450cd05fa3..cb6677321425 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests+Support.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests+Support.swift @@ -65,108 +65,6 @@ actor SupersededTrackingTransport: CmxByteTransport { func observedCloseCount() -> Int { closeCount } } -enum RouteRecordingTransportError: Error { - case routeFailed -} - -final class RouteRecordingTransportFactory: CmxByteTransportFactory, @unchecked Sendable { - private let router: LivenessHostRouter - private let box: TransportBox - private let failingPorts: Set - private let holdFirstFailingPort: Int? - private let lock = NSLock() - private var attempts: [Int] = [] - private var heldConnectConsumed = false - private var heldConnectReleased = false - private var heldConnectWaiters: [CheckedContinuation] = [] - - init( - router: LivenessHostRouter, - box: TransportBox, - failingPorts: Set, - holdFirstFailingPort: Int? = nil - ) { - self.router = router - self.box = box - self.failingPorts = failingPorts - self.holdFirstFailingPort = holdFirstFailingPort - } - - func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { - guard case let .hostPort(_, port) = route.endpoint else { - throw RouteRecordingTransportError.routeFailed - } - let shouldHold = lock.withLock { - attempts.append(port) - if port == holdFirstFailingPort, !heldConnectConsumed { - heldConnectConsumed = true - return true - } - return false - } - if shouldHold { - return HeldFailingConnectTransport(factory: self) - } - if failingPorts.contains(port) { - throw RouteRecordingTransportError.routeFailed - } - let transport = LivenessTransport(router: router) - box.set(transport) - return transport - } - - func attemptedPorts() -> [Int] { - lock.withLock { attempts } - } - - func releaseHeldConnect() { - let waiters = lock.withLock { - heldConnectReleased = true - let waiters = heldConnectWaiters - heldConnectWaiters = [] - return waiters - } - for waiter in waiters { - waiter.resume() - } - } - - func waitUntilHeldConnectReleased() async { - let shouldWait = lock.withLock { - guard !heldConnectReleased else { return false } - return true - } - guard shouldWait else { return } - await withCheckedContinuation { continuation in - let resumeImmediately = lock.withLock { - guard !heldConnectReleased else { return true } - heldConnectWaiters.append(continuation) - return false - } - if resumeImmediately { - continuation.resume() - } - } - } -} - -actor HeldFailingConnectTransport: CmxByteTransport { - private let factory: RouteRecordingTransportFactory - - init(factory: RouteRecordingTransportFactory) { - self.factory = factory - } - - func connect() async throws { - await factory.waitUntilHeldConnectReleased() - throw RouteRecordingTransportError.routeFailed - } - - func receive() async throws -> Data? { nil } - func send(_ data: Data) async throws {} - func close() async {} -} - final class KindRecordingTransportFactory: CmxByteTransportFactory, @unchecked Sendable { private let router: LivenessHostRouter private let box: TransportBox diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests.swift index 0a00312f63e3..45d6412881fb 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ReconnectRouteSelectionTests.swift @@ -1,6 +1,8 @@ import CMUXMobileCore import CmuxMobilePairedMac import CmuxMobileRPC +import CmuxMobileShellModel +import CmuxMobileTransport import Foundation import Testing @testable import CmuxMobileShell @@ -30,6 +32,15 @@ import Testing ) } + func legacyLANStoredAsTailscale(_ port: Int = 50906) throws -> CmxAttachRoute { + try CmxAttachRoute( + id: "legacy_lan", + kind: .tailscale, + endpoint: .hostPort(host: "192.168.1.77", port: port), + priority: 1 + ) + } + func iroh(priority: Int = -10_000) throws -> CmxAttachRoute { try CmxAttachRoute( id: "iroh-personal", @@ -45,7 +56,7 @@ import Testing } @Test func physicalDevicePrefersRealRouteOverLowerPriorityLoopback() throws { - let pick = MobileShellComposite.firstReconnectHostPortRoute( + let pick = MobileShellRouteSelection().firstReconnectHostPortRoute( [try loopback(), try tailscale()], supportedKinds: [.debugLoopback, .tailscale], preferNonLoopback: true @@ -67,7 +78,7 @@ import Testing @Test func simulatorKeepsLoopbackPriorityOrder() throws { // On the simulator 127.0.0.1 IS the host Mac, so priority order stands. - let pick = MobileShellComposite.firstReconnectHostPortRoute( + let pick = MobileShellRouteSelection().firstReconnectHostPortRoute( [try loopback(), try tailscale()], supportedKinds: [.debugLoopback, .tailscale], preferNonLoopback: false @@ -75,6 +86,49 @@ import Testing #expect(pick?.0 == "127.0.0.1") } + @Test func physicalManualHostEntryDoesNotTrustLoopbackAlias() throws { + let route = try MobileShellRouteSelection().manualHostRoute( + host: "127.1", + port: 50906, + isPhysicalDevice: true + ) + #expect(route.kind == .manualHost) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(route)) + } + + @Test func legacyLANRouteStoredAsTailscaleBecomesManualHost() throws { + let route = try MobileShellRouteSelection().manualHostRoute( + host: "192.168.1.77", + port: 50906, + preserving: legacyLANStoredAsTailscale() + ) + + #expect(route.kind == .manualHost) + #expect(route.endpoint == .hostPort(host: "192.168.1.77", port: 50906)) + } + + @Test func verifiedTailscaleSourcePreservesRouteKind() throws { + let source = try tailscale() + let route = try MobileShellRouteSelection().manualHostRoute( + host: "100.82.214.112", + port: 50906, + preserving: source + ) + + #expect(route == source) + #expect(route.kind == .tailscale) + } + + @Test func invalidManualHostCannotConstructRoute() { + do { + _ = try MobileShellRouteSelection().manualHostRoute( + host: "https://studio-mac.local/path", + port: 50_906 + ) + Issue.record("Expected invalid manual host route construction to fail closed") + } catch {} + } + @Test func reconnectCandidatesKeepFallbackRoutesAfterPreferredRoute() throws { let candidates = MobileShellComposite.reconnectHostPortRoutes( [try loopback(), try tailscale()], @@ -141,56 +195,6 @@ import Testing #expect(candidates.isEmpty) } - private func magicDNS(_ port: Int = 50906) throws -> CmxAttachRoute { - // A MagicDNS hostname route, advertised BEFORE the IP route by priority. - try CmxAttachRoute( - id: "tailscale", - kind: .tailscale, - endpoint: .hostPort(host: "lawrences-macbook-pro-2.tail137216.ts.net", port: port), - priority: 5 - ) - } - - @Test func physicalDevicePrefersIPLiteralOverMagicDNSHostname() throws { - // The exact dogfood failure: a Mac advertises loopback, a MagicDNS - // hostname (higher priority), and the raw tailscale IP. MagicDNS doesn't - // resolve on the phone, so dialing the hostname times out; selection must - // pick the IP literal so the secondary fetch / reconnect actually connects. - let ip = try CmxAttachRoute( - id: "tailscale_2", - kind: .tailscale, - endpoint: .hostPort(host: "100.82.214.112", port: 50922), - priority: 10 - ) - let pick = MobileShellComposite.firstReconnectHostPortRoute( - [try loopback(50922), try magicDNS(50922), ip], - supportedKinds: [.debugLoopback, .tailscale], - preferNonLoopback: true - ) - #expect(pick?.0 == "100.82.214.112") - } - - @Test func magicDNSHostnameStillUsedWhenNoIPRouteExists() throws { - // If the only non-loopback route is a hostname, still prefer it over - // loopback on device (better than dialing the phone's own 127.0.0.1). - let pick = MobileShellComposite.firstReconnectHostPortRoute( - [try loopback(50922), try magicDNS(50922)], - supportedKinds: [.debugLoopback, .tailscale], - preferNonLoopback: true - ) - #expect(pick?.0 == "lawrences-macbook-pro-2.tail137216.ts.net") - } - - @Test func ipLiteralHostClassification() { - #expect(MobileShellComposite.isIPLiteralHost("100.82.214.112")) - #expect(MobileShellComposite.isIPLiteralHost("127.0.0.1")) - #expect(MobileShellComposite.isIPLiteralHost("fd7a:115c:a1e0::4b36:d670")) - #expect(!MobileShellComposite.isIPLiteralHost("lawrences-macbook-pro-2.tail137216.ts.net")) - #expect(!MobileShellComposite.isIPLiteralHost("example.com")) - #expect(!MobileShellComposite.isIPLiteralHost("100.82.214")) // too few octets - #expect(!MobileShellComposite.isIPLiteralHost("256.1.1.1")) // out of range - } - @Test func constrainedReconnectTicketMergesWithStoredRoutes() throws { let stale = try loopback(50906) let connected = try tailscale(50922) @@ -345,14 +349,15 @@ import Testing routes: [route], expiresAt: clock.now.addingTimeInterval(3_600) ) + let authContext = store.currentRPCAuthContext() let first = Task { @MainActor in - try? await store.connect(ticket: ticket) + try? await store.connect(ticket: ticket, authContext: authContext) } #expect(await router.waitForCount(of: "workspace.list", atLeast: 1)) let second = Task { @MainActor in - try? await store.connect(ticket: ticket) + try? await store.connect(ticket: ticket, authContext: authContext) } #expect(await router.waitForCount(of: "workspace.list", atLeast: 2)) _ = await second.value @@ -408,7 +413,9 @@ import Testing runtime: runtime, route: routeA, ticket: ticketA, - allowsStackAuthFallback: true + allowsStackAuthFallback: true, + authScope: MobileRPCAuthScope(), + authScopeValidator: { true } ) let store = MobileShellComposite( runtime: runtime, @@ -442,7 +449,7 @@ import Testing #expect(!restored.routes.contains(where: { $0.endpoint == staleRouteB.endpoint })) } - private func loopbackRoute(id: String, port: Int) throws -> CmxAttachRoute { + func loopbackRoute(id: String, port: Int) throws -> CmxAttachRoute { try CmxAttachRoute( id: id, kind: .debugLoopback, @@ -453,7 +460,8 @@ import Testing func makeReconnectStore( routes: [CmxAttachRoute], - runtime: any MobileSyncRuntime + runtime: any MobileSyncRuntime, + reachability: any ReachabilityProviding = AlwaysOnlineReachability() ) async throws -> MobileShellComposite { let (pairedStore, _) = try makePairedMacStore() try await pairedStore.upsert( @@ -470,7 +478,7 @@ import Testing isSignedIn: true, pairedMacStore: pairedStore, identityProvider: StaticIdentityProvider(userID: "user-1"), - reachability: AlwaysOnlineReachability(), + reachability: reachability, pairingHintDefaults: UserDefaults(suiteName: "reconnect-routes-\(UUID().uuidString)")! ) await store.loadPairedMacs() diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthLivenessTransport.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthLivenessTransport.swift new file mode 100644 index 000000000000..ff0bcb699f2f --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthLivenessTransport.swift @@ -0,0 +1,60 @@ +import CMUXMobileCore +import CmuxMobileRPC +import Foundation + +actor RecordedAuthLivenessTransport: CmxByteTransport { + private let router: LivenessHostRouter + private let tokenSink: RecordedAuthTokenSink + private var pendingFrames: [Data] = [] + private var receiveWaiters: [CheckedContinuation] = [] + private var isClosed = false + + init(router: LivenessHostRouter, tokenSink: RecordedAuthTokenSink) { + self.router = router + self.tokenSink = tokenSink + } + + func connect() async throws {} + + func receive() async throws -> Data? { + if !pendingFrames.isEmpty { return pendingFrames.removeFirst() } + if isClosed { return nil } + return await withCheckedContinuation { receiveWaiters.append($0) } + } + + func send(_ data: Data) async throws { + var buffer = data + let payloads = try MobileSyncFrameCodec.decodeFrames(from: &buffer) + for payload in payloads { + let request = (try? JSONSerialization.jsonObject(with: payload)) as? [String: Any] + let requestMethod = request?["method"] as? String + let requestID = request?["id"] as? String + let params = request?["params"] as? [String: Any] + let topics = params?["topics"] as? [String] + let auth = request?["auth"] as? [String: Any] + await tokenSink.record(auth?["stack_access_token"] as? String) + await router.record(method: requestMethod, topics: topics) + Task { [router, weak self] in + guard let response = await router.response(method: requestMethod, id: requestID) else { + return + } + await self?.deliver(response) + } + } + } + + func close() async { + isClosed = true + let waiters = receiveWaiters + receiveWaiters.removeAll() + for waiter in waiters { waiter.resume(returning: nil) } + } + + private func deliver(_ frame: Data) { + if !receiveWaiters.isEmpty { + receiveWaiters.removeFirst().resume(returning: frame) + } else { + pendingFrames.append(frame) + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthLivenessTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthLivenessTransportFactory.swift new file mode 100644 index 000000000000..014f309c8dba --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthLivenessTransportFactory.swift @@ -0,0 +1,11 @@ +import CMUXMobileCore + +struct RecordedAuthLivenessTransportFactory: CmxByteTransportFactory { + let router: LivenessHostRouter + let tokenSink: RecordedAuthTokenSink + + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + _ = route + return RecordedAuthLivenessTransport(router: router, tokenSink: tokenSink) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthTokenSink.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthTokenSink.swift new file mode 100644 index 000000000000..cf31e325aa68 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RecordedAuthTokenSink.swift @@ -0,0 +1,10 @@ +actor RecordedAuthTokenSink { + private var tokens: [String] = [] + + func record(_ token: String?) { + guard let token else { return } + tokens.append(token) + } + + func recordedTokens() -> [String] { tokens } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RefusingManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RefusingManualHostTrustStore.swift new file mode 100644 index 000000000000..49b3bd874485 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RefusingManualHostTrustStore.swift @@ -0,0 +1,14 @@ +import CmuxMobileShellModel + +actor RefusingManualHostTrustStore: MobileManualHostTrustStoring { + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + _ = scope + return false + } + + func trust(_ scope: MobileManualHostTrustScope) async { + _ = scope + } + + func removeAll() async {} +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteAttemptRecorder.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteAttemptRecorder.swift new file mode 100644 index 000000000000..9e1607aefd6d --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteAttemptRecorder.swift @@ -0,0 +1,17 @@ +import CMUXMobileCore +import Foundation + +/// Synchronous test probe: every access to mutable state is serialized by `lock`, +/// and no locked region crosses an async suspension point. +final class RouteAttemptRecorder: @unchecked Sendable { + private let lock = NSLock() + private var counts: [CmxAttachTransportKind: Int] = [:] + + func record(_ kind: CmxAttachTransportKind) { + lock.withLock { counts[kind, default: 0] += 1 } + } + + func count(_ kind: CmxAttachTransportKind) -> Int { + lock.withLock { counts[kind, default: 0] } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteRecordingTransportError.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteRecordingTransportError.swift new file mode 100644 index 000000000000..a3a81133d4db --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteRecordingTransportError.swift @@ -0,0 +1,3 @@ +enum RouteRecordingTransportError: Error { + case routeFailed +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteRecordingTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteRecordingTransportFactory.swift new file mode 100644 index 000000000000..a30565fc730b --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteRecordingTransportFactory.swift @@ -0,0 +1,85 @@ +import CMUXMobileCore +import CmuxMobileTransport +import Foundation + +// The lock synchronously coordinates test transport creation and one-shot continuation handoff. +final class RouteRecordingTransportFactory: CmxByteTransportFactory, @unchecked Sendable { + private let router: LivenessHostRouter + private let box: TransportBox + private let failingPorts: Set + private let holdFirstFailingPort: Int? + private let lock = NSLock() + private var attempts: [Int] = [] + private var heldConnectConsumed = false + private var heldConnectReleased = false + private var heldConnectWaiters: [CheckedContinuation] = [] + + init( + router: LivenessHostRouter, + box: TransportBox, + failingPorts: Set, + holdFirstFailingPort: Int? = nil + ) { + self.router = router + self.box = box + self.failingPorts = failingPorts + self.holdFirstFailingPort = holdFirstFailingPort + } + + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + guard case let .hostPort(_, port) = route.endpoint else { + throw RouteRecordingTransportError.routeFailed + } + let shouldHold = lock.withLock { + attempts.append(port) + if port == holdFirstFailingPort, !heldConnectConsumed { + heldConnectConsumed = true + return true + } + return false + } + if shouldHold { + return HeldFailingConnectTransport(factory: self) + } + if failingPorts.contains(port) { + throw RouteRecordingTransportError.routeFailed + } + let transport = LivenessTransport(router: router) + box.set(transport) + return transport + } + + func attemptedPorts() -> [Int] { + lock.withLock { attempts } + } + + func releaseHeldConnect() { + let waiters = lock.withLock { + heldConnectReleased = true + let waiters = heldConnectWaiters + heldConnectWaiters = [] + return waiters + } + for waiter in waiters { + waiter.resume() + } + } + + func waitUntilHeldConnectReleased() async { + let shouldWait = lock.withLock { + guard !heldConnectReleased else { return false } + return true + } + guard shouldWait else { return } + await withCheckedContinuation { continuation in + let resumeImmediately = lock.withLock { + guard !heldConnectReleased else { return true } + heldConnectWaiters.append(continuation) + return false + } + if resumeImmediately { + continuation.resume() + } + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteSelectiveFailureTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteSelectiveFailureTransportFactory.swift new file mode 100644 index 000000000000..dddebcf76b6f --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/RouteSelectiveFailureTransportFactory.swift @@ -0,0 +1,17 @@ +import CMUXMobileCore +import CmuxMobileRPC + +struct RouteSelectiveFailureTransportFactory: CmxByteTransportFactory { + let failingRouteID: String + let router: LivenessHostRouter + let box: TransportBox + + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + if route.id == failingRouteID { + return SlowIgnoringCancellationTransport() + } + let transport = LivenessTransport(router: router) + box.set(transport) + return transport + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryManualHostTrustExpirationTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryManualHostTrustExpirationTests.swift new file mode 100644 index 000000000000..13793d0e2f0d --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryManualHostTrustExpirationTests.swift @@ -0,0 +1,62 @@ +import CMUXMobileCore +import CmuxMobilePairedMac +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct SecondaryManualHostTrustExpirationTests { + @Test func expiredTrustDisconnectsLiveSecondaryWithoutAnotherRPC() async throws { + let directory = FileManager.default.temporaryDirectory + .appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let manualRoute = try CmxAttachRoute( + id: "expiring-secondary-manual-host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.88", port: 50_923) + ) + try await pairedMacStore.upsert( + macDeviceID: "secondary-mac", + displayName: "Secondary Mac", + routes: [manualRoute], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let attempts = RouteAttemptRecorder() + let runtime = LivenessTestRuntime( + transportFactory: SecondaryRouteFallbackTransportFactory( + router: LivenessHostRouter(), + box: TransportBox(), + attempts: attempts + ), + now: { Date() }, + supportedRouteKinds: [.manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + isSignedIn: true, + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: ImmediateExpiryManualHostTrustStore() + ) + + await store.loadPairedMacs() + await store.refreshSecondaryMacWorkspaces() + let expired = try await pollUntil(attempts: 50) { + store.secondaryMacSubscriptions["secondary-mac"] == nil + } + + #expect(attempts.count(.manualHost) >= 1) + #expect(expired) + #expect(store.secondaryMacSubscriptions["secondary-mac"] == nil) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryRouteFallbackTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryRouteFallbackTests.swift new file mode 100644 index 000000000000..5f04186141b7 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryRouteFallbackTests.swift @@ -0,0 +1,73 @@ +import CMUXMobileCore +import CmuxMobilePairedMac +import CmuxMobileShellModel +import Foundation +import Testing +@testable import CmuxMobileShell + +@MainActor +@Suite struct SecondaryRouteFallbackTests { + @Test func secondaryAggregationSkipsTailscaleAndUsesApprovedManualHost() async throws { + let directory = FileManager.default.temporaryDirectory + .appendingPathComponent(UUID().uuidString, isDirectory: true) + try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: directory) } + let pairedMacStore = try MobilePairedMacStore( + databaseURL: directory.appendingPathComponent("paired-macs.sqlite3") + ) + let tailscaleRoute = try CmxAttachRoute( + id: "preferred-tailscale", + kind: .tailscale, + endpoint: .hostPort(host: "100.82.214.112", port: 50_922), + priority: 0 + ) + let manualRoute = try CmxAttachRoute( + id: "approved-manual-host", + kind: .manualHost, + endpoint: .hostPort(host: "192.168.1.77", port: 50_923), + priority: 10 + ) + try await pairedMacStore.upsert( + macDeviceID: "secondary-mac", + displayName: "Secondary Mac", + routes: [tailscaleRoute, manualRoute], + markActive: false, + stackUserID: "phone-user", + teamID: nil, + now: Date() + ) + let trustStore = InMemoryMobileManualHostTrustStore() + let trustScope = try #require( + MobileManualHostTrustScope(route: manualRoute, stackUserID: "phone-user") + ) + await trustStore.trust(trustScope) + let attempts = RouteAttemptRecorder() + let router = LivenessHostRouter() + await router.setHostIdentity(deviceID: "secondary-mac", instanceTag: nil, displayName: "Secondary Mac") + let runtime = LivenessTestRuntime( + transportFactory: SecondaryRouteFallbackTransportFactory( + router: router, + box: TransportBox(), + attempts: attempts + ), + now: { Date() }, + supportedRouteKinds: [.tailscale, .manualHost], + supportsServerPushEvents: false + ) + let store = MobileShellComposite( + runtime: runtime, + isSignedIn: true, + pairedMacStore: pairedMacStore, + identityProvider: StaticIdentityProvider(userID: "phone-user"), + reachability: AlwaysOnlineReachability(), + manualHostTrustStore: trustStore + ) + await store.loadPairedMacs() + + await store.refreshSecondaryMacWorkspaces() + + #expect(attempts.count(.tailscale) == 0) + #expect(attempts.count(.manualHost) >= 1) + #expect(store.secondaryMacSubscriptions["secondary-mac"]?.route.kind == .manualHost) + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryRouteFallbackTransportFactory.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryRouteFallbackTransportFactory.swift new file mode 100644 index 000000000000..30b17c7a6524 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SecondaryRouteFallbackTransportFactory.swift @@ -0,0 +1,18 @@ +import CMUXMobileCore +import Foundation + +struct SecondaryRouteFallbackTransportFactory: CmxByteTransportFactory { + let router: LivenessHostRouter + let box: TransportBox + let attempts: RouteAttemptRecorder + + func makeTransport(for route: CmxAttachRoute) throws -> any CmxByteTransport { + attempts.record(route.kind) + guard route.kind != .tailscale else { + throw URLError(.cannotConnectToHost) + } + let transport = LivenessTransport(router: router) + box.set(transport) + return transport + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SignalingManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SignalingManualHostTrustStore.swift new file mode 100644 index 000000000000..e468e3e7b3c6 --- /dev/null +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/SignalingManualHostTrustStore.swift @@ -0,0 +1,40 @@ +import CmuxMobileShellModel + +actor SignalingManualHostTrustStore: MobileManualHostTrustStoring { + private var trustedScopes: Set = [] + private var checkCounts: [MobileManualHostTrustScope: Int] = [:] + private var checkWaiters: [MobileManualHostTrustScope: [( + expected: Int, + continuation: CheckedContinuation + )]] = [:] + + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + checkCounts[scope, default: 0] += 1 + let currentCount = checkCounts[scope, default: 0] + let waiters = checkWaiters.removeValue(forKey: scope) ?? [] + let readyWaiters = waiters.filter { $0.expected <= currentCount } + let remainingWaiters = waiters.filter { $0.expected > currentCount } + if !remainingWaiters.isEmpty { + checkWaiters[scope] = remainingWaiters + } + for waiter in readyWaiters { + waiter.continuation.resume() + } + return trustedScopes.contains(scope) + } + + func trust(_ scope: MobileManualHostTrustScope) async { + trustedScopes.insert(scope) + } + + func removeAll() async { + trustedScopes.removeAll() + } + + func waitUntilChecked(_ scope: MobileManualHostTrustScope, count: Int) async { + if checkCounts[scope, default: 0] >= count { return } + await withCheckedContinuation { continuation in + checkWaiters[scope, default: []].append((count, continuation)) + } + } +} diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TaggedBuildPresenceRouteIsolationTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TaggedBuildPresenceRouteIsolationTests.swift index 264ee03c6ad0..3f90205e126f 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TaggedBuildPresenceRouteIsolationTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TaggedBuildPresenceRouteIsolationTests.swift @@ -43,7 +43,7 @@ import Testing ), ] )] - let accountScope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let accountScope = accountScope(for: store) store.applyPresenceUpdate( snapshot([ @@ -102,7 +102,7 @@ import Testing teamIDProvider: { "team-a" } ) await store.loadPairedMacs() - let accountScope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let accountScope = accountScope(for: store) store.applyPresenceUpdate( snapshot([ @@ -132,6 +132,17 @@ import Testing let original = try route(id: "original", host: "100.64.0.1", port: 50_000) let defaultRoute = try route(id: "stable", host: "100.64.0.2", port: 51_001) let routeB = try route(id: "b", host: "100.64.0.3", port: 51_002) + let transportFactory = RouteRecordingTransportFactory( + router: LivenessHostRouter(), + box: TransportBox(), + failingPorts: [51_001] + ) + let runtime = LivenessTestRuntime( + transportFactory: transportFactory, + now: { Date() }, + supportedRouteKinds: [.tailscale], + supportsServerPushEvents: false + ) let pairedStore = DelayedTeamPairedMacStore( recordsByTeam: ["team-a": [pairedMac( routes: [original], @@ -141,6 +152,7 @@ import Testing blockedTeams: [] ) let store = MobileShellComposite( + runtime: runtime, isSignedIn: true, pairedMacStore: pairedStore, buildCompatibilityPolicy: .official, @@ -167,7 +179,7 @@ import Testing ), ] )] - let accountScope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let accountScope = accountScope(for: store) store.applyPresenceUpdate( snapshot([ @@ -181,10 +193,8 @@ import Testing #expect(try await storedInstanceTag(in: pairedStore) == "default") #expect(await pairedStore.currentUpsertCount() == 1) #expect(try await storedRoutes(in: pairedStore) == [defaultRoute]) - let recoveryRan = try await pollUntil(attempts: 50) { - store.isRecoveringConnection || store.connectionRecoveryFailed - } - #expect(recoveryRan) + await store.connectionRecoveryOwner.task?.value + #expect(store.connectionRecoveryFailed) } @Test func explicitEmptyRoutesClearRegistryWithoutErasingPersistedRoutes() async throws { @@ -212,7 +222,7 @@ import Testing lastSeenAt: Date(timeIntervalSince1970: 1) )] )] - let accountScope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let accountScope = accountScope(for: store) store.applyPresenceUpdate( .routes(instance(deviceId: "registry-only-mac", tag: "feature-a", routes: [])), @@ -241,7 +251,7 @@ import Testing reachability: AlwaysOnlineReachability() ) await store.loadPairedMacs() - let accountScope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let accountScope = accountScope(for: store) store.applyPresenceUpdate( snapshot([ @@ -278,7 +288,7 @@ import Testing teamIDProvider: { "team-a" } ) await store.loadPairedMacs() - let scope = MobileShellScopeSnapshot(userID: "user-1", teamID: "team-a", generation: 0) + let scope = accountScope(for: store) store.applyPresenceUpdate(.snapshot(PresenceSnapshot( teamId: "team-a", @@ -334,9 +344,7 @@ import Testing let pairedDevice = presenceDevice(id: "paired-mac", instances: [ instance(deviceId: "paired-mac", tag: "feature-a", routes: [updated]), ]) - let scope = MobileShellScopeSnapshot( - userID: "user-1", teamID: "team-a", generation: 0 - ) + let scope = accountScope(for: store) store.applyPresenceUpdate(.snapshot(PresenceSnapshot( teamId: "team-a", @@ -383,9 +391,7 @@ import Testing ) let upsertsBeforePresence = await pairedStore.currentUpsertCount() await pairedStore.resetLoadAllCount() - let scope = MobileShellScopeSnapshot( - userID: "user-1", teamID: "team-a", generation: 0 - ) + let scope = accountScope(for: store) store.applyPresenceUpdate(.snapshot(PresenceSnapshot( teamId: "team-a", @@ -473,6 +479,16 @@ import Testing ) } + private func accountScope(for store: MobileShellComposite) -> MobileShellScopeSnapshot { + MobileShellScopeSnapshot( + userID: "user-1", + teamID: "team-a", + generation: 0, + signInGeneration: store.currentSessionGeneration, + rpcAuthContext: store.currentRPCAuthContext() + ) + } + private func storedRoutes(in store: DelayedTeamPairedMacStore) async throws -> [CmxAttachRoute]? { try await store.loadAll(stackUserID: "user-1", teamID: "team-a").first?.routes } diff --git a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TerminalMissingBaselineReplayBudgetTests.swift b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TerminalMissingBaselineReplayBudgetTests.swift index 1a28be058978..431088123dc3 100644 --- a/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TerminalMissingBaselineReplayBudgetTests.swift +++ b/Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/TerminalMissingBaselineReplayBudgetTests.swift @@ -99,12 +99,19 @@ import Testing let fullChunk = try #require(await iterator.next()) #expect(String(decoding: fullChunk.data, as: UTF8.self).contains("live-full-takes-over")) + let droppedOutputCountBeforePartial = + store.terminalReplayBarrierDroppedOutputCountsBySurfaceID[surfaceID] ?? 0 await transport.deliver(try renderGridEventFrame( surfaceID: surfaceID, seq: 11, text: "partial-dropped-before-full-ack", full: false )) + let partialWasDropped = try await pollUntil { + (store.terminalReplayBarrierDroppedOutputCountsBySurfaceID[surfaceID] ?? 0) + > droppedOutputCountBeforePartial + } + #expect(partialWasDropped) await router.enqueueReplayPayload(text: "stale-held-replay", sequence: 5) await router.releaseAllHeld() store.terminalOutputDidProcess(surfaceID: surfaceID, streamToken: fullChunk.streamToken) diff --git a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/InMemoryMobileManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/InMemoryMobileManualHostTrustStore.swift new file mode 100644 index 000000000000..00140b9e3f57 --- /dev/null +++ b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/InMemoryMobileManualHostTrustStore.swift @@ -0,0 +1,27 @@ +import Foundation + +/// Volatile manual-host trust store whose approvals last only for this actor's lifetime. +public actor InMemoryMobileManualHostTrustStore: MobileManualHostTrustStoring { + private var trustedScopes: Set = [] + + /// Creates an empty in-memory trust store. + public init() {} + + /// Returns whether the given host/port/account scope is already trusted. + /// - Parameter scope: The scope to look up. + public func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + trustedScopes.contains(scope) + } + + /// Persists trust for exactly the given host/port/account scope. + /// - Parameter scope: The scope to approve. + public func trust(_ scope: MobileManualHostTrustScope) async { + guard !Task.isCancelled else { return } + trustedScopes.insert(scope) + } + + /// Removes every stored approval. + public func removeAll() async { + trustedScopes.removeAll() + } +} diff --git a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustScope.swift b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustScope.swift new file mode 100644 index 000000000000..a6f08abd2bed --- /dev/null +++ b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustScope.swift @@ -0,0 +1,53 @@ +public import CMUXMobileCore +import Foundation + +/// A narrowly-scoped manual-host trust decision. +/// +/// Trust is keyed to the normalized host, port, and current Stack user id. +/// That keeps an approval for one LAN host from becoming a +/// global permission for unrelated plaintext routes. +public struct MobileManualHostTrustScope: Equatable, Hashable, Sendable { + /// The normalized host, lowercased for DNS/IP-literal comparisons. + public let normalizedHost: String + /// The approved TCP port. + public let port: Int + /// The nonempty Stack user id that approved this route. + public let stackUserID: String + + /// Creates a trust scope from a user-entered host and port. + /// - Parameters: + /// - host: A DNS name or IP literal. + /// - port: The TCP port in `1...65535`. + /// - stackUserID: The approving Stack user id. Empty or missing ids fail closed. + public init?(host: String, port: Int, stackUserID: String?) { + let trimmedUserID = stackUserID?.trimmingCharacters(in: .whitespacesAndNewlines) + guard let manualHost = CmxManualHost(routeHost: host), + (1...65535).contains(port), + let trimmedUserID, + !trimmedUserID.isEmpty else { + return nil + } + self.normalizedHost = manualHost.rawValue.lowercased() + self.port = port + self.stackUserID = trimmedUserID + } + + /// Creates a trust scope from an attach route. + /// - Parameters: + /// - route: The manual-host route to scope. + /// - stackUserID: The approving Stack user id, if known. + public init?(route: CmxAttachRoute, stackUserID: String?) { + guard case let .hostPort(host, port) = route.endpoint else { + return nil + } + self.init(host: host, port: port, stackUserID: stackUserID) + } + + var storageKey: String { + [ + stackUserID.mobileManualHostTrustStorageEscaped, + normalizedHost.mobileManualHostTrustStorageEscaped, + "\(port)", + ].joined(separator: "|") + } +} diff --git a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustStoredState.swift b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustStoredState.swift new file mode 100644 index 000000000000..006a17fb497f --- /dev/null +++ b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustStoredState.swift @@ -0,0 +1,55 @@ +import Foundation + +struct MobileManualHostTrustStoredState { + let persistedExpirations: [String: TimeInterval] + let trustedScopes: [MobileManualHostTrustScope: TimeInterval] + + init(defaults: UserDefaults, key: String, sessionIdentifier: String) { + let persistedExpirations: [String: TimeInterval] + if let raw = defaults.dictionary(forKey: key) { + persistedExpirations = raw.reduce(into: [:]) { result, entry in + if let expiresAt = entry.value as? TimeInterval { + result[entry.key] = expiresAt + } else if let expiresAt = entry.value as? NSNumber { + result[entry.key] = expiresAt.doubleValue + } + } + } else { + persistedExpirations = [:] + } + self.persistedExpirations = persistedExpirations + + let sessionPrefix = sessionIdentifier.mobileManualHostTrustStorageEscaped + "|" + self.trustedScopes = persistedExpirations.reduce(into: [:]) { result, entry in + guard entry.key.hasPrefix(sessionPrefix) else { return } + let components = entry.key.dropFirst(sessionPrefix.count).split( + separator: "|", + omittingEmptySubsequences: false + ) + guard components.count == 3, + let port = Int(components[2]), + let scope = MobileManualHostTrustScope( + host: String(components[1]).mobileManualHostTrustStorageUnescaped, + port: port, + stackUserID: String(components[0]).mobileManualHostTrustStorageUnescaped + ) else { + return + } + result[scope] = entry.value + } + } +} + +extension String { + var mobileManualHostTrustStorageEscaped: String { + self + .replacing("%", with: "%25") + .replacing("|", with: "%7C") + } + + var mobileManualHostTrustStorageUnescaped: String { + self + .replacing("%7C", with: "|") + .replacing("%25", with: "%") + } +} diff --git a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustStoring.swift b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustStoring.swift new file mode 100644 index 000000000000..4a4d4db3ad96 --- /dev/null +++ b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustStoring.swift @@ -0,0 +1,29 @@ +public import Foundation + +/// Persistence for explicit manual-host approvals. +public protocol MobileManualHostTrustStoring: Sendable { + /// Returns whether the given host/port/account scope is already trusted. + /// - Parameter scope: The scope to look up. + func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool + + /// Persists trust for exactly the given host/port/account scope. + /// - Parameter scope: The scope to approve. + func trust(_ scope: MobileManualHostTrustScope) async + + /// Returns when the approval expires, or `nil` for stores without expiry. + /// - Parameter scope: The approved scope to inspect. + func expirationDate(for scope: MobileManualHostTrustScope) async -> Date? + + /// Removes every stored approval. + func removeAll() async +} + +/// Default behavior for trust stores that do not expire approvals themselves. +public extension MobileManualHostTrustStoring { + /// Returns no expiry when the store does not own an expiration policy. + /// - Parameter scope: The approved scope to inspect. + func expirationDate(for scope: MobileManualHostTrustScope) async -> Date? { + _ = scope + return nil + } +} diff --git a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustWarning.swift b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustWarning.swift new file mode 100644 index 000000000000..766775173127 --- /dev/null +++ b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileManualHostTrustWarning.swift @@ -0,0 +1,30 @@ +import Foundation + +/// UI state describing a manual-host route that needs explicit trust. +public struct MobileManualHostTrustWarning: Equatable, Sendable { + /// The trust scope that will be persisted if the user approves. + public let scope: MobileManualHostTrustScope + /// The host text shown to the user. + public let displayHost: String + + /// Creates a warning for a pending manual-host approval. + /// - Parameters: + /// - scope: The narrow host/port/account trust scope. + /// - displayHost: The host string to show. Defaults to the normalized host. + public init(scope: MobileManualHostTrustScope, displayHost: String? = nil) { + self.scope = scope + self.displayHost = displayHost ?? scope.normalizedHost + } + + /// The approved endpoint, formatted for display. + public var endpoint: String { + let host = if displayHost.hasPrefix("[") && displayHost.hasSuffix("]") { + String(displayHost.dropFirst().dropLast()) + } else { + displayHost + } + return host.contains(":") + ? "[\(host)]:\(scope.port)" + : "\(host):\(scope.port)" + } +} diff --git a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileShellRouteAuthPolicy.swift b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileShellRouteAuthPolicy.swift index 614a36cc328e..505807b6bc2c 100644 --- a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileShellRouteAuthPolicy.swift +++ b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/MobileShellRouteAuthPolicy.swift @@ -2,87 +2,94 @@ public import CMUXMobileCore import Foundation /// Pure routing/trust policy that decides which attach routes may carry Stack auth -/// and how a manually typed host maps to a transport kind. +/// and how a manually typed host maps to a conservative transport kind. /// /// All members are pure functions of their inputs so the trust decisions (loopback /// vs Tailscale vs LAN vs arbitrary host) can be exhaustively tested without a live /// connection. /// -/// The Stack-bearer-token gate (``routeAllowsStackAuth(_:)``) is intentionally -/// restricted to **loopback**, which never leaves the machine. iOS cannot prove -/// that a generic packet-tunnel interface belongs to Tailscale's authenticated -/// control plane, so a Tailscale-address heuristic is insufficient for sending -/// an account credential over plaintext TCP. Iroh sessions authenticate RPC out -/// of band and never carry a Stack bearer token. Plain -/// private-LAN and `.local`/Bonjour hosts are dialed -/// over unencrypted TCP (``CmxNetworkByteTransport`` uses `NWParameters(tls: nil)`), -/// so they are excluded from the Stack-auth-allowed set even though they may still -/// be reachable as attach routes. -public struct MobileShellRouteAuthPolicy { - private init() {} +/// The Stack-bearer-token gate (``routeAllowsStackAuth(_:manualHostTrusted:)``) +/// is intentionally restricted to loopback plus an explicit per-host manual +/// approval. Iroh sessions authenticate RPC out of band and never carry a Stack +/// bearer token; a generic packet-tunnel interface does not prove Tailscale +/// provenance, so `.tailscale` host routes also cannot carry that credential. +/// Plain private-LAN and `.local`/Bonjour hosts remain excluded by default even +/// though they may still be reachable as attach routes. +public struct MobileShellRouteAuthPolicy: Sendable { + private let loopbackHost: CmxLoopbackHost + + /// Creates a route-auth policy with an injectable loopback host matcher. + /// - Parameter loopbackHost: Matcher used to recognize loopback aliases. + public init(loopbackHost: CmxLoopbackHost = CmxLoopbackHost()) { + self.loopbackHost = loopbackHost + } /// Normalizes a raw, user-entered host string, stripping IPv6 brackets and /// rejecting anything that contains scheme/path/whitespace characters. /// - Parameter rawHost: The raw host string typed by the user. /// - Returns: The normalized bare host, or `nil` when it is not a valid host. - public static func normalizedManualHost(_ rawHost: String) -> String? { - let trimmed = rawHost.trimmingCharacters(in: .whitespacesAndNewlines) - guard !trimmed.isEmpty else { - return nil - } - - let host: String - if trimmed.hasPrefix("[") || trimmed.hasSuffix("]") { - guard trimmed.hasPrefix("["), - trimmed.hasSuffix("]"), - trimmed.count > 2 else { - return nil - } - host = String(trimmed.dropFirst().dropLast()) - } else { - host = trimmed - } + public func normalizedManualHost(_ rawHost: String) -> String? { + CmxManualHost(rawHost)?.rawValue + } - guard !host.isEmpty, - host.rangeOfCharacter(from: .whitespacesAndNewlines) == nil, - host.rangeOfCharacter(from: .controlCharacters) == nil, - host.rangeOfCharacter(from: CharacterSet(charactersIn: "/?#@")) == nil, - host.range(of: "://") == nil else { - return nil - } - return host + /// Normalizes an already-stored attach-route endpoint host. + /// + /// Unlike ``normalizedManualHost(_:)``, this accepts bare IPv6 because route + /// endpoints store IPv6 hosts without brackets. + public func normalizedManualRouteHost(_ rawHost: String) -> String? { + CmxManualHost(routeHost: rawHost)?.rawValue } /// Maps a manually typed host to the transport kind that should be used. - /// - Parameter host: The host to classify. - /// - Returns: `.debugLoopback` for loopback hosts, otherwise `.tailscale`. - public static func manualRouteKind(for host: String) -> CmxAttachTransportKind { - let normalizedHost = host.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() - if isLoopbackHost(normalizedHost) { + /// - Parameters: + /// - host: The host to classify. + /// - allowsDebugLoopback: Whether loopback aliases should become + /// `.debugLoopback`. Keep this `false` for physical-device manual entry: + /// loopback dials the phone itself there, not the Mac. + /// - Returns: `.debugLoopback` for allowed loopback hosts, `.manualHost` + /// otherwise, or `nil` for an invalid host. Host text alone never proves + /// that a raw TCP connection traverses Tailscale; only a structured route + /// may carry that provenance. + public func manualRouteKind( + for host: String, + allowsDebugLoopback: Bool = true + ) -> CmxAttachTransportKind? { + guard let normalizedHost = normalizedManualRouteHost(host)?.lowercased() else { + return nil + } + if allowsDebugLoopback, isLoopbackHost(normalizedHost) { return .debugLoopback } - return .tailscale + return .manualHost } /// Whether the given route is trusted enough to carry the Stack bearer token. /// /// The Stack `stack_access_token` is the owner's account credential, so it must - /// only ever traverse loopback. This predicate gates every Stack-token-send - /// site and returns `true` only for `.debugLoopback` to a loopback host. + /// only ever traverse loopback or an explicitly approved manual-host route. + /// Iroh authorizes RPC through its admitted session, while raw `.tailscale` + /// text lacks structural transport proof and therefore remains fail-closed. /// /// Plain private-LAN (`192.168/16`, `10/8`, `172.16/12`, link-local) and /// `.local`/Bonjour hosts are deliberately **excluded**: they are dialed over /// unencrypted TCP (``CmxNetworkByteTransport`` uses `NWParameters(tls: nil)`), /// so sending the bearer token to such a host would disclose it in plaintext on /// the local network before the Mac proves it is the same-account host. - /// Iroh routes always return `false`. Their authenticated session context - /// authorizes RPC without disclosing the account bearer token to the peer. - /// - Parameter route: The candidate attach route. - /// - Returns: `true` only for a loopback route. - public static func routeAllowsStackAuth(_ route: CmxAttachRoute) -> Bool { + /// - Parameters: + /// - route: The candidate attach route. + /// - manualHostTrusted: Whether this exact `.manualHost` route has an + /// explicit persisted trust approval. + /// - Returns: `true` only for loopback and explicitly approved manual-host + /// routes. + public func routeAllowsStackAuth( + _ route: CmxAttachRoute, + manualHostTrusted: Bool = false + ) -> Bool { switch (route.kind, route.endpoint) { case (.debugLoopback, let .hostPort(host, _)): return isLoopbackHost(host) + case (.manualHost, let .hostPort(host, _)): + return manualHostTrusted && !isLoopbackHost(host) case (.tailscale, .hostPort), (.iroh, .peer): return false default: @@ -90,6 +97,17 @@ public struct MobileShellRouteAuthPolicy { } } + /// Whether a route is an explicit manual-host route that needs approval. + /// - Parameter route: The candidate attach route. + /// - Returns: `true` only for `.manualHost` host/port routes. + public func routeRequiresManualHostTrust(_ route: CmxAttachRoute) -> Bool { + guard route.kind == .manualHost, + case let .hostPort(host, _) = route.endpoint else { + return false + } + return !isLoopbackHost(host) + } + /// Whether a decoded pairing/attach ticket must be rejected because its /// routes dial the device itself. /// @@ -107,18 +125,18 @@ public struct MobileShellRouteAuthPolicy { /// simulator and on other platforms. /// - Returns: `true` when the ticket must fail with the loopback-rejected /// error instead of connecting. - public static func ticketRejectsLoopbackRoutes( + public func ticketRejectsLoopbackRoutes( _ routes: [CmxAttachRoute], isPhysicalDevice: Bool ) -> Bool { - isPhysicalDevice && routes.contains(where: CmxLoopbackHost().matches) + isPhysicalDevice && routes.contains(where: routeIsLoopback) } /// Whether the given route may carry Stack auth when reached via an implicit /// pair-link (no explicit attach token), restricted to loopback only. /// - Parameter route: The candidate attach route. /// - Returns: `true` only for loopback host/port routes. - public static func routeAllowsImplicitPairLinkStackAuth(_ route: CmxAttachRoute) -> Bool { + public func routeAllowsImplicitPairLinkStackAuth(_ route: CmxAttachRoute) -> Bool { switch (route.kind, route.endpoint) { case (.debugLoopback, let .hostPort(host, _)): return isLoopbackHost(host) @@ -133,59 +151,35 @@ public struct MobileShellRouteAuthPolicy { /// dial it. /// - Parameter route: The candidate attach route. /// - Returns: `true` when the route's host/port endpoint is a loopback host. - public static func routeIsLoopback(_ route: CmxAttachRoute) -> Bool { + public func routeIsLoopback(_ route: CmxAttachRoute) -> Bool { guard case let .hostPort(host, _) = route.endpoint else { return false } return isLoopbackHost(host) } - /// Whether a manual host should warn that it cannot carry account credentials. - /// - Parameter host: The manually typed host. - /// - Returns: `true` for every valid host outside loopback. - public static func manualHostNeedsTrustWarning(_ host: String) -> Bool { - guard let normalizedHost = normalizedManualNetworkHost(host) else { + /// Whether a manually entered host should show the plaintext-route warning. + /// - Parameters: + /// - host: The manually typed host. + /// - allowsDebugLoopback: Whether loopback aliases are trusted debug hosts + /// for this caller. + /// - Returns: `true` for every valid host except an allowed debug loopback. + public func manualHostNeedsTrustWarning( + _ host: String, + allowsDebugLoopback: Bool = true + ) -> Bool { + guard normalizedManualNetworkHost(host) != nil else { return false } - return !isLoopbackHost(normalizedHost) + return manualRouteKind(for: host, allowsDebugLoopback: allowsDebugLoopback) == .manualHost } - private static func normalizedManualNetworkHost(_ host: String) -> String? { + private func normalizedManualNetworkHost(_ host: String) -> String? { normalizedManualHost(host)?.lowercased() } - private static func isLoopbackHost(_ host: String) -> Bool { - let normalizedHost = host.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() - return normalizedHost == "localhost" || - normalizedHost == "::1" || - isIPv4LoopbackHost(normalizedHost) - } - - private static func isIPv4LoopbackHost(_ host: String) -> Bool { - guard let octets = ipv4Octets(host) else { - return false - } - return octets[0] == 127 - } - - private static func ipv4Octets(_ host: String) -> [Int]? { - let parts = host.split(separator: ".", omittingEmptySubsequences: false) - guard parts.count == 4 else { - return nil - } - let octets = parts.compactMap { part -> Int? in - guard !part.isEmpty, - part.utf8.allSatisfy({ (48...57).contains($0) }), - let value = Int(part), - (0...255).contains(value) else { - return nil - } - return value - } - guard octets.count == 4 else { - return nil - } - return octets + private func isLoopbackHost(_ host: String) -> Bool { + loopbackHost.matches(host) } } diff --git a/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/UserDefaultsMobileManualHostTrustStore.swift b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/UserDefaultsMobileManualHostTrustStore.swift new file mode 100644 index 000000000000..4f9a3c64874d --- /dev/null +++ b/Packages/iOS/CmuxMobileShellModel/Sources/CmuxMobileShellModel/UserDefaultsMobileManualHostTrustStore.swift @@ -0,0 +1,136 @@ +public import Foundation +import OSLog + +nonisolated private let manualHostTrustStoreLog = Logger(subsystem: "com.cmuxterm.app", category: "ManualHostTrust") + +/// UserDefaults-backed manual-host trust store for production. +public actor UserDefaultsMobileManualHostTrustStore: MobileManualHostTrustStoring { + /// Default lifetime for a same-app-session manual-host approval. + public static let defaultTrustDuration: TimeInterval = 10 * 60 + + private let defaults: UserDefaults + private let key: String + private let sessionIdentifier: String + private let trustDuration: TimeInterval + private let now: @Sendable () -> Date + private var persistedExpirations: [String: TimeInterval] + private var trustedScopes: [MobileManualHostTrustScope: TimeInterval] + + /// Creates a same-session manual-host trust store. + /// - Parameters: + /// - defaults: The backing defaults store. + /// - key: The defaults key that stores approved scopes and their expiry times. + /// - sessionIdentifier: The app-session boundary for approvals. + /// - trustDuration: How long a host approval remains valid within this session. + /// - now: Clock source used to evaluate expiry. + public init( + defaults: UserDefaults = .standard, + key: String = "cmux.mobile.manualHostTrust.v2", + sessionIdentifier: String = UUID().uuidString, + trustDuration: TimeInterval = UserDefaultsMobileManualHostTrustStore.defaultTrustDuration, + now: @escaping @Sendable () -> Date = { Date() } + ) { + self.defaults = defaults + self.key = key + self.sessionIdentifier = sessionIdentifier + self.trustDuration = trustDuration + self.now = now + let storedState = MobileManualHostTrustStoredState( + defaults: defaults, + key: key, + sessionIdentifier: sessionIdentifier + ) + self.persistedExpirations = storedState.persistedExpirations + self.trustedScopes = storedState.trustedScopes + } + + /// Creates a same-session manual-host trust store in a named defaults suite. + /// - Parameters: + /// - suiteName: The `UserDefaults` suite name. + /// - key: The defaults key that stores approved scopes and their expiry times. + /// - sessionIdentifier: The app-session boundary for approvals. + /// - trustDuration: How long a host approval remains valid within this session. + /// - now: Clock source used to evaluate expiry. + public init( + suiteName: String, + key: String = "cmux.mobile.manualHostTrust.v2", + sessionIdentifier: String = UUID().uuidString, + trustDuration: TimeInterval = UserDefaultsMobileManualHostTrustStore.defaultTrustDuration, + now: @escaping @Sendable () -> Date = { Date() } + ) { + let resolvedDefaults: UserDefaults + if let suiteDefaults = UserDefaults(suiteName: suiteName) { + resolvedDefaults = suiteDefaults + } else { + assertionFailure("Failed to resolve UserDefaults suite \(suiteName); falling back to .standard") + manualHostTrustStoreLog.error( + "failed to resolve UserDefaults suite \(suiteName, privacy: .public); falling back to standard defaults" + ) + resolvedDefaults = .standard + } + self.defaults = resolvedDefaults + self.key = key + self.sessionIdentifier = sessionIdentifier + self.trustDuration = trustDuration + self.now = now + let storedState = MobileManualHostTrustStoredState( + defaults: resolvedDefaults, + key: key, + sessionIdentifier: sessionIdentifier + ) + self.persistedExpirations = storedState.persistedExpirations + self.trustedScopes = storedState.trustedScopes + } + + /// Returns whether the given host/port/account scope is already trusted and unexpired. + /// - Parameter scope: The scope to look up. + public func isTrusted(_ scope: MobileManualHostTrustScope) async -> Bool { + guard let expiresAt = trustedScopes[scope] else { + return false + } + guard expiresAt > now().timeIntervalSince1970 else { + trustedScopes.removeValue(forKey: scope) + persistedExpirations.removeValue(forKey: sessionStorageKey(for: scope)) + defaults.set(persistedExpirations, forKey: key) + return false + } + return true + } + + /// Persists trust for exactly the given host/port/account scope until its expiry time. + /// - Parameter scope: The scope to approve. + public func trust(_ scope: MobileManualHostTrustScope) async { + guard !Task.isCancelled else { return } + let currentTime = now().timeIntervalSince1970 + persistedExpirations = persistedExpirations.filter { _, expiresAt in + expiresAt > currentTime + } + trustedScopes = trustedScopes.filter { _, expiresAt in + expiresAt > currentTime + } + let expiresAt = currentTime + trustDuration + trustedScopes[scope] = expiresAt + persistedExpirations[sessionStorageKey(for: scope)] = expiresAt + defaults.set(persistedExpirations, forKey: key) + } + + /// Returns the recorded absolute expiry so the connection owner can queue + /// reapproval even when no further RPC happens after the deadline. + public func expirationDate(for scope: MobileManualHostTrustScope) async -> Date? { + trustedScopes[scope].map(Date.init(timeIntervalSince1970:)) + } + + /// Removes every stored approval. + public func removeAll() async { + persistedExpirations.removeAll() + trustedScopes.removeAll() + defaults.removeObject(forKey: key) + } + + private func sessionStorageKey(for scope: MobileManualHostTrustScope) -> String { + [ + sessionIdentifier.mobileManualHostTrustStorageEscaped, + scope.storageKey, + ].joined(separator: "|") + } +} diff --git a/Packages/iOS/CmuxMobileShellModel/Tests/CmuxMobileShellModelTests/MobileShellRouteAuthPolicyTests.swift b/Packages/iOS/CmuxMobileShellModel/Tests/CmuxMobileShellModelTests/MobileShellRouteAuthPolicyTests.swift index 834e60902beb..013ee66c2b66 100644 --- a/Packages/iOS/CmuxMobileShellModel/Tests/CmuxMobileShellModelTests/MobileShellRouteAuthPolicyTests.swift +++ b/Packages/iOS/CmuxMobileShellModel/Tests/CmuxMobileShellModelTests/MobileShellRouteAuthPolicyTests.swift @@ -40,16 +40,16 @@ import Testing priority: 0 ) - #expect(MobileShellRouteAuthPolicy.routeIsLoopback(loopbackIP)) - #expect(MobileShellRouteAuthPolicy.routeIsLoopback(localhost)) - #expect(MobileShellRouteAuthPolicy.routeIsLoopback(ipv6Loopback)) - #expect(MobileShellRouteAuthPolicy.routeIsLoopback(loopbackOnNetworkKind)) - #expect(!MobileShellRouteAuthPolicy.routeIsLoopback(pretendLoopback)) - #expect(!MobileShellRouteAuthPolicy.routeIsLoopback(tailscaleIP)) - #expect(!MobileShellRouteAuthPolicy.routeIsLoopback(irohPeer)) + #expect(MobileShellRouteAuthPolicy().routeIsLoopback(loopbackIP)) + #expect(MobileShellRouteAuthPolicy().routeIsLoopback(localhost)) + #expect(MobileShellRouteAuthPolicy().routeIsLoopback(ipv6Loopback)) + #expect(MobileShellRouteAuthPolicy().routeIsLoopback(loopbackOnNetworkKind)) + #expect(!MobileShellRouteAuthPolicy().routeIsLoopback(pretendLoopback)) + #expect(!MobileShellRouteAuthPolicy().routeIsLoopback(tailscaleIP)) + #expect(!MobileShellRouteAuthPolicy().routeIsLoopback(irohPeer)) } - @Test func allowsStackAuthOnlyForLoopbackRoutes() throws { + @Test func allowsStackAuthOnlyForLoopbackOrApprovedManualHostRoutes() throws { let loopback = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: CmxMobileDefaults.defaultHostPort) let tailscaleIP = try hostPortRoute(kind: .tailscale, host: "100.71.210.41", port: CmxMobileDefaults.defaultHostPort) let tailscaleIPv6 = try hostPortRoute( @@ -85,37 +85,230 @@ import Testing ), priority: 0 ) - #expect(MobileShellRouteAuthPolicy.manualRouteKind(for: "127.0.0.1") == .debugLoopback) - #expect(MobileShellRouteAuthPolicy.manualRouteKind(for: "127.attacker.example") == .tailscale) - - // Loopback never leaves the device and may carry the Stack bearer token. - #expect(MobileShellRouteAuthPolicy.routeAllowsStackAuth(loopback)) - - // A numeric Tailscale address and an anonymous utun path do not prove - // which VPN owns that path or which peer accepted plaintext TCP. - #expect(!MobileShellRouteAuthPolicy.routeAllowsStackAuth(tailscaleIP)) - #expect(!MobileShellRouteAuthPolicy.routeAllowsStackAuth(tailscaleIPv6)) - - // Iroh's session context authenticates RPC out of band. The Stack - // bearer token must never be sent to the peer or any path hint. - #expect(!MobileShellRouteAuthPolicy.routeAllowsStackAuth(irohPeer)) - - // Plaintext-TCP routes must NOT carry the Stack bearer token: a `.tailscale` - // route to a private-LAN IP or a `.local`/Bonjour host is dialed over - // unencrypted TCP, so it is excluded from the Stack-auth-allowed set. - #expect(!MobileShellRouteAuthPolicy.routeAllowsStackAuth(lanIP)) - #expect(!MobileShellRouteAuthPolicy.routeAllowsStackAuth(localDNS)) - // MagicDNS text is not a transport proof. The connection factory must - // receive a canonical numeric Tailscale peer so DNS substitution cannot - // redirect the plaintext bearer before the Mac authenticates. - #expect(!MobileShellRouteAuthPolicy.routeAllowsStackAuth(tailscaleMagicDNS)) - #expect(!MobileShellRouteAuthPolicy.routeAllowsStackAuth(pretendLoopback)) - - #expect(!MobileShellRouteAuthPolicy.manualHostNeedsTrustWarning("127.0.0.1")) - #expect(MobileShellRouteAuthPolicy.manualHostNeedsTrustWarning("100.71.210.41")) - #expect(MobileShellRouteAuthPolicy.manualHostNeedsTrustWarning("work-mac.tailnet.ts.net")) - #expect(MobileShellRouteAuthPolicy.manualHostNeedsTrustWarning("192.168.1.77")) - #expect(MobileShellRouteAuthPolicy.manualHostNeedsTrustWarning("devbox.local")) + + let manualHostRoute = try hostPortRoute(kind: .manualHost, host: "192.168.1.77", port: CmxMobileDefaults.defaultHostPort) + let manualLoopbackAlias = try hostPortRoute(kind: .manualHost, host: "127.1", port: CmxMobileDefaults.defaultHostPort) + let manualUnspecifiedIPv4 = try hostPortRoute(kind: .manualHost, host: "0.0.0.0", port: CmxMobileDefaults.defaultHostPort) + let manualHexLoopback = try hostPortRoute(kind: .manualHost, host: "0x7f.0.0.1", port: CmxMobileDefaults.defaultHostPort) + + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "127.0.0.1") == .debugLoopback) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "127.1") == .debugLoopback) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "0.0.0.0") == .debugLoopback) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "0x7f.0.0.1") == .debugLoopback) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "[::1]") == .debugLoopback) + #expect(MobileShellRouteAuthPolicy().manualRouteKind( + for: "127.1", + allowsDebugLoopback: false + ) == .manualHost) + #expect(MobileShellRouteAuthPolicy().manualRouteKind( + for: "0.0.0.0", + allowsDebugLoopback: false + ) == .manualHost) + #expect(MobileShellRouteAuthPolicy().manualRouteKind( + for: "0x7f.0.0.1", + allowsDebugLoopback: false + ) == .manualHost) + #expect(MobileShellRouteAuthPolicy().manualRouteKind( + for: "[::1]", + allowsDebugLoopback: false + ) == .manualHost) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "100.71.210.41") == .manualHost) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "work-mac.tailnet.ts.net") == .manualHost) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "127.attacker.example") == .manualHost) + #expect(MobileShellRouteAuthPolicy().manualRouteKind(for: "https://bad.example") == nil) + + // Encrypted / loopback channels and explicitly approved manual hosts may + // carry the Stack bearer token. + #expect(MobileShellRouteAuthPolicy().routeAllowsStackAuth(loopback)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(tailscaleMagicDNS)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(tailscaleIP)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(tailscaleIPv6)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(irohPeer)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(manualHostRoute)) + #expect(MobileShellRouteAuthPolicy().routeAllowsStackAuth(manualHostRoute, manualHostTrusted: true)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(manualLoopbackAlias, manualHostTrusted: true)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(manualUnspecifiedIPv4, manualHostTrusted: true)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(manualHexLoopback, manualHostTrusted: true)) + + // Plaintext-TCP routes must NOT carry the Stack bearer token by default: + // a `.tailscale` route to a private-LAN IP or a `.local`/Bonjour host is + // dialed over unencrypted TCP, so it is excluded from the Stack-auth set. + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(lanIP)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(localDNS)) + #expect(!MobileShellRouteAuthPolicy().routeAllowsStackAuth(pretendLoopback)) + #expect(!MobileShellRouteAuthPolicy().routeRequiresManualHostTrust(manualLoopbackAlias)) + + #expect(!MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("127.0.0.1")) + #expect(!MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("127.1")) + #expect(!MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("0.0.0.0")) + #expect(!MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("0x7f.0.0.1")) + #expect(MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning( + "127.1", + allowsDebugLoopback: false + )) + #expect(MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning( + "0.0.0.0", + allowsDebugLoopback: false + )) + #expect(MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning( + "0x7f.0.0.1", + allowsDebugLoopback: false + )) + #expect(MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("100.71.210.41")) + #expect(MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("work-mac.tailnet.ts.net")) + #expect(MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("192.168.1.77")) + #expect(MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning("devbox.local")) + } + + @Test func manualHostTrustScopeIsHostPortAndAccountScoped() async throws { + let store = InMemoryMobileManualHostTrustStore() + let approved = try #require(MobileManualHostTrustScope( + host: "Studio-Mac.local", + port: 58465, + stackUserID: "user-a" + )) + let sameHostDifferentCase = try #require(MobileManualHostTrustScope( + host: "studio-mac.local", + port: 58465, + stackUserID: "user-a" + )) + let differentPort = try #require(MobileManualHostTrustScope( + host: "studio-mac.local", + port: 58466, + stackUserID: "user-a" + )) + let differentAccount = try #require(MobileManualHostTrustScope( + host: "studio-mac.local", + port: 58465, + stackUserID: "user-b" + )) + let normalizedIPv6 = try #require(MobileManualHostTrustScope( + host: "fd00::12", + port: 58465, + stackUserID: "user-a" + )) + let bracketedIPv6 = try #require(MobileManualHostTrustScope( + host: "[fd00::12]", + port: 58465, + stackUserID: "user-a" + )) + let ipv4MappedIPv6 = try #require(MobileManualHostTrustScope( + host: "::ffff:192.168.0.1", + port: 58465, + stackUserID: "user-a" + )) + let bracketedIPv4MappedIPv6 = try #require(MobileManualHostTrustScope( + host: "[::ffff:192.168.0.1]", + port: 58465, + stackUserID: "user-a" + )) + + #expect(await store.isTrusted(approved) == false) + await store.trust(approved) + await store.trust(normalizedIPv6) + await store.trust(ipv4MappedIPv6) + + #expect(await store.isTrusted(sameHostDifferentCase)) + #expect(await store.isTrusted(bracketedIPv6)) + #expect(await store.isTrusted(bracketedIPv4MappedIPv6)) + #expect(await store.isTrusted(differentPort) == false) + #expect(await store.isTrusted(differentAccount) == false) + } + + @Test func manualHostTrustScopeRequiresConcreteAccount() { + #expect(MobileManualHostTrustScope( + host: "studio-mac.local", + port: 58_465, + stackUserID: nil + ) == nil) + #expect(MobileManualHostTrustScope( + host: "studio-mac.local", + port: 58_465, + stackUserID: " " + ) == nil) + } + + @Test func userDefaultsManualHostTrustIsSessionScopedAndExpires() async throws { + let suiteName = "cmux-manual-host-trust-\(UUID().uuidString)" + defer { + UserDefaults(suiteName: suiteName)?.removePersistentDomain(forName: suiteName) + } + let scope = try #require(MobileManualHostTrustScope( + host: "studio-mac.local", + port: 58465, + stackUserID: "user-a" + )) + let key = "manual-host-trust" + let writer = UserDefaultsMobileManualHostTrustStore( + suiteName: suiteName, + key: key, + sessionIdentifier: "session-a", + trustDuration: 60, + now: { Date(timeIntervalSince1970: 1_000) } + ) + await writer.trust(scope) + + let stillValidReader = UserDefaultsMobileManualHostTrustStore( + suiteName: suiteName, + key: key, + sessionIdentifier: "session-a", + trustDuration: 60, + now: { Date(timeIntervalSince1970: 1_059) } + ) + let differentSessionReader = UserDefaultsMobileManualHostTrustStore( + suiteName: suiteName, + key: key, + sessionIdentifier: "session-b", + trustDuration: 60, + now: { Date(timeIntervalSince1970: 1_059) } + ) + let expiredReader = UserDefaultsMobileManualHostTrustStore( + suiteName: suiteName, + key: key, + sessionIdentifier: "session-a", + trustDuration: 60, + now: { Date(timeIntervalSince1970: 1_061) } + ) + + #expect(await stillValidReader.isTrusted(scope)) + #expect(await differentSessionReader.isTrusted(scope) == false) + #expect(await expiredReader.isTrusted(scope) == false) + } + + @Test func userDefaultsManualHostTrustUsesItsInitializedCacheForValidation() async throws { + let suiteName = "cmux-manual-host-trust-cache-\(UUID().uuidString)" + defer { UserDefaults(suiteName: suiteName)?.removePersistentDomain(forName: suiteName) } + let scope = try #require(MobileManualHostTrustScope( + host: "studio-mac.local", + port: 58_465, + stackUserID: "user-a" + )) + let key = "manual-host-trust" + let store = UserDefaultsMobileManualHostTrustStore( + suiteName: suiteName, + key: key, + sessionIdentifier: "session-a", + trustDuration: 60, + now: { Date(timeIntervalSince1970: 1_000) } + ) + await store.trust(scope) + + UserDefaults(suiteName: suiteName)?.removeObject(forKey: key) + + #expect(await store.isTrusted(scope)) + } + + @Test func manualHostTrustWarningFormatsBracketedIPv6Once() throws { + let scope = try #require(MobileManualHostTrustScope( + host: "[fd00::12]", + port: 58465, + stackUserID: "user-a" + )) + + #expect(MobileManualHostTrustWarning(scope: scope).endpoint == "[fd00::12]:58465") + #expect( + MobileManualHostTrustWarning(scope: scope, displayHost: "[fd00::12]").endpoint == "[fd00::12]:58465" + ) } @Test func physicalDeviceRejectsLoopbackTicketsInEveryGrammar() throws { @@ -127,22 +320,22 @@ import Testing let loopbackUnderTailscaleKind = try hostPortRoute(kind: .tailscale, host: "127.0.0.1", port: 56577) let tailscale = try hostPortRoute(kind: .tailscale, host: "100.71.210.41", port: 56577) - #expect(MobileShellRouteAuthPolicy.ticketRejectsLoopbackRoutes( + #expect(MobileShellRouteAuthPolicy().ticketRejectsLoopbackRoutes( [loopback], isPhysicalDevice: true )) - #expect(MobileShellRouteAuthPolicy.ticketRejectsLoopbackRoutes( + #expect(MobileShellRouteAuthPolicy().ticketRejectsLoopbackRoutes( [loopbackUnderTailscaleKind], isPhysicalDevice: true )) // One loopback route poisons the ticket even when a real route rides along. - #expect(MobileShellRouteAuthPolicy.ticketRejectsLoopbackRoutes( + #expect(MobileShellRouteAuthPolicy().ticketRejectsLoopbackRoutes( [tailscale, loopback], isPhysicalDevice: true )) - #expect(!MobileShellRouteAuthPolicy.ticketRejectsLoopbackRoutes( + #expect(!MobileShellRouteAuthPolicy().ticketRejectsLoopbackRoutes( [tailscale], isPhysicalDevice: true )) // The simulator flow legitimately pairs over loopback (127.0.0.1 IS // the host Mac there), so the policy never fires off-device. - #expect(!MobileShellRouteAuthPolicy.ticketRejectsLoopbackRoutes( + #expect(!MobileShellRouteAuthPolicy().ticketRejectsLoopbackRoutes( [loopback], isPhysicalDevice: false )) } diff --git a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView+PairingWarnings.swift b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView+PairingWarnings.swift new file mode 100644 index 000000000000..42732c05ee19 --- /dev/null +++ b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView+PairingWarnings.swift @@ -0,0 +1,39 @@ +import CmuxMobileShell +import CmuxMobileShellModel + +extension CMUXMobileRootView { + func showManualHostTrustWarningIfNeeded( + _ warning: MobileManualHostTrustWarning? = nil + ) { + guard warning ?? store.manualHostTrustWarning != nil, + isAuthenticated, + !authManager.isRestoringSession, + !shouldShowOnboarding, + !isShowingAddDeviceSheet else { + return + } + showAddDevice() + } + + func acceptPairingVersionWarning() async { + let result = await store.acceptPairingVersionWarning() + finishPairingPresentation(after: result) + } + + func acceptManualHostTrustWarning() async { + let result = await store.acceptManualHostTrustWarning() + finishPairingPresentation(after: result) + } + + func finishPairingPresentation(after result: MobilePairingURLConnectionResult) { + clearAttachTicketAuthentication(after: result) + switch result { + case .connected: + dismissAddDeviceSheet() + case .needsUserApproval: + showAddDevice() + case .failed, .superseded: + break + } + } +} diff --git a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift index 95826d5c4e04..a83dd0b260fb 100644 --- a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift +++ b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/CMUXMobileRootView.swift @@ -14,7 +14,7 @@ import AppKit struct CMUXMobileRootView: View { @Bindable var store: CMUXMobileShellStore @Environment(\.scenePhase) private var scenePhase - @Environment(AuthCoordinator.self) private var authManager + @Environment(AuthCoordinator.self) var authManager @Environment(\.dogfoodAttachPreparation) private var dogfoodAttachPreparation private let signOutHook: MobileSignOutHook private let startupConnectionCoordinator: MobileStartupConnectionCoordinator @@ -32,7 +32,7 @@ struct CMUXMobileRootView: View { #endif @State private var pendingAttachURL: String? @State private var didAuthenticateWithAttachTicket = false - @State private var isShowingAddDeviceSheet = false + @State var isShowingAddDeviceSheet = false #if os(iOS) @State private var addDeviceSheetDetent: PresentationDetent = .large #endif @@ -136,6 +136,7 @@ struct CMUXMobileRootView: View { // workspace list's initial-connection status could never resolve // because nothing updates `didFinishStoredMacReconnectAttempt`. reconnectStoredMacIfNeeded() + showManualHostTrustWarningIfNeeded() } #if os(iOS) // A notification tap can arrive before the workspace (or terminal) it @@ -155,8 +156,15 @@ struct CMUXMobileRootView: View { store.currentTeamDidChange() } .onChange(of: scenePhase) { _, phase in - guard phase == .active else { store.suspendForegroundRefresh(); return } - store.resumeForegroundRefresh() + switch MobileSceneRefreshAction(scenePhase: phase) { + case .none: + return + case .enterBackground: + store.suspendForegroundRefresh() + return + case .resumeForeground: + store.resumeForegroundRefresh() + } // The user may have toggled Tailscale while we were backgrounded. tailscaleStatusMonitor?.refresh() // Re-check the Stack session on resume so one that died while @@ -176,7 +184,8 @@ struct CMUXMobileRootView: View { return } Task { - await store.connectPairingURL(rawURL) + let result = await store.connectPairingURLResult(rawURL) + finishPairingPresentation(after: result) } } .onChange(of: isAuthenticated) { _, isAuthenticated in @@ -185,10 +194,15 @@ struct CMUXMobileRootView: View { startupConnectionCoordinator.reset() return } - if consumePendingURLIfReady() { - return + if !consumePendingURLIfReady() { + showManualHostTrustWarningIfNeeded() + reconnectStoredMacIfNeeded() } - reconnectStoredMacIfNeeded() + } + .onChange(of: authManager.currentUser?.id) { _, _ in + // Stack Auth can replace one authenticated user with another without + // toggling `isAuthenticated`; resynchronize the shell on that edge. + syncShellAuthentication(isAuthenticated) } .onChange(of: authManager.isRestoringSession) { _, isRestoringSession in syncShellAuthentication(isAuthenticated, isRestoringSession: isRestoringSession) @@ -196,6 +210,7 @@ struct CMUXMobileRootView: View { if consumePendingURLIfReady() { return } + showManualHostTrustWarningIfNeeded() reconnectStoredMacIfNeeded() } .onChange(of: store.connectionState) { _, connectionState in @@ -205,6 +220,9 @@ struct CMUXMobileRootView: View { clearAttachTicketAuthenticationIfNeeded() } } + .onChange(of: store.manualHostTrustWarning) { _, warning in + showManualHostTrustWarningIfNeeded(warning) + } .onChange(of: store.hasActiveUnexpiredAttachTicket) { _, hasActiveUnexpiredAttachTicket in if !hasActiveUnexpiredAttachTicket { clearAttachTicketAuthenticationIfNeeded() @@ -279,18 +297,16 @@ struct CMUXMobileRootView: View { connectionError: store.connectionError, connectionErrorGuidance: store.connectionErrorGuidance, versionWarning: store.pairingVersionWarning, + manualHostTrustWarning: store.manualHostTrustWarning, connectPairingCode: { - await store.connectPairingInput() - }, - acceptVersionWarning: { - let result = await store.acceptPairingVersionWarning() - clearAttachTicketAuthentication(after: result) - if result == .connected { - dismissAddDeviceSheet() - } + let result = await store.connectPairingInput() + finishPairingPresentation(after: result) }, + acceptVersionWarning: acceptPairingVersionWarning, + acceptManualHostTrustWarning: acceptManualHostTrustWarning, connectManualHost: { name, host, port in - await store.connectManualHost(name: name, host: host, port: port) + let result = await store.connectManualHost(name: name, host: host, port: port) + finishPairingPresentation(after: result) }, cancelPairing: cancelPairing, cancel: dismissAddDeviceSheet @@ -319,7 +335,7 @@ struct CMUXMobileRootView: View { /// Whether the one-time first-run onboarding should be presented. Always /// `false` off iOS (onboarding is iOS-only). - private var shouldShowOnboarding: Bool { + var shouldShowOnboarding: Bool { #if os(iOS) return MobileOnboardingGate.shouldShowOnboarding( hasSeenOnboarding: hasSeenOnboarding @@ -345,10 +361,10 @@ struct CMUXMobileRootView: View { private func completeOnboarding() { onboardingStore.markSeen() hasSeenOnboarding = true + showManualHostTrustWarningIfNeeded() } #endif - - private var isAuthenticated: Bool { + var isAuthenticated: Bool { MobileRootAuthGate.isAuthenticated( stackAuthenticated: authManager.isAuthenticated, attachTicketAuthenticated: hasActiveAttachTicketAuthentication @@ -404,7 +420,7 @@ struct CMUXMobileRootView: View { } } - private func showAddDevice() { + func showAddDevice() { #if os(iOS) addDeviceSheetDetent = .large #endif @@ -420,10 +436,7 @@ struct CMUXMobileRootView: View { syncShellAuthentication(true) Task { let result = await store.connectPairingURLResult(rawURL) - if result == .needsUserApproval { - isShowingAddDeviceSheet = true - } - clearAttachTicketAuthentication(after: result) + finishPairingPresentation(after: result) } } @@ -439,7 +452,8 @@ struct CMUXMobileRootView: View { guard isAuthenticated else { return false } pendingAttachURL = nil Task { - await store.connectPairingURL(rawURL) + let result = await store.connectPairingURLResult(rawURL) + finishPairingPresentation(after: result) } return true } @@ -454,16 +468,16 @@ struct CMUXMobileRootView: View { clearAttachTicketAuthenticationIfNeeded() } - private func dismissAddDeviceSheet() { + func dismissAddDeviceSheet() { isShowingAddDeviceSheet = false - if store.pairingVersionWarning != nil { + if store.pairingVersionWarning != nil || store.manualHostTrustWarning != nil { cancelPairing() } else { clearAttachTicketAuthenticationIfNeeded() } } - private func clearAttachTicketAuthentication(after result: MobilePairingURLConnectionResult) { + func clearAttachTicketAuthentication(after result: MobilePairingURLConnectionResult) { guard MobileRootAuthGate.shouldClearAttachTicketAuthentication( pairingResult: result, connectionState: store.connectionState, @@ -523,7 +537,8 @@ struct CMUXMobileRootView: View { } Task { await dogfoodAttachPreparation.run { - await store.connectPairingURL(attachURL) + let result = await store.connectPairingURLResult(attachURL) + finishPairingPresentation(after: result) } startupConnectionCoordinator.finishInjectedAttach(startupAttempt) } diff --git a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/MobileSceneRefreshAction.swift b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/MobileSceneRefreshAction.swift new file mode 100644 index 000000000000..e34c45bbbdad --- /dev/null +++ b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/MobileSceneRefreshAction.swift @@ -0,0 +1,16 @@ +import SwiftUI + +nonisolated enum MobileSceneRefreshAction: Equatable { + case none + case enterBackground + case resumeForeground + + init(scenePhase: ScenePhase) { + self = switch scenePhase { + case .active: .resumeForeground + case .background: .enterBackground + case .inactive: .none + @unknown default: .none + } + } +} diff --git a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/PairingView.swift b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/PairingView.swift index aa2cddb5acc9..cb0f9edf2e3a 100644 --- a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/PairingView.swift +++ b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/PairingView.swift @@ -19,8 +19,10 @@ struct PairingView: View { /// when the headline is already the full instruction. let connectionErrorGuidance: String? let versionWarning: String? + let manualHostTrustWarning: MobileManualHostTrustWarning? let connectPairingCode: () async -> Void let acceptVersionWarning: () async -> Void + let acceptManualHostTrustWarning: () async -> Void let connectManualHost: (String, String, Int) async -> Void let cancelPairing: () -> Void let cancel: () -> Void @@ -167,6 +169,44 @@ struct PairingView: View { } } + if let manualHostTrustWarning { + Section { + VStack(alignment: .leading, spacing: 10) { + Label { + Text(L10n.string("mobile.pairing.manualHostTrustTitle", defaultValue: "Trust manual host?")) + } icon: { + Image(systemName: "exclamationmark.triangle.fill") + } + .font(.headline) + .foregroundStyle(.orange) + + Text(manualHostTrustWarning.endpoint) + .font(.subheadline) + .foregroundStyle(.primary) + .textSelection(.enabled) + .accessibilityIdentifier("MobileManualHostTrustEndpoint") + + Text(L10n.string( + "mobile.pairing.manualHostTrustBody", + defaultValue: "cmux does not encrypt this direct connection end to end. Account credentials are sent through it and can be intercepted on an untrusted network. Trust this host and port only on a network you control." + )) + .font(.footnote) + .foregroundStyle(.secondary) + .accessibilityIdentifier("MobileManualHostTrustWarning") + + Button(role: .destructive) { + startPairingTask { + await acceptManualHostTrustWarning() + } + } label: { + Text(L10n.string("mobile.pairing.manualHostTrustContinue", defaultValue: "Trust and Pair")) + } + .disabled(isPairing) + .accessibilityIdentifier("MobileManualHostTrustContinueButton") + } + } + } + if let errorText { Section { VStack(alignment: .leading, spacing: 8) { @@ -247,17 +287,27 @@ struct PairingView: View { private var cancelButton: some View { Button { - pairingTask?.cancel() - pairingTaskID = nil - pairingTask = nil - isPairing = false - cancelPairing() - cancel() + cancelAndDismiss() } label: { Text(L10n.string("mobile.common.cancel", defaultValue: "Cancel")) } } + func cancelAndDismiss() { + let shouldCancelStoreAttempt = pairingTask != nil + || versionWarning != nil + || manualHostTrustWarning != nil + || connectionError != nil + pairingTask?.cancel() + pairingTaskID = nil + pairingTask = nil + isPairing = false + if shouldCancelStoreAttempt { + cancelPairing() + } + cancel() + } + private var errorText: String? { validationError ?? connectionError } @@ -274,7 +324,7 @@ struct PairingView: View { let trimmedHost = host.trimmingCharacters(in: .whitespacesAndNewlines) guard !trimmedHost.isEmpty, !CmxPairingURLScheme.hasPairingScheme(trimmedHost), - MobileShellRouteAuthPolicy.manualHostNeedsTrustWarning(trimmedHost) else { + MobileShellRouteAuthPolicy().manualHostNeedsTrustWarning(trimmedHost) else { return nil } return L10n.string( @@ -304,8 +354,11 @@ struct PairingView: View { return String(format: format, email) } - private func pair() { + func pair() { validationError = nil + if versionWarning != nil || manualHostTrustWarning != nil { + cancelPairing() + } let trimmedHost = host.trimmingCharacters(in: .whitespacesAndNewlines) guard !trimmedHost.isEmpty else { validationError = L10n.string("mobile.addDevice.invalidHost", defaultValue: "Enter a host or IP address, without spaces or URL paths.") @@ -318,7 +371,7 @@ struct PairingView: View { } return } - guard MobileShellRouteAuthPolicy.normalizedManualHost(trimmedHost) != nil else { + guard MobileShellRouteAuthPolicy().normalizedManualHost(trimmedHost) != nil else { validationError = L10n.string("mobile.addDevice.invalidHost", defaultValue: "Enter a host or IP address, without spaces or URL paths.") return } diff --git a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceDetailView.swift b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceDetailView.swift index b9bae4de0821..85977def2e0f 100644 --- a/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceDetailView.swift +++ b/Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceDetailView.swift @@ -13,7 +13,6 @@ import SwiftUI #elseif os(macOS) import AppKit #endif - struct WorkspaceDetailView: View { let host: String let connectionStatus: MobileMacConnectionStatus diff --git a/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/MobileRootAuthGateShellSyncTests.swift b/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/MobileRootAuthGateShellSyncTests.swift new file mode 100644 index 000000000000..436f669c462b --- /dev/null +++ b/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/MobileRootAuthGateShellSyncTests.swift @@ -0,0 +1,49 @@ +import CmuxMobileShell +import CmuxMobileShellModel +import CmuxMobileWorkspace +import Foundation +import Testing +@testable import CmuxMobileShellUI + +@MainActor +@Suite struct MobileRootAuthGateShellSyncTests { + @Test func authenticatedUserReplacementClearsPreviousAccountsShellState() { + let identity = WorkspaceMacSelectionIdentityProvider(userID: "user-a") + let privateWorkspace = MobileWorkspacePreview( + id: "user-a-private-workspace", + name: "User A Private Workspace", + terminals: [ + MobileTerminalPreview( + id: "user-a-private-terminal", + name: "Private Terminal" + ), + ] + ) + let defaults = UserDefaults( + suiteName: "MobileRootAuthGateShellSyncTests-\(UUID().uuidString)" + )! + let store = MobileShellComposite( + workspaces: [privateWorkspace], + clientIDRepository: MobileClientIDRepository(defaults: defaults), + identityProvider: identity, + pairingHintDefaults: defaults, + multiMacAggregationDefaults: defaults + ) + MobileRootAuthGate.syncShellAuthentication( + stackAuthenticated: true, + store: store + ) + store.terminalInputText = "user-a-unsent-secret" + + identity.currentUserID = "user-b" + MobileRootAuthGate.syncShellAuthentication( + stackAuthenticated: true, + store: store + ) + + #expect(store.terminalInputText.isEmpty) + #expect(!store.workspaces.contains(where: { $0.id == privateWorkspace.id })) + #expect(store.selectedWorkspaceID != privateWorkspace.id) + #expect(store.selectedTerminalID != privateWorkspace.terminals.first?.id) + } +} diff --git a/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/MobileSceneRefreshActionTests.swift b/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/MobileSceneRefreshActionTests.swift new file mode 100644 index 000000000000..367f9b5bc242 --- /dev/null +++ b/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/MobileSceneRefreshActionTests.swift @@ -0,0 +1,11 @@ +import SwiftUI +import Testing +@testable import CmuxMobileShellUI + +@Suite struct MobileSceneRefreshActionTests { + @Test func inactiveInterruptionDoesNotBecomeBackgroundTransition() { + #expect(MobileSceneRefreshAction(scenePhase: .inactive) == .none) + #expect(MobileSceneRefreshAction(scenePhase: .background) == .enterBackground) + #expect(MobileSceneRefreshAction(scenePhase: .active) == .resumeForeground) + } +} diff --git a/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/PairingViewPendingApprovalTests.swift b/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/PairingViewPendingApprovalTests.swift new file mode 100644 index 000000000000..63d631db73b9 --- /dev/null +++ b/Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/PairingViewPendingApprovalTests.swift @@ -0,0 +1,85 @@ +import CmuxMobileShellModel +import SwiftUI +import Testing +@testable import CmuxMobileShellUI + +@Suite struct PairingViewPendingApprovalTests { + @MainActor + @Test func pairClearsPendingManualHostApprovalBeforeLocalValidationReturns() { + var cancelCount = 0 + let view = PairingView( + pairingCode: .constant(""), + connectionError: nil, + connectionErrorGuidance: nil, + versionWarning: nil, + manualHostTrustWarning: warning(), + connectPairingCode: {}, + acceptVersionWarning: {}, + acceptManualHostTrustWarning: {}, + connectManualHost: { _, _, _ in }, + cancelPairing: { cancelCount += 1 }, + cancel: {} + ) + + view.pair() + + #expect(cancelCount == 1) + } + + @MainActor + @Test func idleCancelDismissesWithoutTearingDownStoreConnection() { + var cancelPairingCount = 0 + var dismissCount = 0 + let view = PairingView( + pairingCode: .constant(""), + connectionError: nil, + connectionErrorGuidance: nil, + versionWarning: nil, + manualHostTrustWarning: nil, + connectPairingCode: {}, + acceptVersionWarning: {}, + acceptManualHostTrustWarning: {}, + connectManualHost: { _, _, _ in }, + cancelPairing: { cancelPairingCount += 1 }, + cancel: { dismissCount += 1 } + ) + + view.cancelAndDismiss() + + #expect(cancelPairingCount == 0) + #expect(dismissCount == 1) + } + + @MainActor + @Test func cancelAfterCompletedFailureClearsStoreAttemptBeforeDismiss() { + var cancelPairingCount = 0 + var dismissCount = 0 + let view = PairingView( + pairingCode: .constant(""), + connectionError: "Could not connect", + connectionErrorGuidance: nil, + versionWarning: nil, + manualHostTrustWarning: nil, + connectPairingCode: {}, + acceptVersionWarning: {}, + acceptManualHostTrustWarning: {}, + connectManualHost: { _, _, _ in }, + cancelPairing: { cancelPairingCount += 1 }, + cancel: { dismissCount += 1 } + ) + + view.cancelAndDismiss() + + #expect(cancelPairingCount == 1) + #expect(dismissCount == 1) + } + + private func warning() -> MobileManualHostTrustWarning { + let scope = MobileManualHostTrustScope( + host: "192.168.1.77", + port: 58_465, + stackUserID: "user_123" + )! + return MobileManualHostTrustWarning(scope: scope) + } +} diff --git a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransport.swift b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransport.swift index 1545be00a4c7..afaa0fb18edf 100644 --- a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransport.swift +++ b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransport.swift @@ -35,8 +35,9 @@ public enum CmxNetworkByteTransportError: Error, Equatable, Sendable { case unsupportedRouteKind(CmxAttachTransportKind) /// The endpoint is not a host/port endpoint this transport can dial. case unsupportedEndpoint(CmxAttachEndpoint) - /// A Tailscale route reached the route-only factory seam without an - /// authorization context. Raw Tailscale TCP is never constructed there. + /// A credential-capable plaintext route reached a route-only seam without + /// an authorization context. Raw Tailscale or manual-host TCP is never + /// constructed there. case authorizationIntentRequired /// The request's authorization mode cannot be served by plaintext TCP. case unsupportedAuthorizationMode(CmxTransportAuthorizationMode) @@ -137,7 +138,7 @@ public actor CmxNetworkByteTransport: CmxByteTransport { connectTimeoutNanoseconds: UInt64 = CmxNetworkByteTransport.defaultConnectTimeoutNanoseconds ) throws { try route.validate() - guard route.kind != .tailscale else { + guard route.kind != .tailscale, route.kind != .manualHost else { throw CmxNetworkByteTransportError.authorizationIntentRequired } guard case let .hostPort(host, port) = route.endpoint else { diff --git a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransportFactory.swift b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransportFactory.swift index de36ed730443..f71a6b4b6567 100644 --- a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransportFactory.swift +++ b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransportFactory.swift @@ -7,7 +7,7 @@ public struct CmxNetworkByteTransportFactory: CmxRouteAwareByteTransportFactory public var connectTimeoutNanoseconds: UInt64 public init( - supportedKinds: [CmxAttachTransportKind] = [.tailscale, .debugLoopback], + supportedKinds: [CmxAttachTransportKind] = [.tailscale, .manualHost, .debugLoopback], maximumReceiveLength: Int = CmxNetworkByteTransport.defaultMaximumReceiveLength, connectTimeoutNanoseconds: UInt64 = CmxNetworkByteTransport.defaultConnectTimeoutNanoseconds ) { @@ -24,7 +24,7 @@ public struct CmxNetworkByteTransportFactory: CmxRouteAwareByteTransportFactory guard case let .hostPort(host, port) = route.endpoint else { throw CmxNetworkByteTransportError.unsupportedEndpoint(route.endpoint) } - guard route.kind != .tailscale else { + guard route.kind != .tailscale, route.kind != .manualHost else { throw CmxNetworkByteTransportError.authorizationIntentRequired } return try CmxNetworkByteTransport( @@ -60,6 +60,13 @@ public struct CmxNetworkByteTransportFactory: CmxRouteAwareByteTransportFactory // It cannot prove that the tunnel belongs to Tailscale's authenticated // control plane, so plaintext TCP must never carry a Stack bearer. throw CmxNetworkByteTransportError.tailscaleAuthorizationUnavailable + case .manualHost: + return try CmxNetworkByteTransport( + host: host, + port: port, + maximumReceiveLength: maximumReceiveLength, + connectTimeoutNanoseconds: connectTimeoutNanoseconds + ) case .debugLoopback: guard CmxLoopbackHost().matches(route) else { throw CmxNetworkByteTransportError.tailscaleAuthorizationUnavailable diff --git a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/NetworkReachability.swift b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/NetworkReachability.swift index b2c8589c5028..389c9c1b557e 100644 --- a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/NetworkReachability.swift +++ b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/NetworkReachability.swift @@ -31,7 +31,7 @@ public final class NetworkReachability { /// Convenience inverse of ``isOnline``. public var isOffline: Bool { !isOnline } - /// Monotonic counter that increments on each meaningful path change. + /// Monotonic counter that increments on each post-initial path update. /// /// Observe it via `withObservationTracking` to drive reconnect/resync when /// the underlying network moves out from under a live connection. It mirrors diff --git a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityProviding.swift b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityProviding.swift index d5edb49de54c..b8e505319e98 100644 --- a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityProviding.swift +++ b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityProviding.swift @@ -3,10 +3,11 @@ import Foundation /// A network-reachability seam other layers depend on instead of a singleton. /// /// Conformers report whether the system currently has a satisfied network path -/// and emit a value on every *meaningful* path change (regaining connectivity -/// after being offline, or the primary interface switching while online), so a -/// live connection can resync or reconnect when the network moves out from -/// under it. +/// and emit a value on every path update after the initial snapshot, so a live +/// connection can resync or reconnect when the network moves out from under it. +/// This deliberately includes updates that keep the same primary interface +/// type: Wi-Fi roaming can move to a different LAN without a `.wifi`→cellular +/// transition. /// /// The concrete ``ReachabilityService`` is constructed once at the app /// composition root and injected as `any ReachabilityProviding`. @@ -14,12 +15,11 @@ public protocol ReachabilityProviding: Sendable { /// Whether the system currently has a satisfied network path. var isOnline: Bool { get async } - /// A stream that yields once per meaningful path change. + /// A stream that yields once per path update after the initial snapshot. /// - /// Each element marks a change worth recovering from: connectivity returning - /// after an offline window, or the primary interface type changing (for - /// example Wi-Fi to cellular) while online. It deliberately does not emit on - /// the first path delivery, so observers don't recover spuriously at startup. + /// Same-interface updates are included so Wi-Fi→Wi-Fi roaming invalidates + /// network-scoped trust. The first path delivery is omitted so observers do + /// not recover spuriously at startup. /// - Returns: An `AsyncStream` that completes when the provider is torn down. func pathChanges() -> AsyncStream } diff --git a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityService.swift b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityService.swift index a3616ae28a3a..e1cc56e45b24 100644 --- a/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityService.swift +++ b/Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/ReachabilityService.swift @@ -4,9 +4,8 @@ import Foundation /// A de-singletonized network-reachability monitor backed by `NWPathMonitor`. /// /// Owns the path monitor and its callback queue, tracks the current online -/// state and primary interface type as actor-isolated state, and fans -/// meaningful path changes out to any number of subscribers through -/// ``pathChanges()``. +/// state as actor-isolated state, and fans post-initial path updates out to any +/// number of subscribers through ``pathChanges()``. /// /// Construct it once at the app composition root and inject it as /// `any ReachabilityProviding`: @@ -22,7 +21,6 @@ public actor ReachabilityService: ReachabilityProviding { private let queue: DispatchQueue private var started = false private var online = true - private var lastInterfaceType: NWInterface.InterfaceType? private var nextSubscriptionID = 0 private var subscribers: [Int: AsyncStream.Continuation] = [:] /// Whether `NWPathMonitor` has delivered its first path since `start`. @@ -90,11 +88,13 @@ public actor ReachabilityService: ReachabilityProviding { } } - /// A stream that yields once per meaningful path change. + /// A stream that yields once per path update after the initial snapshot. /// - Returns: An `AsyncStream` removed from the registry when its consumer /// stops iterating or the task is cancelled. public nonisolated func pathChanges() -> AsyncStream { - AsyncStream { continuation in + // Recovery only needs the newest pending security boundary; bounding + // the stream prevents callback bursts from queuing unbounded work. + AsyncStream(bufferingPolicy: .bufferingNewest(1)) { continuation in let registration = Task { await self.register(continuation) } continuation.onTermination = { _ in registration.cancel() @@ -103,7 +103,7 @@ public actor ReachabilityService: ReachabilityProviding { } } - private func register(_ continuation: AsyncStream.Continuation) -> Int { + func register(_ continuation: AsyncStream.Continuation) -> Int { startIfNeeded() let id = nextSubscriptionID nextSubscriptionID += 1 @@ -120,20 +120,17 @@ public actor ReachabilityService: ReachabilityProviding { guard !started else { return } started = true monitor.pathUpdateHandler = { [weak self] path in - // Compute Sendable values on the monitor queue; never capture NWPath. + // Compute Sendable state on the monitor queue; never capture NWPath. let isSatisfied = path.status == .satisfied - let primaryType = ReachabilityService.primaryInterfaceType(of: path) - Task { await self?.apply(online: isSatisfied, primaryType: primaryType) } + Task { await self?.apply(online: isSatisfied) } } monitor.start(queue: queue) } - private func apply(online: Bool, primaryType: NWInterface.InterfaceType?) { - let wasOnline = self.online - let previousType = lastInterfaceType + func apply(online: Bool) { + let isInitialPath = !receivedFirstPath self.online = online - if online { lastInterfaceType = primaryType } - if !receivedFirstPath { + if isInitialPath { receivedFirstPath = true for waiter in firstPathWaiters.values { waiter.resume() @@ -141,24 +138,12 @@ public actor ReachabilityService: ReachabilityProviding { firstPathWaiters.removeAll() cancelledFirstPathWaiterIDs.removeAll() } - let regainedOnline = online && !wasOnline - let interfaceChanged = online && previousType != nil && primaryType != previousType - guard regainedOnline || interfaceChanged else { return } + guard !isInitialPath else { return } for continuation in subscribers.values { continuation.yield(()) } } - private nonisolated static func primaryInterfaceType( - of path: NWPath - ) -> NWInterface.InterfaceType? { - for type in [NWInterface.InterfaceType.wifi, .wiredEthernet, .cellular] - where path.usesInterfaceType(type) { - return type - } - return path.availableInterfaces.first?.type - } - deinit { monitor.cancel() for continuation in subscribers.values { diff --git a/Packages/iOS/CmuxMobileTransport/Tests/CmuxMobileTransportTests/ReachabilityServiceTests.swift b/Packages/iOS/CmuxMobileTransport/Tests/CmuxMobileTransportTests/ReachabilityServiceTests.swift index b9120a79890c..d30dc6067260 100644 --- a/Packages/iOS/CmuxMobileTransport/Tests/CmuxMobileTransportTests/ReachabilityServiceTests.swift +++ b/Packages/iOS/CmuxMobileTransport/Tests/CmuxMobileTransportTests/ReachabilityServiceTests.swift @@ -1,4 +1,5 @@ import Foundation +import Network import Testing @testable import CmuxMobileTransport @@ -30,6 +31,32 @@ import Testing _ = await secondTask.value } +@Test func reachabilityServiceEmitsForASecondPathOnTheSameInterface() async { + let service = ReachabilityService() + let (stream, continuation) = AsyncStream.makeStream() + _ = await service.register(continuation) + defer { continuation.finish() } + + await service.apply(online: true) + await service.apply(online: true) + + let emitted = await withTaskGroup(of: Bool.self) { group in + group.addTask { + var iterator = stream.makeAsyncIterator() + return await iterator.next() != nil + } + group.addTask { + // Assertion deadline only; stream delivery is signaled by `apply`. + try? await Task.sleep(for: .milliseconds(100)) + return false + } + let first = await group.next() ?? false + group.cancelAll() + return first + } + #expect(emitted) +} + @Test func transitionalNetworkReachabilityShimMirrorsAServiceOnMainActor() async { let shim = await NetworkReachability(service: ReachabilityService()) diff --git a/Packages/macOS/CmuxSettings/Sources/CmuxSettings/Keys/MobileCatalogSection.swift b/Packages/macOS/CmuxSettings/Sources/CmuxSettings/Keys/MobileCatalogSection.swift index ff939bdd5625..ba2e3e9aa5a2 100644 --- a/Packages/macOS/CmuxSettings/Sources/CmuxSettings/Keys/MobileCatalogSection.swift +++ b/Packages/macOS/CmuxSettings/Sources/CmuxSettings/Keys/MobileCatalogSection.swift @@ -41,6 +41,16 @@ public struct MobileCatalogSection: SettingCatalogSection { userDefaultsKey: "mobile.iOSPairingHost.port" ) + /// Optional LAN IP address or DNS name advertised as an explicit manual + /// mobile pairing route. Empty keeps the default Tailscale-only route + /// advertisement. This exists for subnet-router topologies where the iPhone + /// can reach the Mac's LAN address but the Mac cannot run Tailscale. + public let iOSPairingManualHost = DefaultsKey( + id: "mobile.iOSPairingHost.manualHost", + defaultValue: "", + userDefaultsKey: "mobile.iOSPairingHost.manualHost" + ) + /// Optional override for the name the iOS app shows for this Mac during /// pairing. Empty means use the Mac's name from System Settings /// (`Host.current().localizedName`). Useful when pairing against several diff --git a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Navigation/CuratedSettingEntry+Default.swift b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Navigation/CuratedSettingEntry+Default.swift index 86eae45c6c8e..4b0033b66a95 100644 --- a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Navigation/CuratedSettingEntry+Default.swift +++ b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Navigation/CuratedSettingEntry+Default.swift @@ -199,6 +199,7 @@ extension Array where Element == CuratedSettingEntry { // Mobile .init(section: .mobile, id: "pairDevice", title: "Pair a Device", synonyms: "pair pairing add device qr qr code scan iphone ipad ios mobile tailscale connect onboarding sign in"), .init(section: .mobile, id: "iOSPairingHost", title: "iOS Pairing", synonyms: "ios iphone ipad mobile pairing local network permission sync"), + .init(section: .mobile, id: "iOSPairingManualHost", title: String(localized: "settings.mobile.manualHost", defaultValue: "Manual Host"), synonyms: "mobile.iOSPairingHost.manualHost manual host lan ip dns subnet router tailscale route iphone ipad"), .init(section: .mobile, id: "iOSPairingPort", title: String(localized: "settings.mobile.port", defaultValue: "Pairing Port"), synonyms: "mobile.iOSPairingHost.port ios iphone mobile pairing port tcp listener firewall conflict"), .init(section: .mobile, id: "iOSPairingDisplayName", title: String(localized: "settings.mobile.displayName", defaultValue: "Display Name"), synonyms: "mobile.iOSPairingHost.displayName ios iphone mobile pairing display name mac hostname device label"), .init( diff --git a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/MobilePairingManualHostAdvertisability.swift b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/MobilePairingManualHostAdvertisability.swift new file mode 100644 index 000000000000..bf7631205158 --- /dev/null +++ b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/MobilePairingManualHostAdvertisability.swift @@ -0,0 +1,15 @@ +import CMUXMobileCore +import Foundation + +struct MobilePairingManualHostAdvertisability: Sendable { + func isAdvertisable(_ rawHost: String) -> Bool { + let trimmed = rawHost.trimmingCharacters(in: .whitespacesAndNewlines) + guard !trimmed.isEmpty else { + return true + } + guard let host = CmxManualHost(trimmed) else { + return false + } + return host.isAdvertisable + } +} diff --git a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/MobileSection.swift b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/MobileSection.swift index 1e9c3fbccab5..9f088b6ab2cb 100644 --- a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/MobileSection.swift +++ b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/MobileSection.swift @@ -10,10 +10,13 @@ import SwiftUI public struct MobileSection: View { @State private var iOSPairingHost: DefaultsValueModel @State private var port: DefaultsValueModel + @State private var manualHost: DefaultsValueModel @State private var displayName: DefaultsValueModel @State private var artifactFolderAccess: DefaultsValueModel @State private var status: MobilePairingStatusModel + private let manualHostAdvertisability = MobilePairingManualHostAdvertisability() + /// The user's in-progress port edit, or `nil` when the field should track /// the persisted value. Local so editing does not rebind the listener; only /// the **Apply** button does, after checking the port is free. `nil` lets the @@ -24,6 +27,8 @@ public struct MobileSection: View { @State private var applyResult: MobilePairingPortApplyResult? /// Guards against overlapping Apply taps while a probe is in flight. @State private var isApplying = false + /// User's in-progress manual-host edit. `nil` tracks the persisted setting. + @State private var editedManualHost: String? /// Host bridge: opens the pairing window, applies the port (availability /// checked), and supplies the live pairing status and default display name. @@ -45,6 +50,7 @@ public struct MobileSection: View { ) { _iOSPairingHost = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.mobile.iOSPairingHost)) _port = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.mobile.iOSPairingPort)) + _manualHost = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.mobile.iOSPairingManualHost)) _displayName = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.mobile.iOSPairingDisplayName)) _artifactFolderAccess = State(initialValue: DefaultsValueModel( store: defaultsStore, @@ -70,6 +76,26 @@ public struct MobileSection: View { (1...65535).contains(draftPort) } + private var trimmedManualHost: String { + draftManualHost.trimmingCharacters(in: .whitespacesAndNewlines) + } + + private var draftManualHost: String { + editedManualHost ?? manualHost.current + } + + private var persistedManualHost: String { + manualHost.current.trimmingCharacters(in: .whitespacesAndNewlines) + } + + private var isManualHostValid: Bool { + manualHostAdvertisability.isAdvertisable(trimmedManualHost) + } + + private var canApplyManualHost: Bool { + isManualHostValid && trimmedManualHost != persistedManualHost + } + /// The Mobile settings section content. public var body: some View { Group { @@ -82,6 +108,9 @@ public struct MobileSection: View { portRow boundPortStatusRow SettingsCardDivider() + manualHostRow + manualHostStatusRow + SettingsCardDivider() displayNameRow SettingsCardDivider() artifactFolderAccessRow @@ -103,6 +132,7 @@ public struct MobileSection: View { iOSPairingHost, port, displayName, + manualHost, artifactFolderAccess, status, ] @@ -262,6 +292,56 @@ public struct MobileSection: View { } } + @ViewBuilder + private var manualHostRow: some View { + SettingsCardRow( + configurationReview: .settingsOnly, + searchAnchorID: "setting:mobile:iOSPairingManualHost", + String(localized: "settings.mobile.manualHost", defaultValue: "Manual Host"), + subtitle: String( + localized: "settings.mobile.manualHost.subtitle", + defaultValue: "Optional LAN IP or DNS host to advertise when this Mac cannot run Tailscale." + ), + controlWidth: Self.columnWidth + 68 + ) { + HStack(spacing: 8) { + TextField( + String(localized: "settings.mobile.manualHost.placeholder", defaultValue: "192.168.1.23 or mac.local"), + text: Binding(get: { draftManualHost }, set: { editedManualHost = $0 }) + ) + .textFieldStyle(.roundedBorder) + .accessibilityIdentifier("SettingsMobilePairingManualHostField") + .onSubmit { applyManualHostIfNeeded() } + + Button(String(localized: "settings.mobile.port.apply", defaultValue: "Apply")) { + applyManualHostIfNeeded() + } + .disabled(!canApplyManualHost) + } + } + } + + @ViewBuilder + private var manualHostStatusRow: some View { + if !isManualHostValid { + statusCaption { + Label( + String( + localized: "settings.mobile.manualHost.invalid", + defaultValue: "Enter a host or IP address, without spaces or URL paths." + ), + systemImage: "exclamationmark.triangle.fill" + ) + .foregroundStyle(.orange) + } + } else if !trimmedManualHost.isEmpty { + SettingsCardNote(String( + localized: "settings.mobile.manualHost.warning", + defaultValue: "Manual hosts are explicit trust routes. The iOS app will ask before sending credentials. With a subnet router, iPhone to router may be encrypted, but router to Mac is normal LAN traffic." + )) + } + } + @ViewBuilder private var displayNameRow: some View { // Show this Mac's system name as the placeholder so the user sees the @@ -286,6 +366,12 @@ public struct MobileSection: View { } } + private func applyManualHostIfNeeded() { + guard canApplyManualHost else { return } + manualHost.set(trimmedManualHost) + editedManualHost = nil + } + @ViewBuilder private var artifactFolderAccessRow: some View { SettingsCardRow( diff --git a/Packages/macOS/CmuxSettingsUI/Tests/CmuxSettingsUITests/SettingsRowAnchorResolutionTests.swift b/Packages/macOS/CmuxSettingsUI/Tests/CmuxSettingsUITests/SettingsRowAnchorResolutionTests.swift index 23d381b34346..29f56bf7995b 100644 --- a/Packages/macOS/CmuxSettingsUI/Tests/CmuxSettingsUITests/SettingsRowAnchorResolutionTests.swift +++ b/Packages/macOS/CmuxSettingsUI/Tests/CmuxSettingsUITests/SettingsRowAnchorResolutionTests.swift @@ -18,6 +18,18 @@ import Testing /// single key). Together they must cover every curated setting entry. @Suite("SettingsRowAnchorResolution") struct SettingsRowAnchorResolutionTests { + @Test func mobileManualHostAdvertisableValidatorRejectsLoopback() { + let validator = MobilePairingManualHostAdvertisability() + #expect(validator.isAdvertisable("")) + #expect(validator.isAdvertisable(" 192.168.1.23 ")) + #expect(validator.isAdvertisable("studio-mac.local")) + #expect(validator.isAdvertisable("[fd00::12]")) + #expect(!validator.isAdvertisable("127.0.0.1")) + #expect(!validator.isAdvertisable("localhost")) + #expect(!validator.isAdvertisable("[::1]")) + #expect(!validator.isAdvertisable("my:host")) + } + /// Every singular cmux.json path declared by an *unconditionally /// rendered* settings row. Excludes rows that aren't standalone search /// results: `workspaceColors.colors` (repeated per-palette rows) and @@ -153,6 +165,7 @@ struct SettingsRowAnchorResolutionTests { "setting:account:account", "setting:mobile:pairDevice", "setting:mobile:iOSPairingHost", + "setting:mobile:iOSPairingManualHost", "setting:mobile:iOSPairingPort", "setting:mobile:iOSPairingDisplayName", "setting:betaFeatures:feed", diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index 11a0753271b6..29c82ebabc58 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -125122,3434 +125122,3362 @@ } } }, - "mobile.pairing.preparing": { + "mobile.pairing.needsRoute.body": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Preparing a pairing code…" + "value": "This Mac has no Tailscale address or Manual Host, so your iPhone can't reach it. Install Tailscale on both devices, or configure a Manual Host in Settings if your iPhone can reach this Mac through a subnet router." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ペアリングコードを準備しています…" + "value": "この Mac には Tailscale アドレスまたは手動ホストがないため、iPhone から接続できません。両方のデバイスに Tailscale をインストールするか、iPhone がサブネットルーター経由でこの Mac に到達できる場合は、設定で手動ホストを構成してください。" } - } - } - }, - "mobile.pairing.qrAccessibilityLabel": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ar": { "stringUnit": { "state": "translated", - "value": "Pairing QR code" + "value": "لا يحتوي هذا الـ Mac على عنوان Tailscale أو مضيف يدوي، لذلك لا يمكن لـ iPhone الوصول إليه. ثبّت Tailscale على كلا الجهازين، أو اضبط مضيفًا يدويًا في الإعدادات إذا كان iPhone يستطيع الوصول إلى هذا الـ Mac عبر موجّه شبكة فرعية." } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "ペアリング QR コード" + "value": "Ovaj Mac nema Tailscale adresu niti ručni host, pa mu iPhone ne može pristupiti. Instalirajte Tailscale na oba uređaja ili podesite ručni host u Postavkama ako iPhone može doći do ovog Maca preko subnet rutera." } - } - } - }, - "mobile.pairing.qrUnavailable": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Pairing code unavailable. Tap Refresh Code." + "value": "Denne Mac har ingen Tailscale-adresse eller manuel vært, så din iPhone kan ikke nå den. Installer Tailscale på begge enheder, eller konfigurer en manuel vært i Indstillinger, hvis din iPhone kan nå denne Mac via en subnet-router." } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "ペアリングコードを利用できません。「コードを更新」をタップしてください。" + "value": "Dieser Mac hat keine Tailscale-Adresse und keinen manuellen Host, daher kann dein iPhone ihn nicht erreichen. Installiere Tailscale auf beiden Geräten oder konfiguriere in den Einstellungen einen manuellen Host, wenn dein iPhone diesen Mac über einen Subnetzrouter erreichen kann." } - } - } - }, - "mobile.pairing.refresh": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "es": { "stringUnit": { "state": "translated", - "value": "Refresh Code" + "value": "Este Mac no tiene una dirección de Tailscale ni un host manual, así que tu iPhone no puede alcanzarlo. Instala Tailscale en ambos dispositivos o configura un host manual en Ajustes si tu iPhone puede llegar a este Mac mediante un router de subred." } }, - "ja": { + "fr": { "stringUnit": { "state": "translated", - "value": "コードを更新" + "value": "Ce Mac n’a pas d’adresse Tailscale ni d’hôte manuel, votre iPhone ne peut donc pas l’atteindre. Installez Tailscale sur les deux appareils, ou configurez un hôte manuel dans les réglages si votre iPhone peut atteindre ce Mac via un routeur de sous-réseau." } - } - } - }, - "mobile.pairing.req.signIn.subtitle": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Sign in to authorize this Mac for pairing." + "value": "Questo Mac non ha un indirizzo Tailscale né un host manuale, quindi il tuo iPhone non può raggiungerlo. Installa Tailscale su entrambi i dispositivi oppure configura un host manuale nelle Impostazioni se l’iPhone può raggiungere questo Mac tramite un router di sottorete." } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "この Mac のペアリングを許可するにはサインインしてください。" + "value": "Mac នេះមិនមានអាសយដ្ឋាន Tailscale ឬម៉ាស៊ីនបម្រើដោយដៃទេ ដូច្នេះ iPhone របស់អ្នកមិនអាចភ្ជាប់ទៅវាបានទេ។ ដំឡើង Tailscale លើឧបករណ៍ទាំងពីរ ឬកំណត់ម៉ាស៊ីនបម្រើដោយដៃនៅក្នុង Settings ប្រសិនបើ iPhone របស់អ្នកអាចទៅដល់ Mac នេះតាមរយៈរ៉ោតទ័រ subnet។" } - } - } - }, - "mobile.pairing.req.signIn.title": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Signed in to cmux" + "value": "이 Mac에는 Tailscale 주소나 수동 호스트가 없어 iPhone에서 연결할 수 없습니다. 두 기기에 Tailscale을 설치하거나, iPhone이 서브넷 라우터를 통해 이 Mac에 도달할 수 있다면 설정에서 수동 호스트를 구성하세요." } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "cmux にサインイン済み" + "value": "Denne Macen har ingen Tailscale-adresse eller manuell vert, så iPhone kan ikke nå den. Installer Tailscale på begge enhetene, eller konfigurer en manuell vert i Innstillinger hvis iPhone kan nå denne Macen via en subnettruter." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Ten Mac nie ma adresu Tailscale ani hosta ręcznego, więc iPhone nie może go osiągnąć. Zainstaluj Tailscale na obu urządzeniach albo skonfiguruj host ręczny w Ustawieniach, jeśli iPhone może dotrzeć do tego Maca przez router podsieci." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Este Mac não tem um endereço do Tailscale nem um host manual, então o iPhone não consegue acessá-lo. Instale o Tailscale nos dois dispositivos ou configure um host manual nos Ajustes se o iPhone conseguir alcançar este Mac por um roteador de sub-rede." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "У этого Mac нет адреса Tailscale или ручного хоста, поэтому iPhone не может к нему подключиться. Установите Tailscale на оба устройства или настройте ручной хост в настройках, если iPhone может достичь этого Mac через маршрутизатор подсети." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "Mac เครื่องนี้ไม่มีที่อยู่ Tailscale หรือโฮสต์แบบกำหนดเอง ดังนั้น iPhone ของคุณจึงติดต่อไม่ได้ ติดตั้ง Tailscale บนอุปกรณ์ทั้งสองเครื่อง หรือกำหนดโฮสต์แบบกำหนดเองในการตั้งค่าหาก iPhone ติดต่อ Mac เครื่องนี้ผ่านเราเตอร์ซับเน็ตได้" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Bu Mac’in Tailscale adresi veya manuel ana bilgisayarı yok, bu yüzden iPhone’unuz ona ulaşamıyor. Her iki aygıta Tailscale yükleyin veya iPhone’unuz bu Mac’e bir alt ağ yönlendiricisi üzerinden ulaşabiliyorsa Ayarlar’da manuel ana bilgisayar yapılandırın." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Цей Mac не має адреси Tailscale або ручного хоста, тому iPhone не може до нього під’єднатися. Установіть Tailscale на обидва пристрої або налаштуйте ручний хост у параметрах, якщо iPhone може дістатися цього Mac через маршрутизатор підмережі." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "这台 Mac 没有 Tailscale 地址或手动主机,因此你的 iPhone 无法访问它。请在两台设备上安装 Tailscale,或者如果 iPhone 可通过子网路由器访问这台 Mac,请在设置中配置手动主机。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "這部 Mac 沒有 Tailscale 位址或手動主機,因此你的 iPhone 無法連線。請在兩部裝置上安裝 Tailscale;如果 iPhone 可透過子網路路由器連到這部 Mac,請在設定中設定手動主機。" } } } }, - "mobile.pairing.req.tailscale.get": { + "mobile.pairing.preparing": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Get Tailscale" + "value": "Preparing a pairing code…" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Tailscale を入手" + "value": "ペアリングコードを準備しています…" } } } }, - "mobile.pairing.req.tailscale.hint": { + "mobile.pairing.qrAccessibilityLabel": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Your Mac and iPhone both need Tailscale to connect over the internet." + "value": "Pairing QR code" } }, "ja": { "stringUnit": { "state": "translated", - "value": "インターネット経由で接続するには、Mac と iPhone の両方に Tailscale が必要です。" + "value": "ペアリング QR コード" } } } }, - "mobile.pairing.req.tailscale.missing": { + "mobile.pairing.qrUnavailable": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Not detected. Install Tailscale on this Mac and your iPhone, signed in to the same account." + "value": "Pairing code unavailable. Tap Refresh Code." } }, "ja": { "stringUnit": { "state": "translated", - "value": "検出されませんでした。この Mac と iPhone の両方に、同じアカウントで Tailscale をインストールしてください。" + "value": "ペアリングコードを利用できません。「コードを更新」をタップしてください。" } } } }, - "mobile.pairing.req.tailscale.reachable": { + "mobile.pairing.refresh": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Reachable over Tailscale." + "value": "Refresh Code" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Tailscale 経由で接続できます。" + "value": "コードを更新" } } } }, - "mobile.pairing.req.tailscale.title": { + "mobile.pairing.req.signIn.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Tailscale" + "value": "Sign in to authorize this Mac for pairing." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Tailscale" + "value": "この Mac のペアリングを許可するにはサインインしてください。" } } } }, - "mobile.pairing.retry": { + "mobile.pairing.req.signIn.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Try Again" + "value": "Signed in to cmux" } }, "ja": { "stringUnit": { "state": "translated", - "value": "再試行" + "value": "cmux にサインイン済み" } } } }, - "mobile.pairing.signIn.button": { + "mobile.pairing.req.manualHost.reachable": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Sign In" + "value": "Manual host configured. Your iPhone will ask before trusting this route." } }, "ja": { "stringUnit": { "state": "translated", - "value": "サインイン" + "value": "手動ホストが設定されています。このルートを信頼する前に iPhone で確認が表示されます。" } - } - } - }, - "mobile.pairing.signIn.connecting": { - "extractionState": "manual", - "localizations": { + }, "ar": { "stringUnit": { "state": "translated", - "value": "جارٍ الاتصال…" + "value": "تم تكوين مضيف يدوي. سيطلب iPhone التأكيد قبل الوثوق بهذا المسار." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Povezivanje…" + "value": "Ručni host je podešen. iPhone će zatražiti potvrdu prije nego što povjeruje ovoj ruti." } }, "da": { "stringUnit": { "state": "translated", - "value": "Forbinder…" + "value": "Manuel vært er konfigureret. Din iPhone spørger, før den godkender denne rute." } }, "de": { "stringUnit": { "state": "translated", - "value": "Verbindung wird hergestellt…" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Connecting…" + "value": "Manueller Host konfiguriert. Dein iPhone fragt nach, bevor diese Route vertraut wird." } }, "es": { "stringUnit": { "state": "translated", - "value": "Conectando…" + "value": "Host manual configurado. Tu iPhone preguntará antes de confiar en esta ruta." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Connexion…" + "value": "Hôte manuel configuré. Votre iPhone demandera confirmation avant d’approuver cette route." } }, "it": { "stringUnit": { "state": "translated", - "value": "Connessione…" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "接続しています…" + "value": "Host manuale configurato. L’iPhone chiederà conferma prima di considerare attendibile questo percorso." } }, "km": { "stringUnit": { "state": "translated", - "value": "កំពុងភ្ជាប់…" + "value": "បានកំណត់ម៉ាស៊ីនបម្រើដោយដៃ។ iPhone របស់អ្នកនឹងសួរមុនពេលជឿទុកចិត្តលើផ្លូវនេះ។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "연결 중…" + "value": "수동 호스트가 구성되었습니다. iPhone은 이 경로를 신뢰하기 전에 확인을 요청합니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Kobler til…" + "value": "Manuell vert er konfigurert. iPhone spør før den stoler på denne ruten." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Łączenie…" + "value": "Skonfigurowano host ręczny. iPhone zapyta przed zaufaniem tej trasie." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Conectando…" + "value": "Host manual configurado. O iPhone perguntará antes de confiar nesta rota." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Подключение…" + "value": "Ручной хост настроен. iPhone запросит подтверждение перед доверием этому маршруту." } }, "th": { "stringUnit": { "state": "translated", - "value": "กำลังเชื่อมต่อ…" + "value": "กำหนดโฮสต์แบบกำหนดเองแล้ว iPhone จะถามก่อนเชื่อถือเส้นทางนี้" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Bağlanıyor…" + "value": "Manuel ana bilgisayar yapılandırıldı. iPhone’unuz bu rotaya güvenmeden önce soracak." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Підключення…" + "value": "Ручний хост налаштовано. iPhone запитає підтвердження перед довірою цьому маршруту." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "正在连接…" + "value": "已配置手动主机。iPhone 会在信任此路由前询问。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "正在連接…" + "value": "已設定手動主機。iPhone 會在信任此路由前詢問。" } } } }, - "mobile.pairing.signIn.openInBrowser": { + "mobile.pairing.req.route.hint": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "فتح في المتصفح" + "value": "Use Tailscale, or configure a Manual Host for subnet-router setups." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Otvori u pregledniku" + "value": "Tailscale を使用するか、サブネットルーター構成用に手動ホストを設定してください。" } }, - "da": { + "ar": { "stringUnit": { "state": "translated", - "value": "Åbn i browser" + "value": "استخدم Tailscale، أو كوّن مضيفًا يدويًا لإعدادات موجّه الشبكة الفرعية." } }, - "de": { + "bs": { "stringUnit": { "state": "translated", - "value": "Im Browser öffnen" + "value": "Koristite Tailscale ili podesite ručni host za subnet-router postavke." } }, - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Open in Browser" + "value": "Brug Tailscale, eller konfigurer en manuel vært til subnet-router-opsætninger." } }, - "es": { + "de": { "stringUnit": { "state": "translated", - "value": "Abrir en el navegador" + "value": "Verwende Tailscale oder konfiguriere einen manuellen Host für Subnetzrouter-Setups." } }, - "fr": { + "es": { "stringUnit": { "state": "translated", - "value": "Ouvrir dans le navigateur" + "value": "Usa Tailscale o configura un host manual para configuraciones con router de subred." } }, - "it": { + "fr": { "stringUnit": { "state": "translated", - "value": "Apri nel browser" + "value": "Utilisez Tailscale, ou configurez un hôte manuel pour les configurations avec routeur de sous-réseau." } }, - "ja": { + "it": { "stringUnit": { "state": "translated", - "value": "ブラウザで開く" + "value": "Usa Tailscale oppure configura un host manuale per configurazioni con router di sottorete." } }, "km": { "stringUnit": { "state": "translated", - "value": "បើកក្នុងកម្មវិធីរុករក" + "value": "ប្រើ Tailscale ឬកំណត់ម៉ាស៊ីនបម្រើដោយដៃសម្រាប់ការរៀបចំ subnet-router។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "브라우저에서 열기" + "value": "Tailscale을 사용하거나 서브넷 라우터 설정을 위해 수동 호스트를 구성하세요." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Åpne i nettleser" + "value": "Bruk Tailscale, eller konfigurer en manuell vert for subnettruter-oppsett." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Otwórz w przeglądarce" + "value": "Użyj Tailscale albo skonfiguruj host ręczny dla konfiguracji z routerem podsieci." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Abrir no navegador" + "value": "Use o Tailscale ou configure um host manual para setups com roteador de sub-rede." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Открыть в браузере" + "value": "Используйте Tailscale или настройте ручной хост для схем с маршрутизатором подсети." } }, "th": { "stringUnit": { "state": "translated", - "value": "เปิดในเบราว์เซอร์" + "value": "ใช้ Tailscale หรือกำหนดโฮสต์แบบกำหนดเองสำหรับการตั้งค่าเราเตอร์ซับเน็ต" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Tarayıcıda Aç" + "value": "Tailscale kullanın veya alt ağ yönlendiricisi kurulumları için manuel ana bilgisayar yapılandırın." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Відкрити у браузері" + "value": "Використовуйте Tailscale або налаштуйте ручний хост для конфігурацій із маршрутизатором підмережі." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "在浏览器中打开" + "value": "使用 Tailscale,或为子网路由器设置配置手动主机。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "在瀏覽器中打開" + "value": "使用 Tailscale,或針對子網路路由器設定手動主機。" } } } }, - "mobile.pairing.signIn.prompt": { + "mobile.pairing.req.route.missing": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Sign in with your cmux account to pair your iPhone." + "value": "No Tailscale address or manual host configured. Install Tailscale, or set a Manual Host in Settings for subnet-router setups." } }, "ja": { "stringUnit": { "state": "translated", - "value": "iPhone をペアリングするには、cmux アカウントでサインインしてください。" + "value": "Tailscale アドレスまたは手動ホストが設定されていません。Tailscale をインストールするか、サブネットルーター構成用に設定で手動ホストを指定してください。" } - } - } - }, - "mobile.pairing.signIn.slowHint": { - "extractionState": "manual", - "localizations": { + }, "ar": { "stringUnit": { "state": "translated", - "value": "قد تتوقف نافذة تسجيل الدخول في النظام عن الاستجابة. إذا لم يحدث شيء، فافتح تسجيل الدخول في المتصفح الافتراضي بدلاً من ذلك." + "value": "لم يتم تكوين عنوان Tailscale أو مضيف يدوي. ثبّت Tailscale أو اضبط مضيفًا يدويًا في الإعدادات لإعدادات موجّه الشبكة الفرعية." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Sistemski prozor za prijavu može prestati odgovarati. Ako se ništa ne dogodi, otvorite prijavu u zadanom pregledniku." + "value": "Nije podešena Tailscale adresa niti ručni host. Instalirajte Tailscale ili postavite ručni host u Postavkama za subnet-router konfiguracije." } }, "da": { "stringUnit": { "state": "translated", - "value": "Systemets loginvindue kan holde op med at svare. Hvis der ikke sker noget, skal du i stedet åbne login i din standardbrowser." + "value": "Ingen Tailscale-adresse eller manuel vært er konfigureret. Installer Tailscale, eller angiv en manuel vært i Indstillinger til subnet-router-opsætninger." } }, "de": { "stringUnit": { "state": "translated", - "value": "Das System-Anmeldefenster reagiert möglicherweise nicht mehr. Wenn nichts passiert, öffne die Anmeldung stattdessen in deinem Standardbrowser." - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "The system sign-in window may stop responding. If nothing happens, open sign-in in your default browser instead." + "value": "Keine Tailscale-Adresse und kein manueller Host konfiguriert. Installiere Tailscale oder lege in den Einstellungen einen manuellen Host für Subnetzrouter-Setups fest." } }, "es": { "stringUnit": { "state": "translated", - "value": "La ventana de inicio de sesión del sistema puede dejar de responder. Si no sucede nada, abre el inicio de sesión en tu navegador predeterminado." + "value": "No hay dirección de Tailscale ni host manual configurados. Instala Tailscale o define un host manual en Ajustes para configuraciones con router de subred." } }, "fr": { "stringUnit": { "state": "translated", - "value": "La fenêtre de connexion du système peut ne plus répondre. Si rien ne se passe, ouvrez plutôt la connexion dans votre navigateur par défaut." + "value": "Aucune adresse Tailscale ni hôte manuel n’est configuré. Installez Tailscale, ou définissez un hôte manuel dans les réglages pour les configurations avec routeur de sous-réseau." } }, "it": { "stringUnit": { "state": "translated", - "value": "La finestra di accesso di sistema potrebbe smettere di rispondere. Se non succede nulla, apri l’accesso nel browser predefinito." - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "システムのサインインウィンドウが応答しなくなることがあります。何も起きない場合は、デフォルトのブラウザでサインインを開いてください。" + "value": "Nessun indirizzo Tailscale o host manuale configurato. Installa Tailscale oppure imposta un host manuale nelle Impostazioni per configurazioni con router di sottorete." } }, "km": { "stringUnit": { "state": "translated", - "value": "បង្អួចចូលគណនីរបស់ប្រព័ន្ធអាចឈប់ឆ្លើយតប។ ប្រសិនបើគ្មានអ្វីកើតឡើង សូមបើកការចូលគណនីក្នុងកម្មវិធីរុករកលំនាំដើមរបស់អ្នកជំនួសវិញ។" + "value": "មិនបានកំណត់អាសយដ្ឋាន Tailscale ឬម៉ាស៊ីនបម្រើដោយដៃទេ។ ដំឡើង Tailscale ឬកំណត់ម៉ាស៊ីនបម្រើដោយដៃនៅក្នុង Settings សម្រាប់ការរៀបចំ subnet-router។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "시스템 로그인 창이 응답하지 않을 수 있습니다. 아무 반응이 없으면 기본 브라우저에서 로그인을 열어 주세요." + "value": "Tailscale 주소나 수동 호스트가 구성되지 않았습니다. Tailscale을 설치하거나 서브넷 라우터 설정을 위해 설정에서 수동 호스트를 지정하세요." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Systemets påloggingsvindu kan slutte å svare. Hvis ingenting skjer, åpner du påloggingen i standardnettleseren i stedet." + "value": "Ingen Tailscale-adresse eller manuell vert er konfigurert. Installer Tailscale, eller angi en manuell vert i Innstillinger for subnettruter-oppsett." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Systemowe okno logowania może przestać odpowiadać. Jeśli nic się nie dzieje, otwórz logowanie w domyślnej przeglądarce." + "value": "Nie skonfigurowano adresu Tailscale ani hosta ręcznego. Zainstaluj Tailscale albo ustaw host ręczny w Ustawieniach dla konfiguracji z routerem podsieci." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "A janela de login do sistema pode parar de responder. Se nada acontecer, abra o login no navegador padrão." + "value": "Nenhum endereço do Tailscale ou host manual configurado. Instale o Tailscale ou defina um host manual nos Ajustes para setups com roteador de sub-rede." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Системное окно входа может перестать отвечать. Если ничего не происходит, откройте вход в браузере по умолчанию." + "value": "Адрес Tailscale или ручной хост не настроены. Установите Tailscale или задайте ручной хост в настройках для схем с маршрутизатором подсети." } }, "th": { "stringUnit": { "state": "translated", - "value": "หน้าต่างลงชื่อเข้าของระบบอาจหยุดตอบสนอง หากไม่มีอะไรเกิดขึ้น ให้เปิดการลงชื่อเข้าในเบราว์เซอร์เริ่มต้นแทน" + "value": "ยังไม่ได้กำหนดที่อยู่ Tailscale หรือโฮสต์แบบกำหนดเอง ติดตั้ง Tailscale หรือกำหนดโฮสต์แบบกำหนดเองในการตั้งค่าสำหรับการตั้งค่าเราเตอร์ซับเน็ต" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Sistem oturum açma penceresi yanıt vermeyi durdurabilir. Hiçbir şey olmazsa oturum açmayı varsayılan tarayıcınızda açın." + "value": "Tailscale adresi veya manuel ana bilgisayar yapılandırılmamış. Tailscale yükleyin veya alt ağ yönlendiricisi kurulumları için Ayarlar’da manuel ana bilgisayar belirleyin." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Системне вікно входу може перестати відповідати. Якщо нічого не відбувається, відкрийте вхід у браузері за умовчанням." + "value": "Адресу Tailscale або ручний хост не налаштовано. Установіть Tailscale або задайте ручний хост у параметрах для конфігурацій із маршрутизатором підмережі." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "系统登录窗口可能会停止响应。如果没有任何反应,请改用默认浏览器打开登录。" + "value": "未配置 Tailscale 地址或手动主机。请安装 Tailscale,或在设置中为子网路由器设置手动主机。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "系統登入視窗可能會停止回應。如果沒有任何反應,請改用預設瀏覽器開啟登入。" + "value": "尚未設定 Tailscale 位址或手動主機。請安裝 Tailscale,或在設定中針對子網路路由器設定手動主機。" } } } }, - "mobile.pairing.step.install": { + "mobile.pairing.req.route.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Install cmux on your iPhone and open it." + "value": "Reachable route" } }, "ja": { "stringUnit": { "state": "translated", - "value": "iPhone に cmux をインストールして開きます。" + "value": "到達可能なルート" } - } - } - }, - "mobile.pairing.step.scan": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ar": { "stringUnit": { "state": "translated", - "value": "Tap Add device, then Scan QR Code, and point the camera at the code above." + "value": "مسار يمكن الوصول إليه" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "「デバイスを追加」→「QR コードをスキャン」をタップし、上のコードにカメラを向けます。" + "value": "Dostupna ruta" } - } - } - }, - "mobile.pairing.step.signIn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Sign in with the same account you use on this Mac." + "value": "Tilgængelig rute" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "この Mac と同じアカウントでサインインします。" + "value": "Erreichbare Route" } - } - } - }, - "mobile.pairing.waiting": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "es": { "stringUnit": { "state": "translated", - "value": "Waiting for your iPhone…" + "value": "Ruta alcanzable" } }, - "ja": { + "fr": { "stringUnit": { "state": "translated", - "value": "iPhone を待っています…" + "value": "Route accessible" } - } - } - }, - "mobile.pairing.window.heading": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Pair your iPhone" + "value": "Percorso raggiungibile" } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "iPhone をペアリング" + "value": "ផ្លូវដែលអាចទៅដល់បាន" } - } - } - }, - "mobile.pairing.window.subheading": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Scan this code with the cmux app on your iPhone to sync your terminal workspaces." + "value": "도달 가능한 경로" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "iPhone の cmux アプリでこのコードをスキャンして、ターミナルワークスペースを同期します。" + "value": "Tilgjengelig rute" } - } - } - }, - "mobile.pairing.window.title": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Pair iPhone" + "value": "Osiągalna trasa" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "iPhone をペアリング" + "value": "Rota alcançável" } - } - } - }, - "mode.compact": { - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Compact" + "value": "Доступный маршрут" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "コンパクト" + "value": "เส้นทางที่ติดต่อได้" } - } - } - }, - "mode.expanded": { - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Expanded" + "value": "Ulaşılabilir rota" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "拡張" + "value": "Доступний маршрут" } - } - } - }, - "mode.system": { - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "System" + "value": "可访问路由" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "システム" + "value": "可連線路由" } } } }, - "notification.agentChat.serverUnavailable.bodyDefault": { + "mobile.pairing.req.tailscale.get": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux couldn't reach %@. Start the server with cmux-chat or configure agentChat.startCommand in cmux.json." + "value": "Get Tailscale" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux は %@ に接続できませんでした。cmux-chat でサーバーを起動するか、cmux.json で agentChat.startCommand を設定してください。" + "value": "Tailscale を入手" } } } }, - "notification.agentChat.serverUnavailable.bodyWithCommand": { + "mobile.pairing.req.tailscale.hint": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux couldn't reach %@. Start it with: %@" + "value": "Your Mac and iPhone both need Tailscale to connect over the internet." } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux は %@ に接続できませんでした。次のコマンドで起動してください: %@" + "value": "インターネット経由で接続するには、Mac と iPhone の両方に Tailscale が必要です。" } } } }, - "notification.agentChat.serverUnavailable.subtitle": { + "mobile.pairing.req.tailscale.missing": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Opened Agent Chat" + "value": "Not detected. Install Tailscale on this Mac and your iPhone, signed in to the same account." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Agent Chat を開きました" + "value": "検出されませんでした。この Mac と iPhone の両方に、同じアカウントで Tailscale をインストールしてください。" } } } }, - "notification.agentChat.serverUnavailable.title": { + "mobile.pairing.req.tailscale.reachable": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Agent chat server isn't running" + "value": "Reachable over Tailscale." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Agent Chat サーバーが起動していません" + "value": "Tailscale 経由で接続できます。" } } } }, - "notification.desktop.defaultTerminalTitle": { + "mobile.pairing.req.tailscale.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Terminal" + "value": "Tailscale" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ターミナル" + "value": "Tailscale" } } } }, - "notificationHook.failure.body": { + "mobile.pairing.retry": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux used default notification behavior because '%@' failed." + "value": "Try Again" } }, "ja": { "stringUnit": { "state": "translated", - "value": "'%@' が失敗したため、cmux は既定の通知動作を使用しました。" + "value": "再試行" } } } }, - "notificationHook.failure.title": { + "mobile.pairing.signIn.button": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Notification Hook Failed" + "value": "Sign In" } }, "ja": { "stringUnit": { "state": "translated", - "value": "通知フックに失敗しました" + "value": "サインイン" } } } }, - "notifications.clearAll": { + "mobile.pairing.signIn.connecting": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "مسح الكل" + "value": "جارٍ الاتصال…" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Obriši sve" + "value": "Povezivanje…" } }, "da": { "stringUnit": { "state": "translated", - "value": "Ryd alle" + "value": "Forbinder…" } }, "de": { "stringUnit": { "state": "translated", - "value": "Alle löschen" + "value": "Verbindung wird hergestellt…" } }, "en": { "stringUnit": { "state": "translated", - "value": "Clear All" + "value": "Connecting…" } }, "es": { "stringUnit": { "state": "translated", - "value": "Borrar todo" + "value": "Conectando…" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Tout effacer" + "value": "Connexion…" } }, "it": { "stringUnit": { "state": "translated", - "value": "Cancella tutto" + "value": "Connessione…" } }, "ja": { "stringUnit": { "state": "translated", - "value": "すべてクリア" + "value": "接続しています…" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "កំពុងភ្ជាប់…" } }, "ko": { "stringUnit": { "state": "translated", - "value": "모두 지우기" + "value": "연결 중…" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Fjern alle" + "value": "Kobler til…" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Wyczyść wszystko" + "value": "Łączenie…" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Limpar Tudo" + "value": "Conectando…" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Очистить все" + "value": "Подключение…" } }, "th": { "stringUnit": { "state": "translated", - "value": "ล้างทั้งหมด" + "value": "กำลังเชื่อมต่อ…" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Tümünü Temizle" + "value": "Bağlanıyor…" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Очистити все" + "value": "Підключення…" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "全部清除" + "value": "正在连接…" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "清除全部" - } - } - } - }, - "notifications.dismiss": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Dismiss" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "破棄" + "value": "正在連接…" } } } }, - "notifications.empty.description": { + "mobile.pairing.signIn.openInBrowser": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "ستظهر إشعارات سطح المكتب هنا للمراجعة السريعة." + "value": "فتح في المتصفح" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Obavještenja na radnoj površini će se pojavljivati ovdje radi brzog pregleda." + "value": "Otvori u pregledniku" } }, "da": { "stringUnit": { "state": "translated", - "value": "Skrivebordsnotifikationer vises her til hurtig gennemgang." + "value": "Åbn i browser" } }, "de": { "stringUnit": { "state": "translated", - "value": "Desktop-Benachrichtigungen werden hier zur schnellen Überprüfung angezeigt." + "value": "Im Browser öffnen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Desktop notifications will appear here for quick review." + "value": "Open in Browser" } }, "es": { "stringUnit": { "state": "translated", - "value": "Las notificaciones de escritorio aparecerán aquí para su revisión rápida." + "value": "Abrir en el navegador" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Les notifications de bureau apparaîtront ici pour une consultation rapide." + "value": "Ouvrir dans le navigateur" } }, "it": { "stringUnit": { "state": "translated", - "value": "Le notifiche desktop appariranno qui per una rapida consultazione." + "value": "Apri nel browser" } }, "ja": { "stringUnit": { "state": "translated", - "value": "デスクトップ通知がここに表示されます。" + "value": "ブラウザで開く" } }, - "ko": { + "km": { "stringUnit": { "state": "translated", - "value": "데스크톱 알림이 여기에 표시되어 빠르게 확인할 수 있습니다." + "value": "បើកក្នុងកម្មវិធីរុករក" } }, - "nb": { + "ko": { "stringUnit": { "state": "translated", - "value": "Skrivebordsvarsler vises her for rask gjennomgang." + "value": "브라우저에서 열기" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Åpne i nettleser" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Powiadomienia pulpitu będą się tu pojawiać do szybkiego przeglądu." + "value": "Otwórz w przeglądarce" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "As notificações da área de trabalho aparecerão aqui para revisão rápida." + "value": "Abrir no navegador" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Уведомления рабочего стола будут отображаться здесь для быстрого просмотра." + "value": "Открыть в браузере" } }, "th": { "stringUnit": { "state": "translated", - "value": "การแจ้งเตือนเดสก์ท็อปจะปรากฏที่นี่เพื่อตรวจสอบอย่างรวดเร็ว" + "value": "เปิดในเบราว์เซอร์" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Masaüstü bildirimleri hızlı inceleme için burada görünecek." + "value": "Tarayıcıda Aç" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Сповіщення робочого столу з'являтимуться тут для швидкого перегляду." + "value": "Відкрити у браузері" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "桌面通知将在此处显示,方便快速查看。" + "value": "在浏览器中打开" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "桌面通知將在這裡顯示,方便您快速查看。" + "value": "在瀏覽器中打開" } } } }, - "notifications.empty.subtitle": { + "mobile.pairing.signIn.prompt": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Sign in with your cmux account to pair your iPhone." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "iPhone をペアリングするには、cmux アカウントでサインインしてください。" + } + } + } + }, + "mobile.pairing.signIn.slowHint": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "ستظهر إشعارات سطح المكتب هنا." + "value": "قد تتوقف نافذة تسجيل الدخول في النظام عن الاستجابة. إذا لم يحدث شيء، فافتح تسجيل الدخول في المتصفح الافتراضي بدلاً من ذلك." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Obavještenja na radnoj površini će se pojavljivati ovdje." + "value": "Sistemski prozor za prijavu može prestati odgovarati. Ako se ništa ne dogodi, otvorite prijavu u zadanom pregledniku." } }, "da": { "stringUnit": { "state": "translated", - "value": "Skrivebordsnotifikationer vises her." + "value": "Systemets loginvindue kan holde op med at svare. Hvis der ikke sker noget, skal du i stedet åbne login i din standardbrowser." } }, "de": { "stringUnit": { "state": "translated", - "value": "Desktop-Benachrichtigungen werden hier angezeigt." + "value": "Das System-Anmeldefenster reagiert möglicherweise nicht mehr. Wenn nichts passiert, öffne die Anmeldung stattdessen in deinem Standardbrowser." } }, "en": { "stringUnit": { "state": "translated", - "value": "Desktop notifications will appear here." + "value": "The system sign-in window may stop responding. If nothing happens, open sign-in in your default browser instead." } }, "es": { "stringUnit": { "state": "translated", - "value": "Las notificaciones de escritorio aparecerán aquí." + "value": "La ventana de inicio de sesión del sistema puede dejar de responder. Si no sucede nada, abre el inicio de sesión en tu navegador predeterminado." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Les notifications de bureau apparaîtront ici." + "value": "La fenêtre de connexion du système peut ne plus répondre. Si rien ne se passe, ouvrez plutôt la connexion dans votre navigateur par défaut." } }, "it": { "stringUnit": { "state": "translated", - "value": "Le notifiche desktop appariranno qui." + "value": "La finestra di accesso di sistema potrebbe smettere di rispondere. Se non succede nulla, apri l’accesso nel browser predefinito." } }, "ja": { "stringUnit": { "state": "translated", - "value": "デスクトップ通知がここに表示されます。" + "value": "システムのサインインウィンドウが応答しなくなることがあります。何も起きない場合は、デフォルトのブラウザでサインインを開いてください。" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "បង្អួចចូលគណនីរបស់ប្រព័ន្ធអាចឈប់ឆ្លើយតប។ ប្រសិនបើគ្មានអ្វីកើតឡើង សូមបើកការចូលគណនីក្នុងកម្មវិធីរុករកលំនាំដើមរបស់អ្នកជំនួសវិញ។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "데스크톱 알림이 여기에 표시됩니다." + "value": "시스템 로그인 창이 응답하지 않을 수 있습니다. 아무 반응이 없으면 기본 브라우저에서 로그인을 열어 주세요." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Skrivebordsvarsler vises her." + "value": "Systemets påloggingsvindu kan slutte å svare. Hvis ingenting skjer, åpner du påloggingen i standardnettleseren i stedet." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Powiadomienia pulpitu będą się tu pojawiać." + "value": "Systemowe okno logowania może przestać odpowiadać. Jeśli nic się nie dzieje, otwórz logowanie w domyślnej przeglądarce." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "As notificações da área de trabalho aparecerão aqui." + "value": "A janela de login do sistema pode parar de responder. Se nada acontecer, abra o login no navegador padrão." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Уведомления рабочего стола будут отображаться здесь." + "value": "Системное окно входа может перестать отвечать. Если ничего не происходит, откройте вход в браузере по умолчанию." } }, "th": { "stringUnit": { "state": "translated", - "value": "การแจ้งเตือนเดสก์ท็อปจะปรากฏที่นี่" + "value": "หน้าต่างลงชื่อเข้าของระบบอาจหยุดตอบสนอง หากไม่มีอะไรเกิดขึ้น ให้เปิดการลงชื่อเข้าในเบราว์เซอร์เริ่มต้นแทน" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Masaüstü bildirimleri burada görünecek." + "value": "Sistem oturum açma penceresi yanıt vermeyi durdurabilir. Hiçbir şey olmazsa oturum açmayı varsayılan tarayıcınızda açın." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Сповіщення робочого столу з'являтимуться тут." + "value": "Системне вікно входу може перестати відповідати. Якщо нічого не відбувається, відкрийте вхід у браузері за умовчанням." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "桌面通知将在此处显示。" + "value": "系统登录窗口可能会停止响应。如果没有任何反应,请改用默认浏览器打开登录。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "桌面通知將在這裡顯示。" + "value": "系統登入視窗可能會停止回應。如果沒有任何反應,請改用預設瀏覽器開啟登入。" } } } }, - "notifications.empty.title": { + "mobile.pairing.step.install": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "لا توجد إشعارات بعد" + "value": "Install cmux on your iPhone and open it." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Još nema obavještenja" + "value": "iPhone に cmux をインストールして開きます。" } - }, - "da": { + } + } + }, + "mobile.pairing.step.scan": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Ingen notifikationer endnu" + "value": "Tap Add device, then Scan QR Code, and point the camera at the code above." } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Noch keine Benachrichtigungen" + "value": "「デバイスを追加」→「QR コードをスキャン」をタップし、上のコードにカメラを向けます。" } - }, + } + } + }, + "mobile.pairing.step.signIn": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "No notifications yet" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Aún no hay notificaciones" + "value": "Sign in with the same account you use on this Mac." } }, - "fr": { + "ja": { "stringUnit": { "state": "translated", - "value": "Aucune notification pour le moment" + "value": "この Mac と同じアカウントでサインインします。" } - }, - "it": { + } + } + }, + "mobile.pairing.waiting": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Nessuna notifica" + "value": "Waiting for your iPhone…" } }, "ja": { "stringUnit": { "state": "translated", - "value": "まだ通知はありません" + "value": "iPhone を待っています…" } - }, - "ko": { + } + } + }, + "mobile.pairing.window.heading": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "아직 알림이 없습니다" + "value": "Pair your iPhone" } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "Ingen varsler ennå" + "value": "iPhone をペアリング" } - }, - "pl": { + } + } + }, + "mobile.pairing.window.subheading": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Brak powiadomień" + "value": "Scan this code with the cmux app on your iPhone to sync your terminal workspaces." } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "Nenhuma notificação ainda" + "value": "iPhone の cmux アプリでこのコードをスキャンして、ターミナルワークスペースを同期します。" } - }, - "ru": { + } + } + }, + "mobile.pairing.window.title": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Уведомлений пока нет" + "value": "Pair iPhone" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "ยังไม่มีการแจ้งเตือน" + "value": "iPhone をペアリング" } - }, - "tr": { + } + } + }, + "mode.compact": { + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Henüz bildirim yok" + "value": "Compact" } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "Сповіщень ще немає" + "value": "コンパクト" } - }, - "zh-Hans": { + } + } + }, + "mode.expanded": { + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "暂无通知" + "value": "Expanded" } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "尚無通知" + "value": "拡張" } } } }, - "notifications.forwardToPhone.hideContent": { - "extractionState": "manual", + "mode.system": { "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Hide content (send a generic message instead of the terminal text)" + "value": "System" } }, "ja": { "stringUnit": { "state": "translated", - "value": "内容を非表示にする(ターミナルのテキストの代わりに一般的なメッセージを送信)" + "value": "システム" } } } }, - "notifications.forwardToPhone.mode.always": { + "notification.agentChat.serverUnavailable.bodyDefault": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Always" + "value": "cmux couldn't reach %@. Start the server with cmux-chat or configure agentChat.startCommand in cmux.json." } }, "ja": { "stringUnit": { "state": "translated", - "value": "常に" + "value": "cmux は %@ に接続できませんでした。cmux-chat でサーバーを起動するか、cmux.json で agentChat.startCommand を設定してください。" } } } }, - "notifications.forwardToPhone.mode.label": { + "notification.agentChat.serverUnavailable.bodyWithCommand": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "When to send" + "value": "cmux couldn't reach %@. Start it with: %@" } }, "ja": { "stringUnit": { "state": "translated", - "value": "送信するタイミング" + "value": "cmux は %@ に接続できませんでした。次のコマンドで起動してください: %@" } } } }, - "notifications.forwardToPhone.mode.onlyWhenAway": { + "notification.agentChat.serverUnavailable.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Only when away from this Mac" + "value": "Opened Agent Chat" } }, "ja": { "stringUnit": { "state": "translated", - "value": "この Mac から離れているときのみ" + "value": "Agent Chat を開きました" } } } }, - "notifications.forwardToPhone.mode.subtitle": { + "notification.agentChat.serverUnavailable.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Away means the screen is locked or asleep, the screensaver is running, or there has been no keyboard or mouse input for %lld minutes." + "value": "Agent chat server isn't running" } }, "ja": { "stringUnit": { "state": "translated", - "value": "離席中とは、画面がロックまたはスリープ中、スクリーンセーバーが実行中、またはキーボードやマウスの入力が %lld 分間ない状態です。" + "value": "Agent Chat サーバーが起動していません" } } } }, - "notifications.forwardToPhone.subtitle": { + "notification.desktop.defaultTerminalTitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Send agent notifications to the cmux iPhone app. Off by default; nothing is uploaded unless this is on." + "value": "Terminal" } }, "ja": { "stringUnit": { "state": "translated", - "value": "エージェントの通知を cmux の iPhone アプリに送信します。デフォルトはオフで、オンにしない限り何もアップロードされません。" + "value": "ターミナル" } } } }, - "notifications.forwardToPhone.title": { + "notificationHook.failure.body": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Forward notifications to my iPhone" + "value": "cmux used default notification behavior because '%@' failed." } }, "ja": { "stringUnit": { "state": "translated", - "value": "通知を iPhone に転送する" + "value": "'%@' が失敗したため、cmux は既定の通知動作を使用しました。" } } } }, - "notifications.jumpToLatest": { + "notificationHook.failure.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Jump to Latest" + "value": "Notification Hook Failed" } }, "ja": { "stringUnit": { "state": "translated", - "value": "最新へジャンプ" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "최신으로 이동" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Перейти до останнього" + "value": "通知フックに失敗しました" } } } }, - "notifications.jumpToLatestUnread": { + "notifications.clearAll": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "الانتقال إلى أحدث غير مقروء" + "value": "مسح الكل" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Skoči na najnovije nepročitano" + "value": "Obriši sve" } }, "da": { "stringUnit": { "state": "translated", - "value": "Gå til seneste ulæste" + "value": "Ryd alle" } }, "de": { "stringUnit": { "state": "translated", - "value": "Zur letzten ungelesenen springen" + "value": "Alle löschen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Jump to Latest Unread" + "value": "Clear All" } }, "es": { "stringUnit": { "state": "translated", - "value": "Ir a la última no leída" + "value": "Borrar todo" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Aller au dernier message non lu" + "value": "Tout effacer" } }, "it": { "stringUnit": { "state": "translated", - "value": "Vai all'ultimo non letto" + "value": "Cancella tutto" } }, "ja": { "stringUnit": { "state": "translated", - "value": "最新の未読にジャンプ" + "value": "すべてクリア" } }, "ko": { "stringUnit": { "state": "translated", - "value": "최신 읽지 않은 항목으로 이동" + "value": "모두 지우기" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Gå til siste uleste" + "value": "Fjern alle" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Przejdź do najnowszego nieprzeczytanego" + "value": "Wyczyść wszystko" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Ir para Última Não Lida" + "value": "Limpar Tudo" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Перейти к последнему непрочитанному" + "value": "Очистить все" } }, "th": { "stringUnit": { "state": "translated", - "value": "ข้ามไปยังรายการยังไม่อ่านล่าสุด" + "value": "ล้างทั้งหมด" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Son Okunmamışa Atla" + "value": "Tümünü Temizle" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Перейти до останнього непрочитаного" + "value": "Очистити все" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "跳转到最新未读" + "value": "全部清除" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "跳至最新未讀" + "value": "清除全部" } } } }, - "notifications.markAsRead": { + "notifications.dismiss": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Mark as Read" + "value": "Dismiss" } }, "ja": { "stringUnit": { "state": "translated", - "value": "既読にする" + "value": "破棄" } } } }, - "notifications.markAsUnread": { + "notifications.empty.description": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Mark as Unread" + "value": "ستظهر إشعارات سطح المكتب هنا للمراجعة السريعة." } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "未読にする" + "value": "Obavještenja na radnoj površini će se pojavljivati ovdje radi brzog pregleda." } - } - } - }, - "notifications.open": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Open" + "value": "Skrivebordsnotifikationer vises her til hurtig gennemgang." } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "開く" + "value": "Desktop-Benachrichtigungen werden hier zur schnellen Überprüfung angezeigt." } - } - } - }, - "notifications.resize": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Resize notifications" + "value": "Desktop notifications will appear here for quick review." } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "通知をリサイズ" + "value": "Las notificaciones de escritorio aparecerán aquí para su revisión rápida." } - } - } - }, - "notifications.resize.hint": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "Drag to resize the notifications popover" + "value": "Les notifications de bureau apparaîtront ici pour une consultation rapide." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Le notifiche desktop appariranno qui per una rapida consultazione." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ドラッグして通知ポップオーバーをリサイズ" + "value": "デスクトップ通知がここに表示されます。" } - } - } - }, - "notifications.row.clear": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Clear notification" + "value": "데스크톱 알림이 여기에 표시되어 빠르게 확인할 수 있습니다." } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "通知をクリア" + "value": "Skrivebordsvarsler vises her for rask gjennomgang." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Powiadomienia pulpitu będą się tu pojawiać do szybkiego przeglądu." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "As notificações da área de trabalho aparecerão aqui para revisão rápida." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Уведомления рабочего стола будут отображаться здесь для быстрого просмотра." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "การแจ้งเตือนเดสก์ท็อปจะปรากฏที่นี่เพื่อตรวจสอบอย่างรวดเร็ว" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Masaüstü bildirimleri hızlı inceleme için burada görünecek." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Сповіщення робочого столу з'являтимуться тут для швидкого перегляду." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "桌面通知将在此处显示,方便快速查看。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "桌面通知將在這裡顯示,方便您快速查看。" } } } }, - "notifications.title": { + "notifications.empty.subtitle": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "الإشعارات" + "value": "ستظهر إشعارات سطح المكتب هنا." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Obavještenja" + "value": "Obavještenja na radnoj površini će se pojavljivati ovdje." } }, "da": { "stringUnit": { "state": "translated", - "value": "Notifikationer" + "value": "Skrivebordsnotifikationer vises her." } }, "de": { "stringUnit": { "state": "translated", - "value": "Benachrichtigungen" + "value": "Desktop-Benachrichtigungen werden hier angezeigt." } }, "en": { "stringUnit": { "state": "translated", - "value": "Notifications" + "value": "Desktop notifications will appear here." } }, "es": { "stringUnit": { "state": "translated", - "value": "Notificaciones" + "value": "Las notificaciones de escritorio aparecerán aquí." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Notifications" + "value": "Les notifications de bureau apparaîtront ici." } }, "it": { "stringUnit": { "state": "translated", - "value": "Notifiche" + "value": "Le notifiche desktop appariranno qui." } }, "ja": { "stringUnit": { "state": "translated", - "value": "通知" + "value": "デスクトップ通知がここに表示されます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "알림" + "value": "데스크톱 알림이 여기에 표시됩니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Varsler" + "value": "Skrivebordsvarsler vises her." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Powiadomienia" + "value": "Powiadomienia pulpitu będą się tu pojawiać." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Notificações" + "value": "As notificações da área de trabalho aparecerão aqui." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Уведомления" + "value": "Уведомления рабочего стола будут отображаться здесь." } }, "th": { "stringUnit": { "state": "translated", - "value": "การแจ้งเตือน" + "value": "การแจ้งเตือนเดสก์ท็อปจะปรากฏที่นี่" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Bildirimler" + "value": "Masaüstü bildirimleri burada görünecek." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Сповіщення" + "value": "Сповіщення робочого столу з'являтимуться тут." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "通知" + "value": "桌面通知将在此处显示。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "通知" + "value": "桌面通知將在這裡顯示。" } } } }, - "paneMemoryGuardrail.banner.detail": { + "notifications.empty.title": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "%1$@ — %2$@" + "value": "لا توجد إشعارات بعد" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "%1$@ — %2$@" + "value": "Još nema obavještenja" } - } - } - }, - "paneMemoryGuardrail.banner.detailWithCommand": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "%1$@ — %2$@ (running %3$@)" + "value": "Ingen notifikationer endnu" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "%1$@ — %2$@(%3$@ を実行中)" + "value": "Noch keine Benachrichtigungen" } - } - } - }, - "paneMemoryGuardrail.banner.dismiss": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Dismiss" + "value": "No notifications yet" } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "閉じる" + "value": "Aún no hay notificaciones" } - } - } - }, - "paneMemoryGuardrail.banner.kill": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "Kill Pane Process" + "value": "Aucune notification pour le moment" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Nessuna notifica" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ペインのプロセスを終了" + "value": "まだ通知はありません" } - } - } - }, - "paneMemoryGuardrail.banner.location": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "%1$@ in %2$@" + "value": "아직 알림이 없습니다" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "%2$@ の %1$@" + "value": "Ingen varsler ennå" } - } - } - }, - "paneMemoryGuardrail.banner.title": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "A pane is using a lot of memory" + "value": "Brak powiadomień" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "ペインが大量のメモリを使用しています" + "value": "Nenhuma notificação ainda" } - } - } - }, - "paneMemoryGuardrail.banner.unnamedPane": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Terminal" + "value": "Уведомлений пока нет" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "ターミナル" + "value": "ยังไม่มีการแจ้งเตือน" } - } - } - }, - "paneMemoryGuardrail.confirm.cancel": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Cancel" + "value": "Henüz bildirim yok" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "キャンセル" + "value": "Сповіщень ще немає" } - } - } - }, - "paneMemoryGuardrail.confirm.kill": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Kill Process" + "value": "暂无通知" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "プロセスを終了" + "value": "尚無通知" } } } }, - "paneMemoryGuardrail.confirm.message": { + "notifications.forwardToPhone.hideContent": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "This sends SIGTERM then SIGKILL to high-memory process groups in the pane. Other process groups are left alone." + "value": "Hide content (send a generic message instead of the terminal text)" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ペイン内の高メモリ使用プロセスグループに SIGTERM、続いて SIGKILL を送信します。他のプロセスグループには影響しません。" + "value": "内容を非表示にする(ターミナルのテキストの代わりに一般的なメッセージを送信)" } } } }, - "paneMemoryGuardrail.confirm.title": { + "notifications.forwardToPhone.mode.always": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Kill this pane's runaway process?" + "value": "Always" } }, "ja": { "stringUnit": { "state": "translated", - "value": "このペインの暴走プロセスを終了しますか?" + "value": "常に" } } } }, - "panel.cloudVM.loading.elapsed": { + "notifications.forwardToPhone.mode.label": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "%ds elapsed" + "value": "When to send" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%d秒経過" + "value": "送信するタイミング" } } } }, - "panel.cloudVM.loading.failed.auth": { + "notifications.forwardToPhone.mode.onlyWhenAway": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux could not open a passwordless terminal session. Try opening the Cloud VM again." + "value": "Only when away from this Mac" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmuxはパスワードなしのターミナルセッションを開けませんでした。Cloud VMをもう一度開いてください。" + "value": "この Mac から離れているときのみ" } } } }, - "panel.cloudVM.loading.failed.elapsed": { + "notifications.forwardToPhone.mode.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Waited %ds before stopping." + "value": "Away means the screen is locked or asleep, the screensaver is running, or there has been no keyboard or mouse input for %lld minutes." } }, "ja": { "stringUnit": { "state": "translated", - "value": "停止するまで%d秒待機しました。" + "value": "離席中とは、画面がロックまたはスリープ中、スクリーンセーバーが実行中、またはキーボードやマウスの入力が %lld 分間ない状態です。" } } } }, - "panel.cloudVM.loading.failed.generic": { + "notifications.forwardToPhone.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Cloud VM could not be opened." + "value": "Send agent notifications to the cmux iPhone app. Off by default; nothing is uploaded unless this is on." } }, "ja": { "stringUnit": { "state": "translated", - "value": "クラウドVMを開けませんでした。" + "value": "エージェントの通知を cmux の iPhone アプリに送信します。デフォルトはオフで、オンにしない限り何もアップロードされません。" } } } }, - "panel.cloudVM.loading.failed.headline": { + "notifications.forwardToPhone.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Cloud VM unavailable" + "value": "Forward notifications to my iPhone" } }, "ja": { "stringUnit": { "state": "translated", - "value": "クラウドVMを利用できません" + "value": "通知を iPhone に転送する" } } } }, - "panel.cloudVM.loading.failed.launch": { + "notifications.jumpToLatest": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Cloud VM command could not be launched." + "value": "Jump to Latest" } }, "ja": { "stringUnit": { "state": "translated", - "value": "クラウドVMコマンドを起動できませんでした。" + "value": "最新へジャンプ" } - } - } - }, - "panel.cloudVM.loading.failed.localServer": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "The local cmux web server is offline. Start it and retry Open Cloud VM." + "value": "최신으로 이동" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "ローカルのcmux Webサーバーがオフラインです。起動してからCloud VMをもう一度開いてください。" + "value": "Перейти до останнього" } } } }, - "panel.cloudVM.loading.failed.missingCommand": { + "notifications.jumpToLatestUnread": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Cloud VM attach command was empty." + "value": "الانتقال إلى أحدث غير مقروء" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "クラウドVM接続コマンドが空です。" + "value": "Skoči na najnovije nepročitano" } - } - } - }, - "panel.cloudVM.loading.failed.serviceUnavailable": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "The Cloud VM service could not create a VM yet. Retry keeps using this pinned Cloud VM slot, and once a VM exists cmux will always reattach to that same VM." + "value": "Gå til seneste ulæste" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "複数回再試行しましたが、Cloud VMサービスの準備が完了しませんでした。ワークスペースは残っています。少し待ってからもう一度お試しください。" + "value": "Zur letzten ungelesenen springen" } - } - } - }, - "panel.cloudVM.loading.headline": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Opening Cloud VM" + "value": "Jump to Latest Unread" } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "クラウドVMを開いています" + "value": "Ir a la última no leída" } - } - } - }, - "panel.cloudVM.loading.message": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "Creating or reattaching to your persistent Cloud VM." + "value": "Aller au dernier message non lu" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Vai all'ultimo non letto" } }, "ja": { "stringUnit": { "state": "translated", - "value": "永続クラウドVMを作成または再接続しています。" + "value": "最新の未読にジャンプ" } - } - } - }, - "panel.cloudVM.loading.step.endpoint": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Waiting for a secure terminal endpoint" + "value": "최신 읽지 않은 항목으로 이동" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "安全なターミナル接続先を待機しています" + "value": "Gå til siste uleste" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Przejdź do najnowszego nieprzeczytanego" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Ir para Última Não Lida" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Перейти к последнему непрочитанному" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "ข้ามไปยังรายการยังไม่อ่านล่าสุด" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Son Okunmamışa Atla" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Перейти до останнього непрочитаного" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "跳转到最新未读" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "跳至最新未讀" } } } }, - "panel.cloudVM.loading.step.request": { + "notifications.markAsRead": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Requesting your persistent VM" + "value": "Mark as Read" } }, "ja": { "stringUnit": { "state": "translated", - "value": "永続VMをリクエストしています" + "value": "既読にする" } } } }, - "panel.cloudVM.loading.step.resume": { + "notifications.markAsUnread": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Starting or resuming the VM" + "value": "Mark as Unread" } }, "ja": { "stringUnit": { "state": "translated", - "value": "VMを起動または再開しています" + "value": "未読にする" } } } }, - "panel.cloudVM.loading.step.retrying": { + "notifications.open": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Still waiting; retrying in the background" + "value": "Open" } }, "ja": { "stringUnit": { "state": "translated", - "value": "まだ待機中です。バックグラウンドで再試行しています" + "value": "開く" } } } }, - "panel.cloudVM.loading.step.terminal": { + "notifications.resize": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Terminal will open automatically when ready" + "value": "Resize notifications" } }, "ja": { "stringUnit": { "state": "translated", - "value": "準備ができたらターミナルが自動で開きます" + "value": "通知をリサイズ" } } } }, - "panel.cloudVM.loading.step.workspace": { + "notifications.resize.hint": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Pinned workspace created" + "value": "Drag to resize the notifications popover" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ピン留めワークスペースを作成しました" + "value": "ドラッグして通知ポップオーバーをリサイズ" } } } }, - "panel.cloudVM.loading.title": { + "notifications.row.clear": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Cloud VM" + "value": "Clear notification" } }, "ja": { "stringUnit": { "state": "translated", - "value": "クラウドVM" + "value": "通知をクリア" } } } }, - "panel.displayName.fallback": { + "notifications.title": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "لسان" + "value": "الإشعارات" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Tab" + "value": "Obavještenja" } }, "da": { "stringUnit": { "state": "translated", - "value": "Fane" + "value": "Notifikationer" } }, "de": { "stringUnit": { "state": "translated", - "value": "Tab" + "value": "Benachrichtigungen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Tab" + "value": "Notifications" } }, "es": { "stringUnit": { "state": "translated", - "value": "Pestaña" + "value": "Notificaciones" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Onglet" + "value": "Notifications" } }, "it": { "stringUnit": { "state": "translated", - "value": "Scheda" + "value": "Notifiche" } }, "ja": { "stringUnit": { "state": "translated", - "value": "タブ" + "value": "通知" } }, "ko": { "stringUnit": { "state": "translated", - "value": "탭" + "value": "알림" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Fane" + "value": "Varsler" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Karta" + "value": "Powiadomienia" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Aba" + "value": "Notificações" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Вкладка" + "value": "Уведомления" } }, "th": { "stringUnit": { "state": "translated", - "value": "แท็บ" + "value": "การแจ้งเตือน" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Sekme" + "value": "Bildirimler" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Вкладка" + "value": "Сповіщення" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "标签页" + "value": "通知" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "標籤頁" + "value": "通知" } } } }, - "panel.openFolder.prompt": { + "paneMemoryGuardrail.banner.detail": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "فتح" + "value": "%1$@ — %2$@" } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Otvori" + "value": "%1$@ — %2$@" } - }, - "da": { + } + } + }, + "paneMemoryGuardrail.banner.detailWithCommand": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Åbn" + "value": "%1$@ — %2$@ (running %3$@)" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Öffnen" + "value": "%1$@ — %2$@(%3$@ を実行中)" } - }, + } + } + }, + "paneMemoryGuardrail.banner.dismiss": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Open" + "value": "Dismiss" } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "Abrir" + "value": "閉じる" } - }, - "fr": { + } + } + }, + "paneMemoryGuardrail.banner.kill": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Ouvrir" + "value": "Kill Pane Process" } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "Apri" + "value": "ペインのプロセスを終了" + } + } + } + }, + "paneMemoryGuardrail.banner.location": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%1$@ in %2$@" } }, "ja": { "stringUnit": { "state": "translated", - "value": "開く" + "value": "%2$@ の %1$@" } - }, - "ko": { + } + } + }, + "paneMemoryGuardrail.banner.title": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "열기" + "value": "A pane is using a lot of memory" } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "Åpne" + "value": "ペインが大量のメモリを使用しています" } - }, - "pl": { + } + } + }, + "paneMemoryGuardrail.banner.unnamedPane": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Otwórz" + "value": "Terminal" } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "Abrir" + "value": "ターミナル" } - }, - "ru": { + } + } + }, + "paneMemoryGuardrail.confirm.cancel": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Открыть" + "value": "Cancel" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "เปิด" + "value": "キャンセル" } - }, - "tr": { + } + } + }, + "paneMemoryGuardrail.confirm.kill": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Aç" + "value": "Kill Process" } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "Відкрити" + "value": "プロセスを終了" } - }, - "zh-Hans": { + } + } + }, + "paneMemoryGuardrail.confirm.message": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "打开" + "value": "This sends SIGTERM then SIGKILL to high-memory process groups in the pane. Other process groups are left alone." } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "開啟" + "value": "ペイン内の高メモリ使用プロセスグループに SIGTERM、続いて SIGKILL を送信します。他のプロセスグループには影響しません。" } } } }, - "panel.openFolder.title": { + "paneMemoryGuardrail.confirm.title": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "فتح مجلد" + "value": "Kill this pane's runaway process?" } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Otvori folder" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Åbn mappe" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Ordner öffnen" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Open Folder" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Abrir carpeta" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Ouvrir un dossier" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Apri cartella" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "フォルダを開く" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "폴더 열기" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Åpne mappe" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Otwórz folder" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Abrir Pasta" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Открыть папку" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "เปิดโฟลเดอร์" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Klasör Aç" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Відкрити теку" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "打开文件夹" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "開啟資料夾" + "value": "このペインの暴走プロセスを終了しますか?" } } } }, - "pricing.enterprise.cta": { + "panel.cloudVM.loading.elapsed": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Contact sales" + "value": "%ds elapsed" } }, "ja": { "stringUnit": { "state": "translated", - "value": "営業に問い合わせ" + "value": "%d秒経過" } } } }, - "pricing.enterprise.f1": { + "panel.cloudVM.loading.failed.auth": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Self-host agent execution, air-gapped" + "value": "cmux could not open a passwordless terminal session. Try opening the Cloud VM again." } }, "ja": { "stringUnit": { "state": "translated", - "value": "エージェント実行をセルフホスト、エアギャップ対応" + "value": "cmuxはパスワードなしのターミナルセッションを開けませんでした。Cloud VMをもう一度開いてください。" } } } }, - "pricing.enterprise.f2": { + "panel.cloudVM.loading.failed.elapsed": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "SSO / SAML, audit logs" + "value": "Waited %ds before stopping." } }, "ja": { "stringUnit": { "state": "translated", - "value": "SSO / SAML、監査ログ" + "value": "停止するまで%d秒待機しました。" } } } }, - "pricing.enterprise.f3": { + "panel.cloudVM.loading.failed.generic": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "SOC 2" + "value": "Cloud VM could not be opened." } }, "ja": { "stringUnit": { "state": "translated", - "value": "SOC 2" + "value": "クラウドVMを開けませんでした。" } } } }, - "pricing.enterprise.name": { + "panel.cloudVM.loading.failed.headline": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Enterprise" + "value": "Cloud VM unavailable" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Enterprise" + "value": "クラウドVMを利用できません" } } } }, - "pricing.enterprise.note": { + "panel.cloudVM.loading.failed.launch": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Self-hosting and compliance." + "value": "Cloud VM command could not be launched." } }, "ja": { "stringUnit": { "state": "translated", - "value": "セルフホスティングとコンプライアンス。" + "value": "クラウドVMコマンドを起動できませんでした。" } } } }, - "pricing.enterprise.price": { + "panel.cloudVM.loading.failed.localServer": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Custom" + "value": "The local cmux web server is offline. Start it and retry Open Cloud VM." } }, "ja": { "stringUnit": { "state": "translated", - "value": "カスタム" + "value": "ローカルのcmux Webサーバーがオフラインです。起動してからCloud VMをもう一度開いてください。" } } } }, - "pricing.footnote": { + "panel.cloudVM.loading.failed.missingCommand": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "One click with your cmux account. Cancel anytime." + "value": "Cloud VM attach command was empty." } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmuxアカウントでワンクリック。いつでも解約できます。" + "value": "クラウドVM接続コマンドが空です。" } } } }, - "pricing.free.cta": { + "panel.cloudVM.loading.failed.serviceUnavailable": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Download for Mac" + "value": "The Cloud VM service could not create a VM yet. Retry keeps using this pinned Cloud VM slot, and once a VM exists cmux will always reattach to that same VM." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Mac版をダウンロード" + "value": "複数回再試行しましたが、Cloud VMサービスの準備が完了しませんでした。ワークスペースは残っています。少し待ってからもう一度お試しください。" } } } }, - "pricing.free.f1": { + "panel.cloudVM.loading.headline": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Native macOS terminal built on Ghostty, open source" + "value": "Opening Cloud VM" } }, "ja": { "stringUnit": { "state": "translated", - "value": "GhosttyベースのネイティブmacOSターミナル、オープンソース" + "value": "クラウドVMを開いています" } } } }, - "pricing.free.f2": { + "panel.cloudVM.loading.message": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Unlimited local terminals and agents" + "value": "Creating or reattaching to your persistent Cloud VM." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ローカルのターミナルとエージェントは無制限" + "value": "永続クラウドVMを作成または再接続しています。" } } } }, - "pricing.free.f3": { + "panel.cloudVM.loading.step.endpoint": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "5 active Cloud VMs, 20 VM creates" + "value": "Waiting for a secure terminal endpoint" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Cloud VMは同時5台、作成20回" + "value": "安全なターミナル接続先を待機しています" } } } }, - "pricing.free.f4": { + "panel.cloudVM.loading.step.request": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Community support" + "value": "Requesting your persistent VM" } }, "ja": { "stringUnit": { "state": "translated", - "value": "コミュニティサポート" + "value": "永続VMをリクエストしています" } } } }, - "pricing.free.name": { + "panel.cloudVM.loading.step.resume": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Free" + "value": "Starting or resuming the VM" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Free" + "value": "VMを起動または再開しています" } } } }, - "pricing.free.note": { + "panel.cloudVM.loading.step.retrying": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "The full terminal, forever." + "value": "Still waiting; retrying in the background" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ターミナルのすべてを、ずっと無料で。" + "value": "まだ待機中です。バックグラウンドで再試行しています" } } } }, - "pricing.native.compare.admin": { + "panel.cloudVM.loading.step.terminal": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Centralized admin and shared team rules" + "value": "Terminal will open automatically when ready" } }, "ja": { "stringUnit": { "state": "translated", - "value": "一元管理と共有チームルール" + "value": "準備ができたらターミナルが自動で開きます" } } } }, - "pricing.native.compare.agents": { + "panel.cloudVM.loading.step.workspace": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Local CLI agents with your own keys" + "value": "Pinned workspace created" } }, "ja": { "stringUnit": { "state": "translated", - "value": "自分のキーで動かすローカル CLI エージェント" + "value": "ピン留めワークスペースを作成しました" } } } }, - "pricing.native.compare.billing": { + "panel.cloudVM.loading.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Unified billing and seat management" + "value": "Cloud VM" } }, "ja": { "stringUnit": { "state": "translated", - "value": "請求とシート管理の一元化" + "value": "クラウドVM" } } } }, - "pricing.native.compare.cloud": { + "panel.displayName.fallback": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Cloud agents on Cloud VMs" + "value": "لسان" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "Cloud VM 上のクラウドエージェント" + "value": "Tab" } - } - } - }, - "pricing.native.compare.cloud.enterprise": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Committed usage" + "value": "Fane" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "契約利用量" + "value": "Tab" } - } - } - }, - "pricing.native.compare.cloud.free": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "1 VM trial" + "value": "Tab" } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "VM トライアル 1 回" + "value": "Pestaña" } - } - } - }, - "pricing.native.compare.cloud.pro": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "20 hrs/mo, then usage-based" + "value": "Onglet" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Scheda" } }, "ja": { "stringUnit": { "state": "translated", - "value": "月 20 時間、その後は従量課金" + "value": "タブ" } - } - } - }, - "pricing.native.compare.cloud.team": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Pooled, usage-based" + "value": "탭" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "共有、従量課金" + "value": "Fane" } - } - } - }, - "pricing.native.compare.concurrent": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Concurrent Cloud VMs" + "value": "Karta" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "同時 Cloud VM 数" + "value": "Aba" } - } - } - }, - "pricing.native.compare.concurrent.free": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "1" + "value": "Вкладка" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "1" + "value": "แท็บ" } - } - } - }, - "pricing.native.compare.custom": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Custom" + "value": "Sekme" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "カスタム" + "value": "Вкладка" } - } - } - }, - "pricing.native.compare.gateway": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Model gateway: routing and usage analytics" + "value": "标签页" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "モデルゲートウェイ: ルーティングと利用分析" + "value": "標籤頁" } } } }, - "pricing.native.compare.ios": { + "panel.openFolder.prompt": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "iOS app" + "value": "فتح" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "iOS アプリ" + "value": "Otvori" } - } - } - }, - "pricing.native.compare.selfHosted": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Self-hosted and air-gapped execution" + "value": "Åbn" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "セルフホストとエアギャップ実行" + "value": "Öffnen" } - } - } - }, - "pricing.native.compare.sso": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "SSO and SAML sign-in" + "value": "Open" } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "SSO と SAML サインイン" + "value": "Abrir" } - } - } - }, - "pricing.native.compare.support": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "Support" + "value": "Ouvrir" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Apri" } }, "ja": { "stringUnit": { "state": "translated", - "value": "サポート" + "value": "開く" } - } - } - }, - "pricing.native.compare.support.community": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Community" + "value": "열기" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "コミュニティ" + "value": "Åpne" } - } - } - }, - "pricing.native.compare.support.dedicated": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Dedicated" + "value": "Otwórz" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "専任" + "value": "Abrir" } - } - } - }, - "pricing.native.compare.support.email": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Email" + "value": "Открыть" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "メール" + "value": "เปิด" } - } - } - }, - "pricing.native.compare.support.priority": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Priority" + "value": "Aç" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "優先" + "value": "Відкрити" } - } - } - }, - "pricing.native.compare.terminal": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Native macOS terminal, open source" + "value": "打开" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "オープンソースのネイティブ macOS ターミナル" + "value": "開啟" } } } }, - "pricing.native.compare.title": { + "panel.openFolder.title": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Compare plans" + "value": "فتح مجلد" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "プラン比較" + "value": "Otvori folder" } - } - } - }, - "pricing.native.compare.usageBased": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Usage-based" + "value": "Åbn mappe" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "従量課金" + "value": "Ordner öffnen" } - } - } - }, - "pricing.native.compare.workspace": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Vertical tabs, splits, notifications, socket API" + "value": "Open Folder" } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "縦タブ、分割、通知、ソケット API" + "value": "Abrir carpeta" } - } - } - }, - "pricing.native.current": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "Current" + "value": "Ouvrir un dossier" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Apri cartella" } }, "ja": { "stringUnit": { "state": "translated", - "value": "現在" + "value": "フォルダを開く" } - } - } - }, - "pricing.native.currentPlan": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Current plan" + "value": "폴더 열기" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "現在のプラン" + "value": "Åpne mappe" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Otwórz folder" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Abrir Pasta" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Открыть папку" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "เปิดโฟลเดอร์" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Klasör Aç" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Відкрити теку" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "打开文件夹" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "開啟資料夾" } } } }, - "pricing.native.enterprise.cta": { + "pricing.enterprise.cta": { "extractionState": "manual", "localizations": { "en": { @@ -128561,97 +128489,97 @@ "ja": { "stringUnit": { "state": "translated", - "value": "営業に問い合わせる" + "value": "営業に問い合わせ" } } } }, - "pricing.native.enterprise.feature.audit": { + "pricing.enterprise.f1": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Audit logs and dedicated support" + "value": "Self-host agent execution, air-gapped" } }, "ja": { "stringUnit": { "state": "translated", - "value": "監査ログと専任サポート" + "value": "エージェント実行をセルフホスト、エアギャップ対応" } } } }, - "pricing.native.enterprise.feature.gateway": { + "pricing.enterprise.f2": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Self-hosted model gateway" + "value": "SSO / SAML, audit logs" } }, "ja": { "stringUnit": { "state": "translated", - "value": "セルフホストのモデルゲートウェイ" + "value": "SSO / SAML、監査ログ" } } } }, - "pricing.native.enterprise.feature.selfHosted": { + "pricing.enterprise.f3": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Self-hosted Cloud execution and networking" + "value": "SOC 2" } }, "ja": { "stringUnit": { "state": "translated", - "value": "セルフホストの Cloud 実行とネットワーク" + "value": "SOC 2" } } } }, - "pricing.native.enterprise.feature.sla": { + "pricing.enterprise.name": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "SOC 2 and an SLA" + "value": "Enterprise" } }, "ja": { "stringUnit": { "state": "translated", - "value": "SOC 2 と SLA" + "value": "Enterprise" } } } }, - "pricing.native.enterprise.feature.sso": { + "pricing.enterprise.note": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "SSO and SAML sign-in" + "value": "Self-hosting and compliance." } }, "ja": { "stringUnit": { "state": "translated", - "value": "SSO と SAML サインイン" + "value": "セルフホスティングとコンプライアンス。" } } } }, - "pricing.native.enterprise.price": { + "pricing.enterprise.price": { "extractionState": "manual", "localizations": { "en": { @@ -128668,1864 +128596,2561 @@ } } }, - "pricing.native.eyebrow": { + "pricing.footnote": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "One click with your cmux account. Cancel anytime." } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "cmuxアカウントでワンクリック。いつでも解約できます。" } } } }, - "pricing.native.free.feature.agents": { + "pricing.free.cta": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Claude Code, Codex, Gemini, and local CLI agents" + "value": "Download for Mac" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Claude Code、Codex、Gemini、ローカル CLI エージェント" + "value": "Mac版をダウンロード" } } } }, - "pricing.native.free.feature.community": { + "pricing.free.f1": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Community support on Discord and GitHub" + "value": "Native macOS terminal built on Ghostty, open source" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Discord と GitHub でのコミュニティサポート" + "value": "GhosttyベースのネイティブmacOSターミナル、オープンソース" } } } }, - "pricing.native.free.feature.terminal": { + "pricing.free.f2": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Native Ghostty-based terminal" + "value": "Unlimited local terminals and agents" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Ghostty ベースのネイティブターミナル" + "value": "ローカルのターミナルとエージェントは無制限" } } } }, - "pricing.native.free.feature.trial": { + "pricing.free.f3": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Local session history and one Cloud VM trial" + "value": "5 active Cloud VMs, 20 VM creates" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ローカルセッション履歴と Cloud VM の1回分トライアル" + "value": "Cloud VMは同時5台、作成20回" } } } }, - "pricing.native.free.feature.workspaces": { + "pricing.free.f4": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Vertical tabs, split panes, browser panels, and notifications" + "value": "Community support" } }, "ja": { "stringUnit": { "state": "translated", - "value": "縦型タブ、分割ペイン、ブラウザパネル、通知" + "value": "コミュニティサポート" } } } }, - "pricing.native.free.price": { + "pricing.free.name": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "$0" + "value": "Free" } }, "ja": { "stringUnit": { "state": "translated", - "value": "$0" + "value": "Free" } } } }, - "pricing.native.metric.compute": { + "pricing.free.note": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Included compute" + "value": "The full terminal, forever." } }, "ja": { "stringUnit": { "state": "translated", - "value": "含まれる計算時間" + "value": "ターミナルのすべてを、ずっと無料で。" } } } }, - "pricing.native.metric.compute.value": { + "pricing.native.compare.admin": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "20 hrs/mo" + "value": "Centralized admin and shared team rules" } }, "ja": { "stringUnit": { "state": "translated", - "value": "月20時間" + "value": "一元管理と共有チームルール" } } } }, - "pricing.native.metric.usage": { + "pricing.native.compare.agents": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Extra usage" + "value": "Local CLI agents with your own keys" } }, "ja": { "stringUnit": { "state": "translated", - "value": "追加利用" + "value": "自分のキーで動かすローカル CLI エージェント" } } } }, - "pricing.native.metric.usage.value": { + "pricing.native.compare.billing": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "metered" + "value": "Unified billing and seat management" } }, "ja": { "stringUnit": { "state": "translated", - "value": "従量課金" + "value": "請求とシート管理の一元化" } } } }, - "pricing.native.metric.vm": { + "pricing.native.compare.cloud": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Default VM" + "value": "Cloud agents on Cloud VMs" } }, "ja": { "stringUnit": { "state": "translated", - "value": "標準 VM" + "value": "Cloud VM 上のクラウドエージェント" } } } }, - "pricing.native.metric.vm.value": { + "pricing.native.compare.cloud.enterprise": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "4 vCPU / 16 GB" + "value": "Committed usage" } }, "ja": { "stringUnit": { "state": "translated", - "value": "4 vCPU / 16 GB" + "value": "契約利用量" } } } }, - "pricing.native.period.month": { + "pricing.native.compare.cloud.free": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "/month" + "value": "1 VM trial" } }, "ja": { "stringUnit": { "state": "translated", - "value": "/月" + "value": "VM トライアル 1 回" } } } }, - "pricing.native.period.userMonth": { + "pricing.native.compare.cloud.pro": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "/user/month" + "value": "20 hrs/mo, then usage-based" } }, "ja": { "stringUnit": { "state": "translated", - "value": "/ユーザー/月" + "value": "月 20 時間、その後は従量課金" } } } }, - "pricing.native.plan.enterprise": { + "pricing.native.compare.cloud.team": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Enterprise" + "value": "Pooled, usage-based" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Enterprise" + "value": "共有、従量課金" } } } }, - "pricing.native.plan.free": { + "pricing.native.compare.concurrent": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Free" + "value": "Concurrent Cloud VMs" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Free" + "value": "同時 Cloud VM 数" } } } }, - "pricing.native.plan.pro": { + "pricing.native.compare.concurrent.free": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Pro" + "value": "1" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Pro" + "value": "1" } } } }, - "pricing.native.plan.team": { + "pricing.native.compare.custom": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Team" + "value": "Custom" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Team" + "value": "カスタム" } } } }, - "pricing.native.pro.feature.gateway": { + "pricing.native.compare.gateway": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Model gateway with usage and cost analytics" + "value": "Model gateway: routing and usage analytics" } }, "ja": { "stringUnit": { "state": "translated", - "value": "使用量とコスト分析付きのモデルゲートウェイ" + "value": "モデルゲートウェイ: ルーティングと利用分析" } } } }, - "pricing.native.pro.feature.hours": { + "pricing.native.compare.ios": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "20 active compute-hours per month, then usage-based" + "value": "iOS app" } }, "ja": { "stringUnit": { "state": "translated", - "value": "月20時間のアクティブ計算時間、その後は従量課金" + "value": "iOS アプリ" } } } }, - "pricing.native.pro.feature.ios": { + "pricing.native.compare.selfHosted": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux iOS app and email support" + "value": "Self-hosted and air-gapped execution" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux iOS アプリとメールサポート" + "value": "セルフホストとエアギャップ実行" } } } }, - "pricing.native.pro.feature.vms": { + "pricing.native.compare.sso": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Cloud agents on isolated Cloud VMs" + "value": "SSO and SAML sign-in" } }, "ja": { "stringUnit": { "state": "translated", - "value": "分離された Cloud VM 上のクラウドエージェント" + "value": "SSO と SAML サインイン" } } } }, - "pricing.native.pro.price": { + "pricing.native.compare.support": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "$30" + "value": "Support" } }, "ja": { "stringUnit": { "state": "translated", - "value": "$30" + "value": "サポート" } } } }, - "pricing.native.signInToUpgrade": { + "pricing.native.compare.support.community": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Get Pro" + "value": "Community" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Pro を入手" + "value": "コミュニティ" } } } }, - "pricing.native.signedIn": { + "pricing.native.compare.support.dedicated": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Signed in" + "value": "Dedicated" } }, "ja": { "stringUnit": { "state": "translated", - "value": "サインイン済み" + "value": "専任" } } } }, - "pricing.native.signedOut": { + "pricing.native.compare.support.email": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Signed out" + "value": "Email" } }, "ja": { "stringUnit": { "state": "translated", - "value": "サインアウト中" + "value": "メール" } } } }, - "pricing.native.size.large.rate": { + "pricing.native.compare.support.priority": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "$0.80" + "value": "Priority" } }, "ja": { "stringUnit": { "state": "translated", - "value": "$0.80" + "value": "優先" } } } }, - "pricing.native.size.large.use": { + "pricing.native.compare.terminal": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Heavy builds and parallel agents" + "value": "Native macOS terminal, open source" } }, "ja": { "stringUnit": { "state": "translated", - "value": "重いビルドと並列エージェント" + "value": "オープンソースのネイティブ macOS ターミナル" } } } }, - "pricing.native.size.medium.rate": { + "pricing.native.compare.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "$0.40" + "value": "Compare plans" } }, "ja": { "stringUnit": { "state": "translated", - "value": "$0.40" + "value": "プラン比較" } } } }, - "pricing.native.size.medium.use": { + "pricing.native.compare.usageBased": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Standard development" + "value": "Usage-based" } }, "ja": { "stringUnit": { "state": "translated", - "value": "標準的な開発" + "value": "従量課金" } } } }, - "pricing.native.size.small.rate": { + "pricing.native.compare.workspace": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "$0.20" + "value": "Vertical tabs, splits, notifications, socket API" } }, "ja": { "stringUnit": { "state": "translated", - "value": "$0.20" + "value": "縦タブ、分割、通知、ソケット API" } } } }, - "pricing.native.size.small.use": { + "pricing.native.current": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Light agents and quick tasks" + "value": "Current" } }, "ja": { "stringUnit": { "state": "translated", - "value": "軽いエージェントと短いタスク" + "value": "現在" } } } }, - "pricing.native.sizes.body": { + "pricing.native.currentPlan": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Pick a VM size per agent. You are billed per active compute-hour, and idle VMs suspend automatically. Pro includes 20 hours per month on the 4 vCPU / 16 GB size." + "value": "Current plan" } }, "ja": { "stringUnit": { "state": "translated", - "value": "エージェントごとに VM サイズを選びます。課金はアクティブなコンピュート時間単位で、アイドル状態の VM は自動停止します。Pro には 4 vCPU / 16 GB サイズで月 20 時間が含まれます。" + "value": "現在のプラン" } } } }, - "pricing.native.sizes.colRate": { + "pricing.native.enterprise.cta": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Per active hour" + "value": "Contact sales" } }, "ja": { "stringUnit": { "state": "translated", - "value": "アクティブ時間あたり" + "value": "営業に問い合わせる" } } } }, - "pricing.native.sizes.colSize": { + "pricing.native.enterprise.feature.audit": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Size" + "value": "Audit logs and dedicated support" } }, "ja": { "stringUnit": { "state": "translated", - "value": "サイズ" + "value": "監査ログと専任サポート" } } } }, - "pricing.native.sizes.colUse": { + "pricing.native.enterprise.feature.gateway": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Best for" + "value": "Self-hosted model gateway" } }, "ja": { "stringUnit": { "state": "translated", - "value": "用途" + "value": "セルフホストのモデルゲートウェイ" } } } }, - "pricing.native.sizes.title": { + "pricing.native.enterprise.feature.selfHosted": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Cloud VM sizes" + "value": "Self-hosted Cloud execution and networking" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Cloud VM サイズ" + "value": "セルフホストの Cloud 実行とネットワーク" } } } }, - "pricing.native.status.billingUnavailable": { + "pricing.native.enterprise.feature.sla": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Billing is not configured for this environment." + "value": "SOC 2 and an SLA" } }, "ja": { "stringUnit": { "state": "translated", - "value": "この環境では請求機能が設定されていません。" + "value": "SOC 2 と SLA" } } } }, - "pricing.native.status.loading": { + "pricing.native.enterprise.feature.sso": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Checking your current plan…" + "value": "SSO and SAML sign-in" } }, "ja": { "stringUnit": { "state": "translated", - "value": "現在のプランを確認中…" + "value": "SSO と SAML サインイン" } } } }, - "pricing.native.status.retry": { + "pricing.native.enterprise.price": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Retry" + "value": "Custom" } }, "ja": { "stringUnit": { "state": "translated", - "value": "再試行" + "value": "カスタム" } } } }, - "pricing.native.status.unavailable": { + "pricing.native.eyebrow": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Billing status unavailable" + "value": "cmux Pro" } }, "ja": { "stringUnit": { "state": "translated", - "value": "請求ステータスを取得できません" + "value": "cmux Pro" } } } }, - "pricing.native.team.cta": { + "pricing.native.free.feature.agents": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Get Teams" + "value": "Claude Code, Codex, Gemini, and local CLI agents" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Teams を入手" + "value": "Claude Code、Codex、Gemini、ローカル CLI エージェント" } } } }, - "pricing.native.team.feature.billing": { + "pricing.native.free.feature.community": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Unified billing for the whole team" + "value": "Community support on Discord and GitHub" } }, "ja": { "stringUnit": { "state": "translated", - "value": "チーム全体の請求を一元管理" + "value": "Discord と GitHub でのコミュニティサポート" } } } }, - "pricing.native.team.feature.compute": { + "pricing.native.free.feature.terminal": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Pooled Cloud VM compute hours" + "value": "Native Ghostty-based terminal" } }, "ja": { "stringUnit": { "state": "translated", - "value": "共有 Cloud VM コンピュート時間" + "value": "Ghostty ベースのネイティブターミナル" } } } }, - "pricing.native.team.feature.gateway": { + "pricing.native.free.feature.trial": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Team-wide model gateway analytics" + "value": "Local session history and one Cloud VM trial" } }, "ja": { "stringUnit": { "state": "translated", - "value": "チーム全体のモデルゲートウェイ分析" + "value": "ローカルセッション履歴と Cloud VM の1回分トライアル" } } } }, - "pricing.native.team.feature.seats": { + "pricing.native.free.feature.workspaces": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Centralized seat management" + "value": "Vertical tabs, split panes, browser panels, and notifications" } }, "ja": { "stringUnit": { "state": "translated", - "value": "シート管理を一元化" + "value": "縦型タブ、分割ペイン、ブラウザパネル、通知" } } } }, - "pricing.native.team.feature.support": { + "pricing.native.free.price": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Priority email support" + "value": "$0" } }, "ja": { "stringUnit": { "state": "translated", - "value": "優先メールサポート" + "value": "$0" } } } }, - "pricing.native.team.price": { + "pricing.native.metric.compute": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "$35" + "value": "Included compute" } }, "ja": { "stringUnit": { "state": "translated", - "value": "$35" + "value": "含まれる計算時間" } } } }, - "pricing.native.title": { + "pricing.native.metric.compute.value": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Pricing" + "value": "20 hrs/mo" } }, "ja": { "stringUnit": { "state": "translated", - "value": "料金" + "value": "月20時間" } } } }, - "pricing.native.upgrade": { + "pricing.native.metric.usage": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Get Pro" + "value": "Extra usage" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Pro を入手" + "value": "追加利用" } } } }, - "pricing.native.window.title": { + "pricing.native.metric.usage.value": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux Upgrade" + "value": "metered" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux アップグレード" + "value": "従量課金" } } } }, - "pricing.perMonth": { + "pricing.native.metric.vm": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "/month" + "value": "Default VM" } }, "ja": { "stringUnit": { "state": "translated", - "value": "/月" + "value": "標準 VM" } } } }, - "pricing.perUserMonth": { + "pricing.native.metric.vm.value": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "/user/month" + "value": "4 vCPU / 16 GB" } }, "ja": { "stringUnit": { "state": "translated", - "value": "/ユーザー/月" + "value": "4 vCPU / 16 GB" } } } }, - "pricing.pro.cta": { + "pricing.native.period.month": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Get Pro" + "value": "/month" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Pro を入手" + "value": "/月" } } } }, - "pricing.pro.f1": { + "pricing.native.period.userMonth": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Everything in Free" + "value": "/user/month" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Freeのすべて" + "value": "/ユーザー/月" } } } }, - "pricing.pro.f2": { + "pricing.native.plan.enterprise": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Cloud dev boxes: 10 active, unlimited creates" + "value": "Enterprise" } }, "ja": { "stringUnit": { "state": "translated", - "value": "クラウド開発マシン: 同時10台、作成無制限" + "value": "Enterprise" } } } }, - "pricing.pro.f3": { + "pricing.native.plan.free": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "20 compute-hours/mo on a 4 vCPU / 16 GB VM" + "value": "Free" } }, "ja": { "stringUnit": { "state": "translated", - "value": "4 vCPU / 16 GB VMで毎月20計算時間" + "value": "Free" } } } }, - "pricing.pro.f4": { + "pricing.native.plan.pro": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "iOS app: your Mac's terminals on your iPhone" + "value": "Pro" } }, "ja": { "stringUnit": { "state": "translated", - "value": "iOSアプリ: MacのターミナルをiPhoneから" + "value": "Pro" } } } }, - "pricing.pro.f5": { + "pricing.native.plan.team": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux AI early access + priority support" + "value": "Team" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux AI早期アクセス + 優先サポート" + "value": "Team" } } } }, - "pricing.pro.name": { + "pricing.native.pro.feature.gateway": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "Model gateway with usage and cost analytics" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "使用量とコスト分析付きのモデルゲートウェイ" } } } }, - "pricing.pro.note": { + "pricing.native.pro.feature.hours": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Billed annually ($360/yr), or $45 month-to-month." + "value": "20 active compute-hours per month, then usage-based" } }, "ja": { "stringUnit": { "state": "translated", - "value": "年払い($360/年)、または月払い$45。" + "value": "月20時間のアクティブ計算時間、その後は従量課金" } } } }, - "pricing.pro.workspace.title": { + "pricing.native.pro.feature.ios": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "cmux iOS app and email support" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "cmux iOS アプリとメールサポート" } } } }, - "pricing.subtitle": { + "pricing.native.pro.feature.vms": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux is free and open source, and always will be. Pro adds the cloud." + "value": "Cloud agents on isolated Cloud VMs" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmuxはこれからも無料でオープンソースです。Proはクラウドを追加します。" + "value": "分離された Cloud VM 上のクラウドエージェント" } } } }, - "pricing.team.cta": { + "pricing.native.pro.price": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Get Teams" + "value": "$30" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Teams を入手" + "value": "$30" } } } }, - "pricing.team.f1": { + "pricing.native.signInToUpgrade": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Everything in Pro for every member" + "value": "Get Pro" } }, "ja": { "stringUnit": { "state": "translated", - "value": "全メンバーにProのすべて" + "value": "Pro を入手" } } } }, - "pricing.team.f2": { + "pricing.native.signedIn": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Shared team billing" + "value": "Signed in" } }, "ja": { "stringUnit": { "state": "translated", - "value": "チーム共有の請求" + "value": "サインイン済み" } } } }, - "pricing.team.f3": { + "pricing.native.signedOut": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Centralized Cloud VM usage" + "value": "Signed out" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Cloud VM使用量の一元管理" + "value": "サインアウト中" } } } }, - "pricing.team.name": { + "pricing.native.size.large.rate": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Team" + "value": "$0.80" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Team" + "value": "$0.80" } } } }, - "pricing.team.note": { + "pricing.native.size.large.use": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Everything in Pro, per seat." + "value": "Heavy builds and parallel agents" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Proのすべてを、席ごとに。" + "value": "重いビルドと並列エージェント" } } } }, - "pricing.title": { + "pricing.native.size.medium.rate": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Pricing" + "value": "$0.40" } }, "ja": { "stringUnit": { "state": "translated", - "value": "料金" + "value": "$0.40" } } } }, - "pricing.window.title": { + "pricing.native.size.medium.use": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "Standard development" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux Pro" + "value": "標準的な開発" } } } }, - "projectSchemes.badge.personal": { + "pricing.native.size.small.rate": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "personal" + "value": "$0.20" } }, "ja": { "stringUnit": { "state": "translated", - "value": "個人" + "value": "$0.20" } } } }, - "projectSchemes.badge.shared": { + "pricing.native.size.small.use": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "shared" + "value": "Light agents and quick tasks" } }, "ja": { "stringUnit": { "state": "translated", - "value": "共有" + "value": "軽いエージェントと短いタスク" } } } }, - "projectSchemes.detail.archiveTarget": { + "pricing.native.sizes.body": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Archive target" + "value": "Pick a VM size per agent. You are billed per active compute-hour, and idle VMs suspend automatically. Pro includes 20 hours per month on the 4 vCPU / 16 GB size." } }, "ja": { "stringUnit": { "state": "translated", - "value": "アーカイブターゲット" + "value": "エージェントごとに VM サイズを選びます。課金はアクティブなコンピュート時間単位で、アイドル状態の VM は自動停止します。Pro には 4 vCPU / 16 GB サイズで月 20 時間が含まれます。" } } } }, - "projectSchemes.detail.environment": { + "pricing.native.sizes.colRate": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Environment" + "value": "Per active hour" } }, "ja": { "stringUnit": { "state": "translated", - "value": "環境" + "value": "アクティブ時間あたり" } } } }, - "projectSchemes.detail.launchArguments": { + "pricing.native.sizes.colSize": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Launch arguments" + "value": "Size" } }, "ja": { "stringUnit": { "state": "translated", - "value": "起動引数" + "value": "サイズ" } } } }, - "projectSchemes.detail.profileTarget": { + "pricing.native.sizes.colUse": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Profile target" + "value": "Best for" } }, "ja": { "stringUnit": { "state": "translated", - "value": "プロファイルターゲット" + "value": "用途" } } } }, - "projectSchemes.detail.runTarget": { + "pricing.native.sizes.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Run target" + "value": "Cloud VM sizes" } }, "ja": { "stringUnit": { "state": "translated", - "value": "実行ターゲット" + "value": "Cloud VM サイズ" } } } }, - "projectSchemes.detail.testTargets": { + "pricing.native.status.billingUnavailable": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Test targets" + "value": "Billing is not configured for this environment." } }, "ja": { "stringUnit": { "state": "translated", - "value": "テストターゲット" + "value": "この環境では請求機能が設定されていません。" } } } }, - "projectSchemes.detail.visibility": { + "pricing.native.status.loading": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Visibility" + "value": "Checking your current plan…" } }, "ja": { "stringUnit": { "state": "translated", - "value": "表示範囲" + "value": "現在のプランを確認中…" } } } }, - "projectSchemes.detail.visibilityPersonal": { + "pricing.native.status.retry": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Personal (current user)" + "value": "Retry" } }, "ja": { "stringUnit": { "state": "translated", - "value": "個人(現在のユーザー)" + "value": "再試行" } } } }, - "projectSchemes.detail.visibilityShared": { + "pricing.native.status.unavailable": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Shared" + "value": "Billing status unavailable" } }, "ja": { "stringUnit": { "state": "translated", - "value": "共有" + "value": "請求ステータスを取得できません" } } } }, - "projectSchemes.empty.hint": { + "pricing.native.team.cta": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Pick a scheme on the left to inspect its run / test / profile / archive targets and launch settings." + "value": "Get Teams" } }, "ja": { "stringUnit": { "state": "translated", - "value": "左側のスキームを選択して、実行 / テスト / プロファイル / アーカイブのターゲットと起動設定を確認します。" + "value": "Teams を入手" } } } }, - "projectSchemes.empty.title": { + "pricing.native.team.feature.billing": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Select a scheme" + "value": "Unified billing for the whole team" } }, "ja": { "stringUnit": { "state": "translated", - "value": "スキームを選択" + "value": "チーム全体の請求を一元管理" } } } }, - "projectSchemes.row.runFormat": { + "pricing.native.team.feature.compute": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "run: %@" + "value": "Pooled Cloud VM compute hours" } }, "ja": { "stringUnit": { "state": "translated", - "value": "実行: %@" + "value": "共有 Cloud VM コンピュート時間" } } } }, - "projectSchemes.row.testFormat": { + "pricing.native.team.feature.gateway": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "test: %d" + "value": "Team-wide model gateway analytics" } }, "ja": { "stringUnit": { "state": "translated", - "value": "テスト: %d" + "value": "チーム全体のモデルゲートウェイ分析" } } } }, - "proWelcome.workspace.title": { + "pricing.native.team.feature.seats": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Welcome to cmux Pro" + "value": "Centralized seat management" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux Pro へようこそ" + "value": "シート管理を一元化" } } } }, - "relativeTime.days": { + "pricing.native.team.feature.support": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "%lldd" + "value": "Priority email support" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%lld日" + "value": "優先メールサポート" } } } }, - "relativeTime.hours": { + "pricing.native.team.price": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "%lldh" + "value": "$35" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%lld時間" + "value": "$35" } } } }, - "relativeTime.minutes": { + "pricing.native.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "%lldm" + "value": "Pricing" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%lld分" + "value": "料金" } } } }, - "relativeTime.now": { + "pricing.native.upgrade": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "now" + "value": "Get Pro" } }, "ja": { "stringUnit": { "state": "translated", - "value": "今" + "value": "Pro を入手" } } } }, - "relativeTime.weeks": { + "pricing.native.window.title": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "%lldw" + "value": "cmux Upgrade" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%lld週" + "value": "cmux アップグレード" } } } }, - "remote.disconnectBanner.reconnectHint": { + "pricing.perMonth": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "/month" } }, - "bs": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "/月" } - }, - "da": { + } + } + }, + "pricing.perUserMonth": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "/user/month" } }, - "de": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "/ユーザー/月" } - }, + } + } + }, + "pricing.pro.cta": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." - } - }, - "es": { - "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "value": "Get Pro" } }, - "fr": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "Pro を入手" } - }, - "it": { + } + } + }, + "pricing.pro.f1": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "Everything in Free" } }, "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Enter キーを押すと再接続します。それまではこのターミナルは切断されたままです。" - } - }, - "km": { - "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "value": "Freeのすべて" } - }, - "ko": { + } + } + }, + "pricing.pro.f2": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "Cloud dev boxes: 10 active, unlimited creates" } }, - "nb": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "クラウド開発マシン: 同時10台、作成無制限" } - }, - "pl": { + } + } + }, + "pricing.pro.f3": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "20 compute-hours/mo on a 4 vCPU / 16 GB VM" } }, - "pt-BR": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "4 vCPU / 16 GB VMで毎月20計算時間" } - }, - "ru": { + } + } + }, + "pricing.pro.f4": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "iOS app: your Mac's terminals on your iPhone" } }, - "th": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "iOSアプリ: MacのターミナルをiPhoneから" } - }, - "tr": { + } + } + }, + "pricing.pro.f5": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "cmux AI early access + priority support" } }, - "uk": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "cmux AI早期アクセス + 優先サポート" } - }, - "zh-Hans": { + } + } + }, + "pricing.pro.name": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "cmux Pro" } }, - "zh-Hant": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + "state": "translated", + "value": "cmux Pro" } } } }, - "remote.disconnectBanner.reconnectUnavailableHint": { + "pricing.pro.note": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] أعد توصيل مساحة العمل هذه من الشريط الجانبي أو شغّل أمر cmux البعيد الأصلي مرة أخرى." + "value": "Billed annually ($360/yr), or $45 month-to-month." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Ponovo povežite ovaj radni prostor iz bočne trake ili ponovo pokrenite originalnu cmux udaljenu naredbu." + "value": "年払い($360/年)、または月払い$45。" } - }, - "da": { + } + } + }, + "pricing.pro.workspace.title": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] Genopret forbindelsen til dette arbejdsområde fra sidepanelet, eller kør den oprindelige cmux-fjernkommando igen." + "value": "cmux Pro" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Verbinde diesen Arbeitsbereich über die Seitenleiste erneut oder führe den ursprünglichen cmux-Remote-Befehl noch einmal aus." + "value": "cmux Pro" } - }, + } + } + }, + "pricing.subtitle": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "[cmux] Reconnect this workspace from the sidebar or by running the original cmux remote command again." + "value": "cmux is free and open source, and always will be. Pro adds the cloud." } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Vuelve a conectar este espacio de trabajo desde la barra lateral o ejecuta de nuevo el comando remoto original de cmux." + "value": "cmuxはこれからも無料でオープンソースです。Proはクラウドを追加します。" } - }, - "fr": { + } + } + }, + "pricing.team.cta": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] Reconnectez cet espace de travail depuis la barre latérale ou relancez la commande distante cmux d'origine." + "value": "Get Teams" } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Riconnetti questo spazio di lavoro dalla barra laterale oppure esegui di nuovo il comando remoto cmux originale." + "value": "Teams を入手" } - }, - "ja": { + } + } + }, + "pricing.team.f1": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] サイドバーからこのワークスペースを再接続するか、元の cmux リモートコマンドをもう一度実行してください。" + "value": "Everything in Pro for every member" } }, - "km": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] ភ្ជាប់កន្លែងធ្វើការនេះឡើងវិញពីរបារចំហៀង ឬដំណើរការពាក្យបញ្ជា cmux ពីចម្ងាយដើមម្តងទៀត។" + "value": "全メンバーにProのすべて" } - }, - "ko": { + } + } + }, + "pricing.team.f2": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] 사이드바에서 이 워크스페이스를 다시 연결하거나 원래 cmux 원격 명령을 다시 실행하세요." + "value": "Shared team billing" } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Koble til dette arbeidsområdet på nytt fra sidefeltet, eller kjør den opprinnelige cmux-fjernkommandoen på nytt." + "value": "チーム共有の請求" } - }, - "pl": { + } + } + }, + "pricing.team.f3": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] Połącz ponownie ten obszar roboczy z paska bocznego albo ponownie uruchom oryginalne polecenie zdalne cmux." + "value": "Centralized Cloud VM usage" } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Reconecte este espaço de trabalho pela barra lateral ou execute novamente o comando remoto original do cmux." + "value": "Cloud VM使用量の一元管理" } - }, - "ru": { + } + } + }, + "pricing.team.name": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] Повторно подключите это рабочее пространство из боковой панели или снова выполните исходную удаленную команду cmux." + "value": "Team" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] เชื่อมต่อพื้นที่ทำงานนี้ใหม่จากแถบด้านข้าง หรือเรียกใช้คำสั่งรีโมต cmux เดิมอีกครั้ง" + "value": "Team" } - }, - "tr": { + } + } + }, + "pricing.team.note": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] Bu çalışma alanını kenar çubuğundan yeniden bağlayın veya özgün cmux uzak komutunu tekrar çalıştırın." + "value": "Everything in Pro, per seat." } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] Повторно підключіть цей робочий простір із бічної панелі або ще раз запустіть початкову віддалену команду cmux." + "value": "Proのすべてを、席ごとに。" } - }, - "zh-Hans": { + } + } + }, + "pricing.title": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "[cmux] 请从边栏重新连接此工作区,或再次运行原始 cmux 远程命令。" + "value": "Pricing" } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "[cmux] 請從側邊欄重新連接此工作區,或再次執行原始 cmux 遠端命令。" + "value": "料金" } } } }, - "remote.disconnectBanner.sessionEnded": { + "pricing.window.title": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] remote session disconnected: %s" + "state": "translated", + "value": "cmux Pro" } }, - "bs": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] remote session disconnected: %s" + "state": "translated", + "value": "cmux Pro" } - }, - "da": { + } + } + }, + "projectSchemes.badge.personal": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { - "state": "new", - "value": "[cmux] remote session disconnected: %s" + "state": "translated", + "value": "personal" } }, - "de": { + "ja": { "stringUnit": { - "state": "new", - "value": "[cmux] remote session disconnected: %s" + "state": "translated", + "value": "個人" } - }, + } + } + }, + "projectSchemes.badge.shared": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "shared" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "共有" + } + } + } + }, + "projectSchemes.detail.archiveTarget": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Archive target" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "アーカイブターゲット" + } + } + } + }, + "projectSchemes.detail.environment": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Environment" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "環境" + } + } + } + }, + "projectSchemes.detail.launchArguments": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Launch arguments" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "起動引数" + } + } + } + }, + "projectSchemes.detail.profileTarget": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Profile target" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "プロファイルターゲット" + } + } + } + }, + "projectSchemes.detail.runTarget": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Run target" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "実行ターゲット" + } + } + } + }, + "projectSchemes.detail.testTargets": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Test targets" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "テストターゲット" + } + } + } + }, + "projectSchemes.detail.visibility": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Visibility" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "表示範囲" + } + } + } + }, + "projectSchemes.detail.visibilityPersonal": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Personal (current user)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "個人(現在のユーザー)" + } + } + } + }, + "projectSchemes.detail.visibilityShared": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Shared" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "共有" + } + } + } + }, + "projectSchemes.empty.hint": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Pick a scheme on the left to inspect its run / test / profile / archive targets and launch settings." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "左側のスキームを選択して、実行 / テスト / プロファイル / アーカイブのターゲットと起動設定を確認します。" + } + } + } + }, + "projectSchemes.empty.title": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Select a scheme" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "スキームを選択" + } + } + } + }, + "projectSchemes.row.runFormat": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "run: %@" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "実行: %@" + } + } + } + }, + "projectSchemes.row.testFormat": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "test: %d" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "テスト: %d" + } + } + } + }, + "proWelcome.workspace.title": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Welcome to cmux Pro" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "cmux Pro へようこそ" + } + } + } + }, + "relativeTime.days": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%lldd" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "%lld日" + } + } + } + }, + "relativeTime.hours": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%lldh" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "%lld時間" + } + } + } + }, + "relativeTime.minutes": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%lldm" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "%lld分" + } + } + } + }, + "relativeTime.now": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "now" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "今" + } + } + } + }, + "relativeTime.weeks": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%lldw" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "%lld週" + } + } + } + }, + "remote.disconnectBanner.reconnectHint": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "bs": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "da": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "de": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "es": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "fr": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "it": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Enter キーを押すと再接続します。それまではこのターミナルは切断されたままです。" + } + }, + "km": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "ko": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "nb": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "pl": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "pt-BR": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "ru": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "th": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "tr": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "uk": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + }, + "zh-Hant": { + "stringUnit": { + "state": "new", + "value": "[cmux] Press Enter to reconnect. This terminal will stay disconnected until then." + } + } + } + }, + "remote.disconnectBanner.reconnectUnavailableHint": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "[cmux] أعد توصيل مساحة العمل هذه من الشريط الجانبي أو شغّل أمر cmux البعيد الأصلي مرة أخرى." + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Ponovo povežite ovaj radni prostor iz bočne trake ili ponovo pokrenite originalnu cmux udaljenu naredbu." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Genopret forbindelsen til dette arbejdsområde fra sidepanelet, eller kør den oprindelige cmux-fjernkommando igen." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Verbinde diesen Arbeitsbereich über die Seitenleiste erneut oder führe den ursprünglichen cmux-Remote-Befehl noch einmal aus." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Reconnect this workspace from the sidebar or by running the original cmux remote command again." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Vuelve a conectar este espacio de trabajo desde la barra lateral o ejecuta de nuevo el comando remoto original de cmux." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Reconnectez cet espace de travail depuis la barre latérale ou relancez la commande distante cmux d'origine." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Riconnetti questo spazio di lavoro dalla barra laterale oppure esegui di nuovo il comando remoto cmux originale." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "[cmux] サイドバーからこのワークスペースを再接続するか、元の cmux リモートコマンドをもう一度実行してください。" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "[cmux] ភ្ជាប់កន្លែងធ្វើការនេះឡើងវិញពីរបារចំហៀង ឬដំណើរការពាក្យបញ្ជា cmux ពីចម្ងាយដើមម្តងទៀត។" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "[cmux] 사이드바에서 이 워크스페이스를 다시 연결하거나 원래 cmux 원격 명령을 다시 실행하세요." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Koble til dette arbeidsområdet på nytt fra sidefeltet, eller kjør den opprinnelige cmux-fjernkommandoen på nytt." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Połącz ponownie ten obszar roboczy z paska bocznego albo ponownie uruchom oryginalne polecenie zdalne cmux." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Reconecte este espaço de trabalho pela barra lateral ou execute novamente o comando remoto original do cmux." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Повторно подключите это рабочее пространство из боковой панели или снова выполните исходную удаленную команду cmux." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "[cmux] เชื่อมต่อพื้นที่ทำงานนี้ใหม่จากแถบด้านข้าง หรือเรียกใช้คำสั่งรีโมต cmux เดิมอีกครั้ง" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Bu çalışma alanını kenar çubuğundan yeniden bağlayın veya özgün cmux uzak komutunu tekrar çalıştırın." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "[cmux] Повторно підключіть цей робочий простір із бічної панелі або ще раз запустіть початкову віддалену команду cmux." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "[cmux] 请从边栏重新连接此工作区,或再次运行原始 cmux 远程命令。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "[cmux] 請從側邊欄重新連接此工作區,或再次執行原始 cmux 遠端命令。" + } + } + } + }, + "remote.disconnectBanner.sessionEnded": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "new", + "value": "[cmux] remote session disconnected: %s" + } + }, + "bs": { + "stringUnit": { + "state": "new", + "value": "[cmux] remote session disconnected: %s" + } + }, + "da": { + "stringUnit": { + "state": "new", + "value": "[cmux] remote session disconnected: %s" + } + }, + "de": { + "stringUnit": { + "state": "new", + "value": "[cmux] remote session disconnected: %s" + } + }, "en": { "stringUnit": { "state": "translated", @@ -153648,10398 +154273,11023 @@ "value": "Utilise l’ascendance des processus de hooks. Désactivez cette option si les sessions Codex ou Claude imbriquées doivent déclencher des notifications de fin." } }, - "it": { + "it": { + "stringUnit": { + "state": "translated", + "value": "Usa la gerarchia dei processi dei hook. Disattiva se le sessioni Codex o Claude annidate devono inviare notifiche di completamento." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "フックプロセスの親子関係を使用します。ネストされた Codex または Claude セッションでも完了通知を出したい場合は無効にしてください。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "훅 프로세스의 상위 프로세스 관계를 사용합니다. 중첩된 Codex 또는 Claude 세션도 완료 알림을 보내야 한다면 비활성화하세요." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Bruker prosesshierarki fra hook-prosesser. Slå av hvis innebygde Codex- eller Claude-økter skal utløse fullføringsvarsler." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Używa hierarchii procesów hooków. Wyłącz, jeśli zagnieżdżone sesje Codex lub Claude mają wywoływać powiadomienia o zakończeniu." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Usa a hierarquia de processos dos hooks. Desative se sessões aninhadas do Codex ou Claude devem disparar notificações de conclusão." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Использует иерархию процессов из hook-процессов. Отключите, если вложенные сеансы Codex или Claude должны отправлять уведомления о завершении." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "ใช้ลำดับชั้นของโปรเซสจากโปรเซส hook ปิดตัวเลือกนี้หากเซสชัน Codex หรือ Claude แบบซ้อนควรส่งการแจ้งเตือนเมื่อเสร็จ" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Hook süreçlerinin üst işlem zincirini kullanır. İç içe Codex veya Claude oturumları tamamlanma bildirimi göndermeliyse kapatın." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Використовує ієрархію процесів із hook-процесів. Вимкніть, якщо вкладені сеанси Codex або Claude мають надсилати сповіщення про завершення." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "使用 hook 进程的进程层级。若嵌套的 Codex 或 Claude 会话应触发完成通知,请将其关闭。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "使用 hook 程序的程序層級。若巢狀 Codex 或 Claude 工作階段應觸發完成通知,請將其關閉。" + } + } + } + }, + "settings.automation.suppressSubagentNotifications.subtitleOff": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "تُرسل إكمالات الوكلاء الفرعيين إشعارات مثل الوكلاء الأعلى مستوى." + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Završeci dječijih agenata šalju obavještenja kao agenti najvišeg nivoa." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Underagenters fuldførelser giver besked som topniveau-agenter." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Abschlüsse von Unteragenten benachrichtigen wie Top-Level-Agenten." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Child agent completions notify like top-level agents." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Las finalizaciones de agentes secundarios notifican como agentes de nivel superior." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Les fins d’agents enfants notifient comme les agents de premier niveau." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "I completamenti degli agenti figli inviano notifiche come gli agenti di primo livello." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "子エージェントの完了もトップレベルのエージェントと同様に通知します。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "하위 에이전트 완료도 최상위 에이전트처럼 알립니다." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Fullføringer fra underagenter varsler som toppnivåagenter." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Ukończenia agentów podrzędnych powiadamiają jak agenci najwyższego poziomu." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Conclusões de agentes filhos notificam como agentes de nível superior." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Завершения дочерних агентов уведомляют как агенты верхнего уровня." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "การทำงานเสร็จของเอเจนต์ลูกจะแจ้งเตือนเหมือนเอเจนต์ระดับบนสุด" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Alt ajan tamamlanmaları üst düzey ajanlar gibi bildirim gönderir." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Завершення дочірніх агентів сповіщають як агенти верхнього рівня." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "子代理完成时会像顶层代理一样通知。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "子代理完成時會像頂層代理一樣通知。" + } + } + } + }, + "settings.automation.suppressSubagentNotifications.subtitleOn": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "تبقى إكمالات الوكلاء الفرعيين في Feed بدون إشعارات." + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Završeci dječijih agenata ostaju u Feed-u bez obavještenja." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Underagenters fuldførelser bliver i Feed uden notifikationer." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Abschlüsse von Unteragenten bleiben ohne Benachrichtigungen im Feed." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Child agent completions stay in Feed without notifications." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Las finalizaciones de agentes secundarios permanecen en Feed sin notificaciones." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Les fins d’agents enfants restent dans Feed sans notifications." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "I completamenti degli agenti figli restano in Feed senza notifiche." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "子エージェントの完了は通知せずFeedにのみ残ります。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "하위 에이전트 완료는 알림 없이 Feed에만 남습니다." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Fullføringer fra underagenter blir i Feed uten varsler." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Ukończenia agentów podrzędnych pozostają w Feed bez powiadomień." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Conclusões de agentes filhos ficam no Feed sem notificações." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Завершения дочерних агентов остаются в Feed без уведомлений." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "การทำงานเสร็จของเอเจนต์ลูกจะอยู่ใน Feed โดยไม่มีการแจ้งเตือน" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Alt ajan tamamlanmaları bildirim olmadan Feed’de kalır." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Завершення дочірніх агентів залишаються у Feed без сповіщень." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "子代理完成事件会留在 Feed 中且不通知。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "子代理完成事件會留在 Feed 中且不通知。" + } + } + } + }, + "settings.automation.workspaceAutoNaming": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "التسمية التلقائية لمساحات العمل" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Automatsko imenovanje radnih prostora" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Automatisk navngivning af arbejdsområder" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Automatische Benennung von Arbeitsbereichen" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Workspace Auto-Naming" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Nombrado automático de espacios de trabajo" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Nommage automatique des espaces de travail" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Assegnazione automatica dei nomi agli spazi di lavoro" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ワークスペースの自動命名" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "ការដាក់ឈ្មោះកន្លែងធ្វើការដោយស្វ័យប្រវត្តិ" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "작업 공간 자동 이름 지정" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Automatisk navngiving av arbeidsområder" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Automatyczne nazywanie obszarów roboczych" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Nomeação automática de espaços de trabalho" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Автоматическое именование рабочих областей" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "การตั้งชื่อพื้นที่ทำงานอัตโนมัติ" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Çalışma alanlarını otomatik adlandırma" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Автоматичне іменування робочих областей" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "工作区自动命名" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "工作區自動命名" + } + } + } + }, + "settings.automation.workspaceAutoNaming.hooksOffWarning": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "تكامل Claude Code متوقف، لذلك لن تتم تسمية جلسات Claude تلقائيًا. لا يزال الوكلاء المدعومون الآخرون يسمّون الجلسات عند تثبيت خطافات cmux الخاصة بهم." + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Claude Code integracija je isključena, pa se Claude sesije neće automatski imenovati. Drugi podržani agenti i dalje imenuju sesije kada su njihovi cmux hookovi instalirani." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Claude Code-integration er slået fra, så Claude-sessioner navngives ikke automatisk. Andre understøttede agenter navngiver stadig, når deres cmux-hooks er installeret." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Die Claude Code-Integration ist deaktiviert, daher werden Claude-Sitzungen nicht automatisch benannt. Andere unterstützte Agenten benennen weiterhin, wenn ihre cmux-Hooks installiert sind." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Claude Code Integration is off, so Claude sessions will not be auto-named. Other supported agents still name when their cmux hooks are installed." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "La integración de Claude Code está desactivada, por lo que las sesiones de Claude no se nombrarán automáticamente. Otros agentes compatibles seguirán nombrando cuando sus hooks de cmux estén instalados." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "L'intégration Claude Code est désactivée, donc les sessions Claude ne seront pas nommées automatiquement. Les autres agents pris en charge continuent de nommer les sessions lorsque leurs hooks cmux sont installés." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "L'integrazione Claude Code è disattivata, quindi le sessioni Claude non verranno nominate automaticamente. Gli altri agenti supportati continuano a nominare quando i loro hook cmux sono installati." + } + }, + "ja": { "stringUnit": { "state": "translated", - "value": "Usa la gerarchia dei processi dei hook. Disattiva se le sessioni Codex o Claude annidate devono inviare notifiche di completamento." + "value": "Claude Code 連携がオフのため、Claude セッションは自動命名されません。他の対応エージェントは、それぞれの cmux フックがインストールされていれば引き続き命名されます。" } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "フックプロセスの親子関係を使用します。ネストされた Codex または Claude セッションでも完了通知を出したい場合は無効にしてください。" + "value": "ការរួមបញ្ចូល Claude Code ត្រូវបានបិទ ដូច្នេះសម័យ Claude នឹងមិនត្រូវបានដាក់ឈ្មោះដោយស្វ័យប្រវត្តិទេ។ ភ្នាក់ងារដែលគាំទ្រផ្សេងទៀតនៅតែដាក់ឈ្មោះនៅពេល hook cmux របស់ពួកវាត្រូវបានដំឡើង។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "훅 프로세스의 상위 프로세스 관계를 사용합니다. 중첩된 Codex 또는 Claude 세션도 완료 알림을 보내야 한다면 비활성화하세요." + "value": "Claude Code 통합이 꺼져 있어 Claude 세션은 자동으로 이름 지정되지 않습니다. 다른 지원 에이전트는 해당 cmux 훅이 설치되어 있으면 계속 이름을 지정합니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Bruker prosesshierarki fra hook-prosesser. Slå av hvis innebygde Codex- eller Claude-økter skal utløse fullføringsvarsler." + "value": "Claude Code-integrasjonen er av, så Claude-økter blir ikke navngitt automatisk. Andre støttede agenter navngir fortsatt når cmux-hookene deres er installert." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Używa hierarchii procesów hooków. Wyłącz, jeśli zagnieżdżone sesje Codex lub Claude mają wywoływać powiadomienia o zakończeniu." + "value": "Integracja Claude Code jest wyłączona, więc sesje Claude nie będą nazywane automatycznie. Inni obsługiwani agenci nadal nadają nazwy, gdy ich hooki cmux są zainstalowane." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Usa a hierarquia de processos dos hooks. Desative se sessões aninhadas do Codex ou Claude devem disparar notificações de conclusão." + "value": "A integração com o Claude Code está desativada, então sessões do Claude não serão nomeadas automaticamente. Outros agentes compatíveis ainda nomeiam quando seus hooks do cmux estão instalados." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Использует иерархию процессов из hook-процессов. Отключите, если вложенные сеансы Codex или Claude должны отправлять уведомления о завершении." + "value": "Интеграция Claude Code отключена, поэтому сеансы Claude не будут автоматически именоваться. Другие поддерживаемые агенты продолжат именование, если установлены их хуки cmux." } }, "th": { "stringUnit": { "state": "translated", - "value": "ใช้ลำดับชั้นของโปรเซสจากโปรเซส hook ปิดตัวเลือกนี้หากเซสชัน Codex หรือ Claude แบบซ้อนควรส่งการแจ้งเตือนเมื่อเสร็จ" + "value": "การผสานรวม Claude Code ปิดอยู่ ดังนั้นเซสชัน Claude จะไม่ถูกตั้งชื่ออัตโนมัติ เอเจนต์อื่นที่รองรับยังคงตั้งชื่อได้เมื่อมีการติดตั้งฮุก cmux ของตน" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Hook süreçlerinin üst işlem zincirini kullanır. İç içe Codex veya Claude oturumları tamamlanma bildirimi göndermeliyse kapatın." + "value": "Claude Code entegrasyonu kapalı, bu yüzden Claude oturumları otomatik adlandırılmayacak. Diğer desteklenen aracılar, cmux hook'ları kurulu olduğunda adlandırmaya devam eder." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Використовує ієрархію процесів із hook-процесів. Вимкніть, якщо вкладені сеанси Codex або Claude мають надсилати сповіщення про завершення." + "value": "Інтеграцію Claude Code вимкнено, тому сеанси Claude не будуть автоматично іменуватися. Інші підтримувані агенти й надалі іменують, коли встановлено їхні хуки cmux." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "使用 hook 进程的进程层级。若嵌套的 Codex 或 Claude 会话应触发完成通知,请将其关闭。" + "value": "Claude Code 集成已关闭,因此 Claude 会话不会自动命名。其他受支持的代理在安装了各自的 cmux 钩子后仍会命名。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "使用 hook 程序的程序層級。若巢狀 Codex 或 Claude 工作階段應觸發完成通知,請將其關閉。" + "value": "Claude Code 整合已關閉,因此 Claude 工作階段不會自動命名。其他支援的代理在安裝各自的 cmux hook 後仍會命名。" } } } }, - "settings.automation.suppressSubagentNotifications.subtitleOff": { + "settings.automation.workspaceAutoNaming.note": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "تُرسل إكمالات الوكلاء الفرعيين إشعارات مثل الوكلاء الأعلى مستوى." + "value": "عند التفعيل، يلخّص cmux جلسات الوكلاء المدعومة في أسماء قصيرة لمساحات العمل وعلامات التبويب باستخدام البرنامج الثنائي الخاص بكل وكيل، ويتم التحديث عند تغيّر الموضوع. تتقدم إعادة التسمية اليدوية دائمًا وتوقف التسمية التلقائية لتلك المساحة أو علامة التبويب. تُستخدم حسابات الوكلاء لديك لاستدعاءات التلخيص القصيرة." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Završeci dječijih agenata šalju obavještenja kao agenti najvišeg nivoa." + "value": "Kada je uključeno, cmux sažima podržane sesije agenata u kratke nazive radnih prostora i kartica koristeći binarni program svakog agenta, uz osvježavanje kada se tema promijeni. Ručna preimenovanja uvijek imaju prednost i zaustavljaju automatsko imenovanje za taj radni prostor ili karticu. Za kratke pozive sažimanja koristi se vaš agentski račun." } }, "da": { "stringUnit": { "state": "translated", - "value": "Underagenters fuldførelser giver besked som topniveau-agenter." + "value": "Når det er slået til, opsummerer cmux understøttede agentsessioner til korte navne på arbejdsområder og faner med hver agents egen binærfil og opdaterer dem, når emnet skifter. Manuelle omdøbninger vinder altid og stopper automatisk navngivning for det arbejdsområde eller den fane. Bruger din agentkonto til de korte opsummeringskald." } }, "de": { "stringUnit": { "state": "translated", - "value": "Abschlüsse von Unteragenten benachrichtigen wie Top-Level-Agenten." + "value": "Wenn aktiviert, fasst cmux unterstützte Agentensitzungen mit der jeweiligen Agent-Binärdatei zu kurzen Arbeitsbereichs- und Tabnamen zusammen und aktualisiert sie, wenn sich das Thema ändert. Manuelle Umbenennungen haben immer Vorrang und stoppen die automatische Benennung für diesen Arbeitsbereich oder Tab. Für die kurzen Zusammenfassungsaufrufe wird dein Agentenkonto verwendet." } }, "en": { "stringUnit": { "state": "translated", - "value": "Child agent completions notify like top-level agents." + "value": "When enabled, cmux summarizes supported agent sessions into short workspace and tab names using each agent's own binary, refreshed as the topic shifts. Manual renames always win and stop auto-naming for that workspace or tab. Uses your agent account for the short summarization calls." } }, "es": { "stringUnit": { "state": "translated", - "value": "Las finalizaciones de agentes secundarios notifican como agentes de nivel superior." + "value": "Cuando está activado, cmux resume las sesiones de agentes compatibles en nombres cortos de espacios de trabajo y pestañas usando el binario propio de cada agente, y los actualiza cuando cambia el tema. Los cambios de nombre manuales siempre tienen prioridad y detienen el nombrado automático para ese espacio de trabajo o pestaña. Usa tu cuenta del agente para las llamadas breves de resumen." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Les fins d’agents enfants notifient comme les agents de premier niveau." + "value": "Lorsque cette option est activée, cmux résume les sessions d'agents prises en charge en noms courts d'espaces de travail et d'onglets avec le binaire propre à chaque agent, puis les actualise quand le sujet change. Les renommages manuels gagnent toujours et arrêtent le nommage automatique pour cet espace de travail ou cet onglet. Utilise votre compte d'agent pour les courts appels de résumé." } }, "it": { "stringUnit": { "state": "translated", - "value": "I completamenti degli agenti figli inviano notifiche come gli agenti di primo livello." + "value": "Quando è attivo, cmux riassume le sessioni degli agenti supportati in brevi nomi di spazi di lavoro e schede usando il binario di ciascun agente, aggiornandoli quando cambia l'argomento. Le rinominazioni manuali hanno sempre la precedenza e interrompono la denominazione automatica per quello spazio di lavoro o quella scheda. Usa il tuo account dell'agente per le brevi chiamate di riepilogo." } }, "ja": { "stringUnit": { "state": "translated", - "value": "子エージェントの完了もトップレベルのエージェントと同様に通知します。" + "value": "有効にすると、cmux は対応エージェントの各バイナリを使ってエージェントセッションを短いワークスペース名とタブ名に要約し、話題が変わると更新します。手動の名前変更が常に優先され、そのワークスペースやタブの自動命名は停止します。短い要約呼び出しにはユーザーのエージェントアカウントが使われます。" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "ពេលបើក cmux សង្ខេបសម័យភ្នាក់ងារដែលគាំទ្រជាឈ្មោះខ្លីសម្រាប់កន្លែងធ្វើការ និងផ្ទាំង ដោយប្រើ binary របស់ភ្នាក់ងារនីមួយៗ ហើយធ្វើបច្ចុប្បន្នភាពនៅពេលប្រធានបទផ្លាស់ប្តូរ។ ការប្តូរឈ្មោះដោយដៃតែងតែមានអាទិភាព ហើយបញ្ឈប់ការដាក់ឈ្មោះស្វ័យប្រវត្តិសម្រាប់កន្លែងធ្វើការ ឬផ្ទាំងនោះ។ ប្រើគណនីភ្នាក់ងាររបស់អ្នកសម្រាប់ការហៅសង្ខេបខ្លីៗ។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "하위 에이전트 완료도 최상위 에이전트처럼 알립니다." + "value": "켜면 cmux가 각 에이전트의 자체 바이너리를 사용해 지원되는 에이전트 세션을 짧은 작업 공간 및 탭 이름으로 요약하고, 주제가 바뀌면 갱신합니다. 수동 이름 변경이 항상 우선하며 해당 작업 공간이나 탭의 자동 이름 지정을 중지합니다. 짧은 요약 호출에는 사용자의 에이전트 계정이 사용됩니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Fullføringer fra underagenter varsler som toppnivåagenter." + "value": "Når dette er på, oppsummerer cmux støttede agentøkter til korte navn på arbeidsområder og faner med hver agents egen binærfil, og oppdaterer dem når emnet endres. Manuelle endringer av navn vinner alltid og stopper automatisk navngiving for det arbeidsområdet eller den fanen. Bruker agentkontoen din for de korte oppsummeringskallene." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Ukończenia agentów podrzędnych powiadamiają jak agenci najwyższego poziomu." + "value": "Po włączeniu cmux streszcza obsługiwane sesje agentów do krótkich nazw obszarów roboczych i kart, używając własnego pliku binarnego każdego agenta, i odświeża je po zmianie tematu. Ręczne zmiany nazw zawsze mają pierwszeństwo i zatrzymują automatyczne nazywanie dla tego obszaru roboczego lub karty. Krótkie wywołania streszczeń używają Twojego konta agenta." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Conclusões de agentes filhos notificam como agentes de nível superior." + "value": "Quando ativado, o cmux resume sessões de agentes compatíveis em nomes curtos de espaços de trabalho e abas usando o binário próprio de cada agente, atualizados conforme o assunto muda. Renomeações manuais sempre vencem e interrompem a nomeação automática para aquele espaço de trabalho ou aba. Usa sua conta do agente para as chamadas curtas de resumo." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Завершения дочерних агентов уведомляют как агенты верхнего уровня." + "value": "Если включено, cmux кратко обобщает поддерживаемые сеансы агентов в короткие имена рабочих областей и вкладок с помощью собственного бинарного файла каждого агента и обновляет их при смене темы. Ручные переименования всегда имеют приоритет и останавливают автоматическое именование для этой рабочей области или вкладки. Для коротких вызовов обобщения используется ваша учетная запись агента." } }, "th": { "stringUnit": { "state": "translated", - "value": "การทำงานเสร็จของเอเจนต์ลูกจะแจ้งเตือนเหมือนเอเจนต์ระดับบนสุด" + "value": "เมื่อเปิดใช้งาน cmux จะสรุปเซสชันเอเจนต์ที่รองรับเป็นชื่อพื้นที่ทำงานและแท็บแบบสั้น โดยใช้ไบนารีของเอเจนต์แต่ละตัว และรีเฟรชเมื่อหัวข้อเปลี่ยน การเปลี่ยนชื่อด้วยตนเองจะมีผลเหนือกว่าเสมอและหยุดการตั้งชื่ออัตโนมัติสำหรับพื้นที่ทำงานหรือแท็บนั้น ใช้บัญชีเอเจนต์ของคุณสำหรับการเรียกสรุปแบบสั้น" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Alt ajan tamamlanmaları üst düzey ajanlar gibi bildirim gönderir." + "value": "Açıldığında cmux, desteklenen aracı oturumlarını her aracının kendi ikili dosyasını kullanarak kısa çalışma alanı ve sekme adlarına özetler ve konu değiştikçe yeniler. Elle yeniden adlandırmalar her zaman kazanır ve o çalışma alanı veya sekme için otomatik adlandırmayı durdurur. Kısa özetleme çağrıları için aracı hesabınızı kullanır." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Завершення дочірніх агентів сповіщають як агенти верхнього рівня." + "value": "Коли ввімкнено, cmux узагальнює підтримувані сеанси агентів у короткі назви робочих областей і вкладок за допомогою власного бінарного файла кожного агента та оновлює їх, коли тема змінюється. Ручні перейменування завжди мають перевагу й зупиняють автоматичне іменування для цієї робочої області або вкладки. Для коротких викликів узагальнення використовується ваш обліковий запис агента." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "子代理完成时会像顶层代理一样通知。" + "value": "启用后,cmux 会使用每个代理自己的二进制文件,将支持的代理会话总结为简短的工作区和标签页名称,并在主题变化时刷新。手动重命名始终优先,并会停止该工作区或标签页的自动命名。短摘要调用会使用你的代理账户。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "子代理完成時會像頂層代理一樣通知。" + "value": "啟用後,cmux 會使用每個代理自己的二進位檔,將支援的代理工作階段摘要為簡短的工作區和分頁名稱,並在主題變化時重新整理。手動重新命名永遠優先,並會停止該工作區或分頁的自動命名。短摘要呼叫會使用你的代理帳戶。" } } } }, - "settings.automation.suppressSubagentNotifications.subtitleOn": { + "settings.automation.workspaceAutoNaming.subtitleOff": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "تبقى إكمالات الوكلاء الفرعيين في Feed بدون إشعارات." + "value": "لا يتم إنشاء أسماء مساحات العمل وعلامات التبويب أبدًا." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Završeci dječijih agenata ostaju u Feed-u bez obavještenja." + "value": "Nazivi radnih prostora i kartica nikada se ne generiraju." } }, "da": { "stringUnit": { "state": "translated", - "value": "Underagenters fuldførelser bliver i Feed uden notifikationer." + "value": "Navne på arbejdsområder og faner genereres aldrig." } }, "de": { "stringUnit": { "state": "translated", - "value": "Abschlüsse von Unteragenten bleiben ohne Benachrichtigungen im Feed." + "value": "Namen für Arbeitsbereiche und Tabs werden nie erzeugt." } }, "en": { "stringUnit": { "state": "translated", - "value": "Child agent completions stay in Feed without notifications." + "value": "Workspace and tab names are never generated." } }, "es": { "stringUnit": { "state": "translated", - "value": "Las finalizaciones de agentes secundarios permanecen en Feed sin notificaciones." + "value": "Nunca se generan nombres para espacios de trabajo ni pestañas." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Les fins d’agents enfants restent dans Feed sans notifications." + "value": "Les noms des espaces de travail et des onglets ne sont jamais générés." } }, "it": { "stringUnit": { "state": "translated", - "value": "I completamenti degli agenti figli restano in Feed senza notifiche." + "value": "I nomi di spazi di lavoro e schede non vengono mai generati." } }, "ja": { "stringUnit": { "state": "translated", - "value": "子エージェントの完了は通知せずFeedにのみ残ります。" + "value": "ワークスペースとタブの名前は自動生成されません。" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "ឈ្មោះកន្លែងធ្វើការ និងផ្ទាំងមិនត្រូវបានបង្កើតឡើយ។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "하위 에이전트 완료는 알림 없이 Feed에만 남습니다." + "value": "작업 공간과 탭 이름은 생성되지 않습니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Fullføringer fra underagenter blir i Feed uten varsler." + "value": "Navn på arbeidsområder og faner genereres aldri." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Ukończenia agentów podrzędnych pozostają w Feed bez powiadomień." + "value": "Nazwy obszarów roboczych i kart nigdy nie są generowane." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Conclusões de agentes filhos ficam no Feed sem notificações." + "value": "Nomes de espaços de trabalho e abas nunca são gerados." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Завершения дочерних агентов остаются в Feed без уведомлений." + "value": "Имена рабочих областей и вкладок никогда не создаются." } }, "th": { "stringUnit": { "state": "translated", - "value": "การทำงานเสร็จของเอเจนต์ลูกจะอยู่ใน Feed โดยไม่มีการแจ้งเตือน" + "value": "จะไม่มีการสร้างชื่อพื้นที่ทำงานและแท็บ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Alt ajan tamamlanmaları bildirim olmadan Feed’de kalır." + "value": "Çalışma alanı ve sekme adları hiçbir zaman oluşturulmaz." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Завершення дочірніх агентів залишаються у Feed без сповіщень." + "value": "Назви робочих областей і вкладок ніколи не створюються." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "子代理完成事件会留在 Feed 中且不通知。" + "value": "不会生成工作区和标签页名称。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "子代理完成事件會留在 Feed 中且不通知。" + "value": "不會產生工作區和分頁名稱。" } } } }, - "settings.automation.workspaceAutoNaming": { + "settings.automation.workspaceAutoNaming.subtitleOn": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "التسمية التلقائية لمساحات العمل" + "value": "تُسمّى مساحات العمل وعلامات التبويب من محادثات الوكيل." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Automatsko imenovanje radnih prostora" + "value": "Radni prostori i kartice nazivaju se prema razgovorima agenta." } }, "da": { "stringUnit": { "state": "translated", - "value": "Automatisk navngivning af arbejdsområder" + "value": "Arbejdsområder og faner navngives ud fra agentsamtaler." } }, "de": { "stringUnit": { "state": "translated", - "value": "Automatische Benennung von Arbeitsbereichen" + "value": "Arbeitsbereiche und Tabs werden aus Agentengesprächen benannt." } }, "en": { "stringUnit": { "state": "translated", - "value": "Workspace Auto-Naming" + "value": "Workspaces and tabs are named from agent conversations." } }, "es": { "stringUnit": { "state": "translated", - "value": "Nombrado automático de espacios de trabajo" + "value": "Los espacios de trabajo y las pestañas se nombran a partir de conversaciones del agente." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Nommage automatique des espaces de travail" + "value": "Les espaces de travail et les onglets sont nommés à partir des conversations de l'agent." } }, "it": { "stringUnit": { "state": "translated", - "value": "Assegnazione automatica dei nomi agli spazi di lavoro" + "value": "Spazi di lavoro e schede vengono nominati dalle conversazioni dell'agente." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ワークスペースの自動命名" + "value": "エージェントの会話からワークスペースとタブに名前が付きます。" } }, "km": { "stringUnit": { "state": "translated", - "value": "ការដាក់ឈ្មោះកន្លែងធ្វើការដោយស្វ័យប្រវត្តិ" + "value": "កន្លែងធ្វើការ និងផ្ទាំងត្រូវបានដាក់ឈ្មោះពីការសន្ទនារបស់ភ្នាក់ងារ។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "작업 공간 자동 이름 지정" + "value": "작업 공간과 탭 이름이 에이전트 대화에서 지정됩니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Automatisk navngiving av arbeidsområder" + "value": "Arbeidsområder og faner navngis fra agentsamtaler." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Automatyczne nazywanie obszarów roboczych" + "value": "Obszary robocze i karty są nazywane na podstawie rozmów agenta." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Nomeação automática de espaços de trabalho" + "value": "Espaços de trabalho e abas são nomeados a partir das conversas do agente." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Автоматическое именование рабочих областей" + "value": "Рабочие области и вкладки получают имена из разговоров агента." } }, "th": { "stringUnit": { "state": "translated", - "value": "การตั้งชื่อพื้นที่ทำงานอัตโนมัติ" + "value": "พื้นที่ทำงานและแท็บจะตั้งชื่อตามการสนทนาของเอเจนต์" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Çalışma alanlarını otomatik adlandırma" + "value": "Çalışma alanları ve sekmeler aracı konuşmalarından adlandırılır." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Автоматичне іменування робочих областей" + "value": "Робочі області та вкладки отримують назви з розмов агента." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "工作区自动命名" + "value": "工作区和标签页会根据代理对话命名。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "工作區自動命名" + "value": "工作區和分頁會根據代理對話命名。" } } } }, - "settings.automation.workspaceAutoNaming.hooksOffWarning": { + "settings.betaFeatures.customSidebars": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "تكامل Claude Code متوقف، لذلك لن تتم تسمية جلسات Claude تلقائيًا. لا يزال الوكلاء المدعومون الآخرون يسمّون الجلسات عند تثبيت خطافات cmux الخاصة بهم." + "value": "Custom Sidebars" } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Claude Code integracija je isključena, pa se Claude sesije neće automatski imenovati. Drugi podržani agenti i dalje imenuju sesije kada su njihovi cmux hookovi instalirani." + "value": "カスタムサイドバー" } - }, - "da": { + } + } + }, + "settings.betaFeatures.customSidebars.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Claude Code-integration er slået fra, så Claude-sessioner navngives ikke automatisk. Andre understøttede agenter navngiver stadig, når deres cmux-hooks er installeret." + "value": "Hides custom sidebars from the sidebar picker until you enable them here." } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Die Claude Code-Integration ist deaktiviert, daher werden Claude-Sitzungen nicht automatisch benannt. Andere unterstützte Agenten benennen weiterhin, wenn ihre cmux-Hooks installiert sind." + "value": "ここで有効にするまで、カスタムサイドバーをサイドバーピッカーに表示しません。" } - }, + } + } + }, + "settings.betaFeatures.customSidebars.subtitleOn": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Claude Code Integration is off, so Claude sessions will not be auto-named. Other supported agents still name when their cmux hooks are installed." + "value": "Lists your sidebars from ~/.config/cmux/sidebars in the sidebar picker, rendered in an isolated helper process." } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "La integración de Claude Code está desactivada, por lo que las sesiones de Claude no se nombrarán automáticamente. Otros agentes compatibles seguirán nombrando cuando sus hooks de cmux estén instalados." + "value": "~/.config/cmux/sidebars のサイドバーをサイドバーピッカーに表示し、分離されたヘルパープロセスで描画します。" } - }, - "fr": { + } + } + }, + "settings.betaFeatures.dock": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "L'intégration Claude Code est désactivée, donc les sessions Claude ne seront pas nommées automatiquement. Les autres agents pris en charge continuent de nommer les sessions lorsque leurs hooks cmux sont installés." + "value": "Dock" } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "L'integrazione Claude Code è disattivata, quindi le sessioni Claude non verranno nominate automaticamente. Gli altri agenti supportati continuano a nominare quando i loro hook cmux sono installati." + "value": "Dock" + } + } + } + }, + "settings.betaFeatures.dock.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Hides Dock from the right sidebar until you enable it here." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Claude Code 連携がオフのため、Claude セッションは自動命名されません。他の対応エージェントは、それぞれの cmux フックがインストールされていれば引き続き命名されます。" + "value": "ここで有効にするまで、Dock を右サイドバーから隠します。" } - }, - "km": { + } + } + }, + "settings.betaFeatures.dock.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "ការរួមបញ្ចូល Claude Code ត្រូវបានបិទ ដូច្នេះសម័យ Claude នឹងមិនត្រូវបានដាក់ឈ្មោះដោយស្វ័យប្រវត្តិទេ។ ភ្នាក់ងារដែលគាំទ្រផ្សេងទៀតនៅតែដាក់ឈ្មោះនៅពេល hook cmux របស់ពួកវាត្រូវបានដំឡើង។" + "value": "Shows Dock in the right sidebar mode switcher for custom terminal controls." } }, - "ko": { + "ja": { "stringUnit": { "state": "translated", - "value": "Claude Code 통합이 꺼져 있어 Claude 세션은 자동으로 이름 지정되지 않습니다. 다른 지원 에이전트는 해당 cmux 훅이 설치되어 있으면 계속 이름을 지정합니다." + "value": "Dock を右サイドバーのモード切り替えに表示し、カスタム端末コントロールを使えるようにします。" } - }, - "nb": { + } + } + }, + "settings.betaFeatures.extensions": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Claude Code-integrasjonen er av, så Claude-økter blir ikke navngitt automatisk. Andre støttede agenter navngir fortsatt når cmux-hookene deres er installert." + "value": "Extensions" } }, - "pl": { + "ja": { "stringUnit": { "state": "translated", - "value": "Integracja Claude Code jest wyłączona, więc sesje Claude nie będą nazywane automatycznie. Inni obsługiwani agenci nadal nadają nazwy, gdy ich hooki cmux są zainstalowane." + "value": "エクステンション" } - }, - "pt-BR": { + } + } + }, + "settings.betaFeatures.extensions.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "A integração com o Claude Code está desativada, então sessões do Claude não serão nomeadas automaticamente. Outros agentes compatíveis ainda nomeiam quando seus hooks do cmux estão instalados." + "value": "Hides all extension UI until you enable it here." } }, - "ru": { + "ja": { "stringUnit": { "state": "translated", - "value": "Интеграция Claude Code отключена, поэтому сеансы Claude не будут автоматически именоваться. Другие поддерживаемые агенты продолжат именование, если установлены их хуки cmux." + "value": "ここで有効にするまで、すべてのエクステンション UI を隠します。" } - }, - "th": { + } + } + }, + "settings.betaFeatures.extensions.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "การผสานรวม Claude Code ปิดอยู่ ดังนั้นเซสชัน Claude จะไม่ถูกตั้งชื่ออัตโนมัติ เอเจนต์อื่นที่รองรับยังคงตั้งชื่อได้เมื่อมีการติดตั้งฮุก cmux ของตน" + "value": "Shows the puzzle button, the sidebar-toggle extension menu, and lets you install and host sidebar extensions." } }, - "tr": { + "ja": { "stringUnit": { "state": "translated", - "value": "Claude Code entegrasyonu kapalı, bu yüzden Claude oturumları otomatik adlandırılmayacak. Diğer desteklenen aracılar, cmux hook'ları kurulu olduğunda adlandırmaya devam eder." + "value": "パズルボタンとサイドバー切り替えのエクステンションメニューを表示し、サイドバーエクステンションのインストールとホストを可能にします。" } - }, - "uk": { + } + } + }, + "settings.betaFeatures.feed": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Інтеграцію Claude Code вимкнено, тому сеанси Claude не будуть автоматично іменуватися. Інші підтримувані агенти й надалі іменують, коли встановлено їхні хуки cmux." + "value": "Feed" } }, - "zh-Hans": { + "ja": { "stringUnit": { "state": "translated", - "value": "Claude Code 集成已关闭,因此 Claude 会话不会自动命名。其他受支持的代理在安装了各自的 cmux 钩子后仍会命名。" + "value": "Feed" + } + } + } + }, + "settings.betaFeatures.feed.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Hides Feed from the right sidebar until you enable it here." } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "Claude Code 整合已關閉,因此 Claude 工作階段不會自動命名。其他支援的代理在安裝各自的 cmux hook 後仍會命名。" + "value": "ここで有効にするまで、Feed を右サイドバーから隠します。" } } } }, - "settings.automation.workspaceAutoNaming.note": { + "settings.betaFeatures.feed.subtitleOn": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "عند التفعيل، يلخّص cmux جلسات الوكلاء المدعومة في أسماء قصيرة لمساحات العمل وعلامات التبويب باستخدام البرنامج الثنائي الخاص بكل وكيل، ويتم التحديث عند تغيّر الموضوع. تتقدم إعادة التسمية اليدوية دائمًا وتوقف التسمية التلقائية لتلك المساحة أو علامة التبويب. تُستخدم حسابات الوكلاء لديك لاستدعاءات التلخيص القصيرة." + "value": "Shows Feed in the right sidebar mode switcher for inline agent decisions." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Kada je uključeno, cmux sažima podržane sesije agenata u kratke nazive radnih prostora i kartica koristeći binarni program svakog agenta, uz osvježavanje kada se tema promijeni. Ručna preimenovanja uvijek imaju prednost i zaustavljaju automatsko imenovanje za taj radni prostor ili karticu. Za kratke pozive sažimanja koristi se vaš agentski račun." + "value": "Feed を右サイドバーのモード切り替えに表示し、エージェントの判断をインラインで扱えるようにします。" } - }, - "da": { + } + } + }, + "settings.betaFeatures.remoteTmux": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Når det er slået til, opsummerer cmux understøttede agentsessioner til korte navne på arbejdsområder og faner med hver agents egen binærfil og opdaterer dem, når emnet skifter. Manuelle omdøbninger vinder altid og stopper automatisk navngivning for det arbejdsområde eller den fane. Bruger din agentkonto til de korte opsummeringskald." + "value": "Remote tmux" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Wenn aktiviert, fasst cmux unterstützte Agentensitzungen mit der jeweiligen Agent-Binärdatei zu kurzen Arbeitsbereichs- und Tabnamen zusammen und aktualisiert sie, wenn sich das Thema ändert. Manuelle Umbenennungen haben immer Vorrang und stoppen die automatische Benennung für diesen Arbeitsbereich oder Tab. Für die kurzen Zusammenfassungsaufrufe wird dein Agentenkonto verwendet." + "value": "リモート tmux" } - }, + } + } + }, + "settings.betaFeatures.remoteTmux.subtitleOff": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "When enabled, cmux summarizes supported agent sessions into short workspace and tab names using each agent's own binary, refreshed as the topic shifts. Manual renames always win and stop auto-naming for that workspace or tab. Uses your agent account for the short summarization calls." + "value": "Hides remote tmux mirroring until you enable it here." } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "Cuando está activado, cmux resume las sesiones de agentes compatibles en nombres cortos de espacios de trabajo y pestañas usando el binario propio de cada agente, y los actualiza cuando cambia el tema. Los cambios de nombre manuales siempre tienen prioridad y detienen el nombrado automático para ese espacio de trabajo o pestaña. Usa tu cuenta del agente para las llamadas breves de resumen." + "value": "ここで有効にするまで、リモート tmux のミラーリングを表示しません。" } - }, - "fr": { + } + } + }, + "settings.betaFeatures.remoteTmux.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Lorsque cette option est activée, cmux résume les sessions d'agents prises en charge en noms courts d'espaces de travail et d'onglets avec le binaire propre à chaque agent, puis les actualise quand le sujet change. Les renommages manuels gagnent toujours et arrêtent le nommage automatique pour cet espace de travail ou cet onglet. Utilise votre compte d'agent pour les courts appels de résumé." + "value": "Mirrors a remote host's tmux sessions in the sidebar over ssh tmux -CC; sessions become workspaces and windows become tabs. Quitting cmux leaves the remote tmux server running." } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "Quando è attivo, cmux riassume le sessioni degli agenti supportati in brevi nomi di spazi di lavoro e schede usando il binario di ciascun agente, aggiornandoli quando cambia l'argomento. Le rinominazioni manuali hanno sempre la precedenza e interrompono la denominazione automatica per quello spazio di lavoro o quella scheda. Usa il tuo account dell'agente per le brevi chiamate di riepilogo." + "value": "ssh tmux -CC でリモートホストの tmux セッションをサイドバーにミラーリングします。セッションはワークスペースに、ウィンドウはタブになります。cmux を終了してもリモートの tmux サーバーは動作し続けます。" + } + } + } + }, + "settings.betaFeatures.warning": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "These features are experimental and may change or break. Enable them only when you are testing them." } }, "ja": { "stringUnit": { "state": "translated", - "value": "有効にすると、cmux は対応エージェントの各バイナリを使ってエージェントセッションを短いワークスペース名とタブ名に要約し、話題が変わると更新します。手動の名前変更が常に優先され、そのワークスペースやタブの自動命名は停止します。短い要約呼び出しにはユーザーのエージェントアカウントが使われます。" + "value": "これらの機能は実験的で、変更されたり壊れたりする可能性があります。テストする場合だけ有効にしてください。" } - }, - "km": { + } + } + }, + "settings.betaFeatures.workspaceTodoControls": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "ពេលបើក cmux សង្ខេបសម័យភ្នាក់ងារដែលគាំទ្រជាឈ្មោះខ្លីសម្រាប់កន្លែងធ្វើការ និងផ្ទាំង ដោយប្រើ binary របស់ភ្នាក់ងារនីមួយៗ ហើយធ្វើបច្ចុប្បន្នភាពនៅពេលប្រធានបទផ្លាស់ប្តូរ។ ការប្តូរឈ្មោះដោយដៃតែងតែមានអាទិភាព ហើយបញ្ឈប់ការដាក់ឈ្មោះស្វ័យប្រវត្តិសម្រាប់កន្លែងធ្វើការ ឬផ្ទាំងនោះ។ ប្រើគណនីភ្នាក់ងាររបស់អ្នកសម្រាប់ការហៅសង្ខេបខ្លីៗ។" + "value": "Workspace Todo Controls" } }, - "ko": { + "ja": { "stringUnit": { "state": "translated", - "value": "켜면 cmux가 각 에이전트의 자체 바이너리를 사용해 지원되는 에이전트 세션을 짧은 작업 공간 및 탭 이름으로 요약하고, 주제가 바뀌면 갱신합니다. 수동 이름 변경이 항상 우선하며 해당 작업 공간이나 탭의 자동 이름 지정을 중지합니다. 짧은 요약 호출에는 사용자의 에이전트 계정이 사용됩니다." + "value": "ワークスペース Todo コントロール" } - }, - "nb": { + } + } + }, + "settings.betaFeatures.workspaceTodoControls.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Når dette er på, oppsummerer cmux støttede agentøkter til korte navn på arbeidsområder og faner med hver agents egen binærfil, og oppdaterer dem når emnet endres. Manuelle endringer av navn vinner alltid og stopper automatisk navngiving for det arbeidsområdet eller den fanen. Bruker agentkontoen din for de korte oppsummeringskallene." + "value": "Keeps workspace todo summaries read-only unless remote rollout enables the controls." } }, - "pl": { + "ja": { "stringUnit": { "state": "translated", - "value": "Po włączeniu cmux streszcza obsługiwane sesje agentów do krótkich nazw obszarów roboczych i kart, używając własnego pliku binarnego każdego agenta, i odświeża je po zmianie tematu. Ręczne zmiany nazw zawsze mają pierwszeństwo i zatrzymują automatyczne nazywanie dla tego obszaru roboczego lub karty. Krótkie wywołania streszczeń używają Twojego konta agenta." + "value": "リモートロールアウトでコントロールが有効になるまで、ワークスペース Todo の概要を読み取り専用にします。" } - }, - "pt-BR": { + } + } + }, + "settings.betaFeatures.workspaceTodoControls.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Quando ativado, o cmux resume sessões de agentes compatíveis em nomes curtos de espaços de trabalho e abas usando o binário próprio de cada agente, atualizados conforme o assunto muda. Renomeações manuais sempre vencem e interrompem a nomeação automática para aquele espaço de trabalho ou aba. Usa sua conta do agente para as chamadas curtas de resumo." + "value": "Shows Add Checklist Item and workspace status controls." } }, - "ru": { + "ja": { "stringUnit": { "state": "translated", - "value": "Если включено, cmux кратко обобщает поддерживаемые сеансы агентов в короткие имена рабочих областей и вкладок с помощью собственного бинарного файла каждого агента и обновляет их при смене темы. Ручные переименования всегда имеют приоритет и останавливают автоматическое именование для этой рабочей области или вкладки. Для коротких вызовов обобщения используется ваша учетная запись агента." + "value": "「チェックリスト項目を追加」とワークスペースのステータスコントロールを表示します。" + } + } + } + }, + "settings.betaFeatures.workspaceTodosChecklistStyle": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Checklist Style" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "เมื่อเปิดใช้งาน cmux จะสรุปเซสชันเอเจนต์ที่รองรับเป็นชื่อพื้นที่ทำงานและแท็บแบบสั้น โดยใช้ไบนารีของเอเจนต์แต่ละตัว และรีเฟรชเมื่อหัวข้อเปลี่ยน การเปลี่ยนชื่อด้วยตนเองจะมีผลเหนือกว่าเสมอและหยุดการตั้งชื่ออัตโนมัติสำหรับพื้นที่ทำงานหรือแท็บนั้น ใช้บัญชีเอเจนต์ของคุณสำหรับการเรียกสรุปแบบสั้น" + "value": "チェックリストの表示スタイル" + } + } + } + }, + "settings.betaFeatures.workspaceTodosChecklistStyle.inline": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Inline" } }, - "tr": { + "ja": { "stringUnit": { "state": "translated", - "value": "Açıldığında cmux, desteklenen aracı oturumlarını her aracının kendi ikili dosyasını kullanarak kısa çalışma alanı ve sekme adlarına özetler ve konu değiştikçe yeniler. Elle yeniden adlandırmalar her zaman kazanır ve o çalışma alanı veya sekme için otomatik adlandırmayı durdurur. Kısa özetleme çağrıları için aracı hesabınızı kullanır." + "value": "インライン" + } + } + } + }, + "settings.betaFeatures.workspaceTodosChecklistStyle.popover": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Popover" } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "Коли ввімкнено, cmux узагальнює підтримувані сеанси агентів у короткі назви робочих областей і вкладок за допомогою власного бінарного файла кожного агента та оновлює їх, коли тема змінюється. Ручні перейменування завжди мають перевагу й зупиняють автоматичне іменування для цієї робочої області або вкладки. Для коротких викликів узагальнення використовується ваш обліковий запис агента." + "value": "ポップオーバー" + } + } + } + }, + "settings.betaFeatures.workspaceTodosChecklistStyle.subtitleInline": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Clicking a row's checklist summary expands the items inline under the row." } }, - "zh-Hans": { + "ja": { "stringUnit": { "state": "translated", - "value": "启用后,cmux 会使用每个代理自己的二进制文件,将支持的代理会话总结为简短的工作区和标签页名称,并在主题变化时刷新。手动重命名始终优先,并会停止该工作区或标签页的自动命名。短摘要调用会使用你的代理账户。" + "value": "行のチェックリスト概要をクリックすると、行の下に項目がインライン展開されます。" + } + } + } + }, + "settings.betaFeatures.workspaceTodosChecklistStyle.subtitlePopover": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Clicking a row's checklist summary opens an anchored popover." } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "啟用後,cmux 會使用每個代理自己的二進位檔,將支援的代理工作階段摘要為簡短的工作區和分頁名稱,並在主題變化時重新整理。手動重新命名永遠優先,並會停止該工作區或分頁的自動命名。短摘要呼叫會使用你的代理帳戶。" + "value": "行のチェックリスト概要をクリックすると、アンカー付きのポップオーバーが開きます。" } } } }, - "settings.automation.workspaceAutoNaming.subtitleOff": { + "settings.blendMode.behindWindow": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "لا يتم إنشاء أسماء مساحات العمل وعلامات التبويب أبدًا." + "value": "خلف النافذة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Nazivi radnih prostora i kartica nikada se ne generiraju." + "value": "Iza prozora" } }, "da": { "stringUnit": { "state": "translated", - "value": "Navne på arbejdsområder og faner genereres aldrig." + "value": "Bag vindue" } }, "de": { "stringUnit": { "state": "translated", - "value": "Namen für Arbeitsbereiche und Tabs werden nie erzeugt." + "value": "Hinter dem Fenster" } }, "en": { "stringUnit": { "state": "translated", - "value": "Workspace and tab names are never generated." + "value": "Behind Window" } }, "es": { "stringUnit": { "state": "translated", - "value": "Nunca se generan nombres para espacios de trabajo ni pestañas." + "value": "Detrás de la ventana" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Les noms des espaces de travail et des onglets ne sont jamais générés." + "value": "Derrière la fenêtre" } }, "it": { "stringUnit": { "state": "translated", - "value": "I nomi di spazi di lavoro e schede non vengono mai generati." + "value": "Dietro la finestra" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ワークスペースとタブの名前は自動生成されません。" - } - }, - "km": { - "stringUnit": { - "state": "translated", - "value": "ឈ្មោះកន្លែងធ្វើការ និងផ្ទាំងមិនត្រូវបានបង្កើតឡើយ។" + "value": "ウインドウの背面" } }, "ko": { "stringUnit": { "state": "translated", - "value": "작업 공간과 탭 이름은 생성되지 않습니다." + "value": "윈도우 뒤" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Navn på arbeidsområder og faner genereres aldri." + "value": "Bak vinduet" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Nazwy obszarów roboczych i kart nigdy nie są generowane." + "value": "Za oknem" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Nomes de espaços de trabalho e abas nunca são gerados." + "value": "Atrás da Janela" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Имена рабочих областей и вкладок никогда не создаются." + "value": "За окном" } }, "th": { "stringUnit": { "state": "translated", - "value": "จะไม่มีการสร้างชื่อพื้นที่ทำงานและแท็บ" + "value": "ด้านหลังหน้าต่าง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Çalışma alanı ve sekme adları hiçbir zaman oluşturulmaz." + "value": "Pencerenin Arkası" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Назви робочих областей і вкладок ніколи не створюються." + "value": "За вікном" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "不会生成工作区和标签页名称。" + "value": "窗口后方" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "不會產生工作區和分頁名稱。" + "value": "視窗後方" } } } }, - "settings.automation.workspaceAutoNaming.subtitleOn": { + "settings.blendMode.withinWindow": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "تُسمّى مساحات العمل وعلامات التبويب من محادثات الوكيل." + "value": "داخل النافذة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Radni prostori i kartice nazivaju se prema razgovorima agenta." + "value": "Unutar prozora" } }, "da": { "stringUnit": { "state": "translated", - "value": "Arbejdsområder og faner navngives ud fra agentsamtaler." + "value": "Inden i vindue" } }, "de": { "stringUnit": { "state": "translated", - "value": "Arbeitsbereiche und Tabs werden aus Agentengesprächen benannt." + "value": "Innerhalb des Fensters" } }, "en": { "stringUnit": { "state": "translated", - "value": "Workspaces and tabs are named from agent conversations." + "value": "Within Window" } }, "es": { "stringUnit": { "state": "translated", - "value": "Los espacios de trabajo y las pestañas se nombran a partir de conversaciones del agente." + "value": "Dentro de la ventana" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Les espaces de travail et les onglets sont nommés à partir des conversations de l'agent." + "value": "Dans la fenêtre" } }, "it": { "stringUnit": { "state": "translated", - "value": "Spazi di lavoro e schede vengono nominati dalle conversazioni dell'agente." + "value": "All'interno della finestra" } }, "ja": { "stringUnit": { "state": "translated", - "value": "エージェントの会話からワークスペースとタブに名前が付きます。" - } - }, - "km": { - "stringUnit": { - "state": "translated", - "value": "កន្លែងធ្វើការ និងផ្ទាំងត្រូវបានដាក់ឈ្មោះពីការសន្ទនារបស់ភ្នាក់ងារ។" + "value": "ウインドウ内" } }, "ko": { "stringUnit": { "state": "translated", - "value": "작업 공간과 탭 이름이 에이전트 대화에서 지정됩니다." + "value": "윈도우 내" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Arbeidsområder og faner navngis fra agentsamtaler." + "value": "Inni vinduet" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Obszary robocze i karty są nazywane na podstawie rozmów agenta." + "value": "W oknie" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Espaços de trabalho e abas são nomeados a partir das conversas do agente." + "value": "Dentro da Janela" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Рабочие области и вкладки получают имена из разговоров агента." + "value": "Внутри окна" } }, "th": { "stringUnit": { "state": "translated", - "value": "พื้นที่ทำงานและแท็บจะตั้งชื่อตามการสนทนาของเอเจนต์" + "value": "ภายในหน้าต่าง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Çalışma alanları ve sekmeler aracı konuşmalarından adlandırılır." + "value": "Pencere İçinde" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Робочі області та вкладки отримують назви з розмов агента." + "value": "Усередині вікна" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "工作区和标签页会根据代理对话命名。" + "value": "窗口内部" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "工作區和分頁會根據代理對話命名。" + "value": "視窗內" } } } }, - "settings.betaFeatures.customSidebars": { + "settings.browser.askWhereToSaveDownloads": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Custom Sidebars" + "value": "Ask Where to Save Downloads" } }, "ja": { "stringUnit": { "state": "translated", - "value": "カスタムサイドバー" + "value": "ダウンロードごとに保存先を確認" } } } }, - "settings.betaFeatures.customSidebars.subtitleOff": { + "settings.browser.askWhereToSaveDownloads.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Hides custom sidebars from the sidebar picker until you enable them here." + "value": "When off, browser downloads save directly to Downloads without a save panel." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ここで有効にするまで、カスタムサイドバーをサイドバーピッカーに表示しません。" + "value": "オフの場合、ブラウザのダウンロードは保存パネルなしで直接「ダウンロード」に保存されます。" } } } }, - "settings.betaFeatures.customSidebars.subtitleOn": { + "settings.browser.customSearchEngineName": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Lists your sidebars from ~/.config/cmux/sidebars in the sidebar picker, rendered in an isolated helper process." + "value": "اسم محرك البحث المخصص" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "~/.config/cmux/sidebars のサイドバーをサイドバーピッカーに表示し、分離されたヘルパープロセスで描画します。" - } - } - } - }, - "settings.betaFeatures.dock": { - "extractionState": "manual", - "localizations": { - "en": { + "bs": { "stringUnit": { "state": "translated", - "value": "Dock" + "value": "Naziv prilagođenog pretraživača" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "Dock" - } - } - } - }, - "settings.betaFeatures.dock.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Hides Dock from the right sidebar until you enable it here." + "value": "Navn på tilpasset søgemaskine" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "ここで有効にするまで、Dock を右サイドバーから隠します。" - } - } - } - }, - "settings.betaFeatures.dock.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + "de": { "stringUnit": { "state": "translated", - "value": "Shows Dock in the right sidebar mode switcher for custom terminal controls." + "value": "Name der benutzerdefinierten Suchmaschine" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "Dock を右サイドバーのモード切り替えに表示し、カスタム端末コントロールを使えるようにします。" - } - } - } - }, - "settings.betaFeatures.extensions": { - "extractionState": "manual", - "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Extensions" + "value": "Custom Search Engine Name" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "エクステンション" - } - } - } - }, - "settings.betaFeatures.extensions.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + "es": { "stringUnit": { "state": "translated", - "value": "Hides all extension UI until you enable it here." + "value": "Nombre del motor de búsqueda personalizado" } }, - "ja": { + "fr": { "stringUnit": { "state": "translated", - "value": "ここで有効にするまで、すべてのエクステンション UI を隠します。" + "value": "Nom du moteur de recherche personnalisé" } - } - } - }, - "settings.betaFeatures.extensions.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Shows the puzzle button, the sidebar-toggle extension menu, and lets you install and host sidebar extensions." + "value": "Nome del motore di ricerca personalizzato" } }, "ja": { "stringUnit": { "state": "translated", - "value": "パズルボタンとサイドバー切り替えのエクステンションメニューを表示し、サイドバーエクステンションのインストールとホストを可能にします。" + "value": "カスタム検索エンジン名" } - } - } - }, - "settings.betaFeatures.feed": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Feed" + "value": "사용자 지정 검색 엔진 이름" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "Feed" + "value": "Navn på tilpasset søkemotor" } - } - } - }, - "settings.betaFeatures.feed.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Hides Feed from the right sidebar until you enable it here." + "value": "Nazwa niestandardowej wyszukiwarki" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "ここで有効にするまで、Feed を右サイドバーから隠します。" + "value": "Nome do mecanismo de busca personalizado" } - } - } - }, - "settings.betaFeatures.feed.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Shows Feed in the right sidebar mode switcher for inline agent decisions." + "value": "Название пользовательской поисковой системы" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "Feed を右サイドバーのモード切り替えに表示し、エージェントの判断をインラインで扱えるようにします。" + "value": "ชื่อเครื่องมือค้นหาแบบกำหนดเอง" } - } - } - }, - "settings.betaFeatures.remoteTmux": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Remote tmux" + "value": "Özel Arama Motoru Adı" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "リモート tmux" + "value": "Назва користувацької пошукової системи" } - } - } - }, - "settings.betaFeatures.remoteTmux.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Hides remote tmux mirroring until you enable it here." + "value": "自定义搜索引擎名称" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "ここで有効にするまで、リモート tmux のミラーリングを表示しません。" + "value": "自訂搜尋引擎名稱" } } } }, - "settings.betaFeatures.remoteTmux.subtitleOn": { + "settings.browser.customSearchEngineName.subtitle": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Mirrors a remote host's tmux sessions in the sidebar over ssh tmux -CC; sessions become workspaces and windows become tabs. Quitting cmux leaves the remote tmux server running." + "value": "يظهر في اقتراحات البحث في شريط عنوان المتصفح." } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "ssh tmux -CC でリモートホストの tmux セッションをサイドバーにミラーリングします。セッションはワークスペースに、ウィンドウはタブになります。cmux を終了してもリモートの tmux サーバーは動作し続けます。" + "value": "Prikazuje se u prijedlozima pretrage u adresnoj traci preglednika." } - } - } - }, - "settings.betaFeatures.warning": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "These features are experimental and may change or break. Enable them only when you are testing them." + "value": "Vises i søgeforslag i browserens adresselinje." } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "これらの機能は実験的で、変更されたり壊れたりする可能性があります。テストする場合だけ有効にしてください。" + "value": "Wird in Suchvorschlägen in der Adressleiste des Browsers angezeigt." } - } - } - }, - "settings.betaFeatures.workspaceTodoControls": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Workspace Todo Controls" + "value": "Shown in browser address bar search suggestions." } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "ワークスペース Todo コントロール" - } - } - } - }, - "settings.betaFeatures.workspaceTodoControls.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + "es": { "stringUnit": { "state": "translated", - "value": "Keeps workspace todo summaries read-only unless remote rollout enables the controls." + "value": "Se muestra en las sugerencias de búsqueda de la barra de direcciones del navegador." } }, - "ja": { + "fr": { "stringUnit": { "state": "translated", - "value": "リモートロールアウトでコントロールが有効になるまで、ワークスペース Todo の概要を読み取り専用にします。" + "value": "Affiché dans les suggestions de recherche de la barre d’adresse du navigateur." } - } - } - }, - "settings.betaFeatures.workspaceTodoControls.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Shows Add Checklist Item and workspace status controls." + "value": "Mostrato nei suggerimenti di ricerca della barra degli indirizzi del browser." } }, "ja": { "stringUnit": { "state": "translated", - "value": "「チェックリスト項目を追加」とワークスペースのステータスコントロールを表示します。" + "value": "ブラウザのアドレスバーの検索候補に表示されます。" } - } - } - }, - "settings.betaFeatures.workspaceTodosChecklistStyle": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Checklist Style" + "value": "브라우저 주소 표시줄 검색 제안에 표시됩니다." } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "チェックリストの表示スタイル" + "value": "Vises i søkeforslag i nettleserens adresselinje." } - } - } - }, - "settings.betaFeatures.workspaceTodosChecklistStyle.inline": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Inline" + "value": "Wyświetlana w sugestiach wyszukiwania na pasku adresu przeglądarki." } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "インライン" + "value": "Exibido nas sugestões de busca da barra de endereço do navegador." } - } - } - }, - "settings.betaFeatures.workspaceTodosChecklistStyle.popover": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Отображается в поисковых подсказках адресной строки браузера." } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "ポップオーバー" + "value": "แสดงในคำแนะนำการค้นหาในแถบที่อยู่ของเบราว์เซอร์" } - } - } - }, - "settings.betaFeatures.workspaceTodosChecklistStyle.subtitleInline": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Clicking a row's checklist summary expands the items inline under the row." + "value": "Tarayıcı adres çubuğu arama önerilerinde gösterilir." } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "行のチェックリスト概要をクリックすると、行の下に項目がインライン展開されます。" + "value": "Показується в пошукових пропозиціях адресного рядка браузера." } - } - } - }, - "settings.betaFeatures.workspaceTodosChecklistStyle.subtitlePopover": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Clicking a row's checklist summary opens an anchored popover." + "value": "显示在浏览器地址栏搜索建议中。" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "行のチェックリスト概要をクリックすると、アンカー付きのポップオーバーが開きます。" + "value": "顯示在瀏覽器位址列搜尋建議中。" } } } }, - "settings.blendMode.behindWindow": { + "settings.browser.customSearchEngineURLTemplate": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "خلف النافذة" + "value": "رابط البحث المخصص" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Iza prozora" + "value": "Prilagođeni URL pretrage" } }, "da": { "stringUnit": { "state": "translated", - "value": "Bag vindue" + "value": "Tilpasset søge-URL" } }, "de": { "stringUnit": { "state": "translated", - "value": "Hinter dem Fenster" + "value": "Benutzerdefinierte Such-URL" } }, "en": { "stringUnit": { "state": "translated", - "value": "Behind Window" + "value": "Custom Search URL" } }, "es": { "stringUnit": { "state": "translated", - "value": "Detrás de la ventana" + "value": "URL de búsqueda personalizada" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Derrière la fenêtre" + "value": "URL de recherche personnalisée" } }, "it": { "stringUnit": { "state": "translated", - "value": "Dietro la finestra" + "value": "URL di ricerca personalizzato" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ウインドウの背面" + "value": "カスタム検索URL" } }, "ko": { "stringUnit": { "state": "translated", - "value": "윈도우 뒤" + "value": "사용자 지정 검색 URL" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Bak vinduet" + "value": "Tilpasset søke-URL" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Za oknem" + "value": "Niestandardowy URL wyszukiwania" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Atrás da Janela" + "value": "URL de busca personalizada" } }, "ru": { "stringUnit": { "state": "translated", - "value": "За окном" + "value": "Пользовательский URL поиска" } }, "th": { "stringUnit": { "state": "translated", - "value": "ด้านหลังหน้าต่าง" + "value": "URL ค้นหาแบบกำหนดเอง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Pencerenin Arkası" + "value": "Özel Arama URL'si" } }, "uk": { "stringUnit": { "state": "translated", - "value": "За вікном" + "value": "Користувацька URL-адреса пошуку" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "窗口后方" + "value": "自定义搜索 URL" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "視窗後方" + "value": "自訂搜尋 URL" } } } }, - "settings.blendMode.withinWindow": { + "settings.browser.customSearchEngineURLTemplate.subtitle": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "داخل النافذة" + "value": "استخدم {query} أو %s لعبارات البحث. بدون عنصر نائب، يضيف cmux q=." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Unutar prozora" + "value": "Koristite {query} ili %s za pojmove pretrage. Bez rezerviranog mjesta cmux dodaje q=." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Brug {query} eller %s til søgeordene. Uden en pladsholder tilføjer cmux q=." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Verwende {query} oder %s für die Suchbegriffe. Ohne Platzhalter fügt cmux q= hinzu." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Use {query} or %s for the search terms. Without a placeholder, cmux appends q=." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Usa {query} o %s para los términos de búsqueda. Sin marcador de posición, cmux agrega q=." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Utilisez {query} ou %s pour les termes de recherche. Sans espace réservé, cmux ajoute q=." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Usa {query} o %s per i termini di ricerca. Senza segnaposto, cmux aggiunge q=." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "検索語には {query} または %s を使います。プレースホルダーがない場合、cmux は q= を追加します。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "검색어에는 {query} 또는 %s를 사용하세요. 자리표시자가 없으면 cmux가 q=를 추가합니다." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Bruk {query} eller %s for søkeordene. Uten plassholder legger cmux til q=." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Użyj {query} lub %s dla wyszukiwanych terminów. Bez symbolu zastępczego cmux doda q=." } }, - "da": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "Inden i vindue" + "value": "Use {query} ou %s para os termos de busca. Sem marcador, o cmux adiciona q=." } }, - "de": { + "ru": { "stringUnit": { "state": "translated", - "value": "Innerhalb des Fensters" + "value": "Используйте {query} или %s для поисковых запросов. Без заполнителя cmux добавляет q=." } }, - "en": { + "th": { "stringUnit": { "state": "translated", - "value": "Within Window" + "value": "ใช้ {query} หรือ %s สำหรับคำค้นหา หากไม่มีตัวยึดตำแหน่ง cmux จะเพิ่ม q=" } }, - "es": { + "tr": { "stringUnit": { "state": "translated", - "value": "Dentro de la ventana" + "value": "Arama terimleri için {query} veya %s kullanın. Yer tutucu yoksa cmux q= ekler." } }, - "fr": { + "uk": { "stringUnit": { "state": "translated", - "value": "Dans la fenêtre" + "value": "Використовуйте {query} або %s для пошукових запитів. Без заповнювача cmux додає q=." } }, - "it": { + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "All'interno della finestra" + "value": "使用 {query} 或 %s 作为搜索词。没有占位符时,cmux 会追加 q=。" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "ウインドウ内" + "value": "使用 {query} 或 %s 作為搜尋詞。沒有佔位符時,cmux 會附加 q=。" } - }, - "ko": { + } + } + }, + "settings.browser.emptyImport.choose": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "윈도우 내" + "value": "Choose What to Import…" } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "Inni vinduet" + "value": "取り込む項目を選ぶ…" } }, - "pl": { + "ko": { "stringUnit": { "state": "translated", - "value": "W oknie" + "value": "가져올 항목 선택…" } }, - "pt-BR": { + "uk": { "stringUnit": { "state": "translated", - "value": "Dentro da Janela" + "value": "Вибрати, що імпортувати…" } - }, - "ru": { + } + } + }, + "settings.browser.emptyImport.title": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Внутри окна" + "value": "Import browser data" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "ภายในหน้าต่าง" + "value": "ブラウザーデータを取り込む" } }, - "tr": { + "ko": { "stringUnit": { "state": "translated", - "value": "Pencere İçinde" + "value": "브라우저 데이터 가져오기" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Усередині вікна" + "value": "Імпорт даних браузера" } - }, - "zh-Hans": { + } + } + }, + "settings.browser.enabled": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "窗口内部" + "value": "Enable cmux Browser" } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "視窗內" + "value": "cmuxブラウザを有効にする" } } } }, - "settings.browser.askWhereToSaveDownloads": { + "settings.browser.enabled.subtitleOff": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Ask Where to Save Downloads" + "value": "Browser tabs, terminal link clicks, and intercepted open commands are disabled. Links open in your default browser." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ダウンロードごとに保存先を確認" + "value": "ブラウザタブ、ターミナルのリンククリック、インターセプトされたopenコマンドは無効です。リンクはデフォルトブラウザで開きます。" } } } }, - "settings.browser.askWhereToSaveDownloads.subtitle": { + "settings.browser.enabled.subtitleOn": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "When off, browser downloads save directly to Downloads without a save panel." + "value": "Browser tabs, terminal link clicks, and intercepted open commands can use the embedded browser." } }, "ja": { "stringUnit": { "state": "translated", - "value": "オフの場合、ブラウザのダウンロードは保存パネルなしで直接「ダウンロード」に保存されます。" + "value": "ブラウザタブ、ターミナルのリンククリック、インターセプトされたopenコマンドで内蔵ブラウザを使用できます。" } } } }, - "settings.browser.customSearchEngineName": { + "settings.browser.externalPatterns": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "اسم محرك البحث المخصص" + "value": "عناوين URL للفتح خارجيًا دائمًا" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Naziv prilagođenog pretraživača" + "value": "URL-ovi za uvijek vanjsko otvaranje" } }, "da": { "stringUnit": { "state": "translated", - "value": "Navn på tilpasset søgemaskine" + "value": "URL'er der altid åbnes eksternt" } }, "de": { "stringUnit": { "state": "translated", - "value": "Name der benutzerdefinierten Suchmaschine" + "value": "URLs, die immer extern geöffnet werden" } }, "en": { "stringUnit": { "state": "translated", - "value": "Custom Search Engine Name" + "value": "URLs to Always Open Externally" } }, "es": { "stringUnit": { "state": "translated", - "value": "Nombre del motor de búsqueda personalizado" + "value": "URLs para abrir siempre externamente" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Nom du moteur de recherche personnalisé" + "value": "URL à toujours ouvrir dans un navigateur externe" } }, "it": { "stringUnit": { "state": "translated", - "value": "Nome del motore di ricerca personalizzato" + "value": "URL da aprire sempre esternamente" } }, "ja": { "stringUnit": { "state": "translated", - "value": "カスタム検索エンジン名" + "value": "常に外部で開くURL" } }, "ko": { "stringUnit": { "state": "translated", - "value": "사용자 지정 검색 엔진 이름" + "value": "항상 외부에서 열 URL" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Navn på tilpasset søkemotor" + "value": "URL-er som alltid åpnes eksternt" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Nazwa niestandardowej wyszukiwarki" + "value": "Adresy URL otwierane zawsze zewnętrznie" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Nome do mecanismo de busca personalizado" + "value": "URLs para Sempre Abrir Externamente" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Название пользовательской поисковой системы" + "value": "URL для открытия во внешнем браузере" } }, "th": { "stringUnit": { "state": "translated", - "value": "ชื่อเครื่องมือค้นหาแบบกำหนดเอง" + "value": "URL ที่เปิดภายนอกเสมอ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Özel Arama Motoru Adı" + "value": "Her Zaman Harici Olarak Açılacak URL'ler" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Назва користувацької пошукової системи" + "value": "URL для завжди зовнішнього відкриття" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "自定义搜索引擎名称" + "value": "始终在外部打开的 URL" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "自訂搜尋引擎名稱" + "value": "一律在外部開啟的 URL" } } } }, - "settings.browser.customSearchEngineName.subtitle": { + "settings.browser.externalPatterns.subtitle": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "يظهر في اقتراحات البحث في شريط عنوان المتصفح." + "value": "ينطبق على نقرات الروابط في الطرفية واستدعاءات `open https://...` المعترضة. قاعدة واحدة لكل سطر. النص العادي يطابق أي جزء من URL، أو ابدأ بـ `re:` للتعبيرات النمطية (مثال: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Prikazuje se u prijedlozima pretrage u adresnoj traci preglednika." + "value": "Primjenjuje se na klikove linkova u terminalu i presretnute `open https://...` pozive. Jedno pravilo po redu. Običan tekst odgovara bilo kojem dijelu URL-a, ili dodajte prefiks `re:` za regex (na primjer: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "da": { "stringUnit": { "state": "translated", - "value": "Vises i søgeforslag i browserens adresselinje." + "value": "Gælder for terminallinksklik og opfangede `open https://...`-kald. Én regel pr. linje. Almindelig tekst matcher enhver URL-delstreng, eller brug `re:` som præfiks for regex (f.eks.: openai.com/usage, re:^https?://[^/]*\\.example\\.com/(billing|usage))." } }, "de": { "stringUnit": { "state": "translated", - "value": "Wird in Suchvorschlägen in der Adressleiste des Browsers angezeigt." + "value": "Gilt für Klicks auf Terminal-Links und abgefangene `open https://...`-Aufrufe. Eine Regel pro Zeile. Klartext stimmt mit jedem URL-Teilstring überein, oder verwenden Sie das Präfix `re:` für Regex (zum Beispiel: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "en": { "stringUnit": { "state": "translated", - "value": "Shown in browser address bar search suggestions." + "value": "Applies to terminal link clicks and intercepted `open https://...` calls. One rule per line. Plain text matches any URL substring, or prefix with `re:` for regex (for example: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "es": { "stringUnit": { "state": "translated", - "value": "Se muestra en las sugerencias de búsqueda de la barra de direcciones del navegador." + "value": "Se aplica a clics en enlaces del terminal y llamadas interceptadas de `open https://...`. Una regla por línea. El texto plano coincide con cualquier subcadena de URL, o usa el prefijo `re:` para regex (por ejemplo: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Affiché dans les suggestions de recherche de la barre d’adresse du navigateur." + "value": "S'applique aux clics sur les liens du terminal et aux appels `open https://...` interceptés. Une règle par ligne. Le texte brut correspond à toute sous-chaîne d'URL, ou préfixez par `re:` pour une expression régulière (par exemple : openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "it": { "stringUnit": { "state": "translated", - "value": "Mostrato nei suggerimenti di ricerca della barra degli indirizzi del browser." + "value": "Si applica ai clic sui link nel terminale e alle chiamate intercettate `open https://...`. Una regola per riga. Il testo semplice corrisponde a qualsiasi sottostringa dell'URL, oppure usa il prefisso `re:` per le regex (ad esempio: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ブラウザのアドレスバーの検索候補に表示されます。" + "value": "ターミナルのリンククリックおよびインターセプトされた`open https://...`呼び出しに適用されます。1行に1ルール。プレーンテキストはURL部分文字列に一致し、`re:`プレフィックスで正規表現を使用できます(例: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "브라우저 주소 표시줄 검색 제안에 표시됩니다." + "value": "터미널 링크 클릭 및 인터셉트된 `open https://...` 호출에 적용됩니다. 한 줄에 하나의 규칙. 일반 텍스트는 URL의 하위 문자열을 일치시키며, `re:` 접두사로 정규식을 사용할 수 있습니다 (예: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Vises i søkeforslag i nettleserens adresselinje." + "value": "Gjelder for terminallenkeklikk og avlyttede `open https://...`-kall. Én regel per linje. Ren tekst matcher enhver del av URL-en, eller prefiks med `re:` for regulære uttrykk (for eksempel: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Wyświetlana w sugestiach wyszukiwania na pasku adresu przeglądarki." + "value": "Dotyczy kliknięć linków w terminalu i przechwyconych wywołań `open https://...`. Jedna reguła na wiersz. Zwykły tekst dopasowuje dowolny fragment URL, lub użyj prefiksu `re:` dla wyrażeń regularnych (na przykład: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Exibido nas sugestões de busca da barra de endereço do navegador." + "value": "Aplica-se a cliques em links do terminal e chamadas interceptadas de `open https://...`. Uma regra por linha. Texto simples corresponde a qualquer substring de URL, ou prefixe com `re:` para regex (por exemplo: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Отображается в поисковых подсказках адресной строки браузера." + "value": "Применяется к нажатиям на ссылки в терминале и перехваченным вызовам `open https://...`. Одно правило на строку. Обычный текст совпадает с любой подстрокой URL, или используйте префикс `re:` для регулярных выражений (например: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "th": { "stringUnit": { "state": "translated", - "value": "แสดงในคำแนะนำการค้นหาในแถบที่อยู่ของเบราว์เซอร์" + "value": "ใช้กับการคลิกลิงก์ในเทอร์มินัลและการดักจับคำสั่ง `open https://...` กฎหนึ่งข้อต่อบรรทัด ข้อความธรรมดาจะจับคู่กับส่วนใดก็ได้ของ URL หรือนำหน้าด้วย `re:` สำหรับ regex (ตัวอย่าง: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Tarayıcı adres çubuğu arama önerilerinde gösterilir." + "value": "Terminal bağlantı tıklamalarına ve yakalanan `open https://...` çağrılarına uygulanır. Satır başına bir kural. Düz metin herhangi bir URL alt dizesiyle eşleşir veya regex için `re:` ön ekini kullanın (örneğin: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Показується в пошукових пропозиціях адресного рядка браузера." + "value": "Застосовується до кліків на посилання в терміналі та перехоплених викликів `open https://...`. Одне правило на рядок. Звичайний текст збігається з будь-якою частиною URL, або додайте префікс `re:` для регулярного виразу (наприклад: openai.com/usage, re:^https?://[^/]*\\.example\\.com/(billing|usage))." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "显示在浏览器地址栏搜索建议中。" + "value": "适用于终端中的链接点击和拦截的 `open https://...` 调用。每行一条规则。纯文本匹配任意 URL 子串,或使用 `re:` 前缀表示正则表达式(例如:openai.com/usage、re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "顯示在瀏覽器位址列搜尋建議中。" + "value": "套用於終端機連結點擊和攔截的 `open https://...` 呼叫。每行一條規則。純文字會比對 URL 的任何子字串,或加上 `re:` 前綴使用正規表示式(例如:openai.com/usage、re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))。" } } } }, - "settings.browser.customSearchEngineURLTemplate": { + "settings.browser.hiddenWebViewDiscard": { "extractionState": "manual", "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "رابط البحث المخصص" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Prilagođeni URL pretrage" - } - }, - "da": { + "en": { "stringUnit": { "state": "translated", - "value": "Tilpasset søge-URL" + "value": "Browser Memory Saver" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Benutzerdefinierte Such-URL" + "value": "ブラウザメモリセーバー" } - }, + } + } + }, + "settings.browser.hiddenWebViewDiscard.subtitleOff": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Custom Search URL" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "URL de búsqueda personalizada" + "value": "Hidden browser tabs keep page memory until closed." } }, - "fr": { + "ja": { "stringUnit": { "state": "translated", - "value": "URL de recherche personnalisée" + "value": "非表示のブラウザタブは、閉じるまでページメモリを保持します。" } - }, - "it": { + } + } + }, + "settings.browser.hiddenWebViewDiscard.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "URL di ricerca personalizzato" + "value": "Hidden browser tabs release page memory after the delay below, then restore when shown again." } }, "ja": { "stringUnit": { "state": "translated", - "value": "カスタム検索URL" + "value": "非表示のブラウザタブは下の遅延後にページメモリを解放し、再表示時に復元します。" } - }, - "ko": { + } + } + }, + "settings.browser.hiddenWebViewDiscardDelay": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "사용자 지정 검색 URL" + "value": "Memory Saver Delay" } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "Tilpasset søke-URL" + "value": "メモリセーバーの遅延" } - }, - "pl": { + } + } + }, + "settings.browser.hiddenWebViewDiscardDelay.minutes": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Niestandardowy URL wyszukiwania" + "value": "%lldm" } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "URL de busca personalizada" + "value": "%lld分" } - }, - "ru": { + } + } + }, + "settings.browser.hiddenWebViewDiscardDelay.minutesSeconds": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Пользовательский URL поиска" + "value": "%lldm %llds" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "URL ค้นหาแบบกำหนดเอง" + "value": "%lld分%lld秒" } - }, - "tr": { + } + } + }, + "settings.browser.hiddenWebViewDiscardDelay.seconds": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Özel Arama URL'si" + "value": "%llds" } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "Користувацька URL-адреса пошуку" + "value": "%lld秒" } - }, - "zh-Hans": { + } + } + }, + "settings.browser.hiddenWebViewDiscardDelay.subtitle": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "自定义搜索 URL" + "value": "How long a browser tab must stay hidden before cmux frees its page memory. Active downloads, popups, developer tools, fullscreen, and loading pages are skipped." } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "自訂搜尋 URL" + "value": "ブラウザタブが非表示になってから、cmux がページメモリを解放するまでの時間です。進行中のダウンロード、ポップアップ、開発者ツール、フルスクリーン、読み込み中のページは対象外です。" } } } }, - "settings.browser.customSearchEngineURLTemplate.subtitle": { + "settings.browser.history": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "استخدم {query} أو %s لعبارات البحث. بدون عنصر نائب، يضيف cmux q=." + "value": "سجل التصفح" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Koristite {query} ili %s za pojmove pretrage. Bez rezerviranog mjesta cmux dodaje q=." + "value": "Historija pregledanja" } }, "da": { "stringUnit": { "state": "translated", - "value": "Brug {query} eller %s til søgeordene. Uden en pladsholder tilføjer cmux q=." + "value": "Browserhistorik" } }, "de": { "stringUnit": { "state": "translated", - "value": "Verwende {query} oder %s für die Suchbegriffe. Ohne Platzhalter fügt cmux q= hinzu." + "value": "Browserverlauf" } }, "en": { "stringUnit": { "state": "translated", - "value": "Use {query} or %s for the search terms. Without a placeholder, cmux appends q=." + "value": "Browsing History" } }, "es": { "stringUnit": { "state": "translated", - "value": "Usa {query} o %s para los términos de búsqueda. Sin marcador de posición, cmux agrega q=." + "value": "Historial de navegación" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Utilisez {query} ou %s pour les termes de recherche. Sans espace réservé, cmux ajoute q=." + "value": "Historique de navigation" } }, "it": { "stringUnit": { "state": "translated", - "value": "Usa {query} o %s per i termini di ricerca. Senza segnaposto, cmux aggiunge q=." + "value": "Cronologia di navigazione" } }, "ja": { "stringUnit": { "state": "translated", - "value": "検索語には {query} または %s を使います。プレースホルダーがない場合、cmux は q= を追加します。" + "value": "ブラウザ履歴" } }, "ko": { "stringUnit": { "state": "translated", - "value": "검색어에는 {query} 또는 %s를 사용하세요. 자리표시자가 없으면 cmux가 q=를 추가합니다." + "value": "탐색 기록" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Bruk {query} eller %s for søkeordene. Uten plassholder legger cmux til q=." + "value": "Nettleserhistorikk" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Użyj {query} lub %s dla wyszukiwanych terminów. Bez symbolu zastępczego cmux doda q=." + "value": "Historia przeglądania" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Use {query} ou %s para os termos de busca. Sem marcador, o cmux adiciona q=." + "value": "Histórico de Navegação" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Используйте {query} или %s для поисковых запросов. Без заполнителя cmux добавляет q=." + "value": "История просмотра" } }, "th": { "stringUnit": { "state": "translated", - "value": "ใช้ {query} หรือ %s สำหรับคำค้นหา หากไม่มีตัวยึดตำแหน่ง cmux จะเพิ่ม q=" + "value": "ประวัติการท่องเว็บ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Arama terimleri için {query} veya %s kullanın. Yer tutucu yoksa cmux q= ekler." + "value": "Tarama Geçmişi" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Використовуйте {query} або %s для пошукових запитів. Без заповнювача cmux додає q=." + "value": "Історія перегляду" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "使用 {query} 或 %s 作为搜索词。没有占位符时,cmux 会追加 q=。" + "value": "浏览历史" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "使用 {query} 或 %s 作為搜尋詞。沒有佔位符時,cmux 會附加 q=。" + "value": "瀏覽記錄" } } } }, - "settings.browser.emptyImport.choose": { + "settings.browser.history.clearButton": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Choose What to Import…" + "value": "مسح السجل…" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "取り込む項目を選ぶ…" + "value": "Obriši historiju…" } }, - "ko": { + "da": { "stringUnit": { "state": "translated", - "value": "가져올 항목 선택…" + "value": "Ryd historik…" } }, - "uk": { + "de": { "stringUnit": { "state": "translated", - "value": "Вибрати, що імпортувати…" + "value": "Verlauf löschen …" } - } - } - }, - "settings.browser.emptyImport.title": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Import browser data" + "value": "Clear History…" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Borrar historial…" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Effacer l'historique..." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Cancella cronologia…" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ブラウザーデータを取り込む" + "value": "履歴をクリア…" } }, "ko": { "stringUnit": { "state": "translated", - "value": "브라우저 데이터 가져오기" + "value": "기록 지우기…" } }, - "uk": { + "nb": { "stringUnit": { "state": "translated", - "value": "Імпорт даних браузера" + "value": "Tøm historikk …" } - } - } - }, - "settings.browser.enabled": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Enable cmux Browser" + "value": "Wyczyść historię…" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "cmuxブラウザを有効にする" + "value": "Limpar Histórico…" } - } - } - }, - "settings.browser.enabled.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Browser tabs, terminal link clicks, and intercepted open commands are disabled. Links open in your default browser." + "value": "Очистить историю..." } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "ブラウザタブ、ターミナルのリンククリック、インターセプトされたopenコマンドは無効です。リンクはデフォルトブラウザで開きます。" + "value": "ล้างประวัติ..." } - } - } - }, - "settings.browser.enabled.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Browser tabs, terminal link clicks, and intercepted open commands can use the embedded browser." + "value": "Geçmişi Temizle…" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "ブラウザタブ、ターミナルのリンククリック、インターセプトされたopenコマンドで内蔵ブラウザを使用できます。" + "value": "Очистити історію…" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "清除历史记录..." + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "清除記錄..." } } } }, - "settings.browser.externalPatterns": { + "settings.browser.history.clearDialog.cancel": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "عناوين URL للفتح خارجيًا دائمًا" + "value": "إلغاء" } }, "bs": { "stringUnit": { "state": "translated", - "value": "URL-ovi za uvijek vanjsko otvaranje" + "value": "Otkaži" } }, "da": { "stringUnit": { "state": "translated", - "value": "URL'er der altid åbnes eksternt" + "value": "Annuller" } }, "de": { "stringUnit": { "state": "translated", - "value": "URLs, die immer extern geöffnet werden" + "value": "Abbrechen" } }, "en": { "stringUnit": { "state": "translated", - "value": "URLs to Always Open Externally" + "value": "Cancel" } }, "es": { "stringUnit": { "state": "translated", - "value": "URLs para abrir siempre externamente" + "value": "Cancelar" } }, "fr": { "stringUnit": { "state": "translated", - "value": "URL à toujours ouvrir dans un navigateur externe" + "value": "Annuler" } }, "it": { "stringUnit": { "state": "translated", - "value": "URL da aprire sempre esternamente" + "value": "Annulla" } }, "ja": { "stringUnit": { "state": "translated", - "value": "常に外部で開くURL" + "value": "キャンセル" } }, "ko": { "stringUnit": { "state": "translated", - "value": "항상 외부에서 열 URL" + "value": "취소" } }, "nb": { "stringUnit": { "state": "translated", - "value": "URL-er som alltid åpnes eksternt" + "value": "Avbryt" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Adresy URL otwierane zawsze zewnętrznie" + "value": "Anuluj" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "URLs para Sempre Abrir Externamente" + "value": "Cancelar" } }, "ru": { "stringUnit": { "state": "translated", - "value": "URL для открытия во внешнем браузере" + "value": "Отменить" } }, "th": { "stringUnit": { "state": "translated", - "value": "URL ที่เปิดภายนอกเสมอ" + "value": "ยกเลิก" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Her Zaman Harici Olarak Açılacak URL'ler" + "value": "Vazgeç" } }, "uk": { "stringUnit": { "state": "translated", - "value": "URL для завжди зовнішнього відкриття" + "value": "Скасувати" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "始终在外部打开的 URL" + "value": "取消" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "一律在外部開啟的 URL" + "value": "取消" } } } }, - "settings.browser.externalPatterns.subtitle": { + "settings.browser.history.clearDialog.confirm": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "ينطبق على نقرات الروابط في الطرفية واستدعاءات `open https://...` المعترضة. قاعدة واحدة لكل سطر. النص العادي يطابق أي جزء من URL، أو ابدأ بـ `re:` للتعبيرات النمطية (مثال: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "مسح السجل" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Primjenjuje se na klikove linkova u terminalu i presretnute `open https://...` pozive. Jedno pravilo po redu. Običan tekst odgovara bilo kojem dijelu URL-a, ili dodajte prefiks `re:` za regex (na primjer: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Obriši historiju" } }, "da": { "stringUnit": { "state": "translated", - "value": "Gælder for terminallinksklik og opfangede `open https://...`-kald. Én regel pr. linje. Almindelig tekst matcher enhver URL-delstreng, eller brug `re:` som præfiks for regex (f.eks.: openai.com/usage, re:^https?://[^/]*\\.example\\.com/(billing|usage))." + "value": "Ryd historik" } }, "de": { "stringUnit": { "state": "translated", - "value": "Gilt für Klicks auf Terminal-Links und abgefangene `open https://...`-Aufrufe. Eine Regel pro Zeile. Klartext stimmt mit jedem URL-Teilstring überein, oder verwenden Sie das Präfix `re:` für Regex (zum Beispiel: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Verlauf löschen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Applies to terminal link clicks and intercepted `open https://...` calls. One rule per line. Plain text matches any URL substring, or prefix with `re:` for regex (for example: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Clear History" } }, "es": { "stringUnit": { "state": "translated", - "value": "Se aplica a clics en enlaces del terminal y llamadas interceptadas de `open https://...`. Una regla por línea. El texto plano coincide con cualquier subcadena de URL, o usa el prefijo `re:` para regex (por ejemplo: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Borrar historial" } }, "fr": { "stringUnit": { "state": "translated", - "value": "S'applique aux clics sur les liens du terminal et aux appels `open https://...` interceptés. Une règle par ligne. Le texte brut correspond à toute sous-chaîne d'URL, ou préfixez par `re:` pour une expression régulière (par exemple : openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Effacer l'historique" } }, "it": { "stringUnit": { "state": "translated", - "value": "Si applica ai clic sui link nel terminale e alle chiamate intercettate `open https://...`. Una regola per riga. Il testo semplice corrisponde a qualsiasi sottostringa dell'URL, oppure usa il prefisso `re:` per le regex (ad esempio: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Cancella cronologia" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ターミナルのリンククリックおよびインターセプトされた`open https://...`呼び出しに適用されます。1行に1ルール。プレーンテキストはURL部分文字列に一致し、`re:`プレフィックスで正規表現を使用できます(例: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))。" + "value": "履歴をクリア" } }, "ko": { "stringUnit": { "state": "translated", - "value": "터미널 링크 클릭 및 인터셉트된 `open https://...` 호출에 적용됩니다. 한 줄에 하나의 규칙. 일반 텍스트는 URL의 하위 문자열을 일치시키며, `re:` 접두사로 정규식을 사용할 수 있습니다 (예: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "기록 지우기" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Gjelder for terminallenkeklikk og avlyttede `open https://...`-kall. Én regel per linje. Ren tekst matcher enhver del av URL-en, eller prefiks med `re:` for regulære uttrykk (for eksempel: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Tøm historikk" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Dotyczy kliknięć linków w terminalu i przechwyconych wywołań `open https://...`. Jedna reguła na wiersz. Zwykły tekst dopasowuje dowolny fragment URL, lub użyj prefiksu `re:` dla wyrażeń regularnych (na przykład: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Wyczyść historię" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Aplica-se a cliques em links do terminal e chamadas interceptadas de `open https://...`. Uma regra por linha. Texto simples corresponde a qualquer substring de URL, ou prefixe com `re:` para regex (por exemplo: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Limpar Histórico" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Применяется к нажатиям на ссылки в терминале и перехваченным вызовам `open https://...`. Одно правило на строку. Обычный текст совпадает с любой подстрокой URL, или используйте префикс `re:` для регулярных выражений (например: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Очистить историю" } }, "th": { "stringUnit": { "state": "translated", - "value": "ใช้กับการคลิกลิงก์ในเทอร์มินัลและการดักจับคำสั่ง `open https://...` กฎหนึ่งข้อต่อบรรทัด ข้อความธรรมดาจะจับคู่กับส่วนใดก็ได้ของ URL หรือนำหน้าด้วย `re:` สำหรับ regex (ตัวอย่าง: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))" + "value": "ล้างประวัติ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Terminal bağlantı tıklamalarına ve yakalanan `open https://...` çağrılarına uygulanır. Satır başına bir kural. Düz metin herhangi bir URL alt dizesiyle eşleşir veya regex için `re:` ön ekini kullanın (örneğin: openai.com/usage, re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))." + "value": "Geçmişi Temizle" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Застосовується до кліків на посилання в терміналі та перехоплених викликів `open https://...`. Одне правило на рядок. Звичайний текст збігається з будь-якою частиною URL, або додайте префікс `re:` для регулярного виразу (наприклад: openai.com/usage, re:^https?://[^/]*\\.example\\.com/(billing|usage))." + "value": "Очистити історію" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "适用于终端中的链接点击和拦截的 `open https://...` 调用。每行一条规则。纯文本匹配任意 URL 子串,或使用 `re:` 前缀表示正则表达式(例如:openai.com/usage、re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))。" + "value": "清除历史记录" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "套用於終端機連結點擊和攔截的 `open https://...` 呼叫。每行一條規則。純文字會比對 URL 的任何子字串,或加上 `re:` 前綴使用正規表示式(例如:openai.com/usage、re:^https?://[^/]*\\\\.example\\\\.com/(billing|usage))。" + "value": "清除記錄" } } } }, - "settings.browser.hiddenWebViewDiscard": { + "settings.browser.history.clearDialog.message": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Browser Memory Saver" + "value": "يؤدي هذا إلى إزالة اقتراحات الصفحات المزارة من شريط عنوان المتصفح." } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "ブラウザメモリセーバー" + "value": "Ovo uklanja prijedloge posjećenih stranica iz omnibar preglednika." } - } - } - }, - "settings.browser.hiddenWebViewDiscard.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Hidden browser tabs keep page memory until closed." + "value": "Dette fjerner besøgte sideforslag fra browserens omnibar." } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "非表示のブラウザタブは、閉じるまでページメモリを保持します。" + "value": "Dies entfernt Vorschläge für besuchte Seiten aus der Browser-Adressleiste." } - } - } - }, - "settings.browser.hiddenWebViewDiscard.subtitleOn": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Hidden browser tabs release page memory after the delay below, then restore when shown again." + "value": "This removes visited-page suggestions from the browser omnibar." } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "非表示のブラウザタブは下の遅延後にページメモリを解放し、再表示時に復元します。" + "value": "Esto elimina las sugerencias de páginas visitadas de la barra de direcciones del navegador." } - } - } - }, - "settings.browser.hiddenWebViewDiscardDelay": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "Memory Saver Delay" + "value": "Cela supprime les suggestions de pages visitées de la barre d'adresse du navigateur." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Questa operazione rimuove i suggerimenti delle pagine visitate dalla barra degli indirizzi del browser." } }, "ja": { "stringUnit": { "state": "translated", - "value": "メモリセーバーの遅延" + "value": "ブラウザのオムニバーから訪問済みページの候補が削除されます。" } - } - } - }, - "settings.browser.hiddenWebViewDiscardDelay.minutes": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "%lldm" + "value": "브라우저 옴니바에서 방문 페이지 제안을 제거합니다." } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "%lld分" + "value": "Dette fjerner forslag basert på besøkte sider fra nettleserens adressefelt." } - } - } - }, - "settings.browser.hiddenWebViewDiscardDelay.minutesSeconds": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "%lldm %llds" + "value": "Spowoduje to usunięcie podpowiedzi odwiedzonych stron z paska adresu przeglądarki." } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "%lld分%lld秒" + "value": "Isto remove as sugestões de páginas visitadas da barra de endereço do navegador." } - } - } - }, - "settings.browser.hiddenWebViewDiscardDelay.seconds": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "%llds" + "value": "Это удалит подсказки посещенных страниц из адресной строки браузера." } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "%lld秒" + "value": "การดำเนินการนี้จะลบคำแนะนำหน้าที่เยี่ยมชมจากแถบที่อยู่เบราว์เซอร์" } - } - } - }, - "settings.browser.hiddenWebViewDiscardDelay.subtitle": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "How long a browser tab must stay hidden before cmux frees its page memory. Active downloads, popups, developer tools, fullscreen, and loading pages are skipped." + "value": "Bu, tarayıcı çok amaçlı çubuğundan ziyaret edilen sayfa önerilerini kaldırır." } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "ブラウザタブが非表示になってから、cmux がページメモリを解放するまでの時間です。進行中のダウンロード、ポップアップ、開発者ツール、フルスクリーン、読み込み中のページは対象外です。" + "value": "Це видалить підказки відвіданих сторінок з адресного рядка браузера." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "这将从浏览器地址栏中移除已访问页面的建议。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "這會移除瀏覽器網址列中已造訪頁面的建議。" } } } }, - "settings.browser.history": { + "settings.browser.history.clearDialog.title": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "سجل التصفح" + "value": "مسح سجل المتصفح؟" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Historija pregledanja" + "value": "Obrisati historiju preglednika?" } }, "da": { "stringUnit": { "state": "translated", - "value": "Browserhistorik" + "value": "Ryd browserhistorik?" } }, "de": { "stringUnit": { "state": "translated", - "value": "Browserverlauf" + "value": "Browserverlauf löschen?" } }, "en": { "stringUnit": { "state": "translated", - "value": "Browsing History" + "value": "Clear browser history?" } }, "es": { "stringUnit": { "state": "translated", - "value": "Historial de navegación" + "value": "¿Borrar historial del navegador?" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Historique de navigation" + "value": "Effacer l'historique du navigateur ?" } }, "it": { "stringUnit": { "state": "translated", - "value": "Cronologia di navigazione" + "value": "Cancellare la cronologia del browser?" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ブラウザ履歴" + "value": "ブラウザ履歴をクリアしますか?" } }, "ko": { "stringUnit": { "state": "translated", - "value": "탐색 기록" + "value": "브라우저 기록을 지우시겠습니까?" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Nettleserhistorikk" + "value": "Tømme nettleserhistorikk?" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Historia przeglądania" + "value": "Wyczyścić historię przeglądarki?" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Histórico de Navegação" + "value": "Limpar histórico do navegador?" } }, "ru": { "stringUnit": { "state": "translated", - "value": "История просмотра" + "value": "Очистить историю браузера?" } }, "th": { "stringUnit": { "state": "translated", - "value": "ประวัติการท่องเว็บ" + "value": "ล้างประวัติเบราว์เซอร์หรือไม่?" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Tarama Geçmişi" + "value": "Tarayıcı geçmişi temizlensin mi?" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Історія перегляду" + "value": "Очистити історію браузера?" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "浏览历史" + "value": "清除浏览器历史记录?" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "瀏覽記錄" + "value": "要清除瀏覽記錄嗎?" } } } }, - "settings.browser.history.clearButton": { + "settings.browser.history.subtitleEmpty": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "مسح السجل…" + "value": "لا توجد صفحات محفوظة بعد." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Obriši historiju…" + "value": "Još nema sačuvanih stranica." } }, "da": { "stringUnit": { "state": "translated", - "value": "Ryd historik…" + "value": "Ingen gemte sider endnu." } }, "de": { "stringUnit": { "state": "translated", - "value": "Verlauf löschen …" + "value": "Noch keine gespeicherten Seiten." } }, "en": { "stringUnit": { "state": "translated", - "value": "Clear History…" + "value": "No saved pages yet." } }, "es": { "stringUnit": { "state": "translated", - "value": "Borrar historial…" + "value": "Aún no hay páginas guardadas." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Effacer l'historique..." + "value": "Aucune page enregistrée pour le moment." } }, "it": { "stringUnit": { "state": "translated", - "value": "Cancella cronologia…" + "value": "Nessuna pagina salvata." } }, "ja": { "stringUnit": { "state": "translated", - "value": "履歴をクリア…" + "value": "保存済みのページはまだありません。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "기록 지우기…" + "value": "아직 저장된 페이지가 없습니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Tøm historikk …" + "value": "Ingen lagrede sider ennå." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Wyczyść historię…" + "value": "Brak zapisanych stron." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Limpar Histórico…" + "value": "Nenhuma página salva ainda." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Очистить историю..." + "value": "Сохраненных страниц пока нет." } }, "th": { "stringUnit": { "state": "translated", - "value": "ล้างประวัติ..." + "value": "ยังไม่มีหน้าที่บันทึก" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Geçmişi Temizle…" + "value": "Henüz kayıtlı sayfa yok." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Очистити історію…" + "value": "Збережених сторінок ще немає." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "清除历史记录..." + "value": "尚无已保存的页面。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "清除記錄..." + "value": "尚無已儲存的頁面。" } } } }, - "settings.browser.history.clearDialog.cancel": { + "settings.browser.history.subtitleLoading": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "إلغاء" + "value": "جارٍ التحقق من سجل التصفح..." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Otkaži" + "value": "Provjerava se historija pregledanja..." } }, "da": { "stringUnit": { "state": "translated", - "value": "Annuller" + "value": "Kontrollerer browserhistorik..." } }, "de": { "stringUnit": { "state": "translated", - "value": "Abbrechen" + "value": "Browserverlauf wird geprüft..." } }, "en": { "stringUnit": { "state": "translated", - "value": "Cancel" + "value": "Checking browsing history..." } }, "es": { "stringUnit": { "state": "translated", - "value": "Cancelar" + "value": "Comprobando el historial de navegación..." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Annuler" + "value": "Vérification de l'historique de navigation..." } }, "it": { "stringUnit": { "state": "translated", - "value": "Annulla" + "value": "Controllo della cronologia di navigazione..." } }, "ja": { "stringUnit": { "state": "translated", - "value": "キャンセル" + "value": "閲覧履歴を確認中..." + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "កំពុងពិនិត្យប្រវត្តិរុករក..." } }, "ko": { "stringUnit": { "state": "translated", - "value": "취소" + "value": "방문 기록을 확인하는 중..." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Avbryt" + "value": "Sjekker nettleserhistorikk..." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Anuluj" + "value": "Sprawdzanie historii przeglądania..." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Cancelar" + "value": "Verificando histórico de navegação..." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Отменить" + "value": "Проверка истории браузера..." } }, "th": { "stringUnit": { "state": "translated", - "value": "ยกเลิก" + "value": "กำลังตรวจสอบประวัติการท่องเว็บ..." } }, "tr": { "stringUnit": { "state": "translated", - "value": "Vazgeç" + "value": "Tarama geçmişi kontrol ediliyor..." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Скасувати" + "value": "Перевірка історії браузера..." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "取消" + "value": "正在检查浏览历史记录..." } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "取消" + "value": "正在檢查瀏覽歷史記錄..." } } } }, - "settings.browser.history.clearDialog.confirm": { + "settings.browser.history.subtitleMany": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "مسح السجل" + "value": "%lld صفحة محفوظة تظهر في اقتراحات شريط العنوان." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Obriši historiju" + "value": "%lld sačuvanih stranica se pojavljuje u prijedlozima omnibara." } }, "da": { "stringUnit": { "state": "translated", - "value": "Ryd historik" + "value": "%lld gemte sider vises i omnibar-forslag." } }, "de": { "stringUnit": { "state": "translated", - "value": "Verlauf löschen" + "value": "%lld gespeicherte Seiten erscheinen in den Adressleisten-Vorschlägen." } }, "en": { "stringUnit": { "state": "translated", - "value": "Clear History" + "value": "%lld saved pages appear in omnibar suggestions." } }, "es": { "stringUnit": { "state": "translated", - "value": "Borrar historial" + "value": "%lld páginas guardadas aparecen en las sugerencias de la barra de direcciones." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Effacer l'historique" + "value": "%lld pages enregistrées apparaissent dans les suggestions de la barre d'adresse." } }, "it": { "stringUnit": { "state": "translated", - "value": "Cancella cronologia" + "value": "%lld pagine salvate appaiono nei suggerimenti della barra degli indirizzi." } }, "ja": { "stringUnit": { "state": "translated", - "value": "履歴をクリア" + "value": "%lld件の保存済みページがオムニバーの候補に表示されます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "기록 지우기" + "value": "%lld개의 저장된 페이지가 옴니바 제안에 표시됩니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Tøm historikk" + "value": "%lld lagrede sider vises i adressefeltforslag." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Wyczyść historię" + "value": "%lld zapisanych stron pojawia się w podpowiedziach paska adresu." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Limpar Histórico" + "value": "%lld páginas salvas aparecem nas sugestões da barra de endereço." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Очистить историю" + "value": "Сохраненных страниц: %lld. Отображаются в подсказках адресной строки." } }, "th": { "stringUnit": { "state": "translated", - "value": "ล้างประวัติ" + "value": "%lld หน้าที่บันทึกจะปรากฏในคำแนะนำแถบที่อยู่" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Geçmişi Temizle" + "value": "%lld kayıtlı sayfa çok amaçlı çubuk önerilerinde görünür." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Очистити історію" + "value": "%lld збережених сторінок з'являються у підказках адресного рядка." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "清除历史记录" + "value": "%lld 个已保存页面显示在地址栏建议中。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "清除記錄" + "value": "%lld 個已儲存頁面會出現在網址列建議中。" } } } }, - "settings.browser.history.clearDialog.message": { + "settings.browser.history.subtitleOne": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "يؤدي هذا إلى إزالة اقتراحات الصفحات المزارة من شريط عنوان المتصفح." + "value": "صفحة محفوظة واحدة تظهر في اقتراحات شريط العنوان." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Ovo uklanja prijedloge posjećenih stranica iz omnibar preglednika." + "value": "1 sačuvana stranica se pojavljuje u prijedlozima omnibara." } }, "da": { "stringUnit": { "state": "translated", - "value": "Dette fjerner besøgte sideforslag fra browserens omnibar." + "value": "1 gemt side vises i omnibar-forslag." } }, "de": { "stringUnit": { "state": "translated", - "value": "Dies entfernt Vorschläge für besuchte Seiten aus der Browser-Adressleiste." + "value": "1 gespeicherte Seite erscheint in den Adressleisten-Vorschlägen." } }, "en": { "stringUnit": { "state": "translated", - "value": "This removes visited-page suggestions from the browser omnibar." + "value": "1 saved page appears in omnibar suggestions." } }, "es": { "stringUnit": { "state": "translated", - "value": "Esto elimina las sugerencias de páginas visitadas de la barra de direcciones del navegador." + "value": "1 página guardada aparece en las sugerencias de la barra de direcciones." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Cela supprime les suggestions de pages visitées de la barre d'adresse du navigateur." + "value": "1 page enregistrée apparaît dans les suggestions de la barre d'adresse." } }, "it": { "stringUnit": { "state": "translated", - "value": "Questa operazione rimuove i suggerimenti delle pagine visitate dalla barra degli indirizzi del browser." + "value": "1 pagina salvata appare nei suggerimenti della barra degli indirizzi." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ブラウザのオムニバーから訪問済みページの候補が削除されます。" + "value": "1件の保存済みページがオムニバーの候補に表示されます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "브라우저 옴니바에서 방문 페이지 제안을 제거합니다." + "value": "1개의 저장된 페이지가 옴니바 제안에 표시됩니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Dette fjerner forslag basert på besøkte sider fra nettleserens adressefelt." + "value": "1 lagret side vises i adressefeltforslag." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Spowoduje to usunięcie podpowiedzi odwiedzonych stron z paska adresu przeglądarki." + "value": "1 zapisana strona pojawia się w podpowiedziach paska adresu." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Isto remove as sugestões de páginas visitadas da barra de endereço do navegador." + "value": "1 página salva aparece nas sugestões da barra de endereço." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Это удалит подсказки посещенных страниц из адресной строки браузера." + "value": "1 сохраненная страница отображается в подсказках адресной строки." } }, "th": { "stringUnit": { "state": "translated", - "value": "การดำเนินการนี้จะลบคำแนะนำหน้าที่เยี่ยมชมจากแถบที่อยู่เบราว์เซอร์" + "value": "1 หน้าที่บันทึกจะปรากฏในคำแนะนำแถบที่อยู่" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Bu, tarayıcı çok amaçlı çubuğundan ziyaret edilen sayfa önerilerini kaldırır." + "value": "1 kayıtlı sayfa çok amaçlı çubuk önerilerinde görünür." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Це видалить підказки відвіданих сторінок з адресного рядка браузера." + "value": "1 збережена сторінка з'являється у підказках адресного рядка." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "这将从浏览器地址栏中移除已访问页面的建议。" + "value": "1 个已保存页面显示在地址栏建议中。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "這會移除瀏覽器網址列中已造訪頁面的建議。" + "value": "1 個已儲存頁面會出現在網址列建議中。" } } } }, - "settings.browser.history.clearDialog.title": { + "settings.browser.hostWhitelist": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "مسح سجل المتصفح؟" + "value": "المضيفون للفتح في المتصفح المضمّن" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Obrisati historiju preglednika?" + "value": "Hostovi za otvaranje u ugrađenom pregledniku" } }, "da": { "stringUnit": { "state": "translated", - "value": "Ryd browserhistorik?" + "value": "Værter der åbnes i den indlejrede browser" } }, "de": { "stringUnit": { "state": "translated", - "value": "Browserverlauf löschen?" + "value": "Hosts, die im integrierten Browser geöffnet werden" } }, "en": { "stringUnit": { "state": "translated", - "value": "Clear browser history?" + "value": "Hosts to Open in Embedded Browser" } }, "es": { "stringUnit": { "state": "translated", - "value": "¿Borrar historial del navegador?" + "value": "Hosts para abrir en el navegador integrado" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Effacer l'historique du navigateur ?" + "value": "Hôtes à ouvrir dans le navigateur intégré" } }, "it": { "stringUnit": { "state": "translated", - "value": "Cancellare la cronologia del browser?" + "value": "Host da aprire nel browser integrato" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ブラウザ履歴をクリアしますか?" + "value": "内蔵ブラウザで開くホスト" } }, "ko": { "stringUnit": { "state": "translated", - "value": "브라우저 기록을 지우시겠습니까?" + "value": "내장 브라우저에서 열 호스트" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Tømme nettleserhistorikk?" + "value": "Verter som åpnes i innebygd nettleser" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Wyczyścić historię przeglądarki?" + "value": "Hosty do otwierania we wbudowanej przeglądarce" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Limpar histórico do navegador?" + "value": "Hosts para Abrir no Navegador Integrado" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Очистить историю браузера?" + "value": "Хосты для открытия во встроенном браузере" } }, "th": { "stringUnit": { "state": "translated", - "value": "ล้างประวัติเบราว์เซอร์หรือไม่?" + "value": "โฮสต์ที่เปิดในเบราว์เซอร์ในตัว" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Tarayıcı geçmişi temizlensin mi?" + "value": "Gömülü Tarayıcıda Açılacak Ana Bilgisayarlar" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Очистити історію браузера?" + "value": "Хости для відкриття у вбудованому браузері" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "清除浏览器历史记录?" + "value": "在内嵌浏览器中打开的主机" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "要清除瀏覽記錄嗎?" + "value": "在內建瀏覽器中開啟的主機" } } } }, - "settings.browser.history.subtitleEmpty": { + "settings.browser.hostWhitelist.subtitle": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "لا توجد صفحات محفوظة بعد." + "value": "ينطبق على نقرات الروابط في الطرفية واستدعاءات `open https://...` المعترضة. فقط هؤلاء المضيفون يفتحون في cmux. البقية تفتح في متصفحك الافتراضي. مضيف واحد أو حرف بدل لكل سطر (مثال: example.com, *.internal.example). اتركه فارغًا لفتح جميع المضيفين في cmux." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Još nema sačuvanih stranica." + "value": "Primjenjuje se na klikove linkova u terminalu i presretnute `open https://...` pozive. Samo se ovi hostovi otvaraju u cmux. Ostali se otvaraju u podrazumijevanom pregledniku. Jedan host ili zamjenski znak po redu (na primjer: example.com, *.internal.example). Ostavite prazno da otvorite sve hostove u cmux." } }, "da": { "stringUnit": { "state": "translated", - "value": "Ingen gemte sider endnu." + "value": "Gælder for terminallinksklik og opfangede `open https://...`-kald. Kun disse værter åbnes i cmux. Andre åbnes i din standardbrowser. Én vært eller wildcard pr. linje (f.eks.: example.com, *.internal.example). Lad stå tomt for at åbne alle værter i cmux." } }, "de": { "stringUnit": { "state": "translated", - "value": "Noch keine gespeicherten Seiten." + "value": "Gilt für Klicks auf Terminal-Links und abgefangene `open https://...`-Aufrufe. Nur diese Hosts werden in cmux geöffnet. Andere werden in Ihrem Standardbrowser geöffnet. Ein Host oder Platzhalter pro Zeile (zum Beispiel: example.com, *.internal.example). Leer lassen, um alle Hosts in cmux zu öffnen." } }, "en": { "stringUnit": { "state": "translated", - "value": "No saved pages yet." + "value": "Applies to terminal link clicks and intercepted `open https://...` calls. Only these hosts open in cmux. Others open in your default browser. One host or wildcard per line (for example: example.com, *.internal.example). Leave empty to open all hosts in cmux." } }, "es": { "stringUnit": { "state": "translated", - "value": "Aún no hay páginas guardadas." + "value": "Se aplica a clics en enlaces del terminal y llamadas interceptadas de `open https://...`. Solo estos hosts se abren en cmux. Los demás se abren en tu navegador predeterminado. Un host o comodín por línea (por ejemplo: example.com, *.internal.example). Déjalo vacío para abrir todos los hosts en cmux." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Aucune page enregistrée pour le moment." + "value": "S'applique aux clics sur les liens du terminal et aux appels `open https://...` interceptés. Seuls ces hôtes s'ouvrent dans cmux. Les autres s'ouvrent dans votre navigateur par défaut. Un hôte ou caractère générique par ligne (par exemple : example.com, *.internal.example). Laissez vide pour ouvrir tous les hôtes dans cmux." } }, "it": { "stringUnit": { "state": "translated", - "value": "Nessuna pagina salvata." + "value": "Si applica ai clic sui link nel terminale e alle chiamate intercettate `open https://...`. Solo questi host si aprono in cmux. Gli altri si aprono nel browser predefinito. Un host o wildcard per riga (ad esempio: example.com, *.internal.example). Lascia vuoto per aprire tutti gli host in cmux." } }, "ja": { "stringUnit": { "state": "translated", - "value": "保存済みのページはまだありません。" + "value": "ターミナルのリンククリックおよびインターセプトされた`open https://...`呼び出しに適用されます。これらのホストのみcmuxで開きます。その他はデフォルトブラウザで開きます。1行に1つのホストまたはワイルドカード(例: example.com, *.internal.example)。空欄にするとすべてのホストをcmuxで開きます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "아직 저장된 페이지가 없습니다." + "value": "터미널 링크 클릭 및 인터셉트된 `open https://...` 호출에 적용됩니다. 이 호스트만 cmux에서 열립니다. 나머지는 기본 브라우저에서 열립니다. 한 줄에 하나의 호스트 또는 와일드카드 (예: example.com, *.internal.example). 비워두면 모든 호스트가 cmux에서 열립니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Ingen lagrede sider ennå." + "value": "Gjelder for terminallenkeklikk og avlyttede `open https://...`-kall. Bare disse vertene åpnes i cmux. Andre åpnes i standard nettleser. Én vert eller jokertegn per linje (for eksempel: example.com, *.internal.example). La stå tom for å åpne alle verter i cmux." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Brak zapisanych stron." + "value": "Dotyczy kliknięć linków w terminalu i przechwyconych wywołań `open https://...`. Tylko te hosty otwierają się w cmux. Pozostałe otwierają się w domyślnej przeglądarce. Jeden host lub wzorzec na wiersz (na przykład: example.com, *.internal.example). Pozostaw puste, aby otwierać wszystkie hosty w cmux." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Nenhuma página salva ainda." + "value": "Aplica-se a cliques em links do terminal e chamadas interceptadas de `open https://...`. Apenas estes hosts abrem no cmux. Outros abrem no seu navegador padrão. Um host ou curinga por linha (por exemplo: example.com, *.internal.example). Deixe vazio para abrir todos os hosts no cmux." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Сохраненных страниц пока нет." + "value": "Применяется к нажатиям на ссылки в терминале и перехваченным вызовам `open https://...`. Только эти хосты открываются в cmux. Остальные открываются в браузере по умолчанию. Один хост или шаблон на строку (например: example.com, *.internal.example). Оставьте пустым, чтобы открывать все хосты в cmux." } }, "th": { "stringUnit": { "state": "translated", - "value": "ยังไม่มีหน้าที่บันทึก" + "value": "ใช้กับการคลิกลิงก์ในเทอร์มินัลและการดักจับคำสั่ง `open https://...` เฉพาะโฮสต์เหล่านี้เท่านั้นที่จะเปิดใน cmux โฮสต์อื่นจะเปิดในเบราว์เซอร์เริ่มต้นของคุณ โฮสต์หรือ wildcard หนึ่งรายการต่อบรรทัด (ตัวอย่าง: example.com, *.internal.example) เว้นว่างเพื่อเปิดโฮสต์ทั้งหมดใน cmux" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Henüz kayıtlı sayfa yok." + "value": "Terminal bağlantı tıklamalarına ve yakalanan `open https://...` çağrılarına uygulanır. Yalnızca bu ana bilgisayarlar cmux'ta açılır. Diğerleri varsayılan tarayıcınızda açılır. Satır başına bir ana bilgisayar veya joker karakter (örneğin: example.com, *.internal.example). Tüm ana bilgisayarları cmux'ta açmak için boş bırakın." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Збережених сторінок ще немає." + "value": "Застосовується до кліків на посилання в терміналі та перехоплених викликів `open https://...`. Тільки ці хости відкриваються в cmux. Інші відкриваються у стандартному браузері. Один хост або шаблон на рядок (наприклад: example.com, *.internal.example). Залиште порожнім, щоб відкривати всі хости в cmux." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "尚无已保存的页面。" + "value": "适用于终端中的链接点击和拦截的 `open https://...` 调用。仅这些主机在 cmux 中打开,其他主机在默认浏览器中打开。每行一个主机或通配符(例如:example.com、*.internal.example)。留空则在 cmux 中打开所有主机。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "尚無已儲存的頁面。" + "value": "套用於終端機連結點擊和攔截的 `open https://...` 呼叫。僅這些主機會在 cmux 中開啟,其他主機會在您的預設瀏覽器中開啟。每行一個主機或萬用字元(例如:example.com、*.internal.example)。留空則在 cmux 中開啟所有主機。" } } } }, - "settings.browser.history.subtitleLoading": { + "settings.browser.httpAllowlist": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "جارٍ التحقق من سجل التصفح..." + "value": "مضيفو HTTP المسموح بهم في المتصفح المضمّن" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Provjerava se historija pregledanja..." + "value": "HTTP hostovi dozvoljeni u ugrađenom pregledniku" } }, "da": { "stringUnit": { "state": "translated", - "value": "Kontrollerer browserhistorik..." + "value": "HTTP-værter tilladt i den indlejrede browser" } }, "de": { "stringUnit": { "state": "translated", - "value": "Browserverlauf wird geprüft..." + "value": "HTTP-Hosts, die im integrierten Browser zugelassen sind" } }, "en": { "stringUnit": { "state": "translated", - "value": "Checking browsing history..." + "value": "HTTP Hosts Allowed in Embedded Browser" } }, "es": { "stringUnit": { "state": "translated", - "value": "Comprobando el historial de navegación..." + "value": "Hosts HTTP permitidos en el navegador integrado" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Vérification de l'historique de navigation..." + "value": "Hôtes HTTP autorisés dans le navigateur intégré" } }, "it": { "stringUnit": { "state": "translated", - "value": "Controllo della cronologia di navigazione..." + "value": "Host HTTP consentiti nel browser integrato" } }, "ja": { "stringUnit": { "state": "translated", - "value": "閲覧履歴を確認中..." - } - }, - "km": { - "stringUnit": { - "state": "translated", - "value": "កំពុងពិនិត្យប្រវត្តិរុករក..." + "value": "内蔵ブラウザで許可するHTTPホスト" } }, "ko": { "stringUnit": { "state": "translated", - "value": "방문 기록을 확인하는 중..." + "value": "내장 브라우저에서 허용할 HTTP 호스트" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Sjekker nettleserhistorikk..." + "value": "HTTP-verter tillatt i innebygd nettleser" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Sprawdzanie historii przeglądania..." + "value": "Hosty HTTP dozwolone we wbudowanej przeglądarce" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Verificando histórico de navegação..." + "value": "Hosts HTTP Permitidos no Navegador Integrado" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Проверка истории браузера..." + "value": "HTTP-хосты, разрешенные во встроенном браузере" } }, "th": { "stringUnit": { "state": "translated", - "value": "กำลังตรวจสอบประวัติการท่องเว็บ..." + "value": "โฮสต์ HTTP ที่อนุญาตในเบราว์เซอร์ในตัว" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Tarama geçmişi kontrol ediliyor..." + "value": "Gömülü Tarayıcıda İzin Verilen HTTP Ana Bilgisayarları" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Перевірка історії браузера..." + "value": "HTTP-хости, дозволені у вбудованому браузері" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "正在检查浏览历史记录..." + "value": "内嵌浏览器中允许的 HTTP 主机" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "正在檢查瀏覽歷史記錄..." + "value": "允許在內建瀏覽器中使用的 HTTP 主機" } } } }, - "settings.browser.history.subtitleMany": { + "settings.browser.httpAllowlist.description": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "%lld صفحة محفوظة تظهر في اقتراحات شريط العنوان." + "value": "يتحكم في مضيفي HTTP (غير HTTPS) الذين يمكنهم الفتح في cmux بدون رسالة تحذير. الافتراضيات تشمل localhost و *.localhost و 127.0.0.1 و ::1 و 0.0.0.0 و *.localtest.me." } }, "bs": { "stringUnit": { "state": "translated", - "value": "%lld sačuvanih stranica se pojavljuje u prijedlozima omnibara." + "value": "Kontroliše koji HTTP (ne-HTTPS) hostovi mogu biti otvoreni u cmux bez upozorenja. Podrazumijevani uključuju localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 i *.localtest.me." } }, "da": { "stringUnit": { "state": "translated", - "value": "%lld gemte sider vises i omnibar-forslag." + "value": "Styrer hvilke HTTP-værter (ikke-HTTPS) der kan åbnes i cmux uden advarselsmeddelelse. Standardindstillinger inkluderer localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 og *.localtest.me." } }, "de": { "stringUnit": { "state": "translated", - "value": "%lld gespeicherte Seiten erscheinen in den Adressleisten-Vorschlägen." + "value": "Steuert, welche HTTP-Hosts (nicht HTTPS) ohne Warnhinweis in cmux geöffnet werden können. Standardmäßig enthalten: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 und *.localtest.me." } }, "en": { "stringUnit": { "state": "translated", - "value": "%lld saved pages appear in omnibar suggestions." + "value": "Controls which HTTP (non-HTTPS) hosts can open in cmux without a warning prompt. Defaults include localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, and *.localtest.me." } }, "es": { "stringUnit": { "state": "translated", - "value": "%lld páginas guardadas aparecen en las sugerencias de la barra de direcciones." + "value": "Controla qué hosts HTTP (no HTTPS) pueden abrirse en cmux sin un mensaje de advertencia. Los valores predeterminados incluyen localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 y *.localtest.me." } }, "fr": { "stringUnit": { "state": "translated", - "value": "%lld pages enregistrées apparaissent dans les suggestions de la barre d'adresse." + "value": "Contrôle quels hôtes HTTP (non HTTPS) peuvent s'ouvrir dans cmux sans avertissement. Les valeurs par défaut incluent localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 et *.localtest.me." } }, "it": { "stringUnit": { "state": "translated", - "value": "%lld pagine salvate appaiono nei suggerimenti della barra degli indirizzi." + "value": "Controlla quali host HTTP (non HTTPS) possono aprirsi in cmux senza un avviso. I valori predefiniti includono localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 e *.localtest.me." } }, "ja": { "stringUnit": { "state": "translated", - "value": "%lld件の保存済みページがオムニバーの候補に表示されます。" + "value": "警告プロンプトなしでcmuxで開けるHTTP(非HTTPS)ホストを制御します。デフォルトにはlocalhost、*.localhost、127.0.0.1、::1、0.0.0.0、*.localtest.meが含まれます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "%lld개의 저장된 페이지가 옴니바 제안에 표시됩니다." + "value": "cmux에서 경고 없이 열 수 있는 HTTP(비HTTPS) 호스트를 제어합니다. 기본값에는 localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 및 *.localtest.me가 포함됩니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "%lld lagrede sider vises i adressefeltforslag." + "value": "Styrer hvilke HTTP-verter (ikke HTTPS) som kan åpnes i cmux uten advarselsmelding. Standardverdier inkluderer localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 og *.localtest.me." } }, "pl": { "stringUnit": { "state": "translated", - "value": "%lld zapisanych stron pojawia się w podpowiedziach paska adresu." + "value": "Określa, które hosty HTTP (inne niż HTTPS) mogą być otwierane w cmux bez ostrzeżenia. Domyślnie uwzględniono localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 i *.localtest.me." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "%lld páginas salvas aparecem nas sugestões da barra de endereço." + "value": "Controla quais hosts HTTP (não HTTPS) podem abrir no cmux sem um aviso. Os padrões incluem localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 e *.localtest.me." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Сохраненных страниц: %lld. Отображаются в подсказках адресной строки." + "value": "Определяет, какие HTTP (не HTTPS) хосты могут открываться в cmux без предупреждения. По умолчанию включены localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 и *.localtest.me." } }, "th": { "stringUnit": { "state": "translated", - "value": "%lld หน้าที่บันทึกจะปรากฏในคำแนะนำแถบที่อยู่" + "value": "ควบคุมว่าโฮสต์ HTTP (ไม่ใช่ HTTPS) ใดที่สามารถเปิดใน cmux โดยไม่ต้องแสดงคำเตือน ค่าเริ่มต้นรวมถึง localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 และ *.localtest.me" } }, "tr": { "stringUnit": { "state": "translated", - "value": "%lld kayıtlı sayfa çok amaçlı çubuk önerilerinde görünür." + "value": "Hangi HTTP (HTTPS olmayan) ana bilgisayarlarının cmux'ta uyarı istemi olmadan açılabileceğini kontrol eder. Varsayılanlar localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 ve *.localtest.me içerir." } }, "uk": { "stringUnit": { "state": "translated", - "value": "%lld збережених сторінок з'являються у підказках адресного рядка." + "value": "Визначає, які HTTP (не HTTPS) хости можуть відкриватися в cmux без попередження. Типово включає localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 та *.localtest.me." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "%lld 个已保存页面显示在地址栏建议中。" + "value": "控制哪些 HTTP(非 HTTPS)主机可以在 cmux 中打开而不显示警告提示。默认包括 localhost、*.localhost、127.0.0.1、::1、0.0.0.0 和 *.localtest.me。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "%lld 個已儲存頁面會出現在網址列建議中。" + "value": "控制哪些 HTTP(非 HTTPS)主機可以在 cmux 中開啟而不顯示警告提示。預設包含 localhost、*.localhost、127.0.0.1、::1、0.0.0.0 和 *.localtest.me。" } } } }, - "settings.browser.history.subtitleOne": { + "settings.browser.httpAllowlist.hint": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "صفحة محفوظة واحدة تظهر في اقتراحات شريط العنوان." + "value": "مضيف واحد أو حرف بدل لكل سطر (مثال: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "bs": { "stringUnit": { "state": "translated", - "value": "1 sačuvana stranica se pojavljuje u prijedlozima omnibara." + "value": "Jedan host ili zamjenski znak po redu (na primjer: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "da": { "stringUnit": { "state": "translated", - "value": "1 gemt side vises i omnibar-forslag." + "value": "Én vært eller wildcard pr. linje (f.eks.: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "de": { "stringUnit": { "state": "translated", - "value": "1 gespeicherte Seite erscheint in den Adressleisten-Vorschlägen." + "value": "Ein Host oder Platzhalter pro Zeile (zum Beispiel: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "en": { "stringUnit": { "state": "translated", - "value": "1 saved page appears in omnibar suggestions." + "value": "One host or wildcard per line (for example: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "es": { "stringUnit": { "state": "translated", - "value": "1 página guardada aparece en las sugerencias de la barra de direcciones." + "value": "Un host o comodín por línea (por ejemplo: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "fr": { "stringUnit": { "state": "translated", - "value": "1 page enregistrée apparaît dans les suggestions de la barre d'adresse." + "value": "Un hôte ou caractère générique par ligne (par exemple : localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "it": { "stringUnit": { "state": "translated", - "value": "1 pagina salvata appare nei suggerimenti della barra degli indirizzi." + "value": "Un host o wildcard per riga (ad esempio: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "ja": { "stringUnit": { "state": "translated", - "value": "1件の保存済みページがオムニバーの候補に表示されます。" + "value": "1行に1つのホストまたはワイルドカード(例: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "1개의 저장된 페이지가 옴니바 제안에 표시됩니다." + "value": "한 줄에 하나의 호스트 또는 와일드카드 (예: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "nb": { "stringUnit": { "state": "translated", - "value": "1 lagret side vises i adressefeltforslag." + "value": "Én vert eller jokertegn per linje (for eksempel: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "pl": { "stringUnit": { "state": "translated", - "value": "1 zapisana strona pojawia się w podpowiedziach paska adresu." + "value": "Jeden host lub wzorzec na wiersz (na przykład: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "1 página salva aparece nas sugestões da barra de endereço." + "value": "Um host ou curinga por linha (por exemplo: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "ru": { "stringUnit": { "state": "translated", - "value": "1 сохраненная страница отображается в подсказках адресной строки." + "value": "Один хост или шаблон на строку (например: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "th": { "stringUnit": { "state": "translated", - "value": "1 หน้าที่บันทึกจะปรากฏในคำแนะนำแถบที่อยู่" + "value": "โฮสต์หรือ wildcard หนึ่งรายการต่อบรรทัด (ตัวอย่าง: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)" } }, "tr": { "stringUnit": { "state": "translated", - "value": "1 kayıtlı sayfa çok amaçlı çubuk önerilerinde görünür." + "value": "Satır başına bir ana bilgisayar veya joker karakter (örneğin: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "uk": { "stringUnit": { "state": "translated", - "value": "1 збережена сторінка з'являється у підказках адресного рядка." + "value": "Один хост або шаблон на рядок (наприклад: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "1 个已保存页面显示在地址栏建议中。" + "value": "每行一个主机或通配符(例如:localhost、*.localhost、127.0.0.1、::1、0.0.0.0、*.localtest.me)。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "1 個已儲存頁面會出現在網址列建議中。" + "value": "每行一個主機或萬用字元(例如:localhost、*.localhost、127.0.0.1、::1、0.0.0.0、*.localtest.me)。" } } } }, - "settings.browser.hostWhitelist": { + "settings.browser.httpAllowlist.save": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "المضيفون للفتح في المتصفح المضمّن" + "value": "حفظ" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Hostovi za otvaranje u ugrađenom pregledniku" + "value": "Spremi" } }, "da": { "stringUnit": { "state": "translated", - "value": "Værter der åbnes i den indlejrede browser" + "value": "Gem" } }, "de": { "stringUnit": { "state": "translated", - "value": "Hosts, die im integrierten Browser geöffnet werden" + "value": "Speichern" } }, "en": { "stringUnit": { "state": "translated", - "value": "Hosts to Open in Embedded Browser" + "value": "Save" } }, "es": { "stringUnit": { "state": "translated", - "value": "Hosts para abrir en el navegador integrado" + "value": "Guardar" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Hôtes à ouvrir dans le navigateur intégré" + "value": "Enregistrer" } }, "it": { "stringUnit": { "state": "translated", - "value": "Host da aprire nel browser integrato" + "value": "Salva" } }, "ja": { "stringUnit": { "state": "translated", - "value": "内蔵ブラウザで開くホスト" + "value": "保存" } }, "ko": { "stringUnit": { "state": "translated", - "value": "내장 브라우저에서 열 호스트" + "value": "저장" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Verter som åpnes i innebygd nettleser" + "value": "Lagre" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Hosty do otwierania we wbudowanej przeglądarce" + "value": "Zapisz" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Hosts para Abrir no Navegador Integrado" + "value": "Salvar" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Хосты для открытия во встроенном браузере" + "value": "Сохранить" } }, "th": { "stringUnit": { "state": "translated", - "value": "โฮสต์ที่เปิดในเบราว์เซอร์ในตัว" + "value": "บันทึก" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Gömülü Tarayıcıda Açılacak Ana Bilgisayarlar" + "value": "Kaydet" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Хости для відкриття у вбудованому браузері" + "value": "Зберегти" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "在内嵌浏览器中打开的主机" + "value": "保存" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "在內建瀏覽器中開啟的主機" + "value": "儲存" } } } }, - "settings.browser.hostWhitelist.subtitle": { + "settings.browser.import": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Import Browser Data" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ブラウザーデータを取り込む" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "브라우저 데이터 가져오기" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Імпорт даних браузера" + } + } + } + }, + "settings.browser.import.choose": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Choose…" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "選択…" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "선택…" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Вибрати…" + } + } + } + }, + "settings.browser.import.detecting": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "ينطبق على نقرات الروابط في الطرفية واستدعاءات `open https://...` المعترضة. فقط هؤلاء المضيفون يفتحون في cmux. البقية تفتح في متصفحك الافتراضي. مضيف واحد أو حرف بدل لكل سطر (مثال: example.com, *.internal.example). اتركه فارغًا لفتح جميع المضيفين في cmux." + "value": "جارٍ التحقق من المتصفحات المثبتة..." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Primjenjuje se na klikove linkova u terminalu i presretnute `open https://...` pozive. Samo se ovi hostovi otvaraju u cmux. Ostali se otvaraju u podrazumijevanom pregledniku. Jedan host ili zamjenski znak po redu (na primjer: example.com, *.internal.example). Ostavite prazno da otvorite sve hostove u cmux." + "value": "Provjeravam instalirane preglednike..." } }, "da": { "stringUnit": { "state": "translated", - "value": "Gælder for terminallinksklik og opfangede `open https://...`-kald. Kun disse værter åbnes i cmux. Andre åbnes i din standardbrowser. Én vært eller wildcard pr. linje (f.eks.: example.com, *.internal.example). Lad stå tomt for at åbne alle værter i cmux." + "value": "Kontrollerer installerede browsere..." } }, "de": { "stringUnit": { "state": "translated", - "value": "Gilt für Klicks auf Terminal-Links und abgefangene `open https://...`-Aufrufe. Nur diese Hosts werden in cmux geöffnet. Andere werden in Ihrem Standardbrowser geöffnet. Ein Host oder Platzhalter pro Zeile (zum Beispiel: example.com, *.internal.example). Leer lassen, um alle Hosts in cmux zu öffnen." + "value": "Installierte Browser werden geprüft..." } }, "en": { "stringUnit": { "state": "translated", - "value": "Applies to terminal link clicks and intercepted `open https://...` calls. Only these hosts open in cmux. Others open in your default browser. One host or wildcard per line (for example: example.com, *.internal.example). Leave empty to open all hosts in cmux." + "value": "Checking installed browsers..." } }, "es": { "stringUnit": { "state": "translated", - "value": "Se aplica a clics en enlaces del terminal y llamadas interceptadas de `open https://...`. Solo estos hosts se abren en cmux. Los demás se abren en tu navegador predeterminado. Un host o comodín por línea (por ejemplo: example.com, *.internal.example). Déjalo vacío para abrir todos los hosts en cmux." + "value": "Comprobando los navegadores instalados..." } }, "fr": { "stringUnit": { "state": "translated", - "value": "S'applique aux clics sur les liens du terminal et aux appels `open https://...` interceptés. Seuls ces hôtes s'ouvrent dans cmux. Les autres s'ouvrent dans votre navigateur par défaut. Un hôte ou caractère générique par ligne (par exemple : example.com, *.internal.example). Laissez vide pour ouvrir tous les hôtes dans cmux." + "value": "Vérification des navigateurs installés..." } }, "it": { "stringUnit": { "state": "translated", - "value": "Si applica ai clic sui link nel terminale e alle chiamate intercettate `open https://...`. Solo questi host si aprono in cmux. Gli altri si aprono nel browser predefinito. Un host o wildcard per riga (ad esempio: example.com, *.internal.example). Lascia vuoto per aprire tutti gli host in cmux." + "value": "Controllo dei browser installati..." } }, "ja": { "stringUnit": { "state": "translated", - "value": "ターミナルのリンククリックおよびインターセプトされた`open https://...`呼び出しに適用されます。これらのホストのみcmuxで開きます。その他はデフォルトブラウザで開きます。1行に1つのホストまたはワイルドカード(例: example.com, *.internal.example)。空欄にするとすべてのホストをcmuxで開きます。" + "value": "インストール済みブラウザーを確認しています..." + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "កំពុងពិនិត្យកម្មវិធីរុករកដែលបានដំឡើង..." } }, "ko": { "stringUnit": { "state": "translated", - "value": "터미널 링크 클릭 및 인터셉트된 `open https://...` 호출에 적용됩니다. 이 호스트만 cmux에서 열립니다. 나머지는 기본 브라우저에서 열립니다. 한 줄에 하나의 호스트 또는 와일드카드 (예: example.com, *.internal.example). 비워두면 모든 호스트가 cmux에서 열립니다." + "value": "설치된 브라우저를 확인하는 중..." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Gjelder for terminallenkeklikk og avlyttede `open https://...`-kall. Bare disse vertene åpnes i cmux. Andre åpnes i standard nettleser. Én vert eller jokertegn per linje (for eksempel: example.com, *.internal.example). La stå tom for å åpne alle verter i cmux." + "value": "Sjekker installerte nettlesere..." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Dotyczy kliknięć linków w terminalu i przechwyconych wywołań `open https://...`. Tylko te hosty otwierają się w cmux. Pozostałe otwierają się w domyślnej przeglądarce. Jeden host lub wzorzec na wiersz (na przykład: example.com, *.internal.example). Pozostaw puste, aby otwierać wszystkie hosty w cmux." + "value": "Sprawdzanie zainstalowanych przeglądarek..." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Aplica-se a cliques em links do terminal e chamadas interceptadas de `open https://...`. Apenas estes hosts abrem no cmux. Outros abrem no seu navegador padrão. Um host ou curinga por linha (por exemplo: example.com, *.internal.example). Deixe vazio para abrir todos os hosts no cmux." + "value": "Verificando navegadores instalados..." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Применяется к нажатиям на ссылки в терминале и перехваченным вызовам `open https://...`. Только эти хосты открываются в cmux. Остальные открываются в браузере по умолчанию. Один хост или шаблон на строку (например: example.com, *.internal.example). Оставьте пустым, чтобы открывать все хосты в cmux." + "value": "Проверяем установленные браузеры..." } }, "th": { "stringUnit": { "state": "translated", - "value": "ใช้กับการคลิกลิงก์ในเทอร์มินัลและการดักจับคำสั่ง `open https://...` เฉพาะโฮสต์เหล่านี้เท่านั้นที่จะเปิดใน cmux โฮสต์อื่นจะเปิดในเบราว์เซอร์เริ่มต้นของคุณ โฮสต์หรือ wildcard หนึ่งรายการต่อบรรทัด (ตัวอย่าง: example.com, *.internal.example) เว้นว่างเพื่อเปิดโฮสต์ทั้งหมดใน cmux" + "value": "กำลังตรวจสอบเบราว์เซอร์ที่ติดตั้ง..." } }, "tr": { "stringUnit": { "state": "translated", - "value": "Terminal bağlantı tıklamalarına ve yakalanan `open https://...` çağrılarına uygulanır. Yalnızca bu ana bilgisayarlar cmux'ta açılır. Diğerleri varsayılan tarayıcınızda açılır. Satır başına bir ana bilgisayar veya joker karakter (örneğin: example.com, *.internal.example). Tüm ana bilgisayarları cmux'ta açmak için boş bırakın." + "value": "Yüklü tarayıcılar kontrol ediliyor..." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Застосовується до кліків на посилання в терміналі та перехоплених викликів `open https://...`. Тільки ці хости відкриваються в cmux. Інші відкриваються у стандартному браузері. Один хост або шаблон на рядок (наприклад: example.com, *.internal.example). Залиште порожнім, щоб відкривати всі хости в cmux." + "value": "Перевіряємо встановлені браузери..." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "适用于终端中的链接点击和拦截的 `open https://...` 调用。仅这些主机在 cmux 中打开,其他主机在默认浏览器中打开。每行一个主机或通配符(例如:example.com、*.internal.example)。留空则在 cmux 中打开所有主机。" + "value": "正在检查已安装的浏览器..." } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "套用於終端機連結點擊和攔截的 `open https://...` 呼叫。僅這些主機會在 cmux 中開啟,其他主機會在您的預設瀏覽器中開啟。每行一個主機或萬用字元(例如:example.com、*.internal.example)。留空則在 cmux 中開啟所有主機。" + "value": "正在檢查已安裝的瀏覽器..." } } } }, - "settings.browser.httpAllowlist": { + "settings.browser.import.hint.note.hidden": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "مضيفو HTTP المسموح بهم في المتصفح المضمّن" + "value": "The blank-tab import hint is hidden. Turn it back on here any time." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "HTTP hostovi dozvoljeni u ugrađenom pregledniku" + "value": "空タブのインポート案内は非表示です。ここでいつでも再表示できます。" } }, - "da": { + "ko": { "stringUnit": { "state": "translated", - "value": "HTTP-værter tilladt i den indlejrede browser" + "value": "빈 탭 가져오기 힌트가 숨겨져 있습니다. 여기서 언제든 다시 켤 수 있습니다." } }, - "de": { + "uk": { "stringUnit": { "state": "translated", - "value": "HTTP-Hosts, die im integrierten Browser zugelassen sind" + "value": "Підказка імпорту на порожній вкладці прихована. Увімкніть її тут у будь-який час." } - }, + } + } + }, + "settings.browser.import.hint.note.settingsOnly": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "HTTP Hosts Allowed in Embedded Browser" + "value": "Blank tabs are currently using Settings only mode from the debug window." } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "Hosts HTTP permitidos en el navegador integrado" + "value": "現在、空タブはデバッグウィンドウの「設定のみ」モードになっています。" } }, - "fr": { + "ko": { "stringUnit": { "state": "translated", - "value": "Hôtes HTTP autorisés dans le navigateur intégré" + "value": "빈 탭이 현재 디버그 창의 설정 전용 모드를 사용하고 있습니다." } }, - "it": { + "uk": { "stringUnit": { "state": "translated", - "value": "Host HTTP consentiti nel browser integrato" + "value": "Порожні вкладки зараз використовують режим «Тільки налаштування» з вікна налагодження." + } + } + } + }, + "settings.browser.import.hint.note.visible": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Blank browser tabs can show this import suggestion. Hide or re-enable it here." } }, "ja": { "stringUnit": { "state": "translated", - "value": "内蔵ブラウザで許可するHTTPホスト" + "value": "空のブラウザータブにこのインポート案内を表示できます。ここで非表示や再表示を切り替えられます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "내장 브라우저에서 허용할 HTTP 호스트" + "value": "빈 브라우저 탭에 가져오기 제안을 표시할 수 있습니다. 여기서 숨기거나 다시 활성화하세요." } }, - "nb": { + "uk": { "stringUnit": { "state": "translated", - "value": "HTTP-verter tillatt i innebygd nettleser" + "value": "Порожні вкладки браузера можуть показувати пропозицію імпорту. Сховайте або увімкніть її тут." } - }, - "pl": { + } + } + }, + "settings.browser.import.hint.settingsNote": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Hosty HTTP dozwolone we wbudowanej przeglądarce" + "value": "Shown until you import or dismiss it on a blank tab." } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "Hosts HTTP Permitidos no Navegador Integrado" + "value": "空のタブでインポートするか閉じるまで表示されます。" } - }, - "ru": { + } + } + }, + "settings.browser.import.hint.show": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "HTTP-хосты, разрешенные во встроенном браузере" + "value": "Show import hint on blank browser tabs" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "โฮสต์ HTTP ที่อนุญาตในเบราว์เซอร์ในตัว" + "value": "空のブラウザータブにインポート案内を表示" } }, - "tr": { + "ko": { "stringUnit": { "state": "translated", - "value": "Gömülü Tarayıcıda İzin Verilen HTTP Ana Bilgisayarları" + "value": "빈 브라우저 탭에 가져오기 힌트 표시" } }, "uk": { "stringUnit": { "state": "translated", - "value": "HTTP-хости, дозволені у вбудованому браузері" + "value": "Показувати підказку імпорту на порожніх вкладках браузера" + } + } + } + }, + "settings.browser.import.refresh": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Refresh" } }, - "zh-Hans": { + "ja": { "stringUnit": { "state": "translated", - "value": "内嵌浏览器中允许的 HTTP 主机" + "value": "再読み込み" } }, - "zh-Hant": { + "ko": { "stringUnit": { "state": "translated", - "value": "允許在內建瀏覽器中使用的 HTTP 主機" + "value": "새로고침" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Оновити" } } } }, - "settings.browser.httpAllowlist.description": { + "settings.browser.interceptOpen": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "يتحكم في مضيفي HTTP (غير HTTPS) الذين يمكنهم الفتح في cmux بدون رسالة تحذير. الافتراضيات تشمل localhost و *.localhost و 127.0.0.1 و ::1 و 0.0.0.0 و *.localtest.me." + "value": "اعتراض open http(s) في الطرفية" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Kontroliše koji HTTP (ne-HTTPS) hostovi mogu biti otvoreni u cmux bez upozorenja. Podrazumijevani uključuju localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 i *.localtest.me." + "value": "Presretni open http(s) u Terminalu" } }, "da": { "stringUnit": { "state": "translated", - "value": "Styrer hvilke HTTP-værter (ikke-HTTPS) der kan åbnes i cmux uden advarselsmeddelelse. Standardindstillinger inkluderer localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 og *.localtest.me." + "value": "Opfang open http(s) i terminal" } }, "de": { "stringUnit": { "state": "translated", - "value": "Steuert, welche HTTP-Hosts (nicht HTTPS) ohne Warnhinweis in cmux geöffnet werden können. Standardmäßig enthalten: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 und *.localtest.me." + "value": "open http(s) im Terminal abfangen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Controls which HTTP (non-HTTPS) hosts can open in cmux without a warning prompt. Defaults include localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, and *.localtest.me." + "value": "Intercept open http(s) in Terminal" } }, "es": { "stringUnit": { "state": "translated", - "value": "Controla qué hosts HTTP (no HTTPS) pueden abrirse en cmux sin un mensaje de advertencia. Los valores predeterminados incluyen localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 y *.localtest.me." + "value": "Interceptar open http(s) en Terminal" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Contrôle quels hôtes HTTP (non HTTPS) peuvent s'ouvrir dans cmux sans avertissement. Les valeurs par défaut incluent localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 et *.localtest.me." + "value": "Intercepter open http(s) dans le terminal" } }, "it": { "stringUnit": { "state": "translated", - "value": "Controlla quali host HTTP (non HTTPS) possono aprirsi in cmux senza un avviso. I valori predefiniti includono localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 e *.localtest.me." + "value": "Intercetta open http(s) nel terminale" } }, "ja": { "stringUnit": { "state": "translated", - "value": "警告プロンプトなしでcmuxで開けるHTTP(非HTTPS)ホストを制御します。デフォルトにはlocalhost、*.localhost、127.0.0.1、::1、0.0.0.0、*.localtest.meが含まれます。" + "value": "ターミナルでopen http(s)をインターセプト" } }, "ko": { "stringUnit": { "state": "translated", - "value": "cmux에서 경고 없이 열 수 있는 HTTP(비HTTPS) 호스트를 제어합니다. 기본값에는 localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 및 *.localtest.me가 포함됩니다." + "value": "터미널에서 open http(s) 인터셉트" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Styrer hvilke HTTP-verter (ikke HTTPS) som kan åpnes i cmux uten advarselsmelding. Standardverdier inkluderer localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 og *.localtest.me." + "value": "Avlytt open http(s) i terminal" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Określa, które hosty HTTP (inne niż HTTPS) mogą być otwierane w cmux bez ostrzeżenia. Domyślnie uwzględniono localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 i *.localtest.me." + "value": "Przechwytuj open http(s) w terminalu" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Controla quais hosts HTTP (não HTTPS) podem abrir no cmux sem um aviso. Os padrões incluem localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 e *.localtest.me." + "value": "Interceptar open http(s) no Terminal" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Определяет, какие HTTP (не HTTPS) хосты могут открываться в cmux без предупреждения. По умолчанию включены localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 и *.localtest.me." + "value": "Перехватывать open http(s) в терминале" } }, "th": { "stringUnit": { "state": "translated", - "value": "ควบคุมว่าโฮสต์ HTTP (ไม่ใช่ HTTPS) ใดที่สามารถเปิดใน cmux โดยไม่ต้องแสดงคำเตือน ค่าเริ่มต้นรวมถึง localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 และ *.localtest.me" + "value": "ดักจับ open http(s) ในเทอร์มินัล" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Hangi HTTP (HTTPS olmayan) ana bilgisayarlarının cmux'ta uyarı istemi olmadan açılabileceğini kontrol eder. Varsayılanlar localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 ve *.localtest.me içerir." + "value": "Terminalde open http(s) Komutlarını Yakala" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Визначає, які HTTP (не HTTPS) хости можуть відкриватися в cmux без попередження. Типово включає localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0 та *.localtest.me." + "value": "Перехоплювати open http(s) у терміналі" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "控制哪些 HTTP(非 HTTPS)主机可以在 cmux 中打开而不显示警告提示。默认包括 localhost、*.localhost、127.0.0.1、::1、0.0.0.0 和 *.localtest.me。" + "value": "在终端中拦截 open http(s)" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "控制哪些 HTTP(非 HTTPS)主機可以在 cmux 中開啟而不顯示警告提示。預設包含 localhost、*.localhost、127.0.0.1、::1、0.0.0.0 和 *.localtest.me。" + "value": "在終端機中攔截 open http(s)" } } } }, - "settings.browser.httpAllowlist.hint": { + "settings.browser.interceptOpen.subtitle": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "مضيف واحد أو حرف بدل لكل سطر (مثال: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "عند التعطيل، يستخدم `open https://...` و `open http://...` دائمًا متصفحك الافتراضي." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Jedan host ili zamjenski znak po redu (na primjer: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Kada je isključeno, `open https://...` i `open http://...` uvijek koriste podrazumijevani preglednik." } }, "da": { "stringUnit": { "state": "translated", - "value": "Én vært eller wildcard pr. linje (f.eks.: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Når deaktiveret, bruger `open https://...` og `open http://...` altid din standardbrowser." } }, "de": { "stringUnit": { "state": "translated", - "value": "Ein Host oder Platzhalter pro Zeile (zum Beispiel: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Wenn deaktiviert, verwenden `open https://...` und `open http://...` immer Ihren Standardbrowser." } }, "en": { "stringUnit": { "state": "translated", - "value": "One host or wildcard per line (for example: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "When off, `open https://...` and `open http://...` always use your default browser." } }, "es": { "stringUnit": { "state": "translated", - "value": "Un host o comodín por línea (por ejemplo: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Cuando está desactivado, `open https://...` y `open http://...` siempre usan tu navegador predeterminado." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Un hôte ou caractère générique par ligne (par exemple : localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Lorsque désactivé, `open https://...` et `open http://...` utilisent toujours votre navigateur par défaut." } }, "it": { "stringUnit": { "state": "translated", - "value": "Un host o wildcard per riga (ad esempio: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Quando disattivato, `open https://...` e `open http://...` usano sempre il browser predefinito." } }, "ja": { "stringUnit": { "state": "translated", - "value": "1行に1つのホストまたはワイルドカード(例: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)。" + "value": "オフの場合、`open https://...`および`open http://...`は常にデフォルトブラウザを使用します。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "한 줄에 하나의 호스트 또는 와일드카드 (예: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "비활성화하면 `open https://...` 및 `open http://...`가 항상 기본 브라우저를 사용합니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Én vert eller jokertegn per linje (for eksempel: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Når av, bruker `open https://...` og `open http://...` alltid standard nettleser." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Jeden host lub wzorzec na wiersz (na przykład: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Po wyłączeniu `open https://...` i `open http://...` zawsze używają domyślnej przeglądarki." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Um host ou curinga por linha (por exemplo: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Quando desativado, `open https://...` e `open http://...` sempre usam seu navegador padrão." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Один хост или шаблон на строку (например: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "При отключении `open https://...` и `open http://...` всегда используют браузер по умолчанию." } }, "th": { "stringUnit": { "state": "translated", - "value": "โฮสต์หรือ wildcard หนึ่งรายการต่อบรรทัด (ตัวอย่าง: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)" + "value": "เมื่อปิด `open https://...` และ `open http://...` จะใช้เบราว์เซอร์เริ่มต้นของคุณเสมอ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Satır başına bir ana bilgisayar veya joker karakter (örneğin: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Kapalıyken, `open https://...` ve `open http://...` her zaman varsayılan tarayıcınızı kullanır." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Один хост або шаблон на рядок (наприклад: localhost, *.localhost, 127.0.0.1, ::1, 0.0.0.0, *.localtest.me)." + "value": "Якщо вимкнено, `open https://...` та `open http://...` завжди використовують стандартний браузер." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "每行一个主机或通配符(例如:localhost、*.localhost、127.0.0.1、::1、0.0.0.0、*.localtest.me)。" + "value": "关闭后,`open https://...` 和 `open http://...` 始终使用默认浏览器。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "每行一個主機或萬用字元(例如:localhost、*.localhost、127.0.0.1、::1、0.0.0.0、*.localtest.me)。" + "value": "關閉時,`open https://...` 和 `open http://...` 一律使用您的預設瀏覽器。" } } } }, - "settings.browser.httpAllowlist.save": { + "settings.browser.openTerminalLinks": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "حفظ" + "value": "فتح روابط الطرفية في متصفح cmux" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Spremi" + "value": "Otvori linkove terminala u cmux pregledniku" } }, "da": { "stringUnit": { "state": "translated", - "value": "Gem" + "value": "Åbn terminallinks i cmux-browser" } }, "de": { "stringUnit": { "state": "translated", - "value": "Speichern" + "value": "Terminal-Links im cmux-Browser öffnen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Save" + "value": "Open Terminal Links in cmux Browser" } }, "es": { "stringUnit": { "state": "translated", - "value": "Guardar" + "value": "Abrir enlaces del terminal en el navegador de cmux" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Enregistrer" + "value": "Ouvrir les liens du terminal dans le navigateur cmux" } }, "it": { "stringUnit": { "state": "translated", - "value": "Salva" + "value": "Apri link del terminale nel browser cmux" } }, "ja": { "stringUnit": { "state": "translated", - "value": "保存" + "value": "ターミナルのリンクをcmuxブラウザで開く" } }, "ko": { "stringUnit": { "state": "translated", - "value": "저장" + "value": "터미널 링크를 cmux 브라우저에서 열기" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Lagre" + "value": "Åpne terminallenker i cmux-nettleser" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Zapisz" + "value": "Otwieraj linki terminala w przeglądarce cmux" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Salvar" + "value": "Abrir Links do Terminal no Navegador do cmux" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Сохранить" + "value": "Открывать ссылки из терминала в браузере cmux" } }, "th": { "stringUnit": { "state": "translated", - "value": "บันทึก" + "value": "เปิดลิงก์เทอร์มินัลในเบราว์เซอร์ cmux" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Kaydet" + "value": "Terminal Bağlantılarını cmux Tarayıcısında Aç" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Зберегти" + "value": "Відкривати посилання терміналу у браузері cmux" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "保存" + "value": "在 cmux 浏览器中打开终端链接" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "儲存" - } - } - } - }, - "settings.browser.import": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Import Browser Data" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "ブラウザーデータを取り込む" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "브라우저 데이터 가져오기" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Імпорт даних браузера" - } - } - } - }, - "settings.browser.import.choose": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Choose…" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "選択…" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "선택…" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Вибрати…" + "value": "在 cmux 瀏覽器中開啟終端機連結" } } } }, - "settings.browser.import.detecting": { + "settings.browser.openTerminalLinks.subtitle": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "جارٍ التحقق من المتصفحات المثبتة..." + "value": "عند التعطيل، تفتح الروابط المنقورة في مخرجات الطرفية في متصفحك الافتراضي." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Provjeravam instalirane preglednike..." + "value": "Kada je isključeno, linkovi kliknuti u izlazu terminala se otvaraju u podrazumijevanom pregledniku." } }, "da": { "stringUnit": { "state": "translated", - "value": "Kontrollerer installerede browsere..." + "value": "Når deaktiveret, åbnes links, der klikkes i terminaloutput, i din standardbrowser." } }, "de": { "stringUnit": { "state": "translated", - "value": "Installierte Browser werden geprüft..." + "value": "Wenn deaktiviert, werden im Terminal angeklickte Links in Ihrem Standardbrowser geöffnet." } }, "en": { "stringUnit": { "state": "translated", - "value": "Checking installed browsers..." + "value": "When off, links clicked in terminal output open in your default browser." } }, "es": { "stringUnit": { "state": "translated", - "value": "Comprobando los navegadores instalados..." + "value": "Cuando está desactivado, los enlaces en la salida del terminal se abren en tu navegador predeterminado." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Vérification des navigateurs installés..." + "value": "Lorsque désactivé, les liens cliqués dans la sortie du terminal s'ouvrent dans votre navigateur par défaut." } }, "it": { "stringUnit": { "state": "translated", - "value": "Controllo dei browser installati..." + "value": "Quando disattivato, i link cliccati nell'output del terminale si aprono nel browser predefinito." } }, "ja": { "stringUnit": { "state": "translated", - "value": "インストール済みブラウザーを確認しています..." - } - }, - "km": { - "stringUnit": { - "state": "translated", - "value": "កំពុងពិនិត្យកម្មវិធីរុករកដែលបានដំឡើង..." + "value": "オフの場合、ターミナル出力のリンクはデフォルトブラウザで開きます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "설치된 브라우저를 확인하는 중..." + "value": "비활성화하면 터미널 출력에서 클릭한 링크가 기본 브라우저에서 열립니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Sjekker installerte nettlesere..." + "value": "Når av, åpnes lenker som klikkes i terminalutdata i standard nettleser." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Sprawdzanie zainstalowanych przeglądarek..." + "value": "Po wyłączeniu linki kliknięte w terminalu otwierają się w domyślnej przeglądarce." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Verificando navegadores instalados..." + "value": "Quando desativado, links clicados na saída do terminal abrem no seu navegador padrão." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Проверяем установленные браузеры..." + "value": "При отключении ссылки из терминала открываются в браузере по умолчанию." } }, "th": { "stringUnit": { "state": "translated", - "value": "กำลังตรวจสอบเบราว์เซอร์ที่ติดตั้ง..." + "value": "เมื่อปิด ลิงก์ที่คลิกในเอาต์พุตเทอร์มินัลจะเปิดในเบราว์เซอร์เริ่มต้นของคุณ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Yüklü tarayıcılar kontrol ediliyor..." + "value": "Kapalıyken, terminal çıktısında tıklanan bağlantılar varsayılan tarayıcınızda açılır." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Перевіряємо встановлені браузери..." + "value": "Якщо вимкнено, посилання у виводі терміналу відкриваються у стандартному браузері." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "正在检查已安装的浏览器..." + "value": "关闭后,终端输出中点击的链接在默认浏览器中打开。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "正在檢查已安裝的瀏覽器..." + "value": "關閉時,終端機輸出中點擊的連結會在您的預設瀏覽器中開啟。" } } } }, - "settings.browser.import.hint.note.hidden": { + "settings.browser.reactGrabVersion": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "The blank-tab import hint is hidden. Turn it back on here any time." + "value": "React Grab Version" } }, "ja": { "stringUnit": { "state": "translated", - "value": "空タブのインポート案内は非表示です。ここでいつでも再表示できます。" + "value": "React Grabバージョン" } }, "ko": { "stringUnit": { "state": "translated", - "value": "빈 탭 가져오기 힌트가 숨겨져 있습니다. 여기서 언제든 다시 켤 수 있습니다." - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Підказка імпорту на порожній вкладці прихована. Увімкніть її тут у будь-який час." + "value": "React Grab 버전" } } } }, - "settings.browser.import.hint.note.settingsOnly": { + "settings.browser.reactGrabVersion.subtitle": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Blank tabs are currently using Settings only mode from the debug window." + "value": "Pinned npm version of react-grab injected by the toolbar button (Cmd+Shift+G). Only versions with a known integrity hash are accepted." } }, "ja": { "stringUnit": { "state": "translated", - "value": "現在、空タブはデバッグウィンドウの「設定のみ」モードになっています。" + "value": "ツールバーボタン(Cmd+Shift+G)で注入されるreact-grabのnpmバージョン。既知の整合性ハッシュを持つバージョンのみ使用可能です。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "빈 탭이 현재 디버그 창의 설정 전용 모드를 사용하고 있습니다." - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Порожні вкладки зараз використовують режим «Тільки налаштування» з вікна налагодження." + "value": "도구 모음 버튼(Cmd+Shift+G)으로 주입되는 react-grab의 고정된 npm 버전입니다. 알려진 무결성 해시가 있는 버전만 허용됩니다." } } } }, - "settings.browser.import.hint.note.visible": { + "settings.browser.searchEngine": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Blank browser tabs can show this import suggestion. Hide or re-enable it here." + "value": "محرك البحث الافتراضي" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "空のブラウザータブにこのインポート案内を表示できます。ここで非表示や再表示を切り替えられます。" + "value": "Podrazumijevani pretraživač" } }, - "ko": { + "da": { "stringUnit": { "state": "translated", - "value": "빈 브라우저 탭에 가져오기 제안을 표시할 수 있습니다. 여기서 숨기거나 다시 활성화하세요." + "value": "Standardsøgemaskine" } }, - "uk": { + "de": { "stringUnit": { "state": "translated", - "value": "Порожні вкладки браузера можуть показувати пропозицію імпорту. Сховайте або увімкніть її тут." + "value": "Standardsuchmaschine" } - } - } - }, - "settings.browser.import.hint.settingsNote": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Shown until you import or dismiss it on a blank tab." + "value": "Default Search Engine" } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "空のタブでインポートするか閉じるまで表示されます。" + "value": "Motor de búsqueda predeterminado" } - } - } - }, - "settings.browser.import.hint.show": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "fr": { "stringUnit": { "state": "translated", - "value": "Show import hint on blank browser tabs" + "value": "Moteur de recherche par défaut" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Motore di ricerca predefinito" } }, "ja": { "stringUnit": { "state": "translated", - "value": "空のブラウザータブにインポート案内を表示" + "value": "デフォルト検索エンジン" } }, "ko": { "stringUnit": { "state": "translated", - "value": "빈 브라우저 탭에 가져오기 힌트 표시" + "value": "기본 검색 엔진" } }, - "uk": { + "nb": { "stringUnit": { "state": "translated", - "value": "Показувати підказку імпорту на порожніх вкладках браузера" + "value": "Standard søkemotor" } - } - } - }, - "settings.browser.import.refresh": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Refresh" + "value": "Domyślna wyszukiwarka" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "再読み込み" + "value": "Motor de Busca Padrão" } }, - "ko": { + "ru": { "stringUnit": { "state": "translated", - "value": "새로고침" + "value": "Поисковая система по умолчанию" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "เครื่องมือค้นหาเริ่มต้น" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Varsayılan Arama Motoru" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Оновити" + "value": "Стандартна пошукова система" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "默认搜索引擎" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "預設搜尋引擎" } } } }, - "settings.browser.interceptOpen": { + "settings.browser.searchEngine.baidu": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "اعتراض open http(s) في الطرفية" + "value": "Baidu" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Presretni open http(s) u Terminalu" + "value": "Baidu" } }, "da": { "stringUnit": { "state": "translated", - "value": "Opfang open http(s) i terminal" + "value": "Baidu" } }, "de": { "stringUnit": { "state": "translated", - "value": "open http(s) im Terminal abfangen" + "value": "Baidu" } }, "en": { "stringUnit": { "state": "translated", - "value": "Intercept open http(s) in Terminal" + "value": "Baidu" } }, "es": { "stringUnit": { "state": "translated", - "value": "Interceptar open http(s) en Terminal" + "value": "Baidu" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Intercepter open http(s) dans le terminal" + "value": "Baidu" } }, "it": { "stringUnit": { "state": "translated", - "value": "Intercetta open http(s) nel terminale" + "value": "Baidu" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ターミナルでopen http(s)をインターセプト" + "value": "Baidu" } }, "ko": { "stringUnit": { "state": "translated", - "value": "터미널에서 open http(s) 인터셉트" + "value": "Baidu" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Avlytt open http(s) i terminal" + "value": "Baidu" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Przechwytuj open http(s) w terminalu" + "value": "Baidu" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Interceptar open http(s) no Terminal" + "value": "Baidu" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Перехватывать open http(s) в терминале" + "value": "Baidu" } }, "th": { "stringUnit": { "state": "translated", - "value": "ดักจับ open http(s) ในเทอร์มินัล" + "value": "Baidu" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Terminalde open http(s) Komutlarını Yakala" + "value": "Baidu" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Перехоплювати open http(s) у терміналі" + "value": "Baidu" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "在终端中拦截 open http(s)" + "value": "Baidu" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "在終端機中攔截 open http(s)" + "value": "Baidu" } } } }, - "settings.browser.interceptOpen.subtitle": { + "settings.browser.searchEngine.bing": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "عند التعطيل، يستخدم `open https://...` و `open http://...` دائمًا متصفحك الافتراضي." + "value": "Bing" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Kada je isključeno, `open https://...` i `open http://...` uvijek koriste podrazumijevani preglednik." + "value": "Bing" } }, "da": { "stringUnit": { "state": "translated", - "value": "Når deaktiveret, bruger `open https://...` og `open http://...` altid din standardbrowser." + "value": "Bing" } }, "de": { "stringUnit": { "state": "translated", - "value": "Wenn deaktiviert, verwenden `open https://...` und `open http://...` immer Ihren Standardbrowser." + "value": "Bing" } }, "en": { "stringUnit": { "state": "translated", - "value": "When off, `open https://...` and `open http://...` always use your default browser." + "value": "Bing" } }, "es": { "stringUnit": { "state": "translated", - "value": "Cuando está desactivado, `open https://...` y `open http://...` siempre usan tu navegador predeterminado." + "value": "Bing" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Lorsque désactivé, `open https://...` et `open http://...` utilisent toujours votre navigateur par défaut." + "value": "Bing" } }, "it": { "stringUnit": { "state": "translated", - "value": "Quando disattivato, `open https://...` e `open http://...` usano sempre il browser predefinito." + "value": "Bing" } }, "ja": { "stringUnit": { "state": "translated", - "value": "オフの場合、`open https://...`および`open http://...`は常にデフォルトブラウザを使用します。" + "value": "Bing" } }, "ko": { "stringUnit": { "state": "translated", - "value": "비활성화하면 `open https://...` 및 `open http://...`가 항상 기본 브라우저를 사용합니다." + "value": "Bing" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Når av, bruker `open https://...` og `open http://...` alltid standard nettleser." + "value": "Bing" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Po wyłączeniu `open https://...` i `open http://...` zawsze używają domyślnej przeglądarki." + "value": "Bing" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Quando desativado, `open https://...` e `open http://...` sempre usam seu navegador padrão." + "value": "Bing" } }, "ru": { "stringUnit": { "state": "translated", - "value": "При отключении `open https://...` и `open http://...` всегда используют браузер по умолчанию." + "value": "Bing" } }, "th": { "stringUnit": { "state": "translated", - "value": "เมื่อปิด `open https://...` และ `open http://...` จะใช้เบราว์เซอร์เริ่มต้นของคุณเสมอ" + "value": "Bing" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Kapalıyken, `open https://...` ve `open http://...` her zaman varsayılan tarayıcınızı kullanır." + "value": "Bing" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Якщо вимкнено, `open https://...` та `open http://...` завжди використовують стандартний браузер." + "value": "Bing" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "关闭后,`open https://...` 和 `open http://...` 始终使用默认浏览器。" + "value": "Bing" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "關閉時,`open https://...` 和 `open http://...` 一律使用您的預設瀏覽器。" + "value": "Bing" } } } }, - "settings.browser.openTerminalLinks": { + "settings.browser.searchEngine.brave": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "فتح روابط الطرفية في متصفح cmux" + "value": "Brave Search" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Otvori linkove terminala u cmux pregledniku" + "value": "Brave Search" } }, "da": { "stringUnit": { "state": "translated", - "value": "Åbn terminallinks i cmux-browser" + "value": "Brave Search" } }, "de": { "stringUnit": { "state": "translated", - "value": "Terminal-Links im cmux-Browser öffnen" + "value": "Brave Search" } }, "en": { "stringUnit": { "state": "translated", - "value": "Open Terminal Links in cmux Browser" + "value": "Brave Search" } }, "es": { "stringUnit": { "state": "translated", - "value": "Abrir enlaces del terminal en el navegador de cmux" + "value": "Brave Search" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Ouvrir les liens du terminal dans le navigateur cmux" + "value": "Brave Search" } }, "it": { "stringUnit": { "state": "translated", - "value": "Apri link del terminale nel browser cmux" + "value": "Brave Search" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ターミナルのリンクをcmuxブラウザで開く" + "value": "Brave Search" } }, "ko": { "stringUnit": { "state": "translated", - "value": "터미널 링크를 cmux 브라우저에서 열기" + "value": "Brave Search" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Åpne terminallenker i cmux-nettleser" + "value": "Brave Search" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Otwieraj linki terminala w przeglądarce cmux" + "value": "Brave Search" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Abrir Links do Terminal no Navegador do cmux" + "value": "Brave Search" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Открывать ссылки из терминала в браузере cmux" + "value": "Brave Search" } }, "th": { "stringUnit": { "state": "translated", - "value": "เปิดลิงก์เทอร์มินัลในเบราว์เซอร์ cmux" + "value": "Brave Search" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Terminal Bağlantılarını cmux Tarayıcısında Aç" + "value": "Brave Search" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Відкривати посилання терміналу у браузері cmux" + "value": "Brave Search" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "在 cmux 浏览器中打开终端链接" + "value": "Brave Search" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "在 cmux 瀏覽器中開啟終端機連結" + "value": "Brave Search" } } } }, - "settings.browser.openTerminalLinks.subtitle": { + "settings.browser.searchEngine.custom": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "عند التعطيل، تفتح الروابط المنقورة في مخرجات الطرفية في متصفحك الافتراضي." + "value": "مخصص" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Kada je isključeno, linkovi kliknuti u izlazu terminala se otvaraju u podrazumijevanom pregledniku." + "value": "Prilagođeno" } }, "da": { "stringUnit": { "state": "translated", - "value": "Når deaktiveret, åbnes links, der klikkes i terminaloutput, i din standardbrowser." + "value": "Tilpasset" } }, "de": { "stringUnit": { "state": "translated", - "value": "Wenn deaktiviert, werden im Terminal angeklickte Links in Ihrem Standardbrowser geöffnet." + "value": "Benutzerdefiniert" } }, "en": { "stringUnit": { "state": "translated", - "value": "When off, links clicked in terminal output open in your default browser." + "value": "Custom" } }, "es": { "stringUnit": { "state": "translated", - "value": "Cuando está desactivado, los enlaces en la salida del terminal se abren en tu navegador predeterminado." + "value": "Personalizado" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Lorsque désactivé, les liens cliqués dans la sortie du terminal s'ouvrent dans votre navigateur par défaut." + "value": "Personnalisé" } }, "it": { "stringUnit": { "state": "translated", - "value": "Quando disattivato, i link cliccati nell'output del terminale si aprono nel browser predefinito." + "value": "Personalizzato" } }, "ja": { "stringUnit": { "state": "translated", - "value": "オフの場合、ターミナル出力のリンクはデフォルトブラウザで開きます。" + "value": "カスタム" } }, "ko": { "stringUnit": { "state": "translated", - "value": "비활성화하면 터미널 출력에서 클릭한 링크가 기본 브라우저에서 열립니다." + "value": "사용자 지정" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Når av, åpnes lenker som klikkes i terminalutdata i standard nettleser." + "value": "Tilpasset" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Po wyłączeniu linki kliknięte w terminalu otwierają się w domyślnej przeglądarce." + "value": "Niestandardowe" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Quando desativado, links clicados na saída do terminal abrem no seu navegador padrão." + "value": "Personalizado" } }, "ru": { "stringUnit": { "state": "translated", - "value": "При отключении ссылки из терминала открываются в браузере по умолчанию." + "value": "Пользовательский" } }, "th": { "stringUnit": { "state": "translated", - "value": "เมื่อปิด ลิงก์ที่คลิกในเอาต์พุตเทอร์มินัลจะเปิดในเบราว์เซอร์เริ่มต้นของคุณ" + "value": "กำหนดเอง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Kapalıyken, terminal çıktısında tıklanan bağlantılar varsayılan tarayıcınızda açılır." + "value": "Özel" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Якщо вимкнено, посилання у виводі терміналу відкриваються у стандартному браузері." + "value": "Користувацький" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "关闭后,终端输出中点击的链接在默认浏览器中打开。" + "value": "自定义" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "關閉時,終端機輸出中點擊的連結會在您的預設瀏覽器中開啟。" - } - } - } - }, - "settings.browser.reactGrabVersion": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "React Grab Version" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "React Grabバージョン" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "React Grab 버전" - } - } - } - }, - "settings.browser.reactGrabVersion.subtitle": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Pinned npm version of react-grab injected by the toolbar button (Cmd+Shift+G). Only versions with a known integrity hash are accepted." - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "ツールバーボタン(Cmd+Shift+G)で注入されるreact-grabのnpmバージョン。既知の整合性ハッシュを持つバージョンのみ使用可能です。" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "도구 모음 버튼(Cmd+Shift+G)으로 주입되는 react-grab의 고정된 npm 버전입니다. 알려진 무결성 해시가 있는 버전만 허용됩니다." + "value": "自訂" } } } }, - "settings.browser.searchEngine": { + "settings.browser.searchEngine.duckduckgo": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "محرك البحث الافتراضي" + "value": "DuckDuckGo" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Podrazumijevani pretraživač" + "value": "DuckDuckGo" } }, "da": { "stringUnit": { "state": "translated", - "value": "Standardsøgemaskine" + "value": "DuckDuckGo" } }, "de": { "stringUnit": { "state": "translated", - "value": "Standardsuchmaschine" + "value": "DuckDuckGo" } }, "en": { "stringUnit": { "state": "translated", - "value": "Default Search Engine" + "value": "DuckDuckGo" } }, "es": { "stringUnit": { "state": "translated", - "value": "Motor de búsqueda predeterminado" + "value": "DuckDuckGo" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Moteur de recherche par défaut" + "value": "DuckDuckGo" } }, "it": { "stringUnit": { "state": "translated", - "value": "Motore di ricerca predefinito" + "value": "DuckDuckGo" } }, "ja": { "stringUnit": { "state": "translated", - "value": "デフォルト検索エンジン" + "value": "DuckDuckGo" } }, "ko": { "stringUnit": { "state": "translated", - "value": "기본 검색 엔진" + "value": "DuckDuckGo" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Standard søkemotor" + "value": "DuckDuckGo" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Domyślna wyszukiwarka" + "value": "DuckDuckGo" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Motor de Busca Padrão" + "value": "DuckDuckGo" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Поисковая система по умолчанию" + "value": "DuckDuckGo" } }, "th": { "stringUnit": { "state": "translated", - "value": "เครื่องมือค้นหาเริ่มต้น" + "value": "DuckDuckGo" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Varsayılan Arama Motoru" + "value": "DuckDuckGo" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Стандартна пошукова система" + "value": "DuckDuckGo" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "默认搜索引擎" + "value": "DuckDuckGo" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "預設搜尋引擎" + "value": "DuckDuckGo" } } } }, - "settings.browser.searchEngine.baidu": { + "settings.browser.searchEngine.ecosia": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "da": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "de": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "en": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "es": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "it": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "th": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Baidu" + "value": "Ecosia" } } } }, - "settings.browser.searchEngine.bing": { + "settings.browser.searchEngine.exa": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "da": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "de": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "en": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "es": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "it": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "th": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Bing" + "value": "Exa" } } } }, - "settings.browser.searchEngine.brave": { + "settings.browser.searchEngine.github": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "da": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "de": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "en": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "es": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "it": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "th": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Brave Search" + "value": "GitHub" } } } }, - "settings.browser.searchEngine.custom": { + "settings.browser.searchEngine.google": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "مخصص" + "value": "Google" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Prilagođeno" + "value": "Google" } }, "da": { "stringUnit": { "state": "translated", - "value": "Tilpasset" + "value": "Google" } }, "de": { "stringUnit": { "state": "translated", - "value": "Benutzerdefiniert" + "value": "Google" } }, "en": { "stringUnit": { "state": "translated", - "value": "Custom" + "value": "Google" } }, "es": { "stringUnit": { "state": "translated", - "value": "Personalizado" + "value": "Google" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Personnalisé" + "value": "Google" } }, "it": { "stringUnit": { "state": "translated", - "value": "Personalizzato" + "value": "Google" } }, "ja": { "stringUnit": { "state": "translated", - "value": "カスタム" + "value": "Google" } }, "ko": { "stringUnit": { "state": "translated", - "value": "사용자 지정" + "value": "Google" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Tilpasset" + "value": "Google" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Niestandardowe" + "value": "Google" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Personalizado" + "value": "Google" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Пользовательский" + "value": "Google" } }, "th": { "stringUnit": { "state": "translated", - "value": "กำหนดเอง" + "value": "Google" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Özel" + "value": "Google" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Користувацький" + "value": "Google" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "自定义" + "value": "Google" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "自訂" + "value": "Google" } } } }, - "settings.browser.searchEngine.duckduckgo": { + "settings.browser.searchEngine.kagi": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "bs": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "da": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "de": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "en": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "es": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "fr": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "it": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "ja": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "ko": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "nb": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "pl": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "ru": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "th": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "tr": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "uk": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "DuckDuckGo" + "value": "Kagi" } } } }, - "settings.browser.searchEngine.ecosia": { + "settings.browser.searchEngine.mojeek": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "da": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "de": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "en": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "es": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "it": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "th": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Ecosia" + "value": "Mojeek" } } } }, - "settings.browser.searchEngine.exa": { + "settings.browser.searchEngine.perplexity": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "da": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "de": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "en": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "es": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "it": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "th": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Exa" + "value": "Perplexity" } } } }, - "settings.browser.searchEngine.github": { + "settings.browser.searchEngine.qwant": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "bs": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "da": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "de": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "en": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "es": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "fr": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "it": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "ja": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "ko": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "nb": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "pl": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "ru": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "th": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "tr": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "uk": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "GitHub" + "value": "Qwant" } } } }, - "settings.browser.searchEngine.google": { + "settings.browser.searchEngine.startpage": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "da": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "de": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "en": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "es": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "it": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "th": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Google" + "value": "Startpage" } } } }, - "settings.browser.searchEngine.kagi": { + "settings.browser.searchEngine.subtitle": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "يُستخدم بواسطة شريط عنوان المتصفح عندما لا يكون الإدخال URL." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Koristi se u adresnoj traci preglednika kada unos nije URL." } }, "da": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Bruges af browserens adresselinje, når input ikke er en URL." } }, "de": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Wird von der Browser-Adressleiste verwendet, wenn die Eingabe keine URL ist." } }, "en": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Used by the browser address bar when input is not a URL." } }, "es": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Usado por la barra de direcciones del navegador cuando la entrada no es una URL." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Utilisé par la barre d'adresse du navigateur lorsque la saisie n'est pas une URL." } }, "it": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Utilizzato dalla barra degli indirizzi del browser quando l'input non è un URL." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "ブラウザのアドレスバーで入力がURLでない場合に使用されます。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "입력이 URL이 아닌 경우 브라우저 주소 표시줄에서 사용됩니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Brukes av adressefeltet i nettleseren når inndataen ikke er en URL." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Używana przez pasek adresu przeglądarki, gdy dane wejściowe nie są adresem URL." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Usado pela barra de endereço do navegador quando a entrada não é uma URL." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Используется адресной строкой браузера, когда ввод не является URL." } }, "th": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "ใช้โดยแถบที่อยู่เบราว์เซอร์เมื่ออินพุตไม่ใช่ URL" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Giriş bir URL olmadığında tarayıcı adres çubuğu tarafından kullanılır." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "Використовується адресним рядком браузера, коли введення не є URL." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "浏览器地址栏中输入非 URL 内容时使用。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Kagi" + "value": "當瀏覽器網址列的輸入不是 URL 時使用。" } } } }, - "settings.browser.searchEngine.mojeek": { + "settings.browser.searchEngine.wikipedia": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "da": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "de": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "en": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "es": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "it": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "th": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Mojeek" + "value": "Wikipedia" } } } }, - "settings.browser.searchEngine.perplexity": { + "settings.browser.searchEngine.yahoo": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "da": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "de": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "en": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "es": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "it": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "th": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Perplexity" + "value": "Yahoo" } } } }, - "settings.browser.searchEngine.qwant": { + "settings.browser.searchEngine.yandex": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "da": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "de": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "en": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "es": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "it": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "th": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Qwant" + "value": "Yandex" } } } }, - "settings.browser.searchEngine.startpage": { + "settings.browser.searchSuggestions": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "عرض اقتراحات البحث" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Prikaži prijedloge pretrage" } }, "da": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Vis søgeforslag" } }, "de": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Suchvorschläge anzeigen" } }, "en": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Show Search Suggestions" } }, "es": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Mostrar sugerencias de búsqueda" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Afficher les suggestions de recherche" } }, "it": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Mostra suggerimenti di ricerca" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "検索候補を表示" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "검색 제안 표시" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Vis søkeforslag" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Pokaż podpowiedzi wyszukiwania" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Mostrar Sugestões de Pesquisa" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Показывать поисковые подсказки" } }, "th": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "แสดงคำแนะนำการค้นหา" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Arama Önerilerini Göster" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "Показувати підказки пошуку" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "显示搜索建议" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Startpage" + "value": "顯示搜尋建議" } } } }, - "settings.browser.searchEngine.subtitle": { + "settings.browser.theme": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "يُستخدم بواسطة شريط عنوان المتصفح عندما لا يكون الإدخال URL." + "value": "مظهر المتصفح" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Koristi se u adresnoj traci preglednika kada unos nije URL." + "value": "Tema preglednika" } }, "da": { "stringUnit": { "state": "translated", - "value": "Bruges af browserens adresselinje, når input ikke er en URL." + "value": "Browsertema" } }, "de": { "stringUnit": { "state": "translated", - "value": "Wird von der Browser-Adressleiste verwendet, wenn die Eingabe keine URL ist." + "value": "Browser-Design" } }, "en": { "stringUnit": { "state": "translated", - "value": "Used by the browser address bar when input is not a URL." + "value": "Browser Theme" } }, "es": { "stringUnit": { "state": "translated", - "value": "Usado por la barra de direcciones del navegador cuando la entrada no es una URL." + "value": "Tema del navegador" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Utilisé par la barre d'adresse du navigateur lorsque la saisie n'est pas une URL." + "value": "Thème du navigateur" } }, "it": { "stringUnit": { "state": "translated", - "value": "Utilizzato dalla barra degli indirizzi del browser quando l'input non è un URL." + "value": "Tema del browser" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ブラウザのアドレスバーで入力がURLでない場合に使用されます。" + "value": "ブラウザテーマ" } }, "ko": { "stringUnit": { "state": "translated", - "value": "입력이 URL이 아닌 경우 브라우저 주소 표시줄에서 사용됩니다." + "value": "브라우저 테마" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Brukes av adressefeltet i nettleseren når inndataen ikke er en URL." + "value": "Nettlesertema" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Używana przez pasek adresu przeglądarki, gdy dane wejściowe nie są adresem URL." + "value": "Motyw przeglądarki" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Usado pela barra de endereço do navegador quando a entrada não é uma URL." + "value": "Tema do Navegador" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Используется адресной строкой браузера, когда ввод не является URL." + "value": "Тема браузера" } }, "th": { "stringUnit": { "state": "translated", - "value": "ใช้โดยแถบที่อยู่เบราว์เซอร์เมื่ออินพุตไม่ใช่ URL" + "value": "ธีมเบราว์เซอร์" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Giriş bir URL olmadığında tarayıcı adres çubuğu tarafından kullanılır." + "value": "Tarayıcı Teması" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Використовується адресним рядком браузера, коли введення не є URL." + "value": "Тема браузера" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "浏览器地址栏中输入非 URL 内容时使用。" + "value": "浏览器主题" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "當瀏覽器網址列的輸入不是 URL 時使用。" + "value": "瀏覽器主題" } } } }, - "settings.browser.searchEngine.wikipedia": { + "settings.browser.theme.subtitleForced": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ يفرض نظام الألوان هذا للصفحات المتوافقة." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ nameće tu shemu boja za kompatibilne stranice." } }, "da": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ tvinger det farveskema for kompatible sider." } }, "de": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ erzwingt dieses Farbschema für kompatible Seiten." } }, "en": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ forces that color scheme for compatible pages." } }, "es": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ fuerza ese esquema de colores para las páginas compatibles." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ impose ce jeu de couleurs aux pages compatibles." } }, "it": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ impone quello schema di colori per le pagine compatibili." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@は対応ページにそのカラースキームを強制します。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@은(는) 호환 페이지에 해당 색상 구성표를 강제 적용합니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ tvinger det fargeskjemaet for kompatible sider." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ wymusza ten schemat kolorów dla zgodnych stron." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ força esse esquema de cores para páginas compatíveis." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ принудительно применяет эту цветовую схему для совместимых страниц." } }, "th": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ บังคับใช้โทนสีนั้นสำหรับหน้าที่รองรับ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ uyumlu sayfalar için bu renk şemasını zorlar." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ примусово встановлює цю кольорову схему для сумісних сторінок." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ 为兼容页面强制使用该配色方案。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Wikipedia" + "value": "%@ 會為相容的頁面強制套用該色彩配置。" } } } }, - "settings.browser.searchEngine.yahoo": { + "settings.browser.theme.subtitleSystem": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "النظام يتبع مظهر التطبيق و macOS." } }, "bs": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Sistemski prati izgled aplikacije i macOS." } }, "da": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "System følger app- og macOS-udseende." } }, "de": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "System folgt der App- und macOS-Darstellung." } }, "en": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "System follows app and macOS appearance." } }, "es": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Sistema sigue la apariencia de la app y macOS." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Système suit l'apparence de l'app et de macOS." } }, "it": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Sistema segue l'aspetto dell'app e di macOS." } }, "ja": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "システムはアプリとmacOSの外観に従います。" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "시스템은 앱 및 macOS 외관을 따릅니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "System følger app- og macOS-utseende." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Systemowy podąża za wyglądem aplikacji i macOS." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Sistema segue a aparência do app e do macOS." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Системная тема следует за оформлением приложения и macOS." } }, "th": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "ระบบจะตามธีมแอปและรูปลักษณ์ macOS" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Sistem, uygulama ve macOS görünümünü takip eder." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "Системна слідує за програмою та зовнішнім виглядом macOS." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "系统跟随应用和 macOS 外观。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Yahoo" + "value": "「系統」會跟隨 App 和 macOS 外觀。" } } } }, - "settings.browser.searchEngine.yandex": { + "settings.config.action.openActiveEditor": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "Open Active Config…" } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "有効な設定を開く…" } - }, - "da": { + } + } + }, + "settings.config.action.openEditor": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "Open in Editor…" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "エディタで開く…" } - }, + } + } + }, + "settings.config.action.reload": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "Reload" } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "再読み込み" } - }, - "fr": { + } + } + }, + "settings.config.action.revealActiveFinder": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "Reveal Active Config in Finder" } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "有効な設定をFinderで表示" + } + } + } + }, + "settings.config.action.revealFinder": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Reveal in Finder" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "Finderで表示" } - }, - "ko": { + } + } + }, + "settings.config.action.save": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "Save" } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "保存" } - }, - "pl": { + } + } + }, + "settings.config.banner.cmux": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "This is the cmux Ghostty config selected for this build. Edit it here, then Save to reload cmux." } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "これはこのビルドで選択されている cmux Ghostty 設定です。ここで編集し、保存すると cmux が再読み込みされます。" } - }, - "ru": { + } + } + }, + "settings.config.banner.synced": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "This is a generated preview of the effective config. Edit the cmux tab to change what cmux reads." } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "これは実効設定の生成プレビューです。cmux が読み込む内容を変更するには cmux タブを編集してください。" } - }, - "tr": { + } + } + }, + "settings.config.banner.syncedNoGhostty": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "This is a generated preview of the effective config. No base Ghostty config file was found, so only cmux overrides are shown." } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "これは実効設定の生成プレビューです。ベースの Ghostty 設定ファイルが見つからなかったため、cmux の上書き設定のみを表示しています。" } - }, - "zh-Hans": { + } + } + }, + "settings.config.source.cmux": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "cmux" } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "Yandex" + "value": "cmux" } } } }, - "settings.browser.searchSuggestions": { + "settings.config.source.label": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "عرض اقتراحات البحث" + "value": "Config Source" } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Prikaži prijedloge pretrage" + "value": "構成ソース" } - }, - "da": { + } + } + }, + "settings.config.source.synced": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Vis søgeforslag" + "value": "synced" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Suchvorschläge anzeigen" + "value": "同期" } - }, + } + } + }, + "settings.config.status.openFailed": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Show Search Suggestions" + "value": "Couldn't open the cmux config." } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "Mostrar sugerencias de búsqueda" + "value": "cmux 設定を開けませんでした。" } - }, - "fr": { + } + } + }, + "settings.config.status.reloaded": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Afficher les suggestions de recherche" + "value": "Reloaded configuration from disk." } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "Mostra suggerimenti di ricerca" + "value": "ディスクから構成を再読み込みしました。" + } + } + } + }, + "settings.config.status.saveFailed": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Couldn't save the cmux config." } }, "ja": { "stringUnit": { "state": "translated", - "value": "検索候補を表示" + "value": "cmux 設定を保存できませんでした。" } - }, - "ko": { + } + } + }, + "settings.config.status.saved": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "검색 제안 표시" + "value": "Saved to cmux config and reloaded." } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "Vis søkeforslag" + "value": "cmux 設定に保存し、再読み込みしました。" } - }, - "pl": { + } + } + }, + "settings.config.windowTitle": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Pokaż podpowiedzi wyszukiwania" + "value": "Config" } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "Mostrar Sugestões de Pesquisa" + "value": "構成" } - }, - "ru": { + } + } + }, + "settings.customSidebars.enabled": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Показывать поисковые подсказки" + "value": "Show Custom Sidebars" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "แสดงคำแนะนำการค้นหา" + "value": "カスタムサイドバーを表示" } - }, - "tr": { + } + } + }, + "settings.customSidebars.enabled.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Arama Önerilerini Göster" + "value": "Hides custom sidebars from the sidebar picker until you enable them here." } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "Показувати підказки пошуку" + "value": "ここで有効にするまで、カスタムサイドバーをサイドバーピッカーに表示しません。" } - }, - "zh-Hans": { + } + } + }, + "settings.customSidebars.enabled.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "显示搜索建议" + "value": "Lists your sidebars from ~/.config/cmux/sidebars in the sidebar picker." } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "顯示搜尋建議" + "value": "~/.config/cmux/sidebars のサイドバーをサイドバーピッカーに表示します。" } } } }, - "settings.browser.theme": { + "settings.customSidebars.note": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "مظهر المتصفح" + "value": "Custom sidebars are SwiftUI-style files in ~/.config/cmux/sidebars. Pick one from the sidebar toggle button's right-click menu; edits hot-reload on save. Use the in-app renderer only for sidebars you trust." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Tema preglednika" + "value": "カスタムサイドバーは ~/.config/cmux/sidebars にある SwiftUI 形式のファイルです。サイドバー切り替えボタンの右クリックメニューから選択でき、保存すると即時に再読み込みされます。アプリ内レンダラーは信頼できるサイドバーのみに使用してください。" } - }, - "da": { + } + } + }, + "settings.customSidebars.renderer": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Browsertema" + "value": "Renderer" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Browser-Design" + "value": "レンダラー" } - }, + } + } + }, + "settings.error.alert.dismiss": { + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Browser Theme" + "value": "OK" } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "Tema del navegador" + "value": "OK" + } + } + } + }, + "settings.error.alert.title": { + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Couldn't save setting" } }, - "fr": { + "ja": { "stringUnit": { "state": "translated", - "value": "Thème du navigateur" + "value": "設定を保存できませんでした" + } + } + } + }, + "settings.fontSize.valuePoints": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%@ pt" } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "Tema del browser" + "value": "%@ pt" + } + } + } + }, + "settings.globalHotkey.enable": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Enable System-Wide Hotkey" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ブラウザテーマ" + "value": "システム全体のホットキーを有効にする" } }, "ko": { "stringUnit": { "state": "translated", - "value": "브라우저 테마" + "value": "시스템 전체 단축키 활성화" } - }, - "nb": { + } + } + }, + "settings.globalHotkey.enable.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Nettlesertema" + "value": "Turn this on to show or hide all cmux windows from any app." } }, - "pl": { + "ja": { "stringUnit": { "state": "translated", - "value": "Motyw przeglądarki" + "value": "どのアプリからでも cmux のすべてのウィンドウを表示または非表示にするにはオンにします。" } }, - "pt-BR": { + "ko": { "stringUnit": { "state": "translated", - "value": "Tema do Navegador" + "value": "이 옵션을 켜면 어떤 앱에서든 모든 cmux 윈도우를 표시하거나 숨길 수 있습니다." + } + } + } + }, + "settings.globalHotkey.enable.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Press the shortcut from any app to show or hide all cmux windows." } }, - "ru": { + "ja": { "stringUnit": { "state": "translated", - "value": "Тема браузера" + "value": "どのアプリからでもこのショートカットで cmux のすべてのウィンドウを表示または非表示にできます。" } }, - "th": { + "ko": { "stringUnit": { "state": "translated", - "value": "ธีมเบราว์เซอร์" + "value": "어떤 앱에서든 단축키를 눌러 모든 cmux 윈도우를 표시하거나 숨깁니다." + } + } + } + }, + "settings.globalHotkey.note": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Use Command, Option, or Control with another key. No extra macOS permission is required." } }, - "tr": { + "ja": { "stringUnit": { "state": "translated", - "value": "Tarayıcı Teması" + "value": "Command、Option、または Control と別のキーを組み合わせてください。追加の macOS 権限は不要です。" } }, - "uk": { + "ko": { "stringUnit": { "state": "translated", - "value": "Тема браузера" + "value": "Command, Option 또는 Control과 다른 키를 함께 사용하세요. 추가 macOS 권한이 필요하지 않습니다." + } + } + } + }, + "settings.globalHotkey.shortcut": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Show/Hide All Windows" } }, - "zh-Hans": { + "ja": { "stringUnit": { "state": "translated", - "value": "浏览器主题" + "value": "すべてのウィンドウを表示/非表示" } }, - "zh-Hant": { + "ko": { "stringUnit": { "state": "translated", - "value": "瀏覽器主題" + "value": "모든 윈도우 표시/숨기기" } } } }, - "settings.browser.theme.subtitleForced": { + "settings.material.contentBackground": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "%@ يفرض نظام الألوان هذا للصفحات المتوافقة." + "value": "خلفية المحتوى" } }, "bs": { "stringUnit": { "state": "translated", - "value": "%@ nameće tu shemu boja za kompatibilne stranice." + "value": "Pozadina sadržaja" } }, "da": { "stringUnit": { "state": "translated", - "value": "%@ tvinger det farveskema for kompatible sider." + "value": "Indholdsbaggrund" } }, "de": { "stringUnit": { "state": "translated", - "value": "%@ erzwingt dieses Farbschema für kompatible Seiten." + "value": "Inhaltshintergrund" } }, "en": { "stringUnit": { "state": "translated", - "value": "%@ forces that color scheme for compatible pages." + "value": "Content Background" } }, "es": { "stringUnit": { "state": "translated", - "value": "%@ fuerza ese esquema de colores para las páginas compatibles." + "value": "Fondo de contenido" } }, "fr": { "stringUnit": { "state": "translated", - "value": "%@ impose ce jeu de couleurs aux pages compatibles." + "value": "Arrière-plan du contenu" } }, "it": { "stringUnit": { "state": "translated", - "value": "%@ impone quello schema di colori per le pagine compatibili." + "value": "Sfondo contenuto" } }, "ja": { "stringUnit": { "state": "translated", - "value": "%@は対応ページにそのカラースキームを強制します。" + "value": "コンテンツ背景" } }, "ko": { "stringUnit": { "state": "translated", - "value": "%@은(는) 호환 페이지에 해당 색상 구성표를 강제 적용합니다." + "value": "콘텐츠 배경" } }, "nb": { "stringUnit": { "state": "translated", - "value": "%@ tvinger det fargeskjemaet for kompatible sider." + "value": "Innholdsbakgrunn" } }, "pl": { "stringUnit": { "state": "translated", - "value": "%@ wymusza ten schemat kolorów dla zgodnych stron." + "value": "Tło zawartości" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "%@ força esse esquema de cores para páginas compatíveis." + "value": "Fundo de Conteúdo" } }, "ru": { "stringUnit": { "state": "translated", - "value": "%@ принудительно применяет эту цветовую схему для совместимых страниц." + "value": "Фон содержимого" } }, "th": { "stringUnit": { "state": "translated", - "value": "%@ บังคับใช้โทนสีนั้นสำหรับหน้าที่รองรับ" + "value": "พื้นหลังเนื้อหา" } }, "tr": { "stringUnit": { "state": "translated", - "value": "%@ uyumlu sayfalar için bu renk şemasını zorlar." + "value": "İçerik Arka Planı" } }, "uk": { "stringUnit": { "state": "translated", - "value": "%@ примусово встановлює цю кольорову схему для сумісних сторінок." + "value": "Фон вмісту" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "%@ 为兼容页面强制使用该配色方案。" + "value": "内容背景" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "%@ 會為相容的頁面強制套用該色彩配置。" + "value": "內容背景" } } } }, - "settings.browser.theme.subtitleSystem": { + "settings.material.fullScreenUI": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "النظام يتبع مظهر التطبيق و macOS." + "value": "واجهة ملء الشاشة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Sistemski prati izgled aplikacije i macOS." + "value": "UI punog ekrana" } }, "da": { "stringUnit": { "state": "translated", - "value": "System følger app- og macOS-udseende." + "value": "Fuldskærms-UI" } }, "de": { "stringUnit": { "state": "translated", - "value": "System folgt der App- und macOS-Darstellung." + "value": "Vollbild-UI" } }, "en": { "stringUnit": { "state": "translated", - "value": "System follows app and macOS appearance." + "value": "Full Screen UI" } }, "es": { "stringUnit": { "state": "translated", - "value": "Sistema sigue la apariencia de la app y macOS." + "value": "Interfaz a pantalla completa" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Système suit l'apparence de l'app et de macOS." + "value": "Interface plein écran" } }, "it": { "stringUnit": { "state": "translated", - "value": "Sistema segue l'aspetto dell'app e di macOS." + "value": "UI a schermo intero" } }, "ja": { "stringUnit": { "state": "translated", - "value": "システムはアプリとmacOSの外観に従います。" + "value": "フルスクリーンUI" } }, "ko": { "stringUnit": { "state": "translated", - "value": "시스템은 앱 및 macOS 외관을 따릅니다." + "value": "전체 화면 UI" } }, "nb": { "stringUnit": { "state": "translated", - "value": "System følger app- og macOS-utseende." + "value": "Fullskjerm-UI" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Systemowy podąża za wyglądem aplikacji i macOS." + "value": "Pełnoekranowy interfejs" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Sistema segue a aparência do app e do macOS." + "value": "Interface em Tela Cheia" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Системная тема следует за оформлением приложения и macOS." + "value": "Полноэкранный интерфейс" } }, "th": { "stringUnit": { "state": "translated", - "value": "ระบบจะตามธีมแอปและรูปลักษณ์ macOS" + "value": "UI เต็มหน้าจอ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Sistem, uygulama ve macOS görünümünü takip eder." + "value": "Tam Ekran Kullanıcı Arayüzü" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Системна слідує за програмою та зовнішнім виглядом macOS." + "value": "Повноекранний інтерфейс" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "系统跟随应用和 macOS 外观。" + "value": "全屏 UI" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "「系統」會跟隨 App 和 macOS 外觀。" + "value": "全螢幕 UI" } } } }, - "settings.config.action.openActiveEditor": { + "settings.material.headerView": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Open Active Config…" + "value": "عرض الرأس" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "有効な設定を開く…" - } - } - } - }, - "settings.config.action.openEditor": { - "extractionState": "manual", - "localizations": { - "en": { + "bs": { "stringUnit": { "state": "translated", - "value": "Open in Editor…" + "value": "Zaglavlje" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "エディタで開く…" - } - } - } - }, - "settings.config.action.reload": { - "extractionState": "manual", - "localizations": { - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Reload" + "value": "Headervisning" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "再読み込み" + "value": "Kopfansicht" } - } - } - }, - "settings.config.action.revealActiveFinder": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Reveal Active Config in Finder" + "value": "Header View" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "有効な設定をFinderで表示" - } - } - } - }, - "settings.config.action.revealFinder": { - "extractionState": "manual", - "localizations": { - "en": { + "es": { "stringUnit": { "state": "translated", - "value": "Reveal in Finder" + "value": "Vista de encabezado" } }, - "ja": { + "fr": { "stringUnit": { "state": "translated", - "value": "Finderで表示" + "value": "Vue d'en-tête" } - } - } - }, - "settings.config.action.save": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Save" + "value": "Vista intestazione" } }, "ja": { "stringUnit": { "state": "translated", - "value": "保存" + "value": "ヘッダビュー" } - } - } - }, - "settings.config.banner.cmux": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "This is the cmux Ghostty config selected for this build. Edit it here, then Save to reload cmux." + "value": "헤더 뷰" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "これはこのビルドで選択されている cmux Ghostty 設定です。ここで編集し、保存すると cmux が再読み込みされます。" + "value": "Topptekstvisning" } - } - } - }, - "settings.config.banner.synced": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "This is a generated preview of the effective config. Edit the cmux tab to change what cmux reads." + "value": "Widok nagłówka" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "これは実効設定の生成プレビューです。cmux が読み込む内容を変更するには cmux タブを編集してください。" + "value": "Cabeçalho" } - } - } - }, - "settings.config.banner.syncedNoGhostty": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "This is a generated preview of the effective config. No base Ghostty config file was found, so only cmux overrides are shown." + "value": "Заголовок" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "これは実効設定の生成プレビューです。ベースの Ghostty 設定ファイルが見つからなかったため、cmux の上書き設定のみを表示しています。" + "value": "มุมมองส่วนหัว" } - } - } - }, - "settings.config.source.cmux": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "cmux" + "value": "Başlık Görünümü" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "cmux" + "value": "Заголовок" } - } - } - }, - "settings.config.source.label": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Config Source" + "value": "头部视图" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "構成ソース" + "value": "標題列" } } } }, - "settings.config.source.synced": { + "settings.material.hudWindow": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "synced" + "value": "نافذة HUD" } }, - "ja": { + "bs": { "stringUnit": { "state": "translated", - "value": "同期" + "value": "HUD prozor" } - } - } - }, - "settings.config.status.openFailed": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "da": { "stringUnit": { "state": "translated", - "value": "Couldn't open the cmux config." + "value": "HUD-vindue" } }, - "ja": { + "de": { "stringUnit": { "state": "translated", - "value": "cmux 設定を開けませんでした。" + "value": "HUD-Fenster" } - } - } - }, - "settings.config.status.reloaded": { - "extractionState": "manual", - "localizations": { + }, "en": { "stringUnit": { "state": "translated", - "value": "Reloaded configuration from disk." + "value": "HUD Window" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "ディスクから構成を再読み込みしました。" - } - } - } - }, - "settings.config.status.saveFailed": { - "extractionState": "manual", - "localizations": { - "en": { + "es": { "stringUnit": { "state": "translated", - "value": "Couldn't save the cmux config." + "value": "Ventana HUD" } }, - "ja": { + "fr": { "stringUnit": { "state": "translated", - "value": "cmux 設定を保存できませんでした。" + "value": "Fenêtre HUD" } - } - } - }, - "settings.config.status.saved": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Saved to cmux config and reloaded." + "value": "Finestra HUD" } }, "ja": { "stringUnit": { "state": "translated", - "value": "cmux 設定に保存し、再読み込みしました。" + "value": "HUDウインドウ" } - } - } - }, - "settings.config.windowTitle": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "Config" + "value": "HUD 윈도우" } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "構成" + "value": "HUD-vindu" } - } - } - }, - "settings.customSidebars.enabled": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Show Custom Sidebars" + "value": "Okno HUD" } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "カスタムサイドバーを表示" + "value": "Janela HUD" } - } - } - }, - "settings.customSidebars.enabled.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Hides custom sidebars from the sidebar picker until you enable them here." + "value": "HUD-окно" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "ここで有効にするまで、カスタムサイドバーをサイドバーピッカーに表示しません。" + "value": "หน้าต่าง HUD" } - } - } - }, - "settings.customSidebars.enabled.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Lists your sidebars from ~/.config/cmux/sidebars in the sidebar picker." + "value": "HUD Penceresi" } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "~/.config/cmux/sidebars のサイドバーをサイドバーピッカーに表示します。" + "value": "HUD-вікно" } - } - } - }, - "settings.customSidebars.note": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Custom sidebars are SwiftUI-style files in ~/.config/cmux/sidebars. Pick one from the sidebar toggle button's right-click menu; edits hot-reload on save. Use the in-app renderer only for sidebars you trust." + "value": "HUD 窗口" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "カスタムサイドバーは ~/.config/cmux/sidebars にある SwiftUI 形式のファイルです。サイドバー切り替えボタンの右クリックメニューから選択でき、保存すると即時に再読み込みされます。アプリ内レンダラーは信頼できるサイドバーのみに使用してください。" + "value": "HUD 視窗" } } } }, - "settings.customSidebars.renderer": { + "settings.material.liquidGlass": { "extractionState": "manual", "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Renderer" + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "レンダラー" - } - } - } - }, - "settings.error.alert.dismiss": { - "localizations": { - "en": { + "bs": { "stringUnit": { "state": "translated", - "value": "OK" + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "OK" - } - } - } - }, - "settings.error.alert.title": { - "localizations": { - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Couldn't save setting" + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "設定を保存できませんでした" - } - } - } - }, - "settings.fontSize.valuePoints": { - "extractionState": "manual", - "localizations": { - "en": { + "de": { "stringUnit": { "state": "translated", - "value": "%@ pt" + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "%@ pt" - } - } - } - }, - "settings.globalHotkey.enable": { - "extractionState": "manual", - "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Enable System-Wide Hotkey" + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { + "es": { "stringUnit": { "state": "translated", - "value": "システム全体のホットキーを有効にする" + "value": "Liquid Glass (macOS 26+)" } }, - "ko": { + "fr": { "stringUnit": { "state": "translated", - "value": "시스템 전체 단축키 활성화" + "value": "Liquid Glass (macOS 26+)" } - } - } - }, - "settings.globalHotkey.enable.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Turn this on to show or hide all cmux windows from any app." + "value": "Liquid Glass (macOS 26+)" } }, "ja": { "stringUnit": { "state": "translated", - "value": "どのアプリからでも cmux のすべてのウィンドウを表示または非表示にするにはオンにします。" + "value": "Liquid Glass(macOS 26以降)" } }, "ko": { "stringUnit": { "state": "translated", - "value": "이 옵션을 켜면 어떤 앱에서든 모든 cmux 윈도우를 표시하거나 숨길 수 있습니다." + "value": "Liquid Glass (macOS 26+)" } - } - } - }, - "settings.globalHotkey.enable.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "nb": { "stringUnit": { "state": "translated", - "value": "Press the shortcut from any app to show or hide all cmux windows." + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { + "pl": { "stringUnit": { "state": "translated", - "value": "どのアプリからでもこのショートカットで cmux のすべてのウィンドウを表示または非表示にできます。" + "value": "Liquid Glass (macOS 26+)" } }, - "ko": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "어떤 앱에서든 단축키를 눌러 모든 cmux 윈도우를 표시하거나 숨깁니다." + "value": "Liquid Glass (macOS 26+)" } - } - } - }, - "settings.globalHotkey.note": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "Use Command, Option, or Control with another key. No extra macOS permission is required." + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "Command、Option、または Control と別のキーを組み合わせてください。追加の macOS 権限は不要です。" + "value": "Liquid Glass (macOS 26+)" } }, - "ko": { + "tr": { "stringUnit": { "state": "translated", - "value": "Command, Option 또는 Control과 다른 키를 함께 사용하세요. 추가 macOS 권한이 필요하지 않습니다." + "value": "Liquid Glass (macOS 26+)" } - } - } - }, - "settings.globalHotkey.shortcut": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "uk": { "stringUnit": { "state": "translated", - "value": "Show/Hide All Windows" + "value": "Liquid Glass (macOS 26+)" } }, - "ja": { + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "すべてのウィンドウを表示/非表示" + "value": "Liquid Glass (macOS 26+)" } }, - "ko": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "모든 윈도우 표시/숨기기" + "value": "Liquid Glass (macOS 26+)" } } } }, - "settings.material.contentBackground": { + "settings.material.menu": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "خلفية المحتوى" + "value": "القائمة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Pozadina sadržaja" + "value": "Meni" } }, "da": { "stringUnit": { "state": "translated", - "value": "Indholdsbaggrund" + "value": "Menu" } }, "de": { "stringUnit": { "state": "translated", - "value": "Inhaltshintergrund" + "value": "Menü" } }, "en": { "stringUnit": { "state": "translated", - "value": "Content Background" + "value": "Menu" } }, "es": { "stringUnit": { "state": "translated", - "value": "Fondo de contenido" + "value": "Menú" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Arrière-plan du contenu" + "value": "Menu" } }, "it": { "stringUnit": { "state": "translated", - "value": "Sfondo contenuto" + "value": "Menu" } }, "ja": { "stringUnit": { "state": "translated", - "value": "コンテンツ背景" + "value": "メニュー" } }, "ko": { "stringUnit": { "state": "translated", - "value": "콘텐츠 배경" + "value": "메뉴" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Innholdsbakgrunn" + "value": "Meny" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Tło zawartości" + "value": "Menu" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Fundo de Conteúdo" + "value": "Menu" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Фон содержимого" + "value": "Меню" } }, "th": { "stringUnit": { "state": "translated", - "value": "พื้นหลังเนื้อหา" + "value": "เมนู" } }, "tr": { "stringUnit": { "state": "translated", - "value": "İçerik Arka Planı" + "value": "Menü" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Фон вмісту" + "value": "Меню" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "内容背景" + "value": "菜单" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "內容背景" + "value": "選單" } } } }, - "settings.material.fullScreenUI": { + "settings.material.none": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "واجهة ملء الشاشة" + "value": "بدون" } }, "bs": { "stringUnit": { "state": "translated", - "value": "UI punog ekrana" + "value": "Ništa" } }, "da": { "stringUnit": { "state": "translated", - "value": "Fuldskærms-UI" + "value": "Ingen" } }, "de": { "stringUnit": { "state": "translated", - "value": "Vollbild-UI" + "value": "Keine" } }, "en": { "stringUnit": { "state": "translated", - "value": "Full Screen UI" + "value": "None" } }, "es": { "stringUnit": { "state": "translated", - "value": "Interfaz a pantalla completa" + "value": "Ninguno" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Interface plein écran" + "value": "Aucun" } }, "it": { "stringUnit": { "state": "translated", - "value": "UI a schermo intero" + "value": "Nessuno" } }, "ja": { "stringUnit": { "state": "translated", - "value": "フルスクリーンUI" + "value": "なし" } }, "ko": { "stringUnit": { "state": "translated", - "value": "전체 화면 UI" + "value": "없음" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Fullskjerm-UI" + "value": "Ingen" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Pełnoekranowy interfejs" + "value": "Brak" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Interface em Tela Cheia" + "value": "Nenhum" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Полноэкранный интерфейс" + "value": "Нет" } }, "th": { "stringUnit": { "state": "translated", - "value": "UI เต็มหน้าจอ" + "value": "ไม่มี" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Tam Ekran Kullanıcı Arayüzü" + "value": "Yok" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Повноекранний інтерфейс" + "value": "Немає" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "全屏 UI" + "value": "无" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "全螢幕 UI" + "value": "無" } } } }, - "settings.material.headerView": { + "settings.material.popover": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "عرض الرأس" + "value": "نافذة منبثقة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Zaglavlje" + "value": "Iskočni prozor" } }, "da": { "stringUnit": { "state": "translated", - "value": "Headervisning" + "value": "Popover" } }, "de": { "stringUnit": { "state": "translated", - "value": "Kopfansicht" + "value": "Popover" } }, "en": { "stringUnit": { "state": "translated", - "value": "Header View" + "value": "Popover" } }, "es": { "stringUnit": { "state": "translated", - "value": "Vista de encabezado" + "value": "Popover" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Vue d'en-tête" + "value": "Popover" } }, "it": { "stringUnit": { "state": "translated", - "value": "Vista intestazione" + "value": "Popover" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ヘッダビュー" + "value": "ポップオーバー" } }, "ko": { "stringUnit": { "state": "translated", - "value": "헤더 뷰" + "value": "팝오버" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Topptekstvisning" + "value": "Popover" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Widok nagłówka" + "value": "Wyskakujące okno" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Cabeçalho" + "value": "Popover" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Заголовок" + "value": "Всплывающее окно" } }, "th": { "stringUnit": { "state": "translated", - "value": "มุมมองส่วนหัว" + "value": "ป็อปโอเวอร์" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Başlık Görünümü" + "value": "Açılır Pencere" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Заголовок" + "value": "Спливне вікно" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "头部视图" + "value": "弹出框" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "標題列" + "value": "彈出框" } } } }, - "settings.material.hudWindow": { + "settings.material.sheet": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "نافذة HUD" + "value": "ورقة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "HUD prozor" + "value": "List" } }, "da": { "stringUnit": { "state": "translated", - "value": "HUD-vindue" + "value": "Ark" } }, "de": { "stringUnit": { "state": "translated", - "value": "HUD-Fenster" + "value": "Dialogblatt" } }, "en": { "stringUnit": { "state": "translated", - "value": "HUD Window" + "value": "Sheet" } }, "es": { "stringUnit": { "state": "translated", - "value": "Ventana HUD" + "value": "Hoja" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Fenêtre HUD" + "value": "Feuille" } }, "it": { "stringUnit": { "state": "translated", - "value": "Finestra HUD" + "value": "Foglio" } }, "ja": { "stringUnit": { "state": "translated", - "value": "HUDウインドウ" + "value": "シート" } }, "ko": { "stringUnit": { "state": "translated", - "value": "HUD 윈도우" + "value": "시트" } }, "nb": { "stringUnit": { "state": "translated", - "value": "HUD-vindu" + "value": "Ark" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Okno HUD" + "value": "Arkusz" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Janela HUD" + "value": "Folha" } }, "ru": { "stringUnit": { "state": "translated", - "value": "HUD-окно" + "value": "Лист" } }, "th": { "stringUnit": { "state": "translated", - "value": "หน้าต่าง HUD" + "value": "ชีท" } }, "tr": { "stringUnit": { "state": "translated", - "value": "HUD Penceresi" + "value": "Sayfa" } }, "uk": { "stringUnit": { "state": "translated", - "value": "HUD-вікно" + "value": "Аркуш" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "HUD 窗口" + "value": "工作表" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "HUD 視窗" + "value": "工作表" } } } }, - "settings.material.liquidGlass": { + "settings.material.sidebar": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "الشريط الجانبي" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Bočna traka" } }, "da": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Sidebjælke" } }, "de": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Seitenleiste" } }, "en": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Sidebar" } }, "es": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Barra lateral" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Barre latérale" } }, "it": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Barra laterale" } }, "ja": { "stringUnit": { "state": "translated", - "value": "Liquid Glass(macOS 26以降)" + "value": "サイドバー" } }, "ko": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "사이드바" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Sidepanel" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Pasek boczny" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Barra Lateral" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Боковая панель" } }, "th": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "แถบด้านข้าง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Kenar Çubuğu" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "Бічна панель" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "侧边栏" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "Liquid Glass (macOS 26+)" + "value": "側邊欄" } } } }, - "settings.material.menu": { + "settings.material.toolTip": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "القائمة" + "value": "تلميح أداة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Meni" + "value": "Opis alata" } }, "da": { "stringUnit": { "state": "translated", - "value": "Menu" + "value": "Værktøjstip" } }, "de": { "stringUnit": { "state": "translated", - "value": "Menü" + "value": "Tooltip" } }, "en": { "stringUnit": { "state": "translated", - "value": "Menu" + "value": "Tool Tip" } }, "es": { "stringUnit": { "state": "translated", - "value": "Menú" + "value": "Descripción emergente" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Menu" + "value": "Info-bulle" } }, "it": { "stringUnit": { "state": "translated", - "value": "Menu" + "value": "Suggerimento" } }, "ja": { "stringUnit": { "state": "translated", - "value": "メニュー" + "value": "ツールチップ" } }, "ko": { "stringUnit": { "state": "translated", - "value": "메뉴" + "value": "도구 설명" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Meny" + "value": "Verktøytips" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Menu" + "value": "Podpowiedź" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Menu" + "value": "Dica de Ferramenta" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Меню" + "value": "Подсказка" } }, "th": { "stringUnit": { "state": "translated", - "value": "เมนู" + "value": "คำแนะนำเครื่องมือ" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Menü" + "value": "Araç İpucu" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Меню" + "value": "Підказка" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "菜单" + "value": "工具提示" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "選單" + "value": "工具提示" } } } }, - "settings.material.none": { + "settings.material.underWindow": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "بدون" + "value": "تحت النافذة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Ništa" + "value": "Ispod prozora" } }, "da": { "stringUnit": { "state": "translated", - "value": "Ingen" + "value": "Under vindue" } }, "de": { "stringUnit": { "state": "translated", - "value": "Keine" + "value": "Unter dem Fenster" } }, "en": { "stringUnit": { "state": "translated", - "value": "None" + "value": "Under Window" } }, "es": { "stringUnit": { "state": "translated", - "value": "Ninguno" + "value": "Debajo de la ventana" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Aucun" + "value": "Sous la fenêtre" } }, "it": { "stringUnit": { "state": "translated", - "value": "Nessuno" + "value": "Sotto la finestra" } }, "ja": { "stringUnit": { "state": "translated", - "value": "なし" + "value": "ウインドウ下" } }, "ko": { "stringUnit": { "state": "translated", - "value": "없음" + "value": "윈도우 아래" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Ingen" + "value": "Under vinduet" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Brak" + "value": "Pod oknem" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Nenhum" + "value": "Sob a Janela" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Нет" + "value": "Под окном" } }, "th": { "stringUnit": { "state": "translated", - "value": "ไม่มี" + "value": "ใต้หน้าต่าง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Yok" + "value": "Pencere Altı" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Немає" + "value": "Під вікном" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "无" + "value": "窗口底部" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "無" + "value": "視窗下方" } } } }, - "settings.material.popover": { + "settings.material.windowBackground": { "extractionState": "manual", "localizations": { "ar": { "stringUnit": { "state": "translated", - "value": "نافذة منبثقة" + "value": "خلفية النافذة" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Iskočni prozor" + "value": "Pozadina prozora" } }, "da": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Vinduesbaggrund" } }, "de": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Fensterhintergrund" } }, "en": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Window Background" } }, "es": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Fondo de ventana" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Arrière-plan de la fenêtre" } }, "it": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Sfondo finestra" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ポップオーバー" + "value": "ウインドウ背景" } }, "ko": { "stringUnit": { "state": "translated", - "value": "팝오버" + "value": "윈도우 배경" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Vindubakgrunn" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Wyskakujące okno" + "value": "Tło okna" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Popover" + "value": "Fundo da Janela" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Всплывающее окно" + "value": "Фон окна" } }, "th": { "stringUnit": { "state": "translated", - "value": "ป็อปโอเวอร์" + "value": "พื้นหลังหน้าต่าง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Açılır Pencere" + "value": "Pencere Arka Planı" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Спливне вікно" + "value": "Фон вікна" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "弹出框" + "value": "窗口背景" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "彈出框" + "value": "視窗背景" } } } }, - "settings.material.sheet": { + "settings.mobile.artifactFolderAccess": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "ورقة" + "value": "Folder Access" } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "List" + "value": "フォルダアクセス" } - }, - "da": { + } + } + }, + "settings.mobile.artifactFolderAccess.oneLevel": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Ark" + "value": "One Level" } }, - "de": { + "ja": { "stringUnit": { "state": "translated", - "value": "Dialogblatt" + "value": "1 階層" } - }, + } + } + }, + "settings.mobile.artifactFolderAccess.subtree": { + "extractionState": "manual", + "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Sheet" + "value": "Entire Subtree" } }, - "es": { + "ja": { "stringUnit": { "state": "translated", - "value": "Hoja" + "value": "サブツリー全体" } - }, - "fr": { + } + } + }, + "settings.mobile.artifactFolderAccess.subtitleOneLevel": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Feuille" + "value": "Limits iOS to immediate children of referenced or visible folders." } }, - "it": { + "ja": { "stringUnit": { "state": "translated", - "value": "Foglio" + "value": "iOS からのアクセスを、参照された、または表示中のフォルダの直下の項目に制限します。" + } + } + } + }, + "settings.mobile.artifactFolderAccess.subtitleSubtree": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Lets iOS browse any item inside a folder referenced by chat or visible in a terminal." } }, "ja": { "stringUnit": { "state": "translated", - "value": "シート" + "value": "チャットで参照された、またはターミナルに表示されたフォルダ内のすべての項目を iOS から参照できるようにします。" } - }, - "ko": { + } + } + }, + "settings.mobile.connections": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "시트" + "value": "Connected Devices" } }, - "nb": { + "ja": { "stringUnit": { "state": "translated", - "value": "Ark" + "value": "接続中のデバイス" } - }, - "pl": { + } + } + }, + "settings.mobile.connections.subtitle": { + "extractionState": "manual", + "localizations": { + "en": { "stringUnit": { "state": "translated", - "value": "Arkusz" + "value": "iOS devices currently attached to this Mac." } }, - "pt-BR": { + "ja": { "stringUnit": { "state": "translated", - "value": "Folha" + "value": "現在この Mac に接続している iOS デバイス。" + } + } + } + }, + "settings.mobile.displayName": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Display Name" } }, - "ru": { + "ja": { "stringUnit": { "state": "translated", - "value": "Лист" + "value": "表示名" + } + } + } + }, + "settings.mobile.displayName.placeholder": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "This Mac's name" } }, - "th": { + "ja": { "stringUnit": { "state": "translated", - "value": "ชีท" + "value": "この Mac の名前" + } + } + } + }, + "settings.mobile.displayName.subtitle": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Name the iOS app shows for this Mac when pairing. Empty uses this Mac's name." } }, - "tr": { + "ja": { "stringUnit": { "state": "translated", - "value": "Sayfa" + "value": "ペアリング時に iOS アプリがこの Mac に表示する名前。空の場合はこの Mac の名前を使用します。" + } + } + } + }, + "settings.mobile.iOSPairingHost": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "iOS Pairing" } }, - "uk": { + "ja": { "stringUnit": { "state": "translated", - "value": "Аркуш" + "value": "iOS ペアリング" + } + } + } + }, + "settings.mobile.iOSPairingHost.subtitleOff": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Keeps the Mac-side iOS pairing listener off until you enable it here." } }, - "zh-Hans": { + "ja": { "stringUnit": { "state": "translated", - "value": "工作表" + "value": "ここで有効にするまで、Mac 側の iOS ペアリングリスナーをオフにします。" + } + } + } + }, + "settings.mobile.iOSPairingHost.subtitleOn": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Allows the iOS app to discover and sync with this Mac on your local network." } }, - "zh-Hant": { + "ja": { "stringUnit": { "state": "translated", - "value": "工作表" + "value": "iOS アプリがローカルネットワーク上でこの Mac を検出し、同期できるようにします。" } } } }, - "settings.material.sidebar": { + "settings.mobile.manualHost": { "extractionState": "manual", "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Manual Host" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "手動ホスト" + } + }, "ar": { "stringUnit": { "state": "translated", - "value": "الشريط الجانبي" + "value": "المضيف اليدوي" } }, "bs": { "stringUnit": { "state": "translated", - "value": "Bočna traka" + "value": "Ručni host" } }, "da": { "stringUnit": { "state": "translated", - "value": "Sidebjælke" + "value": "Manuel vært" } }, "de": { "stringUnit": { "state": "translated", - "value": "Seitenleiste" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Sidebar" + "value": "Manueller Host" } }, "es": { "stringUnit": { "state": "translated", - "value": "Barra lateral" + "value": "Host manual" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Barre latérale" + "value": "Hôte manuel" } }, "it": { "stringUnit": { "state": "translated", - "value": "Barra laterale" + "value": "Host manuale" } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "サイドバー" + "value": "ម៉ាស៊ីនបម្រើដោយដៃ" } }, "ko": { "stringUnit": { "state": "translated", - "value": "사이드바" + "value": "수동 호스트" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Sidepanel" + "value": "Manuell vert" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Pasek boczny" + "value": "Host ręczny" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Barra Lateral" + "value": "Host manual" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Боковая панель" + "value": "Ручной хост" } }, "th": { "stringUnit": { "state": "translated", - "value": "แถบด้านข้าง" + "value": "โฮสต์แบบกำหนดเอง" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Kenar Çubuğu" + "value": "Manuel ana bilgisayar" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Бічна панель" + "value": "Ручний хост" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "侧边栏" + "value": "手动主机" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "側邊欄" + "value": "手動主機" } } } }, - "settings.material.toolTip": { + "settings.mobile.manualHost.invalid": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "تلميح أداة" + "value": "Enter a host or IP address, without spaces or URL paths." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Opis alata" + "value": "スペースや URL パスを含めず、ホストまたは IP アドレスを入力してください。" } }, - "da": { + "ar": { "stringUnit": { "state": "translated", - "value": "Værktøjstip" + "value": "أدخل مضيفًا أو عنوان IP بدون مسافات أو مسارات URL." } }, - "de": { + "bs": { "stringUnit": { "state": "translated", - "value": "Tooltip" + "value": "Unesite host ili IP adresu, bez razmaka ili URL putanja." } }, - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Tool Tip" + "value": "Indtast en vært eller IP-adresse uden mellemrum eller URL-stier." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Gib einen Host oder eine IP-Adresse ohne Leerzeichen oder URL-Pfade ein." } }, "es": { "stringUnit": { "state": "translated", - "value": "Descripción emergente" + "value": "Introduce un host o una dirección IP, sin espacios ni rutas URL." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Info-bulle" + "value": "Saisissez un hôte ou une adresse IP, sans espaces ni chemins d’URL." } }, "it": { "stringUnit": { "state": "translated", - "value": "Suggerimento" + "value": "Inserisci un host o un indirizzo IP, senza spazi o percorsi URL." } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "ツールチップ" + "value": "បញ្ចូលម៉ាស៊ីនបម្រើ ឬអាសយដ្ឋាន IP ដោយគ្មានចន្លោះ ឬផ្លូវ URL។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "도구 설명" + "value": "공백이나 URL 경로 없이 호스트 또는 IP 주소를 입력하세요." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Verktøytips" + "value": "Skriv inn en vert eller IP-adresse uten mellomrom eller URL-baner." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Podpowiedź" + "value": "Wpisz host lub adres IP, bez spacji i ścieżek URL." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Dica de Ferramenta" + "value": "Insira um host ou endereço IP, sem espaços nem caminhos de URL." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Подсказка" + "value": "Введите хост или IP-адрес без пробелов и путей URL." } }, "th": { "stringUnit": { "state": "translated", - "value": "คำแนะนำเครื่องมือ" + "value": "ป้อนโฮสต์หรือที่อยู่ IP โดยไม่มีช่องว่างหรือพาธ URL" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Araç İpucu" + "value": "Boşluk veya URL yolu olmadan bir ana bilgisayar ya da IP adresi girin." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Підказка" + "value": "Введіть хост або IP-адресу без пробілів чи шляхів URL." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "工具提示" + "value": "请输入主机或 IP 地址,不要包含空格或 URL 路径。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "工具提示" + "value": "請輸入主機或 IP 位址,不要包含空格或 URL 路徑。" } } } }, - "settings.material.underWindow": { + "settings.mobile.manualHost.placeholder": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "تحت النافذة" + "value": "192.168.1.23 or mac.local" } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Ispod prozora" + "value": "192.168.1.23 または mac.local" } }, - "da": { + "ar": { "stringUnit": { "state": "translated", - "value": "Under vindue" + "value": "192.168.1.23 أو mac.local" } }, - "de": { + "bs": { "stringUnit": { "state": "translated", - "value": "Unter dem Fenster" + "value": "192.168.1.23 ili mac.local" } }, - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Under Window" + "value": "192.168.1.23 eller mac.local" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "192.168.1.23 oder mac.local" } }, "es": { "stringUnit": { "state": "translated", - "value": "Debajo de la ventana" + "value": "192.168.1.23 o mac.local" } }, "fr": { "stringUnit": { "state": "translated", - "value": "Sous la fenêtre" + "value": "192.168.1.23 ou mac.local" } }, "it": { "stringUnit": { "state": "translated", - "value": "Sotto la finestra" + "value": "192.168.1.23 o mac.local" } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "ウインドウ下" + "value": "192.168.1.23 ឬ mac.local" } }, "ko": { "stringUnit": { "state": "translated", - "value": "윈도우 아래" + "value": "192.168.1.23 또는 mac.local" } }, "nb": { "stringUnit": { "state": "translated", - "value": "Under vinduet" + "value": "192.168.1.23 eller mac.local" } }, "pl": { "stringUnit": { "state": "translated", - "value": "Pod oknem" + "value": "192.168.1.23 lub mac.local" } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Sob a Janela" + "value": "192.168.1.23 ou mac.local" } }, "ru": { "stringUnit": { "state": "translated", - "value": "Под окном" + "value": "192.168.1.23 или mac.local" } }, "th": { "stringUnit": { "state": "translated", - "value": "ใต้หน้าต่าง" + "value": "192.168.1.23 หรือ mac.local" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Pencere Altı" + "value": "192.168.1.23 veya mac.local" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Під вікном" + "value": "192.168.1.23 або mac.local" } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "窗口底部" + "value": "192.168.1.23 或 mac.local" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "視窗下方" + "value": "192.168.1.23 或 mac.local" } } } }, - "settings.material.windowBackground": { + "settings.mobile.manualHost.subtitle": { "extractionState": "manual", "localizations": { - "ar": { + "en": { "stringUnit": { "state": "translated", - "value": "خلفية النافذة" + "value": "Optional LAN IP or DNS host to advertise when this Mac cannot run Tailscale." } }, - "bs": { + "ja": { "stringUnit": { "state": "translated", - "value": "Pozadina prozora" + "value": "この Mac で Tailscale を実行できない場合に通知する任意の LAN IP または DNS ホスト。" } }, - "da": { + "ar": { "stringUnit": { "state": "translated", - "value": "Vinduesbaggrund" + "value": "عنوان IP للشبكة المحلية أو مضيف DNS اختياري للإعلان عنه عندما لا يستطيع هذا الـ Mac تشغيل Tailscale." } }, - "de": { + "bs": { "stringUnit": { "state": "translated", - "value": "Fensterhintergrund" + "value": "Opcionalni LAN IP ili DNS host koji se oglašava kada ovaj Mac ne može pokrenuti Tailscale." } }, - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Window Background" + "value": "Valgfri LAN-IP eller DNS-vært, der annonceres, når denne Mac ikke kan køre Tailscale." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Optionale LAN-IP oder DNS-Host, der angekündigt wird, wenn dieser Mac Tailscale nicht ausführen kann." } }, "es": { "stringUnit": { "state": "translated", - "value": "Fondo de ventana" + "value": "IP de LAN u host DNS opcional para anunciar cuando este Mac no puede ejecutar Tailscale." } }, "fr": { "stringUnit": { "state": "translated", - "value": "Arrière-plan de la fenêtre" + "value": "IP LAN ou hôte DNS facultatif à annoncer lorsque ce Mac ne peut pas exécuter Tailscale." } }, "it": { "stringUnit": { "state": "translated", - "value": "Sfondo finestra" + "value": "IP LAN o host DNS facoltativo da pubblicizzare quando questo Mac non può eseguire Tailscale." } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "ウインドウ背景" + "value": "LAN IP ឬម៉ាស៊ីនបម្រើ DNS ស្រេចចិត្ត ដើម្បីផ្សព្វផ្សាយនៅពេល Mac នេះមិនអាចដំណើរការ Tailscale បាន។" } }, "ko": { "stringUnit": { "state": "translated", - "value": "윈도우 배경" + "value": "이 Mac에서 Tailscale을 실행할 수 없을 때 알릴 선택적 LAN IP 또는 DNS 호스트입니다." } }, "nb": { "stringUnit": { "state": "translated", - "value": "Vindubakgrunn" + "value": "Valgfri LAN-IP eller DNS-vert som annonseres når denne Macen ikke kan kjøre Tailscale." } }, "pl": { "stringUnit": { "state": "translated", - "value": "Tło okna" + "value": "Opcjonalny adres IP LAN lub host DNS do ogłaszania, gdy ten Mac nie może uruchomić Tailscale." } }, "pt-BR": { "stringUnit": { "state": "translated", - "value": "Fundo da Janela" + "value": "IP de LAN ou host DNS opcional para anunciar quando este Mac não puder executar o Tailscale." } }, "ru": { "stringUnit": { "state": "translated", - "value": "Фон окна" + "value": "Необязательный IP-адрес LAN или DNS-хост для объявления, когда этот Mac не может запускать Tailscale." } }, "th": { "stringUnit": { "state": "translated", - "value": "พื้นหลังหน้าต่าง" + "value": "LAN IP หรือโฮสต์ DNS ที่จะประกาศเมื่อ Mac เครื่องนี้ไม่สามารถเรียกใช้ Tailscale ได้" } }, "tr": { "stringUnit": { "state": "translated", - "value": "Pencere Arka Planı" + "value": "Bu Mac Tailscale çalıştıramadığında duyurulacak isteğe bağlı LAN IP veya DNS ana bilgisayarı." } }, "uk": { "stringUnit": { "state": "translated", - "value": "Фон вікна" + "value": "Необов’язкова LAN IP-адреса або DNS-хост для оголошення, коли цей Mac не може запускати Tailscale." } }, "zh-Hans": { "stringUnit": { "state": "translated", - "value": "窗口背景" + "value": "当这台 Mac 无法运行 Tailscale 时要通告的可选 LAN IP 或 DNS 主机。" } }, "zh-Hant": { "stringUnit": { "state": "translated", - "value": "視窗背景" + "value": "當這部 Mac 無法執行 Tailscale 時要公告的選用 LAN IP 或 DNS 主機。" } } } }, - "settings.mobile.artifactFolderAccess": { + "settings.mobile.manualHost.warning": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "Folder Access" + "value": "Manual hosts are explicit trust routes. The iOS app will ask before sending credentials. With a subnet router, iPhone to router may be encrypted, but router to Mac is normal LAN traffic." } }, "ja": { "stringUnit": { "state": "translated", - "value": "フォルダアクセス" - } - } - } - }, - "settings.mobile.artifactFolderAccess.oneLevel": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "One Level" + "value": "手動ホストは明示的に信頼するルートです。認証情報を送信する前に iOS アプリで確認が表示されます。サブネットルーターを使う場合、iPhone からルーターまでは暗号化されることがありますが、ルーターから Mac までは通常の LAN 通信です。" } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "1 階層" - } - } - } - }, - "settings.mobile.artifactFolderAccess.subtree": { - "extractionState": "manual", - "localizations": { - "en": { + "ar": { "stringUnit": { "state": "translated", - "value": "Entire Subtree" + "value": "المضيفون اليدويون مسارات ثقة صريحة. سيطلب تطبيق iOS التأكيد قبل إرسال بيانات الاعتماد. مع موجّه شبكة فرعية، قد يكون الاتصال من iPhone إلى الموجّه مشفرًا، لكن الاتصال من الموجّه إلى Mac هو حركة LAN عادية." } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "サブツリー全体" - } - } - } - }, - "settings.mobile.artifactFolderAccess.subtitleOneLevel": { - "extractionState": "manual", - "localizations": { - "en": { + "bs": { "stringUnit": { "state": "translated", - "value": "Limits iOS to immediate children of referenced or visible folders." + "value": "Ručni hostovi su izričito povjerljive rute. iOS aplikacija će pitati prije slanja vjerodajnica. Uz subnet ruter, iPhone do rutera može biti šifriran, ali ruter do Maca je običan LAN promet." } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "iOS からのアクセスを、参照された、または表示中のフォルダの直下の項目に制限します。" - } - } - } - }, - "settings.mobile.artifactFolderAccess.subtitleSubtree": { - "extractionState": "manual", - "localizations": { - "en": { + "da": { "stringUnit": { "state": "translated", - "value": "Lets iOS browse any item inside a folder referenced by chat or visible in a terminal." + "value": "Manuelle værter er eksplicitte tillidsruter. iOS-appen spørger, før den sender legitimationsoplysninger. Med en subnet-router kan iPhone til router være krypteret, men router til Mac er almindelig LAN-trafik." } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "チャットで参照された、またはターミナルに表示されたフォルダ内のすべての項目を iOS から参照できるようにします。" - } - } - } - }, - "settings.mobile.connections": { - "extractionState": "manual", - "localizations": { - "en": { + "de": { "stringUnit": { "state": "translated", - "value": "Connected Devices" + "value": "Manuelle Hosts sind ausdrücklich vertrauenswürdige Routen. Die iOS-App fragt nach, bevor Anmeldedaten gesendet werden. Bei einem Subnetzrouter kann iPhone-zu-Router verschlüsselt sein, Router-zu-Mac ist jedoch normaler LAN-Verkehr." } }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "接続中のデバイス" - } - } - } - }, - "settings.mobile.connections.subtitle": { - "extractionState": "manual", - "localizations": { - "en": { + "es": { "stringUnit": { "state": "translated", - "value": "iOS devices currently attached to this Mac." + "value": "Los hosts manuales son rutas de confianza explícita. La app de iOS preguntará antes de enviar credenciales. Con un router de subred, el tramo del iPhone al router puede estar cifrado, pero del router al Mac es tráfico LAN normal." } }, - "ja": { + "fr": { "stringUnit": { "state": "translated", - "value": "現在この Mac に接続している iOS デバイス。" + "value": "Les hôtes manuels sont des routes de confiance explicites. L’app iOS demandera confirmation avant d’envoyer des identifiants. Avec un routeur de sous-réseau, le trajet iPhone vers routeur peut être chiffré, mais le trajet routeur vers Mac est du trafic LAN normal." } - } - } - }, - "settings.mobile.displayName": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "it": { "stringUnit": { "state": "translated", - "value": "Display Name" + "value": "Gli host manuali sono percorsi di fiducia espliciti. L’app iOS chiederà conferma prima di inviare credenziali. Con un router di sottorete, il tratto da iPhone al router può essere crittografato, ma dal router al Mac è normale traffico LAN." } }, - "ja": { + "km": { "stringUnit": { "state": "translated", - "value": "表示名" + "value": "ម៉ាស៊ីនបម្រើដោយដៃគឺជាផ្លូវជឿទុកចិត្តដោយច្បាស់លាស់។ កម្មវិធី iOS នឹងសួរមុនពេលផ្ញើព័ត៌មានសម្គាល់។ ជាមួយរ៉ោតទ័រ subnet ការភ្ជាប់ពី iPhone ទៅរ៉ោតទ័រអាចត្រូវបានអ៊ិនគ្រីប ប៉ុន្តែពីរ៉ោតទ័រទៅ Mac គឺជាចរាចរណ៍ LAN ធម្មតា។" } - } - } - }, - "settings.mobile.displayName.placeholder": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ko": { "stringUnit": { "state": "translated", - "value": "This Mac's name" + "value": "수동 호스트는 명시적으로 신뢰한 경로입니다. iOS 앱은 자격 증명을 보내기 전에 확인을 요청합니다. 서브넷 라우터를 사용하는 경우 iPhone에서 라우터까지는 암호화될 수 있지만 라우터에서 Mac까지는 일반 LAN 트래픽입니다." } }, - "ja": { + "nb": { "stringUnit": { "state": "translated", - "value": "この Mac の名前" + "value": "Manuelle verter er eksplisitte tillitsruter. iOS-appen spør før den sender legitimasjon. Med en subnettruter kan iPhone til ruter være kryptert, men ruter til Mac er vanlig LAN-trafikk." } - } - } - }, - "settings.mobile.displayName.subtitle": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "pl": { "stringUnit": { "state": "translated", - "value": "Name the iOS app shows for this Mac when pairing. Empty uses this Mac's name." + "value": "Hosty ręczne to trasy jawnego zaufania. Aplikacja iOS zapyta przed wysłaniem danych logowania. Przy routerze podsieci odcinek iPhone–router może być szyfrowany, ale od routera do Maca jest to zwykły ruch LAN." } }, - "ja": { + "pt-BR": { "stringUnit": { "state": "translated", - "value": "ペアリング時に iOS アプリがこの Mac に表示する名前。空の場合はこの Mac の名前を使用します。" + "value": "Hosts manuais são rotas de confiança explícita. O app iOS perguntará antes de enviar credenciais. Com um roteador de sub-rede, o trecho do iPhone ao roteador pode ser criptografado, mas do roteador ao Mac é tráfego LAN normal." } - } - } - }, - "settings.mobile.iOSPairingHost": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "ru": { "stringUnit": { "state": "translated", - "value": "iOS Pairing" + "value": "Ручные хосты — это явно доверенные маршруты. Приложение iOS спросит перед отправкой учетных данных. При маршрутизаторе подсети участок от iPhone до маршрутизатора может быть зашифрован, но от маршрутизатора до Mac идет обычный LAN-трафик." } }, - "ja": { + "th": { "stringUnit": { "state": "translated", - "value": "iOS ペアリング" + "value": "โฮสต์แบบกำหนดเองเป็นเส้นทางที่ผู้ใช้เชื่อถืออย่างชัดเจน แอป iOS จะถามก่อนส่งข้อมูลรับรอง เมื่อใช้เราเตอร์ซับเน็ต ช่วงจาก iPhone ไปยังเราเตอร์อาจเข้ารหัส แต่จากเราเตอร์ไปยัง Mac เป็นทราฟฟิก LAN ปกติ" } - } - } - }, - "settings.mobile.iOSPairingHost.subtitleOff": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "tr": { "stringUnit": { "state": "translated", - "value": "Keeps the Mac-side iOS pairing listener off until you enable it here." + "value": "Manuel ana bilgisayarlar açıkça güvenilen rotalardır. iOS uygulaması kimlik bilgilerini göndermeden önce sorar. Bir alt ağ yönlendiricisiyle iPhone’dan yönlendiriciye olan kısım şifreli olabilir, ancak yönlendiriciden Mac’e olan kısım normal LAN trafiğidir." } }, - "ja": { + "uk": { "stringUnit": { "state": "translated", - "value": "ここで有効にするまで、Mac 側の iOS ペアリングリスナーをオフにします。" + "value": "Ручні хости — це явно довірені маршрути. Застосунок iOS запитає перед надсиланням облікових даних. За маршрутизатора підмережі ділянка iPhone–маршрутизатор може бути зашифрована, але від маршрутизатора до Mac це звичайний LAN-трафік." } - } - } - }, - "settings.mobile.iOSPairingHost.subtitleOn": { - "extractionState": "manual", - "localizations": { - "en": { + }, + "zh-Hans": { "stringUnit": { "state": "translated", - "value": "Allows the iOS app to discover and sync with this Mac on your local network." + "value": "手动主机是显式信任的路由。iOS 应用会在发送凭据前询问。使用子网路由器时,iPhone 到路由器的链路可能已加密,但路由器到 Mac 是普通 LAN 流量。" } }, - "ja": { + "zh-Hant": { "stringUnit": { "state": "translated", - "value": "iOS アプリがローカルネットワーク上でこの Mac を検出し、同期できるようにします。" + "value": "手動主機是明確信任的路由。iOS App 會在傳送憑證前詢問。使用子網路路由器時,iPhone 到路由器的連線可能已加密,但路由器到 Mac 是一般 LAN 流量。" } } } @@ -164299,6 +165549,131 @@ } } }, + "settings.mobile.route.manualHost": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Manual Host" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "手動ホスト" + } + }, + "ar": { + "stringUnit": { + "state": "translated", + "value": "المضيف اليدوي" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Ručni host" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Manuel vært" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Manueller Host" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Host manual" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Hôte manuel" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Host manuale" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "ម៉ាស៊ីនបម្រើដោយដៃ" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "수동 호스트" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Manuell vert" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Host ręczny" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Host manual" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Ручной хост" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "โฮสต์แบบกำหนดเอง" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Manuel ana bilgisayar" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Ручний хост" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "手动主机" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "手動主機" + } + } + } + }, "settings.mobile.route.tailscale": { "extractionState": "manual", "localizations": { @@ -176664,6 +178039,131 @@ } } }, + "settings.search.alias.setting.mobile.iOSPairingManualHost": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "manual host lan ip dns subnet router tailscale route mobile pairing iphone ipad" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "手動ホスト lan ip dns サブネットルーター tailscale ルート モバイル ペアリング iphone ipad" + } + }, + "ar": { + "stringUnit": { + "state": "translated", + "value": "مضيف يدوي lan ip dns موجّه شبكة فرعية tailscale مسار جوال اقتران iphone ipad" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "ručni host lan ip dns subnet ruter tailscale ruta mobilno uparivanje iphone ipad" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "manuel vært lan ip dns subnet-router tailscale rute mobil parring iphone ipad" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "manueller host lan ip dns subnetzrouter tailscale route mobil koppeln iphone ipad" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "host manual lan ip dns router subred tailscale ruta móvil emparejar iphone ipad" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "hôte manuel lan ip dns routeur sous-réseau tailscale route mobile jumelage iphone ipad" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "host manuale lan ip dns router sottorete tailscale percorso mobile abbinamento iphone ipad" + } + }, + "km": { + "stringUnit": { + "state": "translated", + "value": "ម៉ាស៊ីនបម្រើដោយដៃ lan ip dns រ៉ោតទ័រ subnet tailscale ផ្លូវ mobile pairing iphone ipad" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "수동 호스트 lan ip dns 서브넷 라우터 tailscale 경로 모바일 페어링 iphone ipad" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "manuell vert lan ip dns subnettruter tailscale rute mobil sammenkobling iphone ipad" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "host ręczny lan ip dns router podsieci tailscale trasa mobilne parowanie iphone ipad" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "host manual lan ip dns roteador sub-rede tailscale rota móvel pareamento iphone ipad" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "ручной хост lan ip dns маршрутизатор подсети tailscale маршрут мобильное сопряжение iphone ipad" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "โฮสต์กำหนดเอง lan ip dns เราเตอร์ซับเน็ต tailscale เส้นทาง มือถือ จับคู่ iphone ipad" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "manuel ana bilgisayar lan ip dns alt ağ yönlendiricisi tailscale rota mobil eşleştirme iphone ipad" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "ручний хост lan ip dns маршрутизатор підмережі tailscale маршрут мобільне спарення iphone ipad" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "手动主机 lan ip dns 子网路由器 tailscale 路由 移动 配对 iphone ipad" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "手動主機 lan ip dns 子網路路由器 tailscale 路由 行動 配對 iphone ipad" + } + } + } + }, "settings.search.alias.setting.mobile.iOSPairingPort": { "extractionState": "manual", "localizations": { diff --git a/Sources/HostSettingsActions.swift b/Sources/HostSettingsActions.swift index a74f1d376073..e2eb1b63d775 100644 --- a/Sources/HostSettingsActions.swift +++ b/Sources/HostSettingsActions.swift @@ -358,6 +358,8 @@ final class HostSettingsActions: SettingsHostActions { switch kind { case .tailscale: return String(localized: "settings.mobile.route.tailscale", defaultValue: "Tailscale") + case .manualHost: + return String(localized: "settings.mobile.route.manualHost", defaultValue: "Manual Host") case .debugLoopback: return String(localized: "settings.mobile.route.loopback", defaultValue: "Loopback") case .iroh: diff --git a/Sources/Mobile/MobileHostRouteAdvertisement.swift b/Sources/Mobile/MobileHostRouteAdvertisement.swift new file mode 100644 index 000000000000..4805e0ee91ee --- /dev/null +++ b/Sources/Mobile/MobileHostRouteAdvertisement.swift @@ -0,0 +1,78 @@ +import CMUXMobileCore +import CmuxSettings +import Foundation + +@MainActor +final class MobileHostRouteAdvertisement { + nonisolated static let manualHostDefaultsKey = SettingCatalog().mobile.iOSPairingManualHost.userDefaultsKey + + let routeResolver: MobileRouteResolver + private var advertisedManualHost: String? + + init(routeResolver: MobileRouteResolver = MobileRouteResolver()) { + self.routeResolver = routeResolver + } + + nonisolated static func configuredManualHost(defaults: UserDefaults = .standard) -> String? { + guard let raw = defaults.object(forKey: manualHostDefaultsKey) as? String, + let manualHost = CmxManualHost(raw), + manualHost.isAdvertisable else { + return nil + } + return manualHost.rawValue + } + + nonisolated static func manualHostNeedsRouteRefresh(previous: String?, current: String?) -> Bool { + previous != current + } + + func currentRoutes(port: Int) -> [CmxAttachRoute] { + currentRoutes(port: port, manualHost: Self.configuredManualHost()) + } + + func currentRoutes(port: Int, manualHost: String?) -> [CmxAttachRoute] { + routeResolver.routes(port: port, manualHost: manualHost).routes + } + + func currentRoutes(port: Int, tailscaleHosts: [String]) -> [CmxAttachRoute] { + currentRoutes(port: port, tailscaleHosts: tailscaleHosts, manualHost: Self.configuredManualHost()) + } + + func currentRoutes(port: Int, tailscaleHosts: [String], manualHost: String?) -> [CmxAttachRoute] { + routeResolver.routes( + port: port, + tailscaleHosts: tailscaleHosts, + manualHost: manualHost + ).routes + } + + func publishCurrentRoutes(port: Int) -> [CmxAttachRoute] { + let manualHost = Self.configuredManualHost() + advertisedManualHost = manualHost + return currentRoutes(port: port, manualHost: manualHost) + } + + func publishCurrentRoutes(port: Int, tailscaleHosts: [String]) -> [CmxAttachRoute] { + let manualHost = Self.configuredManualHost() + advertisedManualHost = manualHost + return currentRoutes(port: port, tailscaleHosts: tailscaleHosts, manualHost: manualHost) + } + + func clearAdvertisedRoutes() -> [CmxAttachRoute] { + advertisedManualHost = nil + return [] + } + + func refreshAdvertisedRoutesIfNeeded(port: Int, defaults: UserDefaults = .standard) -> [CmxAttachRoute]? { + let manualHost = Self.configuredManualHost(defaults: defaults) + guard Self.manualHostNeedsRouteRefresh(previous: advertisedManualHost, current: manualHost) else { + return nil + } + advertisedManualHost = manualHost + return currentRoutes(port: port, manualHost: manualHost) + } + + func reset() { + advertisedManualHost = nil + } +} diff --git a/Sources/Mobile/MobileHostRouteSnapshot.swift b/Sources/Mobile/MobileHostRouteSnapshot.swift new file mode 100644 index 000000000000..99e3291c6a8e --- /dev/null +++ b/Sources/Mobile/MobileHostRouteSnapshot.swift @@ -0,0 +1,10 @@ +import CMUXMobileCore +import Foundation + +struct MobileHostRouteSnapshot: Sendable { + let routes: [CmxAttachRoute] + + var payload: [[String: Any]] { + routes.mobileHostJSONObjects(for: .authenticated) + } +} diff --git a/Sources/Mobile/MobileHostService+ManualHostRoutes.swift b/Sources/Mobile/MobileHostService+ManualHostRoutes.swift new file mode 100644 index 000000000000..014dcbfcf756 --- /dev/null +++ b/Sources/Mobile/MobileHostService+ManualHostRoutes.swift @@ -0,0 +1,61 @@ +import CMUXMobileCore +import Foundation + +extension MobileHostService { + /// User-default key for the explicit manual host advertised to iOS when + /// Tailscale is unavailable on this Mac. + nonisolated static let manualHostDefaultsKey = MobileHostRouteAdvertisement.manualHostDefaultsKey + + /// The user-configured LAN/DNS host to advertise as an explicit manual route, + /// or `nil` when unset or invalid. + nonisolated static func configuredManualHost(defaults: UserDefaults = .standard) -> String? { + MobileHostRouteAdvertisement.configuredManualHost(defaults: defaults) + } + + nonisolated static func manualHostNeedsRouteRefresh(previous: String?, current: String?) -> Bool { + MobileHostRouteAdvertisement.manualHostNeedsRouteRefresh(previous: previous, current: current) + } + + func currentRoutes(port: Int) -> [CmxAttachRoute] { + routeAdvertisement.currentRoutes(port: port) + } + + func currentRoutes(port: Int, manualHost: String?) -> [CmxAttachRoute] { + routeAdvertisement.currentRoutes(port: port, manualHost: manualHost) + } + + func currentRoutes(port: Int, tailscaleHosts: [String]) -> [CmxAttachRoute] { + routeAdvertisement.currentRoutes(port: port, tailscaleHosts: tailscaleHosts) + } + + func currentRoutes(port: Int, tailscaleHosts: [String], manualHost: String?) -> [CmxAttachRoute] { + routeAdvertisement.currentRoutes(port: port, tailscaleHosts: tailscaleHosts, manualHost: manualHost) + } + + func publishCurrentRoutes(port: Int) { + updatePublicStatusSnapshot(routes: routeAdvertisement.publishCurrentRoutes(port: port)) + } + + func publishCurrentRoutes(port: Int, tailscaleHosts: [String]) { + updatePublicStatusSnapshot( + routes: routeAdvertisement.publishCurrentRoutes(port: port, tailscaleHosts: tailscaleHosts) + ) + } + + func clearAdvertisedRoutes() { + updatePublicStatusSnapshot(routes: routeAdvertisement.clearAdvertisedRoutes()) + } + + func refreshAdvertisedRoutesIfRunning(defaults: UserDefaults = .standard) { + guard let listenerPort else { + return + } + guard let routes = routeAdvertisement.refreshAdvertisedRoutesIfNeeded( + port: listenerPort, + defaults: defaults + ) else { + return + } + updatePublicStatusSnapshot(routes: routes) + } +} diff --git a/Sources/Mobile/MobileHostService+NetworkStatus.swift b/Sources/Mobile/MobileHostService+NetworkStatus.swift new file mode 100644 index 000000000000..2bf1677811cf --- /dev/null +++ b/Sources/Mobile/MobileHostService+NetworkStatus.swift @@ -0,0 +1,38 @@ +import Foundation +import OSLog + +private let mobileHostNetworkStatusLog = Logger( + subsystem: Bundle.main.bundleIdentifier ?? "com.cmuxterm.app", + category: "mobile-host" +) + +extension MobileHostService { + /// Returns the `mobile.host.status` reply for a network caller. + /// + /// Status is the one unauthenticated verb, so a tokenless request receives + /// the cached identity-free payload without touching the main actor or Stack + /// verifier. A request that presents the owner's same-account Stack token is + /// verified and receives the Mac identity that a freshly QR-paired phone uses + /// to bind its paired-Mac record. Verification failures degrade to the public + /// payload so reachability remains observable while authorized verbs surface + /// the actual auth failure. + #if compiler(>=6.2) + @concurrent + #endif + nonisolated func networkStatusResult( + for request: MobileHostRPCRequest + ) async -> MobileHostRPCResult { + let trimmedToken = request.auth?.stackAccessToken? + .trimmingCharacters(in: .whitespacesAndNewlines) + guard trimmedToken?.isEmpty == false else { + return MobileHostPublicStatusCache.result(includeIdentity: false) + } + let verified = await verifiedStackCaller(for: request) + if !verified { + mobileHostNetworkStatusLog.error( + "mobile host status identity withheld: stack verification failed" + ) + } + return MobileHostPublicStatusCache.result(includeIdentity: verified) + } +} diff --git a/Sources/Mobile/MobileHostService.swift b/Sources/Mobile/MobileHostService.swift index dcfce52458ba..295177229c6d 100644 --- a/Sources/Mobile/MobileHostService.swift +++ b/Sources/Mobile/MobileHostService.swift @@ -225,7 +225,7 @@ final class MobileHostService { nonisolated private static let maximumActiveConnectionCount = 10 nonisolated private static let terminalThemeRevisionEpoch = UUID().uuidString /// The single shape every public `mobile.host.status` reply uses (the - /// public-status cache, the network status gate, and + /// public-status snapshot, the network status gate, and /// `TerminalController`'s no-private-metadata branch), so the fields /// cannot drift. Identity-free status carries no routes: a caller already /// reached the Mac to ask for status, while route discovery belongs to the @@ -270,51 +270,14 @@ final class MobileHostService { return payload } - /// The `mobile.host.status` reply for a network caller. - /// - /// Status is the one unauthenticated verb (a phone probes reachability - /// before it has anything to present), so a tokenless request gets the - /// cached identity-free payload without touching the main actor or the - /// Stack verifier — the DoS posture of the public probe is unchanged, and - /// an arbitrary process that can reach the port receives no private route - /// hints or account identity. A request that does present the owner's - /// same-account Stack token (the iOS client attaches it to status - /// whenever it has one) is verified and answered with the Mac's identity, - /// which is what a freshly QR-paired phone needs to key its paired-Mac - /// record. A token that fails verification degrades to the identity-free - /// payload rather than an error: reachability stays observable, and the - /// authorized verbs that follow surface the auth failure properly. - /// Verification goes through the same gate as the authorized verbs - /// (``verifiedStackCaller(for:)``), so a DEBUG dev-token client that can - /// list workspaces also sees identity. - /// - /// Because status is unauthenticated, the network verifications a - /// token-bearing status request can trigger are bounded: an - /// already-verified token answers from the verifier's cache, and - /// cache-miss lookups are capped by - /// ``MobileHostStatusVerificationLimiter`` (over the cap the reply - /// degrades to identity-free and the phone's identity-recovery retry - /// picks it up later). A flood of unique garbage tokens therefore cannot - /// queue unbounded Stack lookups behind this verb. - nonisolated static func networkStatusResult(for request: MobileHostRPCRequest) async -> MobileHostRPCResult { - let trimmedToken = request.auth?.stackAccessToken?.trimmingCharacters(in: .whitespacesAndNewlines) - guard trimmedToken?.isEmpty == false else { - return MobileHostPublicStatusCache.result(includeIdentity: false) - } - let verified = await MobileHostService.shared.verifiedStackCaller(for: request) - if !verified { - mobileHostLog.error("mobile host status identity withheld: stack verification failed") - } - return MobileHostPublicStatusCache.result(includeIdentity: verified) - } - private let callbackQueue = DispatchQueue(label: "dev.cmux.mobile.host-listener") - private let routeResolver = MobileRouteResolver() + let routeAdvertisement = MobileHostRouteAdvertisement() + var routeResolver: MobileRouteResolver { routeAdvertisement.routeResolver } private let ticketStore = MobileAttachTicketStore() private var listener: NWListener? private var listenerGeneration = UUID() private var listenerUsesEphemeralFallback = false - private var listenerPort: Int? + var listenerPort: Int? /// The preferred port the active start-sequence targeted (regardless of an /// ephemeral fallback). Used to decide whether a settings change needs a /// restart. `nil` while stopped. @@ -690,7 +653,7 @@ final class MobileHostService { self?.updatePublicStatusRoutes(port: port, generation: generation, tailscaleHosts: hosts) } }) - MobileHostPublicStatusCache.update(routes: routeResolver.routes(port: port).routes) + publishCurrentRoutes(port: port) startNetworkPathMonitorIfNeeded() drainReadinessWaiters() } @@ -715,7 +678,7 @@ final class MobileHostService { return } - CmxIrohTCPFirstActivation.start( + CmxIrohTCPFirstActivation().start( startTCP: { startListener(usePreferredPort: true) }, scheduleIroh: { MobileHostIrohRuntime.shared.setDesiredActive(true) } ) @@ -736,7 +699,7 @@ final class MobileHostService { listenerPort = port appliedPreferredPort = port lastErrorDescription = nil - MobileHostPublicStatusCache.update(routes: routeResolver.routes(port: port).routes) + publishCurrentRoutes(port: port) mobileHostLog.info("mobile host listener disabled; publishing XCTest routes without binding") } #endif @@ -824,7 +787,11 @@ final class MobileHostService { Task { await connection.close(reason: reason) } } activeConnections.removeAll() + clientIDsByConnectionID.removeAll() + MobileHostEventSubscriptionTracker.reset() MobileHostPublicStatusCache.update(routes: []) + TerminalController.shared.clearAllMobileViewportReports(reason: "mobile.host.stopped") + drainReadinessWaiters() } func statusSnapshot() -> MobileHostServiceStatus { @@ -929,6 +896,8 @@ final class MobileHostService { ) } + func updatePublicStatusSnapshot(routes: [CmxAttachRoute]) { MobileHostPublicStatusCache.update(routes: routes) } + /// Reconcile the live listener with current settings (enable/disable and /// preferred-port changes). Safe to call on any settings change: it no-ops /// unless the enabled state or the configured port actually changed, so an @@ -956,7 +925,7 @@ final class MobileHostService { appliedPort: appliedPreferredPort ) { case .noop: - break + refreshAdvertisedRoutesIfRunning(defaults: defaults) case .start: start() case .stop: @@ -1054,7 +1023,7 @@ final class MobileHostService { for: request, authorization: authorization, stackStatus: { request in - await MobileHostService.networkStatusResult(for: request) + await MobileHostService.shared.networkStatusResult(for: request) } ) } @@ -1432,9 +1401,9 @@ final class MobileHostService { ) } }) - MobileHostPublicStatusCache.update(routes: routeResolver.routes(port: listenerPort).routes) + publishCurrentRoutes(port: listenerPort) } else { - MobileHostPublicStatusCache.update(routes: []) + clearAdvertisedRoutes() } mobileHostLog.info("mobile host listener ready on port \(self.listenerPort ?? 0)") drainReadinessWaiters() @@ -1445,7 +1414,7 @@ final class MobileHostService { listener = nil listenerUsesEphemeralFallback = false listenerPort = nil - MobileHostPublicStatusCache.update(routes: []) + clearAdvertisedRoutes() drainReadinessWaiters() case let .waiting(error): // A preferred-port bind blocked by another listener surfaces as @@ -1456,11 +1425,11 @@ final class MobileHostService { handleListenerBindFailure(error: error, context: "in use (waiting)") } else { listenerPort = nil - MobileHostPublicStatusCache.update(routes: []) + clearAdvertisedRoutes() } case .setup: listenerPort = nil - MobileHostPublicStatusCache.update(routes: []) + clearAdvertisedRoutes() @unknown default: break } @@ -1471,7 +1440,7 @@ final class MobileHostService { /// Shared by the `.failed` and `.waiting(addressUnavailable)` paths. private func handleListenerBindFailure(error: NWError, context: String) { lastErrorDescription = String(describing: error) - MobileHostPublicStatusCache.update(routes: []) + clearAdvertisedRoutes() let shouldRetryWithEphemeralPort = !listenerUsesEphemeralFallback listener?.stateUpdateHandler = nil listener?.newConnectionHandler = nil @@ -1499,9 +1468,7 @@ final class MobileHostService { guard generation == listenerGeneration, listenerPort == port else { return } - MobileHostPublicStatusCache.update( - routes: routeResolver.routes(port: port, tailscaleHosts: tailscaleHosts).routes - ) + publishCurrentRoutes(port: port, tailscaleHosts: tailscaleHosts) } // MARK: - Network path monitoring @@ -1548,7 +1515,7 @@ final class MobileHostService { self?.updatePublicStatusRoutes(port: port, generation: generation, tailscaleHosts: hosts) } }) - MobileHostPublicStatusCache.update(routes: routeResolver.routes(port: port).routes) + publishCurrentRoutes(port: port) } } @@ -1563,6 +1530,7 @@ extension MobileHostService { listenerGeneration = UUID() listenerUsesEphemeralFallback = false listenerPort = nil + routeAdvertisement.reset() activeConnections.removeAll() clientIDsByConnectionID.removeAll() MobileHostRequestActivity.resetForTesting() diff --git a/Sources/Mobile/MobileRouteResolver.swift b/Sources/Mobile/MobileRouteResolver.swift index 84960f5a9f30..85c312f9d26d 100644 --- a/Sources/Mobile/MobileRouteResolver.swift +++ b/Sources/Mobile/MobileRouteResolver.swift @@ -2,14 +2,6 @@ import CMUXMobileCore import Darwin import Foundation -struct MobileHostRouteSnapshot: Sendable { - let routes: [CmxAttachRoute] - - var payload: [[String: Any]] { - routes.mobileHostJSONObjects(for: .authenticated) - } -} - final class MobileRouteResolver: @unchecked Sendable { private static let tailscaleRouteCacheTTL: TimeInterval = 30 @@ -26,6 +18,7 @@ final class MobileRouteResolver: @unchecked Sendable { func routes( port: Int, + manualHost: String? = nil, now: Date = Date(), immediateHosts: () -> [String] = { MobileRouteResolver.tailscaleRouteHosts(resolveDNS: false) } ) -> MobileHostRouteSnapshot { @@ -33,19 +26,19 @@ final class MobileRouteResolver: @unchecked Sendable { let cachedHosts = resolvedTailscaleRouteHostsFromCache(now: now) ?? [] return routes( port: port, - tailscaleHosts: Self.deduplicatedHosts(cachedHosts + immediateHosts()) + tailscaleHosts: Self.deduplicatedHosts(cachedHosts + immediateHosts()), + manualHost: manualHost ) } func routesResolvingTailscaleDNS( port: Int, - resolveHosts: @escaping @Sendable () -> [String] = { - MobileRouteResolver.tailscaleRouteHosts(resolveDNS: true) - }, + manualHost: String? = nil, + resolveHosts: @escaping @Sendable () -> [String] = { MobileRouteResolver.tailscaleRouteHosts(resolveDNS: true) }, now: Date = Date() ) async -> MobileHostRouteSnapshot { let hosts = await resolvedTailscaleRouteHosts(resolveHosts: resolveHosts, now: now) - return routes(port: port, tailscaleHosts: hosts) + return routes(port: port, tailscaleHosts: hosts, manualHost: manualHost) } /// Drop the resolved-host cache and orphan any in-flight resolution. @@ -66,7 +59,11 @@ final class MobileRouteResolver: @unchecked Sendable { cacheLock.unlock() } - func routes(port: Int, tailscaleHosts: [String]) -> MobileHostRouteSnapshot { + func routes( + port: Int, + tailscaleHosts: [String], + manualHost: String? = nil + ) -> MobileHostRouteSnapshot { var resolved: [CmxAttachRoute] = [] if Self.includesDebugLoopbackRoute { @@ -97,6 +94,23 @@ final class MobileRouteResolver: @unchecked Sendable { } } + if let manualHost = manualHost.flatMap(CmxManualHost.init(routeHost:)), + manualHost.isAdvertisable { + // Continue the EMITTED tailscale sequence, not the discovered-host + // count: discovery can include hosts (like the MagicDNS name) that + // are filtered out above, and `CmxPairingQRCode.encodableRoutes` + // rejects any priority gap in the canonical 10, 20, ... sequence. + let manualPriority = 10 + (numericTailscaleHosts.count * 10) + if let manualRoute = try? CmxAttachRoute( + id: CmxAttachTransportKind.manualHost.rawValue, + kind: .manualHost, + endpoint: .hostPort(host: manualHost.rawValue, port: port), + priority: manualPriority + ) { + resolved.append(manualRoute) + } + } + return MobileHostRouteSnapshot(routes: resolved) } diff --git a/Sources/Mobile/Pairing/MobilePairingModel.swift b/Sources/Mobile/Pairing/MobilePairingModel.swift index 253596f391bd..2070fd2cc1a3 100644 --- a/Sources/Mobile/Pairing/MobilePairingModel.swift +++ b/Sources/Mobile/Pairing/MobilePairingModel.swift @@ -30,8 +30,8 @@ final class MobilePairingModel { /// A phone has attached to the listener; show a paired/success state /// instead of the QR + spinner. case connected(Ready) - /// Neither an authenticated Iroh identity nor a released-client - /// Tailscale compatibility route is available yet. + /// Neither an authenticated Iroh identity nor a phone-reachable + /// Tailscale/manual-host compatibility route is available yet. case needsReachableTransport /// The listener could not be started or no ticket could be minted. case failed(String) @@ -42,6 +42,7 @@ final class MobilePairingModel { enum PrimaryTransport: Equatable, Sendable { case iroh case tailscaleCompatibility + case manualHostCompatibility } /// The `cmux-ios://attach?...` URL encoded into the QR code. @@ -53,6 +54,8 @@ final class MobilePairingModel { let primaryTransport: PrimaryTransport /// The Mac's display name, shown above the code. let macName: String + /// All phone-dialable `host:port` routes carried by the pairing code. + let routeLines: [String] /// Reachable Tailscale `host:port` compatibility routes. Empty when /// Iroh is the only available transport. let tailscaleLines: [String] @@ -60,8 +63,13 @@ final class MobilePairingModel { /// "Copy Port" buttons. `nil` when no phone-dialable route exists. let manualEntry: CmxManualPairingEntry? - /// Whether at least one Tailscale route resolved. + /// Whether at least one phone-reachable Tailscale route resolved. var reachableViaTailscale: Bool { !tailscaleLines.isEmpty } + /// Whether the pairing code carries an explicit non-Tailscale manual route. + var hasManualHostRoute: Bool { + routeLines.contains { line in !tailscaleLines.contains(line) } + } + /// Whether the default QR authenticates and connects through Iroh. var reachableViaIroh: Bool { primaryTransport == .iroh } } @@ -80,6 +88,9 @@ final class MobilePairingModel { let hasLegacyTailscale = routes.contains( where: MobilePairingModel.isPhoneReachableLegacyRoute ) + let hasManualHost = routes.contains { route in + route.kind == .manualHost && MobilePairingModel.isPhoneReachableRoute(route) + } if hasIroh { return PairingRoutePlan( primaryDisclosureMode: .irohIdentityOnly, @@ -94,6 +105,13 @@ final class MobilePairingModel { offersLegacyCode: false ) } + if hasManualHost { + return PairingRoutePlan( + primaryDisclosureMode: .legacyPrivateNetworkCompatibility, + primaryTransport: .manualHostCompatibility, + offersLegacyCode: false + ) + } return nil } } @@ -194,6 +212,16 @@ final class MobilePairingModel { ) return } + // Only the minimal QR grammar (Tailscale/manual-host routes only, + // no loopback, no token) may ever be displayed as a scannable code. + // If the mint raced a route loss and fell back to the v1 payload, + // show route guidance rather than a weak QR. + guard routePlan.primaryTransport == .iroh + || CmxPairingQRCode().isPairingCodeURLString(attachURL) else { + state = .needsReachableTransport + observeRouteAvailability() + return + } let legacyAttachURL: String? if routePlan.offersLegacyCode, let legacyPayload = try? await host.createAttachTicket( @@ -212,6 +240,7 @@ final class MobilePairingModel { legacyAttachURL: legacyAttachURL, primaryTransport: routePlan.primaryTransport, macName: Self.macDisplayName, + routeLines: Self.phoneReachableLines(status.routes), tailscaleLines: Self.tailscaleLines(status.routes), manualEntry: CmxManualPairingEntry.best(in: status.routes) ) @@ -363,6 +392,25 @@ final class MobilePairingModel { Host.current().localizedName ?? ProcessInfo.processInfo.hostName } + /// Whether `route` is one a physical iPhone can actually dial: a + /// Tailscale or explicit manual-host route that does not point back at this + /// Mac. The dev loopback route a DEBUG build always carries must not count + /// as reachability, or the pairing window would happily display a QR no + /// phone can use. + private nonisolated static func isPhoneReachableRoute(_ route: CmxAttachRoute) -> Bool { + (route.kind == .tailscale || route.kind == .manualHost) && !CmxLoopbackHost().matches(route) + } + + private static func phoneReachableLines(_ routes: [CmxAttachRoute]) -> [String] { + uniqueLines(routes.compactMap { route in + guard isPhoneReachableRoute(route), + case let .hostPort(host, port) = route.endpoint else { + return nil + } + return endpointLine(host: host, port: port) + }) + } + /// Whether `route` can serve released iOS clients: a Tailscale route that /// does not point back at this Mac. Iroh-capable clients use an identity-only /// route and never receive this private address in their default QR. @@ -373,12 +421,23 @@ final class MobilePairingModel { } private static func tailscaleLines(_ routes: [CmxAttachRoute]) -> [String] { - routes.compactMap { route in + uniqueLines(routes.compactMap { route in guard route.kind == .tailscale, case let .hostPort(host, port) = route.endpoint else { return nil } - return "\(host):\(port)" + return endpointLine(host: host, port: port) + }) + } + + static func endpointLine(host: String, port: Int) -> String { + host.contains(":") ? "[\(host)]:\(port)" : "\(host):\(port)" + } + + private static func uniqueLines(_ lines: [String]) -> [String] { + var seen: Set = [] + return lines.filter { line in + seen.insert(line).inserted } } } diff --git a/Sources/Mobile/Pairing/MobilePairingRouteReachability.swift b/Sources/Mobile/Pairing/MobilePairingRouteReachability.swift new file mode 100644 index 000000000000..48045c4e1d54 --- /dev/null +++ b/Sources/Mobile/Pairing/MobilePairingRouteReachability.swift @@ -0,0 +1,6 @@ +enum MobilePairingRouteReachability: Equatable { + case tailscale + case manualHost + case missing + case unknown +} diff --git a/Sources/Mobile/Pairing/MobilePairingView.swift b/Sources/Mobile/Pairing/MobilePairingView.swift index 9078406fa669..5bea7e7104c8 100644 --- a/Sources/Mobile/Pairing/MobilePairingView.swift +++ b/Sources/Mobile/Pairing/MobilePairingView.swift @@ -341,8 +341,8 @@ struct MobilePairingView: View { private func readyContent(_ ready: MobilePairingModel.Ready) -> some View { // Manual entry sits above the QR so Copy IP / Copy Port are reachable // without scrolling (they used to sit below the steps, below the fold). - if ready.reachableViaTailscale { - manualFallback(ready) + if ready.manualEntry != nil { + trustedManualFallback(ready) } VStack(alignment: .center, spacing: 14) { @@ -390,6 +390,37 @@ struct MobilePairingView: View { return legacyAttachURL } + @ViewBuilder + private func trustedManualFallback(_ ready: MobilePairingModel.Ready) -> some View { + VStack(alignment: .leading, spacing: 6) { + Text(String(localized: "mobile.pairing.manual.title", defaultValue: "Can't scan? Add this Mac manually:")) + .cmuxFont(.caption, weight: .semibold) + .foregroundStyle(.secondary) + ForEach(ready.routeLines, id: \.self) { line in + Text(line) + .cmuxFont(.caption, design: .monospaced) + .textSelection(.enabled) + .foregroundStyle(.secondary) + } + if let entry = ready.manualEntry { + HStack(spacing: 8) { + copyButton( + label: String(localized: "mobile.pairing.manual.copyIP", defaultValue: "Copy IP"), + value: entry.hostFieldValue + ) + copyButton( + label: String(localized: "mobile.pairing.manual.copyPort", defaultValue: "Copy Port"), + value: String(entry.port) + ) + } + .padding(.top, 2) + } + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(12) + .background(Color.secondary.opacity(0.08), in: RoundedRectangle(cornerRadius: 10)) + } + @ViewBuilder private func pairingCodeModeControls(_ ready: MobilePairingModel.Ready) -> some View { if let _ = ready.legacyAttachURL { @@ -431,6 +462,14 @@ struct MobilePairingView: View { .cmuxFont(.caption) .foregroundStyle(.secondary) .multilineTextAlignment(.center) + } else if ready.primaryTransport == .manualHostCompatibility { + Text(String( + localized: "mobile.pairing.req.manualHost.reachable", + defaultValue: "Manual host configured. Your iPhone will ask before trusting this route." + )) + .cmuxFont(.caption) + .foregroundStyle(.secondary) + .multilineTextAlignment(.center) } else { Text(String( localized: "mobile.pairing.codeMode.legacyOnlyDetail", diff --git a/Sources/SettingsSearchAliases.swift b/Sources/SettingsSearchAliases.swift index a355034c3e25..d1aa9f1ca418 100644 --- a/Sources/SettingsSearchAliases.swift +++ b/Sources/SettingsSearchAliases.swift @@ -135,6 +135,7 @@ enum SettingsSearchAliasIndex { "betaFeatures:feed": localized("settings.search.alias.setting.betaFeatures.feed", defaultValue: "feed right sidebar agent decisions permissions questions approval beta unstable"), "betaFeatures:dock": localized("settings.search.alias.setting.betaFeatures.dock", defaultValue: "dock right sidebar terminal controls tui beta unstable"), "mobile:iOSPairingHost": localized("settings.search.alias.setting.mobile.iOSPairingHost", defaultValue: "ios iphone ipad mobile pairing local network permission sync"), + "mobile:iOSPairingManualHost": localized("settings.search.alias.setting.mobile.iOSPairingManualHost", defaultValue: "manual host lan ip dns subnet router tailscale route mobile pairing iphone ipad"), "mobile:iOSPairingPort": localized("settings.search.alias.setting.mobile.iOSPairingPort", defaultValue: "mobile ios iphone pairing port tcp listener firewall conflict bind"), "mobile:iOSPairingDisplayName": localized("settings.search.alias.setting.mobile.iOSPairingDisplayName", defaultValue: "mobile ios iphone pairing display name mac hostname device label"), "mobile:artifactFolderAccess": localized("settings.search.alias.setting.mobile.artifactFolderAccess", defaultValue: "mobile ios iphone files folders directory subtree one level authorization security"), diff --git a/cmux.xcodeproj/project.pbxproj b/cmux.xcodeproj/project.pbxproj index adf055979d71..5e1c61b4d003 100644 --- a/cmux.xcodeproj/project.pbxproj +++ b/cmux.xcodeproj/project.pbxproj @@ -1073,8 +1073,12 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources C1A070000000000000000004 /* MobileHostIrohServerEventWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A070000000000000000014 /* MobileHostIrohServerEventWriter.swift */; }; DE71CE000000000000000008 /* MobileHostNetworkPathMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE71CE000000000000000007 /* MobileHostNetworkPathMonitor.swift */; }; DE71CE000000000000000006 /* MobileHostNetworkPathRefreshTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE71CE000000000000000005 /* MobileHostNetworkPathRefreshTests.swift */; }; + 7230A0027230A0027230A002 /* MobileHostRouteAdvertisement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7230B0027230B0027230B002 /* MobileHostRouteAdvertisement.swift */; }; + 2B69F8ABA4EE46BE950AA02F /* MobileHostRouteSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3273FBD27A6E4C45AA9D7E04 /* MobileHostRouteSnapshot.swift */; }; 4E673EDE464BF3AB80E94C1D /* MobileHostRPC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47BDC06F004C02A52B05E4A0 /* MobileHostRPC.swift */; }; C7A50B000000000000000014 /* MobileHostService+Capabilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7A50B000000000000000013 /* MobileHostService+Capabilities.swift */; }; + 7230A0017230A0017230A001 /* MobileHostService+ManualHostRoutes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7230B0017230B0017230B001 /* MobileHostService+ManualHostRoutes.swift */; }; + 285A9DCEA2194E7CBF615496 /* MobileHostService+NetworkStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D2B53CB9BC24D699108E184 /* MobileHostService+NetworkStatus.swift */; }; C0DE00000000000000000C8D /* MobileHostService+TicketAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE00000000000000000C8C /* MobileHostService+TicketAuthorization.swift */; }; F67FBC88671C40AC3A3284CE /* MobileHostService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ACA497A6831165EA879C642 /* MobileHostService.swift */; }; C0DE10510000000000000001 /* MobileHostServiceSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE10510000000000000002 /* MobileHostServiceSettingsTests.swift */; }; @@ -1087,6 +1091,7 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources 9B08F916D7FF7626C6820727 /* MobilePairingConnectionTransitionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4880BD05924400E5279D632 /* MobilePairingConnectionTransitionTests.swift */; }; 0099C2865D9D468747D14593 /* MobilePairingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04CE82AE8B39EA0C1395F696 /* MobilePairingModel.swift */; }; 325AF8814443BDA97AC3CC98 /* MobilePairingQRImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B76EC5E03C345BEAC25828A7 /* MobilePairingQRImageView.swift */; }; + 7230A0037230A0037230A003 /* MobilePairingRouteReachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7230B0037230B0037230B003 /* MobilePairingRouteReachability.swift */; }; C1A070000000000000000006 /* MobilePairingView+Connected.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A070000000000000000016 /* MobilePairingView+Connected.swift */; }; A2538FE83AE79539E3BF9248 /* MobilePairingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9BC53FA4991A6EBFB930EDF /* MobilePairingView.swift */; }; 18A8E29E9BD87E184983527C /* MobilePairingWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AE701F43A0B49F08835191C /* MobilePairingWindowController.swift */; }; @@ -3113,8 +3118,12 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C1A070000000000000000014 /* MobileHostIrohServerEventWriter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MobileHostIrohServerEventWriter.swift; sourceTree = ""; }; DE71CE000000000000000007 /* MobileHostNetworkPathMonitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MobileHostNetworkPathMonitor.swift; sourceTree = ""; }; DE71CE000000000000000005 /* MobileHostNetworkPathRefreshTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileHostNetworkPathRefreshTests.swift; sourceTree = ""; }; + 7230B0027230B0027230B002 /* MobileHostRouteAdvertisement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileHostRouteAdvertisement.swift; sourceTree = ""; }; + 3273FBD27A6E4C45AA9D7E04 /* MobileHostRouteSnapshot.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MobileHostRouteSnapshot.swift; sourceTree = ""; }; 47BDC06F004C02A52B05E4A0 /* MobileHostRPC.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MobileHostRPC.swift; sourceTree = ""; }; C7A50B000000000000000013 /* MobileHostService+Capabilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MobileHostService+Capabilities.swift"; sourceTree = ""; }; + 7230B0017230B0017230B001 /* MobileHostService+ManualHostRoutes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MobileHostService+ManualHostRoutes.swift"; sourceTree = ""; }; + 2D2B53CB9BC24D699108E184 /* MobileHostService+NetworkStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MobileHostService+NetworkStatus.swift"; sourceTree = ""; }; C0DE00000000000000000C8C /* MobileHostService+TicketAuthorization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MobileHostService+TicketAuthorization.swift"; sourceTree = ""; }; 7ACA497A6831165EA879C642 /* MobileHostService.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MobileHostService.swift; sourceTree = ""; }; C0DE10510000000000000002 /* MobileHostServiceSettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileHostServiceSettingsTests.swift; sourceTree = ""; }; @@ -3127,6 +3136,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = A4880BD05924400E5279D632 /* MobilePairingConnectionTransitionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobilePairingConnectionTransitionTests.swift; sourceTree = ""; }; 04CE82AE8B39EA0C1395F696 /* MobilePairingModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "Pairing/MobilePairingModel.swift"; sourceTree = ""; }; B76EC5E03C345BEAC25828A7 /* MobilePairingQRImageView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "Pairing/MobilePairingQRImageView.swift"; sourceTree = ""; }; + 7230B0037230B0037230B003 /* MobilePairingRouteReachability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Pairing/MobilePairingRouteReachability.swift"; sourceTree = ""; }; C1A070000000000000000016 /* MobilePairingView+Connected.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "Pairing/MobilePairingView+Connected.swift"; sourceTree = ""; }; F9BC53FA4991A6EBFB930EDF /* MobilePairingView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "Pairing/MobilePairingView.swift"; sourceTree = ""; }; 5AE701F43A0B49F08835191C /* MobilePairingWindowController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "Pairing/MobilePairingWindowController.swift"; sourceTree = ""; }; @@ -4300,6 +4310,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = 8D6D2AC715764ECC1F6B26A2 /* MobileAttachTicketStore.swift */, B8B056D90000000000000002 /* MobileHostIdentity.swift */, 47BDC06F004C02A52B05E4A0 /* MobileHostRPC.swift */, + 7230B0027230B0027230B002 /* MobileHostRouteAdvertisement.swift */, 7ACA497A6831165EA879C642 /* MobileHostService.swift */, 1B0B09010000000000000001 /* MobileHostIrohRuntime.swift */, 1B0B09020000000000000001 /* MobileHostIrohRuntime+Activation.swift */, @@ -4312,14 +4323,18 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C1A070000000000000000014 /* MobileHostIrohServerEventWriter.swift */, C1A070000000000000000015 /* MobileHostTransportAuthorization.swift */, C0DE00000000000000000C8C /* MobileHostService+TicketAuthorization.swift */, + 2D2B53CB9BC24D699108E184 /* MobileHostService+NetworkStatus.swift */, C7A50B000000000000000021 /* MobileHostTerminalTheme.swift */, C7A50B000000000000000015 /* MobileHostBuildIdentity.swift */, 4C1A7E10B2D34F56A8C90012 /* MobileHostStatusVerificationLimiter.swift */, C7A50B000000000000000013 /* MobileHostService+Capabilities.swift */, + 7230B0017230B0017230B001 /* MobileHostService+ManualHostRoutes.swift */, DE71CE000000000000000007 /* MobileHostNetworkPathMonitor.swift */, 7A956C76162B79EC74AF9965 /* MobileRouteResolver.swift */, + 3273FBD27A6E4C45AA9D7E04 /* MobileHostRouteSnapshot.swift */, 04CE82AE8B39EA0C1395F696 /* MobilePairingModel.swift */, B76EC5E03C345BEAC25828A7 /* MobilePairingQRImageView.swift */, + 7230B0037230B0037230B003 /* MobilePairingRouteReachability.swift */, F9BC53FA4991A6EBFB930EDF /* MobilePairingView.swift */, C1A070000000000000000016 /* MobilePairingView+Connected.swift */, 5AE701F43A0B49F08835191C /* MobilePairingWindowController.swift */, @@ -7312,8 +7327,12 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = 1B0B09010000000000000002 /* MobileHostIrohRuntime.swift in Sources */, C1A070000000000000000004 /* MobileHostIrohServerEventWriter.swift in Sources */, DE71CE000000000000000008 /* MobileHostNetworkPathMonitor.swift in Sources */, + 7230A0027230A0027230A002 /* MobileHostRouteAdvertisement.swift in Sources */, + 2B69F8ABA4EE46BE950AA02F /* MobileHostRouteSnapshot.swift in Sources */, 4E673EDE464BF3AB80E94C1D /* MobileHostRPC.swift in Sources */, C7A50B000000000000000014 /* MobileHostService+Capabilities.swift in Sources */, + 7230A0017230A0017230A001 /* MobileHostService+ManualHostRoutes.swift in Sources */, + 285A9DCEA2194E7CBF615496 /* MobileHostService+NetworkStatus.swift in Sources */, C0DE00000000000000000C8D /* MobileHostService+TicketAuthorization.swift in Sources */, F67FBC88671C40AC3A3284CE /* MobileHostService.swift in Sources */, 4C1A7E10B2D34F56A8C90011 /* MobileHostStatusVerificationLimiter.swift in Sources */, @@ -7321,6 +7340,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C1A070000000000000000005 /* MobileHostTransportAuthorization.swift in Sources */, 0099C2865D9D468747D14593 /* MobilePairingModel.swift in Sources */, 325AF8814443BDA97AC3CC98 /* MobilePairingQRImageView.swift in Sources */, + 7230A0037230A0037230A003 /* MobilePairingRouteReachability.swift in Sources */, C1A070000000000000000006 /* MobilePairingView+Connected.swift in Sources */, A2538FE83AE79539E3BF9248 /* MobilePairingView.swift in Sources */, 18A8E29E9BD87E184983527C /* MobilePairingWindowController.swift in Sources */, diff --git a/cmuxTests/MobileHostAuthorizationTests.swift b/cmuxTests/MobileHostAuthorizationTests.swift index 4a4b46f875e2..5e7c7387bf0f 100644 --- a/cmuxTests/MobileHostAuthorizationTests.swift +++ b/cmuxTests/MobileHostAuthorizationTests.swift @@ -211,12 +211,7 @@ struct MobileHostAuthorizationTests { ) let tailscaleRoutes = snapshot.routes.filter { $0.kind == .tailscale } #expect(tailscaleRoutes.count == 1) - if case let .hostPort(host, port) = tailscaleRoutes.first?.endpoint { - #expect(host == "100.71.210.41") - #expect(port == 61234) - } else { - #expect(Bool(false), "Expected immediate snapshot to include a numeric Tailscale route") - } + #expect(tailscaleRoutes.first?.endpoint == .hostPort(host: "100.71.210.41", port: 61234)) #expect(snapshot.routes.filter { $0.kind == .debugLoopback }.count == 1) } @Test func testMobileRouteResolverAwaitsMagicDNSForPublicStatusRoutes() async throws { diff --git a/cmuxTests/MobileHostServiceSettingsTests.swift b/cmuxTests/MobileHostServiceSettingsTests.swift index ea7f862e6478..4c55ae5491b6 100644 --- a/cmuxTests/MobileHostServiceSettingsTests.swift +++ b/cmuxTests/MobileHostServiceSettingsTests.swift @@ -111,6 +111,100 @@ struct MobileHostServiceSettingsTests { #expect(MobileHostService.resolvedDesiredPort(defaults: defaults) == nil) } + @Test func manualHostRouteRefreshOnlyWhenNormalizedValueChanges() throws { + let suiteName = "MobileHostServiceSettingsTests.ManualHost.\(UUID().uuidString)" + let defaults = try #require(UserDefaults(suiteName: suiteName)) + defer { defaults.removePersistentDomain(forName: suiteName) } + + #expect(MobileHostService.configuredManualHost(defaults: defaults) == nil) + defaults.set(" studio-mac.corp.example ", forKey: MobileHostService.manualHostDefaultsKey) + #expect(MobileHostService.configuredManualHost(defaults: defaults) == "studio-mac.corp.example") + #expect(MobileHostService.manualHostNeedsRouteRefresh(previous: nil, current: "studio-mac.corp.example")) + #expect(!MobileHostService.manualHostNeedsRouteRefresh( + previous: "studio-mac.corp.example", + current: "studio-mac.corp.example" + )) + #expect(MobileHostService.manualHostNeedsRouteRefresh( + previous: "studio-mac.corp.example", + current: nil + )) + + defaults.set("my:host", forKey: MobileHostService.manualHostDefaultsKey) + #expect(MobileHostService.configuredManualHost(defaults: defaults) == nil) + } + + @Test(arguments: ["127.0.0.1", "127.1", "0.0.0.0", "localhost", "[::1]"]) + func configuredManualHostRejectsLoopbackHosts(rawHost: String) throws { + let suiteName = "MobileHostServiceSettingsTests.ManualHost.Loopback.\(UUID().uuidString)" + let defaults = try #require(UserDefaults(suiteName: suiteName)) + defer { defaults.removePersistentDomain(forName: suiteName) } + + defaults.set(rawHost, forKey: MobileHostService.manualHostDefaultsKey) + + #expect(MobileHostService.configuredManualHost(defaults: defaults) == nil) + } + + @Test func routeResolverDoesNotAdvertiseLoopbackManualHost() { + let routes = MobileRouteResolver().routes( + port: 58_465, + tailscaleHosts: ["100.82.214.112"], + manualHost: "127.1" + ).routes + + #expect(routes.contains { $0.kind == .tailscale }) + #expect(!routes.contains { $0.kind == .manualHost }) + } + + @Test func routeResolverUsesManualHostWhenTailscaleIsUnavailable() throws { + let snapshot = MobileRouteResolver().routes( + port: 61_234, + tailscaleHosts: [], + manualHost: " studio-mac.corp.example " + ) + let route = try #require(snapshot.routes.first { $0.kind == .manualHost }) + #expect(snapshot.routes.filter { $0.kind == .tailscale }.isEmpty) + #expect(route.endpoint == .hostPort(host: "studio-mac.corp.example", port: 61_234)) + } + + @Test func routeResolverKeepsCanonicalPrioritiesWhenMagicDNSHostIsFiltered() throws { + // Production discovery prepends the MagicDNS name to the numeric + // Tailscale address; the resolver emits only the numeric host. The + // manual route's priority must continue the EMITTED sequence + // (10, 20, ...) or `CmxPairingQRCode.encodableRoutes` rejects the + // routes and the pairing QR silently degrades to the v1 payload. + let snapshot = MobileRouteResolver().routes( + port: 58_465, + tailscaleHosts: ["studio-mac.tail1234.ts.net", "100.82.214.112"], + manualHost: "studio-mac.corp.example" + ) + let minimalRoutes = snapshot.routes.filter { $0.kind != .debugLoopback } + let tailscaleRoute = try #require(minimalRoutes.first { $0.kind == .tailscale }) + let manualRoute = try #require(minimalRoutes.first { $0.kind == .manualHost }) + + #expect(minimalRoutes.count == 2) + #expect(tailscaleRoute.priority == 10) + #expect(manualRoute.priority == 20) + } + + @Test func routeResolverAdvertisesConfiguredIPv6ManualHost() throws { + let suiteName = "MobileHostServiceSettingsTests.ManualHost.IPv6.\(UUID().uuidString)" + let defaults = try #require(UserDefaults(suiteName: suiteName)) + defer { defaults.removePersistentDomain(forName: suiteName) } + + defaults.set("[fd00::12]", forKey: MobileHostService.manualHostDefaultsKey) + + let configuredHost = try #require(MobileHostService.configuredManualHost(defaults: defaults)) + let routes = MobileRouteResolver().routes( + port: 58_465, + tailscaleHosts: [], + manualHost: configuredHost + ).routes + let manualRoute = try #require(routes.first { $0.kind == .manualHost }) + + #expect(configuredHost == "fd00::12") + #expect(manualRoute.endpoint == .hostPort(host: "fd00::12", port: 58_465)) + } + @Test func portApplyPreBindClassifiesNonBindCases() { // Out of range → invalid, regardless of anything else. #expect(MobileHostService.portApplyPreBindOutcome(enabled: true, currentBoundPort: nil, requestedPort: 0) == .invalid) diff --git a/cmuxTests/MobilePairingConnectionTransitionTests.swift b/cmuxTests/MobilePairingConnectionTransitionTests.swift index b15a1ea1aafa..124fee68e861 100644 --- a/cmuxTests/MobilePairingConnectionTransitionTests.swift +++ b/cmuxTests/MobilePairingConnectionTransitionTests.swift @@ -17,6 +17,7 @@ struct MobilePairingConnectionTransitionTests { legacyAttachURL: "cmux-ios://attach?v=2&r=100.64.0.1:7777", primaryTransport: .iroh, macName: "Test Mac", + routeLines: ["100.64.0.1:7777"], tailscaleLines: ["100.64.0.1:7777"], manualEntry: CmxManualPairingEntry(host: "100.64.0.1", port: 7777) ) @@ -117,6 +118,12 @@ struct MobilePairingConnectionTransitionTests { #expect(next == .signedOut) } + @Test("Route display lines bracket IPv6 hosts") + func routeDisplayLinesBracketIPv6Hosts() { + #expect(MobilePairingModel.endpointLine(host: "fd00::12", port: 58465) == "[fd00::12]:58465") + #expect(MobilePairingModel.endpointLine(host: "100.64.0.1", port: 7777) == "100.64.0.1:7777") + } + @Test("Iroh is the default and Tailscale remains a compatibility code") func irohRouteWinsWithLegacyCompatibility() throws { let plan = try #require(MobilePairingModel.PairingRoutePlan.make(routes: [ diff --git a/ios/cmux/Resources/Localizable.xcstrings b/ios/cmux/Resources/Localizable.xcstrings index 5ab2739b12a8..0fb91a369aaf 100644 --- a/ios/cmux/Resources/Localizable.xcstrings +++ b/ios/cmux/Resources/Localizable.xcstrings @@ -10354,6 +10354,142 @@ } } }, + "mobile.pairing.manualHostTrustBody": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "cmux does not encrypt this direct connection end to end. Account credentials are sent through it and can be intercepted on an untrusted network. Trust this host and port only on a network you control." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "cmux は、この直接接続をエンドツーエンドで暗号化しません。アカウントの認証情報はこの接続を通じて送信され、信頼できないネットワークでは傍受される可能性があります。管理しているネットワーク上でのみ、このホストとポートを信頼してください。" + } + } + } + }, + "mobile.pairing.manualHostTrustContinue": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Trust and Pair" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "信頼してペアリング" + } + } + } + }, + "mobile.pairing.manualHostTrustTitle": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Trust manual host?" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "手動ホストを信頼しますか?" + } + } + } + }, + "mobile.connection.invalidResponse": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Invalid mobile sync response" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "モバイル同期の応答が無効です" + } + } + } + }, + "mobile.connection.closed": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Mobile sync connection closed" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "モバイル同期接続が閉じられました" + } + } + } + }, + "mobile.connection.timedOut": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Mobile sync request timed out" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "モバイル同期リクエストがタイムアウトしました" + } + } + } + }, + "mobile.connection.insecureManualRoute": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Manual host route needs approval before mobile sync can send account credentials" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "モバイル同期がアカウント認証情報を送信する前に、手動ホストルートの承認が必要です" + } + } + } + }, + "mobile.connection.attachTicketExpired": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Mobile attach ticket expired" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "モバイル接続チケットの有効期限が切れました" + } + } + } + }, "mobile.common.actions": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Actions"}},"ja":{"stringUnit":{"state":"translated","value":"操作"}}}}, "mobile.common.remove": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Remove"}},"ja":{"stringUnit":{"state":"translated","value":"削除"}}}}, "mobile.settings.iroh": {"extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Iroh and Relays"}},"ja":{"stringUnit":{"state":"translated","value":"Iroh とリレー"}}}}, diff --git a/ios/cmux/cmuxApp.swift b/ios/cmux/cmuxApp.swift index c9d6dc931d85..d7504508fc17 100644 --- a/ios/cmux/cmuxApp.swift +++ b/ios/cmux/cmuxApp.swift @@ -36,9 +36,9 @@ struct cmuxApp: App { // attach to an in-runner mock host; release device builds keep only // real transports. #if targetEnvironment(simulator) || DEBUG - let supportedKinds: [CmxAttachTransportKind] = [.debugLoopback, .tailscale] + let supportedKinds: [CmxAttachTransportKind] = [.debugLoopback, .tailscale, .manualHost] #else - let supportedKinds: [CmxAttachTransportKind] = [.tailscale] + let supportedKinds: [CmxAttachTransportKind] = [.tailscale, .manualHost] #endif let networkFactory = CmxNetworkByteTransportFactory(supportedKinds: supportedKinds) let fallbackRegistrations = supportedKinds.map { kind in diff --git a/ios/cmuxPackage/Sources/cmuxFeature/CMUXMobileRuntime.swift b/ios/cmuxPackage/Sources/cmuxFeature/CMUXMobileRuntime.swift index 7a45ac137d54..809961a6aa46 100644 --- a/ios/cmuxPackage/Sources/cmuxFeature/CMUXMobileRuntime.swift +++ b/ios/cmuxPackage/Sources/cmuxFeature/CMUXMobileRuntime.swift @@ -129,7 +129,7 @@ public struct CMUXMobileRuntime: Sendable, MobileSyncRuntime { } public init( - supportedRouteKinds: [CmxAttachTransportKind] = [.tailscale, .debugLoopback], + supportedRouteKinds: [CmxAttachTransportKind] = [.tailscale, .manualHost, .debugLoopback], transportFactory: any CmxByteTransportFactory, stackAccessTokenProvider: (@Sendable () async throws -> String)? = nil, stackAccessTokenForStatusProvider: (@Sendable () async -> String?)? = nil, diff --git a/ios/cmuxPackage/Tests/cmuxFeatureTests/cmuxFeatureTests.swift b/ios/cmuxPackage/Tests/cmuxFeatureTests/cmuxFeatureTests.swift index 882354fa804e..58a3b1a48af2 100644 --- a/ios/cmuxPackage/Tests/cmuxFeatureTests/cmuxFeatureTests.swift +++ b/ios/cmuxPackage/Tests/cmuxFeatureTests/cmuxFeatureTests.swift @@ -110,7 +110,7 @@ final class TerminalOutputCollector { let loopback = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: CmxMobileDefaults.defaultHostPort) let tailscale = try hostPortRoute(kind: .tailscale, host: "100.71.210.41", port: CmxMobileDefaults.defaultHostPort) - let route = CMUXMobileShellStore.firstReconnectHostPortRoute( + let route = MobileShellRouteSelection().firstReconnectHostPortRoute( [loopback, tailscale], supportedKinds: [.tailscale] ) @@ -633,35 +633,66 @@ final class TerminalOutputCollector { } @MainActor -@Test func manualHostPairingRejectsTailscaleMagicDNSWithoutSendingAuth() async throws { - let responses = ScriptedTransportResponses([]) +@Test func manualHostPairingRequiresApprovalForTailscaleMagicDNSHost() async throws { + let attachRoute = try hostPortRoute( + kind: .manualHost, + host: "work-mac.tailnet.ts.net", + port: CmxMobileDefaults.defaultHostPort + ) + let responses = ScriptedTransportResponses([ + try rpcAttachTicketFrame(route: attachRoute, workspaceID: "live-workspace"), + try rpcWorkspaceListFrame(workspaceID: "live-workspace", title: "Live Workspace"), + ]) let runtime = testRuntime( - supportedRouteKinds: [.tailscale], + supportedRouteKinds: [.manualHost], transportFactory: ScriptedTransportFactory(responses: responses) ) let store = CMUXMobileShellStore.preview(runtime: runtime) store.signIn() - await store.connectManualHost(name: "Work Mac", host: "work-mac.tailnet.ts.net", port: CmxMobileDefaults.defaultHostPort) + let firstResult = await store.connectManualHost( + name: "Work Mac", + host: "work-mac.tailnet.ts.net", + port: CmxMobileDefaults.defaultHostPort + ) - #expect(store.phase == .pairing) - #expect(store.connectionState == .disconnected) - #expect(store.activeRoute == nil) + #expect(firstResult == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "work-mac.tailnet.ts.net:58465") #expect(try await responses.sentRequests().isEmpty) + + let approvedResult = await store.acceptManualHostTrustWarning() + + let route = try #require(store.activeRoute) + #expect(approvedResult == .connected) + #expect(store.phase == .workspaces) + #expect(store.connectedHostName == "Work Mac") + #expect(route.kind == .manualHost) + if case let .hostPort(host, port) = route.endpoint { + #expect(host == "work-mac.tailnet.ts.net") + #expect(port == CmxMobileDefaults.defaultHostPort) + } else { + Issue.record("approved manual route should use host/port") + } } @MainActor -@Test func manualHostPairingRejectsPrivateLANIPWithoutSendingStackToken() async throws { - // Plain private-LAN routes are dialed over unencrypted TCP, so - // routeAllowsStackAuth excludes them: pairing must fail before any RPC - // (and the Stack bearer token) leaves the device. - let responses = ScriptedTransportResponses([]) +@Test func manualHostPairingBlocksPrivateLANIPUntilApproved() async throws { + let attachRoute = try hostPortRoute( + kind: .manualHost, + host: "192.168.1.77", + port: 15432 + ) + let responses = ScriptedTransportResponses([ + try rpcAttachTicketFrame(route: attachRoute, workspaceID: "trusted-lan-workspace"), + try rpcWorkspaceListFrame(workspaceID: "trusted-lan-workspace", title: "Trusted LAN Workspace"), + ]) let runtime = testRuntime( - supportedRouteKinds: [.tailscale], + supportedRouteKinds: [.manualHost], transportFactory: ScriptedTransportFactory(responses: responses), stackAccessToken: "stack-token-for-lan" ) - let store = CMUXMobileShellStore.preview(runtime: runtime) + let trustStore = InMemoryMobileManualHostTrustStore() + let store = MobileShellPreviewFactory(runtime: runtime, manualHostTrustStore: trustStore).makeStore() store.signIn() await store.connectManualHost(name: "Studio LAN", host: " 192.168.1.77 ", port: 15432) @@ -670,51 +701,175 @@ final class TerminalOutputCollector { #expect(store.connectionState == .disconnected) #expect(store.activeTicket == nil) #expect(store.activeRoute == nil) - #expect(store.connectionError == "This pairing route is not allowed. Enter a host and port, or pair with a QR/link from that computer.") + #expect(store.connectionError == nil) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:15432") #expect(try await responses.sentRequests().isEmpty) + + let result = await store.acceptManualHostTrustWarning() + + #expect(result == .connected) + #expect(store.phase == .workspaces) + #expect(store.connectionState == .connected) + #expect(store.manualHostTrustWarning == nil) + let route = try #require(store.activeRoute) + #expect(route.kind == .manualHost) + let requests = try await responses.sentRequests() + #expect(requests.map(\.method) == ["mobile.attach_ticket.create", "workspace.list"]) + #expect(requests.allSatisfy { $0.stackAccessToken == "stack-token-for-lan" }) } @MainActor -@Test func manualHostPairingRejectsLocalDNSNameWithoutSendingStackToken() async throws { - // `.local`/Bonjour hosts are dialed over unencrypted TCP, so - // routeAllowsStackAuth excludes them: pairing must fail before any RPC - // (and the Stack bearer token) leaves the device. - let responses = ScriptedTransportResponses([]) +@Test func manualHostPairingApprovesBracketedIPv6ManualEntry() async throws { + let attachRoute = try hostPortRoute( + kind: .manualHost, + host: "fd00::12", + port: 15433 + ) + let responses = ScriptedTransportResponses([ + try rpcAttachTicketFrame(route: attachRoute, workspaceID: "trusted-ipv6-workspace"), + try rpcWorkspaceListFrame(workspaceID: "trusted-ipv6-workspace", title: "Trusted IPv6 Workspace"), + ]) let runtime = testRuntime( - supportedRouteKinds: [.tailscale], + supportedRouteKinds: [.manualHost], transportFactory: ScriptedTransportFactory(responses: responses), + stackAccessToken: "stack-token-for-ipv6" + ) + let store = MobileShellPreviewFactory( + runtime: runtime, + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ).makeStore() + + store.signIn() + await store.connectManualHost(name: "IPv6 LAN", host: "[fd00::12]", port: 15433) + + #expect(store.manualHostTrustWarning?.endpoint == "[fd00::12]:15433") + #expect(try await responses.sentRequests().isEmpty) + + let result = await store.acceptManualHostTrustWarning() + + #expect(result == .connected) + let route = try #require(store.activeRoute) + #expect(route.kind == .manualHost) + #expect(route.endpoint == .hostPort(host: "fd00::12", port: 15433)) + let requests = try await responses.sentRequests() + #expect(requests.map(\.method) == ["mobile.attach_ticket.create", "workspace.list"]) + #expect(requests.allSatisfy { $0.stackAccessToken == "stack-token-for-ipv6" }) +} + +@MainActor +@Test func manualHostTrustDoesNotCoverDifferentHost() async throws { + let approvedRoute = try hostPortRoute( + kind: .manualHost, + host: "studio-mac.local", + port: 61234 + ) + let approvedResponses = ScriptedTransportResponses([ + try rpcAttachTicketFrame(route: approvedRoute, workspaceID: "approved-workspace"), + try rpcWorkspaceListFrame(workspaceID: "approved-workspace", title: "Approved Workspace"), + ]) + let trustStore = InMemoryMobileManualHostTrustStore() + let approvedRuntime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: approvedResponses), stackAccessToken: "stack-token-for-local-dns" ) - let store = CMUXMobileShellStore.preview(runtime: runtime) + let approvedStore = MobileShellPreviewFactory(runtime: approvedRuntime, manualHostTrustStore: trustStore).makeStore() + + approvedStore.signIn() + await approvedStore.connectManualHost(name: "", host: "studio-mac.local", port: 61234) + #expect(approvedStore.manualHostTrustWarning?.endpoint == "studio-mac.local:61234") + _ = await approvedStore.acceptManualHostTrustWarning() + #expect(approvedStore.connectionState == .connected) + + let blockedResponses = ScriptedTransportResponses([]) + let runtime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: blockedResponses), + stackAccessToken: "stack-token-for-local-dns" + ) + let store = MobileShellPreviewFactory(runtime: runtime, manualHostTrustStore: trustStore).makeStore() store.signIn() - await store.connectManualHost(name: "", host: "devbox.local", port: 61234) + await store.connectManualHost(name: "", host: "other-mac.local", port: 61234) #expect(store.phase == .pairing) #expect(store.connectionState == .disconnected) #expect(store.activeTicket == nil) #expect(store.activeRoute == nil) - #expect(store.connectionError == "This pairing route is not allowed. Enter a host and port, or pair with a QR/link from that computer.") - #expect(try await responses.sentRequests().isEmpty) + #expect(store.manualHostTrustWarning?.endpoint == "other-mac.local:61234") + #expect(try await blockedResponses.sentRequests().isEmpty) } @MainActor -@Test func manualHostPairingRejectsTailscaleBeforeLegacyProbeOrFallback() async throws { - let responses = ScriptedTransportResponses([]) +@Test func manualHostPairingRequiresApprovalBeforeAttachTicketProbe() async throws { + // Host text alone does not prove that the connection traverses Tailscale. + // After explicit approval, an older Mac that does not implement the ticket + // probe falls back to a synthetic ticket and Stack-authenticated workspace.list. + let responses = ScriptedTransportResponses([ + try rpcErrorFrame(code: "method_not_found", message: "unknown method"), + try rpcWorkspaceListFrame(workspaceID: "manual-workspace", title: "Manual Workspace"), + try rpcHostStatusFrame( + renderGrid: false, + macDeviceID: "manual-100.71.210.41:15432" + ), + ]) let runtime = testRuntime( - supportedRouteKinds: [.tailscale], + supportedRouteKinds: [.manualHost], transportFactory: ScriptedTransportFactory(responses: responses), stackAccessToken: "stack-token-for-fallback" ) let store = CMUXMobileShellStore.preview(runtime: runtime) store.signIn() - await store.connectManualHost(name: "Work Mac", host: "100.71.210.41", port: 15432) + let firstResult = await store.connectManualHost( + name: "Work Mac", + host: "100.71.210.41", + port: 15432 + ) + + #expect(firstResult == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "100.71.210.41:15432") + #expect(try await responses.sentRequests().isEmpty) + + let approvedResult = await store.acceptManualHostTrustWarning() + + #expect(approvedResult == .connected) + #expect(store.phase == .workspaces) + #expect(store.connectionState == .connected) + #expect(store.connectionError == nil) + #expect(store.connectedHostName == "Work Mac") + #expect(store.activeRoute?.kind == .manualHost) + let requests = try await responses.sentRequests() + #expect(requests.map(\.method) == [ + "mobile.attach_ticket.create", "workspace.list", "mobile.host.status", + ]) + #expect(requests.allSatisfy { $0.stackAccessToken == "stack-token-for-fallback" }) + #expect(requests.allSatisfy { $0.attachToken == nil }) +} + +@MainActor +@Test func approvedManualHostPairingTimesOutWrongHostWithoutStayingConnected() async throws { + let runtime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: HangingTransportFactory(), + pairingRequestTimeoutNanoseconds: 1_000_000 + ) + let store = CMUXMobileShellStore.preview(runtime: runtime) + + store.signIn() + let firstResult = await store.connectManualHost( + name: "Slow Mac", + host: "work-mac.tailnet.ts.net", + port: CmxMobileDefaults.defaultHostPort + ) + let approvedResult = await store.acceptManualHostTrustWarning() + #expect(firstResult == .needsUserApproval) + #expect(approvedResult == .failed) #expect(store.phase == .pairing) #expect(store.connectionState == .disconnected) - #expect(store.activeRoute == nil) - #expect(try await responses.sentRequests().isEmpty) + #expect(store.connectionError == "No response from work-mac.tailnet.ts.net:58465. Your Mac may be asleep or off Tailscale. Make sure it's awake and on the same Tailscale network.") + #expect(store.connectionErrorGuidance != nil) } @MainActor @@ -732,7 +887,11 @@ final class TerminalOutputCollector { let store = CMUXMobileShellStore.preview(runtime: runtime) store.signIn() - await store.connectManualHost(name: "Slow Mac", host: "work-mac.tailnet.ts.net", port: CmxMobileDefaults.defaultHostPort) + await store.connectManualHost( + name: "Slow Mac", + host: "work-mac.tailnet.ts.net", + port: CmxMobileDefaults.defaultHostPort + ) #expect(route.kind == .tailscale) #expect(store.phase == .pairing) @@ -749,17 +908,31 @@ final class TerminalOutputCollector { // the per-route timeouts into the opaque ~60s wait the reporter saw. let dials = TransportDialRecorder() let runtime = testRuntime( - supportedRouteKinds: [.tailscale], + supportedRouteKinds: [.manualHost], transportFactory: RecordingNeverConnectTransportFactory(dials: dials) ) let store = CMUXMobileShellStore( runtime: runtime, - reachability: OfflineReachability() + identityProvider: TestIdentityProvider( + currentUserIDValue: "feature-test-user", + currentUserEmailValue: nil + ), + reachability: OfflineReachability(), + manualHostTrustStore: InMemoryMobileManualHostTrustStore() ) store.signIn() - await store.connectManualHost(name: "Work Mac", host: "work-mac.tailnet.ts.net", port: CmxMobileDefaults.defaultHostPort) + let firstResult = await store.connectManualHost( + name: "Work Mac", + host: "work-mac.tailnet.ts.net", + port: CmxMobileDefaults.defaultHostPort + ) + #expect(firstResult == .needsUserApproval) + #expect(dials.count == 0) + let approvedResult = await store.acceptManualHostTrustWarning() + + #expect(approvedResult == .failed) #expect(store.phase == .pairing) #expect(store.connectionState == .disconnected) // Non-empty, offline-specific headline: the spinner can no longer revert @@ -918,6 +1091,10 @@ final class TerminalOutputCollector { ) let store = CMUXMobileShellStore( runtime: runtime, + identityProvider: TestIdentityProvider( + currentUserIDValue: "feature-test-user", + currentUserEmailValue: nil + ), reachability: OfflineReachability() ) @@ -960,7 +1137,7 @@ final class TerminalOutputCollector { } @MainActor -@Test func unsupportedAttachTicketClearsPreviousRemoteClient() async throws { +@Test func unsupportedAttachTicketPreservesPreviousRemoteClient() async throws { let supportedRoute = try hostPortRoute(kind: .debugLoopback, host: "127.0.0.1", port: CmxMobileDefaults.defaultHostPort) let supportedTicket = try CmxAttachTicket( workspaceID: "live-workspace", @@ -986,6 +1163,7 @@ final class TerminalOutputCollector { store.signIn() await store.connectPairingURL(try attachURL(for: supportedTicket).absoluteString) #expect(store.phase == .workspaces) + let originalClient = try #require(store.remoteClient) let unsupportedRoute = try CmxAttachRoute( id: "iroh", @@ -1007,15 +1185,12 @@ final class TerminalOutputCollector { ) await store.connectPairingURL(try attachURL(for: unsupportedTicket).absoluteString) - #expect(store.connectionState == .disconnected) + #expect(store.connectionState == .connected) + #expect(store.remoteClient === originalClient) #expect(store.connectionError == "This pairing code is not supported.") - store.terminalInputText = "echo should-not-hit-old-host" - await store.submitTerminalInput() - let requests = try await responses.sentRequests() #expect(requests.contains { $0.method == "workspace.list" }) - #expect(!requests.contains { $0.method == "terminal.input" }) } @MainActor @@ -1756,6 +1931,180 @@ final class TerminalOutputCollector { #expect(store.connectionError != MobilePairingFailureCategory.invalidCode.message) } +@MainActor +@Test func pairingQRCodeManualHostBlocksUntilApproved() async throws { + let responses = ScriptedTransportResponses([ + try rpcWorkspaceListFrame(workspaceID: "qr-manual-workspace", title: "QR Manual Workspace"), + try rpcHostStatusFrame( + renderGrid: false, + macDeviceID: "qr-manual-mac", + macDisplayName: "QR Manual Mac" + ), + ]) + let runtime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: responses), + stackAccessToken: "stack-token-for-qr-manual" + ) + let trustStore = InMemoryMobileManualHostTrustStore() + let store = MobileShellPreviewFactory(runtime: runtime, manualHostTrustStore: trustStore).makeStore() + let url = "cmux-ios://attach?v=3&pc=1&m=studio-mac.local:61234" + + store.signIn() + let firstResult = await store.connectPairingURLResult(url) + + #expect(firstResult == .needsUserApproval) + #expect(store.connectionState == .disconnected) + #expect(store.activeTicket == nil) + #expect(store.activeRoute == nil) + #expect(store.manualHostTrustWarning?.endpoint == "studio-mac.local:61234") + #expect(try await responses.sentRequests().isEmpty) + + let approvedResult = await store.acceptManualHostTrustWarning() + + #expect(approvedResult == .connected) + #expect(store.connectionState == .connected) + #expect(store.manualHostTrustWarning == nil) + let route = try #require(store.activeRoute) + #expect(route.kind == .manualHost) + let requests = try await responses.sentRequests() + #expect(requests.contains { request in + request.method == "workspace.list" && + request.stackAccessToken == "stack-token-for-qr-manual" + }) +} + +@MainActor +@Test func newPairingValidationClearsStaleManualHostTrustWarning() async throws { + let responses = ScriptedTransportResponses([]) + let runtime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: responses), + stackAccessToken: "stack-token-for-stale-manual-warning" + ) + let store = MobileShellPreviewFactory( + runtime: runtime, + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ).makeStore() + + store.signIn() + let firstResult = await store.connectPairingURLResult( + "cmux-ios://attach?v=3&pc=1&m=studio-mac.local:61234" + ) + let secondResult = await store.connectPairingURLResult("not a cmux pairing url") + let staleApprovalResult = await store.acceptManualHostTrustWarning() + + #expect(firstResult == .needsUserApproval) + #expect(secondResult == .failed) + #expect(staleApprovalResult == .superseded) + #expect(store.manualHostTrustWarning == nil) + #expect(store.connectionState == .disconnected) + #expect(try await responses.sentRequests().isEmpty) +} + +@MainActor +@Test func signOutClearsPendingManualHostTrustWarning() async throws { + let responses = ScriptedTransportResponses([]) + let runtime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: responses), + stackAccessToken: "stack-token-for-signout-manual-warning" + ) + let store = MobileShellPreviewFactory( + runtime: runtime, + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ).makeStore() + + store.signIn() + let firstResult = await store.connectPairingURLResult( + "cmux-ios://attach?v=3&pc=1&m=studio-mac.local:61234" + ) + store.signOut() + let staleApprovalResult = await store.acceptManualHostTrustWarning() + + #expect(firstResult == .needsUserApproval) + #expect(staleApprovalResult == .superseded) + #expect(store.manualHostTrustWarning == nil) + #expect(store.connectionState == .disconnected) + #expect(try await responses.sentRequests().isEmpty) +} + +@MainActor +@Test func teamSwitchClearsPendingManualHostTrustWarning() async throws { + let responses = ScriptedTransportResponses([]) + let runtime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: responses), + stackAccessToken: "stack-token-for-team-switch-manual-warning" + ) + let store = MobileShellPreviewFactory( + runtime: runtime, + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ).makeStore() + + store.signIn() + let firstResult = await store.connectPairingURLResult( + "cmux-ios://attach?v=3&pc=1&m=studio-mac.local:61234" + ) + store.currentTeamDidChange() + let staleApprovalResult = await store.acceptManualHostTrustWarning() + + #expect(firstResult == .needsUserApproval) + #expect(staleApprovalResult == .superseded) + #expect(store.manualHostTrustWarning == nil) + #expect(try await responses.sentRequests().isEmpty) +} + +@MainActor +@Test func manualHostTrustWarningSupersedesPendingVersionWarning() async throws { + let responses = ScriptedTransportResponses([]) + let runtime = testRuntime( + supportedRouteKinds: [.tailscale, .manualHost], + transportFactory: ScriptedTransportFactory(responses: responses), + stackAccessToken: "stack-token-for-version-manual-warning" + ) + let store = MobileShellPreviewFactory( + runtime: runtime, + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ).makeStore() + + store.signIn() + let versionWarningResult = await store.connectPairingURLResult( + "cmux-ios://attach?v=2&pc=2&av=0.65.0&ab=9&r=100.71.210.41:\(CmxMobileDefaults.defaultHostPort)" + ) + await store.connectManualHost(name: "Studio LAN", host: "192.168.1.77", port: 15432) + let staleVersionApprovalResult = await store.acceptPairingVersionWarning() + + #expect(versionWarningResult == .needsUserApproval) + #expect(staleVersionApprovalResult == .failed) + #expect(store.pairingVersionWarning == nil) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:15432") + #expect(try await responses.sentRequests().isEmpty) +} + +@MainActor +@Test func mixedPairingQRCodeBlocksManualFallbackUntilApproved() async throws { + let responses = ScriptedTransportResponses([]) + let runtime = testRuntime( + supportedRouteKinds: [.tailscale, .manualHost], + transportFactory: FailingRouteTransportFactory(failingRouteID: "tailscale", responses: responses, attempts: RouteAttemptRecorder()), + stackAccessToken: "stack-token-for-mixed-manual" + ) + let store = MobileShellPreviewFactory( + runtime: runtime, + manualHostTrustStore: InMemoryMobileManualHostTrustStore() + ).makeStore() + let url = "cmux-ios://attach?v=3&pc=1&r=100.71.210.41:61234&m=studio-mac.local:61234" + + store.signIn() + let result = await store.connectPairingURLResult(url) + + #expect(result == .needsUserApproval) + #expect(store.connectionState == .disconnected) + #expect(store.manualHostTrustWarning?.endpoint == "studio-mac.local:61234") + #expect(try await responses.sentRequests().isEmpty) +} + @MainActor @Test func pairLinkWithoutAttachTokenRejectsArbitraryHostBeforeSendingAuth() async throws { let route = try hostPortRoute(kind: .tailscale, host: "attacker.example", port: CmxMobileDefaults.defaultHostPort) @@ -1787,48 +2136,95 @@ final class TerminalOutputCollector { } @MainActor -@Test func manualHostPairingRejectsTailscaleIPWithoutSendingStackToken() async throws { - let responses = ScriptedTransportResponses([]) +@Test func manualHostPairingRequiresApprovalForTailscaleIP() async throws { + let attachRoute = try hostPortRoute( + kind: .manualHost, + host: "100.71.210.41", + port: CmxMobileDefaults.defaultHostPort + ) + let responses = ScriptedTransportResponses([ + try rpcAttachTicketFrame(route: attachRoute, workspaceID: "tailscale-ip-workspace"), + try rpcWorkspaceListFrame(workspaceID: "tailscale-ip-workspace", title: "Tailscale IP Workspace"), + ]) let runtime = testRuntime( - supportedRouteKinds: [.tailscale], + supportedRouteKinds: [.manualHost], transportFactory: ScriptedTransportFactory(responses: responses), stackAccessToken: "stack-token-for-tailscale-ip" ) let store = CMUXMobileShellStore.preview(runtime: runtime) store.signIn() - await store.connectManualHost(name: "Work Mac", host: "100.71.210.41", port: CmxMobileDefaults.defaultHostPort) + let firstResult = await store.connectManualHost( + name: "Work Mac", + host: "100.71.210.41", + port: CmxMobileDefaults.defaultHostPort + ) - #expect(store.phase == .pairing) - #expect(store.connectionState == .disconnected) - #expect(store.activeTicket == nil) - #expect(store.activeRoute == nil) - #expect(store.connectionError == "This pairing route is not allowed. Enter a host and port, or pair with a QR/link from that computer.") + #expect(firstResult == .needsUserApproval) + #expect(store.manualHostTrustWarning?.endpoint == "100.71.210.41:58465") #expect(try await responses.sentRequests().isEmpty) + + let approvedResult = await store.acceptManualHostTrustWarning() + + let route = try #require(store.activeRoute) + #expect(approvedResult == .connected) + #expect(store.phase == .workspaces) + #expect(store.connectionState == .connected) + #expect(store.connectionError == nil) + #expect(store.connectedHostName == "Work Mac") + #expect(route.kind == .manualHost) + if case let .hostPort(host, port) = route.endpoint { + #expect(host == "100.71.210.41") + #expect(port == CmxMobileDefaults.defaultHostPort) + } else { + Issue.record("approved manual IP route should use host/port") + } + let attachTicketRequest = try #require(try await responses.sentRequests().first { $0.method == "mobile.attach_ticket.create" }) + #expect(attachTicketRequest.stackAccessToken == "stack-token-for-tailscale-ip") } @MainActor -@Test func manualHostPairingRejectsDefaultPortLANHostWithoutSendingStackToken() async throws { - // Same encrypted-routes-only contract as the explicit-port LAN test, on - // the default host port: no RPC (and no Stack bearer token) may leave the - // device for a plain-TCP private-LAN route. - let responses = ScriptedTransportResponses([]) +@Test func manualHostTrustDoesNotCoverDifferentPort() async throws { + let approvedRoute = try hostPortRoute( + kind: .manualHost, + host: "192.168.1.77", + port: CmxMobileDefaults.defaultHostPort + ) + let approvedResponses = ScriptedTransportResponses([ + try rpcAttachTicketFrame(route: approvedRoute, workspaceID: "approved-default-port"), + try rpcWorkspaceListFrame(workspaceID: "approved-default-port", title: "Approved Default Port"), + ]) + let trustStore = InMemoryMobileManualHostTrustStore() + let approvedRuntime = testRuntime( + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: approvedResponses), + stackAccessToken: "stack-token-for-default-lan" + ) + let approvedStore = MobileShellPreviewFactory(runtime: approvedRuntime, manualHostTrustStore: trustStore).makeStore() + + approvedStore.signIn() + await approvedStore.connectManualHost(name: "Work Mac", host: "192.168.1.77", port: CmxMobileDefaults.defaultHostPort) + #expect(approvedStore.manualHostTrustWarning?.endpoint == "192.168.1.77:\(CmxMobileDefaults.defaultHostPort)") + _ = await approvedStore.acceptManualHostTrustWarning() + #expect(approvedStore.connectionState == .connected) + + let blockedResponses = ScriptedTransportResponses([]) let runtime = testRuntime( - supportedRouteKinds: [.tailscale], - transportFactory: ScriptedTransportFactory(responses: responses), + supportedRouteKinds: [.manualHost], + transportFactory: ScriptedTransportFactory(responses: blockedResponses), stackAccessToken: "stack-token-for-default-lan" ) - let store = CMUXMobileShellStore.preview(runtime: runtime) + let store = MobileShellPreviewFactory(runtime: runtime, manualHostTrustStore: trustStore).makeStore() store.signIn() - await store.connectManualHost(name: "Work Mac", host: "192.168.1.77", port: CmxMobileDefaults.defaultHostPort) + await store.connectManualHost(name: "Work Mac", host: "192.168.1.77", port: CmxMobileDefaults.defaultHostPort + 1) #expect(store.phase == .pairing) #expect(store.connectionState == .disconnected) #expect(store.activeTicket == nil) #expect(store.activeRoute == nil) - #expect(store.connectionError == "This pairing route is not allowed. Enter a host and port, or pair with a QR/link from that computer.") - #expect(try await responses.sentRequests().isEmpty) + #expect(store.manualHostTrustWarning?.endpoint == "192.168.1.77:\(CmxMobileDefaults.defaultHostPort + 1)") + #expect(try await blockedResponses.sentRequests().isEmpty) } @MainActor