Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
code on this site's /mcp
CLI
none: the JSON below is the answer
JSON
/christopher/abso-core/files/worker/project/test/seat-notice.test.ts?version=277&format=json
38 linesgroups 100%Last change groups in version 277, 1 version changed it

You're reading version 277. The newest is 318, and no version since then changed this file. Go to the newestCompare with 318

1// A seat's earlier chat hears that another chat just used the seat: one line, worded here, once per key, to that seat only.
2import assert from "node:assert/strict";
3import { test } from "node:test";
4import { MemoryStore, Project } from "../project.ts";
5
6function setup() {
7 const store = new MemoryStore();
8 const project = new Project(store);
9 project.init({ "a.txt": "a\n" }, 0);
10 for (const a of ["ann", "bob"]) project.sync(a);
11 project.news("ann");
12 project.news("bob");
13 return { project, store };
16test("the seat hears it once, as news, and the history keeps it", () => {
17 const { project, store } = setup();
18 assert.equal(project.seatNotice("ann", "groups on DESKTOP-1", "seat ann:s1:s2:0"), true);
19 assert.equal(
20 project.seatNotice("ann", "groups on DESKTOP-1", "seat ann:s1:s2:0"),
21 false,
22 "the same key adds nothing",
23 );
24 assert.deepEqual(project.news("bob").news, [], "only that seat");
25 assert.deepEqual(project.news("ann").news, ["ann was just used from another chat (groups on DESKTOP-1)"]);
26 const replayed = Project.load(store.entries, new MemoryStore());
27 assert.deepEqual(replayed.news("ann").news, [], "replay knows it was heard");
28 assert.equal(replayed.seatNotice("ann", "groups on DESKTOP-1", "seat ann:s1:s2:0"), false, "and that it was sent");
29});
31test("no seat, no place or a key that isn't a seat's adds nothing; the place stays one line", () => {
32 const { project } = setup();
33 assert.equal(project.seatNotice("cal", "x on m", "seat cal:a:b:0"), false);
34 assert.equal(project.seatNotice("ann", " \n ", "seat ann:a:b:0"), false);
35 assert.equal(project.seatNotice("ann", "x on m", "announce 1"), false);
36 assert.equal(project.seatNotice("ann", "two\nlines on m", "seat ann:a:b:1"), true);
37 assert.deepEqual(project.news("ann").news, ["ann was just used from another chat (two lines on m)"]);
38});