agent: per-session todo queue (todo tool, pinned TODO section, GUI panel)
Persistent task list (pending/doing/done) with never-reused seq from a per-session high-water mark; open items injected as a dynamic TODO section with pre-warm-on-change; read-only GUI panel + i18n; TOOL_USE manual extended. Docs updated; agent-feedback memory Q&A exchange and AGENT_RULES seed rules included. Verified: 245 passed / 6 ignored, clippy+fmt clean; dogfooded live.
This commit is contained in:
1 parent
f74d53e446
commit
9b05592efb
16 files changed
+1067
-21
No files matched your search
+10
-1
@@ -307,7 +307,7 @@ details.thinking .reasoning {
|
||||
.queue-chip button:hover { color: var(--danger); }
|
||||
|
||||
/* ---- Stats modal ---- */
|
||||
#stats-modal, #dialog, #settings-modal, #notepad-modal, #mcp-picker-modal {
|
||||
#stats-modal, #dialog, #settings-modal, #notepad-modal, #todo-modal, #mcp-picker-modal {
|
||||
position: fixed; inset: 0; z-index: 40;
|
||||
background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
|
||||
padding: 20px;
|
||||
@@ -438,6 +438,15 @@ details.thinking .reasoning {
|
||||
.notepad-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--accent); flex: 0 0 auto; max-width: 42%; overflow-wrap: anywhere; }
|
||||
.notepad-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
|
||||
|
||||
/* ---- Todo (read-only task queue, agent-managed; reuses the notepad card) ---- */
|
||||
.todo-status {
|
||||
flex: 0 0 auto; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.03em;
|
||||
padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
|
||||
}
|
||||
.todo-status.todo-doing { color: var(--accent); border-color: var(--accent); }
|
||||
.todo-done { opacity: 0.6; }
|
||||
.todo-done .notepad-text { text-decoration: line-through; }
|
||||
|
||||
/* ---- Wide screens: persistent sidebar ---- */
|
||||
@media (min-width: 900px) {
|
||||
#drawer { position: static; transform: none; width: var(--sidebar-w); flex-shrink: 0; }
|
||||
|
||||
@@ -747,6 +747,38 @@ async function refreshNotepad() {
|
||||
|
||||
function closeNotepad() { $("#notepad-modal").hidden = true; }
|
||||
|
||||
// ---- Todo (read-only observability; the agent writes via the tool) ---------
|
||||
async function showTodo() {
|
||||
if (!currentSession()) return;
|
||||
$("#todo-modal").hidden = false;
|
||||
await refreshTodo();
|
||||
}
|
||||
|
||||
async function refreshTodo() {
|
||||
const sess = currentSession();
|
||||
if (!sess) return;
|
||||
const root = $("#todo-content");
|
||||
root.textContent = "";
|
||||
try {
|
||||
const items = await getJSON(`/api/sessions/${sess.id}/todos`);
|
||||
if (!items.length) {
|
||||
root.appendChild(el("div", "empty", t("todo.empty")));
|
||||
return;
|
||||
}
|
||||
for (const i of items) {
|
||||
const row = el("div", "notepad-entry" + (i.status === "done" ? " todo-done" : ""));
|
||||
row.appendChild(el("span", "notepad-key", String(i.seq)));
|
||||
row.appendChild(el("span", "todo-status todo-" + i.status, t("todo.status." + i.status)));
|
||||
row.appendChild(el("span", "notepad-text", i.content));
|
||||
root.appendChild(row);
|
||||
}
|
||||
} catch (err) {
|
||||
root.appendChild(el("div", "empty", t("todo.error", { msg: err.message })));
|
||||
}
|
||||
}
|
||||
|
||||
function closeTodo() { $("#todo-modal").hidden = true; }
|
||||
|
||||
// ---- Settings (per-session instance or global defaults) -------------------
|
||||
let settingsScope = "session";
|
||||
let settingsBase = {};
|
||||
@@ -1171,6 +1203,14 @@ function wire() {
|
||||
$("#close-notepad").addEventListener("click", closeNotepad);
|
||||
$("#notepad-modal").addEventListener("click", (e) => { if (e.target.id === "notepad-modal") closeNotepad(); });
|
||||
document.addEventListener("keydown", (e) => { if (e.key === "Escape" && !$("#notepad-modal").hidden) closeNotepad(); });
|
||||
$("#show-todo").setAttribute("aria-label", t("todo.title"));
|
||||
$("#show-todo").addEventListener("click", showTodo);
|
||||
$("#refresh-todo").setAttribute("aria-label", t("todo.refresh"));
|
||||
$("#refresh-todo").addEventListener("click", refreshTodo);
|
||||
$("#close-todo").setAttribute("aria-label", t("todo.close"));
|
||||
$("#close-todo").addEventListener("click", closeTodo);
|
||||
$("#todo-modal").addEventListener("click", (e) => { if (e.target.id === "todo-modal") closeTodo(); });
|
||||
document.addEventListener("keydown", (e) => { if (e.key === "Escape" && !$("#todo-modal").hidden) closeTodo(); });
|
||||
$("#show-settings").addEventListener("click", () => openSettings("session"));
|
||||
$("#set-scope-session").addEventListener("click", () => openSettings("session"));
|
||||
$("#set-scope-general").addEventListener("click", () => openSettings("general"));
|
||||
|
||||
@@ -97,5 +97,14 @@
|
||||
"notepad.empty": "No notes yet. The agent can pin important things here.",
|
||||
"notepad.refresh": "Refresh",
|
||||
"notepad.close": "Close",
|
||||
"notepad.error": "Error: {msg}"
|
||||
"notepad.error": "Error: {msg}",
|
||||
"todo.title": "Todo",
|
||||
"todo.hint": "The session's task queue, managed by the agent. Read-only.",
|
||||
"todo.empty": "No tasks yet. The agent can plan multi-step work here.",
|
||||
"todo.refresh": "Refresh",
|
||||
"todo.close": "Close",
|
||||
"todo.error": "Error: {msg}",
|
||||
"todo.status.pending": "pending",
|
||||
"todo.status.doing": "doing",
|
||||
"todo.status.done": "done"
|
||||
}
|
||||
@@ -97,5 +97,14 @@
|
||||
"notepad.empty": "Nessun appunto. L'agente può fissare qui le cose importanti.",
|
||||
"notepad.refresh": "Aggiorna",
|
||||
"notepad.close": "Chiudi",
|
||||
"notepad.error": "Errore: {msg}"
|
||||
"notepad.error": "Errore: {msg}",
|
||||
"todo.title": "Todo",
|
||||
"todo.hint": "La coda di lavoro della sessione, gestita dall'agente. Sola lettura.",
|
||||
"todo.empty": "Nessun task. L'agente può pianificare qui il lavoro multi-step.",
|
||||
"todo.refresh": "Aggiorna",
|
||||
"todo.close": "Chiudi",
|
||||
"todo.error": "Errore: {msg}",
|
||||
"todo.status.pending": "da fare",
|
||||
"todo.status.doing": "in corso",
|
||||
"todo.status.done": "fatto"
|
||||
}
|
||||
Reference in new issue
Block a user