Add Ask a question to a stopped loop and stop the agent on Back to the dashboard

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-04 20:13:43 -08:00
1 parent 81d14c8e78
commit 7f95dabd00
10 files changed
+226 -11

No files matched your search

+1 -1
View File
@@ -63,7 +63,7 @@ export function wireLoopMessages(store, redraw) {
store.loopNotifyTest = { waiting: false, ok: data.ok === true, sent: data.sent === true, error: data.ok === true ? null : String(data.error || "The app could not send the test.") };
redraw();
});
for (const kind of ["loop-resume-result", "loop-fix-result", "loop-finalize-result", "loop-dashboard-result"]) {
for (const kind of ["loop-resume-result", "loop-ask-result", "loop-fix-result", "loop-finalize-result", "loop-dashboard-result"]) {
onAppMessage(kind, (data) => {
store.loopAction = { kind, ok: data.ok === true, error: data.ok === true ? null : String(data.error || "The app could not do that.") };
redraw();
+16 -5
View File
@@ -617,6 +617,14 @@ async function decideChat(re, decision, text) {
redraw();
}
// A stopped loop's screen, with its Ask a question button on offer: its agent
// is gone, so a note here would reach nobody, and the panel says how to ask.
const askOffered = () => {
const end = page.S && page.S.loopEnd;
return Boolean(end && end.kind !== "finished" && Array.isArray(end.can) && end.can.includes("ask") && !finish());
};
const ASK_HINT = "Press Ask a question to wake an agent, then ask in the Ask tab.";
export function renderAside() {
const aside = $("aside");
// Redrawing empties the panel, which drops its scroll to the top. An image
@@ -630,7 +638,7 @@ export function renderAside() {
const item = page.view === "end" ? null : byId(page.selected);
if (!item) {
// The menu has no questions, so no notes either: the pane stays empty.
if (!isDashboard()) aside.appendChild(el("p", "aside-empty", "Pick a question to see its notes."));
if (!isDashboard()) aside.appendChild(el("p", "aside-empty", askOffered() ? ASK_HINT : "Pick a question to see its notes."));
return;
}
// Off the question's own page (a doc tab, Ask) "this" points at nothing on
@@ -644,9 +652,11 @@ export function renderAside() {
el(
"p",
"aside-empty",
isOpen(item) && !finish()
? "No back and forth yet. Anything you type here goes with your next send."
: "Nothing was said about this one."
askOffered()
? ASK_HINT
: isOpen(item) && !finish()
? "No back and forth yet. Anything you type here goes with your next send."
: "Nothing was said about this one."
)
);
}
@@ -689,7 +699,8 @@ export function renderAside() {
// A finished session has nobody left for a note to reach, so the box would
// be a place to type words that go nowhere.
if (!isOpen(item) || finish()) {
// A stopped loop has no agent either, even with a question left open.
if (!isOpen(item) || finish() || askOffered()) {
aside.scrollTop = place;
return;
}
+1
View File
@@ -162,6 +162,7 @@ function closeGuideHeld() {
let loopPressed = null;
const LOOP_BUTTONS = [
["ask", "loop-ask", "Ask a question", ""],
["resume", "loop-resume", "Resume the loop", "primary"],
["fix", "loop-fix", "Fix it by hand", ""],
["finalize", "loop-finalize", "Finalize", "primary"],