mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Add a Reconnect to agent button where the agent has gone quiet
AI Assisted
This commit is contained in:
1 parent
6376a68f85
commit
30fd1134ea
11 files changed
+222
-25
No files matched your search
@@ -508,6 +508,7 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web
|
||||
| `public/meter.js` | PURE, imports only `skills.js`: the session meter. `WEIGHTS` (the events that are not a skill's own launch, merged with each skill's `weight` from `skills.js`; its keys are also `RUN_EVENTS`, the `run` events `post` accepts), `LAUNCH_COUNTED` (workflows whose launch itself scores), the built-phase sizing (`TASK_EVENTS`, the keys of `TASK_BONUS`: `implement-phase` +0 and `implement-review-phase` +1; `isTaskCount()` accepts a whole `tasks` from 1 to `MAX_TASKS` 999; `runPoints()` scores such a run `ceil(tasks / TASKS_PER_POINT)` (3) plus its bonus, and any other run its `WEIGHTS` value), `ANSWERS_PER_POINT` 2 (`answer` entries score per skill run, `floor(count / 2)`), `breakdownFrom()` (the click-the-ring list: one row per scoring entry plus one answers row per skill run), `pointsFrom()` (the count, its sum, folded from `ledger.ndjson` and deduplicated by id, never stored), `levelFor()` with `YELLOW_AT` 5 / `RED_AT` 10, `ringFraction()` (full at `RING_FULL` 15), `WORDS`, `tooltipFor()`, `RED_BANNER` and `meterView()` |
|
||||
| `public/mentions.js` | PURE, no imports: the `@name` popover's logic — `mentionAt()` finds an `@partial` at the caret, `matchNames()` filters the workspace names, `applyMention()` splices a pick in and returns the new caret. Used by the Ask box, notes and text answers |
|
||||
| `public/favicon.js` | The tab icon's status bar. `faviconState({ mood, spin })` (PURE) maps the call `renderStatus()` makes for Planny's line to `busy` (the spinning ring), `ready` (`point`), `attention` (`adrift`, `gone`, or `work` without the ring — the stale line) or `plain` (`done`, `happy`); a finished screen gets no special case, so one still offering a press points and lights `ready` (the desktop app's taskbar dot follows), a stranded press is `attention`, and only all done or paused is `plain`; `faviconSvg()` is `FAVICON_BODY` (kept equal to `favicon.svg` by a test) plus a bar along the bottom edge in the `FAVICON_COLORS` color (busy dashed on a white strip, so the states differ by pattern; the rest solid); `setFavicon()` swaps both `<link rel=icon>` hrefs only on a change — the SVG as a data URL, the PNG link drawn through a canvas. Called from `say()` in `renderStatus()`, which runs every second |
|
||||
| `public/continue-button.js` | The one control that wakes a quiet agent. `continueButton(label, cls)` is a button asking the app for `agent-continue` (held off 4 s after a press); `reconnectOffer(cls)` is that button labeled **Reconnect to agent** under the app and, in a browser, a line telling the person to type `continue` in their terminal. Used by the status line (`screens/core.js`: the dashboard's quiet, launch-saved and way-home-saved lines), the Ask tab (`screens/ask.js`, left of Send while the red no-agent line shows) and the saved-and-waiting launch screen (`screens/starting.js`, app only; a browser reads the hint). |
|
||||
| `public/app-bridge.js` | The messages the page posts to the desktop app that frames it. `framed()` is true inside a frame; `tellApp(kind, extra)` posts `{ plan2code: kind }`, a named request with no free text: `looks` (the highlight's dark shades, from `applyLooks()`, for the app bar's buttons), `agent-continue` (the in-app **continue** button on the Not running line: the app types the keystrokes `continueKeys()` in `plan2code-app/ui/meter.js` names into the agent's terminal, `continue` and Enter, then under Claude Code its send-now chord ctrl+x ctrl+s, so a word queued behind a stuck turn is delivered), `terminal-open` (the in-app **terminal** button, shown in place of the word in every What to check line while the app's terminal panel is collapsed: the app presses the panel's own Collapse/View button, and only when collapsed; the app tells the page the panel's state with `terminal-state` `{ collapsed }` on the page's `console-ready` and on every change, heard through `onAppMessage` into `page.terminalCollapsed`), `new-session` (the meter popover's New Session: the app presses its own bar button, confirm and all) and `activities-full` (`{ on }`, an Activities game going in or out of full screen: the app lays the console's frame over its bar and terminal and puts the window in full screen, and out of it only if it put it there; `taskbarSwitch()` checks the boolean, and the window permissions are in `capabilities/default.json`). Nothing outside a frame |
|
||||
| `public/subagents.js` | PURE, no imports: the Subagents switch. `SUBAGENT_WORKFLOWS` / `offered()` (the opt-in table, one entry per non-null `subagents` field in `skills.js`, each with its default instruction), `cleanSetting()` (`{ on, instruction, max, strength }` or `{ error }`: `bad`, `too-long` past 2,000 characters, `max` outside 1-20, `strength` not one of `STRENGTHS`; `strength` is `balanced`, `thrifty`, `best` or `session`, missing reads as `balanced`, saved per project and skill in each `subagents.json` entry and sent as a `Helper strength:` line in the "on" block), `FRAME_LINES`, `blockFor(setting, told)` (the `Subagents:` lines and `subagents` field an agent is owed, given the session setting and its cursor; never says "off" to an agent not told "on"), `checkHelper()` / `checkHelpers()` (the `helpers` house rule) and the page's view rules `showSwitch()`, `switchLabel()`, `helperRows()`, `showTab()`, `CHECKIN_LINE`. Imported by the server, the `cmd-*.mjs` files, `patches.mjs`, `settings.mjs`, the page and the tests; in `SERVABLE` and preloaded |
|
||||
| `handoffs.mjs` | the handoff store, the only code that names, lists, marks, deletes and sweeps handoffs, all in `~/.plan2code/handoffs/` (`PLAN2CODE_HANDOFFS_DIR` for tests; `PLAN2CODE_NOW` pins its clock): `newHandoff()` claims `YYYY-MM-DD-HHmm-handoff` (`-2`, `-3` on a clash, the `.json` created exclusively) and writes only `<id>.json` (`{ v: 1, id, title, worktree, project, spec, workflow, skill, written, fromStop, usedAt }`), the agent writing `<id>.md`; `listHandoffs(worktree)` (unused, same worktree, `.md` present, newest first, title and Next task read off the document); `readHandoffMeta()`, `markHandoffUsed()`; `removeHandoff()` (`HANDOFF_ID` only, regular files, never a link, realpath inside the folder, throws on any refusal); `staleHandoffs()` / `removeHandoffs()` for the sweep |
|
||||
|
||||
@@ -173,6 +173,128 @@ test("a finished screen's press that nothing collects says Plan2Code is not runn
|
||||
await until(async () => (await toApp(s, "agent-continue")).length === 1, 5000);
|
||||
});
|
||||
|
||||
// A dashboard whose agent stopped answering (its terminal died or sat idle for
|
||||
// a long while): the sidebar offers to wake it. Under the app that is the
|
||||
// continue button; in a browser it is the instruction to type it.
|
||||
const DASH_MENU = { menu: { note: "Pick one." }, agent: { status: "waiting" } };
|
||||
|
||||
test("a quiet dashboard agent shows a continue button under the app, which asks the app to type it", async (t) => {
|
||||
const s = await openSession(await suite.browser(), {
|
||||
t,
|
||||
workflow: "dashboard",
|
||||
clock: true,
|
||||
payload: DASH_MENU,
|
||||
env: { PLAN2CODE_IN_APP: "1" },
|
||||
init: FAKE_APP_FRAME,
|
||||
});
|
||||
// The dashboard's wake-up intro covers the page until it is skipped.
|
||||
const skip = s.page.getByRole("button", { name: "Skip the intro" });
|
||||
await skip.click();
|
||||
await skip.waitFor({ state: "hidden" });
|
||||
const welcomeDone = s.page.getByRole("button", { name: "Start building" });
|
||||
if (await welcomeDone.isVisible()) {
|
||||
await welcomeDone.click();
|
||||
await welcomeDone.waitFor({ state: "hidden" });
|
||||
}
|
||||
await s.page.clock.fastForward(200_000);
|
||||
await lineSays(s, /^Plan2Code has gone quiet\./);
|
||||
assert.match(await s.page.locator("#planny").getAttribute("class"), /\bis-adrift\b/);
|
||||
assert.equal(await whatToCheck(s).count(), 1, "the quiet line carries What to check");
|
||||
const press = s.page.locator("#agent-text .agent-key-btn");
|
||||
assert.equal(await press.textContent(), "continue");
|
||||
await press.click();
|
||||
await until(async () => (await toApp(s, "agent-continue")).length === 1, 5000);
|
||||
});
|
||||
|
||||
test("a quiet dashboard agent in a browser says to type continue in the terminal, with no button", async (t) => {
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "dashboard", clock: true, payload: DASH_MENU });
|
||||
await s.page.clock.fastForward(200_000);
|
||||
await lineSays(s, /^Plan2Code has gone quiet\./);
|
||||
assert.match(await textOf(statusLine(s)), /type continue there/);
|
||||
assert.equal(await s.page.locator("#agent-text .agent-key-btn").count(), 0, "a browser cannot type into a terminal");
|
||||
assert.equal(await s.page.locator("#agent-text .agent-key").count(), 1, "continue shows as a key to type");
|
||||
});
|
||||
|
||||
// A pick nobody collected: the saved-and-waiting screen. Under the app it holds
|
||||
// a Reconnect to agent button; in a browser its hint says to type continue.
|
||||
async function pickFromMenu(s) {
|
||||
const skip = s.page.getByRole("button", { name: "Skip the intro" });
|
||||
await skip.click();
|
||||
await skip.waitFor({ state: "hidden" });
|
||||
const welcomeDone = s.page.getByRole("button", { name: "Start building" });
|
||||
if (await welcomeDone.isVisible()) {
|
||||
await welcomeDone.click();
|
||||
await welcomeDone.waitFor({ state: "hidden" });
|
||||
}
|
||||
const main = s.page.locator("#main");
|
||||
await main.getByRole("button").filter({ has: s.page.locator("code", { hasText: /^\/plan2code-1-plan$/ }) }).click();
|
||||
await main.getByRole("button", { name: "Start Plan" }).click();
|
||||
await main.getByRole("heading", { name: /^Waking up / }).waitFor();
|
||||
await s.page.clock.fastForward(200_000);
|
||||
await main.getByRole("heading", { name: /is saved and waiting$/ }).waitFor();
|
||||
return main;
|
||||
}
|
||||
|
||||
test("a saved pick nobody collected offers Reconnect to agent under the app, which asks the app to type continue", async (t) => {
|
||||
const s = await openSession(await suite.browser(), {
|
||||
t,
|
||||
workflow: "dashboard",
|
||||
clock: true,
|
||||
payload: DASH_MENU,
|
||||
env: { PLAN2CODE_IN_APP: "1" },
|
||||
init: FAKE_APP_FRAME,
|
||||
});
|
||||
const main = await pickFromMenu(s);
|
||||
assert.match(await textOf(main), /Press Reconnect to agent below\./);
|
||||
await main.getByRole("button", { name: "Reconnect to agent", exact: true }).click();
|
||||
await until(async () => (await toApp(s, "agent-continue")).length === 1, 5000);
|
||||
});
|
||||
|
||||
test("a saved pick nobody collected says to type continue in a browser, with no button", async (t) => {
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "dashboard", clock: true, payload: DASH_MENU });
|
||||
const main = await pickFromMenu(s);
|
||||
assert.match(await textOf(main), /Return to the terminal and type continue\./);
|
||||
assert.equal(await main.getByRole("button", { name: "Reconnect to agent" }).count(), 0);
|
||||
});
|
||||
|
||||
// The Ask tab's red "No agent available" line leads nowhere on its own. Under
|
||||
// the app a Reconnect to agent button sits left of Send and asks the app to type
|
||||
// continue; in a browser the line tells the person to.
|
||||
async function askOffline(s) {
|
||||
await s.page.locator("nav").getByRole("button", { name: "Ask", exact: true }).click();
|
||||
await s.page.locator("#ask-input").waitFor();
|
||||
await s.page.clock.fastForward(200_000);
|
||||
await s.page.waitForFunction((t) => document.body.innerText.includes(t), CHAT_OFFLINE_TEXT, { timeout: 10000 });
|
||||
}
|
||||
|
||||
test("the Ask tab offers Reconnect to agent left of Send when no agent is there, under the app", async (t) => {
|
||||
const s = await openSession(await suite.browser(), {
|
||||
t,
|
||||
workflow: "plan",
|
||||
clock: true,
|
||||
payload: PLAN_QUESTION,
|
||||
env: { PLAN2CODE_IN_APP: "1" },
|
||||
init: FAKE_APP_FRAME,
|
||||
});
|
||||
await askOffline(s);
|
||||
const row = s.page.locator(".ask-composer");
|
||||
const reconnect = row.getByRole("button", { name: "Reconnect to agent", exact: true });
|
||||
assert.equal(await reconnect.count(), 1);
|
||||
const [r, send] = await Promise.all([reconnect.boundingBox(), row.getByRole("button", { name: "Send", exact: true }).boundingBox()]);
|
||||
assert.ok(r.x + r.width <= send.x + 1, "Reconnect to agent sits left of Send");
|
||||
assert.equal(await row.getByRole("button", { name: "Send", exact: true }).isDisabled(), true, "Send stays off");
|
||||
await reconnect.click();
|
||||
await until(async () => (await toApp(s, "agent-continue")).length === 1, 5000);
|
||||
});
|
||||
|
||||
test("the Ask tab in a browser says to type continue in the terminal, with no reconnect button", async (t) => {
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", clock: true, payload: PLAN_QUESTION });
|
||||
await askOffline(s);
|
||||
const row = s.page.locator(".ask-composer");
|
||||
assert.equal(await row.getByRole("button", { name: "Reconnect to agent" }).count(), 0);
|
||||
assert.match(await textOf(row), /type continue in your terminal/i);
|
||||
});
|
||||
|
||||
test("Continue here is hidden once the session meter is red, and the command and fresh-session advice stay", async (t) => {
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "implement", payload: { agent: { status: "working", activity: "Task 1 of 1" } } });
|
||||
// Ten points: a thirty-task phase scores ten, the red level.
|
||||
|
||||
@@ -326,8 +326,14 @@ test("a stale dashboard launch says the pick is saved and how to wake the agent"
|
||||
kicker: "Saved",
|
||||
title: "Pathfinder is saved and waiting",
|
||||
quip: "Plan2Code is not running right now.",
|
||||
hint: "Return to the terminal and send any message. Plan2Code will collect this launch and continue here.",
|
||||
hint: "Return to the terminal and type continue. Plan2Code will collect this launch and continue here.",
|
||||
});
|
||||
// Under the desktop app the Reconnect to agent button is on the screen, so
|
||||
// the hint points at it instead of the terminal.
|
||||
assert.equal(
|
||||
staleLaunchFeedback("Pathfinder", true, true).hint,
|
||||
"Press Reconnect to agent below. Plan2Code will collect this launch and continue here."
|
||||
);
|
||||
assert.equal(staleLaunchFeedback("Pathfinder", false), null);
|
||||
});
|
||||
|
||||
|
||||
@@ -861,13 +861,17 @@ export function deleteSummary(spec) {
|
||||
};
|
||||
}
|
||||
|
||||
export function staleLaunchFeedback(title, adrift) {
|
||||
// `inApp`: the desktop app puts a Reconnect to agent button on the screen
|
||||
// (starting.js), so the hint points at it; a browser has only the terminal.
|
||||
export function staleLaunchFeedback(title, adrift, inApp = false) {
|
||||
if (!adrift) return null;
|
||||
return {
|
||||
kicker: "Saved",
|
||||
title: `${title || "Your workflow"} is saved and waiting`,
|
||||
quip: "Plan2Code is not running right now.",
|
||||
hint: "Return to the terminal and send any message. Plan2Code will collect this launch and continue here.",
|
||||
hint: inApp
|
||||
? "Press Reconnect to agent below. Plan2Code will collect this launch and continue here."
|
||||
: "Return to the terminal and type continue. Plan2Code will collect this launch and continue here.",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// Plan2Code Web Console - the one button that wakes a quiet agent.
|
||||
//
|
||||
// Under the desktop app the agent's terminal is in the same window, so a press
|
||||
// asks the app to type "continue" there (the app types that word and nothing
|
||||
// else). A browser cannot reach a terminal, so those spots say what to type.
|
||||
|
||||
import { page } from "./state.js";
|
||||
import { tellApp } from "./app-bridge.js";
|
||||
import { el } from "./render.js";
|
||||
|
||||
// Held off for a few seconds after a press, so a double press does not send it twice.
|
||||
const CONTINUE_HOLD_MS = 4000;
|
||||
|
||||
// Kept here, not on the button: a screen that redraws builds a fresh button,
|
||||
// which must still be held off for the rest of the four seconds.
|
||||
let heldUntil = 0;
|
||||
|
||||
/**
|
||||
* A button asking the app to type continue into the agent's terminal. `label`
|
||||
* is the button's words; the status line keeps its own small key look, the Ask
|
||||
* tab and the waiting screens say "Reconnect to agent".
|
||||
*/
|
||||
export function continueButton(label = "continue", cls = "agent-key agent-key-btn") {
|
||||
const btn = el("button", cls, label);
|
||||
btn.type = "button";
|
||||
btn.disabled = Date.now() < heldUntil;
|
||||
btn.title = "Type continue in the agent's terminal";
|
||||
btn.addEventListener("click", () => {
|
||||
btn.disabled = true;
|
||||
heldUntil = Date.now() + CONTINUE_HOLD_MS;
|
||||
tellApp("agent-continue");
|
||||
setTimeout(() => (btn.disabled = false), CONTINUE_HOLD_MS);
|
||||
});
|
||||
return btn;
|
||||
}
|
||||
|
||||
/**
|
||||
* What a spot with no agent to talk to offers: the button under the app, and
|
||||
* under a browser a line telling the person to type continue in their terminal.
|
||||
* Null when there is nothing to offer.
|
||||
*/
|
||||
export function reconnectOffer(cls = "reconnect-offer") {
|
||||
if (page.inApp) return continueButton("Reconnect to agent", "btn small " + cls);
|
||||
const note = el("p", cls + " help");
|
||||
note.appendChild(document.createTextNode("To wake the agent, type "));
|
||||
note.appendChild(el("strong", "agent-key", "continue"));
|
||||
note.appendChild(document.createTextNode(" in your terminal."));
|
||||
return note;
|
||||
}
|
||||
@@ -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 { reconnectOffer } from "../continue-button.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";
|
||||
|
||||
@@ -337,6 +338,10 @@ function askComposer(ss) {
|
||||
row.appendChild(hint);
|
||||
}
|
||||
|
||||
// No agent there: under the app a button that types continue in its terminal,
|
||||
// left of Send; in a browser, the line telling the person to.
|
||||
if (ss.state === "offline" && !finish()) row.appendChild(reconnectOffer("ask-reconnect"));
|
||||
|
||||
const go = el("button", "btn small primary", "Send");
|
||||
go.type = "button";
|
||||
row.appendChild(go);
|
||||
|
||||
@@ -72,6 +72,7 @@ import { board, renderGitBoard, resetBoard } from "./git-host.js";
|
||||
import { renderWorkspace, tellFolderIssues } from "./workspace.js";
|
||||
import { openHelpOn } from "./help-dialog.js";
|
||||
import { linkLeavesPage, onAppMessage, startNewSession, tellApp } from "../app-bridge.js";
|
||||
import { continueButton } from "../continue-button.js";
|
||||
import { askOfflineFlipped, askState, declineOpen, renderAside, renderAsk, renderSubagents, renderSubagentsButton } from "./ask.js";
|
||||
import { renderHandoff, renderLoopEnd, renderHomeButton, renderStopButton, renderStopControls, renderStopping, stopInProgress, stopWarning } from "./ending.js";
|
||||
import { renderNotepadButton } from "./notepad.js";
|
||||
@@ -1167,6 +1168,12 @@ let moodVar = 0;
|
||||
const STRANDED_LINE =
|
||||
"Plan2Code is not running. Your answers are saved and waiting for it. If the terminal is idle, type **continue** there and it will pick them up; it may also be waiting for your permission approval.";
|
||||
|
||||
// The dashboard's quiet lines: the pick or the way home is saved, and typing
|
||||
// **continue** in the terminal (a button under the app) wakes the agent.
|
||||
const WAKE_TAIL = "If the terminal is idle, type **continue** there to wake it.";
|
||||
const DASH_QUIET_LINE = `Plan2Code has gone quiet. A pick still waits here for it. ${WAKE_TAIL}`;
|
||||
const HOMEWARD_QUIET_LINE = `Your way back to the dashboard is saved and waiting for Plan2Code. ${WAKE_TAIL}`;
|
||||
|
||||
// The agent is out of `wait` answering an Ask message (askBusy()), so a send
|
||||
// waits for it to finish that first.
|
||||
const ASK_BUSY_LINE = "Plan2Code is answering your Ask message. Your answers are saved, and it picks them up after that.";
|
||||
@@ -1175,23 +1182,6 @@ const ASK_BUSY_LINE = "Plan2Code is answering your Ask message. Your answers are
|
||||
const PRESS_STRANDED_LINE =
|
||||
"Plan2Code is not running. Your choice is saved and waiting for it. If the terminal is idle, type **continue** there and it will pick it up; it may also be waiting for your permission approval.";
|
||||
|
||||
// The status line's **continue**, under the app: a press asks the app to type
|
||||
// it into the agent's terminal. Held off for a few seconds after, so a double
|
||||
// press does not send it twice.
|
||||
const CONTINUE_HOLD_MS = 4000;
|
||||
|
||||
function continueButton() {
|
||||
const btn = el("button", "agent-key agent-key-btn", "continue");
|
||||
btn.type = "button";
|
||||
btn.title = "Type continue in the agent's terminal";
|
||||
btn.addEventListener("click", () => {
|
||||
btn.disabled = true;
|
||||
tellApp("agent-continue");
|
||||
setTimeout(() => (btn.disabled = false), CONTINUE_HOLD_MS);
|
||||
});
|
||||
return btn;
|
||||
}
|
||||
|
||||
// Under the app with its terminal panel collapsed (the app's `terminal-state`),
|
||||
// "terminal" in a What to check line is a button asking the app to expand it.
|
||||
function terminalButton(word) {
|
||||
@@ -1325,7 +1315,7 @@ export function renderStatus() {
|
||||
// until the agent resumes the session as the dashboard.
|
||||
if (page.local.homeward && !isDashboard()) {
|
||||
return agentAdrift()
|
||||
? say("adrift", "Your way back to the dashboard is saved and waiting for Plan2Code.")
|
||||
? say("adrift", HOMEWARD_QUIET_LINE, "", false, true)
|
||||
: say("work", "Saving your place and opening the dashboard…", "", true);
|
||||
}
|
||||
// The dashboard's three states, ahead of the question logic it never
|
||||
@@ -1335,13 +1325,13 @@ export function renderStatus() {
|
||||
if (page.local.launching) {
|
||||
const stale = staleLaunchFeedback(page.local.launching.title, agentAdrift());
|
||||
return stale
|
||||
? say("adrift", `${page.local.launching.title} is saved and waiting for Plan2Code.`)
|
||||
? say("adrift", `${page.local.launching.title} is saved and waiting for Plan2Code. ${WAKE_TAIL}`, "", false, true)
|
||||
: say("work", `Waking up ${page.local.launching.title}…`, "", true);
|
||||
}
|
||||
if (page.dashPick) return say("point", `Start ${page.dashPick.title} when you're ready.`);
|
||||
// The cards work before the agent's menu lands, so a pick is always
|
||||
// theirs; the line still says what the agent is up to, or that it went quiet.
|
||||
if (agentAdrift()) return say("adrift", "Plan2Code has gone quiet. A pick still waits here for it.");
|
||||
if (agentAdrift()) return say("adrift", DASH_QUIET_LINE, "", false, true);
|
||||
const doing = page.S.agent && typeof page.S.agent.activity === "string" ? page.S.agent.activity.trim() : "";
|
||||
if (agentWorking() && !page.S.menu) return say("point", `Pick what we are doing today. ${doing || "Plan2Code is looking over the project."}`);
|
||||
return say("point", "Your move: pick what we are doing today.");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { page, redraw } from "../state.js";
|
||||
import { el, approvalTip } from "../render.js";
|
||||
import { startPose, startingHint, staleLaunchFeedback, workflowTitle } from "../answers.js";
|
||||
import { continueButton } from "../continue-button.js";
|
||||
import { skillByName } from "../skills.js";
|
||||
import { agentAdrift, doingNow, docs, loopDriving } from "../selectors.js";
|
||||
|
||||
@@ -119,7 +120,7 @@ export function renderLaunching(main) {
|
||||
const l = page.local.launching || {};
|
||||
const pane = posePane(main, "launching", l.skill && skillByName(l.skill)?.workflow);
|
||||
|
||||
const stale = staleLaunchFeedback(l.title, agentAdrift());
|
||||
const stale = staleLaunchFeedback(l.title, agentAdrift(), page.inApp);
|
||||
pane.appendChild(el("p", "card-kicker", stale ? stale.kicker : "On it"));
|
||||
pane.appendChild(el("h2", "launch-title", stale ? stale.title : `Waking up ${l.title || "the next mode"}`));
|
||||
pane.appendChild(el("p", "launch-quip", stale ? stale.quip : LAUNCH_QUIPS[0]));
|
||||
@@ -130,6 +131,14 @@ export function renderLaunching(main) {
|
||||
stale ? stale.hint : "This page turns into its home the moment it answers. No need to touch anything."
|
||||
)
|
||||
);
|
||||
// Under the app a saved pick no agent collects gets a button that types
|
||||
// continue in the terminal; the ticker shows and hides it with the hint.
|
||||
if (page.inApp) {
|
||||
const row = el("div", "launch-reconnect");
|
||||
row.hidden = !stale;
|
||||
row.appendChild(continueButton("Reconnect to agent", "btn primary"));
|
||||
pane.appendChild(row);
|
||||
}
|
||||
startLaunchTicker();
|
||||
}
|
||||
|
||||
@@ -211,7 +220,9 @@ function startLaunchTicker() {
|
||||
return;
|
||||
}
|
||||
const elapsed = Date.now() - cur.at;
|
||||
const stale = staleLaunchFeedback(cur.title, agentAdrift());
|
||||
const stale = staleLaunchFeedback(cur.title, agentAdrift(), page.inApp);
|
||||
const reconnect = document.querySelector(".launch-reconnect");
|
||||
if (reconnect) reconnect.hidden = !stale;
|
||||
if (kicker) kicker.textContent = stale ? stale.kicker : "On it";
|
||||
if (title) title.textContent = stale ? stale.title : `Waking up ${cur.title || "the next mode"}`;
|
||||
q.textContent = stale ? stale.quip : LAUNCH_QUIPS[Math.floor(elapsed / 2600) % LAUNCH_QUIPS.length];
|
||||
|
||||
@@ -149,6 +149,11 @@
|
||||
.ask-actions .btn.primary { margin-left: auto; }
|
||||
.ask-send-hint { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
|
||||
.ask-send-hint + .btn.primary { margin-left: 0; }
|
||||
/* The wake-the-agent offer when nobody is there: a button (or, in a browser, a
|
||||
line) pushed right so it sits directly left of Send. */
|
||||
.ask-actions .ask-reconnect { margin-left: auto; }
|
||||
.ask-actions .ask-reconnect + .btn.primary { margin-left: 0; }
|
||||
p.ask-reconnect { margin-top: 0; margin-bottom: 0; font-size: 12.5px; }
|
||||
.ask-count { font: 12px/1 var(--mono); color: var(--ink-3); }
|
||||
.ask-count.is-over { color: var(--warn); font-weight: 700; }
|
||||
.ask-error { color: var(--warn); font-size: 13px; margin: 8px 0 0; }
|
||||
|
||||
@@ -602,6 +602,9 @@
|
||||
to { opacity: 1; transform: none; }
|
||||
}
|
||||
.launch-hint { margin: 0; font-size: 12.5px; color: var(--ink-3); max-width: 46ch; }
|
||||
/* Under the app, a saved pick nobody collected: the button that types continue. */
|
||||
.launch-reconnect { margin-top: 14px; }
|
||||
.launch-reconnect[hidden] { display: none; }
|
||||
/* A line, never a banner: no border, no background, no icon. */
|
||||
.approval-tip { max-width: 70ch; margin: 18px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ export const SERVABLE = new Set([
|
||||
"mentions.js",
|
||||
"favicon.js",
|
||||
"app-bridge.js",
|
||||
"continue-button.js",
|
||||
"git-board.js",
|
||||
"git-board-view.js",
|
||||
"pr-url.js",
|
||||
|
||||
Reference in new issue
Block a user