Official
chat
Built-in chat UI (JavaScript UI plugin).
The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/chat@0.2.7
Permissions in 0.2.7
Files
time.test.ts2.3 KB
// How the transcript tells time: spans of time and the day-aware time a message was sent.
import assert from "node:assert/strict";
import test from "node:test";
import { duration, sentAt } from "./time.ts";
test("a span of time reads in seconds, then minutes and seconds, then hours and minutes", () => {
assert.equal(duration(0), "0s");
assert.equal(duration(42_400), "42s");
assert.equal(duration(133_000), "2m 13s");
assert.equal(duration(185_000), "3m 05s");
assert.equal(duration(3_720_000), "1h 02m");
// A clock that went back never makes a negative time.
assert.equal(duration(-5_000), "0s");
});
test("a message's time knows the day it was sent", () => {
// Local times, so the test reads the same in every time zone.
const now = new Date(2026, 10, 3, 18, 0).getTime();
const at = (date: Date) => sentAt(date.toISOString(), now);
const time = (date: Date) => date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
const today = new Date(2026, 10, 3, 15, 42);
assert.equal(at(today)?.label, time(today));
const yesterday = new Date(2026, 10, 2, 23, 59);
assert.equal(at(yesterday)?.label, `Yesterday ${time(yesterday)}`);
const older = new Date(2026, 9, 28, 9, 5);
assert.equal(at(older)?.label, older.toLocaleDateString([], { month: "short", day: "numeric" }));
const lastYear = new Date(2025, 10, 3, 9, 5);
assert.equal(at(lastYear)?.label, lastYear.toLocaleDateString([], { month: "short", day: "numeric", year: "numeric" }));
// The tooltip has the whole date and the time.
assert.equal(at(older)?.full, older.toLocaleString([], { dateStyle: "full", timeStyle: "short" }));
assert.equal(sentAt(undefined, now), null);
assert.equal(sentAt("not a time", now), null);
});
test("formatting message timestamps does not allocate locale formatting per message", (ctx) => {
const methods = ["toLocaleTimeString", "toLocaleDateString", "toLocaleString"] as const;
const calls = methods.map((method) => ctx.mock.method(Date.prototype, method));
const now = new Date(2026, 10, 6, 15).getTime();
for (const date of [new Date(2026, 10, 6, 12), new Date(2026, 10, 5, 12), new Date(2026, 10, 1), new Date(2025, 10, 1)])
assert.ok(sentAt(date.toISOString(), now));
assert.equal(calls.reduce((count, method) => count + method.mock.callCount(), 0), 0);
});Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.9latest | Nov 21, 2026 | >=5 <6 | 349 KB | 5 permissions | Listed |
| 0.2.8 | Nov 16, 2026 | >=5 <6 | 348.6 KB | 5 permissions | Listed |
| 0.2.7 | Nov 11, 2026 | >=5 <6 | 314.3 KB | 5 permissions | Listed |
| 0.2.6 | Nov 9, 2026 | >=5 <6 | 306.2 KB | 5 permissions | Listed |
| 0.2.5 | Oct 27, 2026 | >=2 <4 | 178.6 KB | 5 permissions | Listed |
No comments yet.