Add Ask for suggestions chip, thread tag, stale-pick pruning and agent line

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-04 12:39:16 -08:00
1 parent f8a0a6bfc7
commit bc2c7c6c41
21 files changed
+228 -4

No files matched your search

+2
View File
@@ -39,6 +39,8 @@ With nothing to post, `node "<CONSOLE>" wait --session <sid> --seconds 240` wait
`reply` is what they would have typed: one line per question, parts joined with `; `. Act on it as their typed answer, in that turn, with no summary back. Open every `Image:` and `File:` path in it with your file-read tool before you answer.
A `Suggestions wanted on <title>:` line asks your recommendation for that item: reply in its `thread`, list each suggestion and why, and re-post the item (reworded, `recommended`) only when that helps.
Other fields, when present: `session` (actions about the session, dispatch on `i`: `__launch` and `__pickup` run `resume`, then read `skillFile` and follow it in this conversation; `__stop`, `__dashboard`, `__commit`, `__changelog`, `__delete`, `__brief`, `__review`, `__done`, `__git` are covered by the topic file `read` names, or by your notes), `chat` (the seq numbers of Quick questions that need a reply), `read` (open each path now, before acting), `resume`, `skillFile`, `handoffFile`, `fallback` (hop fields: run `resume` as given).
## A patch
+7
View File
@@ -1819,6 +1819,13 @@
answer and a note together. Plan2Code's replies appear in the same
panel.
</p>
<p>
On a question with options to pick, <strong>Ask for suggestions</strong>
asks Plan2Code what it would pick and why, on its own: anything you
already ticked stays as it is, and anything typed in the note box goes
along with it. The answer appears in the same panel, and sometimes the
question comes back reworded.
</p>
<h4>Attaching a file</h4>
<p>Three ways, whichever is handiest:</p>
<ul>
+33 -1
View File
@@ -11,6 +11,7 @@ import { attachMentions } from "../mention-box.js";
import { makeMdField } from "../md-field.js";
import { pickerAccept, attachmentKind, noteAwaiting, threadWho, threadText } from "../answers.js";
import { postJson } from "../net.js";
import { suggestState } from "../send-state.js";
import { CHECKIN_LINE, helperRows, showSwitch, switchLabel, defaultInstruction, PATHFINDER_RESEARCH_LINE, STRENGTHS, DEFAULT_STRENGTH, STRENGTH_HELP } from "../subagents.js";
const $ = (id) => document.getElementById(id);
@@ -665,6 +666,7 @@ export function renderAside() {
if (pending) who.appendChild(el("span", null, "Sent, waiting for Plan2Code"));
else if (m.at) who.appendChild(el("span", null, shortTime(m.at)));
box.appendChild(who);
if (m.suggest === true) box.appendChild(suggestTag());
const text = threadText(m);
if (text) box.appendChild(md(text, "md"));
const tray = mine ? sentAttachments(m) : null;
@@ -678,6 +680,7 @@ export function renderAside() {
who.appendChild(el("span", null, "You"));
who.appendChild(el("span", null, "Sent, waiting for Plan2Code"));
box.appendChild(who);
if (waiting.suggest === true) box.appendChild(suggestTag());
if (waiting.text) box.appendChild(md(waiting.text, "md"));
const tray = sentAttachments(waiting);
if (tray) box.appendChild(tray);
@@ -698,7 +701,9 @@ export function renderAside() {
wrap.appendChild(label);
const attached = noteImages(item.id);
wrap.appendChild(attachRow(item.id, "Add files to this note"));
const row = attachRow(item.id, "Add files to this note");
if (!loopDriving() && !isDashboard() && SUGGEST_KINDS.includes(item.kind)) row.appendChild(suggestChip(item));
wrap.appendChild(row);
if (attached.length) wrap.appendChild(attachTray(item.id, attached));
@@ -727,6 +732,33 @@ export function renderAside() {
aside.scrollTop = place;
}
// The cards with options to pick from, where asking what Plan2Code would pick
// makes sense.
const SUGGEST_KINDS = ["choice", "multi", "confirm"];
// Ask for suggestions: its own send, beside the main one (core.js). Focus
// stays in the panel: on the chip when it is live again, else the note box.
function suggestChip(item) {
const st = suggestState(item);
const chip = el("button", "btn tiny suggest-chip", "Ask for suggestions");
chip.type = "button";
chip.id = "suggest-" + item.id;
chip.setAttribute("aria-label", "Ask Plan2Code for suggestions on this question");
chip.title = st.why;
chip.disabled = st.disabled;
chip.addEventListener("click", async () => {
await hooks.askSuggestions(item.id);
const again = $("suggest-" + item.id);
if (again && !again.disabled) again.focus();
else $("thread-" + item.id)?.field?.focus();
});
return chip;
}
function suggestTag() {
return el("span", "pill suggest-tag", "Asked for suggestions");
}
// The helpers the agent reported, as it last posted them. Everything here is
// the agent's text, so it goes in as text, never as markup.
export function renderSubagents(main) {
+13
View File
@@ -28,6 +28,7 @@ import {
noteAction,
noteReplyLines,
progressTotal,
pruneStaged,
recordedAnswer,
sentAnswer,
staleLaunchFeedback,
@@ -464,6 +465,18 @@ export function adopt(body) {
delete page.local.sent[id];
}
}
// A re-posted card can drop or rekey an option a pick was staged on: that
// pick goes, and the person is told which question lost it.
const pruned = pruneStaged(page.S.items || [], page.local.staged);
if (pruned.dropped.length) {
page.local.staged = pruned.staged;
save();
const titles = pruned.dropped.map((id) => (byId(id) && byId(id).title) || id).join(", ");
const line = `A pick on ${titles} no longer matches the reworded question, so it was cleared.`;
banner(line, "info");
clearTimeout(arrivalBannerTimer);
arrivalBannerTimer = setTimeout(() => !page.gone && $("banner").textContent === line && banner(null), 8000);
}
// A retracted send suppresses exactly that send. Once the item moves --
// settled, sent again (a new `at`), or answered by an agent reply -- the
// mark is stale and keeping it would hide a send that is not that one.
+5
View File
@@ -417,6 +417,11 @@ h1 {
.attach-row { display: flex; align-items: center; margin: -4px 0 6px -13px; }
.attach-row.is-under { margin: 6px 0 4px -13px; }
.attach-row .suggest-chip { margin: 0 0 0 auto; }
.msg .suggest-tag {
display: inline-block; margin-bottom: 4px;
background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line);
}
.attach-tray { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.attach-thumb {
position: relative;
+3 -2
View File
@@ -1369,10 +1369,11 @@ function submit(req, res, ctx) {
}
// Name the items that went. A page with OTHER answers staged should drop
// only what was sent, and a brief request is a submit carrying no answers
// at all, so a blanket "everything is gone" is wrong for both.
// at all, so a blanket "everything is gone" is wrong for both. A request
// for suggestions sends no answer, so the pick staged on its card stays.
ctx.broadcast("submitted", {
rev: ctx.rev,
ids: body.actions.map((a) => a && a.i).filter(Boolean),
ids: body.actions.filter((a) => a && !(a.type === "comment" && a.suggest === true)).map((a) => a.i).filter(Boolean),
});
ctx.pushState();
return json(res, 200, { ok: true });