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
Menus and dialogs float in Codync's own layer, animated
leepokai24090d520d24
diff --git a/apps/macos/App/CodyncMacApp.swift b/apps/macos/App/CodyncMacApp.swiftindex e5b783fb..aae5ee35 100644--- a/apps/macos/App/CodyncMacApp.swift+++ b/apps/macos/App/CodyncMacApp.swift@@ -21,6 +21,7 @@ struct CodyncMacApp: App {.environment(host).environment(account).frame(width: 340)+ .modalHost()} label: {// The Codync mark; a dot joins it when a bot needs you.Image(host.needsAttention ? "MenuBarIconAlert" : "MenuBarIcon")@@ -40,6 +41,7 @@ struct CodyncMacApp: App {Window("Codync", id: "chat") {ChatWindow()+ .modalHost().environment(host).environment(account)}diff --git a/kit/Sources/CodyncUI/Chrome.swift b/kit/Sources/CodyncUI/Chrome.swiftindex 8e0be889..550d0919 100644--- a/kit/Sources/CodyncUI/Chrome.swift+++ b/kit/Sources/CodyncUI/Chrome.swift@@ -172,6 +172,12 @@ public extension View {return modifier(CodyncSheet(isPresented: shown, sheet: { item.wrappedValue.map(content) }))}+ /// Presents a full-window layer the content draws itself (menus, dialogs), fading in and out.+ /// `close` animates it away.+ func codyncOverlay<Layer: View>(isPresented: Binding<Bool>, @ViewBuilder content: @escaping (_ close: @escaping () -> Void) -> Layer) -> some View {+ modifier(CodyncOverlay(isPresented: isPresented, layer: content))+ }+/// Mac: the window root that hosts every `.codyncSheet` below it, so modals cover the/// whole window rather than the column that opened them.@ViewBuilder func modalHost() -> some View {@@ -199,6 +205,44 @@ private struct CodyncSheet<Sheet: View>: ViewModifier {}}+private struct CodyncOverlay<Layer: View>: ViewModifier {+ @Binding var isPresented: Bool+ let layer: (_ close: @escaping () -> Void) -> Layer++ func body(content: Content) -> some View {+ content+ .fullScreenCover(isPresented: $isPresented) {+ FadeLayer(close: { isPresented = false }, layer: layer)+ .presentationBackground(.clear)+ }+ .transaction(value: isPresented) { $0.disablesAnimations = true }+ }+}++private struct FadeLayer<Layer: View>: View {+ let close: () -> Void+ let layer: (_ close: @escaping () -> Void) -> Layer+ @State private var shown = false+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ var body: some View {+ layer(animateClose)+ .opacity(shown ? 1 : 0)+ .scaleEffect(shown ? 1 : 0.98)+ .onAppear { withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { shown = true } }+ }++ private func animateClose() {+ withAnimation(Motion.reduced(Motion.fade, reduceMotion)) {+ shown = false+ } completion: {+ var t = Transaction()+ t.disablesAnimations = true+ withTransaction(t) { close() }+ }+ }+}+/// The iPhone modal: slides up over a dim, drags down (from the grabber) to close.private struct BottomSheet<Content: View>: View {let close: () -> Void@@ -288,20 +332,24 @@ public extension View {#else@MainActor @Observablefinal class ModalHost {+ enum Chrome { case card, bare }+struct Entry: Identifiable {let id: UUID+ var chrome: Chromevar content: AnyViewvar shown = false}var entries: [Entry] = []- func present(_ id: UUID, _ content: AnyView) {+ func present(_ id: UUID, chrome: Chrome, _ content: AnyView) {if let index = entries.firstIndex(where: { $0.id == id }) {entries[index].content = content+ if !entries[index].shown { withAnimation(Motion.layout) { entries[index].shown = true } }return}- entries.append(Entry(id: id, content: content))+ entries.append(Entry(id: id, chrome: chrome, content: content))withAnimation(Motion.layout) {if let index = entries.firstIndex(where: { $0.id == id }) { entries[index].shown = true }}@@ -330,7 +378,10 @@ private struct ModalHostModifier: ViewModifier {.overlay {ZStack {ForEach(host.entries) { entry in- ModalCard(shown: entry.shown) { entry.content }+ switch entry.chrome {+ case .card: ModalCard(shown: entry.shown) { entry.content }+ case .bare: entry.content.opacity(entry.shown ? 1 : 0).scaleEffect(entry.shown ? 1 : 0.98)+ }}}}@@ -361,9 +412,11 @@ private struct ModalCard<Content: View>: View {}}-private struct CodyncSheet<Sheet: View>: ViewModifier {+/// Hands a presentation to the window's `ModalHost`, carrying the stores the content reads.+private struct HostedPresentation<Layer: View>: ViewModifier {@Binding var isPresented: Bool- let sheet: () -> Sheet+ let chrome: ModalHost.Chrome+ let layer: (_ close: @escaping () -> Void) -> Layer@Environment(\.modalHost) private var host@Environment(BotStore.self) private var store: BotStore?@Environment(AccountStore.self) private var accounts: AccountStore?@@ -379,10 +432,11 @@ private struct CodyncSheet<Sheet: View>: ViewModifier {guard let host else { return }guard isPresented else { return host.close(id) }let binding = $isPresented- // ponytail: the card's content is captured when it opens; state it reads through+ let close = { binding.wrappedValue = false }+ // ponytail: the content is captured when it opens; state it reads through// stores and bindings stays live, plain values passed in don't refresh.- host.present(id, AnyView(- sheet()+ host.present(id, chrome: chrome, AnyView(+ layer(close).environment(store).environment(accounts).environment(\.modalHost, host)@@ -391,6 +445,24 @@ private struct CodyncSheet<Sheet: View>: ViewModifier {}}+private struct CodyncSheet<Sheet: View>: ViewModifier {+ @Binding var isPresented: Bool+ let sheet: () -> Sheet++ func body(content: Content) -> some View {+ content.modifier(HostedPresentation(isPresented: $isPresented, chrome: .card) { _ in sheet() })+ }+}++private struct CodyncOverlay<Layer: View>: ViewModifier {+ @Binding var isPresented: Bool+ let layer: (_ close: @escaping () -> Void) -> Layer++ func body(content: Content) -> some View {+ content.modifier(HostedPresentation(isPresented: $isPresented, chrome: .bare, layer: layer))+ }+}+public extension View {func hidesSystemNavigationBar() -> some View { self }}diff --git a/kit/Sources/CodyncUI/Controls.swift b/kit/Sources/CodyncUI/Controls.swiftindex 7a873534..2a7d04be 100644--- a/kit/Sources/CodyncUI/Controls.swift+++ b/kit/Sources/CodyncUI/Controls.swift@@ -204,13 +204,9 @@ private struct MenuRow: View {}public extension View {- /// Shows a Codync menu anchored to this view while `isPresented` is true.+ /// Shows a Codync menu under (or above) this view while `isPresented` is true.func codyncMenu(isPresented: Binding<Bool>, items: @escaping () -> [MenuItem]) -> some View {- popover(isPresented: isPresented, arrowEdge: .bottom) {- MenuPanel(items: items()) { isPresented.wrappedValue = false }- .presentationCompactAdaptation(.popover)- .presentationBackground(Palette.bubbleAgent)- }+ modifier(AnchoredMenu(isPresented: isPresented, point: nil, items: items))}/// Long-press (iPhone) or right-click (Mac) opens a Codync menu: the replacement for `contextMenu`.@@ -222,15 +218,16 @@ public extension View {private struct ContextActions: ViewModifier {let items: () -> [MenuItem]@State private var open = false+ @State private var point: CGPoint?func body(content: Content) -> some View {content#if os(macOS)- .overlay { SecondaryClickCapture { _ in open = true } }+ .overlay { SecondaryClickCapture { point = $0; open = true } }#else- .onLongPressGesture(minimumDuration: 0.35) { open = true }+ .onLongPressGesture(minimumDuration: 0.35) { point = nil; open = true }#endif- .codyncMenu(isPresented: $open, items: items)+ .modifier(AnchoredMenu(isPresented: $open, point: point, items: items)).accessibilityActions {ForEach(items()) { item inButton(item.title, action: item.action)@@ -239,6 +236,51 @@ private struct ContextActions: ViewModifier {}}+/// Presents `MenuPanel` next to the view (or at `point` inside it, for right-clicks).+private struct AnchoredMenu: ViewModifier {+ @Binding var isPresented: Bool+ let point: CGPoint?+ let items: () -> [MenuItem]+ @State private var frame: CGRect = .zero++ func body(content: Content) -> some View {+ content+ .onGeometryChange(for: CGRect.self) { $0.frame(in: .global) } action: { frame = $0 }+ .codyncOverlay(isPresented: $isPresented) { close in+ let anchor = point.map { CGRect(x: frame.minX + $0.x, y: frame.minY + $0.y, width: 0, height: 0) } ?? frame+ AnchoredPanel(anchor: anchor, close: close) {+ MenuPanel(items: items(), dismiss: close)+ }+ }+ }+}++/// Places a floating panel beside `anchor` (global coordinates), flipping to stay on screen;+/// a tap anywhere else closes it.+struct AnchoredPanel<Panel: View>: View {+ let anchor: CGRect+ let close: () -> Void+ @ViewBuilder let panel: () -> Panel++ var body: some View {+ GeometryReader { geo in+ let space = geo.frame(in: .global)+ let a = anchor.offsetBy(dx: -space.minX, dy: -space.minY)+ let below = a.maxY < space.height * 0.62+ let leading = a.midX < space.width * 0.6+ ZStack(alignment: Alignment(horizontal: leading ? .leading : .trailing, vertical: below ? .top : .bottom)) {+ Color.clear.contentShape(Rectangle()).onTapGesture(perform: close)+ panel()+ .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 14, style: .continuous))+ .shadow(color: .black.opacity(0.25), radius: 20, y: 8)+ .offset(x: leading ? max(8, a.minX) : -max(8, space.width - a.maxX),+ y: below ? a.maxY + 6 : -(space.height - a.minY + 6))+ }+ }+ .ignoresSafeArea()+ }+}+/// A button that opens a Codync menu.public struct DropdownMenu<Label: View>: View {let items: () -> [MenuItem]@@ -536,21 +578,9 @@ private struct CodyncDialog: ViewModifier {let actions: () -> [DialogAction]func body(content: Content) -> some View {- #if os(iOS)- content.fullScreenCover(isPresented: $isPresented) {- DialogCard(title: title, message: message, cancel: cancel, actions: actions()) { isPresented = false }- .presentationBackground(.clear)- }- .transaction { $0.disablesAnimations = true }- #else- content.overlay {- if isPresented {- DialogCard(title: title, message: message, cancel: cancel, actions: actions()) { isPresented = false }- .transition(.opacity)- }+ content.codyncOverlay(isPresented: $isPresented) { close in+ DialogCard(title: title, message: message, cancel: cancel, actions: actions(), dismiss: close)}- .animation(Motion.fade, value: isPresented)- #endif}}@@ -560,11 +590,10 @@ private struct DialogCard: View {let cancel: String?let actions: [DialogAction]let dismiss: () -> Void- @State private var shown = falsevar body: some View {ZStack {- Color.black.opacity(shown ? 0.35 : 0).ignoresSafeArea()+ Color.black.opacity(0.35).ignoresSafeArea().onTapGesture { if cancel != nil { dismiss() } }VStack(spacing: 14) {VStack(spacing: 6) {@@ -596,10 +625,7 @@ private struct DialogCard: View {.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 22, style: .continuous)).shadow(color: .black.opacity(0.25), radius: 24, y: 10).padding(24)- .scaleEffect(shown ? 1 : 0.96)- .opacity(shown ? 1 : 0)}- .onAppear { withAnimation(Motion.layout) { shown = true } }.accessibilityAddTraits(.isModal)}}