@william_jin/autobrowse 0.8.6 → 0.8.8

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/README.md CHANGED
@@ -367,7 +367,9 @@ a row; it is work.
367
367
  (default 2, the Mac screen's own); `LIVE_VIEW_THEME` its look (`dark`, the default, `light` or
368
368
  `system`). Its address field suggests from the profile's history and from
369
369
  Google; `LIVE_VIEW_SUGGEST=false` stops the Google part (what you type goes
370
- to Google, as in Chrome). Design: `designs/2026-11-25-live-view.md`.
370
+ to Google, as in Chrome). Open it yourself with `autobrowse hub`, or
371
+ Autobrowse Live in Spotlight or the Dock (`~/Applications/Autobrowse Live.app`): every
372
+ session, and headless runs as rows you open to watch. Design: `designs/2026-11-25-live-view.md`.
371
373
  - **Where the browser is.** `BROWSER=local` (a Chrome per site profile),
372
374
  `browserbase`, or `cdp` with `BROWSER_CDP_URL=http://127.0.0.1:9222`: a
373
375
  browser already running, or an Electron app (new Outlook, Slack, Notion)
@@ -19,7 +19,7 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
19
19
  .nb{height:26px;min-width:26px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border-radius:7px;color:var(--mut);transition:background-color .15s,color .15s}
20
20
  .nb:hover{background:var(--btnh);color:var(--fg)}
21
21
  .nb.on{color:var(--fg)}
22
- #seg{display:flex;margin:0;border:0;min-width:0;padding:2px;border-radius:8px;background:var(--seg)}
22
+ #seg{display:flex;flex:none;margin:0;border:0;padding:2px;border-radius:8px;background:var(--seg)}
23
23
  #seg button{height:22px;padding:0 9px;border-radius:6px;color:var(--mut);font-size:12px;font-weight:500;transition:background-color .15s,color .15s}
24
24
  #seg button[aria-pressed=true]{background:var(--segon);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.12)}
25
25
  #unmax{max-width:0;padding:0;opacity:0;overflow:hidden;white-space:nowrap;font-size:12px;font-weight:500;pointer-events:none;transition:max-width .15s cubic-bezier(.16,1,.3,1),padding .15s cubic-bezier(.16,1,.3,1),opacity .1s,background-color .15s,color .15s}
@@ -28,10 +28,20 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
28
28
  /* sizer: the longer label, never seen */
29
29
  #pauseall::after{content:"Resume all";height:0;overflow:hidden;visibility:hidden}
30
30
  #pauseall:disabled{opacity:.4}
31
+ /* 390: traffic lights + all controls fit */
32
+ @media (max-width:759px){#top{gap:4px}#seg button{padding:0 7px}#pauseall{padding:0 8px}}
31
33
  #main{position:absolute;inset:38px 0 0 0;display:flex}
32
- #side{position:relative;flex:none;width:248px;display:flex;flex-direction:column;background:var(--side);overflow:hidden;transition:width .2s cubic-bezier(.16,1,.3,1)}
33
- .noside #side{width:0}
34
- #list{position:relative;list-style:none;margin:0;flex:1;overflow-y:auto;padding:2px 6px 44px;width:248px;scrollbar-width:thin}
34
+ #list{position:relative;list-style:none;margin:0;flex:1;overflow-y:auto;padding:2px 6px 44px;scrollbar-width:thin}
35
+ /* §Sidebar collapse: #side holds the room in the layout (full, rail or none); #sidein is the panel, --sidew wide, clipped to that room. The flyout unclips it over the stage, so the stage never resizes */
36
+ #side{position:relative;z-index:3;flex:none;width:var(--sidew,248px);background:var(--side);transition:width .2s cubic-bezier(.16,1,.3,1)}
37
+ .m-rail #side{width:52px}
38
+ .m-hidden #side{width:0}
39
+ #sidein{position:absolute;inset:0 auto 0 0;width:var(--sidew,248px);display:flex;flex-direction:column;background:var(--side);overflow:hidden;clip-path:inset(0 0 0 0);transition:clip-path .2s cubic-bezier(.16,1,.3,1),box-shadow .2s cubic-bezier(.16,1,.3,1)}
40
+ .m-rail #sidein{clip-path:inset(0 calc(100% - 52px) 0 0)}
41
+ .m-hidden #sidein{clip-path:inset(0 100% 0 0);pointer-events:none}
42
+ /* the flyout: unclipped, room on the right for its shadow */
43
+ .m-rail.peek #sidein{clip-path:inset(0 -60px 0 0);box-shadow:0 0 0 1px var(--hair),var(--lift);transition-duration:.18s}
44
+ .unpeek #side #sidein{transition-duration:.15s}
35
45
  /* a leaving row or label: out of the flow, fading, while the rest slide up */
36
46
  #list>.gone{position:absolute;left:6px;right:6px;opacity:0;pointer-events:none;transition:opacity .15s}
37
47
  .sec{position:sticky;top:0;z-index:1;background:var(--side);transition:opacity .15s,transform .2s cubic-bezier(.16,1,.3,1)}
@@ -143,12 +153,60 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
143
153
  #keys kbd{min-width:22px;height:22px;padding:0 6px;border-radius:6px;font-size:12px}
144
154
  /* biome-ignore lint/complexity/noImportantStyles: reduced motion beats every rule; fades stay, moves go (MO-27) */
145
155
  @media (prefers-reduced-motion:reduce){*,*::before,*::after{transition-property:opacity,background-color,color,box-shadow!important;animation:none!important}#keys .s{transform:none}}
156
+ /* §Sidebar collapse: overrides, after the base rules */
157
+ #bar #more{justify-content:center;width:26px;padding:0}
158
+ #more[aria-expanded=true]{background:var(--btnh);color:var(--fg)}
159
+ /* the sidebar's actions (Raycast's Actions): a native popover, grown from its button */
160
+ #menu{position:fixed;inset:auto;margin:0;min-width:200px;padding:5px;border:1px solid transparent;border-radius:10px;background:var(--side);color:var(--fg);box-shadow:var(--raise),var(--lift);font-size:13px;transform-origin:var(--org,left bottom);transition:opacity .15s cubic-bezier(.16,1,.3,1),transform .15s cubic-bezier(.16,1,.3,1),display .15s allow-discrete,overlay .15s allow-discrete}
161
+ #menu:not(:popover-open){opacity:0;transform:scale(.97);transition-duration:.1s}
162
+ @starting-style{#menu:popover-open{opacity:0;transform:scale(.97)}}
163
+ #menu button{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 8px 0 6px;border-radius:6px;text-align:left;white-space:nowrap;transition:background-color .15s}
164
+ #menu button:hover:not(:disabled){background:var(--btnh)}
165
+ #menu button:disabled{opacity:.4;cursor:not-allowed}
166
+ #menu .ck{width:14px;height:14px;opacity:0}
167
+ #menu [aria-checked=true] .ck{opacity:1}
168
+ #menu .ks{margin-left:auto;padding-left:16px}
169
+ #menu hr{border:0;height:1px;margin:4px 6px;background:var(--line)}
170
+ /* the rail: one 40 px cell a row, the icon and its badge; the name stays for screen readers */
171
+ .railrows #list{scrollbar-width:none}
172
+ .railrows #list .row{display:flex;align-items:center;justify-content:center;width:40px;height:34px;padding:0}
173
+ .railrows #list .row>:not(.ico):not(.site){display:none}
174
+ .railrows #list .row .site,.railrows #list .sh .l{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
175
+ .railrows #list .sh{width:40px;justify-content:center;padding:8px 0 4px}
176
+ .railrows #list .sec:first-child .sh{padding-top:4px}
177
+ .railrows #list .sh::before{content:"";width:20px;height:1px;background:var(--line)}
178
+ .railrows #list .sec:first-child .sh::before{background:transparent}
179
+ .railrows #list .sh .n,.railrows #list .sh .ic{display:none}
180
+ .railrows #list .sh[aria-expanded=true]{pointer-events:none}
181
+ .railrows #list .sh[aria-expanded=false]::before{display:none}
182
+ .railrows #list .sh[aria-expanded=false] .n{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:18px;padding:0 5px;border-radius:9px;background:var(--fill);box-shadow:inset 0 0 0 1px var(--hair);color:var(--fg);font-size:11px;opacity:1}
183
+ .railrows #bar{padding:0 6px;gap:0}
184
+ .railrows #barl,.railrows #bar .sp,.railrows #barkeys{display:none}
185
+ .railrows #bar #more{width:40px}
186
+ /* the edge: drag to size; neutral, never an accent stripe */
187
+ #grip{position:absolute;top:0;bottom:0;right:-3px;width:6px;z-index:4;cursor:col-resize;touch-action:none}
188
+ #grip::after{content:"";position:absolute;top:0;bottom:0;left:2px;width:2px;background:color-mix(in srgb,var(--fg) 22%,transparent);opacity:0;transition:opacity .15s}
189
+ #grip:hover::after,#grip:focus-visible::after,.sizing #grip::after{opacity:1}
190
+ #grip:focus-visible{outline:none}
191
+ #grip:focus-visible::after{opacity:1;background:var(--ring)}
192
+ .m-hidden #grip,.peek #grip,.narrow #grip{display:none}
193
+ /* a drag: 1:1 with the pointer, so no tweens; frames take no pointer */
194
+ .sizing,.sizing *{cursor:col-resize}
195
+ .sizing #side,.sizing #side #sidein,.sizing #stage .pane{transition:none}
196
+ .sizing iframe{pointer-events:none}
197
+ /* a snap mid-drag (rail, hidden, back): the edge leaves the pointer, so it eases */
198
+ .sizing.snap #side{transition:width .12s cubic-bezier(.16,1,.3,1)}
199
+ .sizing.snap #side #sidein{transition:clip-path .12s cubic-bezier(.16,1,.3,1)}
200
+ /* compact rows: one line; a needs-you reason stays */
201
+ #list .row .meta,#list .row .title{transition:opacity .1s}
202
+ .compacting .row :is(.meta,.job,.flow,.title){opacity:0}
203
+ .compact #list .row :is(.meta,.job,.flow,.title){display:none}
146
204
  </style>
147
205
  </head>
148
206
  <body>
149
207
  <svg width="0" height="0" style="position:absolute" aria-hidden="true"><symbol id="mark" viewBox="0 0 100 100"><g stroke-linecap="round" stroke-linejoin="round"><path d="M27.0 3.2C28.3 3.0 30.0 3.1 31.5 3.0C33.0 2.9 34.5 2.8 36.0 2.7C37.5 2.6 39.0 2.5 40.5 2.4C42.0 2.3 43.5 2.2 45.0 2.2C46.5 2.1 48.0 2.2 49.5 2.2C51.0 2.2 52.5 2.3 54.0 2.4C55.5 2.5 57.0 2.6 58.5 2.7C60.0 2.8 61.5 3.0 63.0 3.1C64.5 3.1 66.0 3.2 67.5 3.3C69.0 3.3 70.5 3.3 72.0 3.3C73.5 3.3 75.0 3.3 76.5 3.2C78.0 3.2 79.7 3.1 81.0 3.2C82.3 3.3 83.3 3.4 84.4 3.9C85.4 4.3 86.4 5.1 87.1 5.9C87.8 6.7 88.4 7.7 88.8 8.8C89.2 9.8 89.2 10.9 89.3 12.1C89.4 13.2 89.3 14.5 89.4 15.7C89.4 16.9 89.5 18.1 89.6 19.3C89.8 20.6 89.9 21.8 90.0 23.0C90.2 24.2 90.3 25.4 90.4 26.7C90.5 27.9 90.6 29.1 90.7 30.3C90.7 31.6 90.7 32.8 90.7 34.0C90.7 35.2 90.6 36.4 90.6 37.7C90.5 38.9 90.4 40.1 90.4 41.3C90.3 42.6 90.4 43.8 90.2 45.0C90.1 46.2 89.9 47.4 89.5 48.5C89.0 49.6 88.3 50.7 87.5 51.5C86.7 52.3 85.6 53.1 84.5 53.5C83.5 54.0 82.4 54.1 81.0 54.2C79.7 54.3 78.0 54.1 76.5 54.0C75.0 53.9 73.5 53.8 72.0 53.7C70.5 53.6 69.0 53.5 67.5 53.4C66.0 53.3 64.5 53.2 63.0 53.2C61.5 53.1 60.0 53.2 58.5 53.2C57.0 53.2 55.5 53.3 54.0 53.4C52.5 53.5 51.0 53.6 49.5 53.7C48.0 53.8 46.5 54.0 45.0 54.1C43.5 54.1 42.0 54.2 40.5 54.3C39.0 54.3 37.5 54.3 36.0 54.3C34.5 54.3 33.0 54.3 31.5 54.2C30.0 54.2 28.3 54.3 27.0 54.2C25.6 54.1 24.6 54.0 23.5 53.5C22.4 53.1 21.3 52.4 20.4 51.6C19.5 50.8 18.7 49.8 18.2 48.7C17.7 47.6 17.5 46.3 17.3 45.1C17.2 43.8 17.3 42.6 17.4 41.3C17.4 40.1 17.5 38.9 17.6 37.7C17.8 36.4 17.9 35.2 18.0 34.0C18.2 32.8 18.3 31.6 18.4 30.3C18.5 29.1 18.6 27.9 18.7 26.7C18.7 25.4 18.7 24.2 18.7 23.0C18.7 21.8 18.6 20.6 18.6 19.3C18.5 18.1 18.4 16.9 18.4 15.7C18.3 14.4 18.1 13.2 18.2 12.0C18.3 10.8 18.4 9.7 18.8 8.6C19.3 7.6 20.0 6.6 20.8 5.8C21.6 5.0 22.6 4.3 23.6 3.9C24.7 3.5 25.7 3.3 27.0 3.2Z" style="fill:var(--mkf)" stroke="currentColor" stroke-width="3.62"/><path d="M18.1 12.8C19.4 12.7 20.9 12.8 22.3 12.8C23.8 12.8 25.2 12.7 26.7 12.6C28.1 12.6 29.6 12.5 31.0 12.4C32.4 12.3 33.9 12.3 35.3 12.2C36.8 12.2 38.2 12.2 39.7 12.2C41.1 12.2 42.6 12.2 44.0 12.3C45.4 12.3 46.9 12.3 48.3 12.3C49.8 12.3 51.2 12.3 52.7 12.2C54.1 12.2 55.6 12.1 57.0 12.0C58.4 11.9 59.9 11.7 61.3 11.6C62.8 11.5 64.2 11.3 65.7 11.2C67.1 11.1 68.7 10.9 70.1 11.0C71.5 11.1 72.9 11.3 74.2 11.9C75.4 12.5 76.7 13.4 77.5 14.5C78.4 15.5 79.1 16.8 79.5 18.1C79.9 19.3 79.9 20.6 79.9 22.0C80.0 23.4 79.8 25.0 79.7 26.4C79.7 27.9 79.7 29.4 79.7 30.9C79.7 32.4 79.7 33.9 79.7 35.3C79.8 36.8 79.8 38.3 79.8 39.8C79.8 41.3 79.8 42.7 79.7 44.2C79.7 45.7 79.6 47.2 79.5 48.7C79.5 50.1 79.4 51.6 79.3 53.1C79.3 54.6 79.2 56.1 79.2 57.6C79.2 59.0 79.3 60.6 79.3 61.9C79.2 63.3 79.2 64.5 78.9 65.7C78.5 66.9 77.9 68.1 77.1 69.1C76.3 70.1 75.2 71.1 74.0 71.7C72.8 72.3 71.5 72.6 70.1 72.8C68.7 72.9 67.1 72.8 65.7 72.8C64.2 72.8 62.8 72.7 61.3 72.6C59.9 72.6 58.4 72.5 57.0 72.4C55.6 72.3 54.1 72.3 52.7 72.2C51.2 72.2 49.8 72.2 48.3 72.2C46.9 72.2 45.4 72.2 44.0 72.3C42.6 72.3 41.1 72.3 39.7 72.3C38.2 72.3 36.8 72.3 35.3 72.2C33.9 72.2 32.4 72.1 31.0 72.0C29.6 71.9 28.1 71.7 26.7 71.6C25.2 71.5 23.8 71.3 22.3 71.2C20.9 71.1 19.4 71.2 18.1 71.0C16.8 70.9 15.6 70.8 14.5 70.4C13.4 70.0 12.3 69.4 11.4 68.6C10.5 67.8 9.6 66.8 9.0 65.7C8.4 64.6 8.1 63.4 7.9 62.0C7.7 60.6 7.8 59.0 7.7 57.6C7.7 56.1 7.7 54.6 7.7 53.1C7.7 51.6 7.7 50.1 7.7 48.7C7.8 47.2 7.8 45.7 7.8 44.2C7.8 42.7 7.8 41.3 7.7 39.8C7.7 38.3 7.6 36.8 7.5 35.3C7.5 33.9 7.4 32.4 7.3 30.9C7.3 29.4 7.2 27.9 7.2 26.4C7.2 25.0 7.1 23.3 7.3 21.9C7.5 20.5 7.8 19.2 8.4 18.0C9.0 16.9 10.0 15.8 11.0 15.0C12.0 14.2 13.2 13.6 14.4 13.2C15.5 12.9 16.7 12.8 18.1 12.8Z" style="fill:var(--mkf)" stroke="currentColor" stroke-width="4.7"/><circle cx="18.0" cy="21" r="2.6" style="fill:none" stroke="currentColor" stroke-width="2.4"/><circle cx="25.5" cy="21" r="2.6" style="fill:none" stroke="currentColor" stroke-width="2.4"/><circle cx="33.0" cy="21" r="2.6" style="fill:none" stroke="currentColor" stroke-width="2.4"/><path d="M40.0 21.2C41.2 21.1 45.0 20.7 47.5 20.8C50.0 20.8 52.5 21.2 55.0 21.2C57.5 21.2 60.0 21.0 62.5 20.9C65.0 20.9 68.8 20.9 70.0 20.9" style="fill:none" stroke="currentColor" stroke-width="3.38"/><path d="M8.0 29.1C9.2 29.0 12.8 28.6 15.2 28.6C17.6 28.6 20.0 29.0 22.4 29.1C24.8 29.2 27.2 29.2 29.6 29.2C32.0 29.2 34.4 29.1 36.8 29.0C39.2 28.9 41.6 28.8 44.0 28.8C46.4 28.8 48.8 28.8 51.2 28.9C53.6 29.0 56.0 29.4 58.4 29.4C60.8 29.4 63.2 29.0 65.6 28.9C68.0 28.7 70.4 28.5 72.8 28.6C75.2 28.7 78.8 29.3 80.0 29.4" style="fill:none" stroke="currentColor" stroke-width="3.38"/><path d="M45 50H37M47.6 43.6L41.6 37.6M54 41V35" style="fill:none;stroke:var(--mkt)" stroke-width="4.5" /><path d="M54.0 50.0Q53.3 70.0 54.0 90.0Q58.4 85.3 63.3 81.3Q66.3 89.0 70.3 96.3Q73.9 94.4 77.7 93.1Q74.7 85.7 70.7 78.7Q76.8 78.4 83.0 79.0Q69.0 64.0 54.0 50.0Z" style="fill:var(--mkf)" stroke="currentColor" stroke-width="4.2"/></g></symbol></svg>
150
208
  <div id="top">
151
- <button type="button" class="nb" id="sidebtn" title="Sessions (⌘\)" aria-label="Show or hide sessions (⌘\)" aria-pressed="true"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="2"/><path d="M6 3v10"/></svg></button>
209
+ <button type="button" class="nb" id="sidebtn" title="Sessions (⌘\)" aria-label="Collapse or expand the sidebar (⌘\)" aria-pressed="true"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="2"/><path d="M6 3v10"/></svg></button>
152
210
  <div class="sp" id="drag"></div>
153
211
  <button type="button" class="nb" id="unmax" title="Restore the layout (⌘⇧↩)" tabindex="-1"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><path d="M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4"/></svg>Restore</button>
154
212
  <fieldset id="seg" aria-label="Layout">
@@ -160,14 +218,17 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
160
218
  <button type="button" class="nb" id="keysbtn" title="Keys" aria-label="Keys" aria-expanded="false"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="1.5" y="4" width="13" height="8.5" rx="1.8"/><path d="M4.5 7h.01M7 7h.01M9.5 7h.01M12 7h.01M5 10h6"/></svg></button>
161
219
  </div>
162
220
  <div id="main">
163
- <nav id="side" aria-label="Sessions"><ul id="list"></ul>
164
- <div id="bar" class="off"><span id="barl"></span><span class="sp"></span><button type="button" id="barkeys" title="Keys (⌘/)">Keys <span class="ks"><kbd>⌘</kbd><kbd>/</kbd></span></button></div>
221
+ <nav id="side" aria-label="Sessions"><div id="sidein"><ul id="list"></ul>
222
+ <div id="bar" class="off"><span id="barl"></span><span class="sp"></span><button type="button" id="barkeys" title="Keys (⌘/)">Keys <span class="ks"><kbd>⌘</kbd><kbd>/</kbd></span></button><button type="button" id="more" title="Sidebar actions" aria-label="Sidebar actions" aria-haspopup="menu" aria-expanded="false" aria-controls="menu" popovertarget="menu"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h.01M8 8h.01M12.5 8h.01" stroke-width="2.4"/></svg></button></div></div>
223
+ <!-- biome-ignore lint/a11y/useSemanticElements: a focusable splitter (WAI-ARIA window splitter); <hr> is a static rule -->
224
+ <div id="grip" role="separator" tabindex="0" aria-orientation="vertical" aria-label="Sidebar width" aria-valuemin="0" aria-valuemax="420" aria-valuenow="248" title="Drag to resize; double-click to reset"></div>
165
225
  </nav>
166
226
  <div id="stage" class="single">
167
227
  <div id="empty"><svg viewBox="0 0 100 100" aria-hidden="true"><use href="#mark"/></svg><div class="h">No sessions</div><div class="s"></div></div>
168
228
  <div id="keys"><div class="s" role="dialog" aria-label="Keyboard shortcuts"><div class="hd"><svg aria-hidden="true" viewBox="0 0 100 100"><use href="#mark"/></svg>Keyboard shortcuts<button type="button" class="cl" id="keysx" title="Close (Esc)" aria-label="Close (Esc)"><kbd>esc</kbd></button></div><div class="g">Hub</div></div></div>
169
229
  </div>
170
230
  </div>
231
+ <div id="menu" popover role="menu" aria-label="Sidebar actions"></div>
171
232
  <script>
172
233
  'use strict';
173
234
  const $ = (id) => document.getElementById(id);
@@ -194,7 +255,7 @@ const ICON = {
194
255
  const FILLED = new Set(['pause', 'play']);
195
256
  const icon = (n) => `<svg class="ic${FILLED.has(n) ? ' fill' : ''}" viewBox="0 0 16 16" aria-hidden="true">${ICON[n]}</svg>`;
196
257
  /** the hub's keys: this sheet, and a group in each pane's ⌘/ sheet */
197
- const HUB_KEYS = [['Sessions', ['⌘', '\\']], ['Focus, Split, Grid', ['⌃', '⌘', '1–3']], ['Next pane', ['⌘', '⌥', '←→↑↓']], ['Maximize a pane', ['⌘', '⇧', '↩']], ['Session by row', ['⌘', '⌥', '1–9']], ['Sessions list', ['⌘', '⌥', '0']], ['Own window, dock back', ['⌘', '⇧', 'T']], ['Pause or resume all', ['⌘', '⇧', 'P']]];
258
+ const HUB_KEYS = [['Sidebar: full or collapsed', ['⌘', '\\']], ['Focus, Split, Grid', ['⌃', '⌘', '1–3']], ['Next pane', ['⌘', '⌥', '←→↑↓']], ['Maximize a pane', ['⌘', '⇧', '↩']], ['Session by row', ['⌘', '⌥', '1–9']], ['Sessions list', ['⌘', '⌥', '0']], ['Own window, dock back', ['⌘', '⇧', 'T']], ['Pause or resume all', ['⌘', '⇧', 'P']]];
198
259
  /** a pane this wide or wider sizes its page; a narrower one scales it (pages under this go phone layout) */
199
260
  const SIZE_MIN = 480;
200
261
 
@@ -206,7 +267,24 @@ let order = [];
206
267
  let layout = CAP[store.get('hub.layout', 'focus')] ? store.get('hub.layout', 'focus') : 'focus';
207
268
  /** placed panes, by key (`id`, or `id#own` for a second view of one session) */
208
269
  let cells = [];
209
- let cur = 0, max = false, hubOn = false, side = store.get('hub.side', '1') === '1';
270
+ let cur = 0, max = false, hubOn = false;
271
+ // --- sidebar modes (§Sidebar collapse) ---
272
+ const RAIL = 52, WMIN = 200, WMAX = 420, WDEF = 248, SNAP = 140, HIDE = 26;
273
+ const clampW = (w) => Math.min(WMAX, Math.max(WMIN, Math.round(w)));
274
+ /** 'full' | 'rail' | 'hidden'; the old '1' and '0' read as full and hidden */
275
+ const modeOf = (v) => (v === '0' ? 'hidden' : v === 'rail' || v === 'hidden' ? v : 'full');
276
+ let mode = modeOf(store.get('hub.side', 'full'));
277
+ /** where ⌘\\ goes from full */
278
+ let collapsedTo = store.get('hub.collapsed', 'rail') === 'hidden' ? 'hidden' : 'rail';
279
+ let sidew = clampW(Number(store.get('hub.sidew', WDEF)) || WDEF);
280
+ let compact = store.get('hub.compact', '0') === '1';
281
+ /** flyout open by hover or focus; pinned open by ⌘\\ in a narrow window */
282
+ let peek = false, pin = false;
283
+ /** a drag on the grip: {x0, w0, m0, id, w, m} */
284
+ let sizing = null;
285
+ const narrowQ = matchMedia('(max-width: 759px)');
286
+ /** what shows: a narrow window shows full as the rail */
287
+ const shownMode = () => (narrowQ.matches && mode === 'full' ? 'rail' : mode);
210
288
  /** key → {el, frame, url, title, at} ; a pane out of the layout stays a while, hidden, for a quick return */
211
289
  const panes = new Map();
212
290
  const KEEP = 4;
@@ -403,8 +481,7 @@ function target(e) {
403
481
 
404
482
  // --- render --------------------------------------------------------------------------
405
483
  function render() {
406
- document.documentElement.classList.toggle('noside', !side);
407
- $('sidebtn').setAttribute('aria-pressed', String(side));
484
+ applySide();
408
485
  for (const b of $('seg').children) b.setAttribute('aria-pressed', String(b.dataset.l === layout));
409
486
  const single = max || (cells.length <= 1 && layout === 'focus');
410
487
  stage.classList.toggle('single', single);
@@ -496,7 +573,17 @@ let fold = {};
496
573
  try { fold = JSON.parse(store.get('hub.fold', '{}')) || {}; } catch {}
497
574
  /** Needs you never folds; Not watched starts folded past 8 rows */
498
575
  const folded = (sec, n) => sec !== 'needs' && (fold[sec] ?? (sec === 'lazy' && n > 8));
499
- function toggleFold(sec, n) { fold[sec] = !folded(sec, n); store.set('hub.fold', JSON.stringify(fold)); renderRows(); }
576
+ /** ⌥-click: every section goes the way this one turns (Finder's outline) */
577
+ function toggleFold(sec, n, all = false) {
578
+ const to = !folded(sec, n);
579
+ if (all) foldAll(to); else { fold[sec] = to; store.set('hub.fold', JSON.stringify(fold)); renderRows(); }
580
+ }
581
+ /** an explicit open per section, so Not watched stays open past 8 rows */
582
+ function foldAll(to) {
583
+ for (const [k] of SECS) if (k !== 'needs') fold[k] = to;
584
+ store.set('hub.fold', JSON.stringify(fold));
585
+ renderRows();
586
+ }
500
587
  /** the first grapheme of the host */
501
588
  const seg = typeof Intl.Segmenter === 'function' ? new Intl.Segmenter() : null;
502
589
  function letterOf(site) {
@@ -535,7 +622,7 @@ function secEl(sec, label) {
535
622
  ? `<div class="sh"><span class="l"></span><span class="n"></span></div>`
536
623
  : `<button type="button" class="sh" aria-expanded="true"><span class="l"></span><span class="n"></span>${icon('caret')}</button>`;
537
624
  el.querySelector('.l').textContent = label;
538
- el.querySelector('button')?.addEventListener('click', () => toggleFold(sec, Number(el.dataset.n)));
625
+ el.querySelector('button')?.addEventListener('click', (e) => toggleFold(sec, Number(el.dataset.n), e.altKey));
539
626
  return el;
540
627
  }
541
628
  function fillRow(el, r, onIds) {
@@ -664,7 +751,7 @@ function focusList() {
664
751
  const all = shown();
665
752
  const el = all.find((x) => x.dataset.id === idOf(cells[cur] || '')) || all[0];
666
753
  if (!el) return;
667
- if (!side) { side = true; store.set('hub.side', '1'); render(); }
754
+ if (shownMode() === 'hidden') setMode('full');
668
755
  window.focus(); el.focus(); el.scrollIntoView({ block: 'nearest' });
669
756
  }
670
757
  /** text changes ease: out 60 ms, in 60 ms; the first fill is instant */
@@ -734,7 +821,7 @@ function move(code) {
734
821
  }
735
822
  function key(k) {
736
823
  const { code, shift, alt, ctrl } = k;
737
- if (!shift && !alt && !ctrl && code === 'Backslash') { side = !side; store.set('hub.side', side ? '1' : '0'); render(); return true; }
824
+ if (!shift && !alt && !ctrl && code === 'Backslash') { toggleSide(); return true; }
738
825
  if (ctrl && !alt && !shift && /^Digit[1-3]$/.test(code)) { setLayout(['focus', 'split', 'grid'][Number(code.slice(5)) - 1]); return true; }
739
826
  if (alt && !ctrl && !shift && /^Arrow/.test(code)) { move(code); return true; }
740
827
  if (alt && !ctrl && !shift && code === 'Digit0') { focusList(); return true; }
@@ -747,7 +834,11 @@ function key(k) {
747
834
  }
748
835
  addEventListener('keydown', (e) => {
749
836
  if (e.metaKey && key({ code: e.code, shift: e.shiftKey, alt: e.altKey, ctrl: e.ctrlKey })) e.preventDefault();
750
- else if (e.key === 'Escape') keys(false);
837
+ else if (e.key === 'Escape') {
838
+ if (sizing) endSize(false);
839
+ else if ($('keys').classList.contains('on')) keys(false);
840
+ else if (peek || pin) { const inside = sidein.contains(document.activeElement); setPeek(false); if (inside) $('sidebtn').focus(); }
841
+ }
751
842
  });
752
843
  // a pane's words: only from a frame that is one of our panes
753
844
  addEventListener('message', (e) => {
@@ -756,7 +847,7 @@ addEventListener('message', (e) => {
756
847
  const hit = [...panes.entries()].find(([, p]) => p.frame.contentWindow === e.source);
757
848
  if (!hit) return;
758
849
  const [k, p] = hit;
759
- if (m.t === 'focus') { const i = cells.indexOf(k); if (i >= 0 && i !== cur) { cur = i; render(); } }
850
+ if (m.t === 'focus') { closeFlyout(); const i = cells.indexOf(k); if (i >= 0 && i !== cur) { cur = i; render(); } }
760
851
  else if (m.t === 'title' && typeof m.text === 'string') { p.title = m.text; p.el.querySelector('.tt').textContent = m.text; const ph = p.el.querySelector('.ph'); ph.title = `${ph.title.split(' · ')[0]} · ${m.text}`; }
761
852
  else if (m.t === 'close') { cells = cells.filter((x) => x !== k); render(); }
762
853
  else if (m.t === 'key') key(m);
@@ -789,8 +880,227 @@ for (const el of [$('top'), $('drag')]) {
789
880
  el.addEventListener('mousedown', (e) => { if (e.target === e.currentTarget && e.button === 0 && e.detail === 1) app({ t: 'drag' }); });
790
881
  el.addEventListener('dblclick', (e) => { if (e.target === e.currentTarget) app({ t: 'zoom' }); });
791
882
  }
883
+ // --- sidebar: modes, flyout, resize, menu (§Sidebar collapse) ------------------------------
884
+ const root = document.documentElement, sidein = $('sidein'), grip = $('grip'), menu = $('menu'), more = $('more');
885
+ let railT = 0, peekT = 0, unpeekT = 0, snapT = 0, booted = false, sizeRaf = 0, railAnim = null, clickHold = 0;
886
+ const reduceQ = matchMedia('(prefers-reduced-motion: reduce)');
887
+ /** rows slide from where they were (FLIP, Y only) */
888
+ function flipRows(change, ms) {
889
+ const els = live(), t0 = new Map(els.map((el) => [el, el.getBoundingClientRect().top]));
890
+ change();
891
+ if (reduceQ.matches) return;
892
+ for (const el of els) {
893
+ const d = t0.get(el) - el.getBoundingClientRect().top;
894
+ if (d) el.animate?.([{ transform: `translateY(${d}px)` }, { transform: 'none' }], { duration: ms, easing: 'cubic-bezier(.16,1,.3,1)' });
895
+ }
896
+ }
897
+ function applySide() {
898
+ const m = sizing ? sizing.m : shownMode(), open = m === 'rail' && (peek || pin);
899
+ for (const k of ['full', 'rail', 'hidden']) root.classList.toggle(`m-${k}`, m === k);
900
+ root.classList.toggle('narrow', narrowQ.matches);
901
+ root.classList.toggle('peek', open);
902
+ root.classList.toggle('compact', compact);
903
+ root.style.setProperty('--sidew', `${sizing ? sizing.w : sidew}px`);
904
+ railRows(m === 'rail' && !open);
905
+ $('sidebtn').setAttribute('aria-pressed', String(m === 'full' || open));
906
+ const now = m === 'full' ? Math.round(sizing ? sizing.w : sidew) : m === 'rail' ? RAIL : 0;
907
+ grip.setAttribute('aria-valuenow', String(now));
908
+ }
909
+ /** rows turn to icons once the panel has clipped to the rail; back to full rows at once, under the opening clip */
910
+ function railRows(on) {
911
+ clearTimeout(railT); railAnim?.cancel(); railAnim = null;
912
+ const is = root.classList.contains('railrows');
913
+ if (on === is) return;
914
+ if (!booted || sizing) { root.classList.toggle('railrows', on); return; }
915
+ // to full rows (flyout, mode): each row slides from its icon cell; clicks wait until they land
916
+ if (!on) { clickHold = performance.now() + 170; flipRows(() => root.classList.remove('railrows'), 150); return; }
917
+ // to icons: once the clip has closed, rows fade out, icons fade in
918
+ const swap = () => {
919
+ if (!root.classList.contains('m-rail') || root.classList.contains('peek')) return;
920
+ root.classList.add('railrows');
921
+ if (!reduceQ.matches) list.animate?.([{ opacity: 0 }, { opacity: 1 }], { duration: 120, easing: 'ease-out' });
922
+ };
923
+ if (reduceQ.matches) { swap(); return; }
924
+ railT = setTimeout(() => {
925
+ railAnim = list.animate?.([{ opacity: 1 }, { opacity: 0 }], { duration: 80, easing: 'ease-in', fill: 'forwards' }) ?? null;
926
+ if (!railAnim) { swap(); return; }
927
+ railAnim.onfinish = () => { swap(); railAnim?.cancel(); railAnim = null; };
928
+ }, 200);
929
+ }
930
+ function setMode(m) {
931
+ if (m !== 'full') { collapsedTo = m; store.set('hub.collapsed', m); }
932
+ mode = m; store.set('hub.side', m);
933
+ peek = false; pin = false;
934
+ render();
935
+ }
936
+ function toggleSide() {
937
+ // a narrow window has no room: ⌘\ pins the flyout over the stage
938
+ if (narrowQ.matches && mode !== 'hidden') { pin = !pin; setPeek(pin); if (pin) focusList(); return; }
939
+ setMode(mode === 'full' ? collapsedTo : 'full');
940
+ }
941
+ function setPeek(on) {
942
+ clearTimeout(peekT);
943
+ if (on && document.activeElement === grip) return;
944
+ if (!on) pin = false;
945
+ if (peek === on) { applySide(); return; }
946
+ // reduced motion: no clip sweep, a short fade
947
+ if (reduceQ.matches) sidein.animate?.([{ opacity: 0 }, { opacity: 1 }], { duration: 120, easing: 'ease-out' });
948
+ peek = on;
949
+ clearTimeout(unpeekT);
950
+ root.classList.toggle('unpeek', !on);
951
+ if (!on) unpeekT = setTimeout(() => root.classList.remove('unpeek'), 150);
952
+ applySide();
953
+ }
954
+ const menuOpen = () => menu.matches(':popover-open');
955
+ function closeFlyout() { if ((peek || pin) && !menuOpen()) setPeek(false); }
956
+ // hover: 300 ms in opens, 250 ms out closes; the menu holds it open
957
+ sidein.addEventListener('pointerenter', () => {
958
+ if (shownMode() !== 'rail' || sizing || peek) { clearTimeout(peekT); return; }
959
+ peekT = setTimeout(() => setPeek(true), 300);
960
+ });
961
+ sidein.addEventListener('pointerleave', () => {
962
+ clearTimeout(peekT);
963
+ if (peek && !pin) peekT = setTimeout(() => { if (!menuOpen()) setPeek(false); }, 250);
964
+ });
965
+ sidein.addEventListener('focusin', () => { if (shownMode() === 'rail' && !peek) setPeek(true); });
966
+ sidein.addEventListener('focusout', (e) => {
967
+ if (sidein.contains(e.relatedTarget) || menu.contains(e.relatedTarget) || menuOpen()) return;
968
+ if (pin && e.relatedTarget === null) return;
969
+ closeFlyout();
970
+ });
971
+ // a row picked from the flyout: its pane comes up, the flyout goes
972
+ list.addEventListener('click', (e) => { if (performance.now() < clickHold) { e.stopPropagation(); e.preventDefault(); } }, true);
973
+ list.addEventListener('click', (e) => { if (e.target.closest('.row') && !e.target.closest('button')) closeFlyout(); });
974
+ narrowQ.addEventListener('change', () => { peek = false; pin = false; render(); });
975
+
976
+ // the grip: a drag follows the pointer 1:1 (GS-2); past a limit it resists (GS-13)
977
+ const rubber = (x, dim = 100, c = 0.55) => (x * dim * c) / (dim + c * Math.abs(x));
978
+ grip.addEventListener('pointerdown', (e) => {
979
+ if (e.button !== 0 || sizing) return;
980
+ const m0 = shownMode();
981
+ sizing = { x0: e.clientX, w0: m0 === 'rail' ? RAIL : sidew, m0, id: e.pointerId, w: sidew, m: m0 };
982
+ grip.setPointerCapture(e.pointerId);
983
+ clearTimeout(peekT); peek = false; pin = false;
984
+ root.classList.add('sizing');
985
+ e.preventDefault();
986
+ });
987
+ grip.addEventListener('pointermove', (e) => {
988
+ if (!sizing || e.pointerId !== sizing.id) return;
989
+ const raw = sizing.w0 + e.clientX - sizing.x0, m0 = sizing.m;
990
+ if (raw < HIDE) sizing.m = 'hidden';
991
+ else if (raw < SNAP) sizing.m = 'rail';
992
+ else {
993
+ sizing.m = 'full';
994
+ sizing.w = raw > WMAX ? WMAX + rubber(raw - WMAX) : raw < WMIN ? WMIN - rubber(WMIN - raw) : raw;
995
+ }
996
+ if (sizing.m !== m0) { root.classList.add('snap'); clearTimeout(snapT); snapT = setTimeout(() => root.classList.remove('snap'), 140); }
997
+ if (!sizeRaf) sizeRaf = requestAnimationFrame(() => { sizeRaf = 0; if (sizing) applySide(); });
998
+ });
999
+ function endSize(keep) {
1000
+ if (!sizing) return;
1001
+ const s = sizing;
1002
+ sizing = null;
1003
+ cancelAnimationFrame(sizeRaf); sizeRaf = 0;
1004
+ if (grip.hasPointerCapture?.(s.id)) grip.releasePointerCapture(s.id);
1005
+ root.classList.remove('sizing', 'snap'); clearTimeout(snapT);
1006
+ if (!keep) { render(); return; }
1007
+ // a width past a limit settles back to it (200 ms)
1008
+ if (s.m === 'full') { sidew = clampW(s.w); store.set('hub.sidew', String(sidew)); }
1009
+ setMode(s.m);
1010
+ }
1011
+ grip.addEventListener('pointerup', (e) => { if (sizing && e.pointerId === sizing.id) endSize(true); });
1012
+ grip.addEventListener('pointercancel', () => endSize(false));
1013
+ grip.addEventListener('lostpointercapture', () => endSize(false));
1014
+ addEventListener('blur', () => endSize(false));
1015
+ grip.addEventListener('dblclick', () => { sidew = WDEF; store.set('hub.sidew', String(sidew)); setMode('full'); });
1016
+ grip.addEventListener('keydown', (e) => {
1017
+ const m = shownMode(), step = e.shiftKey ? 64 : 16;
1018
+ if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
1019
+ const d = e.key === 'ArrowRight' ? step : -step;
1020
+ if (m === 'rail') { if (d > 0) setMode('full'); else setMode('hidden'); }
1021
+ else if (m === 'full') {
1022
+ if (sidew + d < WMIN) setMode('rail');
1023
+ else { sidew = clampW(sidew + d); store.set('hub.sidew', String(sidew)); render(); }
1024
+ }
1025
+ } else if (e.key === 'Home') setMode('rail');
1026
+ else if (e.key === 'End') { sidew = WMAX; store.set('hub.sidew', String(sidew)); setMode('full'); }
1027
+ else if (e.key === 'Enter') setMode(m === 'full' ? 'rail' : 'full');
1028
+ else return;
1029
+ e.preventDefault();
1030
+ requestAnimationFrame(() => { if (shownMode() !== 'hidden') grip.focus(); });
1031
+ });
1032
+
1033
+ // the menu: built on open, so it always says what each item does now
1034
+ const CHECK = '<svg class="ic ck" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7"/></svg>';
1035
+ const kbds = (ks) => `<span class="ks">${ks.map((k) => `<kbd>${k}</kbd>`).join('')}</span>`;
1036
+ function menuItems() {
1037
+ const m = shownMode(), secs = SECS.filter(([k]) => k !== 'needs' && [...rows.values()].some((r) => secOf(r) === k));
1038
+ const n = (k) => [...rows.values()].filter((r) => secOf(r) === k).length;
1039
+ const allFolded = secs.length > 0 && secs.every(([k]) => folded(k, n(k))), anyFolded = secs.some(([k]) => folded(k, n(k)));
1040
+ const narrow = narrowQ.matches;
1041
+ const out = [
1042
+ { a: 'collapse', l: 'Collapse all', off: !secs.length || allFolded },
1043
+ { a: 'expand', l: 'Expand all', off: !anyFolded },
1044
+ { a: 'compact', l: 'Compact rows', check: compact },
1045
+ null,
1046
+ ];
1047
+ if (m === 'full') out.push({ a: 'rail', l: 'Icon rail', k: collapsedTo === 'rail' }, { a: 'hidden', l: 'Hide sidebar', k: collapsedTo === 'hidden' });
1048
+ else out.push({ a: 'full', l: narrow ? 'Show sessions' : 'Full sidebar', k: true }, m === 'rail' ? { a: 'hidden', l: 'Hide sidebar' } : null);
1049
+ if (sidew !== WDEF && !narrow) out.push({ a: 'reset', l: 'Reset width' });
1050
+ return out.filter((x, i, a) => x || (i > 0 && a[i - 1]));
1051
+ }
1052
+ function fillMenu() {
1053
+ menu.innerHTML = menuItems().map((x) => !x ? '<hr>'
1054
+ : `<button type="button" role="${'check' in x ? 'menuitemcheckbox' : 'menuitem'}" data-a="${x.a}"${'check' in x ? ` aria-checked="${x.check}"` : ''}${x.off ? ' disabled' : ''}>${'check' in x ? CHECK : '<span class="ck"></span>'}${esc(x.l)}${x.k ? kbds(['⌘', '\\']) : ''}</button>`).join('');
1055
+ }
1056
+ // placed before the first paint: anchored by its bottom edge, so no measure is needed
1057
+ menu.addEventListener('beforetoggle', (e) => {
1058
+ if (e.newState !== 'open') return;
1059
+ fillMenu();
1060
+ const r = more.getBoundingClientRect(), byRight = r.right > 216; // room for the 200 px menu to its left
1061
+ Object.assign(menu.style, { top: 'auto', bottom: `${innerHeight - r.top + 6}px`, left: byRight ? 'auto' : `${Math.max(8, r.left)}px`, right: byRight ? `${Math.max(8, innerWidth - r.right)}px` : 'auto' });
1062
+ menu.style.setProperty('--org', `${byRight ? 'right' : 'left'} bottom`);
1063
+ });
1064
+ menu.addEventListener('toggle', (e) => {
1065
+ const open = e.newState === 'open';
1066
+ more.setAttribute('aria-expanded', String(open));
1067
+ if (open) { menu.querySelector('button:not(:disabled)')?.focus(); return; }
1068
+ if (peek && !pin) {
1069
+ clearTimeout(peekT);
1070
+ peekT = setTimeout(() => { if (!sidein.matches(':hover') && !sidein.contains(document.activeElement) && !menuOpen()) setPeek(false); }, 250);
1071
+ }
1072
+ });
1073
+ menu.addEventListener('keydown', (e) => {
1074
+ const all = [...menu.querySelectorAll('button:not(:disabled)')], at = all.indexOf(document.activeElement);
1075
+ const to = e.key === 'ArrowDown' ? all[(at + 1) % all.length] : e.key === 'ArrowUp' ? all[(at - 1 + all.length) % all.length]
1076
+ : e.key === 'Home' ? all[0] : e.key === 'End' ? all[all.length - 1] : null;
1077
+ if (to) { e.preventDefault(); to.focus(); }
1078
+ });
1079
+ menu.addEventListener('click', (e) => {
1080
+ const a = e.target.closest('button')?.dataset.a;
1081
+ if (!a) return;
1082
+ menu.hidePopover();
1083
+ if (a === 'collapse' || a === 'expand') foldAll(a === 'collapse');
1084
+ else if (a === 'compact') setCompact(!compact);
1085
+ else if (a === 'reset') { sidew = WDEF; store.set('hub.sidew', String(sidew)); setMode('full'); }
1086
+ else if (a === 'full' && narrowQ.matches) { pin = true; setPeek(true); }
1087
+ else setMode(a);
1088
+ if (e.detail === 0 && more.offsetParent && shownMode() !== 'hidden') more.focus(); else more.blur();
1089
+ });
1090
+ /** compact rows: lines fade (100 ms), then rows slide to their new places (FLIP 200 ms) */
1091
+ function setCompact(on) {
1092
+ compact = on; store.set('hub.compact', on ? '1' : '0');
1093
+ if (on) {
1094
+ root.classList.add('compacting');
1095
+ setTimeout(() => { flipRows(() => root.classList.toggle('compact', compact), 200); root.classList.remove('compacting'); }, 100);
1096
+ } else {
1097
+ flipRows(() => { root.classList.add('compacting'); root.classList.remove('compact'); }, 200);
1098
+ requestAnimationFrame(() => requestAnimationFrame(() => root.classList.remove('compacting')));
1099
+ }
1100
+ }
792
1101
  new ResizeObserver(() => render()).observe(stage);
793
1102
  render();
1103
+ booted = true;
794
1104
  app({ t: 'ready' });
795
1105
  </script>
796
1106
  </body>
@@ -66,8 +66,12 @@ button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:defa
66
66
  #ro .ic{width:14px;height:14px}
67
67
  /* a hub tile: the page scales to fit; the bar shrinks to the address */
68
68
  .embed #strip{padding-left:8px}
69
- /* a pane among others: the hub's pane header is its one bar */
69
+ /* a pane among others: the hub's pane header is its one bar; a second tab (a sign-in popup) brings a compact strip */
70
70
  .bare #strip,.bare #nav{display:none}
71
+ .bare.many #strip{display:flex;height:31px;padding:0 6px;align-items:flex-end}
72
+ .bare.many #tabs{height:29px}
73
+ .bare.many .tab{height:27px;flex-basis:170px;min-width:96px;padding-left:10px}
74
+ .bare #newtab{display:none}
71
75
  .embed #keys{display:none}
72
76
  @keyframes breathe{50%{opacity:.35}}
73
77
  @keyframes spin{to{transform:rotate(360deg)}}
@@ -360,6 +364,8 @@ let typeIn = null;
360
364
  function newTab() { typeIn = new Set(tabs.map((t) => t.id)); tx({ t: 'new' }); }
361
365
  function drawTabs(list, overlay) {
362
366
  tabs = list;
367
+ // instant, no slide: a moving strip would resize the page each frame
368
+ document.documentElement.classList.toggle('many', list.length > 1);
363
369
  const box = $('tabs');
364
370
  const had = new Map([...box.children].map((n) => [Number(n.dataset.id), n]));
365
371
  const keep = new Set();
@@ -1,6 +1,6 @@
1
1
  /** `autobrowse login <site>` and `autobrowse record <name>`: the recorder's command line. */
2
2
  import { spawn } from "node:child_process";
3
- import { existsSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
+ import { existsSync, mkdirSync, openSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
4
4
  import { dirname, join } from "node:path";
5
5
  import { Option } from "commander";
6
6
  import { runJson } from "../agent/run-json.js";
@@ -163,7 +163,15 @@ export function registerRecordCommands(program, settings, local) {
163
163
  if (held)
164
164
  throw new Error(`port ${port}: explore ${held.site} (pid ${held.pid}) is alive and does not answer. End it: autobrowse stop ${port}`);
165
165
  rmSync(tokenFile, { force: true });
166
- const log = join(dirname(tokenFile), `explore-${port}.log`);
166
+ // beside the session's journal and network log, one per session: a later session on the port never overwrites it
167
+ const logDir = join(expandHome(settings.recordingsDir), `.explore-${site}`);
168
+ mkdirSync(logDir, { recursive: true });
169
+ const olds = readdirSync(logDir)
170
+ .filter((f) => /^server-.+\.log$/.test(f))
171
+ .sort();
172
+ for (const f of olds.slice(0, Math.max(0, olds.length - 9)))
173
+ rmSync(join(logDir, f), { force: true });
174
+ const log = join(logDir, `server-${new Date().toISOString().replace(/[:.]/g, "-")}.log`);
167
175
  const argv = given ?? process.argv.slice(2).filter((a) => a !== "--background");
168
176
  // the child takes the picked port by name; this pid's claim covers it until it listens
169
177
  if (picked)
@@ -196,6 +204,16 @@ export function registerRecordCommands(program, settings, local) {
196
204
  stdio: ["ignore", fd, fd],
197
205
  }).unref();
198
206
  };
207
+ program
208
+ .command("hub")
209
+ .description("Open the live hub (Autobrowse Live, also in Spotlight and the Dock): every session on this Mac, headless runs as rows you open to watch. It stays while its window is open")
210
+ .option("--restart", "replace a hub from an older build (explore rows come back at their next ask)")
211
+ .action(async (o) => {
212
+ const { openHub } = await import("../browser/live-hub.js");
213
+ const r = await openHub({ restart: o.restart === true });
214
+ if (r.stale)
215
+ console.log("the hub up is from an older build: `autobrowse hub --restart` replaces it");
216
+ });
199
217
  program
200
218
  .command("bring-back <port>")
201
219
  .description("An explore session the person moved to Chrome (⌘⇧O) comes back to the live view on its port: Chrome quits and saves its tabs, the session reopens them with its journal and sign-ins (the hub's Bring back runs this)")