Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

fix(console): console_state reports an expired confirm card as lastResult.expired

Dragan Spiridonov3d6ccf389fb7
diff --git a/plugins/ruflo-console/hooks/model-tools.ts b/plugins/ruflo-console/hooks/model-tools.ts
index 8360232cfa..a0d9fe2471 100644
--- a/plugins/ruflo-console/hooks/model-tools.ts
+++ b/plugins/ruflo-console/hooks/model-tools.ts
@@ -215,7 +215,7 @@ function stateJson(deps: ModelToolDeps, filter: string): string {
title: VIEWS.find(view => view.id === state.view)?.label ?? state.view,
screen,
waiting: state.pending === null ? null : { ...(askedBy(state.pending) !== '' && { askedBy: askedBy(state.pending).replace(/: $/, '') }), label: modelLine(state.pending.label, 120), expect: modelLine(state.pending.expect, 160), note: state.pending.note === undefined ? undefined : modelLine(state.pending.note, 160) },
- lastResult: state.outcome === null ? null : { label: modelLine(state.outcome.label, 100), ok: state.outcome.ok, detail: modelLine(state.outcome.detail, 200), lines: (state.outcome.lines ?? []).slice(0, 12).map(line => modelLine(line, 160)) },
+ lastResult: state.outcome === null ? null : { label: modelLine(state.outcome.label, 100), ok: state.outcome.ok, detail: modelLine(state.outcome.detail, 200), lines: (state.outcome.lines ?? []).slice(0, 12).map(line => modelLine(line, 160)), ...(state.outcome.expired === true && { expired: true }) },
entries,
entryCount: all.length,
entriesNote: entries.length < (words.length === 0 ? all.length : entries.length) || (words.length > 0 && entries.length === 40) ? 'the list is cut: pass filter (words in an id or label) to find other entries' : undefined,
diff --git a/plugins/ruflo-console/tests/pending-expiry.spec.ts b/plugins/ruflo-console/tests/pending-expiry.spec.ts
index 9e567eb94a..b64d26cd8d 100644
--- a/plugins/ruflo-console/tests/pending-expiry.spec.ts
+++ b/plugins/ruflo-console/tests/pending-expiry.spec.ts
@@ -169,6 +169,24 @@ describe('console_run with a stale or withdrawable card', () => {
expect(state.events.some(event => /expired after 30 s, not run/.test(event.text))).toBe(true)
})
+ it('console_state hands the expiry to Claude as lastResult.expired, and an ordinary result carries no such field', async () => {
+ const { state, deps, age } = modelSetup()
+
+ expect(await callTool('console_run', { id: 'mem-store', text: 'console k1 v1' }, deps)).toMatch(/Waiting for the person/)
+ age()
+
+ const expired = JSON.parse(await callTool('console_state', {}, deps)) as { waiting: unknown; lastResult: { ok: boolean; detail: string; expired?: boolean } | null }
+
+ expect(expired.waiting).toBeNull()
+ expect(expired.lastResult).toMatchObject({ ok: false, expired: true })
+ expect(expired.lastResult?.detail).toMatch(/^expired: ask again/)
+
+ state.outcome = { label: 'store a note', ok: true, verified: 'n/a', detail: 'stored', atMs: Date.now() }
+ const ordinary = JSON.parse(await callTool('console_state', {}, deps)) as { lastResult: Record<string, unknown> | null }
+
+ expect(ordinary.lastResult).not.toHaveProperty('expired')
+ })
+
it('console_run ask-withdraw takes back Claude’s own write-class card; nothing runs', async () => {
const { state, deps, ran } = modelSetup()