Compare commits

...
3 Commits
Author SHA1 Message Date
tben aef7169173 Release 0.27.10
CI / check (push) Canceled after 0s
Release image / image (release) Canceled after 0s
Release image / computer-image (release) Canceled after 0s
2026-11-23 07:33:39 +01:00
tben 712145582e Test that an active plan marks a reply due 2026-11-23 07:32:23 +01:00
tben 1b26c5b42f Stand the thinking row at once when a plan is approved 2026-11-23 07:26:44 +01:00
4 changed files with 57 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cobble",
"version": "0.27.9",
"version": "0.27.10",
"module": "index.ts",
"type": "module",
"private": true,
@@ -1,6 +1,7 @@
import isCrewMessage from "@/src/utils/is-crew-message";
import { lazy, Suspense, useContext, useEffect, useMemo, useRef, useState } from "react";
import awaitsReply from "../(utils)/awaits-reply";
import planMarksReplyDue from "../(utils)/plan-marks-reply-due";
import Stack from "@moduletrace/twui/layout/Stack";
import type { BotMessageReactionEmoji } from "@/src/dict/bot-dict";
import type {
@@ -336,7 +337,19 @@ export default function Conversation() {
on_open_jobs: () => setOpenReplyJobs(1),
});
useSessionPlan({ session_id, on_change: setSessionPlan });
/**
* An active plan has a step reply on its way, queued by the app with no
* user message before it: mark it due here so the thinking row stands at
* once instead of waiting for the run's first step push.
*/
useSessionPlan({
session_id,
on_change: (plan) => {
setSessionPlan(plan);
if (planMarksReplyDue({ plan })) setOpenReplyJobs(1);
},
});
/**
* The thread's pull-to-reload: the page's crew read again (the layout
@@ -0,0 +1,26 @@
import { describe, expect, test } from "bun:test";
import type { BotPlanView } from "@/src/types";
import planMarksReplyDue from "./plan-marks-reply-due";
const plan = (status: BotPlanView["status"]) => ({ id: 7, status }) as BotPlanView;
describe("planMarksReplyDue", () => {
test("a plan that started has a step reply on its way", () => {
expect(planMarksReplyDue({ plan: plan("active") })).toBe(true);
});
test("approving is what starts it: one waiting for the user does not", () => {
expect(planMarksReplyDue({ plan: plan("planned") })).toBe(false);
});
test("a plan stopped between steps has nothing on its way", () => {
expect(planMarksReplyDue({ plan: plan("paused") })).toBe(false);
expect(planMarksReplyDue({ plan: plan("done") })).toBe(false);
expect(planMarksReplyDue({ plan: plan("cancelled") })).toBe(false);
});
test("no plan in the conversation at all is no reply", () => {
expect(planMarksReplyDue({ plan: null })).toBe(false);
expect(planMarksReplyDue({})).toBe(false);
});
});
@@ -0,0 +1,16 @@
import type { BotPlanView } from "@/src/types";
type Params = {
plan?: BotPlanView | null;
};
/**
* Whether this plan change means a reply is on its way in its conversation.
* An active plan is one the app advances by itself: approving it, picking it
* back up or finishing a step queues the next step with no user message
* before it, so the thread must show the thinking row at once instead of
* waiting for the run's first step push.
*/
export default function planMarksReplyDue({ plan }: Params) {
return plan?.status == "active";
}