@wrongstack/cli 0.269.0 → 0.270.0

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/dist/index.js CHANGED
@@ -3490,7 +3490,7 @@ var init_hq_server = __esm({
3490
3490
  "src/hq-server.ts"() {
3491
3491
  DEFAULT_HOST = "127.0.0.1";
3492
3492
  DEFAULT_PORT = 3499;
3493
- MAX_EVENT_LOG = 500;
3493
+ MAX_EVENT_LOG = 5e3;
3494
3494
  MAX_NON_STRICT_PORT_SCAN = 50;
3495
3495
  HQ_HTML = `<!DOCTYPE html>
3496
3496
  <html lang="en">
@@ -3519,9 +3519,9 @@ var init_hq_server = __esm({
3519
3519
  .hq-led.live { background: var(--live); box-shadow: 0 0 6px var(--live); }
3520
3520
  .hq-led.dead { background: var(--dim); }
3521
3521
  .hq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
3522
- .hq-flow { position: relative; min-height: 320px; overflow: hidden; background: radial-gradient(circle at 1px 1px, rgba(139,148,158,0.18) 1px, transparent 0), #0d1117; background-size: 22px 22px; border: 1px solid var(--border); border-radius: 10px; }
3523
- .hq-flow svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
3524
- .hq-flow .flow-node { position: absolute; width: 168px; min-height: 74px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(22,27,34,0.96); box-shadow: 0 8px 18px rgba(0,0,0,0.28); }
3522
+ .hq-flow { position: relative; min-height: 320px; overflow-x: auto; overflow-y: visible; background: radial-gradient(circle at 1px 1px, rgba(139,148,158,0.18) 1px, transparent 0), #0d1117; background-size: 22px 22px; border: 1px solid var(--border); border-radius: 10px; }
3523
+ .hq-flow svg { position: absolute; top: 0; left: 0; height: 100%; pointer-events: none; z-index: 0; }
3524
+ .hq-flow .flow-node { position: absolute; width: 168px; min-height: 74px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(22,27,34,0.96); box-shadow: 0 8px 18px rgba(0,0,0,0.28); z-index: 1; }
3525
3525
  .hq-flow .flow-node.core { border-color: rgba(88,166,255,0.65); box-shadow: 0 0 0 1px rgba(88,166,255,0.08), 0 8px 18px rgba(0,0,0,0.28); }
3526
3526
  .hq-flow .flow-node.project { border-color: rgba(63,185,80,0.45); }
3527
3527
  .hq-flow .flow-node.mailbox { border-color: rgba(210,153,34,0.45); }
@@ -3794,28 +3794,72 @@ var init_hq_server = __esm({
3794
3794
  const projectIndex = new Map(orderedProjects.map((id, index) => [id, index]));
3795
3795
  const rows = Math.max(1, orderedProjects.length);
3796
3796
  const height = Math.max(320, 150 + rows * 112);
3797
- root.style.minHeight = height + 'px';
3797
+ // Grid layout: each project gets a row band; mailboxes stack vertically within their project column.
3798
+ // This prevents overlap that occurred with the old formula:
3799
+ // y: y + mailboxIdx * 92 - Math.max(0, projectMailboxes.length - 1) * 28
3800
+ // which produced negative offsets when projectMailboxes.length > 1.
3801
+ const HQ_X = 20;
3802
+ const PROJECT_X = 280;
3803
+ const MAILBOX_X = 540;
3804
+ const NODE_W = 168;
3805
+ const ROW_HEIGHT = 100; // vertical spacing per project row
3806
+ const MAILBOX_ROW_H = 80; // vertical spacing per mailbox under same project
3807
+ const TOP_PADDING = 20;
3808
+ const HQ_HEIGHT = 74;
3798
3809
 
3799
- const nodes = [{ id: 'hq', kind: 'core', title: 'WrongStack HQ', x: 24, y: Math.max(24, Math.round(height / 2) - 38), meta: [clients.length + ' clients', orderedProjects.length + ' projects'] }];
3810
+ const nodes = [{
3811
+ id: 'hq',
3812
+ kind: 'core',
3813
+ title: 'WrongStack HQ',
3814
+ x: HQ_X,
3815
+ y: TOP_PADDING,
3816
+ meta: [clients.length + ' clients', orderedProjects.length + ' projects'],
3817
+ }];
3800
3818
  const edges = [];
3801
3819
  const projectById = new Map(projects.map((p) => [p.projectId, p]));
3820
+
3802
3821
  for (const projectId of orderedProjects) {
3803
3822
  const idx = projectIndex.get(projectId) || 0;
3804
3823
  const project = projectById.get(projectId) || { projectId, projectName: projectId, activeClients: 0 };
3805
- const y = 40 + idx * 112;
3824
+ const projectY = TOP_PADDING + idx * ROW_HEIGHT;
3806
3825
  const projectNodeId = 'project:' + projectId;
3807
- nodes.push({ id: projectNodeId, kind: 'project', title: project.projectName || projectId, x: 260, y, meta: [(project.activeClients || 0) + ' clients', shortId(projectId)] });
3826
+ nodes.push({
3827
+ id: projectNodeId,
3828
+ kind: 'project',
3829
+ title: project.projectName || projectId,
3830
+ x: PROJECT_X,
3831
+ y: projectY,
3832
+ meta: [(project.activeClients || 0) + ' clients', shortId(projectId)],
3833
+ });
3808
3834
  edges.push({ from: 'hq', to: projectNodeId });
3809
- const projectMailboxes = mailboxes.filter((m) => m.projectId === projectId).slice(0, 3);
3835
+
3836
+ // Mailboxes for this project: stack horizontally side-by-side within the row
3837
+ const projectMailboxes = mailboxes.filter((m) => m.projectId === projectId).slice(0, 6);
3810
3838
  projectMailboxes.forEach((m, mailboxIdx) => {
3811
3839
  const mailboxNodeId = 'mailbox:' + m.mailboxId;
3812
- nodes.push({ id: mailboxNodeId, kind: 'mailbox', title: shortId(m.mailboxId), x: 500, y: y + mailboxIdx * 92 - Math.max(0, projectMailboxes.length - 1) * 28, meta: [m.messageCount + ' msgs', m.unreadCount + ' unread'] });
3840
+ nodes.push({
3841
+ id: mailboxNodeId,
3842
+ kind: 'mailbox',
3843
+ title: shortId(m.mailboxId),
3844
+ x: MAILBOX_X + mailboxIdx * (NODE_W + 16), // horizontal spacing for multiple mailbox columns
3845
+ y: projectY,
3846
+ meta: [m.messageCount + ' msgs', m.unreadCount + ' unread'],
3847
+ });
3813
3848
  edges.push({ from: projectNodeId, to: mailboxNodeId });
3814
3849
  });
3815
3850
  }
3816
3851
 
3852
+ // Recalculate height to fit all rows
3853
+ const usedHeight = TOP_PADDING + orderedProjects.length * ROW_HEIGHT + 80;
3854
+ const usedWidth = MAILBOX_X + 4 * (NODE_W + 16) + NODE_W + 20;
3855
+ root.style.minHeight = Math.max(height, usedHeight) + 'px';
3856
+ root.style.minWidth = Math.max(720, usedWidth) + 'px';
3857
+
3817
3858
  const pos = new Map(nodes.map((n) => [n.id, n]));
3818
- const svg = '<svg viewBox="0 0 720 ' + height + '" preserveAspectRatio="xMinYMin meet" aria-hidden="true">' +
3859
+ const svgViewW = Math.max(720, usedWidth);
3860
+ const svgViewH = Math.max(height, usedHeight);
3861
+ const svgWidth = svgViewW + 'px';
3862
+ const svg = '<svg viewBox="0 0 ' + svgViewW + ' ' + svgViewH + '" width="' + svgWidth + '" preserveAspectRatio="none" aria-hidden="true">' +
3819
3863
  '<defs><marker id="arrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path d="M0,0 L8,4 L0,8 Z" fill="#58a6ff" opacity="0.8" /></marker></defs>' +
3820
3864
  edges.map((e) => {
3821
3865
  const from = pos.get(e.from);
@@ -3888,7 +3932,7 @@ var init_hq_server = __esm({
3888
3932
  // Per-project live event feed (ring buffer per project). Keyed by
3889
3933
  // projectId so switching drawers keeps each project's history.
3890
3934
  const eventFeeds = new Map();
3891
- const FEED_MAX = 50;
3935
+ const FEED_MAX = 500;
3892
3936
  let feedIdleTimer = null;
3893
3937
 
3894
3938
  function currentBrowserToken() {
@@ -4143,9 +4187,9 @@ var init_hq_server = __esm({
4143
4187
  // ---------- Live mailbox event feed ----------
4144
4188
 
4145
4189
  function handleHqEvent(event) {
4146
- if (!event || event.type !== 'mailbox.event') return;
4190
+ // Accept all event types \u2014 each may carry project-scoped data for the live feed.
4191
+ if (!event || !event.projectId) return;
4147
4192
  const projectId = event.projectId;
4148
- if (!projectId) return;
4149
4193
  const list = eventFeeds.get(projectId) || [];
4150
4194
  list.unshift(event); // newest first
4151
4195
  if (list.length > FEED_MAX) list.length = FEED_MAX;
@@ -4162,7 +4206,7 @@ var init_hq_server = __esm({
4162
4206
  const elFeed = el('drawer-event-feed');
4163
4207
  if (!elFeed) return;
4164
4208
  if (!list || list.length === 0) {
4165
- elFeed.innerHTML = '<p class="empty">No mailbox events yet for this project.</p>';
4209
+ elFeed.innerHTML = '<p class="empty">No events yet for this project.</p>';
4166
4210
  return;
4167
4211
  }
4168
4212
  elFeed.innerHTML = list.map((evt) => {