Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
Conversation screens, bot settings and folder picking use Codync's own modals and headers, animated
leepokaiba67dbbac4d1
diff --git a/kit/Sources/CodyncUI/Bots/BotEditorView.swift b/kit/Sources/CodyncUI/Bots/BotEditorView.swiftindex ad289af0..76400721 100644--- a/kit/Sources/CodyncUI/Bots/BotEditorView.swift+++ b/kit/Sources/CodyncUI/Bots/BotEditorView.swift@@ -8,10 +8,10 @@ public struct EditorRequest: Identifiable {public init(_ draft: BotDraft) { self.draft = draft }}-/// Create or edit a bot in a sheet (iPhone): the settings form plus Cancel / Save.+/// Create or edit a bot in a modal (iPhone): the settings form plus Close / Save.public struct BotEditorView: View {@Environment(BotStore.self) private var model- @Environment(\.dismiss) private var dismiss+ @Environment(\.dismissModal) private var dismiss@State var draft: BotDraftpublic init(draft: BotDraft) { _draft = State(initialValue: draft) }@@ -21,25 +21,19 @@ public struct BotEditorView: View {private var isNew: Bool { draft.id == nil }public var body: some View {- BotSettingsForm(draft: $draft, error: error)- .navigationTitle(isNew ? "New bot" : "Settings")- .inlineNavigationTitle()- .toolbar {- ToolbarItem(placement: .cancellationAction) {- Button("Cancel", systemImage: "xmark") { dismiss() }.labelStyle(.iconOnly).help("Cancel")- }- ToolbarItem(placement: .confirmationAction) {- if saving {- Spinner()- } else {- Button(isNew ? "Create" : "Save", systemImage: "checkmark") { save() }- .labelStyle(.iconOnly)- .help(isNew ? "Create" : "Save")- .disabled(!draft.isValid)- }+ VStack(spacing: 0) {+ ModalHeader(isNew ? "New bot" : "Settings") {+ if saving {+ Spinner()+ } else {+ IconButton(isNew ? "Create" : "Save", systemImage: "checkmark") { save() }+ .disabled(!draft.isValid)}}- .onAppear { if isNew { model.fillDefaults(&draft) } }+ BotSettingsForm(draft: $draft, error: error)+ }+ .background(Palette.background)+ .onAppear { if isNew { model.fillDefaults(&draft) } }}private func save() {@@ -100,6 +94,7 @@ struct BotSettingsForm: View {@Environment(BotStore.self) private var model@State private var pickingFolder = false@State private var pickingAvatar = false+ @State private var avatarFrame: CGRect = .zerovar body: some View {ScrollView {@@ -114,10 +109,13 @@ struct BotSettingsForm: View {.buttonStyle(.plain).accessibilityLabel("Edit Bot avatar").help("Edit Bot avatar")- .popover(isPresented: $pickingAvatar) {- AvatarPicker(shape: $draft.avatarShape, color: $draft.avatarColor)- .padding(14)- .frame(width: 300)+ .onGeometryChange(for: CGRect.self) { $0.frame(in: .global) } action: { avatarFrame = $0 }+ .codyncOverlay(isPresented: $pickingAvatar) { close in+ AnchoredPanel(anchor: avatarFrame, close: close) {+ AvatarPicker(shape: $draft.avatarShape, color: $draft.avatarColor)+ .padding(14)+ .frame(width: 300)+ }}#elseCharacterAvatar(shape: draft.avatarShape, color: draft.avatarColor, size: 96)@@ -244,20 +242,13 @@ struct BotSettingsForm: View {.scrollDismissesKeyboard(.interactively).background(Palette.background).task { await model.refreshPlugins() }- .sheet(isPresented: $pickingFolder) {- NavigationStack {- FolderPicker(path: draft.cwd.isEmpty ? model.hello?.home : draft.cwd) {- draft.cwd = $0- pickingFolder = false- }- .toolbar {- ToolbarItem(placement: .cancellationAction) {- Button("Cancel", systemImage: "xmark") { pickingFolder = false }.labelStyle(.iconOnly).help("Cancel")- }- }+ .codyncSheet(isPresented: $pickingFolder) {+ FolderPicker(start: draft.cwd.isEmpty ? model.hello?.home : draft.cwd) {+ draft.cwd = $0+ pickingFolder = false}#if os(macOS)- .frame(minWidth: 460, minHeight: 520)+ .frame(width: 460, height: 520)#endif}}@@ -390,7 +381,7 @@ struct AvatarPicker: View {CharacterAvatar(shape: s, color: color, size: 36).padding(4).background(Circle().strokeBorder(s == shape ? Palette.accent : .clear, lineWidth: 2))- .onTapGesture { shape = s }+ .onTapGesture { withAnimation(Motion.hover) { shape = s } }.accessibilityLabel("\(s) shape").accessibilityAddTraits(s == shape ? .isSelected : [])}@@ -405,7 +396,7 @@ struct AvatarPicker: View {.frame(width: 26, height: 26).padding(4).background(Circle().strokeBorder(c.id == color ? Palette.accent : .clear, lineWidth: 2))- .onTapGesture { color = c.id }+ .onTapGesture { withAnimation(Motion.hover) { color = c.id } }.accessibilityLabel(c.label).accessibilityAddTraits(c.id == color ? .isSelected : [])}@@ -416,10 +407,60 @@ struct AvatarPicker: View {}}-/// Browses folders on the host.+/// Browses folders on the host, drilling down in place.struct FolderPicker: View {+ let start: String?+ let onPick: (String) -> Void+ /// The folders opened so far; the last one is shown.+ @State private var stack: [String?]+ @State private var forward = true+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ init(start: String?, onPick: @escaping (String) -> Void) {+ self.start = start+ self.onPick = onPick+ _stack = State(initialValue: [start])+ }++ var body: some View {+ let current = stack.last ?? nil+ VStack(spacing: 0) {+ HStack(spacing: 0) {+ if stack.count > 1 {+ BackButton { go(forward: false) { stack.removeLast() } }+ .padding(.leading, InterfaceMetrics.value(mac: 10, mobile: 12))+ .transition(.opacity)+ }+ ModalHeader(current.map { ($0 as NSString).lastPathComponent } ?? "Folders")+ }+ ZStack {+ FolderLevel(path: current, onPick: onPick) { path in go(forward: true) { stack.append(path) } }+ .id(stack.count)+ .transition(.asymmetric(+ insertion: .move(edge: forward ? .trailing : .leading),+ removal: .move(edge: forward ? .leading : .trailing)+ ).combined(with: .opacity))+ }+ .frame(maxHeight: .infinity, alignment: .top)+ .clipped()+ }+ .background(Palette.background)+ }++ /// Sets the slide direction first, so the leaving level takes it too, then moves.+ private func go(forward: Bool, _ change: @escaping () -> Void) {+ self.forward = forward+ Task { @MainActor in+ withAnimation(Motion.reduced(Motion.layout, reduceMotion), change)+ }+ }+}++/// One folder's subfolders.+private struct FolderLevel: View {let path: String?let onPick: (String) -> Void+ let open: (String) -> Void@Environment(BotStore.self) private var model@State private var listing: DirListing?@State private var error: String?@@ -440,14 +481,14 @@ struct FolderPicker: View {.frame(maxWidth: .infinity, alignment: .leading).contentShape(Rectangle())}- .buttonStyle(.plain)+ .buttonStyle(PressScale())}let dirs = listing.dirs.filter { filter.isEmpty || $0.name.localizedCaseInsensitiveContains(filter) }if !dirs.isEmpty {CardSection {ForEach(dirs) { dir in- NavigationLink {- FolderPicker(path: dir.path, onPick: onPick)+ Button {+ open(dir.path)} label: {HStack(spacing: 10) {Image(systemName: dir.isGit ? "arrow.triangle.branch" : "folder")@@ -461,7 +502,7 @@ struct FolderPicker: View {}.contentShape(Rectangle())}- .buttonStyle(.plain)+ .buttonStyle(PressScale())}}}@@ -476,8 +517,6 @@ struct FolderPicker: View {}.scrollDismissesKeyboard(.interactively).background(Palette.background)- .navigationTitle(listing.map { ($0.path as NSString).lastPathComponent } ?? "Folders")- .inlineNavigationTitle().task {do { listing = try await model.listDirs(path) } catch { self.error = error.localizedDescription }}diff --git a/kit/Sources/CodyncUI/Bots/BotRow.swift b/kit/Sources/CodyncUI/Bots/BotRow.swiftindex 2cf61247..eb06d81c 100644--- a/kit/Sources/CodyncUI/Bots/BotRow.swift+++ b/kit/Sources/CodyncUI/Bots/BotRow.swift@@ -142,9 +142,7 @@ public struct ConnectionBanner: View {}Spacer()if retry {- Button("Retry", systemImage: "arrow.clockwise") { model.restartStream() }- .labelStyle(.iconOnly)- .help("Retry")+ IconButton("Retry", systemImage: "arrow.clockwise") { model.restartStream() }}}.padding(10)diff --git a/kit/Sources/CodyncUI/Bots/BotTemplateView.swift b/kit/Sources/CodyncUI/Bots/BotTemplateView.swiftindex f0f68b63..3faad00f 100644--- a/kit/Sources/CodyncUI/Bots/BotTemplateView.swift+++ b/kit/Sources/CodyncUI/Bots/BotTemplateView.swift@@ -3,7 +3,7 @@ import SwiftUI/// A portable settings snapshot, with no conversation identity or runtime state.struct BotTemplateView: View {- @Environment(\.dismiss) private var dismiss+ @Environment(\.accessibilityReduceMotion) private var reduceMotion@State private var copied = falseprivate let template: BotDraftprivate let encoded: String?@@ -20,18 +20,10 @@ struct BotTemplateView: View {}var body: some View {+ VStack(spacing: 0) {+ ModalHeader("Create template")VStack(alignment: .leading, spacing: 20) {- HStack {- VStack(alignment: .leading, spacing: 5) {- Text("Create template").font(.title2.weight(.semibold))- Text(template.name).font(.subheadline).foregroundStyle(Palette.secondary)- }- Spacer()- Button("Close", systemImage: "xmark") { dismiss() }- .labelStyle(.iconOnly)- .buttonStyle(.plain)- .keyboardShortcut(.cancelAction)- }+ Text(template.name).font(.subheadline).foregroundStyle(Palette.secondary)Text("Copy this bot’s settings to reuse as a template. Conversation history and conversation ID are excluded.").font(.callout).foregroundStyle(Palette.secondary)@@ -49,7 +41,7 @@ struct BotTemplateView: View {Spacer()Button {Pasteboard.copy(encoded)- copied = true+ withAnimation(Motion.reduced(Motion.morph, reduceMotion)) { copied = true }} label: {Label(copied ? "Copied" : "Copy template", systemImage: copied ? "checkmark" : "square.on.square").font(.system(size: 13, weight: .semibold))@@ -62,7 +54,8 @@ struct BotTemplateView: View {.keyboardShortcut(.defaultAction)}}- .padding(24)+ .padding([.horizontal, .bottom], 24)+ }.frame(width: 560, height: 540).background(Palette.background)}diff --git a/kit/Sources/CodyncUI/Bots/MemoryView.swift b/kit/Sources/CodyncUI/Bots/MemoryView.swiftindex e222d25a..e456dcda 100644--- a/kit/Sources/CodyncUI/Bots/MemoryView.swift+++ b/kit/Sources/CodyncUI/Bots/MemoryView.swift@@ -98,7 +98,7 @@ struct MemoryCard: View {}private func forget(_ fact: MemoryFact) {- facts.removeAll { $0.id == fact.id }+ withAnimation(Motion.layout) { facts.removeAll { $0.id == fact.id } }Task {try? await model.client?.forgetMemory(botId: botId, id: fact.id)await load()@@ -106,7 +106,7 @@ struct MemoryCard: View {}private func clear() {- facts = []+ withAnimation(Motion.layout) { facts = [] }Task {try? await model.client?.clearMemory(botId: botId)await load()diff --git a/kit/Sources/CodyncUI/Bots/NewChatView.swift b/kit/Sources/CodyncUI/Bots/NewChatView.swiftindex 2ed22b22..9b2055c6 100644--- a/kit/Sources/CodyncUI/Bots/NewChatView.swift+++ b/kit/Sources/CodyncUI/Bots/NewChatView.swift@@ -27,16 +27,13 @@ public struct NewChatView: View {.textFieldStyle(.plain).focused($toFocused).onSubmit { if let first = matches.first { pick(first) } else { create() } }- Button("Close", systemImage: "xmark", action: close)- .labelStyle(.iconOnly)- .buttonStyle(.plain)- .foregroundStyle(Palette.secondary)+ IconButton("Close", systemImage: "xmark", action: close).keyboardShortcut(.cancelAction)}.font(.title3).padding(.horizontal, 22).padding(.vertical, 16)- Divider().overlay(Palette.border)+ Rectangle().fill(Palette.border).frame(height: 0.5)ScrollView {VStack(spacing: 2) {diff --git a/kit/Sources/CodyncUI/Platform.swift b/kit/Sources/CodyncUI/Platform.swiftindex d9bb9505..df107eac 100644--- a/kit/Sources/CodyncUI/Platform.swift+++ b/kit/Sources/CodyncUI/Platform.swift@@ -19,14 +19,6 @@ enum Pasteboard {}extension View {- func inlineNavigationTitle() -> some View {- #if os(iOS)- navigationBarTitleDisplayMode(.inline)- #else- self- #endif- }-func plainTextInput() -> some View {#if os(iOS)textInputAutocapitalization(.never).autocorrectionDisabled()diff --git a/kit/Sources/CodyncUI/Screen/ScreenView.swift b/kit/Sources/CodyncUI/Screen/ScreenView.swiftindex 6ca855a8..6a2739f5 100644--- a/kit/Sources/CodyncUI/Screen/ScreenView.swift+++ b/kit/Sources/CodyncUI/Screen/ScreenView.swift@@ -8,8 +8,11 @@ import UIKitpublic struct ScreenView: View {@Environment(BotStore.self) private var model@Environment(\.dismiss) private var dismiss+ @Environment(\.accessibilityReduceMotion) private var reduceMotion/// The bot being watched, when opened from its chat.private let watching: String?+ /// Animated close from the presenting layer (`.codyncOverlay`'s `close`); falls back to `dismiss`.+ private let close: (() -> Void)?@State private var session: ScreenSession?@State private var display: ScreenDisplay?@@ -21,8 +24,9 @@ public struct ScreenView: View {@State private var resetToken = 0@State private var tookOver = false- public init(watching: String? = nil) {+ public init(watching: String? = nil, close: (() -> Void)? = nil) {self.watching = watching+ self.close = close}private var screen: ScreenState? { model.screen }@@ -43,7 +47,10 @@ public struct ScreenView: View {}.overlay(alignment: .top) { topBar }.safeAreaInset(edge: .bottom) {- if keyboard && interactive { ModifierBar(armed: $armed) { session?.send(["type": "key", "key": $0, "modifiers": armed]); armed = [] } }+ if keyboard && interactive {+ ModifierBar(armed: $armed) { session?.send(["type": "key", "key": $0, "modifiers": armed]); armed = [] }+ .transition(.move(edge: .bottom).combined(with: .opacity))+ }}.statusBarHidden().persistentSystemOverlays(.hidden)@@ -89,25 +96,26 @@ public struct ScreenView: View {private var topBar: some View {HStack(spacing: 8) {- OverlayButton("Close", "xmark") { dismiss() }+ OverlayButton("Close", "xmark") { if let close { close() } else { dismiss() } }if let agent, !interactive {Label("\(agent.name) is using the computer", systemImage: "cursorarrow.motionlines").font(.caption.weight(.medium)).padding(.horizontal, 10).padding(.vertical, 6).background(.ultraThinMaterial, in: Capsule())+ .transition(.opacity)}Spacer()if session != nil {if interactive {- OverlayButton(keyboard ? "Hide keyboard" : "Keyboard", keyboard ? "keyboard.chevron.compact.down" : "keyboard") { keyboard.toggle() }+ OverlayButton(keyboard ? "Hide keyboard" : "Keyboard", keyboard ? "keyboard.chevron.compact.down" : "keyboard") { animate { keyboard.toggle() } }OverlayButton(mode == .trackpad ? "Touch mode: trackpad" : "Touch mode: direct", mode == .trackpad ? "rectangle.and.hand.point.up.left" : "hand.point.up.left") {- mode = mode == .trackpad ? .direct : .trackpad+ animate { mode = mode == .trackpad ? .direct : .trackpad }}clipboardMenu}if zoomed {- OverlayButton("Fit screen", "arrow.down.right.and.arrow.up.left") { resetToken += 1 }+ OverlayButton("Fit screen", "arrow.down.right.and.arrow.up.left") { animate { resetToken += 1 } }}if let displays = screen?.displays, displays.count > 1 {DropdownMenu {@@ -121,14 +129,19 @@ public struct ScreenView: View {} label: { IconLabel("Displays", "display.2") }}OverlayButton(interactive ? "Hand back to bots" : "Take over", interactive ? "hand.raised.slash" : "hand.raised") {- setInteractive(!interactive)+ animate { setInteractive(!interactive) }}}}+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: zoomed).padding(.horizontal, 12).padding(.top, 6)}+ private func animate(_ change: () -> Void) {+ withAnimation(Motion.reduced(Motion.layout, reduceMotion), change)+ }+private var clipboardMenu: some View {// MenuItem has no disabled state: unavailable actions are left out instead.DropdownMenu {@@ -220,6 +233,7 @@ private struct OverlayButton: View {var body: some View {Button(action: action) { IconLabel(label, icon) }+ .buttonStyle(PressScale())}}@@ -256,22 +270,26 @@ private struct ModifierBar: View {ForEach(Self.modifiers, id: \.0) { name, icon inlet on = armed.contains(name)Button {- if on { armed.removeAll { $0 == name } } else { armed.append(name) }+ withAnimation(Motion.hover) {+ if on { armed.removeAll { $0 == name } } else { armed.append(name) }+ }} label: {Image(systemName: icon).frame(width: 40, height: 34).background(on ? Color.white : Color.white.opacity(0.12), in: RoundedRectangle(cornerRadius: 8)).foregroundStyle(on ? Color.black : Color.white)}+ .buttonStyle(PressScale()).accessibilityLabel(name).accessibilityAddTraits(on ? .isSelected : [])}- Divider().frame(height: 24).overlay(.white.opacity(0.3))+ Rectangle().fill(.white.opacity(0.3)).frame(width: 0.5, height: 24)ForEach(Self.keys, id: \.0) { name, icon inButton { press(name) } label: {Image(systemName: icon).frame(width: 40, height: 34).background(Color.white.opacity(0.12), in: RoundedRectangle(cornerRadius: 8)).foregroundStyle(.white)}+ .buttonStyle(PressScale()).accessibilityLabel(name)}}diff --git a/kit/Sources/CodyncUI/Thread/ChatRows.swift b/kit/Sources/CodyncUI/Thread/ChatRows.swiftindex 1cafc2fd..98987f9b 100644--- a/kit/Sources/CodyncUI/Thread/ChatRows.swift+++ b/kit/Sources/CodyncUI/Thread/ChatRows.swift@@ -50,6 +50,7 @@ struct UserBubble: View {.help("Don't send").accessibilityLabel("Don't send")}+ .buttonStyle(.plain).font(.caption2)case "delivering":Text("Delivered to the computer").font(.caption2).foregroundStyle(Palette.tertiary)diff --git a/kit/Sources/CodyncUI/Thread/PermissionCard.swift b/kit/Sources/CodyncUI/Thread/PermissionCard.swiftindex c9f23633..f69218e3 100644--- a/kit/Sources/CodyncUI/Thread/PermissionCard.swift+++ b/kit/Sources/CodyncUI/Thread/PermissionCard.swift@@ -92,7 +92,7 @@ struct PermissionCard: View {let options = orderedreturn VStack(spacing: 0) {ForEach(Array(options.enumerated()), id: \.element.id) { i, o in- if i > 0 { Divider().overlay(Palette.border) }+ if i > 0 { Rectangle().fill(Palette.border).frame(height: 0.5) }Button { respond(o.optionId) } label: {Text(label(o)).font(.body.weight(o.kind == "allow_once" ? .semibold : .regular))diff --git a/kit/Sources/CodyncUI/Thread/ThreadView.swift b/kit/Sources/CodyncUI/Thread/ThreadView.swiftindex 03e5ed14..119c8a57 100644--- a/kit/Sources/CodyncUI/Thread/ThreadView.swift+++ b/kit/Sources/CodyncUI/Thread/ThreadView.swift@@ -21,6 +21,7 @@ public struct ThreadView: View {@State private var availableWidth: CGFloat = 800@State private var compactDetails = false@FocusState private var composerFocused: Bool+ @Environment(\.accessibilityReduceMotion) private var reduceMotionprivate var bot: Bot? { model.bots[botId] }@@ -30,10 +31,14 @@ public struct ThreadView: View {HStack(spacing: 0) {conversation.frame(maxWidth: .infinity)if showSettings && geometry.size.width >= 680 {- Rectangle().fill(Palette.border).frame(width: 1)- detailsPanel.frame(width: 292)+ HStack(spacing: 0) {+ Rectangle().fill(Palette.border).frame(width: 1)+ detailsPanel.frame(width: 292)+ }+ .transition(.move(edge: .trailing).combined(with: .opacity))}}+ .clipped().onGeometryChange(for: CGFloat.self) {$0.size.width} action: {@@ -41,7 +46,7 @@ public struct ThreadView: View {}}.ignoresSafeArea(.container, edges: .top)- .sheet(isPresented: $compactDetails) {+ .codyncSheet(isPresented: $compactDetails) {detailsPanel.frame(width: 340, height: 600)}#else@@ -57,7 +62,9 @@ public struct ThreadView: View {LazyVStack(alignment: .leading, spacing: 0) {if !model.historyComplete.contains(botId), thread.count >= 50 {Button("Load earlier messages") { Task { await model.loadOlder(botId) } }+ .buttonStyle(.plain).font(.footnote)+ .foregroundStyle(Palette.secondary).frame(maxWidth: .infinity).padding(.vertical, 12)}@@ -102,27 +109,27 @@ public struct ThreadView: View {composer}}- .inlineNavigationTitle()- .toolbar {- #if os(iOS)- ToolbarItem(placement: .principal) { header }- #endif- #if os(iOS)- if model.screen?.agentBot == botId {- ToolbarItem(placement: .primaryAction) {+ #if os(iOS)+ .safeAreaInset(edge: .top, spacing: 0) {+ ScreenHeader {+ BackButton { dismiss() }+ } title: {+ header+ } trailing: {+ if model.screen?.agentBot == botId {// The bot is operating the computer: watch it live (and take over from there).- Button("Watch the screen", systemImage: "cursorarrow.motionlines") {+ IconButton("Watch the screen", systemImage: "cursorarrow.motionlines") {model.screenRequest = ScreenRequest(watching: botId)}.symbolEffect(.pulse, options: .repeating)- .tint(Palette.accent)+ .transition(.opacity)}+ menu}- #endif- #if os(iOS)- ToolbarItem(placement: .primaryAction) { menu }- #endif- }+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: model.screen?.agentBot == botId)+ }+ .hidesSystemNavigationBar()+ #endif#if os(macOS).safeAreaInset(edge: .top, spacing: 0) {VStack(spacing: 0) {@@ -130,22 +137,19 @@ public struct ThreadView: View {headerSpacer(minLength: 8)if let bot {- TemplateButton {+ IconButton("Create template", systemImage: "square.and.arrow.up") {templateRequest = EditorRequest(BotDraft(bot))}}if !showSettings || availableWidth < 680 {- Button("Conversation details", systemImage: "chevron.right.2") { toggleDetails() }- .labelStyle(.iconOnly)- .help("Show conversation details")+ IconButton("Conversation details", systemImage: "chevron.right.2") { toggleDetails() }.keyboardShortcut("i", modifiers: [.command, .option])+ .transition(.opacity)}}- .buttonStyle(.plain)- .foregroundStyle(Palette.secondary).padding(.horizontal, 16).frame(height: 44)- Divider().overlay(Palette.border)+ Rectangle().fill(Palette.border).frame(height: 0.5)ConnectionBanner().padding(.horizontal, 16).padding(.top, model.isOffline ? 8 : 0)}.background(Palette.background)@@ -155,19 +159,17 @@ public struct ThreadView: View {}#endif.onAppear { model.markRead(botId) }- .sheet(isPresented: $showTrace) {- NavigationStack { TraceView(botId: botId) }+ .codyncSheet(isPresented: $showTrace) {+ TraceView(botId: botId)#if os(macOS).frame(width: 620, height: 560)#endif- .presentationDetents([.medium, .large])- .presentationDragIndicator(.visible)}- .sheet(item: $templateRequest) { request in+ .codyncSheet(item: $templateRequest) { request inBotTemplateView(draft: request.draft)}- .sheet(item: $editing) { request in- NavigationStack { BotEditorView(draft: request.draft) }+ .codyncSheet(item: $editing) { request in+ BotEditorView(draft: request.draft)}.codyncDialog("Start a new session?", isPresented: $confirmNewSession,message: "The conversation stays here, but the agent starts with a fresh context.") {@@ -236,98 +238,19 @@ public struct ThreadView: View {#if os(macOS)private func toggleDetails() {- if availableWidth < 680 { compactDetails.toggle() } else { showSettings.toggle() }+ if availableWidth < 680 {+ compactDetails.toggle()+ } else {+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { showSettings.toggle() }+ }}+ /// Its own view so it stays live inside the compact modal (which captures its content).private var detailsPanel: some View {- VStack(spacing: 0) {- HStack(spacing: 10) {- if editingDetails {- Button("Back to details", systemImage: "chevron.left") { editingDetails = false }- .labelStyle(.iconOnly)- Text("Settings").font(.system(size: 13, weight: .semibold))- Spacer()- } else {- Spacer()- Button("Bot settings", systemImage: "gearshape") { editingDetails = true }- .labelStyle(.iconOnly)- .help("Bot settings")- }- Button("Close details", systemImage: "chevron.right.2") {- showSettings = false- compactDetails = false- }- .labelStyle(.iconOnly)- .help("Close details")- .keyboardShortcut("i", modifiers: [.command, .option])- }- .buttonStyle(.plain)- .foregroundStyle(Palette.secondary)- .padding(.horizontal, 16)- .frame(height: 44)- if editingDetails {- BotSettingsPanel(botId: botId)- } else {- ScrollView {- VStack(alignment: .leading, spacing: 22) {- VStack(spacing: 12) {- VStack(spacing: 12) {- Image(systemName: "desktopcomputer")- .font(.system(size: 32, weight: .light))- Text(computerStatus)- .font(.system(size: 12))- .multilineTextAlignment(.center)- .foregroundStyle(Palette.secondary)- }- .frame(maxWidth: .infinity)- .frame(height: 164)- .background(Palette.surface, in: RoundedRectangle(cornerRadius: 8))- Text(model.hostName)- .font(.caption)- .foregroundStyle(Palette.tertiary)- }- if let bot {- VStack(alignment: .leading, spacing: 8) {- Text("Agent").font(.system(size: 13, weight: .semibold))- Text(model.backendName(bot.backend)).foregroundStyle(Palette.secondary)- Text(bot.cwd)- .font(.system(size: 12))- .foregroundStyle(Palette.secondary)- .textSelection(.enabled)- if !bot.description.isEmpty {- Text(bot.description).foregroundStyle(Palette.secondary)- }- }- .font(.system(size: 13))- }- Button {- showTrace = true- } label: {- HStack {- Label("Full conversation", systemImage: "list.bullet.rectangle")- Spacer()- Image(systemName: "chevron.right").font(.caption2)- }- .font(.system(size: 13))- .padding(12)- .background(Palette.surface, in: RoundedRectangle(cornerRadius: 8))- }- .buttonStyle(.plain)- }- .padding(.horizontal, 16)- .padding(.bottom, 16)- }- }+ DetailsPanel(botId: botId, editing: $editingDetails, showTrace: $showTrace) {+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { showSettings = false }+ compactDetails = false}- .background(Palette.background)- }-- private var computerStatus: String {- guard !model.isOffline else { return "Computer is offline" }- guard let screen = model.screen, screen.enabled else { return "Remote screen is off" }- guard screen.connected else { return "Connecting to computer…" }- guard screen.capture else { return "Screen recording permission needed" }- return screen.agentBot == botId ? "This bot is using your Mac" : "Ready · View this Mac from your iPhone"}#endif@@ -337,8 +260,10 @@ public struct ThreadView: View {if let bot {items.append(MenuItem("Edit profile", icon: "pencil") {#if os(macOS)- editingDetails = true- showSettings = true+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) {+ editingDetails = true+ showSettings = true+ }if availableWidth < 680 { compactDetails = true }#elseediting = EditorRequest(BotDraft(bot))@@ -351,8 +276,13 @@ public struct ThreadView: View {return items} label: {Image(systemName: "ellipsis.circle")+ .font(.system(size: InterfaceMetrics.value(mac: 14, mobile: 18), weight: .medium))+ .foregroundStyle(Palette.secondary)+ .frame(width: InterfaceMetrics.value(mac: 28, mobile: 36), height: InterfaceMetrics.value(mac: 28, mobile: 36))+ .contentShape(Rectangle())}.accessibilityLabel("More")+ .help("More")}private var canSend: Bool {@@ -477,24 +407,112 @@ private struct IntroCard: View {}}-/// The share glyph creates a settings template; conversation actions live in the sidebar.-private struct TemplateButton: View {- let action: () -> Void- @State private var hovered = false+#if os(macOS)+/// The Mac inspector beside a conversation: the computer, the agent, and the bot's settings.+private struct DetailsPanel: View {+ let botId: String+ @Binding var editing: Bool+ @Binding var showTrace: Bool+ let close: () -> Void+ @Environment(BotStore.self) private var model+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ private var bot: Bot? { model.bots[botId] }var body: some View {- Button(action: action) {- Image(systemName: "square.and.arrow.up")- .font(.system(size: 15))- .foregroundStyle(hovered ? Palette.text : Palette.secondary)- .frame(width: 30, height: 30)- .background(hovered ? Palette.text.opacity(0.08) : .clear,- in: RoundedRectangle(cornerRadius: 8))- .contentShape(Rectangle())+ VStack(spacing: 0) {+ HStack(spacing: 10) {+ if editing {+ IconButton("Back to details", systemImage: "chevron.left") { setEditing(false) }+ Text("Settings").font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text)+ Spacer()+ } else {+ Spacer()+ IconButton("Bot settings", systemImage: "gearshape") { setEditing(true) }+ }+ IconButton("Close details", systemImage: "chevron.right.2", action: close)+ .keyboardShortcut("i", modifiers: [.command, .option])+ }+ .padding(.horizontal, 12)+ .frame(height: 44)+ ZStack {+ if editing {+ BotSettingsPanel(botId: botId)+ .transition(.move(edge: .trailing).combined(with: .opacity))+ } else {+ details+ .transition(.move(edge: .leading).combined(with: .opacity))+ }+ }+ .frame(maxHeight: .infinity, alignment: .top)+ .clipped()}- .buttonStyle(.plain)- .onHover { hovered = $0 }- .accessibilityLabel("Create template")- .help("Create template")+ .background(Palette.background)+ }++ private func setEditing(_ on: Bool) {+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { editing = on }+ }++ private var details: some View {+ ScrollView {+ VStack(alignment: .leading, spacing: 22) {+ VStack(spacing: 12) {+ VStack(spacing: 12) {+ Image(systemName: "desktopcomputer")+ .font(.system(size: 32, weight: .light))+ Text(computerStatus)+ .font(.system(size: 12))+ .multilineTextAlignment(.center)+ .foregroundStyle(Palette.secondary)+ }+ .frame(maxWidth: .infinity)+ .frame(height: 164)+ .background(Palette.surface, in: RoundedRectangle(cornerRadius: 8))+ Text(model.hostName)+ .font(.caption)+ .foregroundStyle(Palette.tertiary)+ }+ if let bot {+ VStack(alignment: .leading, spacing: 8) {+ Text("Agent").font(.system(size: 13, weight: .semibold))+ Text(model.backendName(bot.backend)).foregroundStyle(Palette.secondary)+ Text(bot.cwd)+ .font(.system(size: 12))+ .foregroundStyle(Palette.secondary)+ .textSelection(.enabled)+ if !bot.description.isEmpty {+ Text(bot.description).foregroundStyle(Palette.secondary)+ }+ }+ .font(.system(size: 13))+ }+ Button {+ showTrace = true+ } label: {+ HStack {+ Label("Full conversation", systemImage: "list.bullet.rectangle")+ Spacer()+ Image(systemName: "chevron.right").font(.caption2)+ }+ .font(.system(size: 13))+ .padding(12)+ .background(Palette.surface, in: RoundedRectangle(cornerRadius: 8))+ .contentShape(Rectangle())+ }+ .buttonStyle(PressScale())+ }+ .padding(.horizontal, 16)+ .padding(.bottom, 16)+ }+ }++ private var computerStatus: String {+ guard !model.isOffline else { return "Computer is offline" }+ guard let screen = model.screen, screen.enabled else { return "Remote screen is off" }+ guard screen.connected else { return "Connecting to computer…" }+ guard screen.capture else { return "Screen recording permission needed" }+ return screen.agentBot == botId ? "This bot is using your Mac" : "Ready · View this Mac from your iPhone"}}+#endifdiff --git a/kit/Sources/CodyncUI/Thread/TraceView.swift b/kit/Sources/CodyncUI/Thread/TraceView.swiftindex 6da96040..62e0712a 100644--- a/kit/Sources/CodyncUI/Thread/TraceView.swift+++ b/kit/Sources/CodyncUI/Thread/TraceView.swift@@ -8,23 +8,24 @@ public struct TraceView: View {public init(botId: String) { self.botId = botId }@Environment(BotStore.self) private var model- @Environment(\.dismiss) private var dismisspublic var body: some View {let turns = Dictionary(grouping: model.thread(botId), by: \.turn).sorted { $0.key < $1.key }- ScrollView {+ VStack(spacing: 0) {+ ModalHeader("Full conversation")+ ScrollView {LazyVStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 14, mobile: 22)) {if turns.isEmpty {Text("Nothing yet.").foregroundStyle(Palette.tertiary)}ForEach(turns, id: \.key) { turn, entries in- VStack(alignment: .leading, spacing: 6) {- // CardSection's own title wraps; a turn header stays on one line.+ VStack(alignment: .leading, spacing: 8) {+ // A plain one-line turn header (CardSection's own title wraps).Text(entries.first { $0.kind == "user" }?.data.text ?? "Turn \(turn)").lineLimit(1)- .font(InterfaceMetrics.secondary)- .foregroundStyle(Palette.secondary)+ .font(InterfaceMetrics.secondary.weight(.semibold))+ .foregroundStyle(Palette.text).padding(.leading, 4)CardSection {ForEach(entries) { TraceRow(entry: $0) }@@ -34,16 +35,10 @@ public struct TraceView: View {}.padding(InterfaceMetrics.value(mac: 14, mobile: 20)).frame(maxWidth: .infinity, alignment: .leading)- }- .background(Palette.background)- .navigationTitle("Full conversation")- .inlineNavigationTitle()- .toolbar {- ToolbarItem(placement: .confirmationAction) {- Button("Done", systemImage: "checkmark") { dismiss() }.labelStyle(.iconOnly).help("Done")}+ .defaultScrollAnchor(.bottom)}- .defaultScrollAnchor(.bottom)+ .background(Palette.background)}}@@ -55,7 +50,7 @@ private struct TraceRow: View {let d = entry.dataswitch entry.kind {case "user":- Label { Text(d.text ?? "").foregroundStyle(Palette.text) } icon: { Image(systemName: "person.fill") }+ Label { Text(d.text ?? "").foregroundStyle(Palette.text) } icon: { Image(systemName: "person.fill").foregroundStyle(Palette.secondary) }.font(.subheadline)case "agent":VStack(alignment: .leading, spacing: 4) {