diff --git a/apps/host/server/agent/agent-bridge.mjs b/apps/host/server/agent/agent-bridge.mjs index d91cc67e..542ccace 100644 --- a/apps/host/server/agent/agent-bridge.mjs +++ b/apps/host/server/agent/agent-bridge.mjs @@ -647,7 +647,7 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir = emit(stepFrame(now, index)); emit(publishPlan('step', now)); const st = now.steps[index]; - reporter.set({ phase: 'goal', code: 'goal-step', text: stepLine(index, now.steps.length, st.text, 'started'), key: 'Step {0} of {1}: {2}', values: [index + 1, now.steps.length, st.text], args: { step: index + 1, steps: now.steps.length } }); + reporter.set({ phase: 'goal', code: 'goal-step', text: stepLine(index, now.steps.length, st.text, 'started'), key: '{0}', values: [st.text], args: { step: index + 1, steps: now.steps.length } }); } /** One goal step finished: say so, hand over queued messages, and begin the next step (or end the plan). */ diff --git a/apps/host/server/agent/plan.mjs b/apps/host/server/agent/plan.mjs index 2c7e372f..68ac9312 100644 --- a/apps/host/server/agent/plan.mjs +++ b/apps/host/server/agent/plan.mjs @@ -124,9 +124,9 @@ export function stepObjective(plan, index) { } const WORD = { started: 'started', done: 'done', failed: "didn't finish", stopped: 'stopped', skipped: 'skipped' }; -/** One short friendly line for a step: "Step 2 of 4: Write the roof — done". */ +/** One short friendly line for a step: "Write the roof — done" (no step counter: the owner removed it). */ export function stepLine(index, total, text, state) { - return `Step ${index + 1} of ${total}: ${clip(clean(text), 90)} — ${WORD[state] ?? state}`; + return `${clip(clean(text), 90)} — ${WORD[state] ?? state}`; } /** The short summary of a step from the words it closed with: the first sentence, plain. */ diff --git a/apps/host/src/components/TimeSkipWorking.tsx b/apps/host/src/components/TimeSkipWorking.tsx index e45c8ae6..5b22a466 100644 --- a/apps/host/src/components/TimeSkipWorking.tsx +++ b/apps/host/src/components/TimeSkipWorking.tsx @@ -36,7 +36,7 @@ const laneFraction = (l: ForkLane | null | undefined) => (l && l.total > 0 ? Mat function Lane({ name, lane, waitingText }: { name: string; lane: ForkLane | null | undefined; waitingText: string }) { const pct = Math.round(laneFraction(lane) * 100); - const words = !lane ? waitingText : lane.waiting ? waitingText : lane.line || (lane.text ? tr('Step {0} of {1}: {2}', [lane.step, lane.total, lane.text]) : tr('Starting…')); + const words = !lane ? waitingText : lane.waiting ? waitingText : lane.line || (lane.text ? lane.text : tr('Starting…')); return
{name}
diff --git a/apps/host/tests/agent-plan-run.test.mjs b/apps/host/tests/agent-plan-run.test.mjs index 4a40a6c9..4c372e9d 100644 --- a/apps/host/tests/agent-plan-run.test.mjs +++ b/apps/host/tests/agent-plan-run.test.mjs @@ -63,7 +63,7 @@ test('Start as goal: each plan step is a goal step, reported one by one, queued const stepFrames = out.filter(f => f.type === 'plan-step').map(f => `${f.index}:${f.state}`); assert.deepEqual(stepFrames, ['1:running', '1:done', '2:running', '2:done', '3:running', '3:done']); const lines = words(out); - assert.match(lines, /Step 1 of 3: First thing SCRIPT:goalstep — done/); assert.match(lines, /Step 3 of 3: Third thing SCRIPT:goalstep — done/); + assert.match(lines, /First thing SCRIPT:goalstep — done/); assert.match(lines, /Third thing SCRIPT:goalstep — done/); assert.ok(out.find(f => f.type === 'plan-step' && f.state === 'done').summary, 'a done step carries a short summary from its closing words'); const goals = out.filter(f => f.type === 'goal' && f.goal); assert.ok(goals.some(f => f.goal.step?.index === 2 && f.goal.step.total === 3 && f.goal.objective === plan.title), 'the goal bar knows the step and shows the plan title'); @@ -84,7 +84,7 @@ test('a goal with numbered points runs point by point and reports each one', { s await r.bridge.goalCommand({ ...r.base('p3', f => out.push(f)), line: 'Make the page: 1. draw the base SCRIPT:goalstep 2. add the roof SCRIPT:goalstep' }); const plan = r.bridge.planState('p3'); assert.equal(plan.source, 'goal'); assert.equal(plan.title, 'Make the page'); assert.equal(plan.state, 'done'); - assert.match(words(out), /Step 1 of 2: draw the base SCRIPT:goalstep — done/); assert.match(words(out), /Step 2 of 2: add the roof SCRIPT:goalstep — done/); + assert.match(words(out), /draw the base SCRIPT:goalstep — done/); assert.match(words(out), /add the roof SCRIPT:goalstep — done/); }); test('a message typed while a goal without points runs is queued, can be taken back, and is handed back when the goal is stopped', { skip }, async (t) => { diff --git a/apps/host/tests/agent-plan.test.mjs b/apps/host/tests/agent-plan.test.mjs index 2ce90ab3..35f03028 100644 --- a/apps/host/tests/agent-plan.test.mjs +++ b/apps/host/tests/agent-plan.test.mjs @@ -52,8 +52,8 @@ test('a step goal names its step, what is done and what is not its job', () => { const o = stepObjective(plan, 1); assert.match(o, /step 2 of 3: Write it \(one file\)/); assert.match(o, /Already done: 1\. Look/); assert.match(o, /do not start them/); assert.ok(!/do not start/.test(stepObjective(plan, 2))); - assert.equal(stepLine(1, 4, 'Build the roof', 'done'), 'Step 2 of 4: Build the roof — done'); - assert.equal(stepLine(0, 4, 'x', 'failed'), "Step 1 of 4: x — didn't finish"); + assert.equal(stepLine(1, 4, 'Build the roof', 'done'), 'Build the roof — done'); + assert.equal(stepLine(0, 4, 'x', 'failed'), "x — didn't finish"); assert.equal(firstSentence('## Done\n\nThe roof is built and tiled. Then I checked it.'), 'The roof is built and tiled.'); assert.equal(firstSentence(' '), null); }); diff --git a/apps/host/tests/timeskip-fork.test.mjs b/apps/host/tests/timeskip-fork.test.mjs index 10d783db..3a336e45 100644 --- a/apps/host/tests/timeskip-fork.test.mjs +++ b/apps/host/tests/timeskip-fork.test.mjs @@ -67,7 +67,7 @@ test('plan -> lever (with its why) -> A runs every step -> B forks after step 1 const phases = r.events.map(e => e.phase); assert.ok(phases.indexOf('checkpointing') < phases.indexOf('generating') && phases.indexOf('generating') < phases.indexOf('completed')); assert.ok(r.events.some(e => e.lever && e.lever.step === 2), 'the lever and its reason were sent'); - assert.ok(r.events.some(e => e.a?.line && /Step 1 of 3/.test(e.a.line)) && r.events.some(e => e.b?.line && /Step 1 of 2/.test(e.b.line)), "A's and B's progress were sent"); + assert.ok(r.events.some(e => e.a?.line && / — /.test(e.a.line)) && r.events.some(e => e.b?.line && / — /.test(e.b.line)), "A's and B's progress were sent"); assert.ok(r.events.some(e => /^B, /.test(e.activity?.text ?? '')), 'the activity line names B'); // B was copied from A at the fork and got the context attachment; the project is untouched assert.ok(existsSync(join(r.dir, 'ts', run.id, 'B', '.timeskip', 'context.md')));