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

wip(console): full-text helpers, mission goal never truncated (ADR-481)

ruvbf67d3e304dd
diff --git a/plugins/ruflo-console/hooks/data/missions.ts b/plugins/ruflo-console/hooks/data/missions.ts
index 210fdcc63e..ee07ad67e2 100644
--- a/plugins/ruflo-console/hooks/data/missions.ts
+++ b/plugins/ruflo-console/hooks/data/missions.ts
@@ -58,7 +58,7 @@ export function parseMissions(text: string | null): MissionObservation | null {
})
const out: Mission = {
id,
- objective: plain(mission.objective, 200),
+ objective: plain(mission.objective, 2_000),
state: stringOf(mission.state, 30) ?? 'unknown',
revision: numberOf(mission.revision) ?? 0,
executionMode: stringOf(mission.executionMode, 30) ?? 'unknown',
diff --git a/plugins/ruflo-console/hooks/field-keep.ts b/plugins/ruflo-console/hooks/field-keep.ts
new file mode 100644
index 0000000000..631e341b31
--- /dev/null
+++ b/plugins/ruflo-console/hooks/field-keep.ts
@@ -0,0 +1,29 @@
+/**
+ * A refused entry stays in its field (ADR-481). Every one-shot field empties after its Enter (views/clearing.ts); when the text was refused
+ * (it is over a real limit) the person must not lose it, so the refusing action marks the exact text `kept`, and the field puts it back
+ * instead of emptying. Keyed by the text, not the field: the action does not know which field (page or menu strip) it came from.
+ */
+import type { State } from './state'
+
+const kept = new WeakMap<State, Set<string>>()
+
+const keptOf = (state: State): Set<string> => {
+ let found = kept.get(state)
+
+ if (found === undefined) {
+ found = new Set()
+ kept.set(state, found)
+ }
+
+ return found
+}
+
+/** Marks `text` (exactly as the field submitted it) as refused: the field keeps it. */
+export function keepText(state: State, text: string): void {
+ keptOf(state).add(text)
+}
+
+/** True once after `keepText` for this text: the field then keeps it instead of clearing. */
+export function takeKept(state: State, text: string): boolean {
+ return keptOf(state).delete(text)
+}
diff --git a/plugins/ruflo-console/hooks/full-text.ts b/plugins/ruflo-console/hooks/full-text.ts
new file mode 100644
index 0000000000..aa2d1785bf
--- /dev/null
+++ b/plugins/ruflo-console/hooks/full-text.ts
@@ -0,0 +1,197 @@
+/**
+ * Text a person typed is never silently shortened (ADR-481). Two shared helpers, so no call site writes its own cut:
+ *
+ * - {@link showFull}: the whole text, wrapped over as many lines as it needs, for the view where it is the primary content. When the
+ * block would pass `maxLines` it ends in an explicit marker with the number of lines that are hidden and how to see them: never an
+ * unmarked cut.
+ * - {@link checkLimit}: the one place a real limit (the ruflo mission record, a task title, an OS or MCP bound) is checked, BEFORE
+ * anything is sent. Over the limit it says the exact limit and how many characters are over; the caller keeps the person's text.
+ *
+ * Pure: strings in, strings out. Counts are code points ("characters" as a person counts them), and a wrap never splits a surrogate
+ * pair, so unicode text survives both.
+ */
+
+import { plain } from './data/parse'
+
+/** Characters a person's long-form text may have when it is sent to Claude as a prompt (stdin or the session prompt: no argv is involved). */
+export const LONG_TEXT_MAX = 20_000
+
+/**
+ * The most a ruflo mission record takes as its objective: `mission_create`'s input schema says `objective: { maxLength: 2000 }`
+ * (v3/@claude-flow/cli/src/mcp-tools/mission-tools.ts). A real limit; over it the mission is not created and the person is told by how much.
+ */
+export const MISSION_OBJECTIVE_MAX = 2_000
+
+/**
+ * The most text of a person's that rides in ONE argv element or one JSON argument of a `ruflo mcp exec -p <json>` child process. Linux allows 128 KiB
+ * per element (MAX_ARG_STRLEN) and Windows 32,767 characters for the whole command line, so 8,000 characters (a JSON escape can double that) is
+ * the largest value that is safe on both.
+ */
+export const ARGV_TEXT_MAX = 8_000
+
+/** Lines a full-text block shows before it ends in the marker: generous (a screenful and then some), and always explicit. */
+export const SHOW_LINES = 40
+
+/** Number of code points in `text`. */
+export const countOf = (text: string): number => {
+ let count = 0
+
+ for (const _ of text) count++
+
+ return count
+}
+
+/** `12345` as `12,345`: the same digits whatever the locale, so a message is the same everywhere. */
+export const grouped = (n: number): string => String(Math.trunc(n)).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
+
+/**
+ * The text as lines no wider than `width`: it breaks at spaces, keeps the person's own line breaks, and breaks a word longer than the
+ * width (a URL, a path, 12,000 characters without a space) into pieces instead of cutting it. Nothing is dropped: the lines joined
+ * back (spaces at a break aside) are the text.
+ */
+export function wrapFull(text: string, width: number): string[] {
+ const w = Math.max(8, Math.floor(width))
+ const out: string[] = []
+
+ for (const paragraph of text.split(/\r\n|\r|\n/)) {
+ let current = ''
+ let currentLen = 0
+
+ const flush = () => {
+ out.push(current)
+ current = ''
+ currentLen = 0
+ }
+
+ for (const word of paragraph.split(' ')) {
+ const letters = Array.from(word)
+
+ // A word that cannot fit on a line of its own is broken into full lines; the rest starts the next line.
+ if (letters.length > w) {
+ if (current !== '') flush()
+
+ let i = 0
+
+ for (; letters.length - i > w; i += w) out.push(letters.slice(i, i + w).join(''))
+ current = letters.slice(i).join('')
+ currentLen = letters.length - i
+
+ continue
+ }
+
+ if (currentLen === 0 && current === '') {
+ current = word
+ currentLen = letters.length
+ } else if (currentLen + 1 + letters.length > w) {
+ flush()
+ current = word
+ currentLen = letters.length
+ } else {
+ current = `${current} ${word}`
+ currentLen += 1 + letters.length
+ }
+ }
+
+ flush()
+ }
+
+ return out
+}
+
+export type Shown = {
+ /** The lines to draw, the marker last when some are hidden. */
+ lines: string[]
+ /** Lines the whole text needs at this width. */
+ total: number
+ /** Lines left out of `lines` (0 when all are shown). */
+ hidden: number
+ /** The marker line, or null when everything is shown. */
+ marker: string | null
+}
+
+/** `… (+3 more lines, press ✎ edit to view/edit)`: how many lines are left out, and where to read them. */
+export const markerFor = (hidden: number, hint: string): string => `… (+${grouped(hidden)} more line${hidden === 1 ? '' : 's'}, ${hint})`
+
+/**
+ * The text in full: wrapped to `width` and cut at `maxLines` lines only with the marker, which names the hidden line count. `hint` says
+ * where the rest can be read or edited (`press ✎ edit to view/edit`). The marker counts as one of the lines drawn.
+ */
+export function showFull(text: string, width: number, opts: { maxLines?: number; hint?: string } = {}): Shown {
+ const maxLines = Math.max(2, opts.maxLines ?? SHOW_LINES)
+ const hint = opts.hint ?? 'press ✎ edit to view/edit'
+ const all = wrapFull(text, width)
+
+ if (all.length <= maxLines) return { lines: all, total: all.length, hidden: 0, marker: null }
+
+ // One slot goes to the marker, so the block is never taller than maxLines.
+ const kept = all.slice(0, maxLines - 1)
+ const hidden = all.length - kept.length
+ const marker = markerFor(hidden, hint)
+
+ return { lines: [...kept, marker], total: all.length, hidden, marker }
+}
+
+export type Limit = { ok: true; length: number } | { ok: false; length: number; limit: number; over: number; message: string }
+
+/**
+ * Whether `text` fits a real limit. Over it: the exact message (what, the limit, the length, the characters over), for the caller to show
+ * BEFORE acting; the caller keeps the text in the field and runs nothing. `why` names the reason for the limit.
+ */
+export function checkLimit(text: string, limit: number, what: string, why = ''): Limit {
+ const length = countOf(text)
+
+ if (length <= limit) return { ok: true, length }
+
+ const over = length - limit
+
+ return {
+ ok: false,
+ length,
+ limit,
+ over,
+ message: `${what} is ${grouped(length)} characters; the limit is ${grouped(limit)}${why === '' ? '' : ` (${why})`}: ${grouped(over)} over. Nothing was sent or changed; shorten it and ask again.`,
+ }
+}
+
+/** A one-line label for the text with an ellipsis where it is shortened (a title, a menu line); the full text lives elsewhere. */
+export function labelOf(text: string, width: number): string {
+ const letters = Array.from(text.replace(/\s+/g, ' ').trim())
+
+ return letters.length <= width ? letters.join('') : `${letters.slice(0, Math.max(0, width - 1)).join('')}…`
+}
+
+/**
+ * Printable text for a long-form field: the escape sequences, controls and hidden characters `plain` removes go too, but the person's own
+ * line breaks stay, and nothing is shortened. Use it where the destination takes several lines (a prompt to Claude); use `plain(text,
+ * LONG_TEXT_MAX)` where the destination is one line (a slash command's arguments, a title) and say so.
+ */
+export function keepLines(value: unknown): string {
+ if (typeof value !== 'string') return ''
+
+ return value
+ .split(/\r\n|\r|\n/)
+ .map(line => plain(line, Number.MAX_SAFE_INTEGER))
+ .join('\n')
+ .replace(/\n{3,}/g, '\n\n')
+ .trim()
+}
+
+/**
+ * The text as pieces of at most `size` characters, each overlapping the previous by `overlap` (so a phrase that straddles a boundary is whole in one
+ * of them), for a check that can take only `size` at a time. One piece when the text fits. Code-point safe.
+ */
+export function chunksOf(text: string, size: number, overlap = 0): string[] {
+ const letters = Array.from(text)
+
+ if (letters.length <= size) return [text]
+
+ const step = Math.max(1, size - Math.max(0, Math.min(overlap, size - 1)))
+ const out: string[] = []
+
+ for (let i = 0; i < letters.length; i += step) {
+ out.push(letters.slice(i, i + size).join(''))
+ if (i + size >= letters.length) break
+ }
+
+ return out
+}
diff --git a/plugins/ruflo-console/hooks/goap.ts b/plugins/ruflo-console/hooks/goap.ts
index 6f1e083ac3..a8a0bc384f 100644
--- a/plugins/ruflo-console/hooks/goap.ts
+++ b/plugins/ruflo-console/hooks/goap.ts
@@ -356,8 +356,8 @@ export function gatesOf(p: Plan): string[] {
return gates
}
-/** The one line that starts the loop: `/loop <interval> <objective>`, the objective on one line and bounded. */
-export const loopCommand = (goal: string, prefs: LoopPrefs): string => `/loop ${prefs.loopInterval} ${goal.replace(/\s+/g, ' ').trim().slice(0, 200)}`
+/** The one line that starts the loop: `/loop <interval> <objective>`, the whole objective on one line (line breaks become spaces; ADR-481). */
+export const loopCommand = (goal: string, prefs: LoopPrefs): string => `/loop ${prefs.loopInterval} ${goal.replace(/\s+/g, ' ').trim()}`
/** The stages a plan runs, in lifecycle order, each with how many steps it holds. */
export const lifecycleOf = (p: Plan): { stage: Stage; steps: number }[] =>
diff --git a/plugins/ruflo-console/hooks/loops.ts b/plugins/ruflo-console/hooks/loops.ts
index db1507ce04..96944f466f 100644
--- a/plugins/ruflo-console/hooks/loops.ts
+++ b/plugins/ruflo-console/hooks/loops.ts
@@ -4,6 +4,7 @@
* says so, and always carries a stop condition when one is set. What the person types is data: a task that begins with a slash must
* be a plugin command the session lists, a typed task is screened by AIDefence, and everything is cut to a short single line.
*/
+import { checkLimit, LONG_TEXT_MAX } from './full-text'
import type { ActionSpec } from './actions'
import { plain } from './data/parse'
import type { Host } from './host'
@@ -82,8 +83,12 @@ export function loopsOf(state: State): LoopCfg {
const SLASH = /^\/([a-z0-9-]+:[A-Za-z0-9._-]+)(?: [A-Za-z0-9 ._:,=-]{0,120})?$/
/** A task longer than this is cut, so every preset must fit: the spec fails on one that does not. */
-export const MAX_TASK = 400
-const MAX_LOOP = 600
+/**
+ * A loop's task is sent on EVERY tick, billed each time, so it has a real bound (ADR-481): MAX_TASK characters for the task and MAX_LOOP for the
+ * whole `/loop` line. Over it the start is refused with the exact count and the typed task is kept; it is never cut.
+ */
+export const MAX_TASK = 4_000
+const MAX_LOOP = MAX_TASK + 200
/** The stop condition as a clause for the loop's prompt, or why it is not understood. Empty is "no stop condition". */
export function stopClause(raw: string): { ok: true; clause: string } | { ok: false; why: string } {
@@ -105,7 +110,10 @@ export function stopClause(raw: string): { ok: true; clause: string } | { ok: fa
/** The exact `/loop` input for a configuration, or why it cannot run. `listed` are the slash commands the session offers. */
export function loopInput(cfg: LoopCfg, listed: readonly string[]): { ok: true; text: string } | { ok: false; why: string } {
- const task = plain(cfg.task, MAX_TASK).trim()
+ const task = plain(cfg.task, LONG_TEXT_MAX).trim()
+ const fit = checkLimit(task, MAX_TASK, 'the task', 'the loop sends it again on every tick')
+
+ if (!fit.ok) return { ok: false, why: fit.message }
if (task === '') return { ok: false, why: 'pick a preset or type what the loop should do' }
if (!(INTERVALS as readonly string[]).includes(cfg.interval)) return { ok: false, why: 'pick an interval' }
@@ -123,7 +131,9 @@ export function loopInput(cfg: LoopCfg, listed: readonly string[]): { ok: true;
const text = `/loop ${cfg.interval === 'self-paced' ? '' : `${cfg.interval} `}${task}${stop.clause === '' ? '' : ` ${stop.clause}`}`
- return text.length > MAX_LOOP ? { ok: false, why: 'that is too long: shorten the task' } : { ok: true, text }
+ const whole = checkLimit(text, MAX_LOOP, 'the /loop line', 'the loop sends it again on every tick')
+
+ return whole.ok ? { ok: true, text } : { ok: false, why: whole.message }
}
export type LoopActions = {
@@ -210,7 +220,7 @@ export function loopActions(state: State, host: Host, runner: Runner): LoopActio
host.invalidate()
},
task: text => {
- cfg.task = plain(text, MAX_TASK)
+ cfg.task = plain(text, LONG_TEXT_MAX)
// A hand-written task is no longer the preset it started from.
if (PRESETS.find(candidate => candidate.id === cfg.preset)?.task !== cfg.task) cfg.preset = null
host.invalidate()
diff --git a/plugins/ruflo-console/hooks/mission-context.ts b/plugins/ruflo-console/hooks/mission-context.ts
index 9fe6a78154..a44e5e3a0c 100644
--- a/plugins/ruflo-console/hooks/mission-context.ts
+++ b/plugins/ruflo-console/hooks/mission-context.ts
@@ -6,10 +6,11 @@
* cache-write price, so event counts, timestamps and spend never reach the key.
*/
import { plain } from './data/parse'
+import { MISSION_OBJECTIVE_MAX } from './full-text'
import type { Derived, LedgerTask, MissionRecord } from './mission-types'
export const CONTEXT_SECTION_ID = 'ruflo-console:mission'
-export const CONTEXT_MAX = 1200
+export const CONTEXT_MAX = MISSION_OBJECTIVE_MAX + 1200
/** The settings key the row stores under, beside the other AI preferences. */
export const CONTEXT_PREF_KEY = 'missionContext'
@@ -31,7 +32,7 @@ function halted(mission: MissionRecord): string | null {
/** The section's text: deterministic, at most CONTEXT_MAX characters. `status` is the active task's derived status. */
export function missionContextText(mission: MissionRecord, task: LedgerTask | null, loop: LoopInfo, status: TaskStatus = 'ready'): string {
- const lines: string[] = [`Mission ${clip(mission.id, 40)}: ${clip(mission.objective, 200)}`]
+ const lines: string[] = [`Mission ${clip(mission.id, 40)}: ${clip(mission.objective, MISSION_OBJECTIVE_MAX)}`]
const stop = halted(mission)
if (task !== null) {
diff --git a/plugins/ruflo-console/hooks/mission-control.ts b/plugins/ruflo-console/hooks/mission-control.ts
index ae59fc506b..c5a69104cc 100644
--- a/plugins/ruflo-console/hooks/mission-control.ts
+++ b/plugins/ruflo-console/hooks/mission-control.ts
@@ -12,6 +12,8 @@ import { PHASE_NAME, plan as planOf, stageOf, type Plan, type Profile, profileOf
import { capGate, capOf, refreshCost } from './mission-guard'
import type { Host } from './host'
import { plain, type TaskRecord } from './data/parse'
+import { keepText } from './field-keep'
+import { checkLimit, keepLines, LONG_TEXT_MAX } from './full-text'
import { isAvailable, MISSION_SKILLS, slashOf, GOALS_PLUGIN } from './mission-skills'
import { offerGuidance } from './mission-guidance'
import { blocksCreate, blocksGuidance, capUsd, isCapability, RESEARCH_DEFAULT_CAP, researchArgs, researchConfirm, researchWhy, screenText, type ResearchDepth } from './mission-options'
@@ -19,9 +21,9 @@ import type { Runner } from './runner'
import { CLI_PREFIXES, type State } from './state'
import type { Derived, LedgerEvent, LedgerTask, McState, McTab, MissionActions, MissionRecord } from './mission-types'
-import { cancelSpec, createSpec, dispatchSpec, isInflight, MAX_HANDOUTS, resultOf, setPaused } from './mission-specs'
+import { cancelSpec, createSpec, createWhy, dispatchSpec, isInflight, MAX_HANDOUTS, resultOf, setPaused } from './mission-specs'
-export { cancelSpec, createSpec, dispatchSpec, resultOf, setPaused }
+export { cancelSpec, createSpec, createWhy, dispatchSpec, resultOf, setPaused }
export type { Derived, LedgerEvent, LedgerTask, McState, McTab, MissionActions, MissionRecord } from './mission-types'
const states = new WeakMap<State, McState>()
@@ -48,7 +50,7 @@ export const activeMission = (state: State): MissionRecord | null => {
export function setGoal(state: State, goal: string): void {
const mc = mcOf(state)
- mc.goal = plain(goal, 500).trim()
+ mc.goal = plain(goal, LONG_TEXT_MAX).trim()
mc.screen = null
if (!mc.isProfilePicked) mc.profile = profileOf(mc.goal)
mc.planned = mc.goal === '' ? null : planOf(mc.profile, mc.rigor)
@@ -165,8 +167,31 @@ export async function loadLedger(state: State, host: Host): Promise<void> {
if (typeof active === 'string' && mc.missions.has(active)) mc.active = active
}
-/** `ruflo mcp exec -t <tool> -p <json>` as an argv on the configured CLI prefix. */
-const MAX_TEXT = 500
+/**
+ * The longest text a person's goal, question, aside or instruction may be (ADR-481). These reach Claude as a prompt or a slash command's
+ * arguments through the session (no argv, no stdin of ours), and the AIDefence screen and guidance turn take the same text, so one bound serves.
+ * Over it the action is refused with the exact count before anything is sent, and the field keeps the text.
+ */
+const MAX_TEXT = LONG_TEXT_MAX
+
+/** The refusal for text over MAX_TEXT (the exact count), or null when it fits. Line breaks count as the spaces they become. */
+export const longRefusal = (raw: string, what: string): string | null => {
+ const fit = checkLimit(raw.replace(/\s+/g, ' ').trim(), MAX_TEXT, what, 'sent to Claude as one prompt')
+
+ return fit.ok ? null : fit.message
+}
+
+/** The Enter that was refused: says why in the result line and puts the text back in its field. Returns true when it refused. */
+function refusedLong(state: State, say: (label: string, ok: boolean, detail: string) => void, label: string, what: string, raw: string): boolean {
+ const refusal = longRefusal(raw, what)
+
+ if (refusal === null) return false
+
+ keepText(state, raw)
+ say(label, false, refusal)
+
+ return true
+}
/** The research start's inputs as typed (ADR-439): the question, the depth and the cap in dollars (text, validated when started). */
@@ -207,6 +232,7 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio
if (custom === undefined && objective.trim() === '') return say(label, false, 'type a goal first: it works on the goal')
if (custom === undefined && blocksGuidance(mc.screen)) return say(`${label} blocked`, false, `AIDefence: ${mc.screen?.detail ?? ''}. Change the goal.`)
+ // The whole goal: the arguments of a slash command are one line of the same prompt, so line breaks become spaces (the goal is one line).
const args = custom?.args ?? plain(objective, MAX_TEXT)
// It starts a model turn: asked first, with the exact command.
@@ -216,7 +242,7 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio
...(custom?.byModel === true && { byModel: true }),
scope: 'controls',
args: [],
- shows: `/${slash} ${plain(args, custom === undefined ? 100 : 200)}`,
+ shows: `/${slash} ${args}`,
expect: 'the command in the main conversation',
note: custom?.note ?? 'Starts a Claude Code turn (billed as any turn is); mid-turn it is only prepared in the prompt box.',
run: async () => {
@@ -244,6 +270,8 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio
const byModel = state.control.viaModel
const draft = { ...researchOf(state) }
const question = plain(draft.question, MAX_TEXT).trim()
+
+ if (refusedLong(state, say, 'research', 'the question', draft.question)) return
const cap = capUsd(draft.cap)
const refused = researchWhy(question, cap)
const skill = MISSION_SKILLS.find(candidate => candidate.id === 'deep-research')
@@ -264,6 +292,8 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio
const actions: MissionActions = {
goal: text => {
+ if (refusedLong(state, say, 'goal not planned', 'the goal', text)) return
+
setGoal(state, text)
mc.tab = 'plan'
mc.screen = null
@@ -304,7 +334,7 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio
mc.tab = tab
host.invalidate()
},
- create: () => runner.ask(blocksCreate(mc.screen) ? null : createSpec(state, host, () => undefined), blocksCreate(mc.screen) ? 'AIDefence flagged the goal: change it first' : 'type a goal first: the plan is made from it'),
+ create: () => runner.ask(blocksCreate(mc.screen) ? null : createSpec(state, host, () => undefined), blocksCreate(mc.screen) ? 'AIDefence flagged the goal: change it first' : (createWhy(state) ?? 'type a goal first: the plan is made from it')),
select: id => {
if (mc.missions.has(id)) mc.active = id
saveLedger(state, host)
@@ -339,6 +369,8 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio
host.invalidate()
},
aside: question => {
+ if (refusedLong(state, say, 'ask aside', 'the question', question)) return
+
const q = plain(question, MAX_TEXT).trim()
if (q === '') return say('ask aside', false, 'type a question first')
@@ -366,7 +398,10 @@ export function missionActions(state: State, host: Host, runner: Runner): Missio
launch(slashOf(skill), skill.title)
},
guide: text => {
- const t = plain(text, MAX_TEXT).trim()
+ // A prompt to the session keeps the person's own line breaks.
+ if (refusedLong(state, say, 'send Claude', 'the instruction', text)) return
+
+ const t = keepLines(text)
if (t !== '') mc.lastGuide = t
diff --git a/plugins/ruflo-console/hooks/mission-loop.ts b/plugins/ruflo-console/hooks/mission-loop.ts
index 82619c7e2e..4bd35ccf7c 100644
--- a/plugins/ruflo-console/hooks/mission-loop.ts
+++ b/plugins/ruflo-console/hooks/mission-loop.ts
@@ -4,6 +4,7 @@
* ticks that arrive carrying the mission's marker, and says when the loop is overdue, about to expire or gone.
*/
import { plain } from './data/parse'
+import { MISSION_OBJECTIVE_MAX } from './full-text'
import { DEFAULT_LOOP, type LoopPrefs } from './goap'
import type { Derived, MissionRecord } from './mission-types'
@@ -59,13 +60,14 @@ export function loopPrompt(mission: MissionRecord, prefs: LoopPrefs): string {
const push = prefs.loopPush ? 'the mission branch may be pushed to its remote' : 'do not push'
const publish = prefs.loopPublish ? 'releases or packages the mission names may be published' : 'do not publish, release or deploy'
const parts = [
- `${loopMarker(mission.id)} Mission ${idOf(mission.id)}: ${plain(mission.objective, 200)}.`,
+ `${loopMarker(mission.id)} Mission ${idOf(mission.id)}: ${plain(mission.objective, MISSION_OBJECTIVE_MAX)}.`,
'Each tick: 1 check progress against the plan; 2 fix what failed; 3 run the gates and read their real output; 4 repeat until every acceptance check passes and every gate is green on the same clean commit, then stop the loop and report.',
'Stop and ask only when a gate fails the same way three ticks running or an action would leave the branch.',
`${commit}; ${push}; ${publish}.`,
]
- return plain(parts.join(' '), 1000)
+ // The whole objective rides in the prompt (a ruflo mission's objective is at most MISSION_OBJECTIVE_MAX); the fixed checklist is the other 1,000.
+ return plain(parts.join(' '), MISSION_OBJECTIVE_MAX + 1000)
}
/** The line that starts the loop: `/loop <interval> <prompt>`, the interval well formed and never below 1m. */
diff --git a/plugins/ruflo-console/hooks/mission-options.ts b/plugins/ruflo-console/hooks/mission-options.ts
index cbb9c6ca33..7bdbe59851 100644
--- a/plugins/ruflo-console/hooks/mission-options.ts
+++ b/plugins/ruflo-console/hooks/mission-options.ts
@@ -7,6 +7,7 @@
* for a mission described. Text is data: nothing from a plugin is interpreted.
*/
import { plain } from './data/parse'
+import { ARGV_TEXT_MAX, chunksOf, LONG_TEXT_MAX } from './full-text'
import type { Host } from './host'
import { CLI_PREFIXES, type State } from './state'
import { GOALS_PLUGIN } from './mission-skills'
@@ -99,16 +100,19 @@ async function piiVerdict(state: State, host: Host, text: string): Promise<strin
* `unavailable` (the screen warns; it never blocks on a missing detector), and the text is never shown in the result.
*/
export async function screenText(state: State, host: Host, raw: string): Promise<Screen> {
- const text = plain(raw, 2_000).trim()
+ // All of the text is screened (ADR-481): a long text goes through in overlapping pieces that each fit one argv element, never only its head.
+ const text = plain(raw, LONG_TEXT_MAX).trim()
if (text === '') return { status: 'safe', detail: 'nothing to screen' }
- const [safe, pii] = await Promise.all([verdict(state, host, 'aidefence_is_safe', text), piiVerdict(state, host, text)])
+ const answers = await Promise.all(chunksOf(text, ARGV_TEXT_MAX, 200).map(async piece => ({ safe: await verdict(state, host, 'aidefence_is_safe', piece), pii: await piiVerdict(state, host, piece) })))
- if (safe?.startsWith('UNSAFE') === true) return { status: 'unsafe', detail: plain(safe, 160) }
- if (pii?.startsWith('PII FOUND') === true || safe?.startsWith('PII FOUND') === true) return { status: 'pii', detail: 'personal or secret data detected' }
- // Both detectors must answer: half an answer is not a screen.
- if (safe === null || pii === null) return { status: 'unavailable', detail: 'AIDefence did not fully answer (is @claude-flow/aidefence installed?): the text was not fully screened' }
+ const unsafe = answers.find(answer => answer.safe?.startsWith('UNSAFE') === true)
+
+ if (unsafe?.safe != null) return { status: 'unsafe', detail: plain(unsafe.safe, 160) }
+ if (answers.some(answer => answer.pii?.startsWith('PII FOUND') === true || answer.safe?.startsWith('PII FOUND') === true)) return { status: 'pii', detail: 'personal or secret data detected' }
+ // Both detectors must answer for every piece: half an answer is not a screen.
+ if (answers.some(answer => answer.safe === null || answer.pii === null)) return { status: 'unavailable', detail: 'AIDefence did not fully answer (is @claude-flow/aidefence installed?): the text was not fully screened' }
return { status: 'safe', detail: 'no threats or PII found' }
}
diff --git a/plugins/ruflo-console/hooks/mission-palette.ts b/plugins/ruflo-console/hooks/mission-palette.ts
index 888d109ef0..e576c9e87d 100644
--- a/plugins/ruflo-console/hooks/mission-palette.ts
+++ b/plugins/ruflo-console/hooks/mission-palette.ts
@@ -1,13 +1,25 @@
/** Palette entries for Mission Control, so `/ruflo run mission-next` and `/ruflo plan <goal>` work headless; a write or a turn still asks. */
import type { ActionSpec } from './actions'
import { blocksCreate } from './mission-options'
-import { activeMission, cancelSpec, createSpec, dispatchSpec, mcOf, missionWired, nextTask, setGoal } from './mission-control'
+import { keepText } from './field-keep'
+import { activeMission, cancelSpec, createSpec, createWhy, dispatchSpec, longRefusal, mcOf, missionWired, nextTask, setGoal } from './mission-control'
import type { PaletteEntry } from './palette'
import type { State } from './state'
/** `mission-auto` takes on or off in any case and nothing else: a word that is not one does not quietly mean off (#3815). */
const AUTO_WORD = /^(on|off)$/i
+/** `/ruflo plan <goal>`: plans the goal, or says by how much it is over the limit and keeps the text (it is never cut). */
+function planGoal(state: State, value: string, wired: ReturnType<typeof missionWired>): void {
+ const refusal = longRefusal(value, 'the goal')
+
+ if (refusal === null) return setGoal(state, value)
+
+ keepText(state, value)
+ mcOf(state).last = { label: 'goal not planned', ok: false, detail: refusal }
+ wired?.host.invalidate()
+}
+
export function missionPalette(state: State): PaletteEntry[] {
const wired = missionWired(state)
// `declared` is what the entry does beyond looking: Claude's call is gated on it (#3815). An entry that only queues a confirm of its own (a screened
@@ -20,9 +32,9 @@ export function missionPalette(state: State): PaletteEntry[] {
const tasks = () => state.snapshot?.tasks ?? []
return [
- { id: 'mission-goal', group: 'missions', label: 'mission-goal <goal>: plan a goal as a SPARC goal-oriented plan (nothing is written)', run: text('mission-goal', value => local('plan the goal', () => setGoal(state, value), 'write')) },
+ { id: 'mission-goal', group: 'missions', label: 'mission-goal <goal>: plan a goal as a SPARC goal-oriented plan (nothing is written)', run: text('mission-goal', value => local('plan the goal', () => planGoal(state, value, wired), 'write')) },
{ id: 'mission-status', group: 'missions', label: 'mission status: progress, each task’s status, what is next', run: spec(() => local('mission status', () => undefined)) },
- { id: 'mission-create', group: 'missions', label: 'create the mission and its tasks from the planned goal (asks first)', run: spec(() => (wired === undefined || blocksCreate(mcOf(state).screen) ? null : createSpec(state, wired.host, () => undefined))) },
+ { id: 'mission-create', group: 'missions', label: 'create the mission and its tasks from the planned goal (asks first)', run: { kind: 'spec' as const, spec: wired === undefined || blocksCreate(mcOf(state).screen) ? null : createSpec(state, wired.host, () => undefined), why: createWhy(state) ?? why } },
{
id: 'mission-next',
group: 'missions',
diff --git a/plugins/ruflo-console/hooks/mission-specs.ts b/plugins/ruflo-console/hooks/mission-specs.ts
index 90051ec619..9006342625 100644
--- a/plugins/ruflo-console/hooks/mission-specs.ts
+++ b/plugins/ruflo-console/hooks/mission-specs.ts
@@ -2,6 +2,7 @@
import type { ActionSpec } from './actions'
import { plain, type TaskRecord } from './data/parse'
import { stageOf, toMissionPlan, type Profile } from './goap'
+import { checkLimit, MISSION_OBJECTIVE_MAX } from './full-text'
import type { Host } from './host'
import { activeMission, instructionOf, mcOf, nextTask, record, rufloTaskOf, saveLedger } from './mission-control'
import type { LedgerTask, MissionRecord } from './mission-types'
@@ -31,11 +32,22 @@ export function resultOf(stdout: string): Record<string, unknown> | null {
const taskType = (profile: Profile) => (profile === 'bugfix' ? 'bugfix' : profile === 'refactor' ? 'refactor' : profile === 'research' ? 'research' : 'feature')
+/**
+ * Why the mission cannot be created from this goal, or null: the ruflo mission record takes an objective of at most MISSION_OBJECTIVE_MAX
+ * characters (mission_create's input schema), and the goal is never cut to fit (ADR-481). Checked before the ask, with the exact count.
+ */
+export function createWhy(state: State): string | null {
+ const goal = mcOf(state).goal
+ const fit = checkLimit(goal, MISSION_OBJECTIVE_MAX, 'the goal', 'the ruflo mission record takes at most that many; planning, guidance and the skills use the whole goal')
+
+ return fit.ok ? null : `${fit.message.replace(/ Nothing was sent or changed; shorten it and ask again\.$/, '')} No mission was created; ✎ edit the goal to fit.`
+}
+
/** Create the mission: `mission_create`, `mission_plan`, then a ruflo task per plan node. One confirm for the chain. */
export function createSpec(state: State, host: Host, onDone: () => void): ActionSpec | null {
const mc = mcOf(state)
- if (mc.planned === null || mc.goal === '') return null
+ if (mc.planned === null || mc.goal === '' || createWhy(state) !== null) return null
const planned = mc.planned
const goal = mc.goal
diff --git a/plugins/ruflo-console/hooks/register.ts b/plugins/ruflo-console/hooks/register.ts
index dea53ec2e3..bd5d902163 100644
--- a/plugins/ruflo-console/hooks/register.ts
+++ b/plugins/ruflo-console/hooks/register.ts
@@ -324,7 +324,7 @@ export const register: Register = (on, raw: PluginOptions) => {
state.pane.rows = Math.max(0, Math.floor(Number(e.props.scroll?.bodyRows) || 0))
- const tree = paneView({ kit: withClearing(kit, state, control.actions.clearField), state, nowMs: Date.now(), columns, pictures, act: control.actions })
+ const tree = paneView({ kit: withClearing(kit, state, control.actions.clearField, { columns, repaint: () => host?.invalidate() }), state, nowMs: Date.now(), columns, pictures, act: control.actions })
state.stats.renders.push(Date.now() - started)
if (state.stats.renders.length > 200) state.stats.renders.shift()
diff --git a/plugins/ruflo-console/hooks/views/clearing.ts b/plugins/ruflo-console/hooks/views/clearing.ts
index 946ca869ec..772720002d 100644
--- a/plugins/ruflo-console/hooks/views/clearing.ts
+++ b/plugins/ruflo-console/hooks/views/clearing.ts
@@ -1,12 +1,52 @@
-import type { Kit } from './common'
+import { takeKept } from '../field-keep'
+import { countOf, showFull, SHOW_LINES } from '../full-text'
import type { State } from '../state'
+import type { Kit } from './common'
+
+const longs = new WeakMap<State, Set<string>>()
+
+/** The keys of the fields whose text is, as last typed, longer than a line (so their echo is drawn). */
+function longOf(state: State): Set<string> {
+ let found = longs.get(state)
+
+ if (found === undefined) {
+ found = new Set()
+ longs.set(state, found)
+ }
+
+ return found
+}
+
+/** What `withClearing` needs to show a long entry in full while it is typed: the pane width and a way to redraw. */
+export type Echo = { columns: number; repaint: () => void }
+
+/**
+ * The host's Input is one line: text longer than the field scrolls out of sight. Under an Input whose text is longer than a line, the
+ * whole text is shown wrapped (ADR-481), so a person sees all of what they typed and what Enter will send. Short text changes nothing:
+ * the Input is returned as it was.
+ */
+function withEcho(kit: Kit, input: ReturnType<NonNullable<Kit['Input']>>, key: string, label: string | undefined, text: string, columns: number): ReturnType<NonNullable<Kit['Input']>> {
+ const lineWidth = Math.max(12, columns - 6)
+
+ if (countOf(text) <= Math.max(10, lineWidth - 8 - (label?.length ?? 0))) return input
+
+ const shown = showFull(text, lineWidth, { maxLines: SHOW_LINES, hint: 'all of it is still in the field above and is sent whole' })
+
+ return kit.Box({
+ key: `${key}-full`,
+ flexDirection: 'column',
+ flexGrow: 1,
+ children: [input, ...shown.lines.map(line => kit.Text({ dimColor: true, children: ` ${line}` }))],
+ })
+}
/**
* Makes every one-shot entry field clear when Enter is pressed. A field that passes its own `value` is a form field its
* caller owns (a memory key, a search the buttons beside it use) and is left alone; every other field is drawn from
* `state.fieldText`, filled as the person types and emptied after its submit, so what was entered never lingers.
+ * With `echo`, a long entry (either kind) is also shown in full under its field.
*/
-export function withClearing(kit: Kit, state: State, clear: (key: string) => void): Kit {
+export function withClearing(kit: Kit, state: State, clear: (key: string) => void, echo?: Echo): Kit {
const Input = kit.Input
if (Input === undefined) return kit
@@ -14,20 +54,37 @@ export function withClearing(kit: Kit, state: State, clear: (key: string) => voi
return {
...kit,
Input: props => {
- if (props.value !== undefined) return Input(props)
+ if (props.value !== undefined) {
+ const own = Input(props)
+
+ return echo === undefined ? own : withEcho(kit, own, props.key, props.label, props.value, echo.columns)
+ }
- return Input({
+ const current = state.fieldText.get(props.key) ?? ''
+ const drawn = Input({
...props,
- value: state.fieldText.get(props.key) ?? '',
+ value: current,
onInput: (value, e) => {
+ const wasLong = longOf(state).has(props.key)
+ const isLong = echo !== undefined && countOf(value) > Math.max(10, Math.max(12, echo.columns - 6) - 8 - (props.label?.length ?? 0))
+
state.fieldText.set(props.key, value)
+ if (isLong) longOf(state).add(props.key)
+ else longOf(state).delete(props.key)
props.onInput?.(value, e)
+ // Only a field that is, or just stopped being, long needs the echo redrawn.
+ if (echo !== undefined && (isLong || wasLong)) echo.repaint()
},
onSubmit: (value, e) => {
props.onSubmit?.(value, e)
- clear(props.key)
+ longOf(state).delete(props.key)
+ // A refused entry (over a real limit) was put back by the action: it stays for the person to edit.
+ if (takeKept(state, value)) state.fieldText.set(props.key, value)
+ else clear(props.key)
},
})
+
+ return echo === undefined ? drawn : withEcho(kit, drawn, props.key, props.label, current, echo.columns)
},
}
}
diff --git a/plugins/ruflo-console/hooks/views/full-rows.ts b/plugins/ruflo-console/hooks/views/full-rows.ts
new file mode 100644
index 0000000000..d49ab88100
--- /dev/null
+++ b/plugins/ruflo-console/hooks/views/full-rows.ts
@@ -0,0 +1,36 @@
+import type { RenderElement } from 'claude-code'
+
+import { SHOW_LINES, showFull } from '../full-text'
+import { row, text, type Ctx } from './common'
+
+type Opts = {
+ /** The key the rows are addressed by: `<key>-0`, `<key>-1`, and `<key>-more` for the marker. */
+ key: string
+ color?: string
+ bold?: boolean
+ dimColor?: boolean
+ /** What sits after the last line (an ✎ edit button), so it reads as part of the text. */
+ after?: RenderElement
+ maxLines?: number
+ /** Where the lines hidden by the marker can be read or edited; default names the ✎ edit button. */
+ hint?: string
+}
+
+/**
+ * A person's text in full (ADR-481): `lead` before the first line (`goal: `), the following lines indented to match, each wrapped to the pane's
+ * width. Beyond `maxLines` the block ends in an explicit marker with the hidden line count, never a silent cut.
+ */
+export function fullRows(ctx: Ctx, lead: string, value: string, opts: Opts): RenderElement[] {
+ const indent = ' '.repeat(lead.length)
+ const width = Math.max(12, ctx.columns - lead.length - 4)
+ const shown = showFull(value, width, { maxLines: opts.maxLines ?? SHOW_LINES, ...(opts.hint !== undefined && { hint: opts.hint }) })
+ const style = { ...(opts.color !== undefined && { color: opts.color }), ...(opts.bold === true && { bold: true }), ...(opts.dimColor === true && { dimColor: true }) }
+ const last = shown.lines.length - 1
+
+ return shown.lines.map((line, i) => {
+ const isMarker = shown.marker !== null && i === last
+ const piece = text(ctx, `${i === 0 ? lead : indent}${line}`, isMarker ? { dimColor: true } : style)
+
+ return i === last && opts.after !== undefined ? row(ctx, [piece, opts.after], `${opts.key}-${isMarker ? 'more' : i}`) : isMarker ? row(ctx, [piece], `${opts.key}-more`) : row(ctx, [piece], `${opts.key}-${i}`)
+ })
+}
diff --git a/plugins/ruflo-console/hooks/views/loops.ts b/plugins/ruflo-console/hooks/views/loops.ts
index 6aea76058d..6b26c069b6 100644
--- a/plugins/ruflo-console/hooks/views/loops.ts
+++ b/plugins/ruflo-console/hooks/views/loops.ts
@@ -2,6 +2,7 @@ import type { RenderElement } from 'claude-code'
import { INTERVALS, loopInput, loopsOf, PRESETS, TIERS } from '../loops'
import { clip, row, section, text, THEME, type Ctx } from './common'
+import { fullRows } from './full-rows'
const chip = (ctx: Ctx, key: string, label: string, isOn: boolean, onPress: () => void): RenderElement =>
ctx.kit.Button({ key, label: ` ${isOn ? '●' : 'β—‹'} ${label} `, plain: true, ...(isOn && { variant: 'primary' as const }), onPress })
@@ -40,7 +41,7 @@ export function loopRows(ctx: Ctx): RenderElement[] {
? [text(ctx, ' pick a preset above, or type a task below', { dimColor: true })]
: [
row(ctx, [text(ctx, ' every '), ...INTERVALS.map(interval => chip(ctx, `loop-int-${interval}`, interval, cfg.interval === interval, () => m.interval(interval)))], 'loop-intervals'),
- text(ctx, ` task: ${clip(cfg.task, Math.max(20, ctx.columns - 12))}`, { bold: true }),
+ ...fullRows(ctx, ' task: ', cfg.task, { key: 'loop-task-line', bold: true }),
]
return section(
@@ -54,7 +55,7 @@ export function loopRows(ctx: Ctx): RenderElement[] {
...configure,
...field(ctx, 'loop-task', '✎ task', 'what each tick should do (or /plugin:command)', 'use', value => m.task(value)),
...field(ctx, 'loop-stop', '⏹ stop', 'until 09:00 · after 12 runs · when done (optional)', 'set', value => m.stop(value)),
- text(ctx, built.ok ? ` will send: ${clip(built.text, Math.max(20, ctx.columns - 14))}` : ` not ready: ${built.why}`, { color: built.ok ? THEME.ok : THEME.warn }),
+ ...fullRows(ctx, built.ok ? ' will send: ' : ' not ready: ', built.ok ? built.text : built.why, { key: 'loop-will', color: built.ok ? THEME.ok : THEME.warn, maxLines: 12, hint: 'the whole line is sent' }),
row(
ctx,
[
diff --git a/plugins/ruflo-console/hooks/views/mission-control.ts b/plugins/ruflo-console/hooks/views/mission-control.ts
index 8f22699ce6..a1c4d82621 100644
--- a/plugins/ruflo-console/hooks/views/mission-control.ts
+++ b/plugins/ruflo-console/hooks/views/mission-control.ts
@@ -11,6 +11,7 @@ import { observationRows } from './missions'
import { loopTabRows } from './mission-claude'
import { capabilityRows, launchRows } from './mission-launch'
import { researchStartRows } from './research-start'
+import { fullRows } from './full-rows'
const GLYPH: Record<Derived, string> = { done: '●', running: '◐', ready: 'β—‹', waiting: 'Β·', failed: 'βœ–', cancelled: '⊘' }
const COLOR = (status: Derived): string => (status === 'done' ? THEME.ok : status === 'running' ? THEME.warn : status === 'failed' ? THEME.bad : status === 'ready' ? THEME.head : THEME.info)
@@ -189,7 +190,9 @@ function controlRows(ctx: Ctx, mission: MissionRecord): RenderElement[] {
const { done, total } = progressOf(mission, tasks)
const state = mission.cancelled ? 'cancelled' : mission.paused ? 'paused' : done === total ? 'complete' : 'running'
const rows: RenderElement[] = [
- text(ctx, ` ${mission.id} Β· ${clip(mission.objective, 60)} Β· ${state} Β· ${bar(done, total)} ${done}/${total}`, { bold: true, color: state === 'complete' ? THEME.ok : state === 'paused' ? THEME.info : state === 'cancelled' ? THEME.bad : THEME.head }),
+ // The status on one line; the objective under it in full (the ruflo record holds it whole).
+ text(ctx, ` ${mission.id} Β· ${state} Β· ${bar(done, total)} ${done}/${total}`, { bold: true, color: state === 'complete' ? THEME.ok : state === 'paused' ? THEME.info : state === 'cancelled' ? THEME.bad : THEME.head }),
+ ...fullRows(ctx, ' objective: ', mission.objective, { key: 'mc-objective', dimColor: true, maxLines: 12, hint: 'the ruflo mission record holds all of it' }),
row(
ctx,
[
@@ -202,7 +205,7 @@ function controlRows(ctx: Ctx, mission: MissionRecord): RenderElement[] {
),
...box(ctx, 'mc-aside', '? ask aside', 'a question about the current work: /btw answers beside the task, outside the conversation (Enter)', 'ask', value => m.aside(value)),
...box(ctx, 'mc-guide', '✎ guide Claude', 'a visible instruction to the Claude session: it asks first (Enter)', 'send', value => m.guide(value)),
- ...(mcOf(ctx.state).lastGuide === '' ? [] : [row(ctx, [text(ctx, ` last: ${clip(mcOf(ctx.state).lastGuide, Math.max(20, ctx.columns - 24))} `, { dimColor: true }), button(ctx, 'mc-edit-guide', '✎ edit', () => ctx.act.editField('mc-guide', mcOf(ctx.state).lastGuide))], 'mc-guide-line')]),
+ ...(mcOf(ctx.state).lastGuide === '' ? [] : fullRows(ctx, ' last: ', mcOf(ctx.state).lastGuide, { key: 'mc-guide-line', dimColor: true, after: button(ctx, 'mc-edit-guide', '✎ edit', () => ctx.act.editField('mc-guide', mcOf(ctx.state).lastGuide)) })),
...confirmHere(ctx, 'guide'),
]
@@ -224,16 +227,16 @@ export function missionControlView(ctx: Ctx): RenderElement {
const mission = activeMission(ctx.state)
const rows: RenderElement[] = [rule(ctx, 'Mission Control', mission === null ? 'goal β†’ SPARC plan β†’ tasks β†’ Claude' : `${mission.id.slice(0, 12)}…`)]
- rows.push(...box(ctx, 'mc-goal', '✎ goal', mc.goal === '' ? 'what should get done? e.g. add a dark mode toggle to settings (Enter plans it)' : `planned: ${clip(mc.goal, 60)} β€” type another goal to re-plan`, 'plan', value => ctx.act.mission.goal(value)))
+ rows.push(...box(ctx, 'mc-goal', '✎ goal', mc.goal === '' ? 'what should get done? e.g. add a dark mode toggle to settings (Enter plans it)' : 'a planned goal is below β€” type another goal to re-plan', 'plan', value => ctx.act.mission.goal(value)))
- if (mc.goal !== '') rows.push(row(ctx, [text(ctx, ` goal: ${clip(mc.goal, Math.max(20, ctx.columns - 24))} `, { bold: true }), button(ctx, 'mc-edit-goal', '✎ edit', () => ctx.act.editField('mc-goal', mc.goal))], 'mc-goal-line'))
+ if (mc.goal !== '') rows.push(...fullRows(ctx, ' goal: ', mc.goal, { key: 'mc-goal-line', bold: true, after: button(ctx, 'mc-edit-goal', '✎ edit', () => ctx.act.editField('mc-goal', mc.goal)) }))
rows.push(...launchRows(ctx), ...researchStartRows(ctx))
if (mc.missions.size > 1) rows.push(row(ctx, [...mc.missions.values()].slice(-6).map(candidate => chip(ctx, `mc-pick-${candidate.id}`, candidate.id.slice(4, 10), candidate.id === mc.active, () => ctx.act.mission.select(candidate.id))), 'mc-picker'))
if (mission !== null) rows.push(...controlRows(ctx, mission))
- if (mc.last !== null) rows.push(text(ctx, ` ${mc.last.ok ? 'βœ“' : 'βœ—'} ${mc.last.label}${mc.last.detail === '' ? '' : ` β€” ${mc.last.detail}`}`, { color: mc.last.ok ? THEME.ok : THEME.bad }))
+ if (mc.last !== null) rows.push(...fullRows(ctx, ` ${mc.last.ok ? 'βœ“' : 'βœ—'} `, `${mc.last.label}${mc.last.detail === '' ? '' : ` β€” ${mc.last.detail}`}`, { key: 'mc-last', color: mc.last.ok ? THEME.ok : THEME.bad, maxLines: 12, hint: 'your text is still in its field' }))
rows.push(row(ctx, TABS.filter(tab => mission !== null || tab.id === 'plan' || tab.id === 'record').map(tab => chip(ctx, `mc-tab-${tab.id}`, tab.label, mc.tab === tab.id, () => ctx.act.mission.tab(tab.id))), 'mc-tabs'))
diff --git a/plugins/ruflo-console/hooks/views/research-start.ts b/plugins/ruflo-console/hooks/views/research-start.ts
index 0dfcbc8295..dd1dc0f628 100644
--- a/plugins/ruflo-console/hooks/views/research-start.ts
+++ b/plugins/ruflo-console/hooks/views/research-start.ts
@@ -19,7 +19,7 @@ export function researchStartRows(ctx: Ctx): RenderElement[] {
const rows = [rule(ctx, 'Deep research', 'asks first Β· capped')]
if (ctx.kit.Input !== undefined) {
- rows.push(ctx.kit.Input({ key: 'research-question', label: 'question', value: draft.question, placeholder: 'what should it find out?', submitLabel: 'ask', onInput: value => setResearch(state, { question: value.slice(0, 500) }), onSubmit: value => { setResearch(state, { question: value.slice(0, 500) }); start() } }))
+ rows.push(ctx.kit.Input({ key: 'research-question', label: 'question', value: draft.question, placeholder: 'what should it find out?', submitLabel: 'ask', onInput: value => setResearch(state, { question: value }), onSubmit: value => { setResearch(state, { question: value }); start() } }))
}
rows.push(row(ctx, [text(ctx, ' depth ', { dimColor: true }), ...RESEARCH_DEPTHS.map(depth => pick(`research-depth-${depth}`, depth, draft.depth === depth, () => { setResearch(state, { depth }); redraw() }))], 'research-depth'))