mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-03 21:37:04 +01:00
* fix(prompts): one card per saved prompt, schedules in words, dialogs that say why
What the owner found on /prompts from an Android phone, item by item:
1. Saved prompts: saving the same name + words again no longer inserts a
row — POST /api/prompts answers with the prompt already saved
(existing: true); the form opens it, the default's save button says
"Already in your prompts". A card that stands for identical copies says
how many and offers "Remove N extra copies" — one explicit tap, the
caller's own rows only, the same soft delete as Delete
(DELETE /api/prompts/<id>/copies). Same name with different words says
"2 versions with this name, worded differently".
2. Filters: the scope filter is a <Segmented> (All / Any project / One
project) sitting with the category row on the list they both filter,
under "Loki's prompts". Category counts follow the scope. Filter chip
rows on a phone get a wider fade, snap to a chip's start and leave room
after the last chip, so the edge reads as "more" rather than a cut word.
3. New prompt: Create stays disabled until there is a name and a prompt,
and says what is missing beside it. Opening or closing the form never
saved anything; the copy glyph on every default card did, in one tap
with no label on a phone — it is now a labelled "save a copy" button.
4. Schedule: pick Every day / Weekdays / Every week / Every month, a day
and a time; Loki writes the cron (lib/cron-words), with "Write it as a
cron line instead" for experts. The schedule reads back in words with
the time zone it runs in ("Every Monday at 10:00, Zurich time
(Europe/Zurich)") and a link to change it; the zone is sent with the
job. The API refuses a cron line the scheduler cannot read, in words.
Create is the primary button and says why when it cannot be pressed.
5. Run: a prompt that names {{project_name}} asks for a project whatever
its scope (a saved copy is global), defaulting to the project in use;
the prompt is shown only once complete. Each action says in one line
who does the work; Send to terminal works for any of your projects
(tab-inject starts or queues the session) and says why when it cannot.
Project pickers list projectTitle(), not folder keys.
6. Category chips are neutral (ui-tag-neutral); the ui-cat-* rainbow and
the featured star's amber are gone. "control" was a second id for the
fleet prompts — one category now, "Fleet control".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
* fix(voice): spoken sentences start with a capital and name a repeated project once
The briefing read "one run is waiting for a builder: loki ... three runs
failed: loki, loki and loki". Sentences now open with a capital, and the
runs' projects are said once each: "Three runs failed on loki.", "Four runs
failed: loki three times and heidi once." The same for runs waiting for a
builder, agents working, and the announcements between turns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
* fix(voice): say why the studio voice is off, with the link that fixes it
POST /api/voice/speak answered 502 with Groq's reason only in the server
console, and the phone fell back to its own voice in silence, so every voice
in the picker sounded the same. Groq's refusal is now classified
(lib/voice/tts-failure: terms gate, bad key, limit, model gone, vendor down,
no key) into one plain sentence and, where one exists, the link that fixes
it — for the Orpheus terms gate, Groq's voice page and "press Accept". The
route returns it in the 502/503 body and records it in debug_logs (once per
reason per half hour) so System shows it. The speaker reports the fallback
to the page; useStudioVoiceStatus keeps it for the tab's session and
StudioVoiceNotice shows it. The phone-voice fallback stays.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
* feat(voice): change Loki's voice by saying so, and answer questions about voice mode truthfully
"I don't like your voice, can I change your voice" was answered like a
generic chatbot ("in most voice-enabled AI chat apps... look in settings").
Now "use Troy", "change your voice to Diana", "other voice" and
"switch voice" are a spoken command (config/no-screen.ts, lib/voice/commands)
that the phone answers itself; with no name it lists the voices. A question
that does reach Loki carries voiceModeContext (lib/voice/self.ts), built from
the SSOT: the voices by name, how to change one, the three switches with the
same one-line notes the screen shows (NO_SCREEN_OPTIONS), every command, the
current settings and why studio voices are off, if they are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
* fix(voice): a music bed a phone can actually play, and keep its sound awake
The bed sat at about -38 dBFS RMS alone and -50 under the voice, every note
98-370 Hz behind a 900 Hz low-pass: below what a phone speaker or many
earbuds reproduce, so "music bed on" was silence. It is now an octave
higher (196-740 Hz), about 12 dB louder, ducks by 10 dB instead of 11 more on
top, and earcons sit above it. The AudioContext is resumed inside the Start
tap, on every tap on the circle or headphone button, on return to the page,
and when the phone suspends it mid-session.
useSoundscape also returned a new object every render, so effects keyed on
it re-ran ~20 times a second while listening: the gain was re-ramped every
frame and the 20-second fleet poll was cleared before it could fire. It is
memoized now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
* fix(voice): one h1 per screen, End clear of the feedback launcher, voices as an even grid
- Speaking screen: an h1 below md, where the app top bar steps aside; the
start screen's big "Voice" is no longer a second h1 beside the top bar's.
- The speaking screen sets data-fc-place="tab", so the feedback launcher
and its Watching pill become the slim edge handle instead of sitting on
End; End is larger, with room below it, and the stage scrolls rather than
pushing End off a short screen.
- The voice picker is a <Segmented> grid of four columns (seven voices as
4 + 3, the last two cells wide) instead of a chip row cut off at the edge;
the setting groups have real headings.
- The unclear note under the switches is one short line under each switch,
shared with what Loki is told about itself.
- The page wires the studio-voice notice (under the picker and under the
circle, said aloud once), the spoken voice change, the page's state sent
with each question, and the sound resume on every tap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
* fix(widget): one card per finding, settled page checks, honest fix status, a count that means what needs you
Watching on Loki's own /voice from an Android phone showed six problems in
one panel. Each is fixed where it starts:
- Notices no longer stack. A page's checks own ONE card (checksSlot), which
each new reading replaces in place and a clean reading takes back
(thread.ts pushNoticed / dropNoticed); a remark whose words are already on
screen is not said again; a finding's signature ignores its count and its
placeholder example (findingKind), and the card names its page.
- The heading miscount: the check counted headings inside aria-hidden and
inert subtrees, and measured the page once, mid-swap — /voice's setup
screen (top bar h1 + page h1) leaving for its speaking screen (immersive
mode hides the top bar: no h1). Checks now count only rendered elements and
run once the page has held still, twice, keeping only what both readings
agree on (settledPageChecks / stableChecks). The Voice page itself now has
one h1 on each screen.
- A fix Watch started that failed no longer promises it "goes live by
itself": it says the fix did not finish, and "Open it in Loki to see why"
is a real link to that run's Watch page (owner-view ownerTap; watch-fix
now resolves a failed run's Watch page even without a live page).
- Self-watch: "I couldn't check on your changes just now" replaces the old
sentence; a request that lived through the page being put away (a phone
locking) is never a failure; background reads count only after three
failures in a row; the changes route always answers with CORS headers and
logs what failed.
- The header's one number is what waits on the owner's decision (failed
attempts, saved notes, notes not started, changes said but not saved),
counted by the server over ALL of the owner's rows, not inside the newest
twelve; the open list shows every one of them first. Nothing waiting:
just "Watching".
- The save receipt never quotes a cut sentence: several changes are listed
one per line under it, clamped to whole lines with "Show all".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
* docs(changelog): voice, Watching and Prompts fixes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
---------
Co-authored-by: Claude <noreply@anthropic.com>
330 lines
13 KiB
TypeScript
330 lines
13 KiB
TypeScript
// "Your changes": the loop closing on the owner's own site. The panel's story
|
|
// used to end at "On it — Loki tells you when", and on the site Loki never
|
|
// did. Pinned here: the owner's words per phase come from the same honest
|
|
// phase the inbox uses and say nothing an engineer wrote; the widget
|
|
// announces exactly the transition to live, once, and never on first sight;
|
|
// the route answers only to a pass for this project and this owner; and the
|
|
// receipt's "Follow the build" no longer tours a page that has not changed.
|
|
// Run: npx tsx scripts/test/widget-changes.ts
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { ownerStatusFor, ownerTap, OWNER_CHANGES_MAX } from "@/lib/feedback/owner-view";
|
|
import { FEEDBACK_WORK_PHASE, WAITING_ON, type FeedbackWorkView } from "@/lib/feedback/work-phase";
|
|
import { FIX_SHIP_STATE, type FixShipping } from "@/lib/feedback/fix-shipping";
|
|
import {
|
|
CHANGES_MAX,
|
|
builtSay,
|
|
changesHeadline,
|
|
SAVED_NOTE_LABEL,
|
|
changesSummary,
|
|
needsYouCount,
|
|
newlyLive,
|
|
parseChanges,
|
|
parseNeedsYou,
|
|
shownChanges,
|
|
toSeen,
|
|
type OwnerChange,
|
|
} from "../../widget/changes";
|
|
|
|
const view = (
|
|
phase: FeedbackWorkView["phase"],
|
|
extra: Partial<FeedbackWorkView> = {},
|
|
): FeedbackWorkView => ({
|
|
phase,
|
|
waitingOn: WAITING_ON.NOBODY,
|
|
label: "x",
|
|
detail: "Open Fleet Runner on This computer",
|
|
diagnostic: "TypeError: cannot read properties of undefined",
|
|
runId: "run-1",
|
|
...extra,
|
|
});
|
|
const ship = (state: string): FixShipping => ({ state }) as FixShipping;
|
|
|
|
// ---- the owner's words, per phase ----
|
|
{
|
|
const waiting = ownerStatusFor(view(FEEDBACK_WORK_PHASE.NOT_STARTED));
|
|
assert.equal(waiting.label, "Waiting");
|
|
assert.ok(waiting.needsYou && !waiting.live && !waiting.settled);
|
|
assert.equal(ownerStatusFor(view(FEEDBACK_WORK_PHASE.QUEUED)).label, "Starting");
|
|
// Behind another change in the project's one lane: the order is the news.
|
|
const behind = ownerStatusFor(
|
|
view(FEEDBACK_WORK_PHASE.QUEUED, {
|
|
detail: "Behind “Add alt text” on this project — starts when that run finishes",
|
|
}),
|
|
);
|
|
assert.equal(behind.label, "In line");
|
|
assert.match(behind.detail, /^Behind “Add alt text”/);
|
|
assert.equal(ownerStatusFor(view(FEEDBACK_WORK_PHASE.WORKING)).label, "Building");
|
|
for (const p of [FEEDBACK_WORK_PHASE.STUCK, FEEDBACK_WORK_PHASE.FAILED]) {
|
|
const s = ownerStatusFor(view(p));
|
|
assert.equal(s.label, "Needs you");
|
|
assert.equal(s.tone, "warning");
|
|
assert.ok(s.needsYou, "the owner is sent into Loki, where the why is");
|
|
// …by a link, not a sentence telling them to go (2026-10-20): the run's
|
|
// Watch page when there is a run, the inbox when there is none.
|
|
assert.doesNotMatch(s.detail, /Open it in Loki/, "the way in is the link, not the words");
|
|
assert.deepEqual(ownerTap(s, true), { to: "run", action: "Open it in Loki to see why" });
|
|
assert.equal(ownerTap(s, false).to, "inbox");
|
|
}
|
|
assert.deepEqual(ownerTap(ownerStatusFor(view(FEEDBACK_WORK_PHASE.WORKING)), true), {
|
|
to: "run",
|
|
action: "Watch it",
|
|
});
|
|
assert.equal(ownerTap(ownerStatusFor(view(FEEDBACK_WORK_PHASE.QUEUED)), false).to, null);
|
|
assert.deepEqual(ownerTap(ownerStatusFor(view(FEEDBACK_WORK_PHASE.DONE)), true), {
|
|
to: "live",
|
|
action: "See it",
|
|
});
|
|
for (const st of [
|
|
FIX_SHIP_STATE.PUSHED,
|
|
FIX_SHIP_STATE.PR_OPEN,
|
|
FIX_SHIP_STATE.MERGED,
|
|
FIX_SHIP_STATE.DEPLOYING,
|
|
]) {
|
|
const s = ownerStatusFor(view(FEEDBACK_WORK_PHASE.NEEDS_VERIFY, { ship: ship(st) }));
|
|
assert.equal(s.label, "On its way", st);
|
|
assert.ok(!s.live && !s.settled);
|
|
}
|
|
const live = ownerStatusFor(
|
|
view(FEEDBACK_WORK_PHASE.NEEDS_VERIFY, { ship: ship(FIX_SHIP_STATE.DEPLOYED) }),
|
|
);
|
|
assert.equal(live.label, "Live");
|
|
assert.ok(live.live && live.settled, "live is the end of the road for the widget");
|
|
const checkLive = ownerStatusFor(view(FEEDBACK_WORK_PHASE.NEEDS_VERIFY, { checkLive: true }));
|
|
assert.ok(checkLive.live, "no deploy we can see, but the reader has to look: counts as live");
|
|
const closedPr = ownerStatusFor(
|
|
view(FEEDBACK_WORK_PHASE.NEEDS_VERIFY, { ship: ship(FIX_SHIP_STATE.PR_CLOSED) }),
|
|
);
|
|
assert.equal(closedPr.label, "Checking");
|
|
assert.ok(!closedPr.live, "a PR closed without merging is not a fix that shipped");
|
|
assert.ok(ownerStatusFor(view(FEEDBACK_WORK_PHASE.DONE)).live);
|
|
const closed = ownerStatusFor(view(FEEDBACK_WORK_PHASE.ARCHIVED));
|
|
assert.ok(closed.settled && !closed.live);
|
|
// Nothing the operator's view carries reaches the site.
|
|
for (const p of Object.values(FEEDBACK_WORK_PHASE)) {
|
|
const s = ownerStatusFor(view(p));
|
|
for (const leak of ["Fleet Runner", "TypeError", "run-1", "dispatched"]) {
|
|
assert.ok(!s.detail.includes(leak) && !s.label.includes(leak), `${p}: "${leak}" leaked`);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ---- the widget notices exactly the transition to live ----
|
|
{
|
|
const c = (id: string, live: boolean): OwnerChange => ({
|
|
id,
|
|
text: id,
|
|
at: "",
|
|
label: live ? "Live" : "Building",
|
|
tone: "accent",
|
|
detail: "",
|
|
live,
|
|
settled: live,
|
|
href: null,
|
|
action: null,
|
|
needsYou: false,
|
|
});
|
|
assert.deepEqual(
|
|
newlyLive({}, [c("a", true)]),
|
|
[],
|
|
"first sight of a live change is not an announcement",
|
|
);
|
|
assert.deepEqual(
|
|
newlyLive({ a: false }, [c("a", true)]).map((x) => x.id),
|
|
["a"],
|
|
"seen building, now live: announce",
|
|
);
|
|
assert.deepEqual(newlyLive({ a: true }, [c("a", true)]), [], "already announced");
|
|
assert.deepEqual(newlyLive({ a: false }, [c("a", false)]), [], "still building");
|
|
assert.deepEqual(toSeen([c("a", true), c("b", false)]), { a: true, b: false });
|
|
}
|
|
|
|
// ---- what the widget accepts from the server ----
|
|
{
|
|
const parsed = parseChanges({
|
|
changes: [
|
|
{
|
|
id: "1",
|
|
text: "Add a scene",
|
|
label: "Live",
|
|
tone: "positive",
|
|
live: true,
|
|
settled: true,
|
|
href: "https://heidi.test/x#loki-tour=t",
|
|
action: "See it",
|
|
at: "2026-10-09T10:00:00Z",
|
|
detail: "d",
|
|
},
|
|
{ id: "2", text: "x", label: "Building", tone: "weird", href: "javascript:alert(1)" },
|
|
{ nope: true },
|
|
"junk",
|
|
],
|
|
});
|
|
assert.equal(parsed.length, 2);
|
|
assert.equal(parsed[0].action, "See it");
|
|
assert.equal(parsed[1].tone, "neutral", "an unknown tone falls back");
|
|
assert.equal(parsed[1].href, null, "only http(s) links become links");
|
|
assert.equal(parsed[0].needsYou, false, "waits on the owner only when the server says so");
|
|
assert.equal(
|
|
parseChanges({ changes: [{ id: "3", text: "y", label: "Needs you", needsYou: true }] })[0]
|
|
.needsYou,
|
|
true,
|
|
);
|
|
assert.equal(parseNeedsYou({ needsYou: 14 }), 14, "the server's count, past the twelve rows");
|
|
assert.equal(parseNeedsYou({ needsYou: "9" }), 0);
|
|
assert.equal(parseNeedsYou(null), 0);
|
|
assert.deepEqual(parseChanges(null), []);
|
|
assert.equal(CHANGES_MAX, OWNER_CHANGES_MAX, "the widget's cap mirrors the server's");
|
|
}
|
|
|
|
// ---- the route and the receipt link ----
|
|
const route = readFileSync("src/app/api/widget/owner/changes/route.ts", "utf8");
|
|
const ownerCheck = readFileSync("src/lib/widget/owner-request.ts", "utf8");
|
|
assert.match(route, /ownerRequest\(req, data\)/, "a pass, verified");
|
|
assert.match(ownerCheck, /passHolder\(data\.ownerPass, token\)/, "…by passHolder");
|
|
assert.match(
|
|
readFileSync("src/lib/feedback/pass-rule.ts", "utf8"),
|
|
/pass\.projectId !== site\.projectId\) return false/,
|
|
"for this project, its owner or an editor (scripts/test/widget-pass-holder.ts)",
|
|
);
|
|
assert.match(
|
|
route,
|
|
/owner: false, changes: \[\]/,
|
|
"no pass, nothing — a stranger with the public token learns nothing",
|
|
);
|
|
assert.match(
|
|
route,
|
|
/attachFeedbackWork\(token\.userId, \[\s*\.\.\.mine/,
|
|
"the same phase the inbox derives",
|
|
);
|
|
assert.match(
|
|
route,
|
|
/i\.source === FEEDBACK_SOURCE\.OWNER \|\| i\.source === FEEDBACK_SOURCE\.AI_REVIEW/,
|
|
"yours means yours — a visitor's note is not the owner's change",
|
|
);
|
|
assert.match(route, /visitors/, "and visitors' notes are counted, not listed");
|
|
assert.match(ownerCheck, /isWidgetOriginAllowed/, "origin allowlist like every widget route");
|
|
assert.match(
|
|
route,
|
|
/createTourToken\(item\.id\)/,
|
|
"See it is the walkthrough of this change, for the owner",
|
|
);
|
|
const watchFix = readFileSync("src/app/(app)/feedback/[id]/watch-fix/route.ts", "utf8");
|
|
assert.match(
|
|
watchFix,
|
|
/if \(!status\.live\) \{(?:(?!tourSiteUrl)[\s\S])*?\/watch\?run=(?:(?!tourSiteUrl)[\s\S])*?return projectInbox;\s*\}/,
|
|
"no walkthrough of a change that is not there yet — its live run, or the inbox",
|
|
);
|
|
const ingest = readFileSync("src/app/api/feedback/route.ts", "utf8");
|
|
assert.match(
|
|
ingest,
|
|
/duplicateOf: bumped, \.\.\.build, followUrl/,
|
|
"the owner's repeated note keeps its follow link",
|
|
);
|
|
const main = readFileSync("widget/main.ts", "utf8");
|
|
assert.match(main, /is live on this site\./, "Loki says it in the thread");
|
|
assert.match(main, /launcher\.say\(/, "and beside the launcher when the panel is closed");
|
|
assert.match(main, /changes\.start\(\)/, "asked for on arrival");
|
|
|
|
// ---- the collapsed line says what moves and what landed, in that order ----
|
|
{
|
|
const c = (label: string, live = false) =>
|
|
({
|
|
id: label,
|
|
text: label,
|
|
at: "",
|
|
label,
|
|
tone: "neutral",
|
|
detail: "",
|
|
live,
|
|
settled: live,
|
|
href: null,
|
|
action: null,
|
|
// What the server marks as waiting on the owner (owner-view.ts).
|
|
needsYou: ["Needs you", SAVED_NOTE_LABEL, "Waiting"].includes(label),
|
|
}) as OwnerChange;
|
|
assert.equal(
|
|
changesSummary([c("Building"), c("In line"), c("In line"), c("Live", true), c("Done", true)]),
|
|
"Your changes · 1 building · 2 in line · 2 live",
|
|
);
|
|
assert.equal(
|
|
changesSummary([c("Needs you"), c("Live", true)]),
|
|
"Your changes · 1 needs you · 1 live",
|
|
);
|
|
assert.equal(
|
|
changesSummary([c("Needs you"), c(SAVED_NOTE_LABEL), c("On its way")]),
|
|
"Your changes · 2 need you · 1 on its way",
|
|
"the open list agrees with the line above it (it said '9 needs you', 2026-10-18)",
|
|
);
|
|
assert.equal(changesSummary([c("Closed")]), "Your changes · 1");
|
|
// The line carries ONE number: what waits on the owner's decision —
|
|
// failed attempts, saved notes, notes not started, and changes said but
|
|
// not saved. Nothing waiting: nothing on the line ("Watching" alone).
|
|
assert.equal(
|
|
changesHeadline([c("Live", true), c("Needs you"), c("Building")]),
|
|
"1 change needs you",
|
|
);
|
|
assert.equal(
|
|
changesHeadline([c("Needs you"), c(SAVED_NOTE_LABEL), c("Waiting")]),
|
|
"3 changes need you",
|
|
"a saved note and one not started wait on the owner too",
|
|
);
|
|
assert.equal(changesHeadline([c("Live", true), c("Starting"), c("Building")]), "");
|
|
assert.equal(changesHeadline([c("Live", true), c("Live", true)]), "");
|
|
assert.equal(changesHeadline([c("On its way")]), "");
|
|
assert.equal(changesHeadline([c("Closed")]), "", "nothing to say: nothing on the line");
|
|
assert.equal(
|
|
changesHeadline([c("Live", true)], { unsaved: 3 }),
|
|
"3 changes need you",
|
|
"changes said on the card and not saved yet are waiting on the owner",
|
|
);
|
|
// The server counts past the twelve rows it sends; the line follows it.
|
|
// Counting inside the newest twelve let three fresh notes push three
|
|
// failed fixes out — "9 need you" became 6 with nothing done (2026-10-20).
|
|
assert.equal(changesHeadline([c("Needs you")], { total: 9 }), "9 changes need you");
|
|
assert.equal(needsYouCount([c("Needs you"), c("Needs you")], { total: 9, unsaved: 1 }), 10);
|
|
// The open list shows every row the line counts, first.
|
|
const many = [
|
|
c("Live", true),
|
|
c("Building"),
|
|
c("Needs you"),
|
|
c("On its way"),
|
|
c(SAVED_NOTE_LABEL),
|
|
c("Needs you"),
|
|
];
|
|
const shown = shownChanges(many);
|
|
assert.deepEqual(
|
|
shown.slice(0, 3).map((x) => x.label),
|
|
["Needs you", SAVED_NOTE_LABEL, "Needs you"],
|
|
"every row that needs the owner leads the list",
|
|
);
|
|
assert.equal(shown.length, 3, "and the rest fill up to CHANGES_SHOWN, no more");
|
|
assert.equal(
|
|
shownChanges([c("Needs you"), c("Needs you"), c("Needs you"), c("Needs you"), c("Live", true)])
|
|
.length,
|
|
4,
|
|
"never fewer rows than the line counts",
|
|
);
|
|
assert.match(builtSay({ started: 3, total: 3 }), /Started your 3 saved notes/);
|
|
assert.match(
|
|
builtSay({ started: 5, total: 5, builds: 2 }),
|
|
/5 saved notes as 2 builds, one per page/,
|
|
);
|
|
assert.match(
|
|
builtSay({ started: 3, total: 3, builds: 1 }),
|
|
/as one build — they are all about the same page/,
|
|
);
|
|
assert.match(
|
|
builtSay({ started: 1, total: 3, note: "Limit reached." }),
|
|
/Started 1 of 3.*Limit reached/,
|
|
);
|
|
assert.equal(builtSay({ started: 0, total: 0 }), "There are no saved notes waiting.");
|
|
// The widget's word for a saved note is the server's.
|
|
assert.ok(
|
|
readFileSync("src/lib/feedback/owner-view.ts", "utf8").includes(`label: "${SAVED_NOTE_LABEL}"`),
|
|
"owner-view labels a saved note exactly as the widget counts it",
|
|
);
|
|
}
|
|
|
|
console.log("widget-changes: ok");
|