agent-afk 5.202.0 → 5.203.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.
Files changed (38) hide show
  1. package/dist/agent/session/agent-session.d.ts +1 -0
  2. package/dist/agent/session-ledger-project.d.ts +103 -0
  3. package/dist/agent/session-ledger-reader.d.ts +8 -0
  4. package/dist/agent/session-ledger.d.ts +4 -63
  5. package/dist/agent/subagent/fork-types.d.ts +2 -1
  6. package/dist/agent/subagent.d.ts +3 -0
  7. package/dist/agent/types/session-types.d.ts +20 -0
  8. package/dist/agent/workspace/index.d.ts +1 -1
  9. package/dist/agent/workspace/workspace-tools.d.ts +2 -1
  10. package/dist/cli.mjs +685 -685
  11. package/dist/index.mjs +239 -239
  12. package/dist/telegram.mjs +302 -302
  13. package/dist/web-server/frontend/app-approvals.d.ts +7 -0
  14. package/dist/web-server/frontend/app-views.d.ts +3 -0
  15. package/dist/web-server/frontend/at-file-panel.d.ts +5 -0
  16. package/dist/web-server/frontend/bg-jobs-panel.d.ts +14 -0
  17. package/dist/web-server/frontend/diff-viewer.d.ts +17 -0
  18. package/dist/web-server/frontend/ledger-adapter.d.ts +7 -2
  19. package/dist/web-server/frontend/memory-panel.d.ts +6 -0
  20. package/dist/web-server/frontend/model-selector.d.ts +10 -0
  21. package/dist/web-server/frontend/render-approvals.d.ts +22 -0
  22. package/dist/web-server/frontend/render-incremental.d.ts +1 -0
  23. package/dist/web-server/frontend/render.d.ts +3 -22
  24. package/dist/web-server/frontend/schedules-view.d.ts +1 -0
  25. package/dist/web-server/frontend/session-status.d.ts +11 -0
  26. package/dist/web-server/frontend/subagent-tree.d.ts +27 -0
  27. package/dist/web-server/frontend/thinking-panel.d.ts +3 -0
  28. package/dist/web-server/frontend/tool-trace-panel.d.ts +2 -0
  29. package/dist/web-server/frontend/view-model.d.ts +19 -1
  30. package/dist/web-server/routes.bg-jobs.d.ts +3 -0
  31. package/dist/web-server/routes.memory.d.ts +3 -0
  32. package/dist/web-server/routes.models.d.ts +6 -0
  33. package/dist/web-ui-assets/app.js +45 -45
  34. package/dist/web-ui-assets/approvals.css +3 -1
  35. package/dist/web-ui-assets/index.html +19 -10
  36. package/dist/web-ui-assets/schedules.css +2 -3
  37. package/dist/web-ui-assets/styles.css +263 -1
  38. package/package.json +1 -1
@@ -11,7 +11,9 @@
11
11
  border-top: 1px solid var(--border); background: var(--bg-sunken);
12
12
  padding: 10px 16px; display: flex; flex-direction: column; gap: 8px;
13
13
  max-height: 42vh; overflow-y: auto;
14
- position: sticky; bottom: 0; z-index: 5;
14
+ /* z-ladder: approvals=15 must exceed topbar=10 so the card isn't clipped
15
+ by the sticky topbar on short viewports. */
16
+ position: sticky; bottom: 0; z-index: 15;
15
17
  }
16
18
  .approval-card {
17
19
  border: 1px solid var(--warning); border-radius: var(--radius);
@@ -23,6 +23,11 @@
23
23
  <link rel="stylesheet" href="/styles.css" />
24
24
  <link rel="stylesheet" href="/approvals.css" />
25
25
  <link rel="stylesheet" href="/schedules.css" />
26
+ <link rel="stylesheet" href="/at-file.css" />
27
+ <link rel="stylesheet" href="/diff-viewer.css" />
28
+ <link rel="stylesheet" href="/bg-jobs.css" />
29
+ <link rel="stylesheet" href="/model-selector.css" />
30
+ <link rel="stylesheet" href="/memory.css" />
26
31
  </head>
27
32
  <body>
28
33
  <header class="topbar">
@@ -31,20 +36,22 @@
31
36
  <span class="brand-name">afk</span>
32
37
  </div>
33
38
  <div id="meter" class="meter"></div>
34
- <div id="status" class="status">idle</div>
35
- <button id="menu-toggle" class="menu-toggle" aria-label="Toggle sessions">☰</button>
39
+ <div id="status" class="status" role="status" aria-live="polite">idle</div>
40
+ <button id="menu-toggle" type="button" class="menu-toggle" aria-label="Toggle sessions">☰</button>
36
41
  </header>
37
42
  <div id="toast" class="toast" hidden></div>
38
43
 
39
44
  <main class="layout">
40
45
  <aside id="sidebar" class="sidebar">
41
46
  <nav class="sidebar-nav">
42
- <button id="nav-sessions" class="sidebar-nav-btn is-active" data-view="sessions">Sessions</button>
43
- <button id="nav-schedules" class="sidebar-nav-btn" data-view="schedules">Schedules</button>
47
+ <button id="nav-sessions" type="button" class="sidebar-nav-btn is-active" data-view="sessions">Sessions</button>
48
+ <button id="nav-schedules" type="button" class="sidebar-nav-btn" data-view="schedules">Schedules</button>
49
+ <button id="nav-bg-jobs" type="button" class="sidebar-nav-btn" data-view="bg-jobs">Jobs</button>
50
+ <button id="nav-memory" type="button" class="sidebar-nav-btn" data-view="memory">Memory</button>
44
51
  </nav>
45
- <div class="sidebar-head">
52
+ <div id="sidebar-head" class="sidebar-head">
46
53
  <span>Sessions</span>
47
- <button id="new-session" class="new-session" title="Start a new session">+ New</button>
54
+ <button id="new-session" type="button" class="new-session" title="Start a new session">+ New</button>
48
55
  </div>
49
56
  <div id="sessions" class="sessions"></div>
50
57
  </aside>
@@ -52,7 +59,9 @@
52
59
 
53
60
  <section class="main">
54
61
  <div id="transcript" class="transcript"></div>
55
- <div id="schedules-view" class="sched-view"></div>
62
+ <div id="schedules-view" class="sched-view" hidden></div>
63
+ <div id="bg-jobs-view" class="bgjob-view" hidden></div>
64
+ <div id="memory-view" class="mem-view" hidden></div>
56
65
  <div id="approvals" class="approvals"></div>
57
66
  <div id="composer" class="composer">
58
67
  <div id="slash-menu" class="slash-menu" hidden></div>
@@ -63,10 +72,10 @@
63
72
  caret. Both must share text metrics — see styles.css. -->
64
73
  <div class="prompt-wrap">
65
74
  <div id="prompt-mirror" class="prompt-mirror" aria-hidden="true"></div>
66
- <textarea id="prompt" rows="2" placeholder="Message the agent…"></textarea>
75
+ <textarea id="prompt" rows="2" placeholder="Message the agent…" aria-label="Message the agent"></textarea>
67
76
  </div>
68
- <button id="stop" class="stop" hidden>Stop</button>
69
- <button id="send" class="send">Send</button>
77
+ <button id="stop" type="button" class="stop" hidden>Stop</button>
78
+ <button id="send" type="button" class="send">Send</button>
70
79
  </div>
71
80
  </div>
72
81
  </section>
@@ -1,7 +1,6 @@
1
1
  /* ── schedules view ─────────────────────────────────────────────────────── */
2
2
 
3
- .sched-view { display: none; flex: 1; flex-direction: column; overflow-y: auto; padding: 24px; }
4
- .sched-view.is-active { display: flex; }
3
+ .sched-view { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 24px; }
5
4
 
6
5
  .sched-header { max-width: 900px; width: 100%; margin: 0 auto 20px; }
7
6
  .sched-title-row {
@@ -182,7 +181,7 @@
182
181
  .sched-hist-excerpt {
183
182
  margin-top: 6px; font-size: 11px; color: var(--text-faint);
184
183
  font-family: var(--mono); white-space: pre-wrap; word-break: break-word;
185
- max-height: 80px; overflow: hidden;
184
+ max-height: 80px; overflow-y: auto;
186
185
  }
187
186
 
188
187
  /* ── nav tabs ───────────────────────────────────────────────────────────── */
@@ -15,12 +15,20 @@
15
15
  --success: #4ade80;
16
16
  --error: #f87171;
17
17
  --warning: #fbbf24;
18
+ --purple: #a78bfa;
19
+ --cyan: #67e8f9;
20
+ --mint: #86efac;
21
+ --lavender: #c4b5fd;
18
22
  --radius: 8px;
19
23
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
20
24
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
21
25
  }
22
26
 
23
27
  * { box-sizing: border-box; }
28
+ /* Invariant: the hidden attribute must always win over CSS display rules.
29
+ Elements like .transcript and .composer have explicit display values that
30
+ override the UA [hidden] { display: none } in some browsers. */
31
+ [hidden] { display: none !important; }
24
32
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
25
33
  #prompt:focus-visible, .approval-input:focus-visible { outline: none; }
26
34
 
@@ -45,6 +53,7 @@ html, body {
45
53
  background: var(--bg-raised);
46
54
  position: sticky;
47
55
  top: 0;
56
+ /* z-ladder: content=0, backdrop=8, sidebar=9, topbar=10, approvals=15, slash-menu=20, at-popover=25, modal=50 */
48
57
  z-index: 10;
49
58
  }
50
59
  .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
@@ -281,7 +290,7 @@ details[open] > .tool-summary::before { transform: rotate(90deg); }
281
290
  background: var(--bg-raised); border: 1px solid var(--border);
282
291
  border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 45%);
283
292
  }
284
- .slash-menu[hidden] { display: none; }
293
+ /* [hidden] handled by global rule — no per-element override needed. */
285
294
  .slash-status {
286
295
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
287
296
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
@@ -416,3 +425,256 @@ details[open] > .tool-summary::before { transform: rotate(90deg); }
416
425
  font-weight: 600; cursor: pointer;
417
426
  }
418
427
  .nsf-btn:hover { opacity: 0.88; }
428
+
429
+ /* ── thinking panel (thinking-panel.ts) ──────────────────────────────────── */
430
+ /*
431
+ * Invariant: expand/collapse is driven by the `.thinking-block--open` modifier
432
+ * class toggled in JS — NOT by `<details>` open attribute. This keeps the panel
433
+ * compatible with the incremental renderer, which keys change-detection off
434
+ * `.className` and would fight with native `<details>` state.
435
+ */
436
+ .thinking-host { max-width: 900px; width: 100%; margin-bottom: 14px; }
437
+
438
+ .thinking-block {
439
+ border: 1px solid var(--border);
440
+ border-radius: var(--radius);
441
+ background: var(--bg-raised);
442
+ overflow: hidden;
443
+ }
444
+
445
+ /* Summary row — always visible, acts as the click target. */
446
+ .thinking-summary {
447
+ display: flex;
448
+ align-items: center;
449
+ gap: 6px;
450
+ padding: 6px 12px;
451
+ cursor: pointer;
452
+ user-select: none;
453
+ font-family: var(--mono);
454
+ font-size: 11px;
455
+ color: var(--text-faint);
456
+ /* No border-bottom by default; appears only when open (see below). */
457
+ }
458
+ .thinking-summary:hover { color: var(--text-dim); }
459
+
460
+ /* Rotated chevron mirrors the tool-summary::before convention. */
461
+ .thinking-chevron {
462
+ font-size: 14px;
463
+ color: var(--text-faint);
464
+ transition: transform 0.15s ease;
465
+ flex: 0 0 auto;
466
+ line-height: 1;
467
+ }
468
+ .thinking-block--open .thinking-chevron { transform: rotate(90deg); }
469
+
470
+ .thinking-label { letter-spacing: 0.03em; }
471
+
472
+ /* Body — hidden until the block is open. */
473
+ .thinking-body {
474
+ display: none;
475
+ border-top: 1px solid var(--border);
476
+ padding: 10px 12px;
477
+ }
478
+ .thinking-block--open .thinking-body { display: block; }
479
+
480
+ /* Verbatim thinking text — monospace, slightly dimmed, scrollable. */
481
+ .thinking-pre {
482
+ margin: 0;
483
+ font-family: var(--mono);
484
+ font-size: 12px;
485
+ line-height: 1.55;
486
+ color: var(--text-dim);
487
+ white-space: pre-wrap;
488
+ word-break: break-word;
489
+ overflow-x: auto;
490
+ max-height: 480px;
491
+ overflow-y: auto;
492
+ }
493
+
494
+ /* Focus ring for keyboard navigation (role=button on .thinking-summary). */
495
+ .thinking-summary:focus-visible {
496
+ outline: 2px solid var(--accent);
497
+ outline-offset: -2px;
498
+ }
499
+
500
+ /* ── subagent tree panel (Wave 2-E) ──────────────────────────────────────── */
501
+ .sat-tree {
502
+ font-family: var(--mono);
503
+ font-size: 12px;
504
+ color: var(--text-dim);
505
+ padding: 6px 0;
506
+ user-select: none;
507
+ }
508
+ .sat-node { display: flex; flex-direction: column; }
509
+ .sat-row {
510
+ display: flex;
511
+ align-items: baseline;
512
+ gap: 4px;
513
+ padding: 2px 8px;
514
+ border-radius: 4px;
515
+ white-space: nowrap;
516
+ overflow: hidden;
517
+ }
518
+ .sat-row-expandable { cursor: pointer; }
519
+ .sat-row-expandable:hover { background: var(--bg-raised); }
520
+
521
+ /* toggle arrow */
522
+ .sat-toggle {
523
+ flex-shrink: 0;
524
+ font-size: 9px;
525
+ color: var(--text-faint);
526
+ width: 12px;
527
+ display: inline-block;
528
+ }
529
+
530
+ /* tree connector (monospace spine) */
531
+ .sat-indent {
532
+ flex-shrink: 0;
533
+ color: var(--text-faint);
534
+ white-space: pre;
535
+ }
536
+
537
+ /* status icons */
538
+ .sat-icon { flex-shrink: 0; font-size: 11px; width: 14px; text-align: center; }
539
+ .sat-icon-started { color: var(--accent); animation: sat-spin 1.2s linear infinite; }
540
+ .sat-icon-succeeded { color: var(--success); }
541
+ .sat-icon-failed { color: var(--error); }
542
+ .sat-icon-cancelled { color: var(--text-faint); }
543
+
544
+ @keyframes sat-spin {
545
+ 0% { opacity: 1; }
546
+ 50% { opacity: 0.35; }
547
+ 100% { opacity: 1; }
548
+ }
549
+
550
+ /* label parts */
551
+ .sat-label { display: flex; align-items: baseline; gap: 0; min-width: 0; overflow: hidden; }
552
+ .sat-type { color: var(--text); font-weight: 500; flex-shrink: 0; }
553
+ .sat-model { color: var(--text-faint); flex-shrink: 0; }
554
+ .sat-head {
555
+ color: var(--text-dim);
556
+ overflow: hidden;
557
+ text-overflow: ellipsis;
558
+ white-space: nowrap;
559
+ min-width: 0;
560
+ }
561
+
562
+ /* right-aligned meta (duration + cost) */
563
+ .sat-meta {
564
+ margin-left: auto;
565
+ display: flex;
566
+ gap: 8px;
567
+ flex-shrink: 0;
568
+ color: var(--text-faint);
569
+ font-size: 11px;
570
+ }
571
+ .sat-duration { color: var(--text-faint); }
572
+ .sat-cost { color: var(--text-faint); }
573
+
574
+ /* children indent container */
575
+ .sat-children { padding-left: 0; }
576
+
577
+ /* ── tool-trace-panel (Wave 2-A) ──────────────────────────────────────────── */
578
+ /*
579
+ * tc-* classes belong to tool-trace-panel.ts. They reuse existing brand
580
+ * tokens and the diff-* / tool-* classes already defined above so the
581
+ * panel stays visually coherent with the existing tool rows in render.ts.
582
+ */
583
+
584
+ .tc-card {
585
+ border: 1px solid var(--border); border-radius: var(--radius);
586
+ margin-bottom: 8px; background: var(--bg-raised); overflow: hidden;
587
+ max-width: 900px; width: 100%;
588
+ }
589
+
590
+ .tc-header {
591
+ display: flex; align-items: center; gap: 8px; padding: 8px 12px;
592
+ cursor: pointer; font-family: var(--mono); font-size: 12px;
593
+ list-style: none; user-select: none;
594
+ }
595
+ .tc-header::-webkit-details-marker { display: none; }
596
+ .tc-header::before {
597
+ content: '›';
598
+ display: inline-block; font-size: 14px; color: var(--text-faint);
599
+ transition: transform 0.15s ease; margin-right: 4px; flex: 0 0 auto;
600
+ }
601
+ details[open] > .tc-header::before { transform: rotate(90deg); }
602
+
603
+ /* Status badge: dot + short label */
604
+ .tc-status { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
605
+ /* tc-dot reuses the .tool-dot sizing; the colour variant classes (tool-dot-ok
606
+ / tool-dot-running / tool-dot-error) come from the existing tool-calls block. */
607
+ .tc-dot {
608
+ width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px;
609
+ }
610
+ .tc-status-label {
611
+ font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
612
+ }
613
+ .tc-status-running { color: var(--warning); }
614
+ .tc-status-ok { color: var(--success); }
615
+ .tc-status-error { color: var(--error); }
616
+
617
+ .tc-name { color: var(--accent); font-weight: 600; flex: 0 0 auto; }
618
+ .tc-input-preview {
619
+ color: var(--text-dim); overflow: hidden; text-overflow: ellipsis;
620
+ white-space: nowrap; flex: 1 1 0; min-width: 0;
621
+ }
622
+ .tc-header-duration {
623
+ color: var(--text-faint); font-size: 11px; flex: 0 0 auto; margin-left: auto;
624
+ }
625
+
626
+ /* Body (visible when <details> is open) */
627
+ .tc-body {
628
+ padding: 0 12px 12px; border-top: 1px solid var(--border);
629
+ }
630
+ .tc-section { margin-top: 10px; }
631
+ .tc-pre-wrap { display: flex; flex-direction: column; gap: 6px; }
632
+
633
+ /* Duration metadata row */
634
+ .tc-meta-row {
635
+ display: flex; align-items: center; gap: 8px;
636
+ padding: 8px 0 0; font-family: var(--mono); font-size: 11px;
637
+ }
638
+ .tc-meta-label {
639
+ font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
640
+ color: var(--text-dim);
641
+ }
642
+ .tc-meta-value { color: var(--text-faint); }
643
+
644
+ /* "output not available" note — dim, not alarming */
645
+ .tc-unavailable {
646
+ margin-top: 10px; font-size: 12px; font-style: italic;
647
+ color: var(--text-faint);
648
+ }
649
+
650
+ /* ---- subagent / bg-job lifecycle cards ---- */
651
+ .sa-card {
652
+ display: flex; flex-direction: column; gap: 4px;
653
+ padding: 8px 12px; margin: 8px 0; border-radius: var(--radius);
654
+ border-left: 3px solid var(--border); background: var(--bg-sunken);
655
+ font-family: var(--mono); font-size: 12px;
656
+ }
657
+ .sa-card--started { border-left-color: var(--accent); }
658
+ .sa-card--succeeded, .sa-card--completed { border-left-color: var(--success); }
659
+ .sa-card--failed { border-left-color: var(--error); }
660
+ .sa-card--cancelled { border-left-color: var(--text-dim); }
661
+ .sa-header {
662
+ display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
663
+ }
664
+ .sa-icon {
665
+ font-size: 13px; width: 18px; text-align: center; flex-shrink: 0;
666
+ }
667
+ .sa-card--started .sa-icon { color: var(--accent); }
668
+ .sa-card--succeeded .sa-icon, .sa-card--completed .sa-icon { color: var(--success); }
669
+ .sa-card--failed .sa-icon { color: var(--error); }
670
+ .sa-card--cancelled .sa-icon { color: var(--text-dim); }
671
+ .sa-label {
672
+ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
673
+ white-space: nowrap; color: var(--text);
674
+ }
675
+ .sa-model { color: var(--text-dim); font-size: 11px; }
676
+ .sa-dur { color: var(--text-faint); font-size: 11px; }
677
+ .sa-prompt {
678
+ color: var(--text-faint); font-size: 11px; line-height: 1.4;
679
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
680
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-afk",
3
- "version": "5.202.0",
3
+ "version": "5.203.0",
4
4
  "description": "Open-source coding-agent harness you can actually change — own the loop (prompts, gates, routing, skills, terminal states), use any model, run long tasks while you're away.",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",