A desktop coding agent with free access to frontier models.
TypeScript
fix: typed event helpers
Samrat Talukdarb0bd93e2d8de
diff --git a/apps/desktop/electron/events/PARITY.sha256 b/apps/desktop/electron/events/PARITY.sha256index fd1c247d..269f397e 100644--- a/apps/desktop/electron/events/PARITY.sha256+++ b/apps/desktop/electron/events/PARITY.sha256@@ -1,3 +1,3 @@# Hackathon events: the same file in omnirush-cli (assets/extensions/omnirush/events/)# and omnirush-gui (apps/desktop/electron/events/). A change to one must be ported to the other and this list updated in both.-beb04f48e3fecd9403527677a0407b0671531025dc27ba14d4c0270f400d14a5 events.mjs+2a9c20f5d5138826156a388c7ce3d740f9c24e9044617664d23a409e64c0aaa8 events.mjsdiff --git a/apps/desktop/electron/events/app-events.mjs b/apps/desktop/electron/events/app-events.mjsindex 94967826..b68a3152 100644--- a/apps/desktop/electron/events/app-events.mjs+++ b/apps/desktop/electron/events/app-events.mjs@@ -56,8 +56,10 @@ export function applyEventStock(dir, env = process.env, now = Date.now()) {* The account status as the window gets it: the profile's raw `eventsRecord` is kept on disk and replaced by* `events` ({ active, joined, restart }; empty lists when the account has none; null to show nothing at all). `started` is applyEventStock's answer.* `restart`: an event now asks for the mode this run did not start in; it applies from the next start.+ * @param {any} status+ * @param {{ dir: string, started?: { stock?: boolean, event?: boolean, asked?: boolean }, now?: number, local?: { locale?: string, timeZone?: string } }} options*/-export function accountEvents(status, { dir, started, now = Date.now(), local } = {}) {+export function accountEvents(status, { dir, started, now = Date.now(), local }) {if (!status || typeof status !== "object") return status;const { eventsRecord: record, ...rest } = status;if (record) saveEventsRecord(dir, record);diff --git a/apps/desktop/electron/events/events.mjs b/apps/desktop/electron/events/events.mjsindex 28005a56..600adb32 100644--- a/apps/desktop/electron/events/events.mjs+++ b/apps/desktop/electron/events/events.mjs@@ -13,6 +13,8 @@const NAME_MAX = 60;+/** @typedef {{ locale?: string, timeZone?: string }} Local */+const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);const text = (value, max) => (typeof value === "string" && value.trim() ? value.trim().slice(0, max) : null);/** An ISO time as ms, null when absent, NaN when present but unreadable. */@@ -62,6 +64,7 @@ export function eventsRecord(me) {return isRecord(me) ? { events: isRecord(me.events) ? me.events : null, stock_mode: isRecord(me.stock_mode) ? me.stock_mode : null } : null;}+/** @param {number} at @param {Intl.DateTimeFormatOptions} options @param {Local} [local] */function format(at, options, { locale, timeZone } = {}) {const zone = timeZone ? { timeZone } : {};try {@@ -77,7 +80,10 @@ function dayNumber(at, timeZone) {return Date.UTC(part("year"), part("month") - 1, part("day")) / 86_400_000;}-/** "ends today 6:00 PM", "ends tomorrow 6:00 PM", "ends Fri 6:00 PM", "ends Nov 7" (local time). */+/**+ * "ends today 6:00 PM", "ends tomorrow 6:00 PM", "ends Fri 6:00 PM", "ends Nov 7" (local time).+ * @param {number} at @param {number} [now] @param {Local} [local]+ */export function endsLabel(at, now = Date.now(), local = {}) {const clock = format(at, { hour: "numeric", minute: "2-digit" }, local);const days = dayNumber(at, local.timeZone) - dayNumber(now, local.timeZone);@@ -87,12 +93,15 @@ export function endsLabel(at, now = Date.now(), local = {}) {return `ends ${format(at, { month: "short", day: "numeric" }, local)}`;}-/** "Oct 29, 2026" (local date). */+/** "Oct 29, 2026" (local date). @param {number} at @param {Local} [local] */export function dateLabel(at, local = {}) {return format(at, { month: "short", day: "numeric", year: "numeric" }, local);}-/** The words both apps show for an active event: { title, detail }. */+/**+ * The words both apps show for an active event: { title, detail }.+ * @param {{ name: string, endsAt: number }} event @param {number} [now] @param {Local} [local]+ */export function eventBadge(event, now = Date.now(), local = {}) {return { title: `${event.name} hackathon`, detail: `You're participating · ${endsLabel(event.endsAt, now, local)}` };}