Skip to content

Commit 12d1ef3

Browse files
committed
fix(bots): the catalog's Bots share as few colours as they can
After the palette re-tune the ten catalog Bots drew in seven colours: three pairs shared one, and none was red. On-call Handover, which drew green beside Interview Notes, now names red in its avatar_seed, so the ten use all eight colours and only two are shared. The four shipped Bots already draw yellow, red, cyan and grey, and keep their seeds.
1 parent 456ca39 commit 12d1ef3

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

‎app/tests/bot-orb.test.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
spyOn,
88
test,
99
} from "bun:test";
10-
import { readFileSync } from "node:fs";
10+
import { readdirSync, readFileSync } from "node:fs";
1111
import { GlobalRegistrator } from "@happy-dom/global-registrator";
1212
import { BOT_COLOURS, seedFor } from "@openbot/shared/bot-look";
1313
import { act, cleanup, render } from "@testing-library/react";
@@ -306,6 +306,27 @@ describe("the colours", () => {
306306
expect(distance(a, b)).toBeGreaterThan(APART * 1.5);
307307
});
308308

309+
test("the catalog's Bots use every colour, and share as few as ten Bots in eight colours can", () => {
310+
// `examples/fintech/catalog/*.yaml`, each with its own `avatar_seed`.
311+
const catalog = new URL("../../examples/fintech/catalog/", import.meta.url);
312+
const colours = readdirSync(catalog)
313+
.filter((file) => file.endsWith(".yaml"))
314+
.map((file) => {
315+
const seed = readFileSync(new URL(file, catalog), "utf8").match(
316+
/^avatar_seed: (\S+)$/m,
317+
)?.[1];
318+
if (!seed) throw new Error(`${file} has no avatar_seed.`);
319+
return orbLookFor(seed).palette;
320+
});
321+
expect(colours).toHaveLength(10);
322+
expect(new Set(colours)).toEqual(new Set(BOT_COLOURS));
323+
// Ten in eight is two colours shared, by two Bots each, and no more.
324+
const shared = BOT_COLOURS.filter(
325+
(colour) => colours.filter((c) => c === colour).length > 1,
326+
);
327+
expect(shared).toHaveLength(colours.length - BOT_COLOURS.length);
328+
});
329+
309330
test("every Bot that never chose a look keeps the face it had", () => {
310331
// Every part of every default Bot's look, pinned: a seed that names no colour draws as before.
311332
expect(

‎examples/fintech/catalog/oncall-handover.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ role_description: >-
1212
close or silence an alert, and never tell the next on-call what to do about something. If a tool
1313
reports an error or says it is not connected, say so and stop: a handover assembled from a partial
1414
read is worse than no handover, because the reader cannot tell which half is missing.
15-
avatar_seed: oncall-handover
15+
# Red by name: its id alone draws green, as Interview Notes does, and no catalog Bot was red.
16+
avatar_seed: coral:oncall-handover
1617
type: built-in
1718
system_prompt: >-
1819
Still open first, each with its last update and who wrote it. Then what fired and cleared, with

0 commit comments

Comments
 (0)