Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Time-skip: each step runs in its own agent session (the folder carries the work), so a small window never fills up across a long plan
Niko1221f11768e87330
diff --git a/apps/host/server/agent/agent-bridge.mjs b/apps/host/server/agent/agent-bridge.mjsindex 36ea31a66..f91d381df 100644--- a/apps/host/server/agent/agent-bridge.mjs+++ b/apps/host/server/agent/agent-bridge.mjs@@ -576,6 +576,8 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =await deliverQueued(at + 1);if (turn.stopping || turn.finished) return true;if (next < 0) return false;+ // One step per turn (Time-skip): the plan stays open for the next step, which starts in a session of its own so the conversation never grows across steps.+ if (run.once) { plans.update(chatId, p => { p.state = 'approved'; }); emit(publishPlan('step', plans.get(chatId))); return false; }await startStep(plans.get(chatId), next);void announceGoal();return true;@@ -673,7 +675,7 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =if (planRun) {const plan = plans.get(chatId);if (!plan || plan.id !== planRun.planId) throw new AgentUnavailable('That plan is no longer there. Ask for a new one with /plan.', 'plan-gone');- turn.plan = { id: plan.id };+ turn.plan = { id: plan.id, once: !!planRun.once };const at = currentStep(plan);if (at < 0) throw new AgentUnavailable('Every step of this plan is already done.', 'plan-done');if (goal.action === 'resume' && plan.goalStarted) {@@ -936,7 +938,13 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =if (tools()?.off?.has('goals')) return sayOnce(options, 'Goals are turned off. You can turn them back on in Settings, Tools.');plans.update(chatId, p => { p.state = 'approved'; });onPlan(chatId, 'approved', planView(plans.get(chatId)));- return runTurn({ ...options, goal: { action: 'create', objective: plan.title }, planRun: { planId: plan.id } });+ return runTurn({ ...options, goal: { action: 'create', objective: plan.title }, planRun: { planId: plan.id, once: options.once === true } });+ }++ /** Forget the chat's agent session (not its plan): the next turn starts a fresh one in the same folder. */+ function resetSession(chatId) {+ if (chats.get(chatId)?.turn || chats.get(chatId)?.starting) throw new AgentUnavailable('This chat is still working.', 'turn-active');+ delete sessionMap[chatId]; persist();}// -- messages typed while a goal runs ----------------------------------------------------------------------@@ -1075,7 +1083,7 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =/** Let go of a chat's Harness session mapping (a task starts every run in a session of its own). */function forget(chatId) { if (chats.get(chatId)?.turn) return; delete sessionMap[chatId]; chats.delete(chatId); persist(); }- return { goalState, goalControl, harnessDir, status, runTurn, goalCommand, planCommand, researchCommand, llmTarget, setPlanBriefing, planGoal, planControl, planState, queueMessage, cancelQueued, takeQueue, forget, approve, setMode, stop, pendingFor, close, sessionOf: chatId => sessionMap[chatId]?.sessionId ?? null, isRunning: chatId => !!chats.get(chatId)?.turn, _debug: () => ({ rt, sessionMap }) };+ return { goalState, goalControl, harnessDir, status, runTurn, goalCommand, planCommand, researchCommand, llmTarget, setPlanBriefing, resetSession, planGoal, planControl, planState, queueMessage, cancelQueued, takeQueue, forget, approve, setMode, stop, pendingFor, close, sessionOf: chatId => sessionMap[chatId]?.sessionId ?? null, isRunning: chatId => !!chats.get(chatId)?.turn, _debug: () => ({ rt, sessionMap }) };}/** A goal that stopped by itself, in words. */diff --git a/apps/host/server/agent/plan.mjs b/apps/host/server/agent/plan.mjsindex c544a1e4a..27db8b9e0 100644--- a/apps/host/server/agent/plan.mjs+++ b/apps/host/server/agent/plan.mjs@@ -108,7 +108,7 @@ export function parsePoints(objective) {/** The goal the Harness runs for step `index` (0-based): one step, with the aim and the steps around it named. */export function stepObjective(plan, index) {const n = plan.steps.length; const s = plan.steps[index];- const done = plan.steps.slice(0, index).map((x, i) => `${i + 1}. ${x.text}`).join('; ');+ const done = plan.steps.slice(0, index).map((x, i) => `${i + 1}. ${x.text}${x.summary ? ' (' + String(x.summary).slice(0, 100) + ')' : ''}`).join('; ');return [`Overall aim: ${plan.title}.`,`You are on step ${index + 1} of ${n}: ${s.text}${s.detail ? ` (${s.detail})` : ''}.`,diff --git a/apps/host/server/timeskip-fork.mjs b/apps/host/server/timeskip-fork.mjsindex 5b62771f7..a90ad3cee 100644--- a/apps/host/server/timeskip-fork.mjs+++ b/apps/host/server/timeskip-fork.mjs@@ -146,12 +146,17 @@ export function createForkTimeskip({ agent, dir, notify = () => {}, now = Date.nagent.planControl({ chatId: bChat, planId: bp.id, action: 'approve' });r.b.plan = bp.steps.map(s => ({ id: s.id, text: s.text }));r.b.state = 'running'; r.b.total = bp.steps.length; announce(r);- await agent.planGoal({ chatId: bChat, planId: bp.id, workspacePath: r.b.root, mode: 'bypass', choice, thinking,- onFrame: f => {- if (f.type === 'plan-step') { r.b.step = f.index; r.b.total = f.total; r.b.text = f.text; r.b.line = f.line; say(r, 'b-step', `B, ${f.line}`, { step: f.index, steps: f.total }); }- } });+ for (let at = 0; at < bp.steps.length && !stopped(); at++) {+ agent.resetSession(bChat);+ await agent.planGoal({ chatId: bChat, planId: bp.id, once: true, workspacePath: r.b.root, mode: 'bypass', choice, thinking,+ onFrame: f => {+ if (f.type === 'error') r.b.note = String(f.message ?? '').slice(0, 240);+ if (f.type === 'plan-step') { r.b.step = f.index; r.b.total = f.total; r.b.text = f.text; r.b.line = f.line; say(r, 'b-step', `B, ${f.line}`, { step: f.index, steps: f.total }); }+ } });+ if (agent.planState(bChat)?.steps[at]?.state !== 'done') break;+ }const end = agent.planState(bChat);- r.b.state = end?.state === 'done' ? 'done' : 'failed';+ r.b.state = end?.steps.every(x => x.state === 'done') ? 'done' : 'failed';if (r.b.state === 'failed') r.b.note = stopped() ? 'Stopped.' : 'B did not finish, so only A is shown.';announce(r);};@@ -172,19 +177,28 @@ export function createForkTimeskip({ agent, dir, notify = () => {}, now = Date.nr.b ??= {};if (r.lever) { r.b = { state: 'pending', root: join(dir, r.id, 'B'), waiting: slots < 2 }; }r.a.state = 'running'; r.a.total = plan.steps.length; setPhase(r, 'generating'); announce(r);- await agent.planGoal({ chatId: aChat, planId: plan.id, workspacePath: r.a.root, mode: 'bypass', choice, thinking,- onFrame: f => {- if (f.type === 'error') r.a.note = String(f.message ?? '').slice(0, 240);- if (f.type === 'goal' && f.goal) r.a.goal = { phase: f.goal.phase, blocked: f.goal.blocked ?? null, round: f.goal.round };- if (f.type === 'plan-step') {- r.a.step = f.index; r.a.total = f.total; r.a.text = f.text; r.a.line = f.line;- if (f.state === 'done') { r.a.summaries.push(`${f.index}. ${f.text}${f.summary ? ': ' + f.summary : ''}`); if (r.lever && f.index === r.lever.step - 1) { try { forkNow(); } catch (e) { r.b = { ...r.b, state: 'failed', note: 'B could not be prepared, so only A is shown.' }; } } }- say(r, 'a-step', `A, ${f.line}`, { step: f.index, steps: f.total });- }- } });+ // Each step is its own turn in its own agent session (the folder carries the work from step to step): a small model window never fills up+ // across a long plan. The fork happens between two steps, so B gets exactly the files of the finished steps.+ for (let at = 0; at < plan.steps.length && !stopped(); at++) {+ agent.resetSession(aChat);+ await agent.planGoal({ chatId: aChat, planId: plan.id, once: true, workspacePath: r.a.root, mode: 'bypass', choice, thinking,+ onFrame: f => {+ if (f.type === 'error') r.a.note = String(f.message ?? '').slice(0, 240);+ if (f.type === 'goal' && f.goal) r.a.goal = { phase: f.goal.phase, blocked: f.goal.blocked ?? null, round: f.goal.round };+ if (f.type === 'plan-step') {+ r.a.step = f.index; r.a.total = f.total; r.a.text = f.text; r.a.line = f.line;+ if (f.state === 'done') r.a.summaries.push(`${f.index}. ${f.text}${f.summary ? ': ' + f.summary : ''}`);+ say(r, 'a-step', `A, ${f.line}`, { step: f.index, steps: f.total });+ }+ } });+ if (stopped()) return;+ const now = agent.planState(aChat);+ if (!now || now.steps[at]?.state !== 'done') break;+ if (r.lever && at + 1 === r.lever.step - 1) { try { forkNow(); } catch (e) { r.b = { ...r.b, state: 'failed', note: 'B could not be prepared, so only A is shown.' }; } }+ }if (stopped()) return;const aEnd = agent.planState(aChat);- r.a.state = aEnd?.state === 'done' ? 'done' : 'failed';+ r.a.state = aEnd?.state === 'done' || aEnd?.steps.every(x => x.state === 'done') ? 'done' : 'failed';announce(r);if (r.a.state !== 'done') throw new Error('A did not finish the plan' + (r.a.note ? ' (' + r.a.note + ')' : r.a.goal?.blocked ? ' (' + r.a.goal.blocked + ')' : '') + ', so there is nothing to compare. Your files were not changed.');if (r.lever && !forked) { forkNow(); }