🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(console): bind every confirm route to the card the person saw (#3983)
rec1541fb1ba3
diff --git a/plugins/ruflo-console/hooks/actions.ts b/plugins/ruflo-console/hooks/actions.tsindex 9e81cda6e4..403d320f39 100644--- a/plugins/ruflo-console/hooks/actions.ts+++ b/plugins/ruflo-console/hooks/actions.ts@@ -31,6 +31,8 @@ export type ActionSpec = {shows?: string/** Raised on Claude's behalf: set by a deferred ask (one that resolves after its screen) from the origin it had when called, so it is never attributed to the person (ADR-450 T14, #3815). */byModel?: boolean+ /** Which of Claude's console_run / console_set calls started this ask (model-tools.ts hands out the numbers): the call that settles it is that one and no other (#3983). */+ byCall?: number/** The class the entry itself declares (a Dev Tools entry's `cost`): Claude's confirm gate never reads it as less than this. */declared?: 'write' | 'network' | 'install' | 'spend' | 'delete'/** A MetaHarness lab entry's id: the runner keeps what it printed for the lab's result panel. */diff --git a/plugins/ruflo-console/hooks/ask-claude.ts b/plugins/ruflo-console/hooks/ask-claude.tsindex f7666157c2..8bbc83c7ec 100644--- a/plugins/ruflo-console/hooks/ask-claude.ts+++ b/plugins/ruflo-console/hooks/ask-claude.ts@@ -143,6 +143,7 @@ export function askActions(state: State, host: Host, runner: Runner, act: () =>/** Resolves once the ask is queued (after its screen, when a typed question is screened): a model call waits on it so the ask keeps its origin and level (#3815). */const deliver = (mode: 'visible' | 'aside', question: string | undefined, view: ViewId): void | Promise<void> => {const byModel = state.control.viaModel+ const byCall = state.control.callTag ?? undefinedconst typed = plain(question ?? '', MAX_QUESTION).trim()const fit = checkLimit(typed, LONG_TEXT_MAX, 'the question', 'sent to Claude as one prompt')@@ -154,6 +155,7 @@ export function askActions(state: State, host: Host, runner: Runner, act: () =>{label: `ask Claude about ${labelOf(view)}${mode === 'aside' ? ' (/btw aside)' : ''}`,byModel,+ byCall,scope: 'ask',args: [],shows: `${mode === 'aside' ? '/btw ' : ''}“${plain(typed || VIEW_ASK[view].default, 120)}” with this view’s text as data (secrets removed) — ${prompt.length} characters`,diff --git a/plugins/ruflo-console/hooks/bindings.ts b/plugins/ruflo-console/hooks/bindings.tsindex c9a6e71482..61a1e191e1 100644--- a/plugins/ruflo-console/hooks/bindings.ts+++ b/plugins/ruflo-console/hooks/bindings.ts@@ -238,7 +238,15 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Stepsif (best !== undefined) runner.runEntry(best, best.run.kind === 'text' ? state.palette.query.trim().slice(best.run.keyword.length).trim() : '')},- run: (id, text = '') => runner.runById(id, text),+ run: (id, text = '') => {+ const before = state.pending?.id+ const isRun = runner.runById(id, text)++ // The card this field text raised, by id: Enter again on the same text confirms that card and no other.+ state.askedAgain = state.pending !== null && state.pending.id !== before && state.pending.id !== undefined ? { entry: id, text: text.trim(), card: state.pending.id } : null++ return isRun+ },costBudgetDraft: text => {state.costBudgetDraft = text},@@ -308,7 +316,7 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Stepsstate.terminal.draft = ''state.terminal.harness = pick.id// An ask the previous harness left on screen goes with it.- if (state.terminal.asked !== null && state.pending?.label === state.terminal.asked.label) runner.cancel()+ if (state.terminal.asked !== null && state.terminal.asked.card !== null && state.pending?.id === state.terminal.asked.card) runner.cancel()state.terminal.asked = nullhost.invalidate()keepField()@@ -332,10 +340,11 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Steps}// The engine may empty the field on submit, so an empty Enter on a pending ask confirms it too.- if (asked !== null && (asked.key === key || text.trim() === '') && state.pending?.label === asked.label) {+ // Enter again answers the card this field raised, by its id: a card with the same words that took its place is not it.+ if (asked !== null && asked.card !== null && (asked.key === key || text.trim() === '') && state.pending?.id === asked.card) {state.terminal.asked = nullstate.terminal.draft = ''- void runner.confirm()+ void runner.confirm(asked.card)return}@@ -344,8 +353,10 @@ export function actionsOf(state: State, host: Host, runner: Runner, steps: Steps// The text is in the pending ask (an empty Enter or Yes runs it): the field clears, unless it cannot be sent and stays to be fixed.state.terminal.draft = spec !== null ? '' : text+ const before = state.pending?.id+runner.ask(spec, whyNotRun(state, text) ?? 'nothing to run')- state.terminal.asked = spec !== null ? { key, label: spec.label } : null+ state.terminal.asked = spec !== null ? { key, label: spec.label, card: state.pending !== null && state.pending.id !== before ? (state.pending.id ?? null) : null } : null},stop: () => {for (const run of state.terminal.runs.values()) run.stop()diff --git a/plugins/ruflo-console/hooks/commands.ts b/plugins/ruflo-console/hooks/commands.tsindex 29d20d9786..895e843739 100644--- a/plugins/ruflo-console/hooks/commands.ts+++ b/plugins/ruflo-console/hooks/commands.ts@@ -16,7 +16,7 @@ export type Intent =| { kind: 'delegate'; owner: 'ruflo-mods' | 'ruflo-swarm'; words: string }| { kind: 'palette'; query: string }| { kind: 'run'; paletteId: string; text: string }- | { kind: 'confirm'; isYes: boolean }+ | { kind: 'confirm'; isYes: boolean; /** The card id a typed `yes <id>` names. */ card?: number }| { kind: 'agent'; who: string }| { kind: 'back' }| { kind: 'select'; by: number }@@ -66,8 +66,11 @@ export function parseRuflo(args: string): Intent {case 'act':return second === '' ? { kind: 'palette', query: '' } : { kind: 'run', paletteId: second, text: rest.slice(second.length).trim() }case 'yes':- case 'y':- return { kind: 'confirm', isYes: true }+ case 'y': {+ const card = /^#?([0-9]{1,9})$/.exec(second)?.[1]++ return card === undefined ? { kind: 'confirm', isYes: true } : { kind: 'confirm', isYes: true, card: Number(card) }+ }case 'no':case 'n':return { kind: 'confirm', isYes: false }diff --git a/plugins/ruflo-console/hooks/data/skills.ts b/plugins/ruflo-console/hooks/data/skills.tsindex 5d950cf39a..1791e90aac 100644--- a/plugins/ruflo-console/hooks/data/skills.ts+++ b/plugins/ruflo-console/hooks/data/skills.ts@@ -32,7 +32,7 @@ export type SkillsState = {createDraft: string/** The change running now (its label), and the create the last Enter asked about: Enter on it again confirms. */busy: string | null- asked: { key: string; label: string } | null+ asked: { key: string; label: string; card: number | null } | null/** How the last change went, kept for the view after the footer lets it go. */last: Outcome | null/** Where ▸ add and ▸ update all go: the scope, and the agents named to `--agent` (none: the CLI's own pick). */diff --git a/plugins/ruflo-console/hooks/dispatch.ts b/plugins/ruflo-console/hooks/dispatch.tsindex 194cbb8d03..1597a64c1a 100644--- a/plugins/ruflo-console/hooks/dispatch.ts+++ b/plugins/ruflo-console/hooks/dispatch.ts@@ -130,7 +130,10 @@ export async function dispatch(control: Controller, state: State, args: string,if (state.pending !== null) {const pending = state.pending- return { text: [`Asked: ${pending.label}. Confirm with /ruflo yes (or y in the pane), cancel with /ruflo no.`, ...(pending.shows === undefined ? [] : [`runs: ${pending.shows}`, pending.note ?? ''])].filter(Boolean).join('\n') }+ // The answer puts this card in front of the person, so a bare /ruflo yes may answer it (and only it).+ state.shownCard = pending.id ?? null++ return { text: [`Asked: ${pending.label}. Confirm with /ruflo yes (or y in the pane; /ruflo yes ${pending.id ?? '<id>'} names this card), cancel with /ruflo no.`, ...(pending.shows === undefined ? [] : [`runs: ${pending.shows}`, pending.note ?? ''])].filter(Boolean).join('\n') }}return { text: (missionAnswer(state, intent.paletteId) ?? xruvAnswer(state, intent.paletteId, askedAtMs) ?? labAnswer(state, intent.paletteId, askedAtMs) ?? skillsAnswer(state, intent.paletteId, askedAtMs)) ?? (state.outcome !== null && !state.outcome.ok ? `${state.outcome.label}: ${state.outcome.detail}` : (state.outcome?.label ?? 'done')) }@@ -147,7 +150,7 @@ export async function dispatch(control: Controller, state: State, args: string,const confirmedAtMs = Date.now()// A typed yes names no card: the runner refuses it while the card is too new or just replaced one (press the card's own Yes then).- await control.runner.confirmUnbound()+ await control.runner.confirmUnbound(intent.card)return { text: xruvAnswer(state, null, confirmedAtMs) ?? labAnswer(state, null, confirmedAtMs) ?? (state.outcome === null ? 'Ran.' : `${state.outcome.ok ? '✓' : '✗'} ${state.outcome.label}: ${state.outcome.detail}${state.outcome.verified === 'yes' ? ' (on disk)' : state.outcome.verified === 'no' ? ' (not on disk yet)' : ''}`) }case 'agent': {diff --git a/plugins/ruflo-console/hooks/mission-control.ts b/plugins/ruflo-console/hooks/mission-control.tsindex 0417cd0ea4..1a3e6936b7 100644--- a/plugins/ruflo-console/hooks/mission-control.ts+++ b/plugins/ruflo-console/hooks/mission-control.ts@@ -230,7 +230,7 @@ export function missionActions(state: State, host: Host, runner: Runner): Missioconst tasksNow = (): readonly TaskRecord[] => state.snapshot?.tasks ?? []/** Runs a slash command on the goal (or the active mission's objective) in the main UI: now when idle, prepared in the prompt box mid-turn. */- const launch = (slash: string, label: string, custom?: { args: string; note: string; byModel?: boolean }) => {+ const launch = (slash: string, label: string, custom?: { args: string; note: string; byModel?: boolean; byCall?: number }) => {const objective = activeMission(state)?.objective ?? mc.goal// A research start brings its own, already screened arguments; every other launch works on the goal.@@ -244,7 +244,7 @@ export function missionActions(state: State, host: Host, runner: Runner): Missiorunner.ask({label: `run /${slash} on the goal in the main Claude UI`,- ...(custom?.byModel === true && { byModel: true }),+ ...(custom?.byModel === true && { byModel: true, byCall: custom.byCall }),scope: 'controls',args: [],shows: `/${slash} ${args}`,@@ -273,6 +273,7 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio/** Research start: validate, screen the question (always: it reaches the web), refuse when unsafe, then ask with the confirm in words. */const research = () => {const byModel = state.control.viaModel+ const byCall = state.control.callTag ?? undefinedconst draft = { ...researchOf(state) }const question = plain(draft.question, MAX_TEXT).trim()@@ -291,7 +292,7 @@ export function missionActions(state: State, host: Host, runner: Runner): Missioif (now.question !== draft.question || now.depth !== draft.depth || now.cap !== draft.cap) returnif (blocksGuidance(screen)) return say('AIDefence blocked the question', false, `${screen.detail}. Change the question.`)- launch(slashOf(skill), 'deep research', { args: researchArgs(question, draft.depth, cap), note: researchConfirm(draft.depth, cap, screen), byModel })+ launch(slashOf(skill), 'deep research', { args: researchArgs(question, draft.depth, cap), note: researchConfirm(draft.depth, cap, screen), byModel, byCall })})}@@ -411,12 +412,13 @@ export function missionActions(state: State, host: Host, runner: Runner): Missioif (t !== '') mc.lastGuide = tconst byModel = state.control.viaModel+ const byCall = state.control.callTag ?? undefinedconst ask = () =>runner.ask(t === ''? null- : { label: `send Claude: ${plain(t, 70)}`, byModel, scope: 'guide', args: [], shows: `to the Claude Code session, as a visible prompt: “${t}”`, expect: 'the instruction in the transcript', note: 'Starts a Claude Code turn (billed as any turn is).', run: async () => host.submitPrompt(t) },+ : { label: `send Claude: ${plain(t, 70)}`, byModel, byCall, scope: 'guide', args: [], shows: `to the Claude Code session, as a visible prompt: “${t}”`, expect: 'the instruction in the transcript', note: 'Starts a Claude Code turn (billed as any turn is).', run: async () => host.submitPrompt(t) },'type the instruction first',)diff --git a/plugins/ruflo-console/hooks/model-tools.ts b/plugins/ruflo-console/hooks/model-tools.tsindex b36c3514cf..b3d1a2467f 100644--- a/plugins/ruflo-console/hooks/model-tools.ts+++ b/plugins/ruflo-console/hooks/model-tools.ts@@ -153,13 +153,15 @@ function within(work: Promise<void>, ms: number, host: Pick<Controller['host'],}/** Runs `fn` as Claude's own act: asks it raises on the way are Claude's, not the person's. Only the synchronous start counts; a deferred ask carries its origin itself (`ActionSpec.byModel`). */-function asModel<T>(state: State, fn: () => T): T {+function asModel<T>(state: State, fn: () => T, tag: number | null = null): T {state.control.viaModel = true+ state.control.callTag = tagtry {return fn()} finally {state.control.viaModel = false+ state.control.callTag = null}}@@ -266,7 +268,7 @@ function setField(deps: ModelToolDeps, field: string, value: string): string | n* An action the console queued (a palette entry, or the follow-up a field raised) is held to the same rules: above the level it is* cancelled and nothing runs; in ask mode it waits for the person; in auto mode it confirms and reports. Null when nothing is pending.*/-async function settlePending(deps: ModelToolDeps, tool: string, id: string, askedAt: number): Promise<{ status: 'refused' | 'waiting' | 'done'; text: string } | null> {+async function settlePending(deps: ModelToolDeps, tool: string, id: string, askedAt: number, own?: { call: number; card: number | null }): Promise<{ status: 'refused' | 'waiting' | 'done'; text: string } | null> {const { state, control } = depsconst ai = settingsOf(state).aiconst level = levelOf(ai.modelControl)@@ -281,6 +283,11 @@ async function settlePending(deps: ModelToolDeps, tool: string, id: string, askereturn { status: 'refused', text: `an action is waiting for the person ("${modelLine(pending.label, 80)}"), so yours was not queued. Do not run another until they answer. Nothing ran.` }}+ // Only a card this call started is settled here: the one it raised as it started (its id, taken then), or a deferred one that carries this call's+ // number. A card that landed meanwhile from anything else (a screened ask of another call, a write queued earlier) is neither confirmed nor+ // cancelled under this call's settlement (#3983): it waits for its own call, the person, or its window.+ if (own !== undefined && pending.byCall !== own.call && !(pending.byCall === undefined && (pending.id ?? null) === own.card)) return null+const kind = classOf(pending)// Claude's own ask: the row says who asked and what class it is (ADR-450 T14).@@ -420,14 +427,15 @@ async function answer(name: string, input: Record<string, unknown>, deps: ModelTif (state.pending !== null) return refuse(`set ${field}`, `an action is already waiting for the person ("${modelLine(state.pending.label, 80)}"). Do not change fields until they answer${withdrawHint(state)}.`)const askedAt = Date.now()- const problem = asModel(state, () => setField(deps, field, value))+ const call = ++state.control.callSeq+ const problem = asModel(state, () => setField(deps, field, value), call)if (problem !== null) return refuse(`set ${field}`, problem)say(state, name, `set ${field}`, 'ok', value)// Some fields raise a follow-up themselves (a goal is planned, then guidance is offered): it is held to the same rules.- const queued = await settlePending(deps, name, `after set ${field}`, askedAt)+ const queued = await settlePending(deps, name, `after set ${field}`, askedAt, { call, card: state.pending?.id ?? null })return `Set ${field}.${queued === null ? ' It is only filled in: run a console entry to act on it.' : ` The console then queued a follow-up. ${queued.text}`}`}@@ -445,21 +453,25 @@ async function answer(name: string, input: Record<string, unknown>, deps: ModelTconst askedAt = state.outcome?.atMs ?? 0- if (!asModel(state, () => control.runner.runById(id, text, { exact: true, direct: true }))) return refuse(`run ${id}`, `no palette entry "${modelLine(id, 40)}" right now. Call console_state for the entries.`)+ const call = ++state.control.callSeq++ if (!asModel(state, () => control.runner.runById(id, text, { exact: true, direct: true }), call)) return refuse(`run ${id}`, `no palette entry "${modelLine(id, 40)}" right now. Call console_state for the entries.`)++ // The card this call raised, by id, taken before anything is awaited: a read still running below may be followed by a card that landed on its own.+ const raisedCard = state.pending?.id ?? nullawait control.runner.settled()- if (state.pending === null) {- const done = state.outcome !== null && state.outcome.atMs > askedAt ? state.outcome : null+ // Only a card this call started is settled by it (settlePending): the one it raised, or a deferred one carrying its number.+ const settled = state.pending === null ? null : await settlePending(deps, name, `run ${id}`, askedAt, { call, card: raisedCard })- say(state, name, `run ${id}`, done === null || done.ok ? 'ok' : 'error', done?.detail ?? '')+ if (settled !== null) return settled.status === 'refused' ? `Refused: ${settled.text}` : settled.text- return done === null ? `Ran ${id}.` : `${done.ok ? 'Done' : 'Failed'}: ${modelLine(done.label, 100)}. ${modelLine(done.detail, 200)}${(done.lines ?? []).length > 0 ? `\n${(done.lines ?? []).slice(0, 12).map(line => modelLine(line, 160)).join('\n')}` : ''}`- }+ const done = state.outcome !== null && state.outcome.atMs > askedAt ? state.outcome : null- const settled = await settlePending(deps, name, `run ${id}`, askedAt)+ say(state, name, `run ${id}`, done === null || done.ok ? 'ok' : 'error', done?.detail ?? '')- return settled === null ? `Ran ${id}.` : settled.status === 'refused' ? `Refused: ${settled.text}` : settled.text+ return done === null ? `Ran ${id}.` : `${done.ok ? 'Done' : 'Failed'}: ${modelLine(done.label, 100)}. ${modelLine(done.detail, 200)}${(done.lines ?? []).length > 0 ? `\n${(done.lines ?? []).slice(0, 12).map(line => modelLine(line, 160)).join('\n')}` : ''}`} catch (error) {say(state, name, name, 'error', error instanceof Error ? error.message : 'failed')diff --git a/plugins/ruflo-console/hooks/runner.ts b/plugins/ruflo-console/hooks/runner.tsindex 2126b2f12c..a5eb6a09c3 100644--- a/plugins/ruflo-console/hooks/runner.ts+++ b/plugins/ruflo-console/hooks/runner.ts@@ -57,7 +57,7 @@ export type Runner = {/** `exact` (the model path, ADR-450 T13) resolves the id as written and never falls back to fuzzy matching. */runById: (id: string, text: string, options?: { exact?: boolean; direct?: boolean }) => boolean/** A Yes typed with no card id (`/ruflo yes`): refused while the card is too new or just replaced one, else it answers the card waiting now. */- confirmUnbound: () => Promise<void>+ confirmUnbound: (card?: number) => Promise<void>/** Resolves when the read started last has finished: `/ruflo run` waits on it to answer with what it printed. */settled: () => Promise<void>/** Resolves when the last action that brought its own `run` (and is not awaited by `confirm`) has finished: the model tools wait on it, with a limit. */@@ -307,7 +307,9 @@ export function createRunner(state: State, host: Host, deps: RunnerDeps): Runner// Only an ask raised inside Claude's own console_run call (not one that landed later after a screen, nor a mission follow-up) is Claude's to withdraw.const isDirect = isDirectRun && state.control.viaModel && spec.byModel !== true- const pending: Pending = { id: asks, view: state.view, ...(isDirect && { origin: 'console_run' as const }), ...(kind !== null && { rememberKey: kind }), ...(spec.scope !== undefined && { scope: spec.scope }), label: spec.label, args: spec.args, expect: spec.expect, askedAtMs: Date.now(), source: byModel ? 'claude' : 'you', ...(spec.shows !== undefined && { shows: spec.shows }), ...(spec.note !== undefined && { note: spec.note }), ...(spec.declared !== undefined && { declared: spec.declared }) }+ // The Claude call that started this ask: named by the spec when the ask landed later, else the call whose synchronous start is running now.+ const byCall = byModel ? (spec.byCall ?? (state.control.viaModel ? (state.control.callTag ?? undefined) : undefined)) : undefined+ const pending: Pending = { id: asks, view: state.view, ...(isDirect && { origin: 'console_run' as const }), ...(byCall !== undefined && { byCall }), ...(kind !== null && { rememberKey: kind }), ...(spec.scope !== undefined && { scope: spec.scope }), label: spec.label, args: spec.args, expect: spec.expect, askedAtMs: Date.now(), source: byModel ? 'claude' : 'you', ...(spec.shows !== undefined && { shows: spec.shows }), ...(spec.note !== undefined && { note: spec.note }), ...(spec.declared !== undefined && { declared: spec.declared }) }// Claude's ask that was screened first lands after every tool call of Claude's returned, so no call is left to gate it: the level and Stop are// checked now, not as they were when it was raised, and a refused ask is not queued (nothing waits for a Yes the settings no longer allow).@@ -378,19 +380,31 @@ export function createRunner(state: State, host: Host, deps: RunnerDeps): Runnerawait execute(spec)}- async function confirmUnbound(): Promise<void> {+ async function confirmUnbound(card?: number): Promise<void> {const pending = state.pendingconst nowMs = Date.now()- if (pending === null) return confirm()+ if (pending === null) return confirm(card)- // A Yes typed with no card id could be meant for the card that was there a moment ago: a card Claude has only just raised, or one that took the- // place of a card that left unanswered, is answered on the card itself (its button or y), which names the card it answers.+ // `/ruflo yes <id>` names its card: it answers that card or nothing (confirm refuses when another card took its place).+ if (card !== undefined) return confirm(card)++ // A bare Yes names no card, so it answers only the card the person was shown: drawn in a pane they can see, or named in the answer to their+ // own typed ask. Any other card is a stranger to them, however it got there (Claude's ask, or one that replaced the card they read).+ if (state.shownCard !== pending.id) {+ say(pending.label, false, `not run: card ${pending.id ?? '?'} ("${plain(pending.label, 60)}") was not put in front of you, so a bare yes may be meant for another. Read it in the console and press Yes on it, or type /ruflo yes ${pending.id ?? '<id>'}`)+ record(state.events, [{ atMs: nowMs, kind: 'tools', text: `a typed yes did not run "${plain(pending.label, 60)}": the card had not been shown to the person` }])++ return+ }++ // A card Claude has only just raised, or one that took the place of a card that left unanswered, is answered on the card itself (its button+ // or y), or by its id.const isNewClaude = pending.source === 'claude' && nowMs - pending.askedAtMs < UNBOUND_FRESH_MSconst isReplacement = nowMs - goneUnansweredAtMs < UNBOUND_REPLACED_MSif (isNewClaude || isReplacement) {- say(pending.label, false, `not run: ${isNewClaude ? 'Claude raised this card a moment ago' : 'this card replaced one that left unanswered a moment ago'}, so a typed yes may be meant for another. Read it and press Yes on the card itself`)+ say(pending.label, false, `not run: ${isNewClaude ? 'Claude raised this card a moment ago' : 'this card replaced one that left unanswered a moment ago'}, so a typed yes may be meant for another. Read it and press Yes on the card itself, or type /ruflo yes ${pending.id ?? '<id>'}`)record(state.events, [{ atMs: nowMs, kind: 'tools', text: `a typed yes did not run "${plain(pending.label, 60)}": the card was new or had just replaced another` }])returndiff --git a/plugins/ruflo-console/hooks/skills.ts b/plugins/ruflo-console/hooks/skills.tsindex 57d9ee5538..a65fbc894c 100644--- a/plugins/ruflo-console/hooks/skills.ts+++ b/plugins/ruflo-console/hooks/skills.ts@@ -231,10 +231,10 @@ export function skillActions(state: State, host: Host, runner: Runner, load: (teconst asked = skills.askedconst name = newNameOf(text)- if (asked !== null && (asked.key === text.trim() || text.trim() === '') && state.pending?.label === asked.label) {+ if (asked !== null && asked.card !== null && (asked.key === text.trim() || text.trim() === '') && state.pending?.id === asked.card) {skills.asked = nullskills.createDraft = ''- void runner.confirm()+ void runner.confirm(asked.card)return}@@ -243,8 +243,10 @@ export function skillActions(state: State, host: Host, runner: Runner, load: (teskills.createDraft = textif (name !== null) skills.authored = name+ const before = state.pending?.id+runner.ask(spec, NAME_RULE)- skills.asked = spec !== null && name !== null ? { key: name, label: spec.label } : null+ skills.asked = spec !== null && name !== null ? { key: name, label: spec.label, card: state.pending !== null && state.pending.id !== before ? (state.pending.id ?? null) : null } : null},add: (found, scope) => runner.ask(addSpec(state, host, found, scope), 'that result is not an owner/repo@skill id'),remove: skill => runner.ask(removeSpec(state, host, skill), nameless('remove')),diff --git a/plugins/ruflo-console/hooks/state.ts b/plugins/ruflo-console/hooks/state.tsindex ab1b46a8d2..dd35fc3a37 100644--- a/plugins/ruflo-console/hooks/state.ts+++ b/plugins/ruflo-console/hooks/state.ts@@ -150,7 +150,7 @@ export function optionsOf(raw: PluginOptions | undefined): Options {}/** A mutating action waiting for the person's second press; `shows` is the command line when it is not a ruflo one. */-export type Pending = { /** Which ask this is (runner.ts hands out ids in order): a Yes names the card it answers, so another card that took its place is never the one run. */ id?: number; label: string; args: readonly string[]; expect: string; askedAtMs: number; shows?: string; note?: string; /** The kind of action, when it may be remembered (see remember.ts). */ rememberKey?: string; /** Where in its view the ask came from. */ scope?: string; /** The page that raised it: the ask shows in full there, and as a pointer on every other page. */ view?: string; /** Who raised it: Claude's tool call or the person's own action (ADR-450 T14). */ source?: 'claude' | 'you'; /** The class the entry declares for itself; the gate takes the stricter of this and the class read from its words. */ declared?: 'write' | 'network' | 'install' | 'spend' | 'delete'; /** Set only on a card Claude raised by its own direct console_run in this session: the one kind of card it may withdraw (runner.ts also matches the id). */ origin?: 'console_run'; /** The class of action, set only on Claude's asks. */ kind?: 'write' | 'network' | 'install' | 'spend' | 'delete' }+export type Pending = { /** Which ask this is (runner.ts hands out ids in order): a Yes names the card it answers, so another card that took its place is never the one run. */ id?: number; label: string; args: readonly string[]; expect: string; askedAtMs: number; shows?: string; note?: string; /** The kind of action, when it may be remembered (see remember.ts). */ rememberKey?: string; /** Where in its view the ask came from. */ scope?: string; /** The page that raised it: the ask shows in full there, and as a pointer on every other page. */ view?: string; /** Who raised it: Claude's tool call or the person's own action (ADR-450 T14). */ source?: 'claude' | 'you'; /** The class the entry declares for itself; the gate takes the stricter of this and the class read from its words. */ declared?: 'write' | 'network' | 'install' | 'spend' | 'delete'; /** Set only on a card Claude raised by its own direct console_run in this session: the one kind of card it may withdraw (runner.ts also matches the id). */ origin?: 'console_run'; /** The class of action, set only on Claude's asks. */ kind?: 'write' | 'network' | 'install' | 'spend' | 'delete'; /** The number of the Claude call that started this ask (ActionSpec.byCall): only that call settles it. */ byCall?: number }/** The MetaHarness lab's last run: what it was, how it exited, its cost note, and its output as lines to scroll. */export type LabResult = { id: string; label: string; ok: boolean; exitCode: number | null; note?: string; lines: string[]; atMs: number }@@ -275,6 +275,10 @@ export type State = {drill: { agentId: string | null; logs: string[] | null; logsAtMs: number }palette: { isOpen: boolean; query: string; index: number; context: 'all' | 'selection' }pending: Pending | null+ /** The id of the confirm card last put in front of the person (drawn in the shown pane, or named in a typed answer): the one card a bare `/ruflo yes` may answer. */+ shownCard: number | null+ /** The last field Enter that raised a card: which entry and text, and the card's id, so Enter again confirms that card and no other that merely reads the same. */+ askedAgain: { entry: string; text: string; card: number } | null/** The key of the element last pressed, and the one the last ask or answer came from: the page draws them right there (views/attention.ts). */lastPressed: string | nullorigin: string | null@@ -309,7 +313,7 @@ export type State = {scroll: numberunseen: number/** The text the last Enter asked about: Enter on the same text again confirms it. */- asked: { key: string; label: string } | null+ asked: { key: string; label: string; card: number | null } | null}/** The skills view: installed skills, the last search, and the change running now. */skills: SkillsState@@ -328,7 +332,7 @@ export type State = {/** The Workflows page: the last read of Claude Code's run folders, the cursor, the inspector tab (wf-state.ts). */wf: WfState/** Claude's control of the console (ADR-444): paused by the person, the call counts, and the log the dashboard shows. */- control: { paused: boolean; calls: number; turnCalls: number; /** Model-driven actions this session, by class (ADR-450 T8 budget). */ used: Record<string, number>; log: ControlEntry[]; /** Until when Claude counts as driving (a tool call extends it): the console does not spend a second Claude turn on guidance meanwhile. */ drivingUntilMs: number; /** Claude's console_run / console_set calls running now: an ask that lands while one runs is settled (gated) by that call; one that lands with none running (console_open and console_state settle nothing) is checked by the runner. */ activeCalls: number; /** True while one of Claude's tool calls is running: a person's "always allow" answer must not let Claude's call skip the level and confirm checks (ADR-444). */ viaModel: boolean }+ control: { paused: boolean; calls: number; turnCalls: number; /** Model-driven actions this session, by class (ADR-450 T8 budget). */ used: Record<string, number>; log: ControlEntry[]; /** Until when Claude counts as driving (a tool call extends it): the console does not spend a second Claude turn on guidance meanwhile. */ drivingUntilMs: number; /** Claude's console_run / console_set calls running now: an ask that lands while one runs is settled (gated) by that call; one that lands with none running (console_open and console_state settle nothing) is checked by the runner. */ activeCalls: number; /** True while one of Claude's tool calls is running: a person's "always allow" answer must not let Claude's call skip the level and confirm checks (ADR-444). */ viaModel: boolean; /** The last number handed to a console_run / console_set call, and the number of the call whose synchronous start is running now (null when none is). */ callSeq: number; callTag: number | null }}export function newState(raw: PluginOptions | undefined): State {@@ -388,6 +392,8 @@ export function newState(raw: PluginOptions | undefined): State {drill: { agentId: null, logs: null, logsAtMs: 0 },palette: { isOpen: false, query: '', index: 0, context: 'all' },pending: null,+ shownCard: null,+ askedAgain: null,lastPressed: null,origin: null,outcome: null,@@ -406,7 +412,7 @@ export function newState(raw: PluginOptions | undefined): State {timers: new Map(),stats: { renders: [], refreshes: [], frames: [] },wf: emptyWf(),- control: { paused: false, calls: 0, turnCalls: 0, used: {}, log: [], drivingUntilMs: 0, activeCalls: 0, viaModel: false },+ control: { paused: false, calls: 0, turnCalls: 0, used: {}, log: [], drivingUntilMs: 0, activeCalls: 0, viaModel: false, callSeq: 0, callTag: null },}}diff --git a/plugins/ruflo-console/hooks/views/automate.ts b/plugins/ruflo-console/hooks/views/automate.tsindex 2253cb7640..0bfbc30181 100644--- a/plugins/ruflo-console/hooks/views/automate.ts+++ b/plugins/ruflo-console/hooks/views/automate.ts@@ -36,16 +36,17 @@ export function strip(ctx: Ctx, key: string, items: readonly Item[]): RenderElem/** True when Enter repeats the text the pending ask came from: the field holds the keys, so Enter again confirms. */export function isAskedAgain(ctx: Ctx, id: string, value: string): boolean {const pending = ctx.state.pending- const entry = [...automateEntries(ctx.state), ...neuralEntries(ctx.state)].find(candidate => candidate.id === id)+ const again = ctx.state.askedAgain- return pending !== null && value.trim() !== '' && entry?.make?.(value)?.label === pending.label+ // The same entry, the same text, and the very card that text raised (its id): a card with the same words that replaced it is not it.+ return pending !== null && pending.id !== undefined && again !== null && value.trim() !== '' && again.entry === id && again.text === value.trim() && again.card === pending.id}/** A typed entry's field: Enter runs a read at once, or asks for a change; Enter again on the same text confirms it. */export function field(ctx: Ctx, id: string, label: string, placeholder: string, submitLabel = 'ask'): RenderElement {if (ctx.kit.Input === undefined) return text(ctx, ` ${label}: this surface has no text field; /ruflo run ${id} <text> does the same`, { dimColor: true })- return ctx.kit.Input({ key: `in-${id}`, label, placeholder, submitLabel, onSubmit: value => (isAskedAgain(ctx, id, value) ? ctx.act.confirm() : void ctx.act.run(id, value)) })+ return ctx.kit.Input({ key: `in-${id}`, label, placeholder, submitLabel, onSubmit: value => (isAskedAgain(ctx, id, value) ? ctx.act.confirm(ctx.state.pending?.id) : void ctx.act.run(id, value)) })}/** The last run whose id has one of `prefixes`: what it was, how it exited, its cost note and a window of its lines. */diff --git a/plugins/ruflo-console/hooks/views/common.ts b/plugins/ruflo-console/hooks/views/common.tsindex 67fe17a939..4e49c8ae09 100644--- a/plugins/ruflo-console/hooks/views/common.ts+++ b/plugins/ruflo-console/hooks/views/common.ts@@ -415,6 +415,9 @@ export function confirmRow(ctx: Ctx): RenderElement | null {// One bordered card in the warning colour: the person says yes to everything in it, so it reads as a unit, not as loose lines. Its border and// padding take four columns, so the text inside is clipped to the narrower width.const inner: Ctx = { ...ctx, columns: Math.max(20, ctx.columns - 4) }+ // Drawn for a person in a pane they can see: this is now the card a bare typed yes may answer. A text answer for a model shows it to no one.+ if (ctx.text !== true && ctx.state.pane.isShown && pending.id !== undefined) ctx.state.shownCard = pending.id+const hasMoney = pending.note !== undefined && /money|models/i.test(pending.note)return ctx.kit.Box({@@ -439,7 +442,7 @@ export function confirmRow(ctx: Ctx): RenderElement | null {// A low-risk ruflo action may be remembered: it is not asked again (Settings lists and forgets it)....(pending.rememberKey !== undefined ? [button(ctx, 'remember', `Always allow “${pending.rememberKey}”`, () => ctx.act.remember(pending.id))] : []),// An AI terminal turn (claude -p in plan mode, codex read-only, the budget cap) may be always accepted: Settings resets it.- ...(ctx.state.terminal.asked !== null && pending.label === ctx.state.terminal.asked.label && ctx.state.terminal.harness !== 'ruflo' ? [button(ctx, 'always', 'Always accept AI turns', () => ctx.act.settings.alwaysAccept(pending.id))] : []),+ ...(ctx.state.terminal.asked !== null && pending.id !== undefined && pending.id === ctx.state.terminal.asked.card && ctx.state.terminal.harness !== 'ruflo' ? [button(ctx, 'always', 'Always accept AI turns', () => ctx.act.settings.alwaysAccept(pending.id))] : []),],}),],diff --git a/plugins/ruflo-console/tests/confirm-binding.spec.ts b/plugins/ruflo-console/tests/confirm-binding.spec.tsnew file mode 100644index 0000000000..383123c535--- /dev/null+++ b/plugins/ruflo-console/tests/confirm-binding.spec.ts@@ -0,0 +1,244 @@+/**+ * #3983: every confirm route answers the card the person saw. The card's own Yes and y were bound to its id; three other routes were not:+ * a typed `/ruflo yes`, the field's "Enter again" (matched by label), and the auto-confirm of a Claude call (settled whichever card waited).+ * Each is shown here to refuse the wrong card, and to still answer the right one.+ * npx vitest run plugins/ruflo-console/tests/confirm-binding.spec.ts+ */+import { afterEach, describe, expect, it, vi } from 'vitest'++import type { ActionSpec } from '../hooks/actions'+import { createController } from '../hooks/controller'+import { dispatch } from '../hooks/dispatch'+import type { Host } from '../hooks/host'+import { callTool } from '../hooks/model-tools'+import { parseRuflo } from '../hooks/commands'+import { settingsOf } from '../hooks/settings'+import { newState } from '../hooks/state'+import { confirmRow, type Ctx } from '../hooks/views/common'+import { isAskedAgain } from '../hooks/views/automate'+import { plainKit } from '../hooks/views/pane'+import { setup } from './fixtures/control-setup'++afterEach(() => vi.useRealTimers())++function console$() {+ vi.useFakeTimers({ now: 5_000_000 })++ const host = new Proxy({}, {+ get: (_target, key) => {+ if (key === 'after' || key === 'every') return (ms: number, fn: () => void) => {+ const handle = key === 'after' ? setTimeout(fn, ms) : setInterval(fn, ms)++ return { cancel: () => (key === 'after' ? clearTimeout(handle) : clearInterval(handle)) }+ }+ if (key === 'pluginRoot') return '/plugin'+ if (key === 'fs') return { read: async () => Promise.reject(new Error('ENOENT')), stat: async () => Promise.reject(new Error('ENOENT')), list: async () => Promise.reject(new Error('ENOENT')) }++ return () => Promise.resolve(undefined)+ },+ }) as unknown as Host+ const state = newState({ boot: false })++ Object.assign(settingsOf(state).ai, { modelControl: 'full', modelConfirm: 'ask' })++ const control = createController(state, host)+ const ran: string[] = []+ const spec = (label: string, extra: Partial<ActionSpec> = {}) => ({ label, args: ['memory', 'store'], expect: 'x', run: async () => void ran.push(label), ...extra }) as unknown as ActionSpec+ const say = (text: string) => dispatch(control, state, text, async () => undefined)+ /** The card drawn for a person in a pane that is open. */+ const draw = () => {+ state.pane.isShown = true+ confirmRow({ kit: plainKit(), state, nowMs: Date.now(), columns: 100, pictures: new Map(), act: new Proxy({}, { get: () => () => undefined }) as never } as unknown as Ctx)+ }++ return { state, control, ran, spec, say, draw }+}++describe('a typed /ruflo yes names its card or answers only the card the person was shown', () => {+ it('parses an id', () => {+ expect(parseRuflo('yes 7')).toEqual({ kind: 'confirm', isYes: true, card: 7 })+ expect(parseRuflo('y #12')).toEqual({ kind: 'confirm', isYes: true, card: 12 })+ expect(parseRuflo('yes')).toEqual({ kind: 'confirm', isYes: true })+ expect(parseRuflo('yes now')).toEqual({ kind: 'confirm', isYes: true })+ })++ it('A expires, Claude raises B, a long while later a bare yes meant for A runs nothing; yes <B> runs B', async () => {+ const { state, control, ran, spec, say, draw } = console$()++ control.runner.ask(spec('store A'), 'x')+ draw()+ vi.advanceTimersByTime(30_300)+ expect(state.pending).toBeNull()++ control.runner.ask(spec('store B', { byModel: true }), 'x')++ const b = state.pending?.id++ vi.advanceTimersByTime(15_000)+ expect(await say('yes')).toMatchObject({ text: expect.stringMatching(/not run.*not put in front of you/) })+ expect(ran).toEqual([])+ expect(state.pending?.id).toBe(b)++ expect((await say(`yes ${(b ?? 0) + 1}`)).text).toMatch(/Ran|✗|✓/)+ expect(ran).toEqual([])+ expect(state.pending?.id).toBe(b)++ await say(`yes ${b}`)+ expect(ran).toEqual(['store B'])+ })++ it('a card drawn in the open pane is the one a bare yes answers; one drawn only for a text answer is not', async () => {+ const { state, control, ran, spec, say, draw } = console$()++ control.runner.ask(spec('store C'), 'x')+ // A model's text answer draws the same card for no one.+ state.pane.isShown = true+ confirmRow({ kit: plainKit(), state, nowMs: Date.now(), columns: 100, pictures: new Map(), text: true, act: {} as never } as unknown as Ctx)+ expect(state.shownCard).toBeNull()+ await say('yes')+ expect(ran).toEqual([])++ draw()+ expect(state.shownCard).toBe(state.pending?.id)+ vi.advanceTimersByTime(4_000)+ await say('yes')+ expect(ran).toEqual(['store C'])+ })++ it('/ruflo run names the card in its answer, and the bare yes after it answers that card', async () => {+ const { state, say } = console$()+ const asked = await say('run mem-store console k1 v1')++ expect(asked.text).toMatch(/Asked: .*\/ruflo yes \d+ names this card/)+ expect(state.pending).not.toBeNull()+ expect(state.shownCard).toBe(state.pending?.id)+ vi.advanceTimersByTime(4_000)++ const yes = await say('yes')++ expect(yes.text).not.toMatch(/not put in front of you/)+ expect(state.pending).toBeNull()+ })++ it('a card nobody showed the person is refused a bare yes with its id in the answer', async () => {+ const { state, control, ran, spec, say } = console$()++ control.runner.ask(spec('store E', { byModel: true }), 'x')+ vi.advanceTimersByTime(10_000)++ const refused = await say('yes')++ expect(refused.text).toMatch(new RegExp(`/ruflo yes ${state.pending?.id}`))+ expect(ran).toEqual([])+ })+})++describe('"Enter again" answers the card its field raised, not one that reads the same', () => {+ it('the automate field: a replacement card with the same label is not confirmed; the original is', () => {+ const { state } = console$()+ const ctx = { kit: plainKit(), state, nowMs: Date.now(), columns: 100, pictures: new Map(), act: {} as never } as unknown as Ctx++ state.pending = { id: 4, label: 'train coordination', args: [], expect: 'x', askedAtMs: Date.now() }+ state.askedAgain = { entry: 'neural-train', text: 'coordination 20', card: 4 }+ expect(isAskedAgain(ctx, 'neural-train', 'coordination 20')).toBe(true)+ // Another card with the very same words took its place (a re-ask with other arguments).+ state.pending = { id: 5, label: 'train coordination', args: [], expect: 'x', askedAtMs: Date.now() }+ expect(isAskedAgain(ctx, 'neural-train', 'coordination 20')).toBe(false)+ state.pending = { id: 4, label: 'train coordination', args: [], expect: 'x', askedAtMs: Date.now() }+ expect(isAskedAgain(ctx, 'neural-train', 'coordination 30')).toBe(false)+ expect(isAskedAgain(ctx, 'other-entry', 'coordination 20')).toBe(false)+ })++ it('the terminal field: Enter again confirms the card it raised; a same-labelled card that replaced it is not confirmed by that Enter', async () => {+ const { state, control, spec } = console$()+ const submit = (text: string) => control.actions.term.submit(text)++ submit('hello there')++ const first = state.pending++ expect(first).not.toBeNull()+ expect(state.terminal.asked?.card).toBe(first?.id)++ // The card the field raised is replaced by another that reads exactly the same (a re-ask from elsewhere, same label).+ control.runner.ask(spec(first?.label ?? ''), 'x')+ expect(state.pending?.label).toBe(first?.label)+ expect(state.pending?.id).not.toBe(first?.id)++ const second = state.pending?.id++ submit('hello there')+ // Enter again did not answer the replacement: it asked afresh (a new card), and nothing was confirmed on the replaced one.+ expect(state.pending?.id).not.toBe(second)+ expect(state.terminal.asked?.card).toBe(state.pending?.id)++ // And now the card this field raised is the one Enter again answers.+ const raised = state.pending?.id++ submit('hello there')+ expect(state.pending === null || state.pending.id !== raised).toBe(true)+ expect(state.terminal.asked === null || state.terminal.asked.card !== raised).toBe(true)+ })+})++describe('auto-confirm settles only the card the call raised', () => {+ it('a read still running while an unrelated write lands: the write is not confirmed under the read call', async () => {+ const { state, calls, deps } = setup('full', 'auto', { search: { label: 'search', readOnly: true } })+ const control = (deps as unknown as { control: { runner: { settled: () => Promise<void> } } }).control+ let release: () => void = () => undefined++ control.runner.settled = () => new Promise<void>(resolve => (release = resolve))++ const running = callTool('console_run', { id: 'search', text: 'x' }, deps)++ // The unrelated deferred write lands while the read is still waiting.+ state.pending = { id: 99, label: 'store a thing', args: [], expect: 'stored', askedAtMs: Date.now(), source: 'claude' }+ release()++ const answer = await running++ expect(calls.confirm).toBe(0)+ expect(state.pending?.id).toBe(99)+ expect(answer).not.toMatch(/Waiting for the person|Done: store a thing|Failed: store a thing/)+ })++ it('a deferred write that carries ANOTHER call\'s number is not settled by this call; one that carries this call\'s number is', async () => {+ for (const mine of [false, true]) {+ const { state, calls, deps } = setup('full', 'auto', { search: { label: 'search', readOnly: true } })+ const control = (deps as unknown as { control: { runner: { settled: () => Promise<void> } } }).control+ let release: () => void = () => undefined++ let waited = false++ // Only the first wait (the read still running) is held; a later one (after a confirm) returns at once.+ control.runner.settled = () => (waited ? Promise.resolve() : ((waited = true), new Promise<void>(resolve => (release = resolve))))++ const running = callTool('console_run', { id: 'search', text: 'x' }, deps)++ // This is the first call, so its number is 1; the stranger carries 7.+ state.pending = { id: 50, label: 'store a thing', args: [], expect: 'stored', askedAtMs: Date.now(), source: 'claude', byCall: mine ? 1 : 7 }+ release()+ await running+ expect(calls.confirm, mine ? 'own deferred card' : 'stranger').toBe(mine ? 1 : 0)+ }+ })++ it('the card the call itself raised is still settled as before (auto: confirmed)', async () => {+ const { state, calls, deps } = setup('full', 'auto')+ const runner = (deps as unknown as { control: { runner: { runById: (id: string) => boolean } } }).control.runner+ const original = runner.runById++ runner.runById = id => {+ const ok = original(id)++ if (state.pending !== null) state.pending.id = 7++ return ok+ }++ const answer = await callTool('console_run', { id: 'mission-create' }, deps)++ expect(calls.confirm).toBe(1)+ expect(answer).toMatch(/Done|Ran/)+ })+})diff --git a/plugins/ruflo-console/tests/deferred-asks.spec.ts b/plugins/ruflo-console/tests/deferred-asks.spec.tsindex d62647d542..c902bc6455 100644--- a/plugins/ruflo-console/tests/deferred-asks.spec.ts+++ b/plugins/ruflo-console/tests/deferred-asks.spec.ts@@ -61,7 +61,7 @@ describe('a Yes runs only the card it was pressed on', () => {state.pending = { id: 41, label: 'ask Claude about the terminal', args: [], expect: 'e', askedAtMs: 1, rememberKey: 'ask' }state.terminal.harness = 'claude'- state.terminal.asked = { key: 'k', label: 'ask Claude about the terminal' } as never+ state.terminal.asked = { key: 'k', label: 'ask Claude about the terminal', card: 41 }const card = confirmRow({ kit, state, act, columns: 100, nowMs: 1_000, pictures: new Map() } as never) as unknown as Eldiff --git a/plugins/ruflo-console/tests/pending-expiry.spec.ts b/plugins/ruflo-console/tests/pending-expiry.spec.tsindex f8f5d28158..9e567eb94a 100644--- a/plugins/ruflo-console/tests/pending-expiry.spec.ts+++ b/plugins/ruflo-console/tests/pending-expiry.spec.ts@@ -372,6 +372,8 @@ describe('a typed /ruflo yes is bound to no card', () => {const { state, control, ran, spec } = console$()control.runner.ask(spec('store a note'), 'x')+ // The card is on the person's screen: a bare typed yes answers it.+ state.shownCard = state.pending?.id ?? nullawait yes(control, state)expect(ran).toEqual(['store a note'])})@@ -382,6 +384,7 @@ describe('a typed /ruflo yes is bound to no card', () => {const { state, control, ran, spec } = console$()control.runner.ask(spec('store a note', { byModel: true }), 'x')+ state.shownCard = state.pending?.id ?? nullvi.advanceTimersByTime(2_000)expect((await yes(control, state)).text).toMatch(/press Yes on the card itself/)expect(ran).toEqual([])@@ -400,6 +403,7 @@ describe('a typed /ruflo yes is bound to no card', () => {vi.advanceTimersByTime(PENDING_TTL_MS + 500)expect(state.pending).toBeNull()control.runner.ask(spec('the new card'), 'x')+ state.shownCard = state.pending?.id ?? nullvi.advanceTimersByTime(4_000)expect((await yes(control, state)).text).toMatch(/replaced one that left unanswered/)expect(ran).toEqual([])