@venizia/vulcan 0.4.9 → 0.4.10-1

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.
@@ -337,6 +337,61 @@
337
337
  width: 32px;
338
338
  padding: 0;
339
339
  }
340
+ .btn[aria-pressed='true'] {
341
+ background: var(--soft);
342
+ border-color: var(--ink);
343
+ }
344
+ .untitled {
345
+ color: var(--muted);
346
+ font-size: 12px;
347
+ font-weight: 400;
348
+ margin-left: 8px;
349
+ }
350
+ .dh .why {
351
+ margin: 4px 0 0;
352
+ color: var(--muted);
353
+ font-size: 13px;
354
+ line-height: 1.4;
355
+ }
356
+ .dh .ctx p,
357
+ .dh .nx {
358
+ margin: 4px 0 0;
359
+ color: var(--ink);
360
+ font-size: 13px;
361
+ line-height: 1.5;
362
+ }
363
+ .dh .nx b,
364
+ .dh .lat .lb,
365
+ .dh .ctx .lb {
366
+ color: var(--muted);
367
+ font-size: 12px;
368
+ font-weight: 600;
369
+ }
370
+ .dh .lat ul {
371
+ list-style: none;
372
+ margin: 4px 0 0;
373
+ padding: 0;
374
+ display: grid;
375
+ gap: 4px;
376
+ }
377
+ .dh .lat li {
378
+ display: grid;
379
+ grid-template-columns: 44px minmax(0, 1fr);
380
+ gap: 8px;
381
+ font-size: 13px;
382
+ line-height: 1.4;
383
+ color: var(--ink);
384
+ }
385
+ .dh .lat .tm {
386
+ color: var(--muted);
387
+ font-variant-numeric: tabular-nums;
388
+ }
389
+ .nowork {
390
+ margin: 0;
391
+ padding: 14px 16px;
392
+ color: var(--muted);
393
+ font-size: 13px;
394
+ }
340
395
 
341
396
  .seg {
342
397
  display: inline-flex;
@@ -2361,7 +2416,7 @@
2361
2416
  <header class="bar">
2362
2417
  <span class="mark" id="mark"></span><span class="brule" aria-hidden="true"></span>
2363
2418
  <h1 id="boardTitle"></h1>
2364
- <div class="tabs" role="tablist" aria-label="Màn hình" data-i18n-aria-label="Màn hình">
2419
+ <div class="tabs" role="tablist" aria-label="Screens" data-i18n-aria-label="Màn hình">
2365
2420
  <button
2366
2421
  class="tab"
2367
2422
  role="tab"
@@ -2370,7 +2425,7 @@
2370
2425
  aria-controls="vFlows"
2371
2426
  type="button"
2372
2427
  >
2373
- <span data-i18n="Luồng">Luồng</span>
2428
+ <span data-i18n="Luồng">Flows</span>
2374
2429
  </button>
2375
2430
  <button
2376
2431
  class="tab"
@@ -2385,25 +2440,28 @@
2385
2440
  </div>
2386
2441
  <span class="spacer"></span>
2387
2442
  <span class="since" id="since"
2388
- ><span id="sinceTxt"><span data-i18n="Đang tải">Đang tải</span></span></span
2443
+ ><span id="sinceTxt"><span data-i18n="Đang tải">Loading</span></span></span
2389
2444
  >
2390
2445
  <button class="btn" type="button" id="bSeen">
2391
- <span data-i18n="Đánh dấu đã xem">Đánh dấu đã xem</span>
2446
+ <span data-i18n="Đánh dấu đã xem">Mark as seen</span>
2392
2447
  </button>
2393
2448
  <span class="fresh" id="fresh"></span>
2449
+ <button class="btn" type="button" id="bPlumb" aria-pressed="false">
2450
+ <span data-i18n="pl.all">Show all events</span>
2451
+ </button>
2394
2452
  <button class="btn lang" type="button" id="bLang"></button>
2395
2453
  <button
2396
2454
  class="btn sq theme"
2397
2455
  type="button"
2398
2456
  id="bTheme"
2399
- aria-label="Giao diện: sáng"
2457
+ aria-label="Theme: light"
2400
2458
  data-i18n-aria-label="Giao diện: sáng"
2401
2459
  ></button>
2402
2460
  <button
2403
2461
  class="btn sq"
2404
2462
  type="button"
2405
2463
  id="bKeys"
2406
- aria-label="Phím tắt"
2464
+ aria-label="Shortcuts"
2407
2465
  data-i18n-aria-label="Phím tắt"
2408
2466
  aria-expanded="false"
2409
2467
  >
@@ -2412,27 +2470,23 @@
2412
2470
  </header>
2413
2471
 
2414
2472
  <main class="view on" id="vFlows" role="tabpanel" aria-labelledby="tFlows">
2415
- <section
2416
- class="pane list"
2417
- aria-label="Danh sách luồng"
2418
- data-i18n-aria-label="Danh sách luồng"
2419
- >
2473
+ <section class="pane list" aria-label="Flow list" data-i18n-aria-label="Danh sách luồng">
2420
2474
  <div class="ph">
2421
- <h2><span data-i18n="Luồng việc">Luồng việc</span></h2>
2475
+ <h2><span data-i18n="Luồng việc">Flows</span></h2>
2422
2476
  <span class="n" id="flowN"></span><span class="spacer"></span>
2423
2477
  <div
2424
2478
  class="seg"
2425
2479
  role="radiogroup"
2426
2480
  id="vmode"
2427
2481
  data-i18n-aria-label="vm.label"
2428
- aria-label="vm.label"
2482
+ aria-label="View"
2429
2483
  >
2430
2484
  <button type="button" role="radio" data-mode="list">
2431
- <span data-i18n="vm.list">vm.list</span></button
2485
+ <span data-i18n="vm.list">List</span></button
2432
2486
  ><button type="button" role="radio" data-mode="diagram">
2433
- <span data-i18n="vm.diagram">vm.diagram</span></button
2487
+ <span data-i18n="vm.diagram">Flow diagram</span></button
2434
2488
  ><button type="button" role="radio" data-mode="board">
2435
- <span data-i18n="vm.board">vm.board</span>
2489
+ <span data-i18n="vm.board">Board</span>
2436
2490
  </button>
2437
2491
  </div>
2438
2492
  </div>
@@ -2440,8 +2494,7 @@
2440
2494
  <p class="empty">
2441
2495
  <span
2442
2496
  data-i18n="Đang tải luồng việc. Luồng nào có sự kiện sẽ hiện ở đây, việc cần anh lên trước."
2443
- >Đang tải luồng việc. Luồng nào có sự kiện sẽ hiện ở đây, việc cần anh lên
2444
- trước.</span
2497
+ >Loading flows. Flows with events show here, the ones that need you first.</span
2445
2498
  >
2446
2499
  </p>
2447
2500
  </div>
@@ -2453,31 +2506,31 @@
2453
2506
  aria-orientation="vertical"
2454
2507
  tabindex="0"
2455
2508
  data-i18n-aria-label="split"
2456
- aria-label="split"
2509
+ aria-label="Resize the flow list and the detail"
2457
2510
  aria-valuemin="25"
2458
2511
  aria-valuemax="75"
2459
2512
  ></div>
2460
2513
  <section
2461
2514
  class="pane detail"
2462
2515
  id="detail"
2463
- aria-label="Chi tiết luồng"
2516
+ aria-label="Flow detail"
2464
2517
  data-i18n-aria-label="Chi tiết luồng"
2465
2518
  data-comment-target
2466
2519
  >
2467
2520
  <div class="pb">
2468
2521
  <div id="dEmpty">
2469
2522
  <div class="dh">
2470
- <h3><span data-i18n="Hôm nay">Hôm nay</span></h3>
2471
- <p class="meta" id="sumLine"><span data-i18n="Đang tải">Đang tải</span></p>
2523
+ <h3><span data-i18n="Hôm nay">Today</span></h3>
2524
+ <p class="meta" id="sumLine"><span data-i18n="Đang tải">Loading</span></p>
2472
2525
  <p class="meta">
2473
2526
  <span
2474
2527
  data-i18n="Chọn một luồng ở bên trái để xem từng bước, từng vòng review và tin nhắn. Phím j, k để chuyển, Enter để mở."
2475
- >Chọn một luồng ở bên trái để xem từng bước, từng vòng review và tin nhắn. Phím
2476
- j, k để chuyển, Enter để mở.</span
2528
+ >Pick a flow on the left to see each stage, each review round and the messages.
2529
+ j and k move, Enter opens.</span
2477
2530
  >
2478
2531
  </p>
2479
2532
  </div>
2480
- <h4 class="dlabel"><span data-i18n="Sự kiện mới nhất">Sự kiện mới nhất</span></h4>
2533
+ <h4 class="dlabel"><span data-i18n="Sự kiện mới nhất">Latest events</span></h4>
2481
2534
  <ul class="evs" id="recent" style="padding: 8px 16px 16px"></ul>
2482
2535
  </div>
2483
2536
  <div id="dBody" hidden></div>
@@ -2488,7 +2541,7 @@
2488
2541
  <main class="view" id="vAgents" role="tabpanel" aria-labelledby="tAgents">
2489
2542
  <section class="pane graphp" aria-label="Agent graph">
2490
2543
  <div class="ph">
2491
- <h2><span data-i18n="gr.title">gr.title</span></h2>
2544
+ <h2><span data-i18n="gr.title">Agent graph</span></h2>
2492
2545
  <span class="n" id="agN"></span><span class="spacer"></span
2493
2546
  ><span class="glegend" id="gLegend"></span>
2494
2547
  </div>
@@ -2498,21 +2551,25 @@
2498
2551
  </section>
2499
2552
  <section class="pane gside" aria-label="Pair">
2500
2553
  <div class="ph">
2501
- <h2 id="gSideT"><span data-i18n="gr.pick">gr.pick</span></h2>
2554
+ <h2 id="gSideT"><span data-i18n="gr.pick">Pick a link</span></h2>
2555
+ </div>
2556
+ <div class="pb" id="gSide">
2557
+ <p class="empty" data-i18n="gr.hint">
2558
+ Click a line between two agents to see what passed between them and the flows it
2559
+ touched. Click an agent for its details.
2560
+ </p>
2502
2561
  </div>
2503
- <div class="pb" id="gSide"><p class="empty" data-i18n="gr.hint">gr.hint</p></div>
2504
2562
  </section>
2505
2563
  </main>
2506
2564
 
2507
2565
  <footer
2508
2566
  class="dock"
2509
2567
  id="dock"
2510
- aria-label="Các agent đang chạy"
2568
+ aria-label="Running agents"
2511
2569
  data-i18n-aria-label="Các agent đang chạy"
2512
2570
  >
2513
2571
  <div class="dock-lbl">
2514
- <b id="dockN">Agent</b
2515
- ><span id="dockSum"><span data-i18n="đang tải">đang tải</span></span>
2572
+ <b id="dockN">Agent</b><span id="dockSum"><span data-i18n="đang tải">loading</span></span>
2516
2573
  </div>
2517
2574
  </footer>
2518
2575
  </div>
@@ -2531,21 +2588,21 @@
2531
2588
  id="keys"
2532
2589
  hidden
2533
2590
  role="dialog"
2534
- aria-label="Phím tắt"
2591
+ aria-label="Shortcuts"
2535
2592
  data-i18n-aria-label="Phím tắt"
2536
2593
  >
2537
- <h2><span data-i18n="Phím tắt">Phím tắt</span></h2>
2594
+ <h2><span data-i18n="Phím tắt">Shortcuts</span></h2>
2538
2595
  <dl>
2539
2596
  <dt>j / k</dt>
2540
- <dd><span data-i18n="Luồng sau / trước">Luồng sau / trước</span></dd>
2597
+ <dd><span data-i18n="Luồng sau / trước">Next / previous flow</span></dd>
2541
2598
  <dt>Enter</dt>
2542
- <dd><span data-i18n="Mở chi tiết">Mở chi tiết</span></dd>
2599
+ <dd><span data-i18n="Mở chi tiết">Open detail</span></dd>
2543
2600
  <dt>e</dt>
2544
- <dd><span data-i18n="Các bước hoặc mọi sự kiện">Các bước hoặc mọi sự kiện</span></dd>
2601
+ <dd><span data-i18n="Các bước hoặc mọi sự kiện">Stages or all events</span></dd>
2545
2602
  <dt>Esc</dt>
2546
- <dd><span data-i18n="Đóng">Đóng</span></dd>
2603
+ <dd><span data-i18n="Đóng">Close</span></dd>
2547
2604
  <dt>?</dt>
2548
- <dd><span data-i18n="Bảng này">Bảng này</span></dd>
2605
+ <dd><span data-i18n="Bảng này">This panel</span></dd>
2549
2606
  </dl>
2550
2607
  </div>
2551
2608
 
@@ -2720,6 +2777,70 @@
2720
2777
  DICT.vi['gr.events'] = 'sự kiện';
2721
2778
  DICT.en['gr.flows'] = 'Flows';
2722
2779
  DICT.vi['gr.flows'] = 'Luồng';
2780
+ DICT.en['pl.all'] = 'Show all events';
2781
+ DICT.vi['pl.all'] = 'Hiện mọi sự kiện';
2782
+ DICT.en['pl.tip'] =
2783
+ 'Sessions starting and stopping, subagents and prompts that only wait are hidden; this shows them';
2784
+ DICT.vi['pl.tip'] =
2785
+ 'Phiên bắt đầu và kết thúc, subagent và lời nhắc chỉ để chờ đang được ẩn; nút này hiện chúng';
2786
+ DICT.en['fl.untitled'] = 'no title yet';
2787
+ DICT.vi['fl.untitled'] = 'chưa có tên';
2788
+ DICT.en['ctx.label'] = 'Context';
2789
+ DICT.vi['ctx.label'] = 'Bối cảnh';
2790
+ DICT.en['nx.label'] = 'Next';
2791
+ DICT.vi['nx.label'] = 'Tiếp theo';
2792
+ DICT.en['lt.label'] = 'Latest';
2793
+ DICT.vi['lt.label'] = 'Mới nhất';
2794
+ DICT.en['nw.chip'] = 'No work yet';
2795
+ DICT.vi['nw.chip'] = 'Chưa có việc';
2796
+ DICT.en['nw.empty'] = 'No work logged yet';
2797
+ DICT.vi['nw.empty'] = 'Chưa có việc nào được ghi';
2798
+ DICT.en['lt.msg'] = 'sent a message';
2799
+ DICT.vi['lt.msg'] = 'gửi tin nhắn';
2800
+ DICT.en['lt.msgTo'] = 'wrote to';
2801
+ DICT.vi['lt.msgTo'] = 'nhắn cho';
2802
+ DICT.en['lt.got'] = 'got a message';
2803
+ DICT.vi['lt.got'] = 'nhận tin nhắn';
2804
+ DICT.en['lt.gotFrom'] = 'got a message from';
2805
+ DICT.vi['lt.gotFrom'] = 'nhận tin nhắn từ';
2806
+ DICT.en['lt.commit'] = 'committed';
2807
+ DICT.vi['lt.commit'] = 'commit';
2808
+ DICT.en['lt.pr'] = 'updated a pull request';
2809
+ DICT.vi['lt.pr'] = 'cập nhật pull request';
2810
+ DICT.en['lt.ci'] = 'ran a check';
2811
+ DICT.vi['lt.ci'] = 'chạy kiểm tra';
2812
+ DICT.en['lt.review'] = 'reviewed';
2813
+ DICT.vi['lt.review'] = 'review';
2814
+ DICT.en['lt.fix'] = 'fixed';
2815
+ DICT.vi['lt.fix'] = 'sửa';
2816
+ DICT.en['lt.merge'] = 'merged';
2817
+ DICT.vi['lt.merge'] = 'merge';
2818
+ DICT.en['lt.release'] = 'released';
2819
+ DICT.vi['lt.release'] = 'phát hành';
2820
+ DICT.en['lt.handoff'] = 'handed over';
2821
+ DICT.vi['lt.handoff'] = 'bàn giao';
2822
+ DICT.en['lt.assign'] = 'assigned work';
2823
+ DICT.vi['lt.assign'] = 'giao việc';
2824
+ DICT.en['lt.request'] = 'requested';
2825
+ DICT.vi['lt.request'] = 'đề xuất';
2826
+ DICT.en['lt.design'] = 'designed';
2827
+ DICT.vi['lt.design'] = 'thiết kế';
2828
+ DICT.en['lt.note'] = 'noted';
2829
+ DICT.vi['lt.note'] = 'ghi chú';
2830
+ DICT.en['lt.ask'] = 'asked the owner';
2831
+ DICT.vi['lt.ask'] = 'hỏi chủ';
2832
+ DICT.en['lt.approve'] = 'approved';
2833
+ DICT.vi['lt.approve'] = 'duyệt';
2834
+ DICT.en['lt.park'] = 'parked';
2835
+ DICT.vi['lt.park'] = 'để sau';
2836
+ DICT.en['lt.reject'] = 'rejected';
2837
+ DICT.vi['lt.reject'] = 'từ chối';
2838
+ DICT.en['lt.decision'] = 'decided';
2839
+ DICT.vi['lt.decision'] = 'quyết định';
2840
+ DICT.en['k.flow'] = 'flow title';
2841
+ DICT.vi['k.flow'] = 'tên luồng';
2842
+ DICT.en['k.agent'] = 'agent activity';
2843
+ DICT.vi['k.agent'] = 'hoạt động agent';
2723
2844
  DICT.en['vm.label'] = 'View';
2724
2845
  DICT.vi['vm.label'] = 'Cách xem';
2725
2846
  DICT.en['vm.list'] = 'List';
@@ -2801,6 +2922,8 @@
2801
2922
  release: 'phát hành',
2802
2923
  handoff: 'bàn giao',
2803
2924
  msg: 'tin nhắn',
2925
+ flow: 'k.flow',
2926
+ agent: 'k.agent',
2804
2927
  };
2805
2928
  const LS = LS_PREFIX + 'lastSeen';
2806
2929
  const $ = (id) => document.getElementById(id);
@@ -2822,6 +2945,10 @@
2822
2945
  localStorage.setItem(k, v);
2823
2946
  } catch {}
2824
2947
  };
2948
+ // Agent plumbing (sessions, subagents, the harness waiting) is hidden until the owner asks for all events.
2949
+ const PLUMB_LS = LS_PREFIX + 'plumbing';
2950
+ let showPlumbing = lsGet(PLUMB_LS) === '1';
2951
+ const keepEv = (e) => showPlumbing || !e.plumbing;
2825
2952
  const hhmm = (iso) => {
2826
2953
  const d = new Date(iso);
2827
2954
  return isNaN(d)
@@ -2868,6 +2995,8 @@
2868
2995
  merge: 6,
2869
2996
  release: 7,
2870
2997
  handoff: 8,
2998
+ flow: 0,
2999
+ agent: 0,
2871
3000
  };
2872
3001
  const normEv = (e) =>
2873
3002
  typeof e.stage === 'number'
@@ -2921,7 +3050,8 @@
2921
3050
  function fold() {
2922
3051
  const out = [];
2923
3052
  for (const f of DATA.flows) {
2924
- const evs = f.events.map(normEv).sort(byTs);
3053
+ const evs = f.events.filter(keepEv).map(normEv).sort(byTs);
3054
+ if (!evs.length) continue;
2925
3055
  const last = evs.find((e) => e.id === f.lastId) || evs[evs.length - 1];
2926
3056
  const lastAsk = f.askId ? evs.find((e) => e.id === f.askId) : undefined;
2927
3057
  const att = {};
@@ -2932,7 +3062,16 @@
2932
3062
  const fresh = evs.filter((e) => e.ts > lastSeen);
2933
3063
  out.push({
2934
3064
  id: f.id,
2935
- f: { title: f.title, repo: f.repo },
3065
+ // Only `flow` lines and plumbing: the flow has no work, and no stage to show.
3066
+ noWork: !evs.some((e) => !e.plumbing && e.kind !== 'flow'),
3067
+ f: {
3068
+ title: f.title,
3069
+ repo: f.repo,
3070
+ why: f.why,
3071
+ context: f.context,
3072
+ next: f.next,
3073
+ named: f.named === true || f.id === 'Unsorted',
3074
+ },
2936
3075
  evs,
2937
3076
  last,
2938
3077
  state: f.state,
@@ -2952,6 +3091,10 @@
2952
3091
 
2953
3092
  function stripOf(fl) {
2954
3093
  const s = el('div', 'strip');
3094
+ if (fl.noWork) {
3095
+ s.append(el('span', 'sg', t('nw.chip')));
3096
+ return s;
3097
+ }
2955
3098
  for (const k of fl.stages) {
2956
3099
  const cur = k === fl.cur;
2957
3100
  const g = el(
@@ -3069,14 +3212,14 @@
3069
3212
  const tt = el('div', 'tt');
3070
3213
  tt.append(el('div', 't', fl.f.title));
3071
3214
  const sub = el('div', 'sub');
3072
- sub.append(
3073
- el('span', 'repo', fl.f.repo),
3074
- el(
3075
- 'span',
3076
- 'last',
3077
- fl.state === 'you' && fl.lastAsk ? fl.lastAsk.summary : fl.last.summary,
3078
- ),
3079
- );
3215
+ if (!fl.f.named) sub.append(el('span', 'untitled', t('fl.untitled')));
3216
+ // A flow with no work has nothing to say of its last line (it is its title): the next step, else the reason.
3217
+ const said = fl.noWork
3218
+ ? fl.f.next || fl.f.why || ''
3219
+ : fl.state === 'you' && fl.lastAsk
3220
+ ? fl.lastAsk.summary
3221
+ : fl.last.summary;
3222
+ sub.append(el('span', 'repo', fl.f.repo), el('span', 'last', said));
3080
3223
  tt.append(sub);
3081
3224
  r.append(tt, stripOf(fl), el('span', 'holder', fl.holder));
3082
3225
  const ag = el(
@@ -3156,7 +3299,11 @@
3156
3299
  t(' xong hôm nay');
3157
3300
  const rec = $('recent');
3158
3301
  rec.replaceChildren();
3159
- for (const e of events.slice().sort(byTs).reverse().slice(0, 14)) {
3302
+ for (const e of events
3303
+ .filter((x) => x.kind !== 'flow')
3304
+ .sort(byTs)
3305
+ .reverse()
3306
+ .slice(0, 14)) {
3160
3307
  const li = evItem(e);
3161
3308
  const f = flowsDoc[e.flowId];
3162
3309
  const tag = el('button', 'btn chip', e.flowId);
@@ -3191,31 +3338,47 @@
3191
3338
  const body = el('div');
3192
3339
  const who = el('div', 'who');
3193
3340
  who.append(el('b', null, e.actor));
3194
- if (e.to) who.append(' → ', el('b', null, e.to));
3341
+ // A message the actor got has a sender, never a recipient: the sentence of the Latest list says the same.
3342
+ if (e.incoming) {
3343
+ if (e.from) who.append(' ← ', el('b', null, e.from));
3344
+ } else if (e.to) who.append(' → ', el('b', null, e.to));
3195
3345
  who.append(
3196
3346
  ' · ' + (t(KIND_TXT[e.kind]) || e.kind) + (e.attempt > 1 ? t(' lần ') + e.attempt : ''),
3197
3347
  );
3198
3348
  body.append(who, el('div', 'sm', e.summary));
3199
- const meta = el('div');
3200
- if (e.link && /^https:\/\//.test(e.link)) {
3201
- const l = el('a', 'lk', e.link.replace(/^https:\/\/github\.com\//, ''));
3202
- l.href = e.link;
3203
- l.target = '_blank';
3204
- l.rel = 'noopener';
3205
- meta.append(l, ' · ');
3206
- }
3207
- meta.append(
3208
- el(
3209
- 'span',
3210
- 'src',
3211
- isApprox(e) ? t('giờ ước lượng') : e.source === 'github' ? 'GitHub' : e.source || '',
3212
- ),
3213
- );
3214
- body.append(meta);
3349
+ // Where a line came from is shown only when it changes how to read it (an estimated time, GitHub); a tool's own
3350
+ // tag such as `cli` is not something the owner reads.
3351
+ const origin = isApprox(e) ? t('giờ ước lượng') : e.source === 'github' ? 'GitHub' : '';
3352
+ const hasLink = e.link && /^https:\/\//.test(e.link);
3353
+ if (hasLink || origin) {
3354
+ const meta = el('div');
3355
+ if (hasLink) {
3356
+ const l = el('a', 'lk', e.link.replace(/^https:\/\/github\.com\//, ''));
3357
+ l.href = e.link;
3358
+ l.target = '_blank';
3359
+ l.rel = 'noopener';
3360
+ meta.append(l);
3361
+ }
3362
+ if (hasLink && origin) meta.append(' · ');
3363
+ if (origin) meta.append(el('span', 'src', origin));
3364
+ body.append(meta);
3365
+ }
3215
3366
  li.append(body);
3216
3367
  return li;
3217
3368
  }
3218
3369
 
3370
+ // One readable sentence for a line: who did what, and the words the writer gave it.
3371
+ function latestText(e) {
3372
+ let verb;
3373
+ if (e.kind === 'decision' && e.choice) verb = t('lt.' + e.choice);
3374
+ else if (e.kind === 'note') verb = t(e.needsOwner ? 'lt.ask' : 'lt.note');
3375
+ else if (e.kind === 'msg' && e.incoming)
3376
+ verb = e.from ? t('lt.gotFrom') + ' ' + e.from : t('lt.got');
3377
+ else if (e.kind === 'msg' && e.to) verb = t('lt.msgTo') + ' ' + e.to;
3378
+ else verb = t('lt.' + e.kind);
3379
+ return e.actor + ' ' + verb + (e.summary ? ': ' + e.summary : '');
3380
+ }
3381
+
3219
3382
  function renderDetail(fresh) {
3220
3383
  const fl = FL.find((x) => x.id === selected);
3221
3384
  const box = $('dBody');
@@ -3238,7 +3401,39 @@
3238
3401
  el('span', 'repo', fl.f.repo),
3239
3402
  el('span', 'pill ' + fl.state, t(STATE_TXT[fl.state])),
3240
3403
  );
3241
- dh.append(top, el('h3', null, fl.f.title));
3404
+ const heading = el('h3', null, fl.f.title);
3405
+ if (!fl.f.named) heading.append(el('span', 'untitled', t('fl.untitled')));
3406
+ dh.append(top, heading);
3407
+ if (fl.f.why) dh.append(el('p', 'why', fl.f.why));
3408
+ if (fl.f.context) {
3409
+ const c = el('div', 'ctx');
3410
+ c.append(el('div', 'lb', t('ctx.label')), el('p', null, fl.f.context));
3411
+ dh.append(c);
3412
+ }
3413
+ if (fl.f.next) {
3414
+ const n = el('p', 'nx');
3415
+ n.append(el('b', null, t('nx.label') + ': '), fl.f.next);
3416
+ dh.append(n);
3417
+ }
3418
+ const hasWork = !fl.noWork;
3419
+ const latest = fl.evs
3420
+ .filter((e) => !e.plumbing && e.kind !== 'flow')
3421
+ .slice(-3)
3422
+ .reverse();
3423
+ if (latest.length) {
3424
+ const lat = el('div', 'lat');
3425
+ const ul = el('ul');
3426
+ for (const e of latest) {
3427
+ const li = el('li');
3428
+ li.append(
3429
+ el('span', 'tm', (isApprox(e) ? '≈' : '') + hhmm(e.ts)),
3430
+ el('span', null, latestText(e)),
3431
+ );
3432
+ ul.append(li);
3433
+ }
3434
+ lat.append(el('div', 'lb', t('lt.label')), ul);
3435
+ dh.append(lat);
3436
+ }
3242
3437
  const meta = el('div', 'meta');
3243
3438
  const m = (k, v) => {
3244
3439
  const s = el('span');
@@ -3263,7 +3458,7 @@
3263
3458
  ),
3264
3459
  );
3265
3460
  box.append(dh);
3266
- if (viewMode === 'diagram') box.append(renderDiagram(fl));
3461
+ if (viewMode === 'diagram' && hasWork) box.append(renderDiagram(fl));
3267
3462
  const tabs = el('div', 'dtabs');
3268
3463
  tabs.setAttribute('role', 'tablist');
3269
3464
  const t1 = el('button', 'tab', t('Các bước')),
@@ -3290,9 +3485,15 @@
3290
3485
  box.append(ul);
3291
3486
  return;
3292
3487
  }
3488
+ // A `flow` line names the flow; it is no work of a stage, so a flow with nothing else has no stage to show.
3489
+ if (!hasWork) {
3490
+ box.append(el('p', 'nowork', t('nw.empty')));
3491
+ return;
3492
+ }
3293
3493
  const ol = el('ol', 'tl');
3294
3494
  for (const k of fl.stages) {
3295
- const evs = fl.evs.filter((e) => e.stage === k);
3495
+ const evs = fl.evs.filter((e) => e.stage === k && e.kind !== 'flow');
3496
+ if (!evs.length) continue;
3296
3497
  const le = evs[evs.length - 1];
3297
3498
  const bad = le.status === 'fail' || le.status === 'blocked';
3298
3499
  const li = el(
@@ -3361,10 +3562,13 @@
3361
3562
  (x.state !== 'done' || sameDay(x.last.ts)) &&
3362
3563
  (!agentFilter || involves(x, agentFilter)),
3363
3564
  );
3364
- STAGES.forEach((nm, k) => {
3565
+ // A flow with no work is at no stage: it waits in a lane of its own, before the stages (it is the earliest of all).
3566
+ const lanes = STAGES.map((nm, k) => ({ nm, k }));
3567
+ if (items.some((x) => x.noWork)) lanes.unshift({ nm: 'nw.chip', k: -1 });
3568
+ lanes.forEach(({ nm, k }) => {
3365
3569
  const col = el('section', 'kc');
3366
3570
  const mine = items
3367
- .filter((x) => x.cur === k)
3571
+ .filter((x) => (k < 0 ? x.noWork : x.cur === k && !x.noWork))
3368
3572
  .sort(
3369
3573
  (a, b) =>
3370
3574
  ({ you: 0, blocked: 1, running: 2, parked: 3, done: 4 })[a.state] -
@@ -3396,7 +3600,9 @@
3396
3600
  el('span', 'spacer'),
3397
3601
  el('span', 'pill ' + fl.state, t(STATE_TXT[fl.state])),
3398
3602
  );
3399
- c.append(top, el('div', 'kt', fl.f.title), ft);
3603
+ const kt = el('div', 'kt', fl.f.title);
3604
+ if (!fl.f.named) kt.append(el('span', 'untitled', t('fl.untitled')));
3605
+ c.append(top, kt, ft);
3400
3606
  c.addEventListener('click', () => select(fl.id, true));
3401
3607
  kl.append(c);
3402
3608
  }
@@ -4255,6 +4461,12 @@
4255
4461
  clearTimeout(toastT);
4256
4462
  toastT = setTimeout(() => t.classList.remove('on'), warn ? 5200 : 2600);
4257
4463
  }
4464
+ // Who sent a message line and who got it: a sent line is the actor's to `to`; a received one is the actor's from `from`.
4465
+ function msgEnds(m) {
4466
+ return m.incoming
4467
+ ? { sender: m.from, receiver: m.actor }
4468
+ : { sender: m.actor, receiver: m.to };
4469
+ }
4258
4470
  function agentInfo(n) {
4259
4471
  const row = agentRows().find((r) => r.n === n) || {
4260
4472
  n,
@@ -4289,12 +4501,13 @@
4289
4501
  }
4290
4502
  const open = Object.values(prs).filter((p) => p.by === n && !p.merged && !p.closed);
4291
4503
  const msgs = events
4292
- .filter((e) => e.kind === 'msg' && (e.to === n || e.actor === n))
4504
+ .filter((e) => e.kind === 'msg' && (msgEnds(e).sender === n || msgEnds(e).receiver === n))
4293
4505
  .sort(byTs);
4506
+ // A message waits for its receiver: unanswered while the receiver has done nothing since, in that flow.
4294
4507
  const pending = msgs.filter((m) => {
4295
- const other = m.to === n ? n : m.to;
4508
+ const { receiver } = msgEnds(m);
4296
4509
  return !events.some(
4297
- (e) => e.ts > m.ts && e.actor === other && (!m.flowId || e.flowId === m.flowId),
4510
+ (e) => e.ts > m.ts && e.actor === receiver && (!m.flowId || e.flowId === m.flowId),
4298
4511
  );
4299
4512
  });
4300
4513
  return { row, mine, open, pending };
@@ -4387,7 +4600,12 @@
4387
4600
  const li = el('li');
4388
4601
  li.append(el('span', 'tm', (isApprox(m) ? '≈' : '') + hhmm(m.ts)));
4389
4602
  const sm = el('span', 'sm');
4390
- sm.append((m.actor === n ? '→ ' + m.to : '← ' + m.actor) + ': ' + (m.summary || ''));
4603
+ const ends = msgEnds(m);
4604
+ sm.append(
4605
+ (ends.sender === n ? '→ ' + (ends.receiver || '?') : '← ' + (ends.sender || '?')) +
4606
+ ': ' +
4607
+ (m.summary || ''),
4608
+ );
4391
4609
  li.append(sm);
4392
4610
  ul.append(li);
4393
4611
  }
@@ -4505,6 +4723,7 @@
4505
4723
  for (const a of ['aria-label', 'title', 'placeholder'])
4506
4724
  for (const e of document.querySelectorAll('[data-i18n-' + a + ']'))
4507
4725
  e.setAttribute(a, t(e.getAttribute('data-i18n-' + a)));
4726
+ syncPlumb();
4508
4727
  const b = $('bLang');
4509
4728
  b.textContent = lang === 'en' ? 'VI' : 'EN';
4510
4729
  b.setAttribute('aria-label', t('lang.label') + ': ' + t('lang.' + lang));
@@ -4603,6 +4822,12 @@
4603
4822
  if ($('vAgents').classList.contains('on')) renderAgents();
4604
4823
  }).observe($('gWrap'));
4605
4824
  let raf = 0;
4825
+ function loadEvents() {
4826
+ events = DATA.flows
4827
+ .flatMap((f) => f.events)
4828
+ .filter(keepEv)
4829
+ .map(normEv);
4830
+ }
4606
4831
  function schedule() {
4607
4832
  if (raf) return;
4608
4833
  raf = requestAnimationFrame(() => {
@@ -4625,6 +4850,19 @@
4625
4850
  }
4626
4851
  $('tFlows').addEventListener('click', () => showTab('Flows'));
4627
4852
  $('tAgents').addEventListener('click', () => showTab('Agents'));
4853
+ function syncPlumb() {
4854
+ const b = $('bPlumb');
4855
+ b.setAttribute('aria-pressed', String(showPlumbing));
4856
+ b.title = t('pl.tip');
4857
+ }
4858
+ $('bPlumb').addEventListener('click', () => {
4859
+ showPlumbing = !showPlumbing;
4860
+ lsSet(PLUMB_LS, showPlumbing ? '1' : '0');
4861
+ syncPlumb();
4862
+ loadEvents();
4863
+ schedule();
4864
+ });
4865
+ syncPlumb();
4628
4866
  $('bSeen').addEventListener('click', () => {
4629
4867
  lastSeen = new Date().toISOString();
4630
4868
  lsSet(LS, lastSeen);
@@ -4685,7 +4923,7 @@
4685
4923
  img.alt = '';
4686
4924
  $('mark').append(img);
4687
4925
  }
4688
- events = DATA.flows.flatMap((f) => f.events).map(normEv);
4926
+ loadEvents();
4689
4927
  decisions = DATA.decisions;
4690
4928
  agentsDoc = DATA.agents;
4691
4929
  releases = [];