Public: anyone can read this; the crew can change it.
The terminal home's first ask makes a new app and files the ask there, as the page does #11930
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/11406-the-terminal-home-s-first-ask-makes-a-ne → main 3 commits fork
2 files
changed +23
−7
src/tui/screens/dashboard.ts +14 −5
| @@ -27,7 +27,7 @@ import { clientAppRows, clientDoings, clientFinished, doingLine, finishedLine } | ||
| 27 | 27 | import { appCrew } from "../../core/app-crew.ts"; |
| 28 | 28 | import { nextStepsFor } from "../../core/next-steps.ts"; |
| 29 | 29 | import { askRepos, askStatus, askStatusLine } from "../../core/ask-status.ts"; |
| 30 | import { keepThought } from "../../actions/thought.ts"; | |
| 30 | import { AUTONOMY_FAILED_WORDS, firstAsk } from "../../actions/first_ask.ts"; | |
| 31 | 31 | import { SAY_SOMETHING_WORDS } from "../../actions/tell_words.ts"; |
| 32 | 32 | import { crewCanRun, crewFirstText } from "../../web/studio/crew_key.ts"; |
| 33 | 33 | import { agentsLine } from "../../web/studio/client_home.ts"; |
| @@ -1357,10 +1357,19 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1357 | 1357 | hint: "enter sends", |
| 1358 | 1358 | onSubmit: (said) => { |
| 1359 | 1359 | if (said.trim() === "") return SAY_SOMETHING_WORDS; |
| 1360 | const kept = keepThought(f.app, f.user, said, "composer"); | |
| 1361 | ctx.toast(kept.ok ? "Received." : "That could not be kept.", kept.ok ? "success" : "danger"); | |
| 1362 | if (kept.ok) void loadClientLines().then(reload); | |
| 1363 | return undefined; | |
| 1360 | // The page's own first ask: one new app made from the sentence, the ask filed on it. | |
| 1361 | return (async () => { | |
| 1362 | const first = await firstAsk(f.app, f.user, said, crewCanRun(f.app)); | |
| 1363 | if (!first.ok) return ctx.toast(first.error.words, "danger"); | |
| 1364 | const { repo, told, autonomyFailed } = first.value; | |
| 1365 | if (!told.ok) return ctx.toast(`Made ${repo.ownerName}/${repo.name}, but the ask could not be filed there.`, "danger"); | |
| 1366 | ctx.toast( | |
| 1367 | `Made ${repo.ownerName}/${repo.name} and filed your ask there as issue #${told.value.issue.number}.${autonomyFailed ? ` ${AUTONOMY_FAILED_WORDS}` : ""}`, | |
| 1368 | autonomyFailed ? "danger" : "success", | |
| 1369 | ); | |
| 1370 | openRepo(repo); | |
| 1371 | void loadClientLines().then(reload); | |
| 1372 | })(); | |
| 1364 | 1373 | }, |
| 1365 | 1374 | }), |
| 1366 | 1375 | ); |
test/tui-first-tell.test.ts +9 −2
| @@ -5,7 +5,7 @@ import { createForgeApp } from "../src/tui/forge.ts"; | ||
| 5 | 5 | import { headlessTerminal } from "../src/tui/term/terminal.ts"; |
| 6 | 6 | import { claimedForge, type ClaimedForge } from "./helpers/claimed-forge.ts"; |
| 7 | 7 | import { quietLogs } from "./helpers/globals.ts"; |
| 8 | import { settleApp } from "./helpers/tui.ts"; | |
| 8 | import { settleApp, settleUntil } from "./helpers/tui.ts"; | |
| 9 | 9 | |
| 10 | 10 | quietLogs(); |
| 11 | 11 | |
| @@ -38,10 +38,17 @@ test("before the first tell the home says what to do and offers no everyday acco | ||
| 38 | 38 | expect(h.text()).toContain("included credit."); |
| 39 | 39 | expect(h.text()).not.toContain("K keeps using admin"); |
| 40 | 40 | |
| 41 | const count = (table: string) => forge.child.db.query<{ n: number }, []>(`SELECT COUNT(*) AS n FROM ${table}`).get()!.n; | |
| 42 | const appsBefore = count("repo"); | |
| 43 | const issuesBefore = count("issue"); | |
| 41 | 44 | await h.key("t"); |
| 42 | 45 | for (const ch of "A weekly menu page") await h.key(ch); |
| 43 | 46 | await h.key("enter"); |
| 44 | expect(forge.child.db.query<{ n: number }, []>("SELECT COUNT(*) AS n FROM thought").get()!.n).toBe(1); | |
| 47 | await settleUntil(h.app, "and filed your ask there as issue #"); | |
| 48 | await settleApp(h.app); | |
| 49 | expect(count("thought")).toBe(0); | |
| 50 | expect(count("repo")).toBe(appsBefore + 1); | |
| 51 | expect(count("issue")).toBe(issuesBefore + 1); | |
| 45 | 52 | h.app.stop(); |
| 46 | 53 | |
| 47 | 54 | // Once the crew has made an issue of it, the home is the everyday one and offers the account. |
new above
offline