Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to PurePoint are documented here. Format follows [Keep a Cha
- `scripts/install.ps1` installs the Windows CLI from PowerShell (`irm https://raw.githubusercontent.com/2witstudios/PurePoint/main/scripts/install.ps1 | iex`). Like `install.sh`, it verifies the release's minisign signature or its GitHub attestation before installing, and stops if neither can be checked unless `PU_INSTALL_SKIP_VERIFY=1` is set.
- `pu daemon status --json` prints the daemon's health and autostart state as JSON.
- Projects can be reordered, and every device shows the same order. Each machine's daemon saves the order of its projects. On the Mac, drag a project within its section or use Move Up / Move Down in its menu; on the iPad, use Move Up / Move Down; on the phone, long-press a machine and choose Reorder Projects…. Changes reach every device following that machine right away. `pu projects` lists projects in the same order. New projects are added at the end.
- The phone's agent screen has **⌫** (hold to keep deleting) and **clear** keys that edit the agent's own input box, so text already typed into an agent, from the phone or the Mac, can be fixed or cleared from the phone. They work with older Mac and Linux hosts.
- Paste an image (Cmd+V) into any agent's terminal, or drop files on a remote agent's terminal, and the macOS app uploads it to the agent's machine and types its path there, so remote agents can see screenshots. Uploads are kept in `~/.pu/attachments` on that machine for 7 days.
- Send photos and files to an agent from the iPhone and iPad. On the iPhone, the **+** menu beside an agent's prompt offers Photos and Files; each upload's path is added to your draft so you can write around it before sending. On the iPad, each agent pane has a paperclip button (Photos, Files), and you can paste an image or drag files in from other apps; the path is typed at the agent's prompt without pressing Enter. Photos are sent as JPEG, at most 2048 px on the long edge. The phone bridge relays uploads with a new `agent.attach` operation, which needs Full access; phone uploads are limited to 20 MB per file.

Expand Down Expand Up @@ -41,6 +42,7 @@ All notable changes to PurePoint are documented here. Format follows [Keep a Cha
- **Breaking: Codex YOLO for all projects is removed** (Settings → Agents, `codexYolo` in `~/.pu/agent-settings.yaml`, `codex_yolo` in `update_global_agent_settings`). If you had it on, Codex now launches with its normal sandbox and approvals. To get the same behaviour, put the flags YOLO added, `--dangerously-bypass-approvals-and-sandbox --no-daemon`, in Codex's launch args for all projects or for one project. An existing `codexYolo` key is ignored and dropped the next time the file is saved, the daemon ignores `codex_yolo` from older clients, and `global_agent_settings_report` still sends `codex_yolo: false` so older apps can read it.

### Fixed
- A prompt the agent had already received could be sent again and again. When Enter emptied a Claude agent's input box but its echo wasn't spotted on screen, the daemon reported "text was not delivered", and the phone offered the text for another send. The daemon now returns `DELIVERY_UNCONFIRMED` with an accurate message, and the phone shows it as sent. Retried typing no longer stacks leftover text under the retyped prompt, a failed delivery leaves the input box empty, and sending the same text again after a failed send asks for confirmation, including after the app is relaunched or another prompt is sent or blocked in between. If the input box can't be read at all after Enter, or it was emptied while other input (someone typing, the phone's clear key) reached the agent during delivery, the daemon returns `DELIVERY_UNKNOWN` and the phone shows the send as failed with delivery unknown, never as sent. An older daemon's "input box cleared but the submitted turn was not echoed" error is shown the same way, because older daemons also returned it when the box couldn't be read.
- `pu clean --all --json` now prints one JSON array of results, as it already did when there was nothing to clean, instead of one JSON document per worktree.
- On Windows, `pu daemon stop` waits for `pu-engine` to exit, so a `pu daemon start` right after it no longer fails with "daemon did not start within 3 seconds".
- On iPad, a new Point Guard conversation always shows the court: wide when the pane is wider than tall, portrait otherwise, never the plain list of plays. Raising the keyboard no longer shrinks the court into the list (it slides up over the bottom of the court, as on the phone). As on the phone, drag a ball off the logo and release it on a play to run that play. The logo leans and turns to follow the ball.
Expand Down
34 changes: 33 additions & 1 deletion apps/purepoint-mobile/PurePoint/AgentControlDomain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct ControlledAgent: Codable, Identifiable, Sendable {
switch phase {
case "dialog": return "Agent is waiting on a prompt. Use the keys below."
case "has_draft":
return "Someone is already typing in this agent. Finish or clear that draft on its terminal before sending."
return "The agent's input box already has text. Clear it with ⌫ or clear, or press ⏎ to send it."
case "busy": return "Agent is busy. Wait until it is ready before sending a prompt."
default:
if state == "broken" { return "This agent has stopped." }
Expand Down Expand Up @@ -135,6 +135,18 @@ struct AgentComposer: Sendable {
private(set) var outcome: AgentPromptOutcome?
private(set) var reason: String?
private(set) var deliveryUncertain = false
/// Text from the latest failed send. A failure can still have reached the agent
/// (a lost receipt, an unseen echo), so resending it needs a deliberate choice.
/// Only a later failure replaces it: neither a blocked send nor a successful send
/// of other text shows whether this one arrived.
private(set) var failedText: String?
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
/// Sending this draft again could submit the same turn twice.
var resendNeedsConfirmation: Bool { failedText != nil && failedText == text }
Comment thread
2witstudios marked this conversation as resolved.
Resolved
/// As `resendNeedsConfirmation`, but also honoring saved recovery records, which
/// outlive this in-memory composer (relaunch rebuilds it from the draft text alone).
func needsConfirmationToSend(given recoveries: [AgentPromptRecovery]) -> Bool {
resendNeedsConfirmation || recoveries.contains { $0.mayHaveReachedAgent && $0.text == text }
}

mutating func begin() -> AgentSubmission? {
guard pending == nil, !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, text.utf8.count <= 65536
Expand All @@ -146,6 +158,8 @@ struct AgentComposer: Sendable {
mutating func finish(_ submission: AgentSubmission, outcome: AgentPromptOutcome, reason: String?, uncertain: Bool = false) {
guard pending?.id == submission.id else { return }
pending = nil; self.outcome = outcome; self.reason = reason; deliveryUncertain = uncertain
// Blocked is decided before anything is typed, so only failures are ambiguous.
if outcome == .failed { failedText = submission.text }
if (outcome == .confirmed || outcome == .sent) && text == submission.text { text = "" }
}
}
Expand Down Expand Up @@ -180,6 +194,20 @@ enum AgentQuickKey: String, CaseIterable, Identifiable, Sendable {
}
}

/// Line editing for text already in an agent's input box. Sent as literal
/// control characters through `terminal.raw`, which every bridge accepts.
enum AgentEditKey: String, CaseIterable, Identifiable, Sendable {
case backspace = "Backspace", clearLine = "Clear line"
var id: String { rawValue }
var bytes: [UInt8] {
switch self {
case .backspace: return [127]
case .clearLine: return [21] // Ctrl-U: delete to the start of the line
}
}
var text: String { String(decoding: bytes, as: UTF8.self) }
}

struct AgentTerminalOpen: Decodable, Sendable {
let streamId: String
let machine: String
Expand Down Expand Up @@ -286,6 +314,10 @@ struct AgentPromptRecovery: Codable, Identifiable, Equatable, Sendable {
let text: String
var status: String
var reason: String?
/// Every unsettled record except a block (decided before anything is typed)
/// may have reached the agent: a failure, a lost receipt, or a send cut off
/// mid-flight that is still marked as awaiting confirmation.
var mayHaveReachedAgent: Bool { status != AgentPromptOutcome.blocked.label }
}

struct AgentNavigationPreferences: Codable, Equatable, Sendable {
Expand Down
7 changes: 7 additions & 0 deletions apps/purepoint-mobile/PurePoint/AgentControlModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ import UserNotifications
var canSend: Bool {
sendExplanation == nil && !composer.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
/// Sending the draft could submit a turn that may already have arrived, including
/// one recorded before a relaunch, so the phone asks before sending it.
var resendNeedsConfirmation: Bool { composer.needsConfirmationToSend(given: recoveries) }
var draft: String {
get { composer.text }
set { composer.text = newValue; saveComposer() }
Expand Down Expand Up @@ -615,6 +618,10 @@ import UserNotifications
func sendKey(_ key: AgentQuickKey, screen token: Int) {
guard token == screen else { return }; input("terminal.keys", fields: ["key": key.rawValue])
}
/// Edits the agent's own input box, so drafts typed earlier (on any device) can be fixed.
func sendEditKey(_ key: AgentEditKey, screen token: Int) {
guard token == screen else { return }; input("terminal.raw", fields: ["data": key.text])
}
// Called only while the terminal synthesizes a deliberate mouse-wheel event.
func sendScroll(_ data: ArraySlice<UInt8>, screen token: Int) {
guard token == screen, controlEnabled, !data.isEmpty else { return }
Expand Down
81 changes: 67 additions & 14 deletions apps/purepoint-mobile/PurePoint/AgentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ struct AgentControlView: View {
private struct AgentControlBar: View {
@ObservedObject var model: AgentControlModel
@State private var showRecoveries = false
@State private var confirmResend = false
@State private var showPhotos = false
@State private var showFiles = false
@State private var photoItems: [PhotosPickerItem] = []
Expand Down Expand Up @@ -1071,14 +1072,23 @@ private struct AgentControlBar: View {
.background(Theme.surface, in: RoundedRectangle(cornerRadius: 20, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.white.opacity(0.07)))
.accessibilityLabel("Agent prompt. Return inserts a new line.")
Button { model.sendPrompt(screen: token) } label: {
Button {
// A failed send may still have reached the agent; never repeat it on one tap.
if model.resendNeedsConfirmation { confirmResend = true } else { model.sendPrompt(screen: token) }
} label: {
Image(systemName: "arrow.up").font(.body.weight(.semibold))
.foregroundStyle(model.canSend ? Theme.ground : Color(hex: 0x85858D))
.frame(width: 38, height: 38)
.background(model.canSend ? Theme.accent : Color(hex: 0x303034), in: Circle())
.frame(width: 44, height: 44).contentShape(Rectangle())
}.disabled(!model.canSend).accessibilityLabel("Send prompt")
}
.confirmationDialog("Send this prompt again?", isPresented: $confirmResend, titleVisibility: .visible) {
Button("Send again") { model.sendPrompt(screen: token) }
Button("Cancel", role: .cancel) {}
} message: {
Text("The last send of this text may have reached the agent anyway. Check its terminal first so the same turn isn't submitted twice.")
}
}
private func rawRow(_ token: Int) -> some View {
HStack(spacing: 6) {
Expand All @@ -1104,23 +1114,37 @@ private struct AgentQuickKeys: View {
private static let order: [AgentQuickKey] = [.enter, .up, .down, .yes, .no, .escape, .interrupt, .tab, .left, .right]
var body: some View {
let token = model.screenToken
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 5) {
ForEach(Self.order) { key in
Button {
model.sendKey(key, screen: token)
} label: {
Text(Self.face(key)).font(.system(.footnote, design: .monospaced).weight(.medium))
.foregroundStyle(Theme.ink)
.frame(minWidth: 38, minHeight: 34).padding(.horizontal, 2)
.background(Color(hex: 0x26262A), in: RoundedRectangle(cornerRadius: 7, style: .continuous))
// Compact key face, full 44-point hit area.
.frame(minHeight: 44).contentShape(Rectangle())
}.buttonStyle(.plain).accessibilityLabel(key.rawValue)
HStack(spacing: 5) {
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 5) {
ForEach(Self.order) { key in
Button {
model.sendKey(key, screen: token)
} label: {
Self.keyFace(Text(Self.face(key)))
}.buttonStyle(.plain).accessibilityLabel(key.rawValue)
}
}
}
// Editing keys stay pinned outside the scroller so a swipe never starts a delete.
Button { model.sendEditKey(.clearLine, screen: token) } label: { Self.keyFace(Text("clear")) }
.buttonStyle(.plain).accessibilityLabel(AgentEditKey.clearLine.rawValue)
.accessibilityHint("Deletes the agent's current input line.")
RepeatingKey(enabled: model.controlEnabled) { model.sendEditKey(.backspace, screen: token) } label: {
Self.keyFace(Image(systemName: "delete.left"))
}
.accessibilityLabel(AgentEditKey.backspace.rawValue)
.accessibilityHint("Deletes one character in the agent's input. Hold to keep deleting.")
}.disabled(!model.controlEnabled).opacity(model.controlEnabled ? 1 : 0.4)
}
private static func keyFace(_ face: some View) -> some View {
face.font(.system(.footnote, design: .monospaced).weight(.medium))
.foregroundStyle(Theme.ink)
.frame(minWidth: 38, minHeight: 34).padding(.horizontal, 2)
.background(Color(hex: 0x26262A), in: RoundedRectangle(cornerRadius: 7, style: .continuous))
// Compact key face, full 44-point hit area.
.frame(minHeight: 44).contentShape(Rectangle())
}
private static func face(_ key: AgentQuickKey) -> String {
switch key {
case .enter: return "⏎"
Expand All @@ -1132,6 +1156,35 @@ private struct AgentQuickKeys: View {
}
}

/// Fires on touch-down, then repeats while held, like the keyboard's delete key.
private struct RepeatingKey<Label: View>: View {
let enabled: Bool
let action: () -> Void
@ViewBuilder let label: () -> Label
@State private var repeater: Task<Void, Never>?
var body: some View {
label()
.onLongPressGesture(minimumDuration: 3600, maximumDistance: 30, perform: {}, onPressingChanged: { pressing in
repeater?.cancel(); repeater = nil
guard pressing, enabled else { return }
action()
repeater = Task { @MainActor in
try? await Task.sleep(nanoseconds: 450_000_000)
// Bounded so a stuck touch cannot erase an unbounded amount.
for count in 0..<400 {
guard !Task.isCancelled else { return }
action()
try? await Task.sleep(nanoseconds: count < 12 ? 90_000_000 : 40_000_000)
}
}
})
.onDisappear { repeater?.cancel(); repeater = nil }
.accessibilityElement(children: .ignore)
.accessibilityAddTraits(.isButton)
.accessibilityAction { if enabled { action() } }
}
}

private struct AgentPromptRecoveries: View {
@ObservedObject var model: AgentControlModel
let screen: Int
Expand Down
Loading
Loading