graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Arm empty Enter-Enter to interrupt a live turn
justrach87d04894c495
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1405eb5f..4981821b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,7 @@ current is part of cutting a release.## Unreleased+- Empty Enter-Enter while a turn is running interrupts (or steers the next queued prompt). It no longer required a queue to arm.- The folder picker can sort by name or modification time, filter Git repositories, and create folders.- Available `rlm` tools are listed from the first turn rather than waiting for a batch or context threshold (ADR 0140).- Desktop fonts are bundled locally; syntax highlighting, diagrams, and secondary panes load when needed.diff --git a/apps/native/components/site/GraffHarness.tsx b/apps/native/components/site/GraffHarness.tsxindex 98cb519f..c2f69c10 100644--- a/apps/native/components/site/GraffHarness.tsx+++ b/apps/native/components/site/GraffHarness.tsx@@ -42,7 +42,7 @@ import {import { type AcpCommand } from "@/lib/acp";import { useChatScroll } from "./useChatScroll";import { enqueuePrompt } from "@/lib/prompt-queue";-import { usePromptQueue } from "./usePromptQueue";+import { usePromptQueue, steerOrInterrupt } from "./usePromptQueue";import { removeSession, type StoredSession } from "@/lib/sessions";import { loadHistory, mergeHistory } from "@/lib/prompt-history";import {@@ -456,10 +456,10 @@ export default function GraffHarness() {root: cwdOf(thread), modelKey: thread.model ?? model ?? undefined,onModelChange: key => changeModel(key, thread.id), onSend: text => void send(text, thread.id),onSetting: text => settings.change(thread.id, text),- onSteerQueued: queues[thread.id]?.length ? () => {- const next = queuesRef.current[thread.id]?.[0];- if (runningRef.current.has(thread.id) && next) steerQueued(thread.id, next.id);- } : undefined,+ onSteerQueued: () => steerOrInterrupt(queuesRef.current[thread.id]?.[0], runningRef.current.has(thread.id), id => steerQueued(thread.id, id), () => {+ const live = sessionsRef.current.get(thread.id);+ if (live) void cancel(handleOf(thread.id), live).catch(() => undefined);+ }),history: mergeHistory(history, thread.messages.flatMap(m => m.role === "user" && m.origin !== "notification" ? [m.text] : [])),busy: busyIds.has(thread.id), onStop: () => {const live = sessionsRef.current.get(thread.id);diff --git a/apps/native/components/site/usePromptQueue.ts b/apps/native/components/site/usePromptQueue.tsindex 0a86cc3b..bd7e56d0 100644--- a/apps/native/components/site/usePromptQueue.ts+++ b/apps/native/components/site/usePromptQueue.ts@@ -2,7 +2,8 @@import { useRef, useState } from "react";import { dropQueuedPrompt, editQueuedPrompt, setQueuedPromptEditing, shiftQueuedPrompt, type QueuedPrompt } from "@/lib/prompt-queue";-import { createQueueSteerer, type SteerStatus } from "@/lib/prompt-queue-steer";+import { createQueueSteerer, steerOrInterrupt, type SteerStatus } from "@/lib/prompt-queue-steer";+export { steerOrInterrupt };export function usePromptQueue() {const queuesRef = useRef<Record<number, QueuedPrompt[]>>({});diff --git a/apps/native/lib/prompt-queue-steer.test.ts b/apps/native/lib/prompt-queue-steer.test.tsindex 355a6914..b3b018e9 100644--- a/apps/native/lib/prompt-queue-steer.test.ts+++ b/apps/native/lib/prompt-queue-steer.test.ts@@ -1,6 +1,6 @@import { describe, it } from "node:test";import assert from "node:assert/strict";-import { createQueueSteerer, type SteerStatus } from "./prompt-queue-steer.ts";+import { createQueueSteerer, steerOrInterrupt, type SteerStatus } from "./prompt-queue-steer.ts";import { enqueuePrompt, dropQueuedPrompt, prioritizeQueuedPrompt, setQueuedPromptEditing, shiftQueuedPrompt } from "./prompt-queue.ts";function fixture(timeoutMs = 1000) {@@ -117,3 +117,13 @@ it("steering cannot bypass an open queue editor", () => {assert.equal(cancelled, 1);f.steerer.finish(1);});++it("empty Enter-Enter interrupts when nothing is queued, else steers the next item", () => {+ const steered: number[] = [];+ let interrupted = 0;+ steerOrInterrupt(undefined, true, id => steered.push(id), () => { interrupted++; });+ steerOrInterrupt({ id: 9 }, true, id => steered.push(id), () => { interrupted++; });+ steerOrInterrupt({ id: 9 }, false, id => steered.push(id), () => { interrupted++; });+ assert.equal(interrupted, 1);+ assert.deepEqual(steered, [9]);+});diff --git a/apps/native/lib/prompt-queue-steer.ts b/apps/native/lib/prompt-queue-steer.tsindex f8b4556c..aaa9becf 100644--- a/apps/native/lib/prompt-queue-steer.ts+++ b/apps/native/lib/prompt-queue-steer.ts@@ -1,5 +1,12 @@import { prioritizeQueuedPrompt, type QueuedPrompt } from "./prompt-queue.ts";+/** Empty Enter-Enter while a turn runs: bump the next queued prompt, or interrupt. */+export function steerOrInterrupt(next: { id: number } | undefined, running: boolean, steer: (id: number) => void, interrupt: () => void) {+ if (!running) return;+ if (next) steer(next.id);+ else interrupt();+}+export type SteerStatus = { pending?: number; error?: string };type Turn = { ready: boolean; selected?: number; cancel?: () => Promise<void>; sent: boolean; attempt: number; timer?: ReturnType<typeof setTimeout> };