Skip to content

Open source CapCut alternative.

TypeScript

Refine notch resting and hover expansion behavior

David Ledec0082c7952
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptCommandHandler.swift b/apps/Donkey/Sources/Donkey/PointerPromptCommandHandler.swift
index cc6cdbe4..fc04faa2 100644
--- a/apps/Donkey/Sources/Donkey/PointerPromptCommandHandler.swift
+++ b/apps/Donkey/Sources/Donkey/PointerPromptCommandHandler.swift
@@ -6,6 +6,7 @@ import Foundation
struct PointerPromptCommandHandlingResult: Equatable, Sendable {
var status: LocalAppTaskLiveRunStatus
var summary: String
+ var taskLabel: String?
var traceID: String
var metadata: [String: String]
var documentReviewRequest: DocumentFormFillReviewRequest?
@@ -104,6 +105,7 @@ struct LocalAppPointerPromptCommandHandler: PointerPromptCommandHandling {
return PointerPromptCommandHandlingResult(
status: result.status,
summary: summary(for: result),
+ taskLabel: taskLabel(for: result),
traceID: traceID,
metadata: result.metadata,
documentReviewRequest: documentReviewRequest(
@@ -173,18 +175,52 @@ struct LocalAppPointerPromptCommandHandler: PointerPromptCommandHandling {
return "Needs review"
case .needsConfirmation:
if let reason = result.resolution.metadata["reason"] {
+ guard reason != "localModelIntentUnavailable",
+ reason != "needsConfirmation"
+ else {
+ return "Need more detail"
+ }
return "Need \(reason)"
}
return "Need more detail"
case .appUnavailable:
return "App unavailable"
case .unsupportedCommand:
- return "Unsupported command"
+ return "Need more detail"
case .failedSafe:
return "Stopped safely"
}
}
+ private func taskLabel(for result: LocalAppTaskLiveRunResult) -> String? {
+ guard result.status == .completed || result.status == .needsUserReview,
+ let definition = result.resolution.definition
+ else {
+ return nil
+ }
+
+ let entities = result.resolution.intent?.normalizedEntities ?? [:]
+ switch definition.taskType {
+ case "weather_lookup":
+ if let city = entities["city"], !city.isEmpty {
+ return "Weather for \(city)"
+ }
+ return "Weather lookup"
+ case "media_playback":
+ if let query = entities["query"], !query.isEmpty {
+ return "Play \(query)"
+ }
+ return "Play media"
+ case "document_form_fill":
+ return "Fill PDF"
+ default:
+ return definition.taskType
+ .split(separator: "_")
+ .map { word in word.prefix(1).uppercased() + word.dropFirst() }
+ .joined(separator: " ")
+ }
+ }
+
private static func uptimeMilliseconds() -> Double {
ProcessInfo.processInfo.systemUptime * 1_000
}
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift b/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift
index 594e768c..e5f328aa 100644
--- a/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/PointerPromptOverlayController.swift
@@ -6,9 +6,6 @@ import SwiftUI
@MainActor
final class PointerPromptOverlayController {
- private static let commandKHotKeySignature: OSType = 0x444B4559
- private static let commandKHotKeyID: UInt32 = 1
-
private let model: PointerPromptOverlayModel
private let fixedPlacement: PointerPromptPlacement = .bottomRight
private let activationShortcut: PointerPromptActivationShortcut
@@ -20,8 +17,6 @@ final class PointerPromptOverlayController {
private var timer: Timer?
private var globalActivationMonitor: Any?
private var localActivationMonitor: Any?
- private var commandKHotKeyRef: EventHotKeyRef?
- private var commandKEventHandlerRef: EventHandlerRef?
private var activationTapStartedAt: Date?
private var activationTapIsClean = false
private var completedActivationTapCount = 0
@@ -29,6 +24,7 @@ final class PointerPromptOverlayController {
private var activationHoldStartedAt: Date?
private var isVoiceInputActive = false
private var isStatusExpanded = false
+ private var statusCollapseWorkItem: DispatchWorkItem?
init(
model: PointerPromptOverlayModel,
@@ -50,7 +46,6 @@ final class PointerPromptOverlayController {
self.inputPanel = inputPanel
self.statusPanel = statusPanel
startActivationMonitoring()
- startCommandKHotKeyMonitoring()
positionStatusPanel()
centerInputPanel()
inputPanel.orderOut(nil)
@@ -91,6 +86,9 @@ final class PointerPromptOverlayController {
panel.dragRegionProvider = { [weak self] in
self?.composerDragRegions() ?? []
}
+ panel.escapeKeyHandler = { [weak self] in
+ self?.dismissActivePromptFromKeyboard()
+ }
panel.level = .statusBar
panel.collectionBehavior = [
.canJoinAllSpaces,
@@ -141,8 +139,9 @@ final class PointerPromptOverlayController {
func stop() {
timer?.invalidate()
timer = nil
+ statusCollapseWorkItem?.cancel()
+ statusCollapseWorkItem = nil
stopActivationMonitoring()
- stopCommandKHotKeyMonitoring()
microphoneWaveformMeter.stop()
inputPanel?.close()
inputPanel = nil
@@ -187,79 +186,7 @@ final class PointerPromptOverlayController {
}
}
- private func startCommandKHotKeyMonitoring() {
- stopCommandKHotKeyMonitoring()
-
- var eventType = EventTypeSpec(
- eventClass: OSType(kEventClassKeyboard),
- eventKind: UInt32(kEventHotKeyPressed)
- )
- let userData = UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque())
- InstallEventHandler(
- GetApplicationEventTarget(),
- { _, event, userData in
- guard let event,
- let userData else {
- return noErr
- }
-
- var hotKeyID = EventHotKeyID()
- let status = GetEventParameter(
- event,
- EventParamName(kEventParamDirectObject),
- EventParamType(typeEventHotKeyID),
- nil,
- MemoryLayout<EventHotKeyID>.size,
- nil,
- &hotKeyID
- )
- guard status == noErr,
- hotKeyID.signature == PointerPromptOverlayController.commandKHotKeySignature,
- hotKeyID.id == PointerPromptOverlayController.commandKHotKeyID else {
- return noErr
- }
-
- let controller = Unmanaged<PointerPromptOverlayController>
- .fromOpaque(userData)
- .takeUnretainedValue()
- Task { @MainActor in
- controller.handleCommandKHotKey()
- }
- return noErr
- },
- 1,
- &eventType,
- userData,
- &commandKEventHandlerRef
- )
-
- let hotKeyID = EventHotKeyID(
- signature: Self.commandKHotKeySignature,
- id: Self.commandKHotKeyID
- )
- RegisterEventHotKey(
- UInt32(kVK_ANSI_K),
- UInt32(cmdKey),
- hotKeyID,
- GetApplicationEventTarget(),
- 0,
- &commandKHotKeyRef
- )
- }
-
- private func stopCommandKHotKeyMonitoring() {
- if let commandKHotKeyRef {
- UnregisterEventHotKey(commandKHotKeyRef)
- self.commandKHotKeyRef = nil
- }
-
- if let commandKEventHandlerRef {
- RemoveEventHandler(commandKEventHandlerRef)
- self.commandKEventHandlerRef = nil
- }
- }
-
- private func handleCommandKHotKey() {
+ private func activateInputFromStatusCommand() {
resetActivationTapSequence()
activateInputAtScreenCenter()
}
@@ -269,7 +196,7 @@ final class PointerPromptOverlayController {
case .flagsChanged:
handleModifierFlagsChanged(event.modifierFlags)
case .keyDown, .leftMouseDown, .rightMouseDown, .otherMouseDown:
- if event.type == .keyDown, activateFromCommandKIfNeeded(event) {
+ if event.type == .keyDown, dismissActivePromptIfEscape(event) {
resetActivationTapSequence()
return
}
@@ -285,19 +212,6 @@ final class PointerPromptOverlayController {
}
}
- private func activateFromCommandKIfNeeded(_ event: NSEvent) -> Bool {
- let flags = event.modifierFlags
- .intersection(.deviceIndependentFlagsMask)
- .subtracting(.capsLock)
- guard flags == .command,
- event.charactersIgnoringModifiers?.lowercased() == "k" else {
- return false
- }
-
- activateInputAtScreenCenter()
- return true
- }
-
private func handleModifierFlagsChanged(_ modifierFlags: NSEvent.ModifierFlags) {
let flags = modifierFlags
.intersection(.deviceIndependentFlagsMask)
@@ -530,11 +444,12 @@ final class PointerPromptOverlayController {
surfaceWidth: metrics.surfaceSize.width,
surfaceHeight: metrics.surfaceSize.height,
isExpanded: isStatusExpanded,
+ accentIndex: model.notchAccentIndex,
hoverChanged: { [weak self] isHovering in
self?.setStatusExpanded(isHovering)
},
commandRequested: { [weak self] in
- self?.handleCommandKHotKey()
+ self?.activateInputFromStatusCommand()
},
updateRequested: { [weak self] in
self?.openAvailableUpdate()
@@ -547,6 +462,17 @@ final class PointerPromptOverlayController {
}
private func setStatusExpanded(_ isExpanded: Bool) {
+ if isExpanded {
+ statusCollapseWorkItem?.cancel()
+ statusCollapseWorkItem = nil
+ applyStatusExpanded(true)
+ return
+ }
+
+ scheduleStatusCollapse()
+ }
+
+ private func applyStatusExpanded(_ isExpanded: Bool) {
guard isStatusExpanded != isExpanded else { return }
isStatusExpanded = isExpanded
@@ -554,6 +480,33 @@ final class PointerPromptOverlayController {
updateStatusPanelView()
}
+ private func scheduleStatusCollapse() {
+ statusCollapseWorkItem?.cancel()
+
+ let workItem = DispatchWorkItem { [weak self] in
+ Task { @MainActor in
+ self?.collapseStatusIfPointerIsOutside()
+ }
+ }
+ statusCollapseWorkItem = workItem
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.12, execute: workItem)
+ }
+
+ private func collapseStatusIfPointerIsOutside() {
+ statusCollapseWorkItem = nil
+
+ guard let statusPanel else {
+ applyStatusExpanded(false)
+ return
+ }
+
+ let hoverTolerance: CGFloat = 2
+ let hoverFrame = statusPanel.frame.insetBy(dx: -hoverTolerance, dy: -hoverTolerance)
+ guard !hoverFrame.contains(NSEvent.mouseLocation) else { return }
+
+ applyStatusExpanded(false)
+ }
+
private func activeScreen() -> NSScreen? {
inputPanel?.screen ?? statusPanel?.screen ?? NSScreen.main ?? NSScreen.screens.first
}
@@ -624,16 +577,7 @@ final class PointerPromptOverlayController {
let composerFrame = composerFrame(for: fixedPlacement)
let inputSurfaceFrame = composerInputSurfaceFrame(in: composerFrame)
- let closeButtonFrame = composerCloseButtonFrame(in: composerFrame).insetBy(dx: -3, dy: -3)
- var regions = [
- inputSurfaceFrame,
- CGRect(
- x: composerFrame.minX,
- y: inputSurfaceFrame.maxY,
- width: max(0, closeButtonFrame.minX - composerFrame.minX),
- height: max(0, composerFrame.maxY - inputSurfaceFrame.maxY)
- )
- ]
+ var regions = [inputSurfaceFrame]
regions.removeAll { $0.width <= 0 || $0.height <= 0 }
return regions
@@ -646,10 +590,9 @@ final class PointerPromptOverlayController {
x: x,
y: currentContentSize.height -
composerTopFromPanelTop -
- PointerPromptLayout.externalCloseButtonOutsideMargin -
currentComposerHeight,
width: PointerPromptLayout.composerWidth,
- height: currentComposerHeight + PointerPromptLayout.externalCloseButtonOutsideMargin
+ height: currentComposerHeight
)
}
@@ -669,15 +612,6 @@ final class PointerPromptOverlayController {
)
}
- private func composerCloseButtonFrame(in composerFrame: CGRect) -> CGRect {
- CGRect(
- x: composerFrame.maxX - PointerPromptLayout.externalCloseButtonSize,
- y: composerFrame.maxY - PointerPromptLayout.externalCloseButtonSize,
- width: PointerPromptLayout.externalCloseButtonSize,
- height: PointerPromptLayout.externalCloseButtonSize
- )
- }
-
private func composerTextInputFrame(in inputSurfaceFrame: CGRect) -> CGRect {
if model.isInputExpanded {
return CGRect(
@@ -736,6 +670,22 @@ final class PointerPromptOverlayController {
return true
}
+ private func dismissActivePromptIfEscape(_ event: NSEvent) -> Bool {
+ guard model.promptState.isActive,
+ event.keyCode == UInt16(kVK_Escape) else { return false }
+
+ dismissActivePromptFromKeyboard()
+ return true
+ }
+
+ private func dismissActivePromptFromKeyboard() {
+ guard model.promptState.isActive else { return }
+
+ model.handle(.dismissed)
+ isVoiceInputActive = false
+ microphoneWaveformMeter.stop()
+ }
+
private var currentContentSize: CGSize {
PointerPromptLayout.contentSize(
inputTextHeight: model.inputTextHeight,
@@ -833,6 +783,7 @@ final class PointerPromptOverlayController {
private final class PointerPromptPanel: NSPanel {
var dragRegionProvider: (() -> [CGRect])?
+ var escapeKeyHandler: (() -> Void)?
override var canBecomeKey: Bool {
true
@@ -843,6 +794,12 @@ private final class PointerPromptPanel: NSPanel {
}
override func sendEvent(_ event: NSEvent) {
+ if event.type == .keyDown,
+ event.keyCode == UInt16(kVK_Escape) {
+ escapeKeyHandler?()
+ return
+ }
+
if event.type == .leftMouseDown,
dragRegionProvider?().contains(where: { $0.contains(event.locationInWindow) }) == true {
performDrag(with: event)
@@ -873,10 +830,13 @@ private struct NotchMetrics {
var layout: PointerPromptNotchLayout {
PointerPromptNotchLayout(
+ voidWidth: voidWidth,
voidHeight: voidHeight,
+ collapsedVisibleHeight: collapsedVisibleHeight,
+ expandedVisibleHeight: expandedVisibleHeight,
contentHorizontalInset: max(12, surfaceWidth * 0.035),
visibleHeight: visibleHeight,
- cornerRadius: isExpanded ? 28 : 14
+ cornerRadius: isExpanded ? 28 : 13
)
}
@@ -891,14 +851,23 @@ private struct NotchMetrics {
private var visibleHeight: CGFloat {
if isExpanded {
- let headerHeight: CGFloat = 52
- let rosterHeight = CGFloat(5 * 58 + 4 * 10)
- let verticalPadding: CGFloat = 12 + 10 + 52 + 12
-
- return headerHeight + rosterHeight + verticalPadding
+ return expandedVisibleHeight
}
- return max(40, voidHeight + 14)
+ return collapsedVisibleHeight
+ }
+
+ private var collapsedVisibleHeight: CGFloat {
+ 26
+ }
+
+ private var expandedVisibleHeight: CGFloat {
+ let headerHeight: CGFloat = 40
+ let taskRowHeight: CGFloat = 48
+ let commandRowHeight: CGFloat = 42
+ let verticalPadding: CGFloat = 10 + 8 + 10
+
+ return headerHeight + taskRowHeight + commandRowHeight + verticalPadding
}
}
diff --git a/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift b/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
index 4fd97ebb..7e1df4d0 100644
--- a/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
+++ b/apps/Donkey/Sources/Donkey/PointerPromptOverlayModel.swift
@@ -10,6 +10,7 @@ final class PointerPromptOverlayModel: ObservableObject, PointerPromptIntentSink
@Published var placement: PointerPromptPlacement = .bottomRight
@Published var inputTextHeight = PointerPromptLayout.composerInputTextMinimumHeight
@Published var isInputExpanded = false
+ @Published private(set) var notchAccentIndex = Int.random(in: 0..<8)
@Published private(set) var updateState: PointerPromptUpdateState
private let commandHandler: any PointerPromptCommandHandling
@@ -131,18 +132,20 @@ final class PointerPromptOverlayModel: ObservableObject, PointerPromptIntentSink
}
private func submitCommand(_ text: String) {
+ let taskLabel = Self.taskLabel(for: text)
messageText = ""
inputTextHeight = PointerPromptLayout.composerInputTextMinimumHeight
isInputExpanded = false
+ notchAccentIndex = Self.nextAccentIndex(after: notchAccentIndex)
promptState.isActive = false
promptState.leadingSignalLevel = .thinking
- promptState.promptText = "Working..."
+ promptState.promptText = taskLabel
Task { [weak self, commandHandler] in
let result = await commandHandler.handleSubmittedCommand(text)
await MainActor.run {
guard let self else { return }
self.promptState.leadingSignalLevel = result.status == .completed ? .ready : .idle
- self.promptState.promptText = result.summary
+ self.promptState.promptText = result.taskLabel ?? result.summary
if let documentReviewRequest = result.documentReviewRequest {
self.documentReviewController.show(request: documentReviewRequest)
}
@@ -150,6 +153,29 @@ final class PointerPromptOverlayModel: ObservableObject, PointerPromptIntentSink
}
}
+ private static func nextAccentIndex(after currentIndex: Int) -> Int {
+ let accentCount = 8
+ var nextIndex = Int.random(in: 0..<accentCount)
+ if nextIndex == currentIndex {
+ nextIndex = (nextIndex + 1) % accentCount
+ }
+ return nextIndex
+ }
+
+ private static func taskLabel(for text: String) -> String {
+ let collapsed = text
+ .trimmingCharacters(in: .whitespacesAndNewlines)
+ .split(whereSeparator: \.isWhitespace)
+ .joined(separator: " ")
+ guard !collapsed.isEmpty else { return "New task" }
+
+ let maxLength = 44
+ guard collapsed.count > maxLength else { return collapsed }
+
+ let endIndex = collapsed.index(collapsed.startIndex, offsetBy: maxLength)
+ return String(collapsed[..<endIndex]).trimmingCharacters(in: .whitespacesAndNewlines) + "..."
+ }
+
private static func bundledTheme() -> PointerPromptTheme {
guard let themeURL = Bundle.module.url(forResource: "theme", withExtension: "json"),
let themeData = try? Data(contentsOf: themeURL),
diff --git a/apps/Donkey/Sources/DonkeyAI/OllamaTaskIntentAdapter.swift b/apps/Donkey/Sources/DonkeyAI/OllamaTaskIntentAdapter.swift
index 3a9eeac6..188cb386 100644
--- a/apps/Donkey/Sources/DonkeyAI/OllamaTaskIntentAdapter.swift
+++ b/apps/Donkey/Sources/DonkeyAI/OllamaTaskIntentAdapter.swift
@@ -325,23 +325,31 @@ public struct OllamaTaskIntentAdapter: TaskIntentParsingAdapter {
appNames: adapterRequest.taskDefinitions.map(\.targetApp.appName)
),
"options": [
- "num_predict": 512
- ]
+ "num_ctx": 2048,
+ "num_predict": 128,
+ "temperature": 0,
+ "top_p": 0.8
+ ],
+ "keep_alive": "10m"
]
}
private func promptText(for request: TaskIntentAdapterRequest) -> String {
let tasks = request.taskDefinitions.map { definition in
let entities = definition.entityRules.map { rule in
- "\(rule.name) required=\(rule.required) markers=\(rule.markers.joined(separator: ",")) aliases=\(rule.aliases.keys.sorted().joined(separator: ","))"
+ "\(rule.name) required=\(rule.required) aliases=\(rule.aliases.keys.sorted().joined(separator: ","))"
}
.joined(separator: "; ")
+ let workflow = definition.workflowSteps
+ .filter { $0.role != .parseIntent }
+ .map(\.summary)
+ .joined(separator: " -> ")
return [
"task_type=\(definition.taskType)",
"app=\(definition.targetApp.appName)",
"bundle=\(definition.targetApp.bundleIdentifier ?? "unknown")",
- "triggers=\(definition.triggerTerms.joined(separator: ","))",
+ "capability=\(workflow)",
"entities=\(entities)"
]
.joined(separator: " | ")
@@ -349,11 +357,14 @@ public struct OllamaTaskIntentAdapter: TaskIntentParsingAdapter {
.joined(separator: "\n")
return [
- "Return exactly one local app task intent as strict JSON.",
+ "Classify the user's natural-language request into exactly one supported local app task intent, then return strict JSON.",
+ "Choose by capability and target app, not by exact wording. The user should not need to remember command phrases.",
+ "Do not include reasoning.",
"Use only the provided task definitions. Do not invent apps, task types, entities, or actions.",
+ "If no capability fits, return the closest supported task with confidence below 0.55.",
"If a required entity is missing, set needsConfirmation=true and include missingEntity in metadata.",
"Command: \(request.command)",
- "Task definitions:",
+ "Supported task capabilities:",
tasks
]
.joined(separator: "\n")
@@ -440,7 +451,7 @@ public struct LocalModelTaskIntentResolver: Sendable {
return (
LocalAppTaskCatalogResolution(
- status: .unsupportedCommand,
+ status: .needsConfirmation,
metadata: [
"reason": "localModelIntentUnavailable",
"modelCallStatus": result.trace.status.rawValue
diff --git a/apps/Donkey/Sources/DonkeyContracts/PointerPromptLayout.swift b/apps/Donkey/Sources/DonkeyContracts/PointerPromptLayout.swift
index de38fa2b..36bf78a6 100644
--- a/apps/Donkey/Sources/DonkeyContracts/PointerPromptLayout.swift
+++ b/apps/Donkey/Sources/DonkeyContracts/PointerPromptLayout.swift
@@ -32,12 +32,6 @@ public enum PointerPromptLayout {
public static let composerExpandedTextHorizontalPadding: CGFloat = 24
public static let composerExpandedToolbarHeight: CGFloat = 54
public static let composerExpandedMinimumHeight: CGFloat = 156
- public static let closeButtonSize: CGFloat = 12
- public static let closeButtonInset: CGFloat = 16
- public static let closeControlWidth = closeButtonSize
- public static let externalCloseButtonSize: CGFloat = 19.2
- public static let externalCloseButtonGap: CGFloat = 2
- public static let externalCloseButtonOutsideMargin: CGFloat = externalCloseButtonSize + externalCloseButtonGap
public static let contentSize = contentSize(inputTextHeight: composerInputTextMinimumHeight)
public static let composerSize = CGSize(
diff --git a/apps/Donkey/Sources/DonkeyContracts/PointerPromptNotchLayout.swift b/apps/Donkey/Sources/DonkeyContracts/PointerPromptNotchLayout.swift
index edf4737f..720dd426 100644
--- a/apps/Donkey/Sources/DonkeyContracts/PointerPromptNotchLayout.swift
+++ b/apps/Donkey/Sources/DonkeyContracts/PointerPromptNotchLayout.swift
@@ -1,18 +1,27 @@
import CoreGraphics
public struct PointerPromptNotchLayout: Equatable, Sendable {
+ public var voidWidth: CGFloat
public var voidHeight: CGFloat
+ public var collapsedVisibleHeight: CGFloat
+ public var expandedVisibleHeight: CGFloat
public var contentHorizontalInset: CGFloat
public var visibleHeight: CGFloat
public var cornerRadius: CGFloat
public init(
+ voidWidth: CGFloat,
voidHeight: CGFloat,
+ collapsedVisibleHeight: CGFloat,
+ expandedVisibleHeight: CGFloat,
contentHorizontalInset: CGFloat,
visibleHeight: CGFloat,
cornerRadius: CGFloat
) {
+ self.voidWidth = voidWidth
self.voidHeight = voidHeight
+ self.collapsedVisibleHeight = collapsedVisibleHeight
+ self.expandedVisibleHeight = expandedVisibleHeight
self.contentHorizontalInset = contentHorizontalInset
self.visibleHeight = visibleHeight
self.cornerRadius = cornerRadius
diff --git a/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swift b/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swift
index ef0f2dd0..bedd28f9 100644
--- a/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swift
+++ b/apps/Donkey/Sources/DonkeyUI/PointerPromptNotchStatusView.swift
@@ -8,6 +8,7 @@ public struct PointerPromptNotchStatusView: View {
private let surfaceWidth: CGFloat
private let surfaceHeight: CGFloat
private let isExpanded: Bool
+ private let accentIndex: Int
private let hoverChanged: @MainActor (Bool) -> Void
private let commandRequested: @MainActor () -> Void
private let updateRequested: @MainActor () -> Void
@@ -19,6 +20,7 @@ public struct PointerPromptNotchStatusView: View {
surfaceWidth: CGFloat,
surfaceHeight: CGFloat,
isExpanded: Bool,
+ accentIndex: Int,
hoverChanged: @escaping @MainActor (Bool) -> Void,
commandRequested: @escaping @MainActor () -> Void,
updateRequested: @escaping @MainActor () -> Void
@@ -29,6 +31,7 @@ public struct PointerPromptNotchStatusView: View {
self.surfaceWidth = surfaceWidth
self.surfaceHeight = surfaceHeight
self.isExpanded = isExpanded
+ self.accentIndex = accentIndex
self.hoverChanged = hoverChanged
self.commandRequested = commandRequested
self.updateRequested = updateRequested
@@ -36,19 +39,12 @@ public struct PointerPromptNotchStatusView: View {
public var body: some View {
ZStack(alignment: .top) {
- UnevenRoundedRectangle(
- cornerRadii: RectangleCornerRadii(
- topLeading: 0,
- bottomLeading: cornerRadius,
- bottomTrailing: cornerRadius,
- topTrailing: 0
- ),
- style: .continuous
- )
- .fill(Color.black)
+ collapsedWindow
+ .opacity(isExpanded ? 0 : 1)
- content
- .offset(y: max(0, layout.voidHeight))
+ expandedWindow
+ .offset(y: isExpanded ? 0 : -expandedSurfaceHeight)
+ .animation(.smooth(duration: 0.24), value: isExpanded)
}
.frame(width: surfaceWidth, height: surfaceHeight, alignment: .top)
.clipped()
@@ -57,39 +53,167 @@ public struct PointerPromptNotchStatusView: View {
hoverChanged(isHovering)
}
}
- .animation(.smooth(duration: 0.24), value: isExpanded)
.accessibilityElement(children: .contain)
}
@ViewBuilder
- private var content: some View {
- if isExpanded {
- expandedContent
+ private var collapsedWindow: some View {
+ if isResting {
+ restingCollapsedWindow
} else {
+ regularCollapsedWindow
+ }
+ }
+
+ private var regularCollapsedWindow: some View {
+ ZStack(alignment: .top) {
+ notchSurface(height: collapsedSurfaceHeight, cornerRadius: collapsedCornerRadius)
+
+ physicalNotchDebugOutline
+
collapsedContent
+ .offset(y: max(0, layout.voidHeight))
+ }
+ .frame(width: surfaceWidth, height: collapsedSurfaceHeight, alignment: .top)
+ }
+
+ private var restingCollapsedWindow: some View {
+ ZStack(alignment: .top) {
+ physicalNotchDebugOutline
+
+ restingCollapsedSurface
+ .offset(x: restingSurfaceOffsetX, y: 0)
+ }
+ .frame(width: surfaceWidth, height: collapsedSurfaceHeight, alignment: .top)
+ }
+
+ private var restingCollapsedSurface: some View {
+ ZStack(alignment: .leading) {
+ notchSurface(
+ width: restingSurfaceWidth,
+ height: restingVisibleHeight,
+ cornerRadius: restingCornerRadius
+ )
+
+ TaskArrowMark(color: accentColor)
+ .frame(width: 13, height: 13)
+ .padding(.leading, 10)
+ }
+ .frame(width: restingSurfaceWidth, height: restingVisibleHeight, alignment: .leading)
+ }
+
+ private var expandedWindow: some View {
+ ZStack(alignment: .top) {
+ notchSurface(height: expandedSurfaceHeight, cornerRadius: expandedCornerRadius)
+
+ physicalNotchDebugOutline
+
+ expandedContent
+ .offset(y: max(0, layout.voidHeight))
}
+ .frame(width: surfaceWidth, height: expandedSurfaceHeight, alignment: .top)
+ }
+
+ private func notchSurface(
+ width: CGFloat? = nil,
+ height: CGFloat,
+ cornerRadius: CGFloat
+ ) -> some View {
+ notchSurfaceShape(cornerRadius: cornerRadius)
+ .fill(Color.black)
+ .overlay {
+ notchSurfaceShape(cornerRadius: cornerRadius)
+ .stroke(
+ notchDebugColor,
+ style: StrokeStyle(lineWidth: 1, dash: [5, 4])
+ )
+ }
+ .frame(width: width ?? surfaceWidth, height: height, alignment: .top)
+ }
+
+ private var physicalNotchDebugOutline: some View {
+ Rectangle()
+ .stroke(
+ Color.cyan.opacity(0.85),
+ style: StrokeStyle(lineWidth: 1, dash: [3, 3])
+ )
+ .frame(width: max(1, layout.voidWidth), height: max(1, layout.voidHeight))
+ .opacity(layout.voidWidth > 0 && layout.voidHeight > 0 ? 1 : 0)
+ }
+
+ private func notchSurfaceShape(cornerRadius: CGFloat) -> UnevenRoundedRectangle {
+ UnevenRoundedRectangle(
+ cornerRadii: RectangleCornerRadii(
+ topLeading: 0,
+ bottomLeading: cornerRadius,
+ bottomTrailing: cornerRadius,
+ topTrailing: 0
+ ),
+ style: .continuous
+ )
+ }
+
+ private var notchDebugColor: Color {
+ Color(red: 1.0, green: 0.14, blue: 0.58).opacity(0.92)
+ }
+
+ private var collapsedSurfaceHeight: CGFloat {
+ layout.voidHeight + layout.collapsedVisibleHeight
+ }
+
+ private var expandedSurfaceHeight: CGFloat {
+ layout.voidHeight + layout.expandedVisibleHeight
+ }
+
+ private var collapsedCornerRadius: CGFloat {
+ 13
+ }
+
+ private var expandedCornerRadius: CGFloat {
+ 28
+ }
+
+ private var restingVisibleHeight: CGFloat {
+ layout.voidHeight > 0 ? layout.voidHeight : layout.collapsedVisibleHeight
+ }
+
+ private var restingCornerRadius: CGFloat {
+ 9
+ }
+
+ private var restingArrowAllowance: CGFloat {
+ 34
+ }
+
+ private var restingSurfaceWidth: CGFloat {
+ max(restingArrowAllowance, layout.voidWidth + restingArrowAllowance * 2)
+ }
+
+ private var restingSurfaceOffsetX: CGFloat {
+ 0
}
private var collapsedContent: some View {
- HStack(spacing: 10) {
- agentIcon(agent: activeAgent, size: 25, symbolSize: 11)
+ HStack(spacing: 7) {
+ TaskArrowMark(color: accentColor)
+ .frame(width: 13, height: 13)
- Text("\(activeAgent.name) · \(activeAgent.subtitle)")
- .font(.system(size: 13, weight: .medium))
+ Text(taskTitle)
+ .font(.system(size: 12, weight: .regular))
.foregroundStyle(Color.white.opacity(0.92))
.lineLimit(1)
.truncationMode(.tail)
Spacer(minLength: 0)
- if activeAgent.isRunning {
- activityBars(color: activeAgent.color)
+ if isWorking {
+ activityBars(color: accentColor, height: 12)
}
}
- .padding(.horizontal, max(12, layout.contentHorizontalInset))
+ .padding(.horizontal, max(10, layout.contentHorizontalInset))
.frame(
width: surfaceWidth,
- height: layout.visibleHeight,
+ height: layout.collapsedVisibleHeight,
alignment: .center
)
}
@@ -98,45 +222,34 @@ public struct PointerPromptNotchStatusView: View {
VStack(spacing: 0) {
expandedHeader
- VStack(spacing: 10) {
- ForEach(displayAgentRows) { agent in
- expandedAgentRow(agent)
- }
- }
- .padding(.horizontal, 14)
- .padding(.top, 12)
+ currentTaskRow
+ .padding(.horizontal, 14)
+ .padding(.top, 10)
- Spacer(minLength: 10)
+ Spacer(minLength: 8)
commandRow
.padding(.horizontal, 14)
- .padding(.bottom, 12)
+ .padding(.bottom, 10)
}
.frame(
width: surfaceWidth,
- height: max(0, surfaceHeight - layout.voidHeight),
+ height: layout.expandedVisibleHeight,
alignment: .top
)
}
private var expandedHeader: some View {
- HStack(spacing: 12) {
- ZStack {
- Circle()
- .fill(activeAgent.color.opacity(0.92))
-
- Image(systemName: "face.smiling")
- .font(.system(size: 10.5, weight: .semibold))
- .foregroundStyle(Color.white)
- }
- .frame(width: 22, height: 22)
+ HStack(spacing: 10) {
+ TaskArrowMark(color: accentColor)
+ .frame(width: 15, height: 15)
- Text("Donkey")
- .font(.system(size: 15, weight: .semibold))
+ Text("Current task")
+ .font(.system(size: 13, weight: .regular))
.foregroundStyle(Color.white.opacity(0.92))
- Text("\(runningAgentCount) of 5 running")
- .font(.system(size: 13, weight: .medium))
+ Text(statusLabel)
+ .font(.system(size: 12, weight: .regular))
.foregroundStyle(Color.white.opacity(0.42))
Spacer()
@@ -149,7 +262,7 @@ public struct PointerPromptNotchStatusView: View {
.frame(width: 7, height: 7)
Text(updateTitle)
- .font(.system(size: 12, weight: .semibold))
+ .font(.system(size: 12, weight: .regular))
}
.foregroundStyle(Color.white.opacity(0.9))
.padding(.horizontal, 11)
@@ -164,15 +277,15 @@ public struct PointerPromptNotchStatusView: View {
HStack(spacing: 6) {
Image(systemName: "plus")
.font(.system(size: 13, weight: .regular))
- Text("new task")
- .font(.system(size: 13, weight: .medium))
+ Text("new")
+ .font(.system(size: 13, weight: .regular))
}
.foregroundStyle(Color.white.opacity(0.46))
}
.buttonStyle(.plain)
}
- .padding(.horizontal, 22)
- .frame(height: 52)
+ .padding(.horizontal, 18)
+ .frame(height: 40)
.overlay(alignment: .bottom) {
Rectangle()
.fill(Color.white.opacity(0.08))
@@ -180,217 +293,148 @@ public struct PointerPromptNotchStatusView: View {
}
}
- private func expandedAgentRow(_ agent: NotchAgentDisplay) -> some View {
- HStack(spacing: 14) {
- agentIcon(agent: agent, size: 32, symbolSize: 15)
+ private var currentTaskRow: some View {
+ HStack(spacing: 10) {
+ Circle()
+ .fill(accentColor)
+ .frame(width: 7, height: 7)
VStack(alignment: .leading, spacing: 4) {
- HStack(spacing: 8) {
- Text(agent.name)
- .font(.system(size: 14, weight: .semibold))
- .foregroundStyle(Color.white.opacity(0.9))
-
- Text(agent.statusLabel)
- .font(.system(size: 11, weight: .medium))
- .foregroundStyle(agent.isRunning ? agent.color : Color.white.opacity(0.44))
- .padding(.horizontal, 5)
- .padding(.vertical, 2)
- .background(agent.isRunning ? agent.color.opacity(0.18) : Color.clear)
- .clipShape(RoundedRectangle(cornerRadius: 4, style: .continuous))
- }
-
- Text(agent.isRunning ? agent.subtitle : "No active task")
+ Text(taskTitle)
.font(.system(size: 13, weight: .regular))
- .foregroundStyle(Color.white.opacity(0.42))
+ .foregroundStyle(Color.white.opacity(0.9))
.lineLimit(1)
+
+ Text(statusDescription)
+ .font(.system(size: 12, weight: .regular))
+ .foregroundStyle(Color.white.opacity(0.42))
}
Spacer()
- if agent.isRunning {
- activityBars(color: agent.color)
- } else {
- Image(systemName: "play.fill")
- .font(.system(size: 16, weight: .semibold))
- .foregroundStyle(Color.white.opacity(0.42))
+ if isWorking {
+ activityBars(color: accentColor)
}
}
.padding(.horizontal, 12)
- .frame(height: 58)
- .background {
- if agent.isRunning {
- RoundedRectangle(cornerRadius: 10, style: .continuous)
- .fill(agent.color.opacity(0.1))
- .overlay(alignment: .leading) {
- RoundedRectangle(cornerRadius: 2, style: .continuous)
- .fill(agent.color)
- .frame(width: 3)
- }
- }
- }
+ .frame(height: 48)
+ .background(Color.white.opacity(0.055))
+ .clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
}
private var commandRow: some View {
Button(action: commandRequested) {
- HStack(spacing: 13) {
+ HStack(spacing: 10) {
Image(systemName: "sparkles")
- .font(.system(size: 16, weight: .medium))
+ .font(.system(size: 14, weight: .regular))
.foregroundStyle(Color.white.opacity(0.42))
- Text("Tell donkey what to do...")
- .font(.system(size: 14, weight: .medium))
+ Text("Type a task...")
+ .font(.system(size: 13, weight: .regular))
.foregroundStyle(Color.white.opacity(0.42))
Spacer()
-
- Text("⌘ K")
- .font(.system(size: 12, weight: .semibold, design: .monospaced))
- .foregroundStyle(Color.white.opacity(0.42))
- .padding(.horizontal, 10)
- .frame(height: 28)
- .background(Color.white.opacity(0.06))
- .overlay {
- RoundedRectangle(cornerRadius: 7, style: .continuous)
- .stroke(Color.white.opacity(0.13), lineWidth: 1)
- }
- .clipShape(RoundedRectangle(cornerRadius: 7, style: .continuous))
}
- .padding(.horizontal, 16)
- .frame(height: 52)
+ .padding(.horizontal, 12)
+ .frame(height: 42)
.background(Color.white.opacity(0.055))
- .clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
+ .clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
}
.buttonStyle(.plain)
}
- private func agentIcon(
- agent: NotchAgentDisplay,
- size: CGFloat,
- symbolSize: CGFloat
- ) -> some View {
- ZStack {
- RoundedRectangle(cornerRadius: size * 0.24, style: .continuous)
- .fill(agent.color)
-
- Image(systemName: agent.symbolName)
- .font(.system(size: symbolSize, weight: .semibold))
- .foregroundStyle(Color.white)
- }
- .frame(width: size, height: size)
- }
-
- private func activityBars(color: Color) -> some View {
+ private func activityBars(color: Color, height: CGFloat = 18) -> some View {
HStack(spacing: 3) {
ForEach([0.44, 0.82, 0.58], id: \.self) { scale in
Capsule(style: .continuous)
.fill(color)
- .frame(width: 3, height: 18 * scale)
+ .frame(width: 3, height: height * scale)
}
}
- .frame(width: 18, height: 18)
+ .frame(width: 18, height: height)
}
- private var activeAgent: NotchAgentDisplay {
- displayAgentRows[0]
+ private var taskTitle: String {
+ switch state.leadingSignalLevel {
+ case .idle:
+ let text = state.promptText.trimmingCharacters(in: .whitespacesAndNewlines)
+ return text.isEmpty || text == "Make this so" ? "Resting" : text
+ case .ready:
+ let text = state.promptText.trimmingCharacters(in: .whitespacesAndNewlines)
+ return text.isEmpty ? "Ready" : text
+ case .thinking:
+ let text = state.promptText.trimmingCharacters(in: .whitespacesAndNewlines)
+ return text.isEmpty ? "Working" : text
+ }
}
- private var activeSubtitle: String {
+ private var statusLabel: String {
switch state.leadingSignalLevel {
case .idle:
return "resting"
case .ready:
- let text = state.promptText.trimmingCharacters(in: .whitespacesAndNewlines)
- guard !text.isEmpty else { return "ready" }
- return text
+ return "ready"
case .thinking:
- return "ranking models on SWE-bench"
+ return "working"
}
}
- private var activeStatusLabel: String {
+ private var statusDescription: String {
switch state.leadingSignalLevel {
case .idle:
- return "idle"
+ return "Waiting for a task"
case .ready:
- return "done"
+ return "Ready for the next task"
case .thinking:
- return "running"
+ return "Classifying and running"
}
}
- private var runningAgentCount: Int {
- displayAgentRows.filter(\.isRunning).count
+ private var isWorking: Bool {
+ state.leadingSignalLevel == .thinking
}
- private var displayAgentRows: [NotchAgentDisplay] {
- var rows = baseAgentRows
- rows[0].subtitle = activeSubtitle
- rows[0].statusLabel = activeStatusLabel
- rows[0].isRunning = state.leadingSignalLevel == .thinking
- return rows
+ private var isResting: Bool {
+ state.leadingSignalLevel == .idle && taskTitle == "Resting"
}
- private var baseAgentRows: [NotchAgentDisplay] {
- [
- NotchAgentDisplay(
- id: "coder",
- name: "Coder",
- subtitle: "Ranking models on SWE-bench",
- statusLabel: "running",
- symbolName: "chevron.left.forwardslash.chevron.right",
- color: Color(red: 0.114, green: 0.62, blue: 0.46),
- isRunning: true
- ),
- NotchAgentDisplay(
- id: "browser",
- name: "Browser",
- subtitle: "Pulling pricing from 3 sites",
- statusLabel: "idle",
- symbolName: "globe",
- color: Color(red: 0.94, green: 0.62, blue: 0.15),
- isRunning: false
- ),
- NotchAgentDisplay(
- id: "researcher",
- name: "Researcher",
- subtitle: "Reading 12 ArXiv papers",
- statusLabel: "idle",
- symbolName: "magnifyingglass",
- color: Color(red: 0.83, green: 0.33, blue: 0.49),
- isRunning: false
- ),
- NotchAgentDisplay(
- id: "inbox",
- name: "Inbox",
- subtitle: "Drafting reply to recruiter",
- statusLabel: "idle",
- symbolName: "envelope",
- color: Color(red: 0.22, green: 0.54, blue: 0.87),
- isRunning: false
- ),
- NotchAgentDisplay(
- id: "scheduler",
- name: "Scheduler",
- subtitle: "Finding slots across KST/PT",
- statusLabel: "idle",
- symbolName: "calendar",
- color: Color(red: 0.5, green: 0.47, blue: 0.87),
- isRunning: false
- )
- ]
+ private var accentColor: Color {
+ Self.accentColors[((accentIndex % Self.accentColors.count) + Self.accentColors.count) % Self.accentColors.count]
}
+ private static let accentColors: [Color] = [
+ Color(red: 0.114, green: 0.62, blue: 0.46),
+ Color(red: 0.94, green: 0.62, blue: 0.15),
+ Color(red: 0.83, green: 0.33, blue: 0.49),
+ Color(red: 0.22, green: 0.54, blue: 0.87),
+ Color(red: 0.5, green: 0.47, blue: 0.87),
+ Color(red: 0.88, green: 0.35, blue: 0.28),
+ Color(red: 0.24, green: 0.69, blue: 0.71),
+ Color(red: 0.66, green: 0.34, blue: 0.79)
+ ]
+
private var cornerRadius: CGFloat {
layout.cornerRadius
}
}
-private struct NotchAgentDisplay: Identifiable {
- var id: String
- var name: String
- var subtitle: String
- var statusLabel: String
- var symbolName: String
+private struct TaskArrowMark: View {
var color: Color
- var isRunning: Bool
+
+ var body: some View {
+ GeometryReader { proxy in
+ let width = proxy.size.width
+ let height = proxy.size.height
+ Path { path in
+ path.move(to: CGPoint(x: width * 0.18, y: height * 0.06))
+ path.addLine(to: CGPoint(x: width * 0.88, y: height * 0.5))
+ path.addLine(to: CGPoint(x: width * 0.18, y: height * 0.94))
+ path.addLine(to: CGPoint(x: width * 0.34, y: height * 0.5))
+ path.closeSubpath()
+ }
+ .fill(color)
+ }
+ .aspectRatio(1, contentMode: .fit)
+ .accessibilityHidden(true)
+ }
}
diff --git a/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift b/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
index fa6e2af2..cee9048c 100644
--- a/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
+++ b/apps/Donkey/Sources/DonkeyUI/PointerPromptStageView.swift
@@ -72,9 +72,6 @@ public struct PointerPromptStageView: View {
messageText: $messageText,
inputTextHeight: inputTextHeight,
isInputExpanded: isInputExpanded,
- dismiss: {
- intentSink?.handle(.dismissed)
- },
submit: {
intentSink?.handle(.messageSubmitted(text: messageText))
},
@@ -109,22 +106,12 @@ private struct PointerPromptComposer: View {
@Binding var messageText: String
let inputTextHeight: CGFloat
let isInputExpanded: Bool
- let dismiss: @MainActor () -> Void
let submit: @MainActor () -> Void
let inputTextHeightChanged: @MainActor (CGFloat) -> Void
let inputExpansionChanged: @MainActor (Bool) -> Void
var body: some View {
- ZStack(alignment: .topTrailing) {
- promptSurface
-
- ComposerExternalCloseButton(action: dismiss)
- .offset(
- x: 0,
- y: -PointerPromptLayout.externalCloseButtonSize -
- PointerPromptLayout.externalCloseButtonGap
- )
- }
+ promptSurface
.frame(
width: PointerPromptLayout.composerInputSurfaceWidth,
height: PointerPromptLayout.composerInputHeight(
@@ -133,7 +120,6 @@ private struct PointerPromptComposer: View {
),
alignment: .topLeading
)
- .padding(.top, PointerPromptLayout.externalCloseButtonSize + PointerPromptLayout.externalCloseButtonGap)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
}
@@ -302,40 +288,6 @@ private struct PointerPromptComposer: View {
}
}
-private struct ComposerExternalCloseButton: View {
- let action: @MainActor () -> Void
- @State private var isHovered = false
-
- var body: some View {
- Button(action: action) {
- Image(systemName: "xmark")
- .font(.system(size: 8.8, weight: .bold))
- .foregroundStyle(Color.white.opacity(0.92))
- .frame(
- width: PointerPromptLayout.externalCloseButtonSize,
- height: PointerPromptLayout.externalCloseButtonSize
- )
- .background {
- Circle()
- .fill(Color.black.opacity(isHovered ? 0.82 : 0.68))
- .overlay {
- Circle()
- .stroke(Color.white.opacity(0.42), lineWidth: 1)
- }
- }
- }
- .buttonStyle(.plain)
- .frame(
- width: PointerPromptLayout.externalCloseButtonSize,
- height: PointerPromptLayout.externalCloseButtonSize
- )
- .contentShape(Circle())
- .onHover { isHovered = $0 }
- .animation(.easeOut(duration: 0.12), value: isHovered)
- .accessibilityLabel("Close prompt")
- }
-}
-
private struct VoiceWaveformView: View {
let levels: [Double]
diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift
index 70f2c9d6..eadbc70d 100644
--- a/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift
+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift
@@ -82,6 +82,8 @@ struct AIHarnessAdapterTests {
#expect(selected.id == "local-runtime-task-intent-qwen3")
#expect(selected.role == .taskIntent)
#expect(selected.provider == .localRuntime)
+ #expect(selected.modelID == "qwen3:8b")
+ #expect(selected.timeoutMS == 4_000)
}
@Test
@@ -329,7 +331,15 @@ struct AIHarnessAdapterTests {
#expect(body["model"] as? String == "qwen3:8b")
#expect(body["stream"] as? Bool == false)
#expect(body["format"] as? [String: Any] != nil)
+ #expect(body["keep_alive"] as? String == "10m")
+ let options = try #require(body["options"] as? [String: Any])
+ #expect(options["num_predict"] as? Int == 128)
+ #expect(options["num_ctx"] as? Int == 2048)
#expect((body["prompt"] as? String)?.contains("Use only the provided task definitions") == true)
+ #expect((body["prompt"] as? String)?.contains("Choose by capability and target app") == true)
+ #expect((body["prompt"] as? String)?.contains("Do not include reasoning") == true)
+ #expect((body["prompt"] as? String)?.contains("triggers=") == false)
+ #expect((body["prompt"] as? String)?.contains("metadata=") == false)
}
@Test
@@ -432,6 +442,70 @@ struct AIHarnessAdapterTests {
#expect(result.trace.metadata["fallback.reason"] == "localModelIntentUnavailable")
}
+ @Test
+ func localModelTaskIntentResolverAsksForDetailsInsteadOfUnsupportedWhenRuntimeUnavailable() async {
+ let resolver = LocalModelTaskIntentResolver(
+ catalog: LocalAppTaskCatalog(
+ taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults,
+ availabilityProvider: StaticLocalAppAvailabilityProvider(installedBundleIdentifiers: ["com.apple.weather"])
+ ),
+ adapter: UnavailableTaskIntentAdapter()
+ )
+
+ let result = await resolver.resolve(
+ command: "do the thing with that value",
+ sourceTraceID: "trace-resolve-clarify"
+ )
+
+ #expect(result.resolution.status == .needsConfirmation)
+ #expect(result.resolution.metadata["reason"] == "localModelIntentUnavailable")
+ #expect(result.resolution.metadata["modelCallStatus"] == "providerOutage")
+ }
+
+ @Test
+ func localModelTaskIntentResolverAcceptsClosestLowConfidenceClassification() async {
+ let httpClient = FakeAIHTTPClient(
+ data: ollamaResponseData(
+ response: """
+ {"taskType":"weather_lookup","targetAppName":"Weather","entities":{},"normalizedEntities":{},"confidence":0.2,"needsConfirmation":false,"metadata":{}}
+ """
+ ),
+ statusCode: 200
+ )
+ let resolver = LocalModelTaskIntentResolver(
+ catalog: LocalAppTaskCatalog(
+ taskDefinitions: BuiltInLocalAppTaskDefinitions.defaults,
+ availabilityProvider: StaticLocalAppAvailabilityProvider(installedBundleIdentifiers: ["com.apple.weather"])
+ ),
+ adapter: OllamaTaskIntentAdapter(
+ router: AIModelRouter(
+ registry: AIModelRegistry(
+ entries: [
+ entry(
+ id: "local-intent",
+ role: .taskIntent,
+ provider: .ollama,
+ modelID: "qwen3:8b",
+ endpoint: URL(string: "http://127.0.0.1:11434/api/generate")!,
+ promptVersion: "task-intent-v1"
+ )
+ ]
+ )
+ ),
+ httpClient: httpClient
+ )
+ )
+
+ let result = await resolver.resolve(
+ command: "banana",
+ sourceTraceID: "trace-low-confidence"
+ )
+
+ #expect(result.resolution.status == .needsConfirmation)
+ #expect(result.resolution.intent?.taskType == "weather_lookup")
+ #expect(result.resolution.metadata["reason"] == "city")
+ }
+
@Test
func openAIAdapterBuildsResponsesRequestWithStoreFalseAndDecodesStructuredHint() async throws {
let httpClient = FakeAIHTTPClient(
diff --git a/docs/guides/minimal-run-coordinator.md b/docs/guides/minimal-run-coordinator.md
index b3c82d77..2f6e36ab 100644
--- a/docs/guides/minimal-run-coordinator.md
+++ b/docs/guides/minimal-run-coordinator.md
@@ -34,7 +34,7 @@ Donkey also supports reflex latency reports and a synthetic replay benchmark. `R
Donkey also supports the first fast local-navigation dry-run slice end to end through the dry-run reflex loop. `LocalNavigationMetadataFrameSource` can turn macOS window candidate metadata and optional browser-tab metadata supplied by callers into metadata-only hot-loop frames. `LocalNavigationDryRunPerceptionAdapter` and `LocalNavigationDryRunWorldStateProjector` keep the local-navigation path swappable while preserving the no-remote-model fallback. `LocalNavigationControllerPolicy` can choose traceable dry-run semantic actions such as `focusWindow`, `activateCandidate`, `switchTab`, `wait`, or `observe` from typed state. This slice is metadata-only and side-effect free by default; guarded live-action smoke requires an injected backend, and richer visual inference remains future work.
-Donkey also supports the first generic local-app task catalog, intent, live runner, and local task-definition loading boundary. `TaskIntent` can represent a parsed task, target app, normalized entities, parser source, confidence, and confirmation state. `LocalAppTaskDefinition` describes app-task knowledge as data: target app metadata, deterministic trigger terms, required entities and aliases, workflow steps, observation strategies, and verification rules. `LocalAppTaskDefinitionLoader` can load additional JSON or JSONL task definitions from `~/Library/Application Support/Donkey/TaskDefinitions/` and merge them with built-ins, so new use cases do not require Swift source changes. `LocalAppTaskCatalog` resolves validated intents against known task definitions, checks target-app availability through an injected provider, and exposes built-in definitions such as Weather lookup, Music playback, and PDF/document form-fill as data rather than source-specific adapters. `ProcessBackedLocalLLMTaskIntentAdapter` is the submitted-command parser: it sends the user command and available task definitions to the app-managed `DONKEY_LOCAL_LLM_RUNNER` sidecar, decodes a `TaskIntent`, and validates it against the catalog before execution can proceed. `OllamaTaskIntentAdapter` remains available for adapter-level tests and compatibility, while `LocalAppTaskIntentParser` remains deterministic validator and benchmark scaffold code rather than a user-command fallback. `LocalAppTaskAdapter` can build a target-app local-navigation metadata request, project dry-run workflow steps, emit guarded keyboard command templates, and verify observed visible text against the requested entity. `LocalAppAccessibilityControlDiscovery` can index controls and form fields from bounded Accessibility snapshots, and `MacAccessibilityActionEngineInputBackend` can execute guarded `AXPress` and `AXSetValue` commands when Accessibility is trusted, focus guard passes, and input policy allows it. `ProcessBackedLocalUIUnderstandingAdapter` can call a local JSON sidecar from `DONKEY_UI_UNDERSTANDER` for bounded screenshot/crop context and return visible text, controls, form fields, and confidence as a `LocalAppTaskObservation`; those results feed observation only and never direct input actions. `LocalAppTaskLiveRunner` publishes coordinator lifecycle/tool events, can launch or focus the resolved app, prefer discovered Accessibility commands when available, fall back to guarded keyboard templates, observe visible Accessibility text when trusted, include bounded screenshot understanding only when Accessibility/metadata are insufficient, and return a final verification plan. Review-only tasks, such as document form-fill with external data, resolve into a local context snapshot and `DocumentFormFillPlanner` review plan. The pointer prompt opens a user-visible review window for proposed document field mappings; only user-approved fields are sent to the guarded Accessibility input runner.
+Donkey also supports the first generic local-app task catalog, intent, live runner, and local task-definition loading boundary. `TaskIntent` can represent a parsed task, target app, normalized entities, parser source, confidence, and confirmation state. `LocalAppTaskDefinition` describes app-task knowledge as data: target app metadata, deterministic trigger terms for offline fallback, required entities and aliases, workflow steps, observation strategies, and verification rules. `LocalAppTaskDefinitionLoader` can load additional JSON or JSONL task definitions from `~/Library/Application Support/Donkey/TaskDefinitions/` and merge them with built-ins, so new use cases do not require Swift source changes. `LocalAppTaskCatalog` resolves validated intents against known task definitions, checks target-app availability through an injected provider, and exposes built-in definitions such as Weather lookup, Music playback, and PDF/document form-fill as data rather than source-specific adapters. `ProcessBackedLocalLLMTaskIntentAdapter` is the submitted-command classifier: it sends the user command and a compact supported-capability list to the app-managed `DONKEY_LOCAL_LLM_RUNNER` sidecar, asks the fast local model to classify by capability rather than exact trigger wording, decodes a `TaskIntent`, rejects low-confidence matches, and validates the result against the catalog before execution can proceed. `OllamaTaskIntentAdapter` remains available for adapter-level tests and compatibility, while `LocalAppTaskIntentParser` remains deterministic validator and offline fallback scaffold code rather than the user-facing command model. `LocalAppTaskAdapter` can build a target-app local-navigation metadata request, project dry-run workflow steps, emit guarded keyboard command templates, and verify observed visible text against the requested entity. `LocalAppAccessibilityControlDiscovery` can index controls and form fields from bounded Accessibility snapshots, and `MacAccessibilityActionEngineInputBackend` can execute guarded `AXPress` and `AXSetValue` commands when Accessibility is trusted, focus guard passes, and input policy allows it. `ProcessBackedLocalUIUnderstandingAdapter` can call a local JSON sidecar from `DONKEY_UI_UNDERSTANDER` for bounded screenshot/crop context and return visible text, controls, form fields, and confidence as a `LocalAppTaskObservation`; those results feed observation only and never direct input actions. `LocalAppTaskLiveRunner` publishes coordinator lifecycle/tool events, can launch or focus the resolved app, prefer discovered Accessibility commands when available, fall back to guarded keyboard templates, observe visible Accessibility text when trusted, include bounded screenshot understanding only when Accessibility/metadata are insufficient, and return a final verification plan. Review-only tasks, such as document form-fill with external data, resolve into a local context snapshot and `DocumentFormFillPlanner` review plan. The pointer prompt opens a user-visible review window for proposed document field mappings; only user-approved fields are sent to the guarded Accessibility input runner.
Donkey also supports a guarded live-action smoke boundary for local-navigation behavior. `GuardedLiveActionSmokeRunner` requires an end-to-end dry-run result, a latency report with p95 evidence, a non-fallback latest action, explicit input policy allowance, and a passing action-engine focus guard before mapping semantic local-navigation actions to typed action-engine commands. The smoke path records replayable action traces and can execute only through an injected backend.
@@ -48,7 +48,7 @@ Donkey also supports a reusable local JSON sidecar runner for local model proces
Donkey's live local-app observation path uses Accessibility and bounded screenshots only. `MacLocalAppTaskController` captures Accessibility controls/visible text first and, when the task definition includes screenshot local-model observation, captures a bounded target-window screenshot only if Accessibility/metadata did not provide the verification text or required controls. That screenshot is sent to `ProcessBackedLocalUIUnderstandingAdapter`. The adapter output is merged into `LocalAppTaskObservation` as visible text, controls, form fields, confidence, and metadata. Screenshot understanding is observation context only and never emits direct input actions.
-Donkey also supports the first post-install local runtime setup boundary. The app package does not ship local runtime packages or Parakeet/YOLO model weights, but `scripts/package-donkey-app.sh` creates Donkey-compatible sidecar runner package artifacts under `dist/LocalRuntimePackages/` for release hosting. Each Python-backed package contains a small executable wrapper plus `donkey_runtime_runner.py`, and manifests checksum both files. Parakeet and YOLO packages also include a manifest-tracked `requirements.txt`; the runner creates a managed virtual environment under Application Support and installs those dependencies there from the Python package index. UI understanding ships as a Swift sidecar using Apple's on-device Vision text recognition, so it does not need downloaded model weights. `LocalModelRuntimeSetupManager` describes the required Parakeet, YOLO26, UI-understanding, and local command-parser LLM runtime packages, provides user-facing setup instructions, downloads configured manifest-backed package files, validates user-downloaded runtime folders, enforces SHA-256 checksums and required signature metadata, verifies Curve25519 manifest signatures when trusted release keys are configured, caches verified package files under Application Support, asks each installed sidecar to prepare model weights in Application Support, and records executable paths in `~/Library/Application Support/Donkey/LocalModelRuntimes/runtime-installations.json`. The `local-llm` runner uses Ollama `qwen3:8b` when available but reports a non-blocking external-unavailable state during setup when Ollama is absent; submitted commands still have the deterministic local-app parser fallback. The Parakeet runner can prepare a Hugging Face snapshot and calls NVIDIA NeMo for transcription when available; YOLO installs its managed Ultralytics dependency and prepares the selected segmentation model. After registration, sidecar calls can resolve app-managed executables without shell environment variables. The first-run setup window exposes one setup button that installs/downloads, verifies, registers, prepares model weights, and health-checks all required runtimes, with one overall ready or retryable needs-attention state. Retry keeps completed runtime installs and resumes at failed or not-yet-attempted runtimes. Settings can reopen setup, and runtime lifecycle helpers can repair or remove managed installs and export user-data-free support status. Developer launch arguments can print setup instructions, show install status, export support status, repair, remove, or register a downloaded runtime folder.
+Donkey also supports the first post-install local runtime setup boundary. The app package does not ship local runtime packages or Parakeet/YOLO model weights, but `scripts/package-donkey-app.sh` creates Donkey-compatible sidecar runner package artifacts under `dist/LocalRuntimePackages/` for release hosting. Each Python-backed package contains a small executable wrapper plus `donkey_runtime_runner.py`, and manifests checksum both files. Parakeet and YOLO packages also include a manifest-tracked `requirements.txt`; the runner creates a managed virtual environment under Application Support and installs those dependencies there from the Python package index. UI understanding ships as a Swift sidecar using Apple's on-device Vision text recognition, so it does not need downloaded model weights. `LocalModelRuntimeSetupManager` describes the required Parakeet, YOLO26, UI-understanding, and local command-parser LLM runtime packages, provides user-facing setup instructions, downloads configured manifest-backed package files, validates user-downloaded runtime folders, enforces SHA-256 checksums and required signature metadata, verifies Curve25519 manifest signatures when trusted release keys are configured, caches verified package files under Application Support, asks each installed sidecar to prepare model weights in Application Support, and records executable paths in `~/Library/Application Support/Donkey/LocalModelRuntimes/runtime-installations.json`. The `local-llm` runner uses Ollama `qwen3:8b` when available so intent classification stays on the supported local LLM path, but reports a non-blocking external-unavailable state during setup when Ollama is absent; submitted commands still have the deterministic local-app parser fallback. The Parakeet runner can prepare a Hugging Face snapshot and calls NVIDIA NeMo for transcription when available; YOLO installs its managed Ultralytics dependency and prepares the selected segmentation model. After registration, sidecar calls can resolve app-managed executables without shell environment variables. The first-run setup window exposes one setup button that installs/downloads, verifies, registers, prepares model weights, and health-checks all required runtimes, with one overall ready or retryable needs-attention state. Retry keeps completed runtime installs and resumes at failed or not-yet-attempted runtimes. Settings can reopen setup, and runtime lifecycle helpers can repair or remove managed installs and export user-data-free support status. Developer launch arguments can print setup instructions, show install status, export support status, repair, remove, or register a downloaded runtime folder.
Donkey also supports the first provider-neutral planner-hint adapter boundary using OpenAI's Responses API. `OpenAIPlannerHintAdapter` reads `OPENAI_API_KEY` from the environment, routes through the model registry, sends a structured-output Responses request with `store: false`, decodes a strict JSON response containing a planner hint plus optional memory write proposals, and records a model-call trace with role, provider, model id, prompt version, schema id, latency, timeout, validation status, and source trace/state ids. Missing credentials, cancellation, timeout, rate limit, invalid output, and provider outage return traceable failures without stopping the reflex loop. Official OpenAI docs were rechecked on May 16, 2026 for the Responses API, `text.format` JSON schema structured outputs, `store: false`, and current model registry default guidance.
diff --git a/docs/guides/pointer-prompt-overlay.md b/docs/guides/pointer-prompt-overlay.md
index 50c4a860..39646700 100644
--- a/docs/guides/pointer-prompt-overlay.md
+++ b/docs/guides/pointer-prompt-overlay.md
@@ -5,21 +5,23 @@
Donkey supports a floating macOS pointer prompt overlay:
- double-tap Command and release to activate and focus a compact prompt modal centered on the current screen without clicking into the target app
-- Command-K activates and focuses the prompt input in the center of the current screen
- double-tap Command and hold the second Command press to activate voice input
- shows a notch-anchored black status panel flush with the top center of the current screen
- sizes the notch status panel from `NSScreen.safeAreaInsets` and `auxiliaryTopLeftArea` / `auxiliaryTopRightArea`, with fallback dimensions for non-reporting displays
- keeps status text below the physical notch void while the black panel visually extends the notch
-- expands the notch status panel on hover to show the agent roster and a bottom command row
+- renders the resting collapsed notch as a slim arrow-only strip beside the physical notch, without adding black padding over the notch void
+- uses regular-weight notch text; collapsed and expanded notch labels should not render bold text
+- expands the notch status panel downward on hover to show the current task and a bottom command row
+- shows temporary debug outlines around the rendered notch surface and detected physical notch void while notch geometry is being tuned
- shows an update button in the expanded notch header when Sparkle reports a valid appcast update
- shows a black prompt modal with text input and a white voice waveform while active
- uses a wide pill-shaped prompt for single-line text, then expands to a rounded rectangle when text wraps at the max input width or the user inserts new lines
- places the waveform in a bottom toolbar that blends with the input background when the prompt is expanded
- captures microphone audio while active and renders the waveform from recent live audio levels
- on voice activation, records a bounded local audio buffer, sends it to the Parakeet-only local transcription adapter, displays transcript progress, and submits decoded transcript text through the same command path as typed input
-- keeps the prompt modal centered until the user drags, dismisses, or closes the modal
+- keeps the prompt modal centered until the user drags or dismisses the modal
- dismisses the active modal when the user clicks outside it
-- closes the active modal with a small high-contrast circular x button outside the prompt surface at the top-right corner
+- dismisses the active modal when the user presses Escape while it is visible
- supports dragging the active modal from capsule areas outside the text input
- lets normal clicks pass through the inactive overlay and transparent active overlay space
- opens the prompt input centered on the current screen instead of following the cursor
@@ -34,23 +36,25 @@ This is a visual, typed-command, and voice-command UI capability. Typed submissi
- Donkey runs with the accessory activation policy, and prompt focus must make the app active, make the panel key, then make the composer text view first responder. A blinking insertion point alone does not mean macOS is sending keyboard events to the panel.
- SwiftUI rendering stays in `DonkeyUI`; it receives `PointerPromptState` and `PointerPromptPlacement` from `DonkeyContracts`.
- Product state stays in `PointerPromptOverlayModel`.
-- Treat the active modal as a compact black prompt surface with a text input, embedded waveform, and a small high-contrast circular x button perched outside the surface at the top-right corner. It has no separate voice button.
+- Treat the active modal as a compact black prompt surface with a text input and embedded waveform. It has no visible close button and no separate voice button.
- Single-line input should render as a full pill. Multiline input should render as a rounded rectangle with non-pill corners and a bottom toolbar matching the input background, containing the waveform without a divider between text and toolbar. The plus and permissions controls may remain available in code for future wiring, but should not render while non-functional.
- The text input should use 16pt light system UI text with ligatures disabled, matching thin `-apple-system` sans-serif web input rendering.
- Text expansion is triggered from a stable pill-width measurement so reaching the single-line edge transitions cleanly without shape flicker. Expanded text uses balanced horizontal padding. Return submits typed text. Shift-Return inserts a deliberate newline.
- Expanded text input grows to a bounded multiline height, then scrolls inside the composer so the waveform toolbar stays attached to the bottom of the prompt instead of being pushed off-screen.
- The controller owns microphone capture and publishes normalized audio levels into product state; SwiftUI only renders the levels it receives.
- The active prompt modal should use a capsule shape and keep transparent active overlay space passing clicks through to windows underneath after it dismisses.
-- Agent pointer drawing and theme code may remain available for future features, but the prompt overlay should not render a visible cursor.
+- Pointer drawing and theme code may remain available for future features, but the prompt overlay should not render a visible cursor.
- Runtime placement remains fixed to `bottomRight` for compatibility with the existing view contract; the rendered input panel itself is centered and no longer uses pointer-relative geometry.
-- The notch status panel should keep its visual language aligned with the `/prototype` route: compact active-agent badge when collapsed, roster plus command row when expanded.
+- The notch status panel should keep its visual language aligned with the `/prototype` route without exposing agent names or implementation roles: a slim arrow-only resting mark beside the physical notch, a minimal one-line task label when collapsed and active, and a compact current-task panel plus command row when expanded.
+- Notch expansion should reveal from the top edge downward so the expanded surface feels attached to the physical notch rather than growing from a lower corner.
- The expanded notch header may show an update button when `PointerPromptUpdateState` is actionable; clicking it should invoke Sparkle's standard update UI outside the SwiftUI view.
- The controller should derive notch geometry from the active `NSScreen`, prefer safe-area and auxiliary-top areas over hardcoded notch sizes, and keep visible status content below the top safe-area inset.
-- Launch positioning, notch positioning, Command-K activation, and double-Command activation handling belong in `PointerPromptOverlayController`, not the SwiftUI view.
-- Command-K is the primary typed prompt activation shortcut. Double-Command remains available as a voice-friendly activation shortcut through `PointerPromptActivationShortcut.doubleCommand`.
+- Launch positioning, notch positioning, and double-Command activation handling belong in `PointerPromptOverlayController`, not the SwiftUI view.
+- Double-Command is the prompt activation shortcut through `PointerPromptActivationShortcut.doubleCommand`.
- Double-Command prompt activation should require two clean Command down/up taps within 450ms. Any intervening key press, mouse press, extra modifier, or overlong Command hold should reset the sequence so normal shortcuts do not summon the modal.
- Holding the second clean Command press for the shortcut's configured hold duration should activate the prompt modal and start microphone level capture instead of waiting for the second release.
- Keep the overlay non-invasive: no screen capture loop, input execution, Accessibility prompt, or direct model call in SwiftUI rendering. Submit text to a command handler boundary instead.
+- Escape dismissal belongs to the input panel/controller path so the prompt closes even when focus is inside the text input or another active panel child.
- Keep the command handler data-driven. It should resolve task knowledge from the local catalog, including local task definitions in Application Support, before invoking the guarded runtime path.
- Keep voice capture separate from transcription. The overlay publishes bounded local audio buffers to the model layer, and model execution plus command parsing remain outside the SwiftUI view/controller rendering path.
@@ -63,7 +67,7 @@ swift build
swift run Donkey
```
-Launch Donkey and confirm the inactive overlay renders as a black notch extension at the top center, with status content below the physical notch area on notched displays. Hover the notch and confirm it expands into the agent roster with a bottom command row, then collapses after the pointer leaves. With Sparkle configured to a local appcast that contains a newer signed update, confirm the expanded header shows an update button and clicking it opens Sparkle's update UI. Press Command-K and confirm the black prompt capsule opens centered on the screen with keyboard focus, grant microphone permission if prompted, then speak or tap near the microphone and confirm the waveform responds to real audio levels. Type enough text to wrap and confirm the prompt changes from a pill into a rounded rectangle and remains centered as it grows. Press Shift-Return and confirm it inserts a newline; press Return and confirm it submits, dismisses the prompt, and shows working/result status in the notch panel. Move the mouse and confirm the active modal stays centered. Double-tap Command and release to confirm it also opens the centered prompt. Double-tap Command again but hold the second Command press, and confirm the same prompt modal appears with voice capture. Click outside the active modal and confirm it dismisses. Reactivate, click the high-contrast rounded x button outside the capsule, and confirm it closes and remains visible over light and dark app backgrounds. Drag the modal from non-input capsule areas. Confirm Command plus another key other than K, Command-click, and a single Command tap do not activate the modal.
+Launch Donkey and confirm the inactive overlay renders as a black notch extension at the top center, with status content below the physical notch area on notched displays. Confirm the debug outlines trace the rendered notch surface and physical notch void. Hover the notch and confirm it expands downward into the current-task panel with a bottom command row, then collapses after the pointer leaves. With Sparkle configured to a local appcast that contains a newer signed update, confirm the expanded header shows an update button and clicking it opens Sparkle's update UI. Double-tap Command and release to confirm the black prompt capsule opens centered on the screen with keyboard focus and no visible close button, grant microphone permission if prompted, then speak or tap near the microphone and confirm the waveform responds to real audio levels. Type enough text to wrap and confirm the prompt changes from a pill into a rounded rectangle and remains centered as it grows. Press Shift-Return and confirm it inserts a newline; press Return and confirm it submits, dismisses the prompt, and shows working/result status in the notch panel. Move the mouse and confirm the active modal stays centered. Double-tap Command again but hold the second Command press, and confirm the same prompt modal appears with voice capture. Press Escape and confirm the active modal dismisses. Click outside the active modal and confirm it dismisses. Reactivate and drag the modal from non-input capsule areas. Confirm Command plus another key, Command-click, and a single Command tap do not activate the modal.
## Source Entry Points
diff --git a/docs/guides/swift-mvc.md b/docs/guides/swift-mvc.md
index 7073730c..4bad7ed6 100644
--- a/docs/guides/swift-mvc.md
+++ b/docs/guides/swift-mvc.md
@@ -15,7 +15,7 @@ Donkey Swift code should keep product state, UI rendering, and AppKit orchestrat
- Keep SwiftUI views value-like: pass state in, pass typed intent sinks out, and avoid timers, global mouse reads, model providers, or window management inside views.
- Keep models on `@MainActor` when they publish UI state. Models may depend on narrow provider protocols, but not on AppKit windows or timers.
-- Keep controllers on `@MainActor` when they touch AppKit. Controllers may read screen and event geometry, monitor Command-K and double-Command activation, own `NSPanel`, and translate geometry into model state.
+- Keep controllers on `@MainActor` when they touch AppKit. Controllers may read screen and event geometry, monitor double-Command activation, own `NSPanel`, and translate geometry into model state.
- Keep app entry files small. They should define `@main`, delegate adaptation, and little else.
- Prefer target-level separation for reusable contracts and UI: `DonkeyContracts`, `DonkeyUI`, `DonkeyRuntime`, and `DonkeyAI`.
- Keep shared UI state types in `DonkeyContracts`, not in `DonkeyUI`, when models and views both need them.
@@ -28,7 +28,7 @@ The pointer overlay follows this split:
- model state covers prompt text, typed input, placement, theme, and typed intents
- views render the notch status and composer from model state
-- the controller owns AppKit-only work such as the notch and prompt panels, Command-K and double-Command activation, screen positioning, and movement timing
+- the controller owns AppKit-only work such as the notch and prompt panels, double-Command activation, screen positioning, and movement timing
- app entry bootstraps the feature and avoids owning product behavior
## Review Checklist
diff --git a/scripts/local-runtime-runners/donkey_runtime_runner.py b/scripts/local-runtime-runners/donkey_runtime_runner.py
index dfea8bbc..df28c4da 100644
--- a/scripts/local-runtime-runners/donkey_runtime_runner.py
+++ b/scripts/local-runtime-runners/donkey_runtime_runner.py
@@ -474,11 +474,17 @@ def run_local_llm(request: dict[str, Any]) -> dict[str, Any]:
"prompt": prompt,
"stream": False,
"format": schema,
- "options": {"num_predict": 512},
+ "options": {
+ "num_ctx": 2048,
+ "num_predict": 128,
+ "temperature": 0,
+ "top_p": 0.8,
+ },
+ "keep_alive": "10m",
}
started = time.monotonic()
try:
- response = post_json("/api/generate", json.dumps(body).encode("utf-8"), timeout=60)
+ response = post_json("/api/generate", json.dumps(body).encode("utf-8"), timeout=4)
latency_ms = (time.monotonic() - started) * 1000
return {
"outputText": response.get("response", ""),
@@ -504,17 +510,21 @@ def task_intent_prompt(command: str, task_definitions: list[dict[str, Any]]) ->
entity_parts = []
for rule in definition.get("entityRules", []):
aliases = ",".join(sorted((rule.get("aliases") or {}).keys()))
- markers = ",".join(rule.get("markers") or [])
entity_parts.append(
- f"{rule.get('name')} required={rule.get('required', True)} markers={markers} aliases={aliases}"
+ f"{rule.get('name')} required={rule.get('required', True)} aliases={aliases}"
)
+ workflow = " -> ".join(
+ step.get("summary", "")
+ for step in definition.get("workflowSteps", [])
+ if step.get("role") != "parseIntent" and step.get("summary")
+ )
task_lines.append(
" | ".join(
[
f"task_type={definition.get('taskType')}",
f"app={target.get('appName')}",
f"bundle={target.get('bundleIdentifier', 'unknown')}",
- f"triggers={','.join(definition.get('triggerTerms') or [])}",
+ f"capability={workflow}",
f"entities={'; '.join(entity_parts)}",
]
)
@@ -522,11 +532,14 @@ def task_intent_prompt(command: str, task_definitions: list[dict[str, Any]]) ->
return "\n".join(
[
- "Return exactly one local app task intent as strict JSON.",
+ "Classify the user's natural-language request into exactly one supported local app task intent, then return strict JSON.",
+ "Choose by capability and target app, not by exact wording. The user should not need to remember command phrases.",
+ "Do not include reasoning.",
"Use only the provided task definitions. Do not invent apps, task types, entities, or actions.",
+ "If no capability fits, return the closest supported task with confidence below 0.55.",
"If a required entity is missing, set needsConfirmation=true and include missingEntity in metadata.",
f"Command: {command}",
- "Task definitions:",
+ "Supported task capabilities:",
"\n".join(task_lines),
]
)
diff --git a/scripts/run-donkey-dev.sh b/scripts/run-donkey-dev.sh
new file mode 100755
index 00000000..32819ece
--- /dev/null
+++ b/scripts/run-donkey-dev.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+APP_DIR="$ROOT_DIR/apps/Donkey"
+
+echo "Stopping any running Donkey app..."
+killall Donkey >/dev/null 2>&1 || true
+
+cd "$APP_DIR"
+
+echo "Building Donkey..."
+swift build
+
+echo "Starting Donkey..."
+exec swift run Donkey
diff --git a/site/src/app/_components/landing/data.ts b/site/src/app/_components/landing/data.ts
index 1d86bf52..8bf0dec1 100644
--- a/site/src/app/_components/landing/data.ts
+++ b/site/src/app/_components/landing/data.ts
@@ -77,7 +77,7 @@ export const workflowSteps = [
color: "coral",
title: "Tell Donkey",
timing: "Seconds",
- body: "Hit Command-K in the notch. Type or speak the task. Donkey picks the right agent and asks any clarifying questions up front.",
+ body: "Double-tap Command. Type or speak the task. Donkey picks the right agent and asks any clarifying questions up front.",
},
{
n: 2,
diff --git a/site/src/app/prototype/_components/App.tsx b/site/src/app/prototype/_components/App.tsx
index e38aee27..479fe176 100644
--- a/site/src/app/prototype/_components/App.tsx
+++ b/site/src/app/prototype/_components/App.tsx
@@ -3,27 +3,27 @@
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
import { Plus } from 'lucide-react';
-import { SPAWN_COLORS } from '@/app/prototype/_components/agents';
import { DemoControls } from '@/app/prototype/_components/DemoControls';
import { MacDesktop } from '@/app/prototype/_components/MacDesktop';
-import type { AgentId, DesktopSize, NotchState, Spawn, SpawnPhase } from '@/app/prototype/_components/types';
+import { TASK_COLORS } from '@/app/prototype/_components/tasks';
+import type { DesktopSize, NotchState, Spawn, SpawnPhase, TaskId } from '@/app/prototype/_components/types';
let spawnCounter = 0;
export default function App() {
const [state, setState] = useState<NotchState>('running-single');
- const [activeAgentId, setActiveAgentId] = useState<AgentId>('coder');
+ const [activeTaskId, setActiveTaskId] = useState<TaskId>('compare');
const [hovering, setHovering] = useState(false);
const [spawns, setSpawns] = useState<Spawn[]>([]);
const [spawnInputOpen, setSpawnInputOpen] = useState(false);
const desktopRef = useRef<HTMLDivElement | null>(null);
const [desktopSize, setDesktopSize] = useState<DesktopSize>({ w: 1000, h: 625 });
- const runningIds = useMemo<AgentId[]>(() => {
+ const runningTaskIds = useMemo<TaskId[]>(() => {
if (state === 'idle') return [];
- if (state === 'running-multi') return ['coder', 'browser', 'scheduler'];
+ if (state === 'running-multi') return ['compare', 'research', 'schedule'];
- return [activeAgentId];
- }, [state, activeAgentId]);
+ return [activeTaskId];
+ }, [state, activeTaskId]);
useLayoutEffect(() => {
if (!desktopRef.current) return;
@@ -41,7 +41,7 @@ export default function App() {
const handleSpawn = (taskText: string) => {
const id = `spawn-${++spawnCounter}-${Date.now()}`;
- const color = SPAWN_COLORS[spawnCounter % SPAWN_COLORS.length];
+ const color = TASK_COLORS[spawnCounter % TASK_COLORS.length];
const label = taskText.slice(0, 40);
const padding = 60;
const target = {
@@ -67,8 +67,8 @@ export default function App() {
<div className="mb-8">
<MacDesktop
state={state}
- activeAgentId={activeAgentId}
- runningIds={runningIds}
+ activeTaskId={activeTaskId}
+ runningTaskIds={runningTaskIds}
hovering={hovering}
setHovering={setHovering}
spawns={spawns}
@@ -85,8 +85,8 @@ export default function App() {
className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-[#e5e3dc] bg-white hover:bg-gray-50 text-gray-700 transition"
>
<Plus size={12} />
- <span className="text-[11px] font-medium">New agent</span>
- <span className="text-[9px] text-gray-400 font-mono ml-1">↵ to spawn</span>
+ <span className="text-[11px] font-medium">New task</span>
+ <span className="text-[9px] text-gray-400 font-mono ml-1">↵ to start</span>
</button>
{spawns.length > 0 && (
<button
@@ -94,7 +94,7 @@ export default function App() {
onClick={() => setSpawns([])}
className="text-[11px] text-gray-500 hover:text-gray-800 underline underline-offset-2"
>
- clear {spawns.length} spawned
+ clear {spawns.length} tasks
</button>
)}
<span className="text-gray-400">·</span>
@@ -105,22 +105,22 @@ export default function App() {
<DemoControls
state={state}
setState={setState}
- activeAgentId={activeAgentId}
- setActiveAgentId={setActiveAgentId}
+ activeTaskId={activeTaskId}
+ setActiveTaskId={setActiveTaskId}
/>
<div className="mt-10 pt-6 border-t border-gray-200 grid grid-cols-1 md:grid-cols-3 gap-6 text-[13px] text-gray-600">
<div>
<div className="font-medium text-gray-900 mb-1">Resting</div>
- <p className="leading-relaxed">Small pill, agent color + live activity bars. Does not compete with your work.</p>
+ <p className="leading-relaxed">Small pill, task color + live activity bars. Does not compete with your work.</p>
</div>
<div>
<div className="font-medium text-gray-900 mb-1">Attention</div>
- <p className="leading-relaxed">Bulges with the agent color. Check badge = done. Pulsing pink halo = needs you.</p>
+ <p className="leading-relaxed">Bulges with the task color. Check badge = done. Pulsing pink halo = needs you.</p>
</div>
<div>
<div className="font-medium text-gray-900 mb-1">Expanded</div>
- <p className="leading-relaxed">Full roster, statuses, ⌘K to dispatch. Background dims so focus stays on Donkey.</p>
+ <p className="leading-relaxed">Current work, statuses, and a task prompt. Background dims so focus stays on the task.</p>
</div>
</div>
</div>
diff --git a/site/src/app/prototype/_components/DemoControls.tsx b/site/src/app/prototype/_components/DemoControls.tsx
index b0940108..d5caab52 100644
--- a/site/src/app/prototype/_components/DemoControls.tsx
+++ b/site/src/app/prototype/_components/DemoControls.tsx
@@ -1,14 +1,15 @@
import { Check } from 'lucide-react';
-import { AGENTS, ALL_AGENT_IDS } from '@/app/prototype/_components/agents';
import { ControlButton } from '@/app/prototype/_components/ControlButton';
-import type { AgentId, NotchState } from '@/app/prototype/_components/types';
+import { TaskArrow } from '@/app/prototype/_components/TaskArrow';
+import { ALL_TASK_IDS, TASKS } from '@/app/prototype/_components/tasks';
+import type { NotchState, TaskId } from '@/app/prototype/_components/types';
type Props = {
state: NotchState;
setState: (state: NotchState) => void;
- activeAgentId: AgentId;
- setActiveAgentId: (id: AgentId) => void;
+ activeTaskId: TaskId;
+ setActiveTaskId: (id: TaskId) => void;
};
type StateOption = {
@@ -18,13 +19,13 @@ type StateOption = {
accent?: string;
};
-export function DemoControls({ state, setState, activeAgentId, setActiveAgentId }: Props) {
+export function DemoControls({ state, setState, activeTaskId, setActiveTaskId }: Props) {
const stateOptions: StateOption[] = [
{ id: 'idle', label: 'Idle', desc: 'Nothing running' },
- { id: 'running-single', label: 'Running (single)', desc: 'One agent active', accent: AGENTS[activeAgentId].color },
- { id: 'running-multi', label: 'Running (multi)', desc: '3 agents in parallel' },
- { id: 'complete', label: 'Task complete', desc: 'Bulge + check', accent: AGENTS[activeAgentId].color },
- { id: 'needs-input', label: 'Needs your input', desc: 'Pulsing · persistent', accent: AGENTS[activeAgentId].color },
+ { id: 'running-single', label: 'Running', desc: 'One task active', accent: TASKS[activeTaskId].color },
+ { id: 'running-multi', label: 'Busy', desc: '3 tasks in motion' },
+ { id: 'complete', label: 'Task complete', desc: 'Bulge + check', accent: TASKS[activeTaskId].color },
+ { id: 'needs-input', label: 'Needs your input', desc: 'Pulsing · persistent', accent: TASKS[activeTaskId].color },
{ id: 'expanded-pinned', label: 'Expanded (pinned)', desc: 'Force-open the panel' },
];
@@ -51,35 +52,34 @@ export function DemoControls({ state, setState, activeAgentId, setActiveAgentId
<div className="bg-white rounded-xl border p-5" style={{ borderColor: '#e5e3dc' }}>
<div className="flex items-center justify-between mb-4">
<div>
- <h2 className="font-medium text-[15px]">Active agent</h2>
+ <h2 className="font-medium text-[15px]">Sample task</h2>
<p className="text-xs text-gray-500 mt-0.5">Drives the color & message</p>
</div>
- <div className="font-mono text-[10px] text-gray-400 uppercase tracking-wider">{activeAgentId}</div>
+ <div className="font-mono text-[10px] text-gray-400 uppercase tracking-wider">{activeTaskId}</div>
</div>
<div className="grid grid-cols-1 gap-1.5">
- {ALL_AGENT_IDS.map((id) => {
- const a = AGENTS[id];
- const IconC = a.Icon;
- const isSelected = activeAgentId === id;
+ {ALL_TASK_IDS.map((id) => {
+ const task = TASKS[id];
+ const isSelected = activeTaskId === id;
return (
<button
type="button"
key={id}
- onClick={() => setActiveAgentId(id)}
+ onClick={() => setActiveTaskId(id)}
className="px-2.5 py-2 rounded-lg flex items-center gap-2.5 transition-all border"
style={{
background: isSelected ? '#fafaf6' : '#fff',
- borderColor: isSelected ? a.color : '#e5e3dc',
+ borderColor: isSelected ? task.color : '#e5e3dc',
}}
>
- <div className="w-6 h-6 rounded-md flex items-center justify-center flex-shrink-0" style={{ background: a.color }}>
- <IconC size={12} color="#fff" />
+ <div className="w-6 h-6 flex items-center justify-center flex-shrink-0">
+ <TaskArrow color={task.color} size={18} />
</div>
<div className="flex-1 text-left min-w-0">
- <div className="text-[12px] font-medium">{a.name}</div>
- <div className="text-[10px] text-gray-500 truncate">{a.subtitle}</div>
+ <div className="text-[12px] font-medium">{task.label}</div>
+ <div className="text-[10px] text-gray-500 truncate">{task.detail}</div>
</div>
- {isSelected && <Check size={14} color={a.color} />}
+ {isSelected && <Check size={14} color={task.color} />}
</button>
);
})}
diff --git a/site/src/app/prototype/_components/MacDesktop.tsx b/site/src/app/prototype/_components/MacDesktop.tsx
index ece2f6ac..bd3ce3ba 100644
--- a/site/src/app/prototype/_components/MacDesktop.tsx
+++ b/site/src/app/prototype/_components/MacDesktop.tsx
@@ -1,15 +1,16 @@
import { Apple, Wifi, BatteryFull } from 'lucide-react';
-import { AGENTS, ALL_AGENT_IDS } from '@/app/prototype/_components/agents';
import { Notch } from '@/app/prototype/_components/Notch';
import { SpawnedCursor } from '@/app/prototype/_components/SpawnedCursor';
import { SpawnInputOverlay } from '@/app/prototype/_components/SpawnInputOverlay';
-import type { AgentId, DesktopRef, DesktopSize, NotchState, SetHovering, Spawn } from '@/app/prototype/_components/types';
+import { TaskArrow } from '@/app/prototype/_components/TaskArrow';
+import { ALL_TASK_IDS, TASKS } from '@/app/prototype/_components/tasks';
+import type { DesktopRef, DesktopSize, NotchState, SetHovering, Spawn, TaskId } from '@/app/prototype/_components/types';
type Props = {
state: NotchState;
- activeAgentId: AgentId;
- runningIds: AgentId[];
+ activeTaskId: TaskId;
+ runningTaskIds: TaskId[];
hovering: boolean;
setHovering: SetHovering;
spawns: Spawn[];
@@ -22,8 +23,8 @@ type Props = {
export function MacDesktop({
state,
- activeAgentId,
- runningIds,
+ activeTaskId,
+ runningTaskIds,
hovering,
setHovering,
spawns,
@@ -67,7 +68,7 @@ export function MacDesktop({
{isExpanded && <div className="absolute inset-0 bg-black/40 z-10 transition-opacity duration-300" />}
- <Notch state={state} activeAgentId={activeAgentId} hovering={hovering} setHovering={setHovering} runningIds={runningIds} />
+ <Notch state={state} activeTaskId={activeTaskId} hovering={hovering} setHovering={setHovering} runningTaskIds={runningTaskIds} />
{spawns.map((s) => (
<SpawnedCursor key={s.id} spawn={s} notchAnchor={notchAnchor} />
@@ -84,14 +85,13 @@ export function MacDesktop({
opacity: isExpanded ? 0.5 : 1,
}}
>
- {ALL_AGENT_IDS.map((id) => {
- const a = AGENTS[id];
- const IconC = a.Icon;
- const isRunning = runningIds.includes(id);
+ {ALL_TASK_IDS.map((id) => {
+ const task = TASKS[id];
+ const isRunning = runningTaskIds.includes(id);
return (
<div key={id} className="relative">
- <div className="w-8 h-8 rounded-lg flex items-center justify-center" style={{ background: a.color }}>
- <IconC size={16} color="#fff" />
+ <div className="w-8 h-8 flex items-center justify-center">
+ <TaskArrow color={task.color} size={22} />
</div>
{isRunning && <div className="absolute -bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-white" />}
</div>
diff --git a/site/src/app/prototype/_components/Notch.tsx b/site/src/app/prototype/_components/Notch.tsx
index e1cbf8b8..f6f2053a 100644
--- a/site/src/app/prototype/_components/Notch.tsx
+++ b/site/src/app/prototype/_components/Notch.tsx
@@ -1,37 +1,45 @@
-import { Smile, Moon, Plus, Sparkles, Check, Play } from 'lucide-react';
+import { Plus, Sparkles, Check } from 'lucide-react';
import type { CSSProperties } from 'react';
import { ActivityBars } from '@/app/prototype/_components/ActivityBars';
-import { AGENTS, ALL_AGENT_IDS } from '@/app/prototype/_components/agents';
-import type { AgentId, NotchState, SetHovering } from '@/app/prototype/_components/types';
+import { TaskArrow } from '@/app/prototype/_components/TaskArrow';
+import { ALL_TASK_IDS, TASKS } from '@/app/prototype/_components/tasks';
+import type { NotchState, SetHovering, TaskId } from '@/app/prototype/_components/types';
type Props = {
state: NotchState;
- activeAgentId: AgentId;
+ activeTaskId: TaskId;
hovering: boolean;
setHovering: SetHovering;
- runningIds: AgentId[];
+ runningTaskIds: TaskId[];
};
type RingStyle = CSSProperties & {
'--ring'?: string;
};
-export function Notch({ state, activeAgentId, hovering, setHovering, runningIds }: Props) {
- const activeAgent = AGENTS[activeAgentId];
+export function Notch({ state, activeTaskId, hovering, setHovering, runningTaskIds }: Props) {
+ const activeTask = TASKS[activeTaskId];
const isExpanded = hovering || state === 'expanded-pinned';
+ const expandedWidth = 440;
+ const expandedHeight = 286;
+ const prototypeNotchWidth = 180;
+ const restingArrowAllowance = 34;
+ const restingSurfaceWidth = prototypeNotchWidth + restingArrowAllowance * 2;
+ const restingSurfaceLeft = (expandedWidth - prototypeNotchWidth) / 2 - restingArrowAllowance;
const isComplete = state === 'complete';
const isAttention = state === 'needs-input';
const isMulti = state === 'running-multi';
const isHero = isComplete || isAttention;
+ const isResting = state === 'idle';
- let widthStyle: CSSProperties;
- if (isExpanded) widthStyle = { width: '440px' };
- else if (isHero) widthStyle = { width: '360px' };
- else if (isMulti) widthStyle = { width: '220px' };
- else if (state === 'running-single') widthStyle = { width: 'fit-content', minWidth: '200px', maxWidth: '460px' };
- else widthStyle = { width: '200px' };
+ let collapsedWidthStyle: CSSProperties;
+ if (isResting) collapsedWidthStyle = { width: `${restingSurfaceWidth}px` };
+ else if (isHero) collapsedWidthStyle = { width: '360px' };
+ else if (isMulti) collapsedWidthStyle = { width: '220px' };
+ else if (state === 'running-single') collapsedWidthStyle = { width: 'fit-content', minWidth: '200px', maxWidth: '420px' };
+ else collapsedWidthStyle = { width: '200px' };
const ringColor = isComplete
? 'rgba(29,158,117,0.55)'
@@ -39,12 +47,15 @@ export function Notch({ state, activeAgentId, hovering, setHovering, runningIds
? 'rgba(212,83,126,0.65)'
: 'transparent';
- const ActiveIcon = activeAgent.Icon;
- const notchBodyStyle: RingStyle = {
- width: '100%',
- borderRadius: isExpanded ? '0 0 22px 22px' : isHero ? '0 0 22px 22px' : '0 0 14px 14px',
+ const collapsedBodyStyle: RingStyle = {
+ ...collapsedWidthStyle,
+ margin: isResting ? `0 0 0 ${restingSurfaceLeft}px` : '0 auto',
+ borderRadius: isResting ? '0 0 9px 9px' : isHero ? '0 0 22px 22px' : '0 0 14px 14px',
boxShadow: !isExpanded && ringColor !== 'transparent' ? `0 0 0 1.5px ${ringColor}` : 'none',
- transition: 'border-radius 0.4s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.3s ease',
+ outline: '1px dashed rgba(255,36,148,0.95)',
+ outlineOffset: '2px',
+ opacity: isExpanded ? 0 : 1,
+ transition: 'opacity 0.12s ease, border-radius 0.24s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.3s ease',
'--ring': ringColor,
};
@@ -52,8 +63,8 @@ export function Notch({ state, activeAgentId, hovering, setHovering, runningIds
<div
className="absolute top-0 left-1/2 -translate-x-1/2 z-20"
style={{
- ...widthStyle,
- transition: 'width 0.4s cubic-bezier(0.32, 0.72, 0, 1), min-width 0.4s cubic-bezier(0.32, 0.72, 0, 1), max-width 0.4s cubic-bezier(0.32, 0.72, 0, 1)',
+ width: `${expandedWidth}px`,
+ height: isExpanded ? `${expandedHeight}px` : undefined,
}}
onMouseEnter={() => setHovering(true)}
onMouseLeave={() => setHovering(false)}
@@ -71,35 +82,39 @@ export function Notch({ state, activeAgentId, hovering, setHovering, runningIds
.fadein-up { animation: fadeinUp 0.3s cubic-bezier(0.32, 0.72, 0, 1) both; }
`}</style>
<div
- className={`bg-black mx-auto text-white overflow-hidden ${isAttention && !isExpanded ? 'pulse-attention' : ''}`}
- style={notchBodyStyle}
+ className={`relative bg-black text-white overflow-hidden ${isAttention && !isExpanded ? 'pulse-attention' : ''}`}
+ style={collapsedBodyStyle}
>
- {!isExpanded && (state === 'idle' || state === 'running-single') && (
+ {!isExpanded && state === 'idle' && (
+ <div className="flex h-[18px] items-center pl-2.5">
+ <TaskArrow color={activeTask.color} size={13} />
+ </div>
+ )}
+
+ {!isExpanded && state === 'running-single' && (
<div className="flex items-center justify-center gap-2 pl-3.5 pr-4 py-1.5">
<div
className="w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0"
- style={{ background: state === 'idle' ? '#444' : activeAgent.color }}
+ style={{ background: 'transparent' }}
>
- {state === 'idle' ? <Moon size={8} color="#fff" /> : <ActiveIcon size={8} color="#fff" />}
+ <TaskArrow color={activeTask.color} size={12} />
</div>
- <span className="text-[10px] font-medium tracking-tight whitespace-nowrap text-white/95">
- {state === 'idle'
- ? 'Donkey · resting'
- : `${activeAgent.name} · ${activeAgent.subtitle.toLowerCase()}`}
+ <span className="text-[10px] tracking-tight whitespace-nowrap text-white/95">
+ {`Donkey · ${activeTask.label.toLowerCase()}`}
</span>
- {state === 'running-single' && <ActivityBars color={activeAgent.color} />}
+ <ActivityBars color={activeTask.color} />
</div>
)}
{!isExpanded && isMulti && (
<div className="flex items-center justify-center gap-2 px-3 py-1.5">
<div className="flex items-center">
- {runningIds.slice(0, 4).map((id, i) => (
+ {runningTaskIds.slice(0, 4).map((id, i) => (
<div
key={id}
className="w-3 h-3 rounded-full"
style={{
- background: AGENTS[id].color,
+ background: TASKS[id].color,
border: '1.5px solid #000',
marginLeft: i === 0 ? 0 : '-4px',
zIndex: 10 - i,
@@ -107,8 +122,8 @@ export function Notch({ state, activeAgentId, hovering, setHovering, runningIds
/>
))}
</div>
- <span className="text-[10px] font-medium text-white/95 whitespace-nowrap">
- {runningIds.length} agents working
+ <span className="text-[10px] text-white/95 whitespace-nowrap">
+ Donkey gets things done
</span>
<ActivityBars color="rgba(255,255,255,0.85)" />
</div>
@@ -117,24 +132,24 @@ export function Notch({ state, activeAgentId, hovering, setHovering, runningIds
{!isExpanded && isComplete && (
<div className="flex items-center gap-2.5 px-4 pt-1.5 pb-2.5 fadein-up">
<div className="relative flex-shrink-0">
- <div className="w-7 h-7 rounded-md flex items-center justify-center" style={{ background: activeAgent.color }}>
- <ActiveIcon size={14} color="#fff" />
+ <div className="w-7 h-7 rounded-md flex items-center justify-center">
+ <TaskArrow color={activeTask.color} size={20} />
</div>
<div className="absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full bg-white flex items-center justify-center">
- <Check size={8} color={activeAgent.color} strokeWidth={3} />
+ <Check size={8} color={activeTask.color} strokeWidth={3} />
</div>
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-1.5">
- <span className="text-[11px] font-medium">{activeAgent.name} finished</span>
+ <span className="text-[11px]">Donkey finished</span>
<span className="text-[9px] text-white/50">· 1m 42s</span>
</div>
- <div className="text-[10px] text-white/65 truncate">{activeAgent.subtitle}</div>
+ <div className="text-[10px] text-white/65 truncate">{activeTask.label}</div>
</div>
<button
type="button"
- className="text-[10px] font-medium px-2 py-1 rounded"
- style={{ background: `${activeAgent.color}66`, color: '#fff' }}
+ className="text-[10px] px-2 py-1 rounded"
+ style={{ background: `${activeTask.color}66`, color: '#fff' }}
>
View
</button>
@@ -144,99 +159,112 @@ export function Notch({ state, activeAgentId, hovering, setHovering, runningIds
{!isExpanded && isAttention && (
<div className="flex items-center gap-2.5 px-4 pt-1.5 pb-2.5 fadein-up">
<div className="relative flex-shrink-0">
- <div className="w-7 h-7 rounded-md flex items-center justify-center" style={{ background: activeAgent.color }}>
- <ActiveIcon size={14} color="#fff" />
+ <div className="w-7 h-7 rounded-md flex items-center justify-center">
+ <TaskArrow color={activeTask.color} size={20} />
</div>
<div className="absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full bg-white flex items-center justify-center">
- <span style={{ fontSize: '9px', color: activeAgent.color, fontWeight: 700, lineHeight: 1 }}>!</span>
+ <span style={{ fontSize: '9px', color: activeTask.color, lineHeight: 1 }}>!</span>
</div>
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-1.5">
- <span className="text-[11px] font-medium">{activeAgent.name} needs you</span>
+ <span className="text-[11px]">Donkey needs you</span>
<span className="text-[9px] text-white/50">· paused</span>
</div>
<div className="text-[10px] text-white/65 truncate">Pick a source for the search</div>
</div>
<button
type="button"
- className="text-[10px] font-medium px-2 py-1 rounded"
- style={{ background: `${activeAgent.color}80`, color: '#fff' }}
+ className="text-[10px] px-2 py-1 rounded"
+ style={{ background: `${activeTask.color}80`, color: '#fff' }}
>
Answer
</button>
</div>
)}
+ </div>
- {isExpanded && (
- <div className="fadein-up">
- <div className="px-3.5 pt-2 pb-2 flex items-center gap-2 border-b border-white/10">
- <div className="w-3.5 h-3.5 rounded-full flex items-center justify-center" style={{ background: '#1D9E75' }}>
- <Smile size={8} color="#fff" />
- </div>
- <span className="text-[11px] font-medium">Donkey</span>
- <span className="text-[10px] text-white/45 ml-1">{runningIds.length} of 5 running</span>
- <div className="ml-auto flex items-center gap-1 text-[10px] text-white/45 hover:text-white/80 cursor-pointer">
- <Plus size={11} />
- <span>new task</span>
- </div>
+ <div
+ className="absolute left-0 top-0 w-full overflow-hidden"
+ style={{
+ height: `${expandedHeight}px`,
+ pointerEvents: isExpanded ? 'auto' : 'none',
+ }}
+ >
+ <div
+ className="bg-black text-white overflow-hidden"
+ style={{
+ width: '100%',
+ height: '100%',
+ borderRadius: '0 0 22px 22px',
+ outline: '1px dashed rgba(255,36,148,0.95)',
+ outlineOffset: '-1px',
+ transform: isExpanded ? 'translateY(0)' : 'translateY(-100%)',
+ transition: 'transform 0.34s cubic-bezier(0.32, 0.72, 0, 1)',
+ }}
+ >
+ <div className="px-3.5 pt-2 pb-2 flex items-center gap-2 border-b border-white/10">
+ <TaskArrow color={activeTask.color} size={14} />
+ <span className="text-[11px]">Donkey</span>
+ <span className="text-[10px] text-white/45 ml-1">gets things done</span>
+ <div className="ml-auto flex items-center gap-1 text-[10px] text-white/45 hover:text-white/80 cursor-pointer">
+ <Plus size={11} />
+ <span>new task</span>
</div>
+ </div>
- <div className="p-2 flex flex-col gap-1">
- {ALL_AGENT_IDS.map((id) => {
- const a = AGENTS[id];
- const IconC = a.Icon;
- const isRunning = runningIds.includes(id);
- const isActiveStateAgent = activeAgentId === id && (state === 'complete' || state === 'needs-input');
- let statusLabel = isRunning ? 'running' : 'idle';
- let statusColor = isRunning ? a.color : 'rgba(255,255,255,0.4)';
- if (isActiveStateAgent && state === 'complete') statusLabel = 'done';
- if (isActiveStateAgent && state === 'needs-input') {
- statusLabel = 'needs you';
- statusColor = a.color;
- }
-
- return (
- <div
- key={id}
- className="flex items-center gap-2.5 px-2 py-1.5 rounded-md hover:bg-white/5 cursor-pointer"
- style={isRunning ? { background: `${a.color}1A`, borderLeft: `2px solid ${a.color}` } : {}}
- >
- <div className="w-5 h-5 rounded flex items-center justify-center flex-shrink-0" style={{ background: a.color }}>
- <IconC size={11} color="#fff" />
- </div>
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-1.5">
- <span className="text-[10px] font-medium">{a.name}</span>
- <span
- className="text-[9px] px-1 py-px rounded"
- style={{
- background: `${statusColor}30`,
- color: statusColor === 'rgba(255,255,255,0.4)' ? 'rgba(255,255,255,0.5)' : statusColor,
- }}
- >
- {statusLabel}
- </span>
- </div>
- <div className="text-[9px] text-white/50 truncate">{isRunning ? a.subtitle : 'No active task'}</div>
+ <div className="p-2 flex flex-col gap-1">
+ {ALL_TASK_IDS.map((id) => {
+ const task = TASKS[id];
+ const isRunning = runningTaskIds.includes(id);
+ const isActiveStateTask = activeTaskId === id && (state === 'complete' || state === 'needs-input');
+ let statusLabel = isRunning ? 'running' : 'idle';
+ let statusColor = isRunning ? task.color : 'rgba(255,255,255,0.4)';
+ if (isActiveStateTask && state === 'complete') statusLabel = 'done';
+ if (isActiveStateTask && state === 'needs-input') {
+ statusLabel = 'needs you';
+ statusColor = task.color;
+ }
+
+ return (
+ <div
+ key={id}
+ className="flex items-center gap-2.5 px-2 py-1.5 rounded-md hover:bg-white/5 cursor-pointer"
+ style={isRunning ? { background: `${task.color}1A`, borderLeft: `2px solid ${task.color}` } : {}}
+ >
+ <div className="w-5 h-5 flex items-center justify-center flex-shrink-0">
+ <TaskArrow color={task.color} size={16} />
+ </div>
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-1.5">
+ <span className="text-[10px]">{task.label}</span>
+ <span
+ className="text-[9px] px-1 py-px rounded"
+ style={{
+ background: `${statusColor}30`,
+ color: statusColor === 'rgba(255,255,255,0.4)' ? 'rgba(255,255,255,0.5)' : statusColor,
+ }}
+ >
+ {statusLabel}
+ </span>
</div>
- {isRunning ? (
- <ActivityBars color={a.color} />
- ) : (
- <Play size={11} color="rgba(255,255,255,0.4)" fill="rgba(255,255,255,0.4)" />
- )}
+ <div className="text-[9px] text-white/50 truncate">{isRunning ? task.detail : 'Ready when needed'}</div>
</div>
- );
- })}
- </div>
+ {isRunning ? (
+ <ActivityBars color={task.color} />
+ ) : (
+ <span className="h-1.5 w-1.5 rounded-full bg-white/30" />
+ )}
+ </div>
+ );
+ })}
+ </div>
- <div className="mx-2 mb-2 px-2.5 py-2 bg-white/[0.06] rounded-md flex items-center gap-2">
- <Sparkles size={11} color="rgba(255,255,255,0.5)" />
- <span className="text-[10px] text-white/40 flex-1">Tell donkey what to do…</span>
- <span className="text-[9px] text-white/30 px-1.5 py-px border border-white/15 rounded font-mono">⌘ K</span>
- </div>
+ <div className="mx-2 mb-2 px-2.5 py-2 bg-white/[0.06] rounded-md flex items-center gap-2">
+ <Sparkles size={11} color="rgba(255,255,255,0.5)" />
+ <span className="text-[10px] text-white/40 flex-1">Tell Donkey what to do…</span>
</div>
- )}
+ </div>
</div>
</div>
);
diff --git a/site/src/app/prototype/_components/SpawnInputOverlay.tsx b/site/src/app/prototype/_components/SpawnInputOverlay.tsx
index fff5a1d2..dccca2b9 100644
--- a/site/src/app/prototype/_components/SpawnInputOverlay.tsx
+++ b/site/src/app/prototype/_components/SpawnInputOverlay.tsx
@@ -1,6 +1,6 @@
-import { useEffect, useRef, useState } from 'react';
+import { useCallback, useEffect, useRef, useState } from 'react';
import { Sparkles } from 'lucide-react';
-import type { KeyboardEvent } from 'react';
+import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
type Props = {
onSubmit: (taskText: string) => void;
@@ -15,14 +15,25 @@ export function SpawnInputOverlay({ onSubmit, onClose }: Props) {
setTimeout(() => inputRef.current?.focus(), 50);
}, []);
- const handleKey = (e: KeyboardEvent<HTMLInputElement>) => {
+ useEffect(() => {
+ const handleWindowKey = (event: KeyboardEvent) => {
+ if (event.key !== 'Escape') return;
+
+ onClose();
+ };
+
+ window.addEventListener('keydown', handleWindowKey);
+ return () => window.removeEventListener('keydown', handleWindowKey);
+ }, [onClose]);
+
+ const handleKey = useCallback((e: ReactKeyboardEvent<HTMLInputElement>) => {
if (e.key === 'Enter' && text.trim()) {
onSubmit(text.trim());
setText('');
} else if (e.key === 'Escape') {
onClose();
}
- };
+ }, [onClose, onSubmit, text]);
return (
<div
@@ -42,16 +53,9 @@ export function SpawnInputOverlay({ onSubmit, onClose }: Props) {
value={text}
onChange={(e) => setText(e.target.value)}
onKeyDown={handleKey}
- placeholder="Spawn an agent to…"
+ placeholder="Ask Donkey to…"
className="bg-transparent border-0 outline-none flex-1 text-[12px] text-white placeholder-white/40"
/>
- <button
- type="button"
- onClick={onClose}
- className="text-[9px] text-white/40 hover:text-white/80 px-1.5 py-px border border-white/15 rounded font-mono"
- >
- esc
- </button>
<button
type="button"
onClick={() => text.trim() && (onSubmit(text.trim()), setText(''))}
diff --git a/site/src/app/prototype/_components/TaskArrow.tsx b/site/src/app/prototype/_components/TaskArrow.tsx
new file mode 100644
index 00000000..9bdcab2a
--- /dev/null
+++ b/site/src/app/prototype/_components/TaskArrow.tsx
@@ -0,0 +1,12 @@
+type Props = {
+ color: string;
+ size?: number;
+};
+
+export function TaskArrow({ color, size = 14 }: Props) {
+ return (
+ <svg width={size} height={size} viewBox="0 0 14 14" aria-hidden="true" className="flex-shrink-0">
+ <path d="M3.1 1.1 12 7l-8.9 5.9L5.2 7 3.1 1.1Z" fill={color} />
+ </svg>
+ );
+}
diff --git a/site/src/app/prototype/_components/agents.ts b/site/src/app/prototype/_components/agents.ts
deleted file mode 100644
index 1b9ee3f0..00000000
--- a/site/src/app/prototype/_components/agents.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Code, Globe, Search, Mail, Calendar } from 'lucide-react';
-
-import type { Agent, AgentId } from '@/app/prototype/_components/types';
-
-export const AGENTS: Record<AgentId, Agent> = {
- coder: { id: 'coder', name: 'Coder', color: '#1D9E75', Icon: Code, subtitle: 'Ranking models on SWE-bench' },
- browser: { id: 'browser', name: 'Browser', color: '#EF9F27', Icon: Globe, subtitle: 'Pulling pricing from 3 sites' },
- researcher: { id: 'researcher', name: 'Researcher', color: '#D4537E', Icon: Search, subtitle: 'Reading 12 ArXiv papers' },
- inbox: { id: 'inbox', name: 'Inbox', color: '#378ADD', Icon: Mail, subtitle: 'Drafting reply to recruiter' },
- scheduler: { id: 'scheduler', name: 'Scheduler', color: '#7F77DD', Icon: Calendar, subtitle: 'Finding slots across KST/PT' },
-};
-
-export const ALL_AGENT_IDS = ['coder', 'browser', 'researcher', 'inbox', 'scheduler'] satisfies AgentId[];
-
-export const SPAWN_COLORS = ['#1D9E75', '#EF9F27', '#D4537E', '#378ADD', '#7F77DD', '#E15A47', '#3DB0B5', '#A856C9'];
diff --git a/site/src/app/prototype/_components/tasks.ts b/site/src/app/prototype/_components/tasks.ts
new file mode 100644
index 00000000..400a01e2
--- /dev/null
+++ b/site/src/app/prototype/_components/tasks.ts
@@ -0,0 +1,13 @@
+import type { TaskId, TaskSample } from '@/app/prototype/_components/types';
+
+export const TASKS: Record<TaskId, TaskSample> = {
+ compare: { id: 'compare', label: 'Compare options', color: '#1D9E75', detail: 'Ranking the best choices' },
+ research: { id: 'research', label: 'Gather research', color: '#EF9F27', detail: 'Reading sources' },
+ reply: { id: 'reply', label: 'Draft a reply', color: '#D4537E', detail: 'Writing the message' },
+ schedule: { id: 'schedule', label: 'Plan a time', color: '#378ADD', detail: 'Finding open slots' },
+ update: { id: 'update', label: 'Update a file', color: '#7F77DD', detail: 'Making edits' },
+};
+
+export const ALL_TASK_IDS = ['compare', 'research', 'reply', 'schedule', 'update'] satisfies TaskId[];
+
+export const TASK_COLORS = ['#1D9E75', '#EF9F27', '#D4537E', '#378ADD', '#7F77DD', '#E15A47', '#3DB0B5', '#A856C9'];
diff --git a/site/src/app/prototype/_components/types.ts b/site/src/app/prototype/_components/types.ts
index 474622cf..06513937 100644
--- a/site/src/app/prototype/_components/types.ts
+++ b/site/src/app/prototype/_components/types.ts
@@ -1,7 +1,6 @@
import type { Dispatch, RefObject, SetStateAction } from 'react';
-import type { LucideIcon } from 'lucide-react';
-export type AgentId = 'coder' | 'browser' | 'researcher' | 'inbox' | 'scheduler';
+export type TaskId = 'compare' | 'research' | 'reply' | 'schedule' | 'update';
export type NotchState =
| 'idle'
@@ -11,12 +10,11 @@ export type NotchState =
| 'needs-input'
| 'expanded-pinned';
-export type Agent = {
- id: AgentId;
- name: string;
+export type TaskSample = {
+ id: TaskId;
+ label: string;
color: string;
- Icon: LucideIcon;
- subtitle: string;
+ detail: string;
};
export type Point = {