create-heresay 0.2.31 → 0.2.33

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-heresay",
3
- "version": "0.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "Set up your own Heresay: in-app feedback that every report gets a hearing. Creates a Firebase project in your Google account and deploys the dashboard, API and SDK to it.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/release/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.31
1
+ 0.2.33
@@ -7,6 +7,7 @@ import { createHash, randomBytes, timingSafeEqual } from 'node:crypto';
7
7
  import { CLAIM_TTL_MS, LIMITS, PLATFORMS, REPORT_TYPES, isPlatform, isReportType, toReporterView, } from './types.js';
8
8
  import { notify } from './notifications.js';
9
9
  import { parseFixRef, stampFix } from './duplicates.js';
10
+ import { withdraw } from './withdraw.js';
10
11
  const json = (status, body) => ({ status, body });
11
12
  const str = (v, max) => {
12
13
  if (typeof v !== 'string')
@@ -370,6 +371,14 @@ async function findings(p, req, deps, body, token, repoName, apps, now) {
370
371
  out.sort((a, b) => b.created_at.localeCompare(a.created_at));
371
372
  return json(200, { repo: repoName, findings: out.slice(0, 100) });
372
373
  }
374
+ if (p.length === 3 && p[2] === 'withdraw' && req.method === 'POST') {
375
+ for (const app of apps) {
376
+ if (!(await deps.store.getReport(app.id, p[1])))
377
+ continue;
378
+ return withdraw(app, p[1], { kind: 'agent', by: repoName }, body.reason, (d) => d === device, deps);
379
+ }
380
+ return json(404, { error: 'no such finding from this repo' });
381
+ }
373
382
  if (p.length !== 1 || req.method !== 'POST')
374
383
  return json(404, { error: 'not found' });
375
384
  const want = str(body.app, 100);
@@ -13,6 +13,7 @@
13
13
  import { createHash } from 'node:crypto';
14
14
  import { OPEN_CORS, baseUrl, chatCaller, signInFirst } from './oauth.js';
15
15
  import { notify } from './notifications.js';
16
+ import { withdraw } from './withdraw.js';
16
17
  import { LIMITS, REPORT_TYPES, isReportType } from './types.js';
17
18
  const PROTOCOLS = ['2025-06-18', '2025-03-26', '2024-11-05'];
18
19
  const json = (status, body, headers) => ({ status, body, headers: { ...OPEN_CORS, ...headers } });
@@ -80,6 +81,21 @@ const TOOLS = [
80
81
  },
81
82
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
82
83
  },
84
+ {
85
+ name: 'withdraw_request',
86
+ title: 'Take back a Heresay request',
87
+ description: 'Withdraws a request this team member sent, while it is still open. It isn\'t deleted: the team sees it under Withdrawn, with the reason. Accepted requests can\'t be withdrawn.',
88
+ inputSchema: {
89
+ type: 'object',
90
+ properties: {
91
+ id: { type: 'string', description: 'The request id, from my_requests' },
92
+ reason: { type: 'string', maxLength: LIMITS.reasonMax, description: 'Why, in a sentence. Optional.' },
93
+ },
94
+ required: ['id'],
95
+ additionalProperties: false,
96
+ },
97
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
98
+ },
83
99
  {
84
100
  name: 'my_requests',
85
101
  title: 'My Heresay requests',
@@ -160,6 +176,8 @@ async function one(m, member, via, req, deps) {
160
176
  return rpcResult(msg.id, await draftRequest(args, member, via, deps));
161
177
  if (name === 'send_draft')
162
178
  return rpcResult(msg.id, await sendDraft(args, member, req, deps));
179
+ if (name === 'withdraw_request')
180
+ return rpcResult(msg.id, await withdrawRequest(args, member, deps));
163
181
  if (name === 'my_requests')
164
182
  return rpcResult(msg.id, await myRequests(args, member, req, deps));
165
183
  return rpcError(msg.id, -32602, `Unknown tool: ${String(name)}`);
@@ -285,8 +303,25 @@ async function myRequests(a, member, req, deps) {
285
303
  }
286
304
  }
287
305
  rows.sort((x, y) => String(y.sent_at).localeCompare(String(x.sent_at)));
288
- const line = (r) => `- ${r.app} · ${r.type} · ${r.status}${r.status === 'declined' && r.decline_reason ? ` (why: ${r.decline_reason})` : ''}`
306
+ const line = (r) => `- ${r.id} · ${r.app} · ${r.type} · ${r.status}${r.status === 'declined' && r.decline_reason ? ` (why: ${r.decline_reason})` : ''}`
289
307
  + `${r.status === 'fixed' && r.fix_note ? ` (${r.fix_note})` : ''}: ${String(r.text).slice(0, 140)}`;
290
308
  return result(rows.length ? rows.slice(0, 50).map(line).join('\n') : 'Nothing sent from a chat app yet.', { requests: rows.slice(0, 50) });
291
309
  }
310
+ /** Find one of this member's requests across the apps and take it back. */
311
+ async function withdrawRequest(a, member, deps) {
312
+ const id = str(a.id, 64);
313
+ if (!id)
314
+ throw new ToolError('Say which request: its id, from my_requests.');
315
+ const device = chatDevice(member.email);
316
+ for (const p of await deps.store.listProjects()) {
317
+ const r = await deps.store.getReport(p.id, id);
318
+ if (!r)
319
+ continue;
320
+ const res = await withdraw(p, id, { kind: 'member', by: member.email }, a.reason, (d) => d === device, deps);
321
+ if (res.status !== 200)
322
+ throw new ToolError(String(res.body.error ?? 'Couldn\'t withdraw it.'));
323
+ return result(`Withdrawn from ${p.name}. It stays on the team's dashboard under Withdrawn${a.reason ? ', with your reason' : ''}.`, { id, app: p.name, status: 'withdrawn' });
324
+ }
325
+ throw new ToolError('No request with that id was sent by you.');
326
+ }
292
327
  //# sourceMappingURL=chat.js.map
@@ -3,6 +3,7 @@ import { agent, normaliseRepo, reposFor, tokens } from './agent.js';
3
3
  import { parseTrail, trailLines } from './trail.js';
4
4
  import { OPEN_CORS, approve, authorizationServer, authorize, connections, describeAsk, protectedResource, register, token } from './oauth.js';
5
5
  import { mcp } from './chat.js';
6
+ import { withdraw } from './withdraw.js';
6
7
  import { alsoReported, duplicatesOf, follow, merge, parseFixRef, stampFix, unmerge } from './duplicates.js';
7
8
  import { notificationSettings, notify } from './notifications.js';
8
9
  import { LIMITS, PLATFORMS, REPORT_ORDER, REPORT_TYPES, isFramework, isPlatform, isReportType, isSignIn, toReporterView, } from './types.js';
@@ -186,6 +187,8 @@ async function route(req, deps) {
186
187
  return submit(req, deps);
187
188
  if (p[0] === 'reports' && p[1] === 'mine' && req.method === 'POST')
188
189
  return mine(req, deps);
190
+ if (p[0] === 'reports' && p[1] === 'withdraw' && req.method === 'POST')
191
+ return withdrawMine(req, deps);
189
192
  if (p[0] === 'reports' && req.method === 'OPTIONS')
190
193
  return preflight(req);
191
194
  // Chat apps (ChatGPT and other MCP clients): OAuth with the member's own sign-in, then MCP.
@@ -456,6 +459,29 @@ async function mine(req, deps) {
456
459
  rs.sort((a, b) => b.created_at.localeCompare(a.created_at));
457
460
  return json(200, { reports: rs.map(toReporterView) }, headers);
458
461
  }
462
+ /**
463
+ * POST /v1/reports/withdraw { key, device_id, report_id, reason? }: the reporter takes back one of
464
+ * their own open reports. Origin-checked like every SDK call, limited like reading them, and the
465
+ * device id must be the one that sent it.
466
+ */
467
+ async function withdrawMine(req, deps) {
468
+ const body = parseBody(req.body);
469
+ const got = await publicProject(req, body.key, deps);
470
+ if ('status' in got)
471
+ return got;
472
+ const { project, headers } = got;
473
+ if (!validDeviceId(body.device_id))
474
+ return json(400, { error: 'bad device_id' }, headers);
475
+ const now = deps.now();
476
+ const start = Math.floor(now / MINE_LIMIT.windowMs) * MINE_LIMIT.windowMs;
477
+ if (!(await deps.store.hit(`mine:${sha(req.ip)}:${start}`, MINE_LIMIT.limit, start + MINE_LIMIT.windowMs))) {
478
+ return json(429, { error: 'too many requests, try again later' }, headers);
479
+ }
480
+ const device = body.device_id;
481
+ const res = await withdraw(project, String(body.report_id ?? ''), { kind: 'reporter', by: 'the reporter' }, body.reason, (d) => d === device, deps);
482
+ const r = res.body.report;
483
+ return { ...res, body: r ? { report: toReporterView(r) } : res.body, headers };
484
+ }
459
485
  /** The SDK posts text/plain to avoid a preflight, so the body may arrive as a string. */
460
486
  function parseBody(b) {
461
487
  if (typeof b === 'string') {
@@ -16,7 +16,7 @@ export const isSignIn = (v) => v === 'yes' || v === 'no';
16
16
  /** A claim nobody has touched for this long is dropped, so a crashed agent can't block a brief. */
17
17
  export const CLAIM_TTL_MS = 24 * 3600_000;
18
18
  export const toReporterView = (r) => ({
19
- id: r.id, type: r.type, text: r.text, status: r.status,
19
+ id: r.id, type: r.type, text: r.text, status: r.status, withdrawn_reason: r.withdrawal?.reason ?? null,
20
20
  decline_reason: r.decline_reason, fix_note: r.fix_note ?? null, fix_version: r.fix_ref?.version ?? null,
21
21
  created_at: r.created_at, updated_at: r.updated_at,
22
22
  });
@@ -1,3 +1,3 @@
1
1
  /** The Heresay release. Bumped by the release script; the CLI and /v1/health report it. */
2
- export const VERSION = '0.2.31';
2
+ export const VERSION = '0.2.33';
3
3
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,29 @@
1
+ import { duplicatesOf } from './duplicates.js';
2
+ import { LIMITS } from './types.js';
3
+ const json = (status, body) => ({ status, body });
4
+ export async function withdraw(project, id, by, reason, owns, deps) {
5
+ const r = await deps.store.getReport(project.id, id);
6
+ // Not yours and not there look the same, so a device can't probe other reports.
7
+ if (!r || !owns(r.device_id))
8
+ return json(404, { error: 'no such report' });
9
+ if (r.status === 'withdrawn')
10
+ return json(200, { report: r, already: true });
11
+ if (r.status !== 'open') {
12
+ return json(409, { error: r.status === 'accepted'
13
+ ? 'This has been accepted and work may have started, so it can\'t be taken back now. Tell the team instead.'
14
+ : `This is already ${r.status}.`, status: r.status });
15
+ }
16
+ const at = new Date(deps.now()).toISOString();
17
+ const why = typeof reason === 'string' && reason.trim() ? reason.trim().slice(0, LIMITS.reasonMax) : null;
18
+ const t = await deps.store.move(project.id, id, 'open', 'withdrawn', { triaged_by: by.by, updated_at: at });
19
+ if (!t.ok)
20
+ return json(409, { error: 'it changed just now; look again' });
21
+ const withdrawal = { ...by, at, reason: why };
22
+ await deps.store.updateReport(project.id, id, { withdrawal });
23
+ // Reports merged into it stand on their own again: their reporters still want an answer.
24
+ for (const d of await duplicatesOf(project, id, deps))
25
+ await deps.store.updateReport(d.project_id, d.id, { duplicate_of: null });
26
+ deps.log('api.report_withdrawn', { project_id: project.id, report_id: id, kind: by.kind });
27
+ return json(200, { report: { ...t.report, withdrawal } });
28
+ }
29
+ //# sourceMappingURL=withdraw.js.map
@@ -9,6 +9,7 @@
9
9
  <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
10
  <link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,700;12..96,800&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
11
11
  <link rel="stylesheet" href="/dashboard.css">
12
+ <link rel="stylesheet" href="/workspace.css">
12
13
  </head>
13
14
  <body class="booting pending">
14
15
 
@@ -39,20 +40,32 @@
39
40
  </div>
40
41
 
41
42
  <div id="app" hidden>
42
- <header class="top">
43
- <a href="#/" aria-label="Your apps"><img src="/logo.svg" alt="Heresay" height="28" style="display:block"></a>
43
+ <a class="skip-link" href="#view">Skip to content</a>
44
+ <aside class="sidebar" aria-label="Workspace navigation">
45
+ <button id="nav-close" class="btn ghost nav-close" type="button" aria-label="Close navigation">×</button>
46
+ <a class="brand" href="#/inbox" aria-label="Heresay inbox"><img src="/logo.svg" alt="Heresay" height="30"></a>
47
+ <div class="workspace-label"><span class="workspace-icon" aria-hidden="true">H</span><span>Your workspace</span><span class="workspace-role" id="workspace-role"></span></div>
44
48
  <nav class="tabs" aria-label="Main">
45
- <a href="#/" data-nav="apps">Apps</a>
46
- <a href="#/team" data-nav="team">Team</a>
47
- <a href="#/notifications" data-nav="notifications">Notifications</a>
48
- <a href="#/chat" data-nav="chat">Chat apps</a>
49
+ <a href="#/inbox" data-nav="inbox"><span class="nav-icon" data-icon="inbox"></span>Inbox<span id="inbox-count" class="nav-count" hidden></span></a>
50
+ <a href="#/apps" data-nav="apps"><span class="nav-icon" data-icon="apps"></span>Apps</a>
51
+ <a href="#/connect" data-nav="connect"><span class="nav-icon" data-icon="repos"></span>Connected repos</a>
52
+ <a href="#/chat" data-nav="chat"><span class="nav-icon" data-icon="chat"></span>Chat apps</a>
49
53
  </nav>
50
- <span class="spacer"></span>
51
- <span id="who" class="who"></span>
52
- <button id="signout" class="btn ghost">Sign out</button>
53
- </header>
54
+ <div class="nav-section">Workspace</div>
55
+ <nav class="tabs" aria-label="Workspace settings">
56
+ <a href="#/team" data-nav="team"><span class="nav-icon" data-icon="team"></span>Team</a>
57
+ <a href="#/notifications" data-nav="notifications"><span class="nav-icon" data-icon="bell"></span>Notifications</a>
58
+ </nav>
59
+ <div class="sidebar-bottom">
60
+ <a class="help-link" href="/docs.html" target="_blank" rel="noopener"><span class="nav-icon" data-icon="help"></span>Help &amp; docs<span aria-hidden="true">↗</span></a>
61
+ <div class="account"><span id="account-avatar" class="avatar" aria-hidden="true">H</span><span id="who" class="who"></span></div>
62
+ <button id="signout" class="btn ghost signout">Sign out</button>
63
+ </div>
64
+ </aside>
65
+ <button id="nav-scrim" class="nav-scrim" type="button" aria-label="Close navigation" tabindex="-1"></button>
66
+ <header class="workspace-top"><button id="nav-toggle" class="btn ghost" aria-label="Open navigation" aria-expanded="false" type="button">☰</button><span class="breadcrumb">Workspace <span aria-hidden="true">/</span> <span id="page-label">Apps</span></span><span class="top-caption">Every report gets a hearing.</span></header>
54
67
  <div id="update" class="update" role="status" hidden></div>
55
- <main id="view"></main>
68
+ <main id="view" tabindex="-1"></main>
56
69
  </div>
57
70
 
58
71
  <script src="/__/firebase/10.14.1/firebase-app-compat.js"></script>
@@ -493,3 +493,6 @@ a.platform:hover { border-color:var(--acc); box-shadow:0 0 0 3px var(--mist); }
493
493
  .report .fix-line .link { border:0; background:none; padding:0; font:inherit; color:var(--deep, #0b5e57); text-decoration:underline; cursor:pointer; }
494
494
  .pill.version-pill { background:#dcfce7; color:#166534; }
495
495
  .fix-ref input { flex:1; min-width:160px; }
496
+
497
+ .status.s-withdrawn { background:rgba(127,127,127,.14); color:var(--mute); }
498
+ .report .reason.withdrawn { color:var(--mute); }
@@ -7,7 +7,7 @@
7
7
 
8
8
  var $ = function (id) { return document.getElementById(id); };
9
9
  var TYPE_LABEL = { broken: 'Broken', confusing: 'Confusing', improvement: 'Could be better', idea: 'Idea' };
10
- var STATUS_LABEL = { open: 'Open', accepted: 'Accepted', fixed: 'Fixed', declined: 'Declined' };
10
+ var STATUS_LABEL = { open: 'Open', accepted: 'Accepted', fixed: 'Fixed', declined: 'Declined', withdrawn: 'Withdrawn' };
11
11
  var SDK_URL = location.origin + '/sdk/v1.js';
12
12
  var me = null, projects = [], timer = null;
13
13
 
@@ -41,6 +41,45 @@
41
41
  return n;
42
42
  }
43
43
 
44
+ // Reuse the dashboard's outline icon language throughout the workspace chrome.
45
+ var NAV_ICONS = {
46
+ inbox: '<path d="M4 4h16l2 12v4H2v-4zM2 14h6l2 3h4l2-3h6"/>',
47
+ apps: '<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>',
48
+ repos: '<circle cx="6" cy="5" r="2"/><circle cx="6" cy="19" r="2"/><circle cx="18" cy="5" r="2"/><path d="M6 7v10M18 7v2a4 4 0 0 1-4 4h-4a4 4 0 0 0-4 4"/>',
49
+ chat: '<path d="M21 11a9 9 0 0 1-9 9H4l-2 2V11a9 9 0 0 1 19 0z"/>',
50
+ team: '<circle cx="9" cy="8" r="3"/><path d="M2 21v-3a7 7 0 0 1 14 0v3M16 5a3 3 0 0 1 0 6M22 21v-3a7 7 0 0 0-4-6"/>',
51
+ bell: '<path d="M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9M10 21h4"/>',
52
+ help: '<circle cx="12" cy="12" r="9"/><path d="M9 9a3 3 0 0 1 6 0c0 2-3 2-3 5M12 17h.01"/>'
53
+ };
54
+ document.querySelectorAll('[data-icon]').forEach(function (n) {
55
+ n.innerHTML = '<svg viewBox="0 0 24 24" aria-hidden="true">' + NAV_ICONS[n.dataset.icon] + '</svg>';
56
+ });
57
+ function setNavigation(open, restoreFocus) {
58
+ $('app').classList.toggle('nav-open', open);
59
+ $('nav-toggle').setAttribute('aria-expanded', String(open));
60
+ $('nav-toggle').setAttribute('aria-label', open ? 'Close navigation' : 'Open navigation');
61
+ $('view').inert = open;
62
+ document.querySelector('.sidebar').inert = window.innerWidth <= 640 && !open;
63
+ if (open) $('nav-close').focus();
64
+ else if (restoreFocus) $('nav-toggle').focus();
65
+ }
66
+ $('nav-toggle').onclick = function () { setNavigation(!$('app').classList.contains('nav-open'), true); };
67
+ $('nav-close').onclick = $('nav-scrim').onclick = function () { setNavigation(false, true); };
68
+ document.addEventListener('keydown', function (e) {
69
+ if (e.key === 'Escape' && $('app').classList.contains('nav-open')) setNavigation(false, true);
70
+ if (e.key === 'Tab' && $('app').classList.contains('nav-open')) {
71
+ var nodes = document.querySelector('.sidebar').querySelectorAll('a, button');
72
+ var first = nodes[0], last = nodes[nodes.length - 1];
73
+ if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }
74
+ else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }
75
+ }
76
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k' && $('report-search')) {
77
+ e.preventDefault(); $('view').classList.remove('detail-open'); $('report-search').focus();
78
+ }
79
+ });
80
+ window.addEventListener('resize', function () { setNavigation(window.innerWidth <= 640 && $('app').classList.contains('nav-open'), false); });
81
+ document.querySelector('.skip-link').onclick = function (e) { e.preventDefault(); $('view').focus(); };
82
+
44
83
  function show(which) {
45
84
  ['gate', 'blocked', 'app'].forEach(function (id) { $(id).hidden = id !== which; });
46
85
  syncLoader();
@@ -180,6 +219,9 @@
180
219
  api('GET', '/me').then(function (b) {
181
220
  me = b;
182
221
  $('who').textContent = b.email;
222
+ $('who').title = b.email;
223
+ $('account-avatar').textContent = b.email.slice(0, 2).toUpperCase();
224
+ $('workspace-role').textContent = b.role === 'owner' ? 'Owner' : 'Member';
183
225
  try {
184
226
  var after = JSON.parse(localStorage.getItem('heresay.after') || 'null');
185
227
  localStorage.removeItem('heresay.after');
@@ -254,14 +296,19 @@
254
296
  var hash = location.hash.replace(/^#\/?/, '');
255
297
  var query = new URLSearchParams(hash.split('?')[1] || '');
256
298
  var parts = hash.split('?')[0].split('/').filter(Boolean);
299
+ var active = ['team', 'notifications', 'chat', 'connect', 'inbox'].indexOf(parts[0]) >= 0 ? parts[0] : 'apps';
300
+ if (!parts.length || (parts[0] === 'apps' && parts[1] && !parts[2])) active = 'inbox';
257
301
  document.querySelectorAll('[data-nav]').forEach(function (a) {
258
- var active = parts[0] === 'team' || parts[0] === 'notifications' || parts[0] === 'chat' ? parts[0] : 'apps';
259
- a.setAttribute('aria-current', String(active === a.dataset.nav));
302
+ if (active === a.dataset.nav) a.setAttribute('aria-current', 'page');
303
+ else a.removeAttribute('aria-current');
260
304
  });
305
+ $('page-label').textContent = { inbox: 'Inbox', apps: 'Apps', connect: 'Connected repos', chat: 'Chat apps', team: 'Team', notifications: 'Notifications' }[active];
306
+ setNavigation(false, false);
261
307
  var view = $('view');
262
308
  view.textContent = '';
263
309
  view.appendChild(loading());
264
- view.classList.remove('wide');
310
+ view.classList.remove('wide', 'inbox-view', 'detail-open');
311
+ if (!parts.length || parts[0] === 'inbox') return reportsView(view, null);
265
312
  if (parts[0] === 'team') return teamView(view);
266
313
  if (parts[0] === 'notifications') return notificationsView(view);
267
314
  if (parts[0] === 'connect') return connectView(view, query);
@@ -283,7 +330,7 @@
283
330
  var hit = projects.filter(function (p) { return p.id === id; })[0];
284
331
  if (hit) return fn(hit);
285
332
  api('GET', '/projects/' + id).then(function (b) { fn(b.project); })
286
- .catch(function () { location.hash = '#/'; });
333
+ .catch(function () { location.hash = '#/apps'; });
287
334
  }
288
335
 
289
336
  // ---- apps ------------------------------------------------------------------------------
@@ -400,7 +447,7 @@
400
447
  return api('GET', '/projects').then(function (b) {
401
448
  projects = b.projects;
402
449
  var first = projects.filter(function (x) { return productOf(x) === productId; })[0];
403
- if (!first) { location.hash = '#/'; return; }
450
+ if (!first) { location.hash = '#/apps'; return; }
404
451
  drawNewApp(view, platform, null, first);
405
452
  });
406
453
  }
@@ -1203,7 +1250,7 @@
1203
1250
  rs.slice(0, 5).forEach(function (r) {
1204
1251
  feed.appendChild(el('li', { class: !first && !known[r.id] ? 'fresh' : '' }, [
1205
1252
  el('span', { class: 'pill ' + r.type, text: TYPE_LABEL[r.type] }),
1206
- showPlatform ? el('span', { class: 'pill platform-pill', text: platformOf(p.platform).label }) : null,
1253
+ el('span', { class: 'pill platform-pill', text: platformOf(p.platform).label }),
1207
1254
  el('span', { class: 'feed-text', text: r.text }),
1208
1255
  el('span', { class: 'mute small', text: [r.context.route, r.context.platform, new Date(r.created_at).toLocaleTimeString()].filter(Boolean).join(' · ') }),
1209
1256
  ]));
@@ -1262,167 +1309,195 @@
1262
1309
  * from. Install, delete and repos stay per platform, because keys and code differ.
1263
1310
  */
1264
1311
  function reportsView(view, p) {
1265
- var reports = [];
1266
- var sibs = [p];
1267
- var where = 'all';
1268
- var filters = el('nav', { class: 'filters', 'aria-label': 'Filter' });
1269
- var platformBar = el('nav', { class: 'filters platforms-filter', 'aria-label': 'Platform' });
1270
- var list = el('div', { class: 'reports' }, [loading()]);
1271
- var empty = el('p', { class: 'empty' });
1272
- var ctxs = {};
1273
- var head = el('div', { class: 'head' });
1274
- var platformsBox = el('div', { class: 'product-platforms' });
1275
- view.appendChild(el('a', { class: 'back', href: '#/', text: '← All apps' }));
1276
- view.appendChild(head);
1277
- view.appendChild(platformsBox);
1278
- view.appendChild(platformBar);
1279
- view.appendChild(filters);
1280
- view.appendChild(list);
1281
- view.appendChild(empty);
1282
-
1283
- function drawHead() {
1284
- head.textContent = '';
1285
- var many = sibs.length > 1;
1286
- head.appendChild(el('div', { class: 'title' }, [
1287
- many ? el('span', { class: 'picon', html: '<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="3" width="8" height="8" rx="2"/><rect x="13" y="3" width="8" height="8" rx="2"/><rect x="3" y="13" width="8" height="8" rx="2"/><path d="M17 13v8M13 17h8"/></svg>' }) : icon(platformOf(p.platform)),
1288
- el('div', {}, [el('h1', { text: productName(p) }),
1289
- el('span', { class: 'mute small', text: many ? sibs.map(function (x) { return platformOf(x.platform).label; }).join(' · ')
1290
- : (p.framework ? frameworkLabel(p.framework) + (p.framework_detected ? ' (detected)' : '') : platformOf(p.platform).label) })])]));
1291
- head.appendChild(el('div', { class: 'row tight' }, [
1292
- el('a', { class: 'btn ghost', href: '#/new?product=' + productOf(p), text: '+ Add a platform' }),
1293
- many || !designable(p) ? null : el('a', { class: 'btn ghost', href: '#/apps/' + p.id + '/design', text: 'Design' }),
1294
- many ? null : el('a', { class: 'btn', href: '#/apps/' + p.id + '/setup', text: 'Install' }),
1295
- many ? null : el('a', { class: 'btn ghost', href: '#/apps/' + p.id + '/delete', text: 'Delete…' }),
1296
- ]));
1297
- }
1312
+ view.classList.add('inbox-view');
1313
+ var reports = [], ctxs = {}, selected = null, loaded = false, detailSignature = null, loadSerial = 0;
1314
+ var product = p ? productOf(p) : 'all', platform = 'all', search = '', type = 'all', source = 'all';
1315
+ var shell = el('div', { class: 'inbox-shell' });
1316
+ var list = el('div', { class: 'report-list', 'aria-label': 'Reports' });
1317
+ var detail = el('section', { class: 'report-detail', 'aria-label': 'Report details', tabindex: '-1' });
1318
+ var filters = el('nav', { class: 'status-tabs', 'aria-label': 'Filter' });
1319
+ var productSelect = el('select', { 'aria-label': 'Product', onchange: function () { product = this.value; selected = null; drawProducts(); render(); } });
1320
+ var platformSelect = el('select', { 'aria-label': 'Platform', onchange: function () { platform = this.value; selected = null; render(); } },
1321
+ [el('option', { value: 'all', text: 'All platforms' })].concat(PLATFORMS.filter(function (x) { return x.ready; }).map(function (x) { return el('option', { value: x.id, text: x.label }); })));
1322
+ var searchInput = el('input', { id: 'report-search', type: 'search', placeholder: 'Search reports', 'aria-label': 'Search reports', oninput: function () { search = this.value.toLowerCase().trim(); render(); } });
1323
+ var advanced = el('div', { class: 'inbox-advanced', hidden: true });
1324
+ var filterButton = el('button', { class: 'btn', type: 'button', text: 'Filters', 'aria-expanded': 'false', 'aria-controls': 'inbox-advanced', onclick: function () { advanced.hidden = !advanced.hidden; this.setAttribute('aria-expanded', String(!advanced.hidden)); } });
1325
+ advanced.id = 'inbox-advanced';
1326
+ advanced.appendChild(el('label', {}, ['Type ', el('select', { 'aria-label': 'Report type', onchange: function () { type = this.value; render(); } },
1327
+ [el('option', { value: 'all', text: 'All types' })].concat(Object.keys(TYPE_LABEL).map(function (t) { return el('option', { value: t, text: TYPE_LABEL[t] }); })))]));
1328
+ advanced.appendChild(el('label', {}, ['Source ', el('select', { 'aria-label': 'Report source', onchange: function () { source = this.value; render(); } },
1329
+ [['all', 'All sources'], ['sdk', 'In-app'], ['chat', 'Chat apps'], ['agent', 'Agents']].map(function (t) { return el('option', { value: t[0], text: t[1] }); }))]));
1330
+ var heading = el('h1', { text: p ? productName(p) : 'Inbox' });
1331
+ var controls = el('div', { class: 'inbox-controls' }, [productSelect, platformSelect, filterButton]);
1332
+ var productTools = el('details', { class: 'inbox-app-tools', hidden: !p }, [el('summary', { text: 'Manage app' })]);
1333
+ var listHead = el('div', { class: 'list-heading' }, [el('b', { text: 'Needs review' }), el('span', { text: 'Type, then most reported' })]);
1334
+ var master = el('section', { class: 'inbox-master', 'aria-label': 'Report inbox' }, [
1335
+ el('div', { class: 'inbox-heading' }, [heading, el('p', { class: 'mute', text: 'A hearing for every report.' })]),
1336
+ el('div', { class: 'inbox-search' }, [searchInput, el('kbd', { text: '⌘ K', 'aria-hidden': 'true' })]),
1337
+ controls, advanced, productTools, filters, listHead, list,
1338
+ ]);
1339
+ shell.appendChild(master); shell.appendChild(detail); view.appendChild(shell);
1340
+ detail.appendChild(loading());
1298
1341
 
1299
- /** Per platform: where agents fix it, and its own Install and Delete. */
1300
- function drawPlatforms() {
1301
- platformsBox.textContent = '';
1302
- var many = sibs.length > 1;
1303
- sibs.forEach(function (x) {
1304
- var repos = (ctxs[x.id] || {}).repos || [];
1305
- platformsBox.appendChild(el('p', { class: 'repos-line' }, [
1306
- many ? el('b', { text: platformOf(x.platform).label + ': ' }) : null,
1307
- document.createTextNode(repos.length ? 'Agents fix these in ' + repos.join(', ') + ' · ' : 'No repo connected for agents yet · '),
1342
+ function relative(iso) {
1343
+ var m = Math.max(0, Math.floor((Date.now() - Date.parse(iso)) / 60000));
1344
+ return m < 1 ? 'Just now' : m < 60 ? m + 'm ago' : m < 1440 ? Math.floor(m / 60) + 'h ago' : new Date(iso).toLocaleDateString();
1345
+ }
1346
+ function key(r) { return r.project_id + '/' + r.id; }
1347
+ function title(r) { return r.text.replace(/[#*_`>]/g, '').split(/\n/)[0].slice(0, 110) || TYPE_LABEL[r.type] + ' report'; }
1348
+ function inProduct(r) { return product === 'all' || productOf(ctxs[r.project_id].project) === product; }
1349
+ function baseReports() { return reports.filter(function (r) {
1350
+ return inProduct(r) && (platform === 'all' || ctxs[r.project_id].project.platform === platform)
1351
+ && (type === 'all' || r.type === type) && (source === 'all' || (r.source || 'sdk') === source)
1352
+ && (!search || [r.text, r.id, ctxs[r.project_id].project.name, r.details, r.from_repo, r.via].filter(Boolean).join(' ').toLowerCase().indexOf(search) >= 0);
1353
+ }); }
1354
+ function drawProducts() {
1355
+ productSelect.textContent = '';
1356
+ productSelect.appendChild(el('option', { value: 'all', text: 'All products' }));
1357
+ var seen = {};
1358
+ projects.forEach(function (x) { var id = productOf(x); if (seen[id]) return; seen[id] = true; productSelect.appendChild(el('option', { value: id, text: productName(x) })); });
1359
+ if (product !== 'all' && !seen[product]) product = 'all';
1360
+ productSelect.value = product;
1361
+ productTools.querySelectorAll('.product-platforms').forEach(function (n) { n.remove(); });
1362
+ var managed = projects.filter(function (x) { return productOf(x) === product; })[0];
1363
+ productTools.hidden = !managed;
1364
+ if (managed) {
1365
+ var box = el('div', { class: 'product-platforms' });
1366
+ siblings(managed).forEach(function (x) { box.appendChild(el('div', { class: 'app-tool-row' }, [
1367
+ el('b', { text: platformOf(x.platform).label }),
1368
+ el('span', { class: 'app-repo-status', text: ctxs[x.id].repos.length ? 'Agents fix these in ' + ctxs[x.id].repos.join(', ') : 'No repo connected for agents yet' }),
1369
+ el('a', { href: '#/apps/' + x.id + '/setup', text: 'Install' }),
1370
+ designable(x) ? el('a', { href: '#/apps/' + x.id + '/design', text: 'Design' }) : null,
1308
1371
  el('a', { href: '#/connect?app=' + x.id, text: 'Connect a repo' }),
1309
- many ? document.createTextNode(' · ') : null,
1310
- many ? el('a', { href: '#/apps/' + x.id + '/setup', text: 'Install' }) : null,
1311
- many && designable(x) ? document.createTextNode(' · ') : null,
1312
- many && designable(x) ? el('a', { href: '#/apps/' + x.id + '/design', text: 'Design' }) : null,
1313
- many ? document.createTextNode(' · ') : null,
1314
- many ? el('a', { href: '#/apps/' + x.id + '/delete', text: 'Delete…' }) : null,
1315
- ]));
1316
- });
1372
+ el('a', { href: '#/apps/' + x.id + '/delete', text: 'Delete…' }),
1373
+ ])); });
1374
+ box.appendChild(el('a', { href: '#/new?product=' + productOf(managed), text: '+ Add a platform' }));
1375
+ productTools.appendChild(box);
1376
+ }
1317
1377
  }
1318
-
1319
- function load() {
1320
- return api('GET', '/projects').then(function (b) {
1321
- projects = b.projects;
1322
- sibs = siblings(p);
1323
- drawHead();
1324
- return Promise.all(sibs.map(function (x) {
1325
- return Promise.all([api('GET', '/projects/' + x.id + '/reports'), api('GET', '/projects/' + x.id + '/repos')])
1326
- .then(function (r) { ctxs[x.id] = { briefs: r[0].briefs || {}, repos: r[1].repos, project: x, reports: r[0].reports }; });
1327
- }));
1328
- }).then(function () {
1329
- var everything = [].concat.apply([], sibs.map(function (x) { return ctxs[x.id].reports; }));
1330
- // Merged reports leave the list and show under the one they were merged into.
1331
- var dups = {};
1332
- everything.forEach(function (r) { if (r.duplicate_of) (dups[r.duplicate_of.report_id] = dups[r.duplicate_of.report_id] || []).push(r); });
1333
- var counts = {};
1334
- Object.keys(dups).forEach(function (k) { counts[k] = dups[k].length; });
1335
- sibs.forEach(function (x) { ctxs[x.id].dups = dups; ctxs[x.id].all = everything; ctxs[x.id].reload = load; ctxs[x.id].siblings = ctxs; });
1336
- reports = triageSort(everything.filter(function (r) { return !r.duplicate_of; }), counts);
1337
- drawPlatforms();
1338
- render();
1339
- }).catch(function (x) {
1340
- if (reports.length) return; // a background refresh failed: keep what is on screen
1341
- list.textContent = '';
1342
- list.appendChild(el('p', { class: 'err', role: 'alert', text: x.message }));
1343
- list.appendChild(el('button', { class: 'btn', text: 'Retry', onclick: function () { route(); } }));
1378
+ function render(preserveDetail) {
1379
+ if (!shell.isConnected) return;
1380
+ var focused = document.activeElement;
1381
+ var focusedReport = list.contains(focused) && focused.dataset.report;
1382
+ var focusedStatus = filters.contains(focused) && focused.dataset.status;
1383
+ var currentProduct = projects.filter(function (x) { return productOf(x) === product; })[0];
1384
+ heading.textContent = currentProduct ? productName(currentProduct) : 'Inbox';
1385
+ var here = baseReports();
1386
+ filters.textContent = '';
1387
+ ['open', 'accepted', 'fixed', 'declined', 'withdrawn', 'all'].forEach(function (f) {
1388
+ var n = f === 'all' ? here.length : here.filter(function (r) { return r.status === f; }).length;
1389
+ filters.appendChild(el('button', { type: 'button', 'data-status': f, 'aria-pressed': String(filter === f), onclick: function () { filter = f; selected = null; render(); } },
1390
+ [(f === 'all' ? 'All' : STATUS_LABEL[f]) + ' ', el('span', { class: 'n', text: String(n) })]));
1344
1391
  });
1345
- }
1346
-
1347
- function render() {
1348
- var many = sibs.length > 1;
1349
- platformBar.textContent = '';
1350
- platformBar.hidden = !many;
1351
- if (many) {
1352
- [{ id: 'all', label: 'All platforms' }].concat(sibs.map(function (x) { return { id: x.id, label: platformOf(x.platform).label }; })).forEach(function (f) {
1353
- var n = f.id === 'all' ? reports.length : reports.filter(function (r) { return r.project_id === f.id; }).length;
1354
- platformBar.appendChild(el('button', { 'aria-pressed': String(where === f.id), onclick: function () { where = f.id; render(); } },
1355
- [f.label + ' ', el('span', { class: 'n', text: String(n) })]));
1356
- });
1357
- }
1358
- var here = reports.filter(function (r) { return where === 'all' || r.project_id === where; });
1359
- drawFilters(here);
1360
- list.textContent = '';
1392
+ var open = reports.filter(function (r) { return r.status === 'open'; }).length;
1393
+ $('inbox-count').textContent = String(open); $('inbox-count').hidden = !open;
1361
1394
  var shown = here.filter(function (r) { return filter === 'all' || r.status === filter; });
1362
- empty.hidden = shown.length > 0;
1363
- empty.textContent = '';
1364
- if (!here.length) {
1365
- empty.appendChild(document.createTextNode('No reports yet. '));
1366
- empty.appendChild(el('a', { href: '#/apps/' + (where === 'all' ? p.id : where) + '/setup', text: 'Check the install' }));
1367
- } else empty.textContent = filter === 'open' ? 'Nothing waiting. Every report has had its hearing.' : 'Nothing here.';
1395
+ listHead.firstChild.textContent = filter === 'open' ? 'Needs review' : filter === 'all' ? 'All reports' : STATUS_LABEL[filter] + ' reports';
1396
+ if (!shown.some(function (r) { return key(r) === selected; })) selected = shown.length ? key(shown[0]) : null;
1397
+ list.textContent = '';
1398
+ if (!projects.length) {
1399
+ list.appendChild(el('div', { class: 'inbox-empty' }, [el('img', { src: '/mark.svg', alt: '', width: '48', height: '48' }), el('h2', { text: 'Add your first app' }), el('p', { text: 'Connect your app to give every report a hearing.' }), el('a', { class: 'btn primary', href: '#/new', text: 'Add an app' })]));
1400
+ } else if (!shown.length) list.appendChild(el('div', { class: 'inbox-empty' }, [el('h2', { text: search || type !== 'all' || source !== 'all' ? 'No matching reports' : filter === 'open' ? 'All caught up' : 'Nothing here yet' }), el('p', { text: search || type !== 'all' || source !== 'all' ? 'Try another search or adjust your filters.' : 'New reports will appear here. Every report gets a hearing.' })]));
1368
1401
  shown.forEach(function (r) {
1369
- var c = ctxs[r.project_id];
1370
- list.appendChild(row(c.project, r, settled, c, many));
1402
+ var c = ctxs[r.project_id], count = (c.dups[r.id] || []).length + 1;
1403
+ var button = el('button', { type: 'button', class: 'report-preview t-' + r.type, 'data-report': key(r), 'aria-current': key(r) === selected ? 'true' : 'false', onclick: function () {
1404
+ if (selected !== key(r)) { selected = key(r); render(); }
1405
+ view.classList.add('detail-open'); detail.focus();
1406
+ } }, [
1407
+ el('span', { class: 'type-symbol', 'aria-hidden': 'true', text: { broken: '!', confusing: '?', improvement: '↗', idea: '+' }[r.type] }),
1408
+ el('span', { class: 'preview-copy' }, [el('b', { text: title(r) }), el('span', { class: 'preview-app', text: productName(c.project) + ' · ' + platformOf(c.project.platform).label }),
1409
+ el('span', { class: 'preview-meta', text: (count > 1 ? count + ' reports · ' : '') + (r.source === 'agent' ? 'Agent' : r.source === 'chat' ? r.via || 'Chat app' : 'In-app') + ' · ' + relative(r.created_at) })]),
1410
+ el('span', { class: 'pill ' + r.type, text: TYPE_LABEL[r.type] }),
1411
+ ]);
1412
+ list.appendChild(button);
1371
1413
  });
1372
- }
1373
-
1374
- function drawFilters(here) {
1375
- here = here || reports.filter(function (r) { return where === 'all' || r.project_id === where; });
1376
- filters.textContent = '';
1377
- ['open', 'accepted', 'fixed', 'declined', 'all'].forEach(function (f) {
1378
- var n = f === 'all' ? here.length : here.filter(function (r) { return r.status === f; }).length;
1379
- filters.appendChild(el('button', {
1380
- 'aria-pressed': String(filter === f),
1381
- onclick: function () { filter = f; render(); },
1382
- }, [(f === 'all' ? 'All' : STATUS_LABEL[f]) + ' ', el('span', { class: 'n', text: String(n) })]));
1414
+ drawDetail(shown, preserveDetail);
1415
+ var candidates = focusedReport ? list.querySelectorAll('[data-report]') : focusedStatus ? filters.querySelectorAll('[data-status]') : [];
1416
+ Array.prototype.some.call(candidates, function (n) {
1417
+ if ((focusedReport && n.dataset.report === focusedReport) || (focusedStatus && n.dataset.status === focusedStatus)) { n.focus({ preventScroll: true }); return true; }
1418
+ return false;
1383
1419
  });
1384
1420
  }
1385
-
1386
- /**
1387
- * A report moved. The card says so where the click was, the counts move at once, and only
1388
- * then does it leave this filter, so nothing vanishes without a word.
1389
- */
1421
+ function drawDetail(shown, preserve) {
1422
+ var chosen = shown.filter(function (x) { return key(x) === selected; })[0];
1423
+ var signature = chosen ? JSON.stringify([chosen, ctxs[chosen.project_id].briefs[chosen.id], ctxs[chosen.project_id].dups[chosen.id], ctxs[chosen.project_id].repos]) : null;
1424
+ if (preserve && signature === detailSignature && detail.querySelector('.detail-card, .detail-placeholder')) return;
1425
+ detailSignature = signature;
1426
+ detail.textContent = '';
1427
+ detail.appendChild(el('button', { class: 'btn ghost detail-back', type: 'button', text: '← Back to reports', onclick: function () { view.classList.remove('detail-open'); var active = list.querySelector('[aria-current=true]'); if (active) active.focus(); } }));
1428
+ var r = shown.filter(function (x) { return key(x) === selected; })[0];
1429
+ if (!r) { view.classList.remove('detail-open'); detail.appendChild(el('div', { class: 'detail-placeholder' }, [el('img', { src: '/mark.svg', width: '52', height: '52', alt: '' }), el('h2', { text: 'Every report gets a hearing.' }), el('p', { text: 'Select a report to read its story and decide what comes next.' })])); return; }
1430
+ var c = ctxs[r.project_id];
1431
+ var card = row(c.project, r, settled, c, true);
1432
+ card.classList.add('detail-card');
1433
+ card.setAttribute('data-report', key(r));
1434
+ card.prepend(el('div', { class: 'detail-eyebrow', text: productName(c.project) + ' / ' + r.id }));
1435
+ card.querySelector('.meta').before(el('h2', { class: 'detail-title', text: title(r) }));
1436
+ var evidence = card.querySelector('.trail');
1437
+ if (evidence) evidence.open = true;
1438
+ var device = deviceView(r.context);
1439
+ if (device) { var actions = card.querySelector('.actions'); card.insertBefore(device, actions || null); }
1440
+ detail.appendChild(card);
1441
+ }
1390
1442
  function settled(r, card, done) {
1391
- if (!done) return load(); // someone else got there first: show what they did
1392
- drawFilters();
1393
- var to = r.status;
1394
- toast(DONE_TOAST[to], filter === to || filter === 'all' ? null : {
1395
- label: 'View ' + STATUS_LABEL[to].toLowerCase(), run: function () { filter = to; render(); window.scrollTo(0, 0); },
1396
- });
1443
+ if (!done) return load();
1444
+ // A preserved detail may hold the pre-refresh object; keep filter counts in sync.
1445
+ reports.forEach(function (current) { if (key(current) === key(r)) Object.assign(current, r); });
1446
+ toast(DONE_TOAST[r.status], { label: 'View ' + STATUS_LABEL[r.status].toLowerCase(), run: function () { filter = r.status; selected = key(r); load(); } });
1397
1447
  card.classList.add('settled');
1398
- setTimeout(function () {
1399
- if (!card.isConnected) return;
1400
- if (filter === 'all' || filter === to) return load(); // it stays in this list
1401
- card.style.height = card.offsetHeight + 'px';
1402
- card.getBoundingClientRect();
1403
- card.classList.add('leaving');
1404
- card.style.height = '0px';
1405
- setTimeout(load, 320);
1406
- }, 2200);
1448
+ list.querySelectorAll('[data-report]').forEach(function (n) { if (n.dataset.report === key(r)) n.classList.add('settled'); });
1449
+ setTimeout(function () { if (card.isConnected) load(); }, 1400);
1450
+ }
1451
+ function readingReport() {
1452
+ return (detail.contains(document.activeElement) && /^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement.tagName)) || detail.querySelector('.busy, .settled')
1453
+ || Array.prototype.some.call(detail.querySelectorAll('textarea, input'), function (n) { return n.value.trim(); });
1454
+ }
1455
+ function load(background) {
1456
+ var serial = ++loadSerial, nextProjects, nextContexts = {};
1457
+ return api('GET', '/projects').then(function (b) {
1458
+ if (!shell.isConnected) return;
1459
+ nextProjects = b.projects;
1460
+ return Promise.all(nextProjects.map(function (x) {
1461
+ return Promise.all([api('GET', '/projects/' + x.id + '/reports'), api('GET', '/projects/' + x.id + '/repos')]).then(function (r) {
1462
+ nextContexts[x.id] = { project: x, reports: r[0].reports, briefs: r[0].briefs || {}, repos: r[1].repos || [] };
1463
+ });
1464
+ }));
1465
+ }).then(function () {
1466
+ if (!shell.isConnected || serial !== loadSerial || (background && readingReport())) return;
1467
+ // Commit a complete snapshot together; failed refreshes leave the old one intact.
1468
+ // Retained details close over their context; update it in place after success.
1469
+ Object.keys(nextContexts).forEach(function (id) {
1470
+ if (ctxs[id]) nextContexts[id] = Object.assign(ctxs[id], nextContexts[id]);
1471
+ });
1472
+ projects = nextProjects; ctxs = nextContexts;
1473
+ var everything = [].concat.apply([], projects.map(function (x) { return ctxs[x.id].reports; }));
1474
+ var dups = {}, counts = {};
1475
+ everything.forEach(function (r) { if (r.duplicate_of) (dups[r.duplicate_of.report_id] = dups[r.duplicate_of.report_id] || []).push(r); });
1476
+ Object.keys(dups).forEach(function (id) { counts[id] = dups[id].length; });
1477
+ projects.forEach(function (x) { var c = ctxs[x.id]; c.dups = dups; c.all = everything.filter(function (r) { return productOf(ctxs[r.project_id].project) === productOf(x); }); c.siblings = ctxs; c.reload = load; });
1478
+ reports = triageSort(everything.filter(function (r) { return !r.duplicate_of; }), counts);
1479
+ loaded = true; drawProducts(); render(background === true);
1480
+ }).catch(function (x) {
1481
+ if (!shell.isConnected) return;
1482
+ if (loaded) { toast('Could not refresh reports. ' + x.message); return; }
1483
+ list.textContent = ''; detail.textContent = '';
1484
+ list.appendChild(el('div', { class: 'inbox-empty' }, [el('h2', { text: 'Could not load reports' }), el('p', { class: 'err', role: 'alert', text: x.message }), el('button', { class: 'btn', text: 'Retry', onclick: load })]));
1485
+ });
1407
1486
  }
1408
-
1409
1487
  load();
1410
- // Reports arrive while you read. Don't refresh under someone typing, or a card on its way out.
1411
- every(30000, function () { if (!list.querySelector('textarea, .report.settled, .report .busy')) load(); });
1412
- }
1413
-
1414
- function ctxLine(c) {
1415
- return [c.page_title, c.route, c.app_version && ('v' + c.app_version), c.platform, c.os, c.browser,
1416
- c.viewport]
1417
- .filter(Boolean).join(' · ');
1488
+ every(30000, function () {
1489
+ // Keep a person's form, selection and reading position steady while they work.
1490
+ if (readingReport()) return;
1491
+ load(true);
1492
+ });
1418
1493
  }
1419
1494
 
1420
- /** The device around the app: what layout, language and timing bugs depend on. */
1421
- function deviceLine(c) {
1422
- var s = c.session_s;
1423
- var inApp = s == null ? null : 'in the app ' + (s < 60 ? s + ' s' : s < 3600 ? Math.floor(s / 60) + ' min' : Math.floor(s / 3600) + ' h ' + Math.floor(s % 3600 / 60) + ' min');
1424
- return [c.device, c.screen, c.theme && c.theme + ' mode', c.locale, c.timezone, c.network, c.settings, inApp]
1425
- .filter(Boolean).join(' · ');
1495
+ function deviceView(c) {
1496
+ var fields = [['Platform', c.platform], ['App version', c.app_version], ['Browser', c.browser], ['OS', c.os], ['Page', c.route], ['Network', c.network]];
1497
+ var more = [['Page title', c.page_title], ['Device', c.device], ['Screen', c.screen], ['Viewport', c.viewport], ['Language', c.locale], ['Timezone', c.timezone], ['Theme', c.theme], ['Settings', c.settings], ['Session', c.session_s == null ? null : c.session_s + ' seconds']];
1498
+ function grid(values) { var dl = el('dl', { class: 'device-grid' }); values.forEach(function (f) { if (f[1]) { dl.appendChild(el('dt', { text: f[0] })); dl.appendChild(el('dd', { text: f[1] })); } }); return dl; }
1499
+ if (!fields.concat(more).some(function (f) { return f[1]; })) return null;
1500
+ return el('section', { class: 'device-section', 'aria-label': 'Device and app' }, [el('h3', { text: 'Device & app' }), grid(fields), more.some(function (f) { return f[1]; }) ? el('details', {}, [el('summary', { text: 'View all details' }), grid(more)]) : null]);
1426
1501
  }
1427
1502
 
1428
1503
  var TRAIL_LABEL = { page: 'Page', click: 'Click', request: 'Request', error: 'Error', warn: 'Warning', state: 'Device' };
@@ -1473,11 +1548,16 @@
1473
1548
  var typed = [rp.name, rp.email].filter(Boolean).join(' · ');
1474
1549
  if (!app && !typed && !rp.note) return null;
1475
1550
  var reply = c.user_email || rp.email;
1476
- return el('div', { class: 'ctx' }, [
1551
+ var label = c.user_label || c.user_id || rp.name || rp.email || '';
1552
+ var initials = label.split(/\s+/).slice(0, 2).map(function (part) { return part.charAt(0); }).join('').toUpperCase();
1553
+ return el('div', { class: 'ctx reporter-context' }, [
1554
+ label ? el('span', { class: 'avatar', 'aria-hidden': 'true', text: initials }) : null,
1555
+ el('div', {}, [
1477
1556
  app ? el('span', {}, [document.createTextNode('Signed in: ' + app + ' ')]) : null,
1478
1557
  !app && typed ? el('span', {}, [document.createTextNode('From: ' + typed + ' ')]) : null,
1479
1558
  reply ? mailto(reply) : null,
1480
1559
  rp.note ? el('div', { text: 'About their setup: ' + rp.note }) : null,
1560
+ ]),
1481
1561
  ]);
1482
1562
  }
1483
1563
 
@@ -1492,6 +1572,7 @@
1492
1572
  var brief = ctx.briefs[r.id];
1493
1573
  var err = el('span', { class: 'err', role: 'alert' });
1494
1574
  var actions = el('div', { class: 'actions' });
1575
+ var acceptNote = el('textarea', { class: 'accept-note', rows: '2', maxlength: '1000', placeholder: 'Clarify what should change…', 'aria-label': 'Add a note for the coding agent (optional)' });
1495
1576
  var card, sentTo = null;
1496
1577
  var act = function (action, body, b) {
1497
1578
  if (action === 'accept') sentTo = (body && body.repo) || ctx.repos[0] || null;
@@ -1538,8 +1619,12 @@
1538
1619
  // Several repos hold this app's code: say where the fix goes, defaulting to the first.
1539
1620
  var pick = ctx.repos.length > 1 ? el('select', { 'aria-label': 'Where the fix goes' },
1540
1621
  ctx.repos.map(function (x) { return el('option', { value: x, text: 'Fix in ' + x }); })) : null;
1622
+ actions.appendChild(el('label', { class: 'accept-note-label' }, ['Add a note for the coding agent (optional)', acceptNote]));
1541
1623
  actions.appendChild(el('button', { class: 'btn primary', type: 'button', text: 'Accept', onclick: function (e) {
1542
- act('accept', pick ? { repo: pick.value } : undefined, e.currentTarget);
1624
+ var body = {};
1625
+ if (pick) body.repo = pick.value;
1626
+ if (acceptNote.value.trim()) body.note = acceptNote.value.trim();
1627
+ act('accept', body, e.currentTarget);
1543
1628
  } }));
1544
1629
  if (pick) actions.appendChild(pick);
1545
1630
  actions.appendChild(el('button', { class: 'btn', type: 'button', text: 'Decline…', onclick: declineForm }));
@@ -1565,6 +1650,7 @@
1565
1650
  }));
1566
1651
  actions.appendChild(el('button', { class: 'btn', type: 'button', text: 'Mark fixed…', onclick: fixedForm }));
1567
1652
  }
1653
+ if (r.status === 'open') actions.appendChild(el('p', { class: 'accept-hint', text: 'Accepting makes this report available to a connected coding agent.' }));
1568
1654
  actions.appendChild(err);
1569
1655
  }
1570
1656
 
@@ -1713,14 +1799,16 @@
1713
1799
  el('summary', { text: 'Attached document' + (r.document.title ? ': ' + r.document.title : '') + ' · ' + (r.document.markdown.length < 1000 ? r.document.markdown.length + ' characters' : Math.round(r.document.markdown.length / 1000) + 'k characters') }),
1714
1800
  markdown(r.document.markdown),
1715
1801
  ]) : null,
1716
- r.source === 'chat' || r.source === 'agent' ? null : el('div', { class: 'ctx', text: ctxLine(r.context) }),
1717
- r.source !== 'chat' && r.source !== 'agent' && deviceLine(r.context) ? el('div', { class: 'ctx', text: deviceLine(r.context) }) : null,
1802
+ null,
1803
+ null,
1718
1804
  r.context.page_url ? el('div', { class: 'ctx' }, [el('a', { href: r.context.page_url, target: '_blank', rel: 'noopener noreferrer', text: r.context.page_url })]) : null,
1719
1805
  reporterLine(r.context, r.reporter),
1720
1806
  dupBox,
1721
1807
  suggest,
1722
1808
  trailView(r.trail),
1723
1809
  r.decline_reason ? el('div', { class: 'reason', text: 'Declined: ' + r.decline_reason }) : null,
1810
+ r.withdrawal ? el('div', { class: 'reason withdrawn', text: 'Withdrawn by ' + ({ reporter: 'the person who sent it', member: r.withdrawal.by, agent: 'the agent in ' + r.withdrawal.by }[r.withdrawal.kind] || r.withdrawal.by)
1811
+ + ' on ' + new Date(r.withdrawal.at).toLocaleString() + (r.withdrawal.reason ? ': ' + r.withdrawal.reason : '') }) : null,
1724
1812
  r.fix_note ? el('div', { class: 'reason', text: 'Told them: ' + r.fix_note }) : null,
1725
1813
  r.status === 'fixed' ? fixRefLine() : null,
1726
1814
  r.status === 'accepted' && brief ? el('div', { class: 'brief-line' }, [
@@ -1728,7 +1816,7 @@
1728
1816
  ]) : null,
1729
1817
  brief && brief.notes.length ? el('details', { class: 'notes' }, [el('summary', { text: brief.notes.length + (brief.notes.length === 1 ? ' note' : ' notes') + ' from agents' })]
1730
1818
  .concat(brief.notes.map(function (n) { return el('p', {}, [el('span', { class: 'mute', text: n.by.replace(/^agent:/, '') + ' · ' + new Date(n.at).toLocaleString() + ': ' }), n.text]); }))) : null,
1731
- r.status === 'fixed' || r.status === 'declined' ? null : actions,
1819
+ r.status === 'fixed' || r.status === 'declined' || r.status === 'withdrawn' ? null : actions,
1732
1820
  ]);
1733
1821
  return card;
1734
1822
  }
@@ -1795,7 +1883,7 @@
1795
1883
  go.disabled = true;
1796
1884
  api('DELETE', '/projects/' + p.id, { confirm: confirm.value }).then(function () {
1797
1885
  projects = projects.filter(function (x) { return x.id !== p.id; });
1798
- location.hash = '#/';
1886
+ location.hash = '#/apps';
1799
1887
  }).catch(function (x) { err.textContent = x.message; go.disabled = false; });
1800
1888
  };
1801
1889
  view.appendChild(el('section', { class: 'card' }, owner ? [el('h2', { text: '2. Delete the app from Heresay' }), form]
@@ -97,7 +97,8 @@
97
97
  improvement: ['Could be better', 'It works, but it could be better'],
98
98
  idea: ['Idea', 'Something that does not exist yet'],
99
99
  },
100
- status: { open: 'Waiting for the developer', accepted: 'Accepted, being worked on', fixed: 'Fixed', declined: 'Declined' },
100
+ status: { open: 'Waiting for the developer', accepted: 'Accepted, being worked on', fixed: 'Fixed', declined: 'Declined', withdrawn: 'You took this back' },
101
+ takeBack: 'Take back', takeBackAsk: 'Take this back? It isn’t deleted: the team sees you withdrew it.', takeBackWhy: 'Why? (optional)', takeBackYes: 'Take it back', keep: 'Keep it', yourWhy: 'Your reason: ',
101
102
  optional: '(optional)', yourName: 'Your name', email: 'Email',
102
103
  emailHint: 'Only if you are happy for the team to reply to you.',
103
104
  setup: 'About your setup', setupHint: 'Sent with every report, so you only say it once.',
@@ -136,7 +137,8 @@
136
137
  improvement: ['Pourrait être mieux', 'Ça marche, mais ça pourrait être mieux'],
137
138
  idea: ['Idée', 'Quelque chose qui n’existe pas encore'],
138
139
  },
139
- status: { open: 'En attente de l’équipe', accepted: 'Accepté, en cours', fixed: 'Corrigé', declined: 'Refusé' },
140
+ status: { open: 'En attente de l’équipe', accepted: 'Accepté, en cours', fixed: 'Corrigé', declined: 'Refusé', withdrawn: 'Vous l’avez retiré' },
141
+ takeBack: 'Retirer', takeBackAsk: 'Retirer ce signalement ? Il n’est pas supprimé : l’équipe voit que vous l’avez retiré.', takeBackWhy: 'Pourquoi ? (facultatif)', takeBackYes: 'Le retirer', keep: 'Le garder', yourWhy: 'Votre raison : ',
140
142
  optional: '(facultatif)', yourName: 'Votre nom', email: 'E-mail',
141
143
  emailHint: 'Seulement si vous acceptez que l’équipe vous réponde.',
142
144
  setup: 'Votre configuration', setupHint: 'Envoyé avec chaque signalement, pour ne le dire qu’une fois.',
@@ -175,7 +177,8 @@
175
177
  improvement: ['இன்னும் சிறப்பாக்கலாம்', 'வேலை செய்கிறது, ஆனால் மேம்படுத்தலாம்'],
176
178
  idea: ['யோசனை', 'இன்னும் இல்லாத ஒன்று'],
177
179
  },
178
- status: { open: 'டெவலப்பருக்காகக் காத்திருக்கிறது', accepted: 'ஏற்கப்பட்டது, வேலை நடக்கிறது', fixed: 'சரிசெய்யப்பட்டது', declined: 'நிராகரிக்கப்பட்டது' },
180
+ status: { open: 'டெவலப்பருக்காகக் காத்திருக்கிறது', accepted: 'ஏற்கப்பட்டது, வேலை நடக்கிறது', fixed: 'சரிசெய்யப்பட்டது', declined: 'நிராகரிக்கப்பட்டது', withdrawn: 'நீங்கள் திரும்பப் பெற்றீர்கள்' },
181
+ takeBack: 'திரும்பப் பெறு', takeBackAsk: 'இதைத் திரும்பப் பெறவா? இது நீக்கப்படாது: நீங்கள் திரும்பப் பெற்றதைக் குழு பார்க்கும்.', takeBackWhy: 'ஏன்? (விருப்பத்தேர்வு)', takeBackYes: 'திரும்பப் பெறு', keep: 'வைத்திரு', yourWhy: 'உங்கள் காரணம்: ',
179
182
  optional: '(விருப்பத்தேர்வு)', yourName: 'உங்கள் பெயர்', email: 'மின்னஞ்சல்',
180
183
  emailHint: 'குழு உங்களுக்குப் பதில் அனுப்பலாம் என்றால் மட்டும்.',
181
184
  setup: 'உங்கள் அமைப்பு பற்றி', setupHint: 'ஒவ்வொரு புகாருடனும் அனுப்பப்படும், எனவே ஒருமுறை சொன்னால் போதும்.',
@@ -214,7 +217,8 @@
214
217
  improvement: ['बेहतर हो सकता है', 'काम करता है, पर बेहतर हो सकता है'],
215
218
  idea: ['सुझाव', 'कुछ ऐसा जो अभी नहीं है'],
216
219
  },
217
- status: { open: 'डेवलपर का इंतज़ार', accepted: 'स्वीकार, इस पर काम चल रहा है', fixed: 'ठीक हो गया', declined: 'अस्वीकार' },
220
+ status: { open: 'डेवलपर का इंतज़ार', accepted: 'स्वीकार, इस पर काम चल रहा है', fixed: 'ठीक हो गया', declined: 'अस्वीकार', withdrawn: 'आपने इसे वापस ले लिया' },
221
+ takeBack: 'वापस लें', takeBackAsk: 'इसे वापस लें? यह हटाया नहीं जाएगा: टीम देखेगी कि आपने इसे वापस लिया।', takeBackWhy: 'क्यों? (वैकल्पिक)', takeBackYes: 'वापस लें', keep: 'रहने दें', yourWhy: 'आपकी वजह: ',
218
222
  optional: '(वैकल्पिक)', yourName: 'आपका नाम', email: 'ईमेल',
219
223
  emailHint: 'सिर्फ़ तब, जब आप चाहते हैं कि टीम आपको जवाब दे।',
220
224
  setup: 'आपके सेटअप के बारे में', setupHint: 'हर रिपोर्ट के साथ भेजा जाता है, ताकि आपको एक ही बार बताना पड़े।',
@@ -334,7 +338,7 @@
334
338
  }
335
339
  function unseen() {
336
340
  var s = seen();
337
- return state.reports.filter(function (r) { return r.status !== 'open' && s[r.id] !== mark(r); }).length;
341
+ return state.reports.filter(function (r) { return r.status !== 'open' && r.status !== 'withdrawn' && s[r.id] !== mark(r); }).length;
338
342
  }
339
343
  /** a < b for versions like 1.4, 1.10.2, 2.0 (build suffixes ignored). Unknown: false. */
340
344
  function older(a, b) {
@@ -1022,6 +1026,15 @@
1022
1026
  }).then(body);
1023
1027
  }
1024
1028
 
1029
+ function withdrawReport(id, reason) {
1030
+ if (PREVIEW) return Promise.resolve({ report: Object.assign({}, state.reports.filter(function (x) { return x.id === id; })[0], { status: 'withdrawn', withdrawn_reason: reason || null }) });
1031
+ return fetch(API + '/reports/withdraw', {
1032
+ method: 'POST',
1033
+ headers: { 'content-type': 'text/plain;charset=UTF-8' },
1034
+ body: JSON.stringify({ key: KEY, device_id: deviceId(), report_id: id, reason: reason || null }),
1035
+ }).then(body);
1036
+ }
1037
+
1025
1038
  function refresh() {
1026
1039
  if (PREVIEW) return Promise.resolve();
1027
1040
  return fetch(API + '/reports/mine', {
@@ -1155,6 +1168,8 @@
1155
1168
  '.thanks{padding:10px 12px;margin:0 0 8px;border-radius:10px;background:var(--fb-line)}',
1156
1169
  '.item{border-top:1px solid var(--fb-line);padding:10px 0}',
1157
1170
  '.item:first-child{border-top:0}',
1171
+ '.take-back{margin-top:6px}.take-back input{width:100%;padding:7px 9px;border:1px solid var(--fb-line);border-radius:8px;background:none;margin:4px 0}',
1172
+ '.take-back .row{margin-top:4px;justify-content:flex-end}',
1158
1173
  '.status{font-size:12px;font-weight:600}',
1159
1174
  '.status.fixed,.status.accepted{color:var(--fb-fg)}',
1160
1175
  '.reason{margin-top:4px;padding:8px;border-radius:8px;background:var(--fb-line);font-size:13px}',
@@ -1503,7 +1518,7 @@
1503
1518
  var s = seen();
1504
1519
  state.reports.forEach(function (r) {
1505
1520
  var label = (TYPES.filter(function (t) { return t.id === r.type; })[0] || {}).label || r.type;
1506
- var fresh = r.status !== 'open' && s[r.id] !== mark(r);
1521
+ var fresh = r.status !== 'open' && r.status !== 'withdrawn' && s[r.id] !== mark(r);
1507
1522
  listBox.appendChild(el('div', { class: 'item' }, [
1508
1523
  el('div', { class: 'status ' + r.status, text: (fresh ? '● ' : '') + (S.status[r.status] || r.status) }),
1509
1524
  el('div', { class: 'text', text: r.text }),
@@ -1514,10 +1529,42 @@
1514
1529
  ? el('div', { class: 'reason', text: r.fix_note }) : null,
1515
1530
  r.status === 'fixed' && r.fix_version
1516
1531
  ? el('div', { class: 'small', text: fmt(S.fixedIn, { v: r.fix_version }) + (older(state.version, r.fix_version) ? ' ' + fmt(S.updateTo, { v: r.fix_version }) : '') }) : null,
1532
+ r.status === 'withdrawn' && r.withdrawn_reason ? el('div', { class: 'small', text: S.yourWhy + r.withdrawn_reason }) : null,
1533
+ r.status === 'open' ? takeBack(r) : null,
1517
1534
  ]));
1518
1535
  });
1519
1536
  }
1520
1537
 
1538
+ /** "Take back": a report they sent and the team hasn't accepted. Kept as withdrawn, not deleted. */
1539
+ function takeBack(r) {
1540
+ var box = el('div', { class: 'take-back' });
1541
+ function ask() {
1542
+ box.textContent = '';
1543
+ var why = el('input', { type: 'text', maxlength: '500', placeholder: S.takeBackWhy, 'aria-label': S.takeBackWhy });
1544
+ var err = el('div', { class: 'err', role: 'alert' });
1545
+ box.appendChild(el('p', { class: 'small', text: S.takeBackAsk }));
1546
+ box.appendChild(why);
1547
+ box.appendChild(el('div', { class: 'row' }, [
1548
+ el('button', { class: 'link', type: 'button', text: S.keep, onclick: idle }),
1549
+ el('button', { class: 'send', type: 'button', text: S.takeBackYes, onclick: function () {
1550
+ withdrawReport(r.id, why.value.trim()).then(function (b) {
1551
+ state.reports = state.reports.map(function (x) { return x.id === r.id ? b.report : x; });
1552
+ markSeen();
1553
+ renderList();
1554
+ }).catch(function (x) { err.textContent = x.message || S.cantSend; });
1555
+ } }),
1556
+ ]));
1557
+ box.appendChild(err);
1558
+ why.focus();
1559
+ }
1560
+ function idle() {
1561
+ box.textContent = '';
1562
+ box.appendChild(el('button', { class: 'link', type: 'button', text: S.takeBack, onclick: ask }));
1563
+ }
1564
+ idle();
1565
+ return box;
1566
+ }
1567
+
1521
1568
  // ---- introduction ----------------------------------------------------------------------
1522
1569
 
1523
1570
  // People can't use a button they never noticed. Once per device and app, a bubble says what it
@@ -0,0 +1,271 @@
1
+ /* Heresay workspace. Brand: Deep Peacock, Figtree, Bricolage Grotesque, JetBrains Mono. */
2
+ :root { --sidebar:224px; --soft:#f6f7f8; --mute:#626c7a; --line:#e5e8ec; }
3
+ body { font-size:14px; }
4
+ button, input, select, textarea { font-family:inherit; }
5
+ button, a, input, select, textarea, summary { -webkit-tap-highlight-color:transparent; }
6
+ button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline:2px solid var(--acc); outline-offset:3px; }
7
+ button:disabled { opacity:.55; cursor:not-allowed; }
8
+ input, textarea, select, .btn { border-radius:7px; }
9
+ input, textarea, select { border-color:#cfd5dc; }
10
+ input::placeholder, textarea::placeholder { color:#737e8c; opacity:1; }
11
+ textarea { resize:vertical; }
12
+ .btn { font-size:13px; min-height:36px; padding:7px 13px; }
13
+ .btn.primary { background:var(--acc); }
14
+ .btn.ghost:hover { background:var(--soft); }
15
+ h1 { font-size:30px; }
16
+ h3 { font-size:15px; margin:0 0 14px; font-weight:700; }
17
+ .card, .product-card, .app-card, .platform { border-radius:9px; box-shadow:none; }
18
+ .card { padding:24px; margin-top:24px; }
19
+ .card h2 { margin-bottom:14px; }
20
+ .head { margin-bottom:24px; }
21
+ .head .row { margin:0; }
22
+ .code pre { border-radius:8px; }
23
+ .skip-link { position:fixed; top:8px; left:240px; z-index:50; transform:translateY(-160%); background:var(--bg); border:2px solid var(--acc); padding:8px 16px; border-radius:6px; }
24
+ .skip-link:focus { transform:translateY(0); }
25
+ .sidebar { width:var(--sidebar); position:fixed; inset:0 auto 0 0; display:flex; flex-direction:column; z-index:12; background:#f7f8f9; border-right:1px solid var(--line); padding:28px 14px 14px; }
26
+ .brand { display:block; margin:0 12px 26px; }
27
+ .brand img { display:block; width:150px; height:auto; }
28
+ .workspace-label { display:flex; align-items:center; gap:9px; min-height:42px; margin:0 4px 25px; padding:8px 10px; border:1px solid var(--line); border-radius:7px; background:var(--bg); font-size:12px; }
29
+ .workspace-icon { display:grid; place-items:center; width:22px; height:22px; border-radius:5px; background:var(--mist); color:var(--deep); font-weight:700; }
30
+ .workspace-role { color:var(--mute); margin-left:auto; font-size:10px; }
31
+ .sidebar .tabs { display:flex; flex-direction:column; gap:5px; }
32
+ .sidebar .tabs a { display:flex; align-items:center; gap:12px; min-height:42px; color:#46505e; font-size:14px; font-weight:500; text-decoration:none; padding:10px 12px; border-radius:6px; position:relative; }
33
+ .sidebar .tabs a:hover { background:#edf0f2; color:var(--fg); }
34
+ .sidebar .tabs a[aria-current=page] { color:var(--deep); background:var(--mist); font-weight:700; }
35
+ .sidebar .tabs a[aria-current=page]::before { content:""; position:absolute; left:0; top:8px; bottom:8px; width:2px; background:var(--acc); border-radius:2px; }
36
+ .nav-icon { flex:none; width:19px; height:19px; display:inline-flex; }
37
+ .nav-icon svg { width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
38
+ .nav-count { margin-left:auto; min-width:23px; padding:0 5px; border-radius:4px; background:#d3eae6; text-align:center; font-size:12px; }
39
+ .nav-section { border-top:1px solid var(--line); margin:24px 8px 9px; padding:20px 6px 0; text-transform:uppercase; letter-spacing:.09em; color:var(--mute); font-size:10px; font-weight:600; }
40
+ .sidebar-bottom { margin-top:auto; padding-top:24px; }
41
+ .help-link { display:flex; align-items:center; gap:12px; padding:16px 10px; border-top:1px solid var(--line); color:#46505e; text-decoration:none; font-size:13px; }
42
+ .help-link > span:last-child { margin-left:auto; }
43
+ .account { display:flex; gap:10px; align-items:center; padding:14px 10px 0; }
44
+ .account .avatar { width:30px; height:30px; flex:none; background:var(--deep); color:white; font-size:11px; }
45
+ .account .who { display:block; overflow:hidden; text-overflow:ellipsis; color:var(--fg); font-size:12px; white-space:nowrap; }
46
+ .signout { margin:4px 0 0 49px; padding:2px 0; min-height:28px; font-size:11px; }
47
+ .workspace-top { position:sticky; top:0; z-index:8; margin-left:var(--sidebar); min-height:55px; padding:0 28px; display:flex; align-items:center; justify-content:space-between; gap:16px; background:var(--bg); border-bottom:1px solid var(--line); }
48
+ .breadcrumb { display:flex; gap:12px; align-items:center; font-size:12px; color:var(--mute); }
49
+ .breadcrumb > span:first-child { color:#acb3bc; }
50
+ #page-label { color:var(--fg); }
51
+ .top-caption { color:var(--mute); font-size:11px; }
52
+ #nav-toggle { display:none; }
53
+ #view { max-width:1120px; margin:0 0 0 var(--sidebar); padding:38px 42px 80px; min-height:calc(100dvh - 55px); }
54
+ #view.wide { max-width:none; }
55
+ #update { margin-left:var(--sidebar); border-bottom:1px solid var(--line); border-radius:0; }
56
+ #view:not(.inbox-view) > .head, #view:not(.inbox-view) > h1 { margin-top:0; }
57
+ .apps { gap:18px; margin-top:24px; }
58
+ .product-card { background:var(--bg); transition:border-color .15s; }
59
+ .product-card:hover { border-color:#b8c5c3; }
60
+ .picon { width:38px; height:38px; border-radius:8px; }
61
+ .platform { padding:24px; }
62
+ .hello { margin-top:12vh; }
63
+ .gate { border:1px solid var(--line); border-radius:12px; padding:36px; max-width:430px; box-shadow:0 10px 40px rgb(21 23 28 / .04); }
64
+ .gate h1 { font-size:27px; }
65
+ .gate .btn { min-height:42px; }
66
+ .members li { padding:16px 0; }
67
+ .design-side { top:78px; }
68
+
69
+ /* The report list and evidence pane fill the workspace; both scroll independently. */
70
+ #view.inbox-view { max-width:none; padding:0; height:calc(100dvh - 55px); min-height:560px; }
71
+ .inbox-shell { display:grid; grid-template-columns:minmax(340px, 39%) minmax(0, 1fr); height:100%; }
72
+ .inbox-master { min-width:0; overflow:auto; border-right:1px solid var(--line); overscroll-behavior:contain; }
73
+ .inbox-heading { padding:28px 24px 0; }
74
+ .inbox-heading h1 { font-size:29px; }
75
+ .inbox-heading p { font-size:14px; margin:5px 0 18px; }
76
+ .inbox-search { position:relative; margin:0 24px 14px; }
77
+ .inbox-search input { width:100%; height:37px; padding-right:55px; font-size:13px; background:var(--bg); }
78
+ .inbox-search kbd { position:absolute; right:10px; top:9px; font:11px var(--mono); color:var(--mute); border:1px solid var(--line); border-radius:3px; padding:0 4px; pointer-events:none; }
79
+ .inbox-controls { display:flex; gap:8px; padding:0 24px 18px; }
80
+ .inbox-controls select { font-size:12px; padding:7px 22px 7px 9px; min-width:0; max-width:42%; text-overflow:ellipsis; height:36px; }
81
+ .inbox-controls .btn { font-size:12px; }
82
+ .inbox-advanced { background:var(--soft); padding:12px 24px; display:flex; gap:12px; flex-wrap:wrap; border-block:1px solid var(--line); }
83
+ .inbox-advanced label { color:var(--mute); font-size:12px; display:flex; align-items:center; gap:8px; }
84
+ .inbox-advanced select { font-size:12px; padding:5px 8px; max-width:170px; }
85
+ .inbox-app-tools { margin:0 24px 18px; font-size:12px; }
86
+ .inbox-app-tools summary { color:var(--acc); cursor:pointer; }
87
+ .inbox-app-tools .product-platforms { margin:10px 0 0; }
88
+ .app-tool-row { display:flex; gap:10px; flex-wrap:wrap; padding:8px 0; }
89
+ .app-tool-row b { width:100%; }
90
+ .status-tabs { display:flex; gap:2px; padding:0 18px; border-bottom:1px solid var(--line); overflow-x:auto; scrollbar-width:thin; }
91
+ .status-tabs button { display:flex; align-items:center; gap:5px; padding:13px 8px; font:600 12px Figtree,system-ui,sans-serif; border:0; border-bottom:2px solid transparent; background:none; color:var(--mute); white-space:nowrap; cursor:pointer; }
92
+ .status-tabs button:hover { color:var(--fg); }
93
+ .status-tabs button[aria-pressed=true] { color:var(--deep); border-bottom-color:var(--acc); }
94
+ .status-tabs .n { font-size:10px; font-weight:500; border-radius:4px; padding:0 4px; background:var(--soft); min-width:17px; }
95
+ .status-tabs button[aria-pressed=true] .n { background:var(--mist); }
96
+ .list-heading { display:flex; align-items:baseline; justify-content:space-between; gap:12px; padding:18px 24px; font-size:12px; }
97
+ .list-heading b { font-size:13px; }
98
+ .list-heading > span { font-size:10px; color:var(--mute); }
99
+ .report-preview { --type:var(--mute); display:grid; grid-template-columns:23px minmax(0,1fr) auto; gap:12px; width:100%; text-align:left; border:0; border-bottom:1px solid var(--line); background:var(--bg); font:inherit; padding:20px 22px 20px 24px; cursor:pointer; position:relative; color:var(--fg); }
100
+ .report-preview:hover { background:#f7f9fa; }
101
+ .report-preview[aria-current=true] { background:#edf6f4; }
102
+ .report-preview[aria-current=true]::before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background:var(--acc); }
103
+ .report-preview.t-broken { --type:var(--broken); }
104
+ .report-preview.t-confusing { --type:var(--confusing); }
105
+ .report-preview.t-improvement { --type:var(--improvement); }
106
+ .report-preview.t-idea { --type:var(--idea); }
107
+ .type-symbol { display:grid; place-items:center; border:1.5px solid var(--type); border-radius:50%; width:21px; height:21px; color:var(--type); font-size:14px; line-height:1; margin-top:2px; }
108
+ .preview-copy { min-width:0; }
109
+ .preview-copy b { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; font-weight:650; line-height:1.45; font-size:14px; overflow-wrap:anywhere; }
110
+ .preview-app { display:block; color:var(--mute); font-size:12px; margin-top:5px; }
111
+ .preview-meta { display:block; color:var(--mute); font-size:10px; margin-top:9px; }
112
+ .report-preview > .pill { font-weight:500; font-size:10px; padding:3px 6px; border-radius:4px; align-self:start; letter-spacing:0; }
113
+ .report-preview > .broken { background:#fbeceb; }
114
+ .report-preview > .confusing { background:#fbf1e3; }
115
+ .report-preview > .improvement { background:#eaf0fa; max-width:82px; text-align:center; }
116
+ .report-preview > .idea { background:#f1edf9; }
117
+ .report-preview.settled { opacity:.55; }
118
+ .inbox-empty { text-align:center; padding:56px 28px; color:var(--mute); }
119
+ .inbox-empty img { margin-bottom:16px; }
120
+ .inbox-empty h2 { color:var(--fg); }
121
+ .inbox-empty p { margin:8px 0 20px; }
122
+ .report-detail { min-width:0; overflow:auto; overscroll-behavior:contain; background:var(--bg); }
123
+ .report-detail:focus { outline:none; }
124
+ .detail-back { display:none; }
125
+ .detail-placeholder { text-align:center; padding:22vh 32px 40px; color:var(--mute); max-width:420px; margin:auto; }
126
+ .detail-placeholder img { opacity:.5; margin-bottom:18px; }
127
+ .detail-placeholder h2 { font-size:21px; color:var(--fg); }
128
+ .detail-placeholder p { margin-top:10px; }
129
+ .report.detail-card { padding:28px 30px 32px; border:0; border-radius:0; margin:0; box-shadow:none; overflow:visible; transition:background-color .2s; min-height:100%; }
130
+ .report.detail-card:hover { border:0; box-shadow:none; }
131
+ .detail-eyebrow { text-transform:uppercase; letter-spacing:.045em; color:var(--mute); font-size:10px; overflow-wrap:anywhere; padding-right:80px; margin-bottom:22px; }
132
+ .detail-card .meta { gap:8px; font-size:11px; margin-bottom:14px; }
133
+ .detail-card .meta > .status { position:absolute; right:30px; top:27px; padding:4px 10px; border-radius:5px; background:var(--mist); color:var(--deep); }
134
+ .detail-card .meta .pill { font-size:11px; font-weight:500; border:0; background:none; padding:0; }
135
+ .detail-card .meta time { color:var(--mute); }
136
+ .detail-card .detail-title { font-size:25px; line-height:1.25; margin:0 0 20px; overflow-wrap:anywhere; }
137
+ .detail-card > .text, .detail-card > .md { padding:16px; background:var(--soft); border-radius:7px; font-size:15px; line-height:1.7; margin:0 0 18px; }
138
+ .detail-card > .ctx { font-size:12px; margin:8px 0; overflow-wrap:anywhere; }
139
+ .detail-card > .ctx a { overflow-wrap:anywhere; }
140
+ .detail-card > .dups { padding:8px 0 18px; color:var(--deep); }
141
+ .detail-card > .dups ul { color:var(--fg); line-height:1.7; }
142
+ .detail-card .dups li { margin:12px 0; }
143
+ .detail-card .trail { margin:20px 0 0; border-top:1px solid var(--line); padding-top:20px; }
144
+ .detail-card .trail summary { font-size:13px; font-weight:600; color:var(--fg); }
145
+ .detail-card .trail ol { margin:18px 0 20px 7px; }
146
+ .detail-card .trail li { padding:6px 0; gap:12px; }
147
+ .detail-card .trail li::before { top:12px; border-color:#c7ced6; width:6px; height:6px; left:-18px; }
148
+ .detail-card .trail .kind { font-size:9px; width:49px; }
149
+ .detail-card .trail .ago { font-size:10px; width:38px; }
150
+ .detail-card .trail .what { font-size:12px; }
151
+ .device-section { border-top:1px solid var(--line); padding:20px 0; margin-top:20px; }
152
+ .device-section h3 { margin-bottom:12px; }
153
+ .device-grid { display:grid; grid-template-columns:90px minmax(0,1fr) 90px minmax(0,1fr); gap:9px 12px; font-size:12px; margin:0; }
154
+ .device-grid dt { color:var(--mute); }
155
+ .device-grid dd { margin:0; overflow-wrap:anywhere; }
156
+ .device-section details { margin-top:16px; }
157
+ .device-section summary { color:var(--deep); font-size:12px; font-weight:600; cursor:pointer; }
158
+ .device-section details .device-grid { margin-top:15px; }
159
+ .detail-card > .actions { border-top:1px solid var(--line); margin-top:20px; padding-top:20px; gap:10px; }
160
+ .accept-note-label { flex:1 1 100%; font-size:11px; color:var(--mute); margin-bottom:4px; }
161
+ .accept-note-label textarea { display:block; width:100%; min-height:58px; margin-top:6px; font-size:13px; }
162
+ .accept-hint { flex:1 1 100%; color:var(--mute); font-size:11px; margin:2px 0 0; }
163
+ .actions > .err:empty { display:none; }
164
+ .detail-card .actions textarea { min-height:80px; }
165
+ .detail-card .actions .accept-note { min-height:58px; }
166
+ .detail-card .actions select { max-width:100%; font-size:12px; }
167
+ .detail-card .fix-line { padding:14px 0; }
168
+ .detail-card .brief-line { padding:14px; background:var(--mist); border-radius:6px; margin:18px 0; }
169
+ .detail-card > .notes, .detail-card > .chat-details { padding:14px 0; border-top:1px solid var(--line); }
170
+ .detail-card > .reason { margin:18px 0; }
171
+ @media (min-width:1600px) { .inbox-shell { grid-template-columns:480px minmax(0,1fr); } .detail-card { max-width:1000px; margin-inline:auto !important; } }
172
+ @media (max-width:1200px) {
173
+ :root { --sidebar:198px; }
174
+ .sidebar { padding-inline:10px; }
175
+ .sidebar .tabs a { font-size:13px; gap:10px; }
176
+ .inbox-shell { grid-template-columns:340px minmax(0,1fr); }
177
+ .report-preview { gap:9px; padding-inline:18px; grid-template-columns:20px minmax(0,1fr); }
178
+ .report-preview > .pill { grid-column:2; grid-row:2; justify-self:start; margin-top:2px; }
179
+ .device-grid { grid-template-columns:85px minmax(0,1fr); }
180
+ .report.detail-card { padding-inline:24px; }
181
+ .detail-card .meta > .status { right:24px; }
182
+ .status-tabs { padding-inline:12px; }
183
+ .status-tabs button { padding-inline:7px; font-size:11px; }
184
+ .status-tabs .n { font-size:9px; }
185
+ #view:not(.inbox-view) { padding-inline:30px; }
186
+ .workspace-role { display:none; }
187
+ }
188
+ @media (max-width:960px) {
189
+ :root { --sidebar:180px; }
190
+ .brand img { width:135px; }
191
+ .sidebar .tabs a { font-size:12px; gap:9px; }
192
+ .inbox-shell { grid-template-columns:minmax(0,1fr); }
193
+ .report-detail { display:none; }
194
+ .inbox-master { border:0; }
195
+ .inbox-view.detail-open .inbox-master { display:none; }
196
+ .inbox-view.detail-open .report-detail { display:block; }
197
+ .detail-back { display:inline-flex; margin:12px 20px 0; }
198
+ .report-preview { grid-template-columns:23px minmax(0,1fr) auto; }
199
+ .report-preview > .pill { grid-column:auto; grid-row:auto; }
200
+ .device-grid { grid-template-columns:85px minmax(0,1fr) 85px minmax(0,1fr); }
201
+ .inbox-controls select { max-width:none; }
202
+ .top-caption { display:none; }
203
+ }
204
+ @media (max-width:640px) {
205
+ :root { --sidebar:0px; }
206
+ .sidebar { transform:translateX(-100%); width:240px; transition:transform .18s ease; box-shadow:8px 0 32px rgb(21 23 28 / .1); }
207
+ .nav-open .sidebar { transform:translateX(0); }
208
+ .nav-open::after { content:""; position:fixed; inset:55px 0 0 240px; background:rgb(21 23 28 / .18); z-index:10; }
209
+ .workspace-top { padding:0 16px; justify-content:flex-start; }
210
+ #nav-toggle { display:inline-flex; font-size:18px; padding:3px 8px; margin-left:-8px; }
211
+ .sidebar .tabs a { font-size:14px; }
212
+ .sidebar .who { display:block; }
213
+ .sidebar .brand img { width:150px; }
214
+ .skip-link { left:16px; }
215
+ #view:not(.inbox-view) { padding:26px 20px 60px; }
216
+ #view.inbox-view { min-height:0; }
217
+ .inbox-heading { padding:24px 20px 0; }
218
+ .inbox-search { margin-inline:20px; }
219
+ .inbox-controls { padding-inline:20px; flex-wrap:wrap; }
220
+ .inbox-controls select { flex:1; }
221
+ .list-heading { padding-inline:20px; }
222
+ .status-tabs button { font-size:12px; padding-inline:8px; }
223
+ .report-preview { padding:18px 20px; }
224
+ .report-preview > .pill { max-width:74px; }
225
+ .preview-copy b { font-size:14px; }
226
+ .device-grid { grid-template-columns:85px minmax(0,1fr); }
227
+ .report.detail-card { padding:20px; }
228
+ .detail-card .meta > .status { top:20px; right:20px; }
229
+ .detail-card .detail-title { font-size:24px; }
230
+ .detail-card .meta { padding-right:0; }
231
+ .detail-card .trail li { gap:7px; }
232
+ .detail-card .trail .kind { width:42px; }
233
+ .detail-card .trail .ago { width:32px; }
234
+ .head { flex-wrap:wrap; }
235
+ .head .row { flex-wrap:wrap; }
236
+ .platforms { gap:10px; }
237
+ .platform { padding:16px; }
238
+ .card { padding:20px; }
239
+ .gate { margin:8vh 16px; padding:28px 24px; }
240
+ #update { padding:12px 20px; }
241
+ }
242
+ @media (prefers-reduced-motion:reduce) { .sidebar, .product-card, .report.detail-card { transition:none; } }
243
+ .nav-close, .nav-scrim { display:none; }
244
+ @media (max-width:640px) {
245
+ .sidebar { padding-top:28px; overflow-y:auto; }
246
+ .nav-close { display:inline-flex; position:absolute; right:8px; top:18px; font-size:23px; padding:2px 8px; }
247
+ .sidebar .brand { margin-right:26px; }
248
+ .nav-open::after { display:none; }
249
+ .nav-open .nav-scrim { display:block; position:fixed; inset:0 0 0 240px; background:rgb(21 23 28 / .18); border:0; z-index:11; cursor:pointer; }
250
+ }
251
+ .app-repo-status { flex-basis:100%; color:var(--mute); overflow-wrap:anywhere; }
252
+ .preview-copy b { font-size:15px; }
253
+ .preview-app { font-size:13px; }
254
+ .preview-meta { font-size:11px; }
255
+ .detail-card .detail-title { font-size:26px; }
256
+ .detail-card > .text, .detail-card > .md { font-size:16px; }
257
+ .detail-card .meta { font-size:12px; }
258
+ .toast { width:max-content; }
259
+ .toast button { white-space:nowrap; flex-shrink:0; }
260
+ .members li > div { min-width:0; overflow-wrap:anywhere; }
261
+ @media (max-width:640px) {
262
+ .btn { min-height:42px; }
263
+ .signout { min-height:32px; }
264
+ .status-tabs button { min-height:44px; }
265
+ .preview-copy b { font-size:14px; }
266
+ .detail-card .detail-title { font-size:24px; }
267
+ }
268
+ .detail-card > .reporter-context { display:flex; align-items:center; gap:10px; margin:18px 0; }
269
+ .reporter-context .avatar { flex:none; width:32px; height:32px; background:#edf0f4; color:#46505e; font-size:11px; }
270
+ .reporter-context > div { min-width:0; overflow-wrap:anywhere; }
271
+ .reporter-context a { margin-left:6px; }