Skip to content
Pace
Esc
↑↓navigate↵open⌘Jpreview
On this page

Pace runtime traces

Follow Pace 0.3.21 through turn ownership, screen routing, typed actions, Power validation, Codex session recovery, and meeting capture.

Pace runtime traces

These traces use the 0.3.21 release source. Run the prompts in the capability guide, then follow each system from the event it accepts to the state it can change.

For the process arguments, HTTP bodies, credentials, and streaming events, open how Pace calls Codex and APIs.

Typed and spoken turn ownership

The chat composer calls submitChatTranscriptFromChatSession. Pace accepts a typed conversation event before constructing a PaceQueuedChatTurn, which carries that event ID, the speech mute flag, permission-prompt policy, and any screen suggestion or catalog selection. Busy typed requests wait in a FIFO. The recorded user event retains its thread root even if the user switches threads before the request runs.

The voice path starts in GlobalPushToTalkShortcutMonitor. The listen-only Core Graphics event tap recognizes Right Option key code 61. It waits 180 ms before publishing a press so a modifier chord or other input can cancel the pending hold. That threshold is part of the shortcut policy. The notch’s listening state reflects actual capture startup, which can happen later. PacePushToTalkManager owns the microphone and local transcription session. Both paths converge at sendTranscriptToPlannerWithScreenshot.

Composer → event → FIFO ─────┐
CGEvent → audio → local STT ─┤
                             ▼
                    Accepted turn lease
                             │
                   Command or planner
                             │
                     Proposed result
                             │
                 Recheck lease ownership
                       ┌─────┴─────┐
                   Current        Stale
                   publish        discard

Routing can suspend before a response task exists. cancelActiveTurnTasks invalidates the lease generation and cancels both tasks. At guarded seams, isActiveTurn checks task cancellation, the lease, and active managed-Power authorization. The lease distinguishes a late answer to turn A from a valid answer to turn B, even if the old provider returns after cancellation.

Read turn dispatch, composer and FIFO wiring, and lease tests. For capture details, see the audio pipeline.

Screen evidence, planning, and actions

Read My Screen gates use of screen context. A screen turn can combine a ScreenCaptureKit frame, Vision OCR text and boxes, and Accessibility elements. PaceScreenAnalysisCacheIdentity compares the analyzer, enabled analysis capabilities, pixel dimensions, point dimensions, and display frame. PaceCachedScreenAnalysis also records the SHA-256 digest of the JPEG bytes. The analysis cache can reuse the element map only within the matching analysis and display context. A text-only CLI path can use OCR without running a local VLM. Opting into an external planner lets that provider receive the prompt and permitted context. Planner calls have per-turn audit metadata in PaceAPIAuditLog.

The v10 structured action path uses payload.calls as an array of objects with name and args. PaceActionTagParser checks the shape and maps supported calls to PaceParsedAction. Approval and execution use the typed plan. UI mutations run in source order because focus, modifiers, and the pointer are shared. An executor observation can stop the plan before the next action. The repeated coordinate-click check matches the point, display identifier and frame, and screenshot digest. On the first repeated click against the same evidence, it asks the planner to inspect again before sending another input event.

For a known sequence, the planner can send both steps in one response.

{
  "spokenText": "",
  "intent": "action",
  "payload": {
    "calls": [
      {
        "name": "App.launch",
        "args": { "app": "Safari" }
      },
      {
        "name": "Key.press",
        "args": { "key": "cmd+t" }
      }
    ]
  }
}

For a dependent sequence, inspect the state after the first action before choosing the second target. A changed screenshot can trigger fresh inspection. Confirmation still depends on the action’s observation.

Read the screen cache fixtures, action parser, and executor and receipt. See the computer-use runtime for observation and postconditions.

Power selection and execution

An explicit run request first gets a chance to resolve an exact saved name or an exact catalog alias. A qualifying spoken miss can rank nearby enabled names using local string and phonetic similarity. The result is a PacePendingSpokenPowerClarification. Confirmation consumes that pending choice, resolves its identifier from the live store, and checks that the entry remains enabled and matches the offered entry. The store revalidates the current saved definition. A stale or modified Power can therefore fail after the user clicks its confirmation button.

There are two useful execution paths to compare.

Representation What the host validates
Version 1 typed Pace Program Branches and literal repeats are checked before running, including branches that will be inactive. The program is bounded to depth 4, 50 source nodes, 10 iterations per repeat, and at most 50 expanded action steps. It compiles against one context snapshot.
Version 2 JavaScript Power Exactly one JavaScript body runs in an isolated XPC worker. The wire contract caps source at 24 KiB, output at 64 KiB, and returned actions at 50. The worker has a 2-second execution budget. The host accepts speak and present_media only, validates argument schemas and media references, then compiles the full action plan.

Read spoken confirmation tests, the XPC wire types, and worker and host tests. The latter exercise the watchdog, cancellation, and rejection of a plan whose last media step is invalid.

Teaching document and playback ownership

PaceDiagramDocument carries stable node IDs, a figure or flowchart, and optional lesson steps. The parser checks references before presentation. The overlay controller keeps selection across valid document updates and clears a selection if its node disappears. Selecting a part pauses the lesson. Dismissal advances dismissalGeneration, clears the document, and stops lesson speech. A late result carrying the former generation cannot reopen the figure.

Follow document validation, overlay state, and the late-result test.

Retained Codex sessions

PaceCodingSessionCoordinator reserves a canonical workspace path and owns an app-server transport slot for it. A session snapshot keeps the Pace session ID, workspace, Codex thread ID, and lifecycle state. Starting uses thread/start. Resuming reads and resumes the owned thread with thread/read and thread/resume, then sends a new explicit task in turn/start. The coordinator checks that the slot’s generation still matches after suspended calls. A stale process event cannot update a replacement slot in the same workspace.

Start and resume require approval scoped to the requested operation and workspace. The coordinator rechecks that scope before acting. The Codex session uses workspace-write policy with network access disabled in the workspace sandbox. Codex remains an external provider. A process crash requires explicit resume and a new task.

Read the coordinator, the JSON-RPC transport, and session race and approval tests.

Meeting capture, local inference, and recovery

PaceMeetingModeController owns the capture lifecycle. It starts a 16 kHz mono ScreenCaptureKit system-audio stream that excludes the current process, alongside a separate microphone track. Starting and stopping change the lifecycle generation so a suspended start or stale stream callback cannot regain ownership. A typed stop during permission-prompt startup can interrupt the start immediately, bypassing the normal busy-turn queue.

Each track feeds a single off-main-actor AsyncStream writer. It creates a .part file on the first sample, writes PCM16 after a 44-byte RIFF/WAV header, and drains queued samples before finalization. The recorder patches lengths and renames surviving tracks. Crash repair can reconstruct those lengths from saved bytes on relaunch. A repaired track remains on disk and the next capture requires a fresh start.

The segmenter aligns tracks to the earliest actual sample, identifies mic and system speech spans, and lets local transcription work on those slices. Note synthesis uses a local planner even if the general chat planner is external. Quoted highlights can surface when structured notes are unavailable.

Read capture and stop, the recorder, and FIFO and crash-repair fixtures.

Completed-turn counter on main

The opt-in counter landed on main after 0.3.21. It increments for a screen-description reply that used screen evidence, has text, and had no actions, or for a single action with a confirming execution observation. It deduplicates by PaceTurnLease in memory and persists only aggregate counts keyed by UTC day in UserDefaults. The Privacy view aggregates today and six prior UTC dates. The counter retains 30 days and clears the totals when disabled.

Read PaceCompletedTurnCounter and the counter tests. Signed build qualification is tracked in #259.

Reproduce the code-level checks

From the repository root on a supported Mac, the filtered runner uses isolated DerivedData.

bash scripts/test-pace.sh PaceTurnLeaseTests PaceScreenContextServiceTests \
  PaceSpokenPowerRecoveryTests PaceJavaScriptPowerTests PaceDiagramTests \
  PaceCodingSessionTests PaceMeetingAudioRecorderTests PaceMeetingModeControllerTests

These suites cover state, parsing, permissions policy, and selected runtime boundaries. The signed preview’s physical microphone and hotkey behavior still has an open hardware verification issue.

Was this page helpful?