Skip to content

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.

feat: show a shaping orb while a bot edits files

leepokai917e8dbc13b9
diff --git a/apps/desktop/src/renderer/components/ThinkingOrb.tsx b/apps/desktop/src/renderer/components/ThinkingOrb.tsx
index d882795a..613771fb 100644
--- a/apps/desktop/src/renderer/components/ThinkingOrb.tsx
+++ b/apps/desktop/src/renderer/components/ThinkingOrb.tsx
@@ -1,14 +1,15 @@
import { useEffect, useRef } from 'react'
import { useDark, useReduceMotion } from '../lib/theme'
-// thinking-orbs 0.3.1, commit de85557 (MIT, Jakub Antalik): src/engine/{core,orbits,lattice,web}.ts
+// thinking-orbs 0.3.1, commit de85557 (MIT, Jakub Antalik): src/engine/{core,orbits,lattice,web,morph}.ts
// with the resolved 20/64 pt presets, as ported in kit's ThinkingOrbGeometry.
-export type OrbState = 'working' | 'searching' | 'listening' | 'connecting'
+export type OrbState = 'working' | 'searching' | 'listening' | 'connecting' | 'shaping'
interface Dot { x: number; y: number; z: number; radius: number; white: number; alpha: number }
interface Line { x1: number; y1: number; x2: number; y2: number; white: number; alpha: number; width: number }
type P3 = [number, number, number]
+type P2 = [number, number]
function speed(state: OrbState, size: number) {
const small = size < 40
@@ -17,6 +18,7 @@ function speed(state: OrbState, size: number) {
case 'searching': return small ? 2.665 : 2.015
case 'listening': return small ? 3.998 : 4.388
case 'connecting': return small ? 6.63 : 3.315
+ case 'shaping': return small ? 2.08 : 2.405
}
}
@@ -150,8 +152,60 @@ function web(size: number, t: number) {
return { dots, lines }
}
+/** The closed outline through `vertices`, parameterized by arc length (0...1). */
+function polygon(vertices: P2[]) {
+ const lengths = vertices.map((a, i) => {
+ const b = vertices[(i + 1) % vertices.length]!
+ return Math.hypot(b[0] - a[0], b[1] - a[1])
+ })
+ const total = lengths.reduce((sum, l) => sum + l, 0)
+ return (f: number): P2 => {
+ let target = f * total, i = 0
+ while (target > lengths[i]! && i < vertices.length - 1) target -= lengths[i++]!
+ const a = vertices[i]!, b = vertices[(i + 1) % vertices.length]!, k = lengths[i] ? Math.min(1, target / lengths[i]!) : 0
+ return [a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k]
+ }
+}
+const SHAPES = [
+ (f: number): P2 => [Math.cos(-Math.PI / 2 + f * 2 * Math.PI) * 0.24, Math.sin(-Math.PI / 2 + f * 2 * Math.PI) * 0.24],
+ polygon([[0, -0.26], [0.24, 0.16], [-0.24, 0.16]]),
+ polygon([[0, -0.2], [0.2, -0.2], [0.2, 0.2], [-0.2, 0.2], [-0.2, -0.2]]),
+]
+
+/** A dotted outline that holds a circle, triangle and square in turn, morphing between them. */
+function morph(size: number, t: number) {
+ const small = size < 40, spread = 1.45, hold = 1.4, change = 0.9, segment = hold + change
+ const cycle = t % (segment * SHAPES.length)
+ const k = Math.min(SHAPES.length - 1, Math.floor(cycle / segment)), local = cycle - k * segment
+ const x = (local - hold) / change, m = local > hold ? x * x * (3 - 2 * x) : 0
+ const from = SHAPES[k]!, to = SHAPES[(k + 1) % SHAPES.length]!
+ const samples = 160
+ const points: P2[] = []
+ for (let i = 0; i < samples; i++) {
+ const a = from(i / samples), b = to(i / samples)
+ points.push([(a[0] + (b[0] - a[0]) * m) * spread, (a[1] + (b[1] - a[1]) * m) * spread])
+ }
+ const lengths = points.map((a, i) => {
+ const b = points[(i + 1) % samples]!
+ return Math.hypot(b[0] - a[0], b[1] - a[1])
+ })
+ const total = lengths.reduce((sum, l) => sum + l, 0)
+ const count = small ? 18 : 24
+ const radius = Math.max(0.35, (small ? 0.021231 : 0.008295) * 1.35 * spread * size)
+ const pulse = 1 + 0.02 * Math.sin(local * 3.1)
+ const dots: Dot[] = []
+ let i = 0, walked = 0
+ for (let n = 0; n < count; n++) {
+ const target = (n / count) * total
+ while (walked + lengths[i]! < target && i < samples - 1) walked += lengths[i++]!
+ const a = points[i]!, b = points[(i + 1) % samples]!, f = lengths[i] ? Math.min(1, (target - walked) / lengths[i]!) : 0
+ dots.push({ x: size / 2 + (a[0] + (b[0] - a[0]) * f) * pulse * size, y: size / 2 + (a[1] + (b[1] - a[1]) * f) * pulse * size, z: 0, radius, white: 0.1, alpha: 1 })
+ }
+ return { dots, lines: [] as Line[] }
+}
+
export function orbFrame(state: OrbState, size: number, time: number) {
- const f = state === 'working' ? orbits(size, time) : state === 'connecting' ? web(size, time) : lattice(size, time, state === 'listening')
+ const f = state === 'working' ? orbits(size, time) : state === 'connecting' ? web(size, time) : state === 'shaping' ? morph(size, time) : lattice(size, time, state === 'listening')
return {
dots: f.dots.filter((d) => d.alpha >= 0.02).map((d) => ({ ...d, radius: Math.max(0.3, d.radius) })).sort((a, b) => a.z - b.z),
lines: f.lines.filter((l) => l.alpha >= 0.02),
diff --git a/apps/desktop/src/renderer/views/thread/TraceView.tsx b/apps/desktop/src/renderer/views/thread/TraceView.tsx
index abf5618c..67fd275d 100644
--- a/apps/desktop/src/renderer/views/thread/TraceView.tsx
+++ b/apps/desktop/src/renderer/views/thread/TraceView.tsx
@@ -3,7 +3,7 @@ import type { Entry, EntryData } from '@shared/models'
import { CardSection, Disclosure } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { ModalHeader } from '../../components/Overlay'
-import { ThinkingOrb } from '../../components/ThinkingOrb'
+import { ThinkingOrb, type OrbState } from '../../components/ThinkingOrb'
import { font } from '../../lib/fonts'
import { useStore } from '../../store/context'
import { MarkdownText } from './Markdown'
@@ -130,6 +130,8 @@ function TraceRow({ entry }: { entry: Entry }) {
const toolIcon = (kind?: string) =>
({ read: 'doc.text', edit: 'pencil', delete: 'trash', move: 'arrow.right.doc.on.clipboard', search: 'magnifyingglass', execute: 'terminal', think: 'brain', fetch: 'globe' })[kind ?? ''] ?? 'wrench.and.screwdriver'
+const toolOrb = (kind?: string): OrbState => ({ search: 'searching', fetch: 'connecting', edit: 'shaping' } as const)[kind ?? ''] ?? 'working'
+
export function ToolRow({ data }: { data: EntryData }) {
const [expanded, setExpanded] = useState(false)
const hasBody = !!data.output || !!data.diffs?.length
@@ -144,7 +146,7 @@ export function ToolRow({ data }: { data: EntryData }) {
) : data.status === 'failed' ? (
<Icon name="xmark" size={10} color="var(--danger)" />
) : (
- <ThinkingOrb state={data.toolKind === 'search' ? 'searching' : data.toolKind === 'fetch' ? 'connecting' : 'working'} size={16} color="var(--secondary)" />
+ <ThinkingOrb state={toolOrb(data.toolKind)} size={16} color="var(--secondary)" />
)}
</span>
)
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrb.swift b/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrb.swift
index 2a04b207..a3dd65e5 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrb.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrb.swift
@@ -4,7 +4,7 @@ import SwiftUI
/// Supply an adjacent status label; this decorative view is hidden from VoiceOver.
public struct ThinkingOrb: View {
public enum State: String, CaseIterable, Sendable {
- case working, searching, listening, connecting
+ case working, searching, listening, connecting, shaping
}
let state: State
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrbGeometry.swift b/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrbGeometry.swift
index 5243c159..981339df 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrbGeometry.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Design/ThinkingOrbGeometry.swift
@@ -1,7 +1,7 @@
import Foundation
// Native port of thinking-orbs 0.3.1, commit de85557 (MIT, Jakub Antalik).
-// Source: src/engine/{core,orbits,lattice,web}.ts and resolved 20/64 pt presets.
+// Source: src/engine/{core,orbits,lattice,web,morph}.ts and resolved 20/64 pt presets.
// See Resources/ThirdPartyNotices/thinking-orbs-LICENSE.txt.
// Keep geometry independent of SwiftUI so upstream golden vectors can verify it.
enum ThinkingOrbGeometry {
@@ -17,6 +17,7 @@ enum ThinkingOrbGeometry {
var lines: [Line] = []
}
typealias Point = SIMD3<Double>
+ typealias Point2 = SIMD2<Double>
static func speed(state: ThinkingOrb.State, size: Double) -> Double {
let small = size < 40
@@ -25,6 +26,7 @@ enum ThinkingOrbGeometry {
case .searching: return small ? 2.665 : 2.015
case .listening: return small ? 3.998 : 4.388
case .connecting: return small ? 6.63 : 3.315
+ case .shaping: return small ? 2.08 : 2.405
}
}
@@ -37,6 +39,7 @@ enum ThinkingOrbGeometry {
case .searching: frame = lattice(size, time, listening: false)
case .listening: frame = lattice(size, time, listening: true)
case .connecting: frame = web(size, time)
+ case .shaping: frame = morph(size, time)
}
frame.dots = frame.dots.filter { $0.alpha >= 0.02 }.map {
var dot = $0; dot.radius = max(0.3, dot.radius); return dot
@@ -184,4 +187,61 @@ enum ThinkingOrbGeometry {
}
return frame
}
+
+ /// A dotted outline that holds a circle, triangle and square in turn, morphing between them.
+ private static func morph(_ size: Double, _ t: Double) -> Frame {
+ let small = size < 40, spread = 1.45, hold = 1.4, change = 0.9, segment = hold + change
+ let cycle = t.truncatingRemainder(dividingBy: segment * Double(shapes.count))
+ let k = min(shapes.count - 1, Int(cycle / segment)), local = cycle - Double(k) * segment
+ let x = (local - hold) / change, m = local > hold ? x * x * (3 - 2 * x) : 0
+ let from = shapes[k], to = shapes[(k + 1) % shapes.count]
+ let samples = 160
+ let points = (0..<samples).map { i -> Point2 in
+ let f = Double(i) / Double(samples), a = from(f), b = to(f)
+ return (a + (b - a) * m) * spread
+ }
+ let lengths = (0..<samples).map { i in
+ hypot(points[(i + 1) % samples].x - points[i].x, points[(i + 1) % samples].y - points[i].y)
+ }
+ let total = lengths.reduce(0, +)
+ let count = small ? 18 : 24
+ let radius = max(0.35, (small ? 0.021231 : 0.008295) * 1.35 * spread * size)
+ let pulse = 1 + 0.02 * sin(local * 3.1)
+ var frame = Frame(), i = 0, walked = 0.0
+ for n in 0..<count {
+ let target = Double(n) / Double(count) * total
+ while walked + lengths[i] < target, i < samples - 1 {
+ walked += lengths[i]
+ i += 1
+ }
+ let a = points[i], b = points[(i + 1) % samples]
+ let f = lengths[i] > 0 ? min(1, (target - walked) / lengths[i]) : 0
+ let p = (a + (b - a) * f) * pulse
+ frame.dots.append(Dot(x: size / 2 + p.x * size, y: size / 2 + p.y * size, z: 0, radius: radius, white: 0.1))
+ }
+ return frame
+ }
+
+ private static let shapes: [@Sendable (Double) -> Point2] = [
+ { f in Point2(cos(-.pi / 2 + f * 2 * .pi), sin(-.pi / 2 + f * 2 * .pi)) * 0.24 },
+ polygon([Point2(0, -0.26), Point2(0.24, 0.16), Point2(-0.24, 0.16)]),
+ polygon([Point2(0, -0.2), Point2(0.2, -0.2), Point2(0.2, 0.2), Point2(-0.2, 0.2), Point2(-0.2, -0.2)]),
+ ]
+
+ /// The closed outline through `vertices`, parameterized by arc length (0...1).
+ private static func polygon(_ vertices: [Point2]) -> @Sendable (Double) -> Point2 {
+ let lengths = vertices.indices.map { i in
+ hypot(vertices[(i + 1) % vertices.count].x - vertices[i].x, vertices[(i + 1) % vertices.count].y - vertices[i].y)
+ }
+ let total = lengths.reduce(0, +)
+ return { f in
+ var target = f * total, i = 0
+ while target > lengths[i], i < vertices.count - 1 {
+ target -= lengths[i]
+ i += 1
+ }
+ let a = vertices[i], b = vertices[(i + 1) % vertices.count]
+ return a + (b - a) * (lengths[i] > 0 ? min(1, target / lengths[i]) : 0)
+ }
+ }
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
index ab0d70df..dc71717e 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
@@ -113,6 +113,15 @@ struct ToolRow: View {
}
}
+ private var orb: ThinkingOrb.State {
+ switch data.toolKind {
+ case "search": .searching
+ case "fetch": .connecting
+ case "edit": .shaping
+ default: .working
+ }
+ }
+
private var hasBody: Bool {
!(data.output ?? "").isEmpty || !(data.diffs ?? []).isEmpty
}
@@ -138,7 +147,7 @@ struct ToolRow: View {
switch data.status {
case "completed": Image(systemName: "checkmark").foregroundStyle(Palette.accent)
case "failed": Image(systemName: "xmark").foregroundStyle(Palette.danger)
- default: ThinkingOrb(state: data.toolKind == "search" ? .searching : data.toolKind == "fetch" ? .connecting : .working, size: 16, color: Palette.secondary)
+ default: ThinkingOrb(state: orb, size: 16, color: Palette.secondary)
}
}
.font(.caption)
diff --git a/apps/ios/Kit/Tests/CodyncKitTests/Fixtures/thinking-orbs-golden.json b/apps/ios/Kit/Tests/CodyncKitTests/Fixtures/thinking-orbs-golden.json
index dfa1758b..b81c76b5 100644
--- a/apps/ios/Kit/Tests/CodyncKitTests/Fixtures/thinking-orbs-golden.json
+++ b/apps/ios/Kit/Tests/CodyncKitTests/Fixtures/thinking-orbs-golden.json
@@ -1957,6 +1957,446 @@
}
],
"lines": []
+ },
+ {
+ "key": "shaping-64-0.6",
+ "state": "shaping",
+ "size": 64,
+ "t": 0.6,
+ "dotCount": 24,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 32,
+ 9.301059,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 8,
+ "values": [
+ 51.6545,
+ 43.347511,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 16,
+ "values": [
+ 12.3455,
+ 43.347511,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 23,
+ "values": [
+ 26.126072,
+ 10.078267,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
+ },
+ {
+ "key": "shaping-64-1.7",
+ "state": "shaping",
+ "size": 64,
+ "t": 1.7,
+ "dotCount": 24,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 32,
+ 9.632946,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 8,
+ "values": [
+ 51.651981,
+ 43.826413,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 16,
+ "values": [
+ 12.348019,
+ 43.826413,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 23,
+ "values": [
+ 26.871972,
+ 11.533978,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
+ },
+ {
+ "key": "shaping-64-3.3",
+ "state": "shaping",
+ "size": 64,
+ "t": 3.3,
+ "dotCount": 24,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 32,
+ 7.851935,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 8,
+ "values": [
+ 54.092734,
+ 46.518776,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 16,
+ "values": [
+ 9.907266,
+ 46.518776,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 23,
+ "values": [
+ 29.238073,
+ 12.685308,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
+ },
+ {
+ "key": "shaping-64-5.1",
+ "state": "shaping",
+ "size": 64,
+ "t": 5.1,
+ "dotCount": 24,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 32,
+ 13.06888,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 8,
+ "values": [
+ 50.93112,
+ 44.620746,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 16,
+ "values": [
+ 13.06888,
+ 44.620746,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 23,
+ "values": [
+ 25.689627,
+ 13.06888,
+ 0,
+ 1.039198,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
+ },
+ {
+ "key": "shaping-20-0.6",
+ "state": "shaping",
+ "size": 20,
+ "t": 0.6,
+ "dotCount": 18,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 10,
+ 2.906581,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 6,
+ "values": [
+ 16.142031,
+ 13.546097,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 12,
+ "values": [
+ 3.857969,
+ 13.546097,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 17,
+ "values": [
+ 7.574087,
+ 3.334876,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
+ },
+ {
+ "key": "shaping-20-1.7",
+ "state": "shaping",
+ "size": 20,
+ "t": 1.7,
+ "dotCount": 18,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 10,
+ 3.010296,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 6,
+ "values": [
+ 16.141244,
+ 13.695754,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 12,
+ "values": [
+ 3.858756,
+ 13.695754,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 17,
+ "values": [
+ 7.895991,
+ 3.876692,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
+ },
+ {
+ "key": "shaping-20-3.3",
+ "state": "shaping",
+ "size": 20,
+ "t": 3.3,
+ "dotCount": 18,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 10,
+ 2.45373,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 6,
+ "values": [
+ 16.903979,
+ 14.537118,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 12,
+ "values": [
+ 3.096021,
+ 14.537118,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 17,
+ "values": [
+ 8.849197,
+ 4.467635,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
+ },
+ {
+ "key": "shaping-20-5.1",
+ "state": "shaping",
+ "size": 20,
+ "t": 5.1,
+ "dotCount": 18,
+ "lineCount": 0,
+ "dots": [
+ {
+ "index": 0,
+ "values": [
+ 10,
+ 4.084025,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 6,
+ "values": [
+ 15.915975,
+ 13.943983,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 12,
+ "values": [
+ 4.084025,
+ 13.943983,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ },
+ {
+ "index": 17,
+ "values": [
+ 7.370678,
+ 4.084025,
+ 0,
+ 0.831194,
+ 0.1,
+ 1
+ ]
+ }
+ ],
+ "lines": []
}
]
}