forge-cw 0.1.28 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,10 @@
1
1
  // src/banner.tsx
2
- import { useState as useState2 } from "preact/hooks";
3
2
  import { definePanel } from "@forge-dev/sdk";
4
3
 
5
4
  // src/ops.ts
6
5
  var errorMessage = (e) => e instanceof Error ? e.message : String(e);
7
6
  var STARTS = ["issue", "request", "review"];
8
7
  var startsTask = (kind) => STARTS.includes(kind);
9
- var inAccount = (items, account) => account ? items.filter((i) => i.account === account) : items;
10
8
  function opFor(item, project) {
11
9
  if (item.kind === "to-task") return item.targetSession ? "send" : null;
12
10
  if (item.kind === "research") return "research";
@@ -18,7 +16,11 @@ function projectsFor({ names, owners }, account) {
18
16
  }
19
17
  var failedLine = (error) => `Last reading failed: ${error}`;
20
18
  var loadFailedLine = (error) => `Can't load Today: ${error}`;
21
- var notesLine = (notes) => notes?.length ? notes.join(" \xB7 ") : null;
19
+ var GH_SIGNED_OUT = "GitHub: gh is not signed in (run gh auth login)";
20
+ function tidyNotes(notes) {
21
+ return [...new Set(notes.map((n) => /^github\b[^:]*:/i.test(n) && /gh auth login|GH_TOKEN/i.test(n) ? GH_SIGNED_OUT : n))];
22
+ }
23
+ var notesLine = (notes) => notes?.length ? tidyNotes(notes).join(" \xB7 ") : null;
22
24
  var SOURCE_NAME = { slack: "Slack", linear: "Linear", reader: "Reader" };
23
25
  function sourcesLabel(sources) {
24
26
  const names = ["slack", "linear", "reader"].filter((s) => sources.includes(s)).map((s) => SOURCE_NAME[s]);
@@ -33,7 +35,6 @@ function groupProblems(problems) {
33
35
  }
34
36
  var groupLine = (g) => `${g.account} \xB7 ${g.label} did not respond`;
35
37
  var problemsLabel = (n) => `\u26A0 ${n} account problem${n === 1 ? "" : "s"}`;
36
- var accountsOf = (items) => [...new Set(items.flatMap((i) => i.account ? [i.account] : []))];
37
38
  function titleFor(i) {
38
39
  if (!i.issueKey) return i.title;
39
40
  const key = i.issueKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -45,9 +46,34 @@ function whoOf(i) {
45
46
  const who = i.who.trim();
46
47
  return !who || who.toLowerCase() === SOURCE_NAMES[i.source].toLowerCase() ? null : who;
47
48
  }
48
- var pendingLabel = (p) => p.kind === "ci" ? "CI failing" : p.kind === "review" ? "Review requested" : p.source === "linear" ? p.started ? "In progress" : "To do" : "Assigned";
49
- var pendingIn = (items, account) => account ? items.filter((p) => p.account === account) : items;
50
49
  var FIRST_READING_NOTE = "First reading \u2014 what you have open is under Pending.";
50
+ function newsList(items) {
51
+ const waiting = (i) => i.state === "proposed" || i.state === "failed" ? 0 : 1;
52
+ return items.filter((i) => i.state !== "dismissed").sort((a, b) => waiting(a) - waiting(b) || Date.parse(b.when) - Date.parse(a.when));
53
+ }
54
+ function ageShort(iso, now = /* @__PURE__ */ new Date()) {
55
+ const min = Math.max(0, Math.round((now.getTime() - Date.parse(iso)) / 6e4));
56
+ if (Number.isNaN(min)) return "";
57
+ if (min < 1) return "now";
58
+ if (min < 60) return `${min}m`;
59
+ if (min < 48 * 60) return `${Math.round(min / 60)}h`;
60
+ return `${Math.round(min / 1440)}d`;
61
+ }
62
+ var safeHref = (link) => /^https?:\/\//i.test(link) ? link : void 0;
63
+ var isOpenNews = (i) => i.state === "proposed" || i.state === "failed";
64
+ function bannerSummary(news, pending) {
65
+ return { fresh: news.filter(isOpenNews).length, pending: pending.length, ci: pending.filter((p) => p.kind === "ci").length, slack: pending.filter((p) => p.kind === "reply").length };
66
+ }
67
+ function summaryText(s) {
68
+ const urgent = [s.ci ? `${s.ci} CI` : "", s.slack ? `${s.slack} Slack` : ""].filter(Boolean).join(" \xB7 ");
69
+ return `${s.fresh} new \xB7 ${s.pending} pending${urgent ? ` (${urgent})` : ""}`;
70
+ }
71
+ function urgentRows(news, pending, max = 3) {
72
+ const open = newsList(news).filter(isOpenNews);
73
+ const urgent = [...pending.filter((p) => p.kind === "ci"), ...pending.filter((p) => p.kind === "reply")];
74
+ const first = urgent.slice(0, open.length ? Math.max(1, max - 1) : max).map((item) => ({ kind: "pending", item }));
75
+ return [...first, ...open.slice(0, max - first.length).map((item) => ({ kind: "news", item }))];
76
+ }
51
77
 
52
78
  // src/rows.tsx
53
79
  import { useCallback, useEffect, useRef, useState } from "preact/hooks";
@@ -65,25 +91,6 @@ function AccountChip({ account }) {
65
91
  const token = accountToken(account);
66
92
  return /* @__PURE__ */ jsx("span", { title: `Account ${account}`, style: { fontSize: "10.5px", fontWeight: 600, padding: "2px 7px", borderRadius: "6px", whiteSpace: "nowrap", color: `var(${token})`, background: soft(token, 15) }, children: account });
67
93
  }
68
- var FILTER_KEY = "today.account";
69
- function useAccountFilter() {
70
- const [account, setAccount] = useState(() => {
71
- try {
72
- return localStorage.getItem(FILTER_KEY) ?? "";
73
- } catch {
74
- return "";
75
- }
76
- });
77
- const choose = (a) => {
78
- setAccount(a);
79
- try {
80
- if (a) localStorage.setItem(FILTER_KEY, a);
81
- else localStorage.removeItem(FILTER_KEY);
82
- } catch {
83
- }
84
- };
85
- return [account, choose];
86
- }
87
94
  function useDigest(forge, path = "/digest") {
88
95
  const [reply, setReply] = useState(null);
89
96
  const [error, setError] = useState(null);
@@ -149,6 +156,9 @@ function useActing(forge, date, reload, hurry = () => {
149
156
  const startPending = (item, project) => run(async () => {
150
157
  await forge.action("pending-start", { id: item.id, ...project ? { project } : {} });
151
158
  });
159
+ const researchPending = (item) => run(async () => {
160
+ await forge.action("pending-research", { id: item.id });
161
+ });
152
162
  const hidePending = (item) => run(async () => {
153
163
  await forge.action("pending-hide", { id: item.id });
154
164
  });
@@ -176,7 +186,7 @@ function useActing(forge, date, reload, hurry = () => {
176
186
  const s = await forge.action("reconnect", { account });
177
187
  if (s) forge.openSession(s.project, s.sessionDir);
178
188
  });
179
- return { busy, refreshing, retrying, retry, reconnect, run, act, refresh, startPending, hidePending };
189
+ return { busy, refreshing, retrying, retry, reconnect, run, act, refresh, startPending, researchPending, hidePending };
180
190
  }
181
191
  function dayOf(date) {
182
192
  const [y, m, d] = date.split("-").map(Number);
@@ -191,9 +201,6 @@ function dayLabel(now, date) {
191
201
  return `${part} \xB7 your ${now.toLocaleDateString("en-US", { weekday: "long" })} ${now.getDate()}`;
192
202
  }
193
203
  var shortDay = (now, date) => !date || isToday(date, now) ? "Today" : dayLabel(now, date);
194
- function foldedNow(folded, items) {
195
- return folded || !items.some((i) => i.state === "proposed" || i.state === "failed");
196
- }
197
204
  var clock = (d) => d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
198
205
  function windowTime(at, read) {
199
206
  if (at.toDateString() === read.toDateString()) return clock(at);
@@ -204,18 +211,10 @@ function readLine(d) {
204
211
  const read = new Date(d.readAt);
205
212
  return `Read at ${clock(read)} \xB7 changes since ${windowTime(new Date(d.windowStart ?? d.since), read)}`;
206
213
  }
207
- function ago(iso, now = /* @__PURE__ */ new Date()) {
208
- const t = new Date(iso);
209
- const min = Math.round((now.getTime() - t.getTime()) / 6e4);
210
- if (min < 1) return "just now";
211
- if (min < 60) return `${min} min ago`;
212
- if (min < 24 * 60) return `${Math.round(min / 60)} h ago`;
213
- return t.toLocaleDateString("en-US", { month: "short", day: "numeric" }) + " " + clock(t);
214
- }
215
214
  var SOURCE_LABEL = { linear: "Linear", slack: "Slack", github: "GitHub" };
216
215
  var SOURCE_TINT = { linear: "#5e6ad2 22%", slack: "#e01e5a 18%", github: "#8b949e 24%" };
217
216
  function SourceIcon({ source }) {
218
- return /* @__PURE__ */ jsx("div", { title: SOURCE_LABEL[source], style: { width: "30px", height: "30px", borderRadius: "8px", display: "grid", placeItems: "center", flexShrink: 0, background: `color-mix(in srgb, ${SOURCE_TINT[source]}, transparent)` }, children: source === "github" ? /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", style: { color: "var(--ink)" }, d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" }) }) : source === "linear" ? /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 100 100", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "#8c94f0", d: "M1.2 61.5 38.5 98.8C19.8 95.6 4.4 80.2 1.2 61.5zM0 46.9 53.1 100c3.4-.2 6.8-.8 10-1.6L1.6 36.9C.8 40.1.2 43.5 0 46.9zM4.9 27 73 95.1c2.6-1.1 5.1-2.5 7.4-4L8.9 19.6c-1.5 2.3-2.9 4.8-4 7.4zM14.4 13.8C23.4 5.3 35.5 0 48.9 0 76 0 100 24 100 51.1c0 13.4-5.3 25.5-13.8 34.5z" }) }) : /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", "stroke-width": "2.6", "stroke-linecap": "round", children: [
217
+ return /* @__PURE__ */ jsx("div", { title: SOURCE_LABEL[source], style: { width: "22px", height: "22px", borderRadius: "6px", display: "grid", placeItems: "center", flexShrink: 0, background: `color-mix(in srgb, ${SOURCE_TINT[source]}, transparent)` }, children: source === "github" ? /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", style: { color: "var(--ink)" }, d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" }) }) : source === "linear" ? /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 100 100", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { fill: "#8c94f0", d: "M1.2 61.5 38.5 98.8C19.8 95.6 4.4 80.2 1.2 61.5zM0 46.9 53.1 100c3.4-.2 6.8-.8 10-1.6L1.6 36.9C.8 40.1.2 43.5 0 46.9zM4.9 27 73 95.1c2.6-1.1 5.1-2.5 7.4-4L8.9 19.6c-1.5 2.3-2.9 4.8-4 7.4zM14.4 13.8C23.4 5.3 35.5 0 48.9 0 76 0 100 24 100 51.1c0 13.4-5.3 25.5-13.8 34.5z" }) }) : /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", "stroke-width": "2.6", "stroke-linecap": "round", children: [
219
218
  /* @__PURE__ */ jsx("path", { stroke: "#36c5f0", d: "M9 3.5v6" }),
220
219
  /* @__PURE__ */ jsx("path", { stroke: "#2eb67d", d: "M20.5 9h-6" }),
221
220
  /* @__PURE__ */ jsx("path", { stroke: "#ecb22e", d: "M15 20.5v-6" }),
@@ -267,118 +266,121 @@ function outcome(item) {
267
266
  where ? ` \xB7 ${where}` : ""
268
267
  ] });
269
268
  }
269
+ var sourceOf = (p) => SOURCE_LABEL[p.source];
270
+ var mono = { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 };
271
+ function Line({ source, keyText, title, account, when, primary, children, dim }) {
272
+ const [open, setOpen] = useState(false);
273
+ return /* @__PURE__ */ jsxs("div", { style: { borderRadius: "9px", background: open ? soft("--ink", 3) : "transparent", border: `1px solid ${open ? "var(--hair)" : "transparent"}`, opacity: dim ? 0.55 : 1, transition: "background .2s var(--ease)" }, children: [
274
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", padding: "4px 6px", minHeight: "30px" }, children: [
275
+ /* @__PURE__ */ jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen(!open), style: { flex: 1, minWidth: 0, display: "flex", alignItems: "center", gap: "8px", font: "inherit", fontSize: "12.5px", textAlign: "left", padding: 0, border: 0, background: "none", color: "var(--ink)", cursor: "pointer" }, children: [
276
+ /* @__PURE__ */ jsx(SourceIcon, { source }),
277
+ /* @__PURE__ */ jsx("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontWeight: 530 }, children: title }),
278
+ keyText && /* @__PURE__ */ jsx("span", { style: { ...mono, flexShrink: 0, marginLeft: "auto" }, children: keyText })
279
+ ] }),
280
+ account && /* @__PURE__ */ jsx("span", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(AccountChip, { account }) }),
281
+ /* @__PURE__ */ jsx("span", { title: when, style: { fontSize: "11px", color: "var(--ink-3)", minWidth: "26px", textAlign: "right" }, children: ageShort(when) }),
282
+ primary && /* @__PURE__ */ jsx("span", { style: { display: "flex", alignItems: "center", gap: "6px", flexShrink: 0 }, children: primary })
283
+ ] }),
284
+ open && /* @__PURE__ */ jsx("div", { style: { padding: "2px 8px 9px 36px", display: "flex", flexDirection: "column", gap: "7px", fontSize: "11.5px", color: "var(--ink-2)" }, children })
285
+ ] });
286
+ }
287
+ var Quote = ({ text }) => /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", borderLeft: "2px solid var(--hair-2)", paddingLeft: "8px", fontStyle: "italic" }, children: [
288
+ "\u201C",
289
+ text,
290
+ "\u201D"
291
+ ] });
292
+ function OpenLink({ href, label }) {
293
+ const safe = safeHref(href);
294
+ return safe ? /* @__PURE__ */ jsxs("a", { href: safe, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--ink-2)", textDecoration: "none", borderBottom: "1px dotted var(--ink-3)" }, children: [
295
+ label,
296
+ " \u2197"
297
+ ] }) : null;
298
+ }
299
+ var Actions = ({ children }) => /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" }, children });
270
300
  var Row = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
271
301
  const [project, setProject] = useState(item.project ?? "");
272
302
  const open = item.state === "proposed" || item.state === "failed";
273
303
  const needsProject = startsTask(item.kind) && !item.project;
274
304
  const op = opFor(item, project);
275
305
  const where = item.source === "slack" ? "in" : "on";
276
- return /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "30px 1fr auto", gap: "12px", alignItems: "center", padding: "10px 12px", borderRadius: "11px", background: soft("--ink", 3), border: "1px solid var(--hair)", opacity: item.state === "dismissed" ? 0.55 : 1, transition: "background .2s var(--ease)" }, children: [
277
- /* @__PURE__ */ jsx(SourceIcon, { source: item.source }),
278
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
279
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: 560, fontSize: "13px", display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }, children: [
280
- item.issueKey && /* @__PURE__ */ jsx("span", { style: { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 }, children: item.issueKey }),
281
- /* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: titleFor(item) })
282
- ] }),
283
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginTop: "3px", fontSize: "11.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
284
- whoOf(item) && /* @__PURE__ */ jsx(Avatar, { who: item.who }),
285
- /* @__PURE__ */ jsx("span", { children: whoOf(item) ? /* @__PURE__ */ jsxs(Fragment, { children: [
286
- item.who,
287
- " ",
288
- where,
289
- " ",
290
- strong(item.where)
291
- ] }) : strong(item.where) }),
292
- /* @__PURE__ */ jsx(Sep, {}),
293
- /* @__PURE__ */ jsx("span", { children: ago(item.when) }),
294
- item.account && /* @__PURE__ */ jsxs(Fragment, { children: [
295
- /* @__PURE__ */ jsx(Sep, {}),
296
- /* @__PURE__ */ jsx(AccountChip, { account: item.account })
297
- ] }),
306
+ const s = item.startedSession;
307
+ const go = /* @__PURE__ */ jsx(Btn, { label: item.state === "failed" ? "Retry" : KIND[item.kind].verb, disabled: acting.busy || !op, onClick: () => op && acting.act(item, op, needsProject ? project : void 0) });
308
+ const primary = open ? needsProject ? null : go : item.state === "done" ? s ? /* @__PURE__ */ jsx(Btn, { label: "Open session", onClick: () => forge.openSession(s.project, s.sessionDir) }) : /* @__PURE__ */ jsx("span", { style: { fontSize: "11.5px", color: "var(--green)" }, children: item.kind === "to-task" ? "Sent" : "Done" }) : null;
309
+ return /* @__PURE__ */ jsxs(Line, { source: item.source, keyText: item.issueKey, title: titleFor(item), account: item.account, when: item.when, primary, children: [
310
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
311
+ /* @__PURE__ */ jsx(KindPill, { kind: item.kind }),
312
+ whoOf(item) && /* @__PURE__ */ jsx(Avatar, { who: item.who }),
313
+ /* @__PURE__ */ jsx("span", { children: whoOf(item) ? /* @__PURE__ */ jsxs(Fragment, { children: [
314
+ item.who,
315
+ " ",
316
+ where,
317
+ " ",
318
+ strong(item.where)
319
+ ] }) : strong(item.where) }),
320
+ item.kind === "to-task" && item.targetSession && /* @__PURE__ */ jsxs(Fragment, { children: [
298
321
  /* @__PURE__ */ jsx(Sep, {}),
299
- /* @__PURE__ */ jsxs("a", { href: item.link, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--ink-2)", textDecoration: "none", borderBottom: "1px dotted var(--ink-3)" }, children: [
300
- "View in ",
301
- SOURCE_LABEL[item.source],
302
- " \u2197"
303
- ] }),
304
- item.kind === "to-task" && item.targetSession && /* @__PURE__ */ jsxs(Fragment, { children: [
305
- /* @__PURE__ */ jsx(Sep, {}),
306
- /* @__PURE__ */ jsxs("span", { children: [
307
- "goes to ",
308
- strong(item.targetSession.sessionDir)
309
- ] })
310
- ] }),
311
- item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
312
- /* @__PURE__ */ jsx(Sep, {}),
313
- /* @__PURE__ */ jsxs("span", { children: [
314
- "project ",
315
- strong(item.project)
316
- ] })
322
+ /* @__PURE__ */ jsxs("span", { children: [
323
+ "goes to ",
324
+ strong(item.targetSession.sessionDir)
317
325
  ] })
318
326
  ] }),
319
- item.quote && /* @__PURE__ */ jsxs("div", { style: { marginTop: "6px", fontSize: "12px", color: "var(--ink-2)", borderLeft: "2px solid var(--hair-2)", paddingLeft: "8px", fontStyle: "italic" }, children: [
320
- "\u201C",
321
- item.quote,
322
- "\u201D"
323
- ] }),
324
- item.error && /* @__PURE__ */ jsx("div", { style: { marginTop: "6px", fontSize: "11.5px", color: "var(--red)" }, children: item.error })
327
+ item.project && item.kind !== "to-task" && /* @__PURE__ */ jsxs(Fragment, { children: [
328
+ /* @__PURE__ */ jsx(Sep, {}),
329
+ /* @__PURE__ */ jsxs("span", { children: [
330
+ "project ",
331
+ strong(item.project)
332
+ ] })
333
+ ] })
325
334
  ] }),
326
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
327
- /* @__PURE__ */ jsx(KindPill, { kind: item.kind }),
328
- open && needsProject && /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
329
- open && /* @__PURE__ */ jsx(Btn, { label: item.state === "failed" ? "Retry" : KIND[item.kind].verb, disabled: acting.busy || !op, onClick: () => op && acting.act(item, op, needsProject ? project : void 0) }),
330
- open && /* @__PURE__ */ jsx(Btn, { label: "Dismiss", style: ghostStyle, disabled: acting.busy, onClick: () => acting.act(item, "dismiss") }),
331
- item.state === "done" && outcome(item),
332
- item.state === "done" && item.startedSession && /* @__PURE__ */ jsx(Btn, { label: "Open session", onClick: () => forge.openSession(item.startedSession.project, item.startedSession.sessionDir) }),
333
- item.state === "dismissed" && /* @__PURE__ */ jsx("span", { style: { fontSize: "11.5px", color: "var(--ink-3)" }, children: "Dismissed" })
335
+ item.quote && /* @__PURE__ */ jsx(Quote, { text: item.quote }),
336
+ item.error && /* @__PURE__ */ jsx("div", { style: { color: "var(--red)" }, children: item.error }),
337
+ item.state === "done" && outcome(item),
338
+ /* @__PURE__ */ jsxs(Actions, { children: [
339
+ open && needsProject && /* @__PURE__ */ jsxs(Fragment, { children: [
340
+ /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
341
+ go
342
+ ] }),
343
+ /* @__PURE__ */ jsx(OpenLink, { href: item.link, label: `Open in ${sourceOf(item)}` }),
344
+ open && /* @__PURE__ */ jsx(Btn, { label: "Dismiss", style: ghostStyle, disabled: acting.busy, onClick: () => acting.act(item, "dismiss") })
334
345
  ] })
335
346
  ] });
336
347
  };
337
- var PENDING_TOKEN = { ci: "--red", review: "--blue", issue: "--green" };
338
- var PendingRow = ({ item, projects = EMPTY_PROJECTS, acting, forge, compact }) => {
348
+ var PENDING_TOKEN = { ci: "--red", review: "--blue", issue: "--green", reply: "--purple" };
349
+ var PendingRow = ({ item, projects = EMPTY_PROJECTS, acting, forge }) => {
339
350
  const [project, setProject] = useState(item.project ?? "");
340
351
  const token = PENDING_TOKEN[item.kind];
341
352
  const target = item.project ?? project;
342
- return /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "30px 1fr auto", gap: "12px", alignItems: "center", padding: compact ? "7px 10px" : "10px 12px", borderRadius: "11px", background: soft("--ink", 3), border: "1px solid var(--hair)" }, children: [
343
- /* @__PURE__ */ jsx(SourceIcon, { source: item.source }),
344
- /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
345
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: 560, fontSize: "13px", display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }, children: [
346
- item.issueKey && /* @__PURE__ */ jsx("span", { style: { fontFamily: "var(--mono, ui-monospace, monospace)", fontSize: "11.5px", color: "var(--ink-2)", fontWeight: 500 }, children: item.issueKey }),
347
- /* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: titleFor(item) })
353
+ const slack = item.kind === "reply";
354
+ const start = /* @__PURE__ */ jsx(Btn, { label: item.kind === "review" ? "Review" : "Start", disabled: acting.busy || !target, onClick: () => acting.startPending(item, item.project ? void 0 : project) });
355
+ const primary = item.targetSession ? /* @__PURE__ */ jsx(Btn, { label: "Open task", onClick: () => forge.openSession(item.targetSession.project, item.targetSession.sessionDir) }) : item.project ? start : null;
356
+ return /* @__PURE__ */ jsxs(Line, { source: item.source, keyText: item.issueKey, title: titleFor(item), account: item.account, when: item.when, primary, children: [
357
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
358
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "10.5px", fontWeight: 600, padding: "2px 7px", borderRadius: "6px", whiteSpace: "nowrap", color: `var(${token})`, background: soft(token, 15) }, children: slack ? "Waiting on you" : item.kind === "ci" ? "CI failing" : item.kind === "review" ? "Review requested" : item.state }),
359
+ slack ? /* @__PURE__ */ jsxs("span", { children: [
360
+ item.who,
361
+ " in ",
362
+ strong(item.where ?? "")
363
+ ] }) : /* @__PURE__ */ jsxs("span", { children: [
364
+ item.repo ? strong(item.repo) : null,
365
+ item.repo && item.state ? " \xB7 " : "",
366
+ item.state
348
367
  ] }),
349
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginTop: "3px", fontSize: "11.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
350
- /* @__PURE__ */ jsxs("span", { children: [
351
- item.repo ? strong(item.repo) : null,
352
- item.repo && item.state ? " \xB7 " : "",
353
- item.state
354
- ] }),
355
- (item.repo || item.state) && /* @__PURE__ */ jsx(Sep, {}),
356
- /* @__PURE__ */ jsx("span", { children: ago(item.when) }),
357
- item.account && /* @__PURE__ */ jsxs(Fragment, { children: [
358
- /* @__PURE__ */ jsx(Sep, {}),
359
- /* @__PURE__ */ jsx(AccountChip, { account: item.account })
360
- ] }),
368
+ item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
361
369
  /* @__PURE__ */ jsx(Sep, {}),
362
- /* @__PURE__ */ jsxs("a", { href: item.link, target: "_blank", rel: "noopener noreferrer", style: { color: "var(--ink-2)", textDecoration: "none", borderBottom: "1px dotted var(--ink-3)" }, children: [
363
- "View in ",
364
- SOURCE_LABEL[item.source],
365
- " \u2197"
366
- ] }),
367
- item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
368
- /* @__PURE__ */ jsx(Sep, {}),
369
- /* @__PURE__ */ jsxs("span", { children: [
370
- "project ",
371
- strong(item.project)
372
- ] })
370
+ /* @__PURE__ */ jsxs("span", { children: [
371
+ "project ",
372
+ strong(item.project)
373
373
  ] })
374
374
  ] })
375
375
  ] }),
376
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
377
- /* @__PURE__ */ jsx("span", { style: { fontSize: "10.5px", fontWeight: 600, padding: "2px 7px", borderRadius: "6px", whiteSpace: "nowrap", color: `var(${token})`, background: soft(token, 15) }, children: pendingLabel(item) }),
378
- item.targetSession ? /* @__PURE__ */ jsx(Btn, { label: "Open task", onClick: () => forge.openSession(item.targetSession.project, item.targetSession.sessionDir) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
379
- !item.project && /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
380
- /* @__PURE__ */ jsx(Btn, { label: item.kind === "review" ? "Review" : "Start", disabled: acting.busy || !target, onClick: () => acting.startPending(item, item.project ? void 0 : project) })
376
+ item.quote && /* @__PURE__ */ jsx(Quote, { text: item.quote }),
377
+ /* @__PURE__ */ jsxs(Actions, { children: [
378
+ !item.targetSession && !item.project && /* @__PURE__ */ jsxs(Fragment, { children: [
379
+ /* @__PURE__ */ jsx(ProjectPicker, { projects: projectsFor(projects, item.account), value: project, onChange: setProject }),
380
+ start
381
381
  ] }),
382
+ /* @__PURE__ */ jsx(OpenLink, { href: item.link, label: `Open in ${sourceOf(item)}` }),
383
+ slack && !item.targetSession && /* @__PURE__ */ jsx(Btn, { label: "Research", style: ghostStyle, disabled: acting.busy, onClick: () => acting.researchPending(item) }),
382
384
  /* @__PURE__ */ jsx(Btn, { label: "Hide", style: ghostStyle, disabled: acting.busy, onClick: () => acting.hidePending(item) })
383
385
  ] })
384
386
  ] });
@@ -388,6 +390,8 @@ var READING_CSS = `
388
390
  @keyframes today-pulse { 0%, 100% { opacity: .55 } 50% { opacity: 1 } }
389
391
  .today-spin { animation: today-spin .8s linear infinite }
390
392
  .today-pulse { animation: today-pulse 1.4s ease-in-out infinite }
393
+ .today-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px; align-items: start }
394
+ @media (max-width: 900px) { .today-cols { grid-template-columns: minmax(0, 1fr) } }
391
395
  @media (prefers-reduced-motion: reduce) { .today-spin, .today-pulse { animation: none } }`;
392
396
  function useReadingStyles() {
393
397
  if (typeof document !== "undefined" && !document.getElementById("today-reading-css")) {
@@ -413,93 +417,31 @@ function ReadingLine({ reading }) {
413
417
  accounts.length > 0 && /* @__PURE__ */ jsx("span", { children: "\u2026" })
414
418
  ] });
415
419
  }
416
- function SkeletonRows() {
417
- useReadingStyles();
418
- return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [0, 1, 2].map((n) => /* @__PURE__ */ jsxs("div", { class: "today-pulse", style: { display: "flex", alignItems: "center", gap: "12px", padding: "10px 12px", borderRadius: "10px", background: "var(--elev)", border: "1px solid var(--hair)", animationDelay: `${n * 0.15}s` }, children: [
419
- /* @__PURE__ */ jsx("div", { style: { width: "30px", height: "30px", borderRadius: "8px", background: "var(--hair)" } }),
420
- /* @__PURE__ */ jsxs("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "6px" }, children: [
421
- /* @__PURE__ */ jsx("div", { style: { height: "9px", width: `${70 - n * 12}%`, borderRadius: "5px", background: "var(--hair)" } }),
422
- /* @__PURE__ */ jsx("div", { style: { height: "8px", width: "35%", borderRadius: "5px", background: "var(--hair)" } })
423
- ] })
424
- ] }, n)) });
425
- }
426
- function ProblemRow({ group, acting, details = false }) {
427
- const mine = acting.retrying === group.account;
428
- return /* @__PURE__ */ jsxs("div", { role: "alert", title: group.reasons.join("\n"), style: { padding: "7px 10px", borderRadius: "10px", fontSize: "12px", color: "var(--ink-2)", background: soft("--orange", 10), border: `1px solid ${soft("--orange", 35)}` }, children: [
429
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
430
- /* @__PURE__ */ jsx("span", { style: { color: "var(--orange)" }, children: "\u26A0" }),
431
- /* @__PURE__ */ jsx("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: groupLine(group) }),
432
- /* @__PURE__ */ jsxs("span", { style: { marginLeft: "auto", display: "flex", gap: "8px", flexShrink: 0 }, children: [
433
- /* @__PURE__ */ jsx(Btn, { label: mine ? "Reading\u2026" : "Retry", disabled: acting.busy, onClick: () => acting.retry(group.account) }),
434
- /* @__PURE__ */ jsx(Btn, { label: "Reconnect", style: ghostStyle, disabled: acting.busy, onClick: () => acting.reconnect(group.account) })
435
- ] })
436
- ] }),
437
- details && /* @__PURE__ */ jsx("ul", { style: { margin: "6px 0 0 22px", padding: 0, color: "var(--ink-3)", fontSize: "11.5px" }, children: group.reasons.map((r) => /* @__PURE__ */ jsx("li", { children: r }, r)) })
438
- ] });
439
- }
440
420
 
441
421
  // src/banner.tsx
442
422
  import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "preact/jsx-runtime";
443
- var pill = { display: "flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--ink-2)", padding: "3px 9px", borderRadius: "20px", background: "var(--elev)", border: "1px solid var(--hair)" };
444
- function Count({ token, n, label }) {
445
- if (n === 0) return null;
446
- return /* @__PURE__ */ jsxs2("span", { style: pill, children: [
447
- /* @__PURE__ */ jsx2("i", { style: { width: "7px", height: "7px", borderRadius: "50%", background: `var(${token})` } }),
448
- n,
449
- " ",
450
- label
451
- ] });
452
- }
453
- function FilterChip({ label, n, on, token, onClick }) {
454
- const tint = token ?? "--blue";
455
- return /* @__PURE__ */ jsxs2("button", { type: "button", "aria-pressed": on, onClick, style: { ...pill, font: "inherit", fontSize: "11.5px", cursor: "pointer", color: on ? "var(--ink)" : "var(--ink-2)", borderColor: on ? `var(${tint})` : "var(--hair)", background: on ? soft(tint, 15) : "var(--elev)" }, children: [
456
- token && /* @__PURE__ */ jsx2("i", { style: { width: "7px", height: "7px", borderRadius: "50%", background: `var(${token})` } }),
457
- label,
458
- " \xB7 ",
459
- n
460
- ] });
461
- }
462
- var live = (items) => items.filter((i) => i.state !== "dismissed");
463
- var done = (items, pick) => items.filter((i) => i.state === "done" && pick(i.kind)).length;
464
423
  function shell(children) {
465
- return /* @__PURE__ */ jsx2("div", { style: { position: "relative", borderRadius: "16px", padding: "1px", background: `linear-gradient(135deg, ${soft("--blue", 55)}, ${soft("--purple", 40)} 45%, var(--hair) 80%)`, boxShadow: `0 10px 40px ${soft("--blue", 10)}` }, children: /* @__PURE__ */ jsx2("div", { style: { borderRadius: "15px", background: "radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--blue) 14%, var(--card)) 0%, var(--card) 55%)" }, children }) });
466
- }
467
- var PENDING_SHOWN = 5;
468
- function PendingFold({ pending, projects, acting, forge }) {
469
- const [open, setOpen] = useState2(false);
470
- if (pending.length === 0) return null;
471
- return /* @__PURE__ */ jsxs2("div", { style: { marginTop: "10px" }, children: [
472
- /* @__PURE__ */ jsxs2("button", { type: "button", "aria-expanded": open, onClick: () => setOpen(!open), style: { font: "inherit", fontSize: "12px", fontWeight: 600, padding: 0, border: 0, background: "none", cursor: "pointer", color: "var(--ink-2)" }, children: [
473
- open ? "\u25BE" : "\u25B8",
474
- " Pending \xB7 ",
475
- pending.length
476
- ] }),
477
- open && /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "6px", marginTop: "8px" }, children: [
478
- pending.slice(0, PENDING_SHOWN).map((p) => /* @__PURE__ */ jsx2(PendingRow, { item: p, projects, acting, forge, compact: true }, p.id)),
479
- /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(Btn, { label: "See all \u2192", style: ghostStyle, onClick: () => forge.openPage() }) })
480
- ] })
481
- ] });
424
+ return /* @__PURE__ */ jsx2("div", { style: { position: "relative", borderRadius: "14px", padding: "1px", background: `linear-gradient(135deg, ${soft("--blue", 55)}, ${soft("--purple", 40)} 45%, var(--hair) 80%)`, boxShadow: `0 8px 30px ${soft("--blue", 8)}` }, children: /* @__PURE__ */ jsx2("div", { style: { borderRadius: "13px", background: "radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--blue) 12%, var(--card)) 0%, var(--card) 55%)" }, children }) });
482
425
  }
483
426
  function Strip({ title, children, actions, below }) {
484
427
  return shell(
485
428
  /* @__PURE__ */ jsxs2(Fragment2, { children: [
486
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "9px 16px", fontSize: "12.5px", color: "var(--ink-2)" }, children: [
429
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "8px 14px", fontSize: "12.5px", color: "var(--ink-2)", flexWrap: "wrap" }, children: [
487
430
  /* @__PURE__ */ jsx2("span", { style: { color: "var(--orange)" }, children: "\u2600\uFE0E" }),
488
431
  /* @__PURE__ */ jsx2("b", { style: { color: "var(--ink)", fontWeight: 600 }, children: title }),
489
432
  children,
490
433
  /* @__PURE__ */ jsx2("span", { style: { marginLeft: "auto", display: "flex", gap: "8px" }, children: actions })
491
434
  ] }),
492
- below && /* @__PURE__ */ jsx2("div", { style: { padding: "0 16px 10px" }, children: below })
435
+ below && /* @__PURE__ */ jsx2("div", { style: { padding: "0 10px 8px" }, children: below })
493
436
  ] })
494
437
  );
495
438
  }
439
+ var small = { ...ghostStyle, border: "1px solid var(--hair-2)", fontSize: "11.5px", padding: "2px 8px", color: "var(--ink)" };
440
+ var linkStyle = { font: "inherit", fontSize: "inherit", padding: 0, border: 0, background: "none", cursor: "pointer" };
496
441
  function Banner({ forge }) {
497
442
  const { reply, error, reload, hurry } = useDigest(forge);
498
443
  const projects = useProjects(forge);
499
- const [chosen, choose] = useAccountFilter();
500
444
  const digest = reply?.digest;
501
- const allPending = reply?.pending ?? [];
502
- const pendingText = (list) => list.length ? ` \xB7 ${list.length} pending` : "";
503
445
  const acting = useActing(forge, digest?.date, reload, hurry);
504
446
  const reading = reply?.reading;
505
447
  const isReading = acting.refreshing || !!reading;
@@ -508,112 +450,54 @@ function Banner({ forge }) {
508
450
  "\xB7 ",
509
451
  text
510
452
  ] });
511
- const notes = notesLine(digest?.notes);
512
- const note = notes && /* @__PURE__ */ jsxs2("span", { style: { color: "var(--ink-3)" }, children: [
513
- "\xB7 ",
514
- notes
515
- ] });
516
- const problems = groupProblems(digest?.problems ?? []);
517
- const problemRows = problems.length > 0 && /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", gap: "6px", marginBottom: "8px" }, children: problems.map((g) => /* @__PURE__ */ jsx2(ProblemRow, { group: g, acting }, g.account)) });
518
- const problemsLink = problems.length > 0 && /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => forge.openPage(), style: { font: "inherit", fontSize: "inherit", padding: 0, border: 0, background: "none", cursor: "pointer", color: "var(--orange)" }, children: [
519
- "\xB7 ",
520
- problemsLabel(problems.length)
521
- ] });
522
453
  if (!reply && !error) return null;
523
454
  if (reply && !reply.enabled) {
524
455
  return /* @__PURE__ */ jsx2(Strip, { title: "Today", actions: /* @__PURE__ */ jsx2(Btn, { label: "Turn on", style: primaryStyle, disabled: acting.busy, onClick: () => acting.run(() => forge.action("enable")) }), children: /* @__PURE__ */ jsx2("span", { children: "\xB7 Linear, Slack and GitHub each morning" }) });
525
456
  }
526
- if (reply && isReading && (!digest || digest.items.length === 0)) {
527
- return shell(
528
- /* @__PURE__ */ jsxs2("div", { style: { padding: "14px 18px", display: "flex", flexDirection: "column", gap: "12px" }, children: [
529
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
530
- /* @__PURE__ */ jsx2("span", { style: { color: "var(--orange)" }, children: "\u2600\uFE0E" }),
531
- /* @__PURE__ */ jsx2(ReadingLine, { reading }),
532
- /* @__PURE__ */ jsx2("span", { style: { marginLeft: "auto" }, children: refreshBtn })
533
- ] }),
534
- !digest && /* @__PURE__ */ jsx2(SkeletonRows, {}),
535
- problemRows
536
- ] })
537
- );
457
+ if (reply && isReading && !digest) {
458
+ return /* @__PURE__ */ jsx2(Strip, { title: "Today", actions: refreshBtn, children: /* @__PURE__ */ jsx2(ReadingLine, { reading }) });
538
459
  }
539
- if (!reply || !digest || digest.items.length === 0) {
540
- return /* @__PURE__ */ jsxs2(Strip, { title: reply && !digest ? "Not read yet" : shortDay(/* @__PURE__ */ new Date(), digest?.date), actions: refreshBtn, below: reply && /* @__PURE__ */ jsx2(PendingFold, { pending: allPending, projects, acting, forge }), children: [
541
- !reply ? failure(loadFailedLine(error)) : digest?.error ? failure(failedLine(digest.error)) : digest && /* @__PURE__ */ jsxs2("span", { children: [
542
- "\xB7 ",
543
- reply.firstReading ? FIRST_READING_NOTE : `nothing new since ${clock(new Date(digest.readAt))}`,
544
- pendingText(allPending)
545
- ] }),
546
- problemsLink,
547
- note
548
- ] });
460
+ if (!reply || !digest) {
461
+ return /* @__PURE__ */ jsx2(Strip, { title: "Not read yet", actions: refreshBtn, children: error ? failure(loadFailedLine(error)) : /* @__PURE__ */ jsx2("span", { children: "\xB7 use Refresh to read now" }) });
549
462
  }
550
- const items = digest.items;
551
- const accounts = accountsOf(items);
552
- const account = accounts.includes(chosen) ? chosen : "";
553
- const seen = (list) => inAccount(list, account);
554
- const shown = seen(live(items));
555
- const folded = foldedNow(reply.folded, items);
556
- const fold = (value) => acting.run(() => forge.action("fold", { date: digest.date, folded: value }));
557
- if (folded) {
558
- return /* @__PURE__ */ jsxs2(Strip, { title: shortDay(/* @__PURE__ */ new Date(), digest.date), actions: /* @__PURE__ */ jsxs2(Fragment2, { children: [
559
- refreshBtn,
560
- /* @__PURE__ */ jsx2(Btn, { label: "See all \u2192", style: ghostStyle, onClick: () => forge.openPage() })
561
- ] }), below: /* @__PURE__ */ jsx2(PendingFold, { pending: pendingIn(allPending, account), projects, acting, forge }), children: [
562
- /* @__PURE__ */ jsxs2("span", { children: [
563
- "\xB7 ",
564
- done(items, startsTask),
565
- " started \xB7 ",
566
- done(items, (k) => k === "research"),
567
- " researching \xB7 ",
568
- done(items, (k) => k === "to-task"),
569
- " sent",
570
- pendingText(pendingIn(allPending, account))
463
+ const pending = reply.pending ?? [];
464
+ const summary = bannerSummary(digest.items, pending);
465
+ const rows = urgentRows(digest.items, pending);
466
+ const problems = groupProblems(digest.problems ?? []);
467
+ const notes = notesLine(digest.notes);
468
+ const status = [isReading ? null : readLine(digest), reply.firstReading ? FIRST_READING_NOTE : null, notes].filter(Boolean).join(" \xB7 ");
469
+ const statusLine = /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "8px", fontSize: "11.5px", color: "var(--ink-3)", padding: "2px 6px 0", minWidth: 0 }, children: [
470
+ isReading ? /* @__PURE__ */ jsx2(ReadingLine, { reading }) : /* @__PURE__ */ jsx2("span", { title: status, style: { minWidth: 0, flexShrink: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: status }),
471
+ digest.error && /* @__PURE__ */ jsx2("span", { style: { color: "var(--red)" }, children: failedLine(digest.error) }),
472
+ problems.length === 1 && /* @__PURE__ */ jsxs2("span", { role: "alert", title: problems[0].reasons.join("\n"), style: { display: "inline-flex", alignItems: "center", gap: "6px", color: "var(--ink-2)" }, children: [
473
+ /* @__PURE__ */ jsx2("span", { style: { color: "var(--orange)" }, children: "\u26A0" }),
474
+ groupLine(problems[0]),
475
+ /* @__PURE__ */ jsx2(Btn, { label: acting.retrying === problems[0].account ? "Reading\u2026" : "Retry", style: small, disabled: acting.busy, onClick: () => acting.retry(problems[0].account) }),
476
+ /* @__PURE__ */ jsx2(Btn, { label: "Reconnect", style: { ...small, ...ghostStyle, padding: "2px 8px" }, disabled: acting.busy, onClick: () => acting.reconnect(problems[0].account) })
477
+ ] }),
478
+ problems.length > 1 && /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => forge.openPage(), style: { ...linkStyle, color: "var(--orange)" }, children: [
479
+ problemsLabel(problems.length),
480
+ " \xB7 Fix on Today \u2192"
481
+ ] })
482
+ ] });
483
+ return /* @__PURE__ */ jsxs2(
484
+ Strip,
485
+ {
486
+ title: shortDay(/* @__PURE__ */ new Date(), digest.date),
487
+ actions: refreshBtn,
488
+ below: /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
489
+ rows.map((r) => r.kind === "pending" ? /* @__PURE__ */ jsx2(PendingRow, { item: r.item, projects, acting, forge }, r.item.id) : /* @__PURE__ */ jsx2(Row, { item: r.item, projects, acting, forge }, r.item.id)),
490
+ statusLine
571
491
  ] }),
572
- digest.error && failure(failedLine(digest.error)),
573
- problemsLink,
574
- note
575
- ] });
576
- }
577
- const waiting = seen(items).filter((i) => i.state === "proposed" || i.state === "failed");
578
- const ready = waiting.filter((i) => opFor(i)).length;
579
- const acceptAll = () => acting.run(() => forge.action("accept-all", { date: digest.date, ...account ? { account } : {} }));
580
- return shell(
581
- /* @__PURE__ */ jsxs2("div", { style: { padding: "16px 18px 12px" }, children: [
582
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
583
- /* @__PURE__ */ jsx2("div", { style: { width: "34px", height: "34px", borderRadius: "10px", display: "grid", placeItems: "center", background: "linear-gradient(160deg, #ffb340, #ff7a1a)", boxShadow: "0 4px 14px rgba(255, 140, 30, .35)", fontSize: "17px" }, children: "\u2600\uFE0E" }),
584
- /* @__PURE__ */ jsxs2("div", { children: [
585
- /* @__PURE__ */ jsx2("h3", { style: { margin: 0, fontSize: "15px", fontWeight: 650, letterSpacing: "-.01em" }, children: dayLabel(/* @__PURE__ */ new Date(), digest.date) }),
586
- /* @__PURE__ */ jsx2("div", { style: { color: "var(--ink-2)", fontSize: "12px", marginTop: "1px" }, children: isReading ? /* @__PURE__ */ jsx2(ReadingLine, { reading }) : readLine(digest) })
492
+ children: [
493
+ /* @__PURE__ */ jsxs2("span", { children: [
494
+ "\xB7 ",
495
+ summaryText(summary),
496
+ " \xB7"
587
497
  ] }),
588
- /* @__PURE__ */ jsxs2("div", { style: { marginLeft: "auto", display: "flex", gap: "8px" }, children: [
589
- refreshBtn,
590
- /* @__PURE__ */ jsx2(Btn, { label: "Fold \u2303", style: ghostStyle, disabled: acting.busy, onClick: () => fold(true) }),
591
- ready > 0 && /* @__PURE__ */ jsx2(Btn, { label: `Accept ${ready === 1 ? "it" : `the ${ready}`}`, style: primaryStyle, disabled: acting.busy, onClick: acceptAll })
592
- ] })
593
- ] }),
594
- accounts.length > 1 && /* @__PURE__ */ jsxs2("div", { role: "group", "aria-label": "Account", style: { display: "flex", gap: "6px", marginTop: "12px", flexWrap: "wrap" }, children: [
595
- /* @__PURE__ */ jsx2(FilterChip, { label: "All", n: live(items).length, on: !account, onClick: () => choose("") }),
596
- accounts.map((a) => /* @__PURE__ */ jsx2(FilterChip, { label: a, token: accountToken(a), n: inAccount(live(items), a).length, on: account === a, onClick: () => choose(a) }, a))
597
- ] }),
598
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "6px", margin: "14px 0 10px", flexWrap: "wrap" }, children: [
599
- /* @__PURE__ */ jsx2(Count, { token: "--orange", n: shown.filter((i) => i.kind === "to-task").length, label: "for open tasks" }),
600
- /* @__PURE__ */ jsx2(Count, { token: "--green", n: shown.filter((i) => i.kind === "issue" || i.kind === "request").length, label: "new tasks" }),
601
- /* @__PURE__ */ jsx2(Count, { token: "--blue", n: shown.filter((i) => i.kind === "review").length, label: "to review" }),
602
- /* @__PURE__ */ jsx2(Count, { token: "--purple", n: shown.filter((i) => i.kind === "research").length, label: "researching" }),
603
- /* @__PURE__ */ jsxs2("span", { style: { ...pill, marginLeft: "auto", borderColor: "transparent", background: "none", color: "var(--ink-3)" }, children: [
604
- seen(items).length,
605
- " read \xB7 ",
606
- seen(items).length - shown.length,
607
- " dismissed"
608
- ] })
609
- ] }),
610
- digest.error && /* @__PURE__ */ jsx2("div", { style: { marginBottom: "8px", fontSize: "11.5px", color: "var(--red)" }, children: failedLine(digest.error) }),
611
- notes && /* @__PURE__ */ jsx2("div", { style: { marginBottom: "8px", fontSize: "11.5px", color: "var(--ink-3)" }, children: notes }),
612
- problemRows,
613
- /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: shown.map((i) => /* @__PURE__ */ jsx2(Row, { item: i, projects, acting, forge }, i.id)) }),
614
- /* @__PURE__ */ jsx2(PendingFold, { pending: pendingIn(allPending, account), projects, acting, forge }),
615
- /* @__PURE__ */ jsx2("div", { style: { marginTop: "10px", fontSize: "11.5px", color: "var(--ink-3)" }, children: "Research starts on its own (limited per day). The rest waits for your ok." })
616
- ] })
498
+ /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => forge.openPage(), style: { ...linkStyle, fontWeight: 600, color: "var(--blue)" }, children: "Open Today \u2192" })
499
+ ]
500
+ }
617
501
  );
618
502
  }
619
503
  var banner_default = definePanel({ id: "banner", title: "Today", component: Banner });