heartcode 0.1.25 → 0.1.30

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/src/settings.html CHANGED
@@ -16,6 +16,7 @@
16
16
  --accent: #16824c; --accent-soft: #e8f5ee; --on-accent: #ffffff;
17
17
  --brand: var(--accent); --brand-soft: var(--accent-soft); --on-brand: var(--on-accent);
18
18
  --ok: #1d8a4b; --ok-soft: #e7f5ec; --err: #d1242f; --err-soft: #fdecee;
19
+ --warn: #a16207; /* in progress, or needs a look: not green (works) and not red (broken) */
19
20
  --ring: 0 0 0 3px rgba(22, 130, 76, .18);
20
21
  --shadow: 0 1px 2px rgba(20, 22, 30, .04), 0 8px 24px rgba(20, 22, 30, .06);
21
22
  --shadow-pop: 0 24px 64px rgba(20, 22, 30, .18), 0 2px 6px rgba(20, 22, 30, .06);
@@ -31,6 +32,7 @@
31
32
  --line: #23252c; --line-strong: #2f323a; --hover: #1c1e24; --input: #101115;
32
33
  --accent: #5ccf8a; --accent-soft: rgba(92, 207, 138, .13); --on-accent: #07140d;
33
34
  --ok: #62cf8b; --ok-soft: rgba(98, 207, 139, .12); --err: #ff7a7a; --err-soft: rgba(255, 122, 122, .12);
35
+ --warn: #e3b341;
34
36
  --ring: 0 0 0 3px rgba(92, 207, 138, .25);
35
37
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
36
38
  --shadow-pop: 0 28px 72px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03);
@@ -42,6 +44,7 @@
42
44
  --line: #23252c; --line-strong: #2f323a; --hover: #1c1e24; --input: #101115;
43
45
  --accent: #5ccf8a; --accent-soft: rgba(92, 207, 138, .13); --on-accent: #07140d;
44
46
  --ok: #62cf8b; --ok-soft: rgba(98, 207, 139, .12); --err: #ff7a7a; --err-soft: rgba(255, 122, 122, .12);
47
+ --warn: #e3b341;
45
48
  --ring: 0 0 0 3px rgba(92, 207, 138, .25);
46
49
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
47
50
  --shadow-pop: 0 28px 72px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03);
@@ -69,6 +72,14 @@
69
72
  nav a.on::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
70
73
  nav a .ic { width: 18px; text-align: center; opacity: .7; font-size: 13px; }
71
74
  nav a.on .ic { color: var(--accent); opacity: 1; }
75
+ .nav-group { height: 1px; margin: 10px 12px; background: var(--line); }
76
+ .nav-group:first-child { display: none; }
77
+ .subtabs { display: flex; gap: 4px; margin: -4px 0 18px; border-bottom: 1px solid var(--line); }
78
+ .subtabs a { position: relative; padding: 8px 12px 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px; transition: color .15s; }
79
+ .subtabs a:hover { color: var(--text); }
80
+ .subtabs a.on { color: var(--text); font-weight: 600; }
81
+ .subtabs a.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
82
+ .subtabs a .count { margin-left: 6px; font-size: 11.5px; color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
72
83
  nav a .count { margin-left: auto; font-size: 11.5px; color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
73
84
  .using:empty { visibility: hidden; } /* until your settings are in */
74
85
  .using { margin: auto 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; background: var(--panel); }
@@ -177,6 +188,21 @@
177
188
  .mono { font-family: var(--mono); font-size: 12.5px; }
178
189
  .muted { color: var(--muted); }
179
190
  .tag { display: inline-block; white-space: nowrap; font-size: 11px; font-weight: 600; line-height: 18px; padding: 0 7px; border-radius: 6px; background: var(--hover); color: var(--muted); font-variant-numeric: tabular-nums; }
191
+ .tag.ok { background: var(--ok-soft); color: var(--ok); }
192
+ .tag.need { background: rgba(217, 164, 6, .14); color: #caa106; }
193
+ /* External tools / capabilities */
194
+ .cap { padding: 13px 0; border-bottom: 1px solid var(--line); }
195
+ .cap:first-child { padding-top: 2px; }
196
+ .cap:last-child { border-bottom: 0; padding-bottom: 2px; }
197
+ .cap-h { display: flex; align-items: center; gap: 8px; }
198
+ .cap-h b { font-weight: 600; }
199
+ .cap-h .tag { margin-left: auto; }
200
+ .cap-mark { width: 18px; text-align: center; font-weight: 700; color: var(--ok); flex: none; }
201
+ .cap.cap-off .cap-mark { color: var(--faint); }
202
+ .cap.cap-off .cap-h b, .cap.cap-off .cap-what { color: var(--faint); } /* grayed out until it's set up */
203
+ .cap-what { color: var(--muted); font-size: 12.5px; margin: 4px 0 0 26px; text-wrap: pretty; }
204
+ .cap-need { font-size: 12.5px; margin: 7px 0 0 26px; padding: 8px 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-s); }
205
+ .cap-need b { color: var(--muted); }
180
206
  .tag.brand { background: var(--accent-soft); color: var(--accent); }
181
207
  .tag.ok { background: var(--ok-soft); color: var(--ok); }
182
208
  .tag.err { background: var(--err-soft); color: var(--err); }
@@ -301,7 +327,7 @@
301
327
  .olist .test .spin { flex: none; }
302
328
  .olist .test button { flex: none; }
303
329
  .olist .test.ok { color: var(--ok); }
304
- .olist .test.warn { color: var(--accent); }
330
+ .olist .test.warn { color: var(--warn); }
305
331
  dialog { width: 70vw; max-width: none; max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); padding: 26px 28px 24px; box-shadow: var(--shadow-pop); }
306
332
  dialog[open] { animation: pop-in .18s cubic-bezier(.2, .8, .3, 1); }
307
333
  @keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@@ -315,7 +341,7 @@
315
341
  #pr-list li.dragging { opacity: .4; }
316
342
  dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
317
343
  .olist .test.failed { color: var(--err); }
318
- .olist .test.testing, .olist .test.waiting { color: var(--accent); }
344
+ .olist .test.testing, .olist .test.waiting { color: var(--warn); }
319
345
  .olist .test button { padding: 0 7px; font-size: 11px; }
320
346
  .spin { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
321
347
  @keyframes spin { to { transform: rotate(360deg); } }
@@ -389,7 +415,7 @@
389
415
  .mtable .yes { color: var(--ok); }
390
416
  .mtable .no { color: var(--faint); }
391
417
  .mtable .src { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
392
- .mtable .src.warn { color: var(--accent); }
418
+ .mtable .src.warn { color: var(--warn); }
393
419
  .mtable button { padding: 2px 8px; font-size: 11.5px; border-color: transparent; background: transparent; color: var(--muted); }
394
420
  .mtable li:hover button, .mtable li.picked button { border-color: var(--line-strong); background: var(--panel); color: var(--text); }
395
421
  .mtable li:hover button.danger { color: var(--err); }
@@ -397,7 +423,10 @@
397
423
  .mtable .try .msg { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
398
424
  .mtable .try.ok { color: var(--ok); }
399
425
  .mtable .try.bad { color: var(--err); }
400
- .mtable .try.going { color: var(--accent); }
426
+ .mtable .try.going { color: var(--warn); }
427
+ .mtable .try.going .msg { animation: pulse 1.4s ease-in-out infinite; }
428
+ @keyframes pulse { 50% { opacity: .45; } }
429
+ @media (prefers-reduced-motion: reduce) { .mtable .try.going .msg { animation: none; } }
401
430
  .mt-empty { padding: 28px 18px; color: var(--muted); }
402
431
  .olist .grip { cursor: grab; color: var(--faint); padding: 0 2px; user-select: none; }
403
432
  .olist .n { font-weight: 800; color: var(--brand); min-width: 24px; }
@@ -428,9 +457,24 @@
428
457
 
429
458
  /* choices as cards (permissions, colors) */
430
459
  .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
460
+ .choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
461
+ .choices.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
462
+ /* General: cards in pairs on rows that line up (related ones side by side: permissions | colors,
463
+ behavior | model, voice | tools), the full width; one column when there isn't room for two */
464
+ .settings-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
465
+ @media (max-width: 1280px) { .settings-col { grid-template-columns: minmax(0, 1fr); } }
466
+ .settings-col .card h2 { margin-bottom: 4px; }
467
+ .settings-col #g-toggles { margin-top: 8px; }
468
+ .setting { display: flex; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
469
+ .setting:last-child { border-bottom: 0; padding-bottom: 2px; }
470
+ .setting .t { flex: 1; min-width: 0; cursor: default; }
471
+ .setting .t b { display: block; font-weight: 600; }
472
+ .setting .t span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; text-wrap: pretty; }
473
+ .setting select, .setting input { flex: none; width: 240px; }
431
474
  .choice { position: relative; border: 1px solid var(--line-strong); border-radius: 12px; padding: 13px 15px; cursor: pointer; background: var(--panel); transition: border-color .15s, box-shadow .15s, background .15s; }
432
475
  .choice:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
433
- .choice.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
476
+ .choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--panel)); }
477
+ .choice:has(input:focus-visible) { box-shadow: var(--ring); }
434
478
  .choice b { display: block; }
435
479
  .choice span { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
436
480
  .choice input { position: absolute; opacity: 0; }
@@ -484,11 +528,14 @@
484
528
  nav { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
485
529
  nav a { flex: none; margin: 0; }
486
530
  nav a.on::before { display: none; } /* a strip of tabs: the highlighted one is enough */
487
- nav a .count, .using { display: none; }
531
+ nav a .count, .using, .nav-group { display: none; }
488
532
  .theme-pick { margin: 6px 0 4px; max-width: 280px; }
489
533
  main { padding: 20px 16px 60px; }
490
534
  .steps { grid-template-columns: 1fr; }
491
- .choices { grid-template-columns: 1fr; }
535
+ .choices, .choices.three { grid-template-columns: 1fr; }
536
+ .choices.four { grid-template-columns: 1fr 1fr; }
537
+ .setting { flex-direction: column; align-items: stretch; gap: 10px; }
538
+ .setting select, .setting input { width: 100%; }
492
539
  .grid, .cols { grid-template-columns: 1fr; }
493
540
  .md { grid-template-columns: 1fr; }
494
541
  .md .list { position: static; max-height: 300px; }
@@ -497,6 +544,52 @@
497
544
  .md.fill .detail > .card > textarea.editor { min-height: 260px; }
498
545
  .prov-head, .prov-body { padding-left: 14px; padding-right: 14px; }
499
546
  }
547
+ /* Status-bar editor */
548
+ .sb-wrap { display: flex; flex-direction: column; gap: 18px; max-width: 940px; }
549
+ .sb-onoff { padding-top: 0; padding-bottom: 16px; cursor: default; }
550
+ .sb-onoff #sb-switch { display: inline-flex; align-items: center; flex: none; } /* so the switch inside is a flex item and gets its width/height */
551
+ .sb-cardhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
552
+ .sb-cardhead .sub { margin-bottom: 0; }
553
+ .sb-cardhead button { flex: none; }
554
+ .sb-hint { font-size: 11px; color: var(--faint); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .04em; }
555
+ .sb-preview { background: #0c0d10; color: #ececf0; border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 11px 13px; font-family: var(--mono); font-size: 13px; line-height: 1.75; overflow-x: auto; white-space: pre; }
556
+ .sb-preview .sb-row { display: flex; }
557
+ .sb-preview .sb-grow { flex: 1; }
558
+ .sb-preview .sb-sep { color: #4b4e57; }
559
+ .sb-preview .sb-empty { color: #6d717c; font-style: italic; }
560
+ .sb-lines { display: flex; flex-direction: column; gap: 10px; }
561
+ .sb-line { display: flex; gap: 8px; align-items: stretch; }
562
+ .sb-line .sb-no { width: 16px; flex: none; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; display: flex; align-items: center; justify-content: center; }
563
+ .sb-zone { flex: 1; min-width: 0; min-height: 44px; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); padding: 8px 9px; background: var(--panel2); display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; transition: background .12s, border-color .12s; }
564
+ .sb-zone .sb-ztag { width: 100%; font-size: 10.5px; color: var(--faint); margin-bottom: 1px; text-transform: uppercase; letter-spacing: .05em; }
565
+ .sb-zone .sb-drop { color: var(--faint); font-size: 12px; font-style: italic; padding: 2px 1px; }
566
+ .sb-zone.sb-over { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
567
+ .sb-line .sb-del { flex: none; width: 30px; align-self: stretch; border: 1px solid transparent; background: none; color: var(--faint); cursor: pointer; border-radius: var(--radius-s); font-size: 14px; }
568
+ .sb-line .sb-del:hover { background: var(--err-soft); color: var(--err); }
569
+ .sb-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px 4px 10px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12.5px; font-weight: 500; cursor: grab; user-select: none; box-shadow: var(--shadow); }
570
+ .sb-chip:active { cursor: grabbing; }
571
+ .sb-chip.sb-dragging { opacity: .4; }
572
+ .sb-chip .sb-x { border: none; background: none; color: var(--faint); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 50%; }
573
+ .sb-chip .sb-x:hover { color: var(--err); background: var(--err-soft); }
574
+ .sb-palette { display: flex; flex-wrap: wrap; gap: 8px; }
575
+ .sb-palette .sb-chip { background: var(--panel2); padding: 5px 11px; }
576
+ .sb-palette .sb-chip.sb-used { opacity: .4; cursor: not-allowed; }
577
+ #sb-editor.sb-off { opacity: .55; } /* off: dimmed as a hint, but still editable so turning it back on keeps the layout */
578
+ /* Import dialog */
579
+ #imp { width: 560px; max-width: calc(100vw - 32px); }
580
+ .imp-list { max-height: 56vh; overflow: auto; margin-top: 4px; }
581
+ .imp-group { margin-bottom: 14px; }
582
+ .imp-gh { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; }
583
+ .imp-gh label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
584
+ .imp-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 8px; border-radius: var(--radius-s); cursor: pointer; }
585
+ .imp-row:hover { background: var(--hover); }
586
+ .imp-row input { margin: 0; flex: none; align-self: center; }
587
+ .tg-steps { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 14px; line-height: 1.55; }
588
+ .tg-steps li::marker { color: var(--muted); }
589
+ .tg-conn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
590
+ .opt.tg-off { opacity: .5; }
591
+ .imp-row .imp-label { font-weight: 500; font-family: var(--mono); font-size: 12.5px; flex: none; }
592
+ .imp-row .imp-desc { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
500
593
  </style>
501
594
  </head>
502
595
  <body>
@@ -504,14 +597,17 @@
504
597
  <aside>
505
598
  <div class="brand"><span>♥</span> HeartCode <small>settings</small></div>
506
599
  <nav id="nav">
507
- <a href="#providers" data-page="providers"><span class="ic">◉</span> Providers &amp; models <span class="count" id="n-providers"></span></a>
508
- <a href="#models" data-page="models"><span class="ic">☰</span> Your models <span class="count" id="n-mine"></span></a>
509
- <a href="#general" data-page="general"><span class="ic">⚙</span> General</a>
510
- <a href="#logging" data-page="logging"><span class="ic">▤</span> Logging <span class="count" id="n-failed"></span></a>
511
- <a href="#prompts" data-page="prompts"><span class="ic">✎</span> System prompt</a>
512
- <a href="#mcp" data-page="mcp"><span class="ic">⧉</span> MCP servers <span class="count" id="n-mcp"></span></a>
600
+ <div class="nav-group" role="separator"></div>
601
+ <a href="#models" data-page="models" data-tabs="models providers"><span class="ic">☰</span> Models <span class="count" id="n-mine"></span></a>
602
+ <div class="nav-group" role="separator"></div>
603
+ <a href="#general" data-page="general" data-tabs="general statusbar"><span class="ic">⚙</span> General</a>
604
+ <a href="#notify" data-page="notify"><span class="ic">✉</span> Notifications</a>
605
+ <div class="nav-group" role="separator"></div>
513
606
  <a href="#skills" data-page="skills"><span class="ic">✦</span> Skills <span class="count" id="n-skills"></span></a>
514
- <a href="#files" data-page="files"><span class="ic">≡</span> Advanced files</a>
607
+ <a href="#mcp" data-page="mcp"><span class="ic">⧉</span> MCP servers <span class="count" id="n-mcp"></span></a>
608
+ <a href="#prompts" data-page="prompts"><span class="ic">✎</span> System prompt</a>
609
+ <div class="nav-group" role="separator"></div>
610
+ <a href="#logging" data-page="logging" data-tabs="logging files"><span class="ic">▤</span> Advanced <span class="count" id="n-failed"></span></a>
515
611
  </nav>
516
612
  <div class="using" id="using"></div>
517
613
  <div class="seg theme-pick" id="theme-pick" role="radiogroup" aria-label="Light or dark">
@@ -524,7 +620,7 @@
524
620
  <!-- Providers & models -->
525
621
  <section class="page" id="page-providers">
526
622
  <div class="head">
527
- <div><h1>Providers &amp; models</h1><p class="lead">Click a model to add it to your list, or tick several. HeartCode tries your list in order: #1 first, the next when one fails.</p></div>
623
+ <div><h1>Providers</h1><p class="lead">Click a model to add it to your list, or tick several. HeartCode tries your list in order: #1 first, the next when one fails.</p></div>
528
624
  <div class="head-actions"><button id="p-mine" type="button"></button><button class="primary" id="p-open">+ Add a provider</button></div>
529
625
  </div>
530
626
  <div class="steps" id="steps"></div>
@@ -551,9 +647,30 @@
551
647
  <div class="card mt-card" id="mt"></div>
552
648
  </section>
553
649
 
650
+ <!-- Notifications -->
651
+ <section class="page" id="page-notify">
652
+ <div class="head"><div><h1>Notifications</h1><p class="lead">A message on your phone when HeartCode finishes a task, fails, or needs you, so you can step away while it works.</p></div></div>
653
+ <div class="cols">
654
+ <div class="stack">
655
+ <div class="card">
656
+ <h2>Telegram</h2>
657
+ <p class="sub">Through a bot of your own: only you get its messages.</p>
658
+ <div id="tg-setup"></div>
659
+ </div>
660
+ </div>
661
+ <div class="stack">
662
+ <div class="card">
663
+ <h2>When to send one</h2>
664
+ <p class="sub">Each on its own. A running HeartCode follows changes right away.</p>
665
+ <div id="tg-events"></div>
666
+ </div>
667
+ </div>
668
+ </div>
669
+ </section>
670
+
554
671
  <!-- Logging -->
555
672
  <section class="page" id="page-logging">
556
- <div class="head"><div><h1>Logging</h1><p class="lead">What HeartCode writes down, for finding out what went wrong. Off unless you switch it on.</p></div><div class="disk" id="l-disk"></div></div>
673
+ <div class="head"><div><h1>Logs</h1><p class="lead">What HeartCode writes down, for finding out what went wrong. Off unless you switch it on.</p></div><div class="disk" id="l-disk"></div></div>
557
674
  <div class="card">
558
675
  <div class="log-opts">
559
676
  <div>
@@ -597,42 +714,83 @@
597
714
  </div>
598
715
  </section>
599
716
 
600
- <!-- General -->
717
+ <!-- General: one column, a card per topic, every setting saved as it changes -->
601
718
  <section class="page" id="page-general">
602
- <div class="head"><div><h1>General</h1><p class="lead">How HeartCode works for you. Saved for next time; a running HeartCode takes changes right away.</p></div></div>
603
- <div class="cols">
604
- <div class="stack">
605
- <div class="card">
606
- <h2>What can HeartCode do without asking?</h2>
607
- <p class="sub">Shift+Tab in HeartCode switches between these too (and to plan mode).</p>
608
- <div class="choices" id="g-perm"></div>
609
- </div>
610
- <div class="card">
611
- <h2>Colors</h2>
612
- <p class="sub">Your own colors on top of a theme: theme.json in <a href="#files">Advanced files</a>.</p>
613
- <div class="choices" id="g-theme"></div>
719
+ <div class="head"><div><h1>General</h1><p class="lead">How HeartCode works for you. Every change saves on its own, and a running HeartCode picks it up right away.</p></div></div>
720
+ <div class="settings-col">
721
+ <div class="card">
722
+ <h2>Permissions</h2>
723
+ <p class="sub">What HeartCode may do without asking you first. <span class="mono">Shift+Tab</span> in HeartCode switches between these too.</p>
724
+ <div class="choices three" id="g-perm"></div>
725
+ </div>
726
+ <div class="card">
727
+ <h2>Terminal colors</h2>
728
+ <p class="sub">Your own colors on top of one: theme.json in <a href="#files">Advanced → Files</a>.</p>
729
+ <div class="choices four" id="g-theme"></div>
730
+ </div>
731
+ <div class="card">
732
+ <h2>Behavior</h2>
733
+ <div id="g-toggles"></div>
734
+ </div>
735
+ <div class="card">
736
+ <h2>Model</h2>
737
+ <div class="setting">
738
+ <label class="t" for="g-effort"><b>Thinking effort</b><span>How hard a thinking model thinks before it answers.</span></label>
739
+ <select id="g-effort"></select>
614
740
  </div>
615
- <div class="card">
616
- <h2>Thinking and context</h2>
617
- <div class="row">
618
- <div class="grow"><label class="f" for="g-effort">How hard a thinking model thinks</label><select id="g-effort"></select></div>
619
- <div class="grow"><label class="f" for="g-context">Context window (tokens)</label><input type="number" id="g-context" min="1" placeholder="as the model says"></div>
620
- </div>
621
- <div class="hint">Leave the context window empty unless HeartCode gets it wrong for your model.</div>
741
+ <div class="setting">
742
+ <label class="t" for="g-context"><b>Context window</b><span>How many tokens the model can hold. Leave it on auto unless HeartCode gets it wrong.</span></label>
743
+ <input type="number" id="g-context" min="1" placeholder="Auto">
622
744
  </div>
623
745
  </div>
624
- <div class="stack">
625
- <div class="card">
626
- <h2>Features</h2>
627
- <p class="sub">Switch each one on or off.</p>
628
- <div id="g-toggles"></div>
746
+ <div class="card">
747
+ <h2>Voice input</h2>
748
+ <p class="sub">Press Space in an empty input box (or type /voice), talk, and Enter. Your words land in the box.</p>
749
+ <div class="setting">
750
+ <label class="t" for="v-src"><b>Transcribe with</b><span id="v-src-about"></span></label>
751
+ <select id="v-src"></select>
629
752
  </div>
630
- <div class="card">
631
- <h2>Voice input</h2>
632
- <p class="sub">/voice in HeartCode. Empty: whisper-cli on this machine. Or a provider's transcription API: <span class="mono">{ "provider": "groq", "model": "whisper-large-v3" }</span>; add <span class="mono">"language": "auto"</span> for other languages.</p>
633
- <textarea id="v-text" spellcheck="false" rows="3" placeholder="(whisper-cli on this machine)"></textarea>
634
- <div class="actions"><button class="primary" id="v-save">Save voice</button></div>
753
+ <div class="setting">
754
+ <label class="t" for="v-model"><b>Model</b><span id="v-model-about"></span></label>
755
+ <input type="text" id="v-model" spellcheck="false" autocomplete="off">
635
756
  </div>
757
+ <div class="setting">
758
+ <label class="t" for="v-lang"><b>Language</b><span id="v-lang-about"></span></label>
759
+ <input type="text" id="v-lang" spellcheck="false" autocomplete="off">
760
+ </div>
761
+ </div>
762
+ <div class="card">
763
+ <h2>External tools</h2>
764
+ <p class="sub">Some features need a tool on your machine. Ready ones are ticked; the rest say what to install.</p>
765
+ <div id="g-caps"></div>
766
+ </div>
767
+ </div>
768
+ </section>
769
+
770
+ <!-- Status bar: visual drag-and-drop editor -->
771
+ <section class="page" id="page-statusbar">
772
+ <div class="head"><div><h1>Status bar</h1><p class="lead">The line(s) at the bottom of HeartCode. Drag items into each line, or onto the right to push them to the edge. Saved for next time; a running HeartCode updates right away.</p></div></div>
773
+ <div class="sb-wrap">
774
+ <div class="card">
775
+ <label class="opt sb-onoff">
776
+ <div class="t"><b>Show the status bar</b><span>Turn the whole thing on or off.</span></div>
777
+ <span id="sb-switch"></span>
778
+ </label>
779
+ <div class="sb-hint">Live preview</div>
780
+ <div class="sb-preview" id="sb-preview"></div>
781
+ </div>
782
+ <div class="card" id="sb-editor">
783
+ <div class="sb-cardhead">
784
+ <div><h2>Lines</h2><p class="sub">Drag an item from the palette into <b>Left</b> or <b>Right</b>. Drag chips to reorder or move between lines; the × removes one.</p></div>
785
+ <button id="sb-reset">Reset to default</button>
786
+ </div>
787
+ <div id="sb-lines"></div>
788
+ <div class="actions"><button id="sb-addline">+ Add a line</button></div>
789
+ </div>
790
+ <div class="card">
791
+ <h2>Items</h2>
792
+ <p class="sub">Drag any of these into a line above. Each one appears once it's placed.</p>
793
+ <div class="sb-palette" id="sb-palette"></div>
636
794
  </div>
637
795
  </div>
638
796
  </section>
@@ -657,7 +815,15 @@
657
815
 
658
816
  <!-- Skills -->
659
817
  <section class="page" id="page-skills">
660
- <div class="head"><div><h1>Skills</h1><p class="lead">Ready-made prompts. You type one as <span class="mono">/name</span>, or the model uses it when it fits.</p></div><button class="primary" id="k-new">+ New skill</button></div>
818
+ <div class="head"><div><h1>Skills</h1><p class="lead">Ready-made prompts. You type one as <span class="mono">/skill:name</span>, or the model uses it when it fits.</p></div><div class="head-actions"><button id="k-import">Import from other tools</button><button class="primary" id="k-new">+ New skill</button></div></div>
819
+ <div class="card" id="k-install-card">
820
+ <h2>Install from GitHub or a URL</h2>
821
+ <p class="sub">A GitHub repo (<span class="mono">owner/repo</span> or its link) or a link to a <span class="mono">SKILL.md</span>. Same as <span class="mono">/install_skill</span> in HeartCode; installed for every project.</p>
822
+ <div class="row">
823
+ <div class="grow"><input type="text" id="k-url" placeholder="owner/repo or https://github.com/owner/repo" spellcheck="false"></div>
824
+ <button class="primary" id="k-install">Install</button>
825
+ </div>
826
+ </div>
661
827
  <div class="md">
662
828
  <div class="list"><div class="items" id="k-items"></div></div>
663
829
  <div class="detail" id="k-detail"></div>
@@ -666,7 +832,7 @@
666
832
 
667
833
  <!-- Advanced files -->
668
834
  <section class="page" id="page-files">
669
- <div class="head"><div><h1>Advanced files</h1><p class="lead">The rest of HeartCode's settings, as the files they're kept in (<span class="mono" id="f-home"></span>). A JSON file that doesn't parse isn't saved; save one empty to delete it.</p></div></div>
835
+ <div class="head"><div><h1>Settings files</h1><p class="lead">The rest of HeartCode's settings, as the files they're kept in (<span class="mono" id="f-home"></span>). A JSON file that doesn't parse isn't saved; save one empty to delete it.</p></div></div>
670
836
  <div class="md">
671
837
  <div class="list"><div class="items" id="f-items"></div></div>
672
838
  <div class="detail" id="f-detail"></div>
@@ -718,6 +884,12 @@
718
884
  <div class="actions"><button id="c-cancel">Cancel</button><button class="primary" id="c-add">Add server</button></div>
719
885
  </dialog>
720
886
  <dialog id="k-form" aria-labelledby="k-title"></dialog>
887
+ <dialog id="imp" aria-labelledby="imp-title">
888
+ <h2 id="imp-title">Import from other coding tools</h2>
889
+ <p class="sub">Skills, commands, MCP servers, instructions and memory found in Claude Code, Cursor, Gemini CLI and Codex. Tick what to bring into HeartCode — nothing already here is overwritten.</p>
890
+ <div id="imp-list" class="imp-list"></div>
891
+ <div class="actions"><span class="spacer"></span><button id="imp-cancel" type="button">Cancel</button><button class="primary" id="imp-go" type="button">Import selected</button></div>
892
+ </dialog>
721
893
  <dialog id="gone" aria-labelledby="gone-title">
722
894
  <h2 id="gone-title">Disconnected</h2>
723
895
  <p class="sub">HeartCode's settings page was turned off, so nothing here can be changed or saved now.</p>
@@ -847,6 +1019,9 @@ const DOING = {
847
1019
  '/api/provider/list': 'Saving the model list setting',
848
1020
  '/api/provider/on': 'Switching the provider',
849
1021
  '/api/order': 'Saving your models',
1022
+ '/api/mcp/login': 'Signing in — your browser will open',
1023
+ '/api/telegram/connect': 'Checking the token with Telegram',
1024
+ '/api/telegram/test': 'Sending a test message',
850
1025
  '/api/models-dev': null, // its own strip
851
1026
  }
852
1027
  let acting = 0
@@ -904,12 +1079,13 @@ addEventListener('scroll', drawVirtual, { capture: true, passive: true }) // the
904
1079
  addEventListener('resize', drawVirtual)
905
1080
 
906
1081
  // pages: one at a time, from the address (#providers…)
907
- const PAGES = ['providers', 'models', 'general', 'logging', 'prompts', 'mcp', 'skills', 'files']
1082
+ const PAGES = ['providers', 'models', 'general', 'statusbar', 'notify', 'logging', 'prompts', 'mcp', 'skills', 'files']
908
1083
  const page = () => (PAGES.includes(location.hash.slice(1)) ? location.hash.slice(1) : 'providers')
909
1084
  function showPage() {
910
1085
  for (const p of PAGES) $('page-' + p).classList.toggle('on', p === page())
911
1086
  $('page-' + page()).querySelector('.head').after(document.querySelector('.job-slot[data-where="page"]')) // what's loading: under this page's title
912
- for (const a of document.querySelectorAll('nav a')) a.classList.toggle('on', a.dataset.page === page())
1087
+ for (const a of document.querySelectorAll('nav a')) a.classList.toggle('on', (a.dataset.tabs?.split(' ') ?? [a.dataset.page]).includes(page()))
1088
+ for (const a of document.querySelectorAll('.subtabs a')) a.classList.toggle('on', a.dataset.tab === page())
913
1089
  if (S) drawUsing(S)
914
1090
  if (page() === 'logging') drawDisk()
915
1091
  scrollTo(0, 0)
@@ -918,6 +1094,16 @@ function showPage() {
918
1094
  document.querySelector('nav a.on')?.scrollIntoView({ inline: 'center', block: 'nearest' }) // on a phone the pages scroll sideways
919
1095
  }
920
1096
  addEventListener('hashchange', showPage)
1097
+ // A sidebar item with several pages (data-tabs): a tab bar on top of each of them. Each page keeps
1098
+ // its own address (#providers, #statusbar, #files…), so links to one still open it.
1099
+ const TAB_NAMES = { models: 'Your list', providers: 'Providers', general: 'Settings', statusbar: 'Status bar', logging: 'Logs', files: 'Files' }
1100
+ const TAB_COUNTS = { providers: 'n-providers' } // a count shown on the tab, not the sidebar item
1101
+ for (const a of document.querySelectorAll('nav a[data-tabs]')) {
1102
+ const tabs = a.dataset.tabs.split(' ')
1103
+ for (const p of tabs) {
1104
+ $('page-' + p).prepend(h('div', { className: 'subtabs', role: 'tablist' }, tabs.map((t) => h('a', { href: '#' + t, role: 'tab', 'data-tab': t }, TAB_NAMES[t], TAB_COUNTS[t] ? h('span', { className: 'count', 'data-count': TAB_COUNTS[t] }) : null))))
1105
+ }
1106
+ }
921
1107
 
922
1108
  // A list on the left, the chosen one on the right (prompts, skills, files). Unsaved text in the
923
1109
  // editor is kept per item while you look at others, marked with a dot in the list.
@@ -1355,7 +1541,7 @@ function drawProviders(s) {
1355
1541
  catalogShape = shape
1356
1542
  markCatalog()
1357
1543
  $('m-search').placeholder = `Search ${Object.values(MODELS).reduce((n, m) => n + (m.list?.length ?? 0), 0) || 'all'} models…`
1358
- $('n-providers').textContent = s.providers.length || ''
1544
+ for (const el of document.querySelectorAll('[data-count="n-providers"]')) el.textContent = s.providers.length || ''
1359
1545
  }
1360
1546
  // Your models: pick one up (anywhere on it with a mouse, by its ⋮⋮ on a touch screen) and the
1361
1547
  // others move aside as it goes; let go and it's saved, already in its place (no jump when the
@@ -1945,11 +2131,90 @@ function drawGeneral(s) {
1945
2131
  put($('g-toggles'), Object.entries(s.choices.toggles).map(([k, d]) => h('label', { className: 'opt' },
1946
2132
  h('div', { className: 't' }, h('b', { textContent: TOGGLE_INFO[k] ?? k }), h('span', { textContent: d[0].toUpperCase() + d.slice(1) })),
1947
2133
  sw({ checked: s.settings[k], onchange: (e) => act('/api/setting', { name: k, value: e.target.checked }, `${TOGGLE_INFO[k] ?? k}: ${e.target.checked ? 'on' : 'off'}`) }))))
1948
- if (document.activeElement !== $('v-text')) $('v-text').value = s.voice
2134
+ drawVoice(s)
2135
+ put($('g-caps'), ...(s.capabilities || []).map((c) =>
2136
+ h('div', { className: 'cap' + (c.ok ? '' : ' cap-off') },
2137
+ h('div', { className: 'cap-h' }, h('span', { className: 'cap-mark', textContent: c.ok ? '✓' : '✗' }), h('b', { textContent: c.name }), h('span', { className: c.ok ? 'tag ok' : 'tag need', textContent: c.ok ? 'ready' : 'needs setup' })),
2138
+ h('div', { className: 'cap-what', textContent: c.what }),
2139
+ c.ok ? null : h('div', { className: 'cap-need' }, h('b', {}, 'Install: '), c.need))))
1949
2140
  }
1950
2141
  $('g-effort').onchange = (e) => act('/api/setting', { name: 'effort', value: e.target.value }, 'effort saved')
1951
2142
  $('g-context').onchange = (e) => act('/api/setting', { name: 'context', value: e.target.value.trim() ? Number(e.target.value) : null }, 'context window saved')
1952
- $('v-save').onclick = () => act('/api/voice', { text: $('v-text').value }, 'voice saved')
2143
+ // Voice: this machine (whisper-cli and a ggml model) or a provider's transcription API, a model and a
2144
+ // language: kept as config's "voice" ({ provider, model, language }; nothing set: this machine).
2145
+ function voiceNow() {
2146
+ try {
2147
+ return S?.voice ? JSON.parse(S.voice) : {}
2148
+ } catch {
2149
+ return {}
2150
+ }
2151
+ }
2152
+ function drawVoice(s) {
2153
+ const v = voiceNow()
2154
+ const names = (s.providers ?? []).map((p) => p.name)
2155
+ put($('v-src'), h('option', { value: '', textContent: 'This machine (whisper-cli)' }), names.map((n) => h('option', { value: n, textContent: `${n} (its transcription API)` })))
2156
+ $('v-src').value = v.provider && names.includes(v.provider) ? v.provider : ''
2157
+ const remote = Boolean($('v-src').value)
2158
+ $('v-src-about').textContent = remote ? 'Sent to that provider to turn into text: fast, needs its key.' : 'Runs on your computer: private, free, slower. Needs whisper-cli and a model.'
2159
+ $('v-model-about').textContent = remote ? 'Its speech-to-text model, like whisper-large-v3 (Groq) or whisper-1 (OpenAI).' : 'A whisper model file (ggml-….bin). Empty: the best one in ~/.whisper-models.'
2160
+ $('v-lang-about').textContent = remote ? 'What you speak, like en or bn. Empty: worked out from what you say.' : 'What you speak, like en or bn; auto works it out. Empty: English.'
2161
+ $('v-model').placeholder = remote ? 'whisper-large-v3' : 'auto'
2162
+ $('v-lang').placeholder = remote ? 'auto' : 'en'
2163
+ for (const [id, k] of [['v-model', 'model'], ['v-lang', 'language']]) if (document.activeElement !== $(id)) $(id).value = v[k] ?? ''
2164
+ }
2165
+ function saveVoice(what) {
2166
+ const v = { provider: $('v-src').value || undefined, model: $('v-model').value.trim() || undefined, language: $('v-lang').value.trim() || undefined }
2167
+ const set = Object.fromEntries(Object.entries(v).filter(([, x]) => x !== undefined))
2168
+ act('/api/voice', { text: Object.keys(set).length ? JSON.stringify(set) : '' }, what)
2169
+ }
2170
+ $('v-src').onchange = (e) => {
2171
+ $('v-model').value = '' // a local model's path means nothing to a provider, and the other way round
2172
+ saveVoice(`voice: ${e.target.value || 'this machine'}`)
2173
+ }
2174
+ $('v-model').onchange = () => saveVoice('voice model saved')
2175
+ $('v-lang').onchange = () => saveVoice('voice language saved')
2176
+
2177
+ // --- Notifications: Telegram set up in three steps (a bot from @BotFather, its token, Start in the
2178
+ // bot), then on/off, a test, and which events send one ---
2179
+ function drawNotify(s) {
2180
+ const t = s.telegram ?? { events: {}, names: {} }
2181
+ const tokenRow = (label) => h('div', { className: 'row', style: 'align-items:flex-end;gap:10px' },
2182
+ h('div', { className: 'grow' }, h('label', { className: 'f', for: 'tg-token', textContent: label }),
2183
+ h('input', { type: 'password', id: 'tg-token', autocomplete: 'off', spellcheck: false, placeholder: t.hint ? `saved: ${t.hint}` : '123456789:AAH…' })),
2184
+ h('button', { className: 'primary', type: 'button', textContent: 'Connect', onclick: tgConnect }))
2185
+ const typed = $('tg-token')?.value ?? '' // a redraw keeps what's being typed
2186
+ const focused = document.activeElement === $('tg-token')
2187
+ if (!t.connected) {
2188
+ put($('tg-setup'), h('ol', { className: 'tg-steps' },
2189
+ h('li', {}, 'In Telegram, open ', h('a', { href: 'https://t.me/BotFather', target: '_blank', rel: 'noopener', textContent: '@BotFather' }), ', send ', h('span', { className: 'mono', textContent: '/newbot' }), ', pick a name, and copy the token it gives you.'),
2190
+ h('li', {}, tokenRow('Paste the token here')),
2191
+ h('li', { className: t.bot ? '' : 'muted' }, t.bot ? ['Open ', h('a', { href: `https://t.me/${t.bot}`, target: '_blank', rel: 'noopener', textContent: `@${t.bot}` }), ' and press ', h('b', { textContent: 'Start' }), ' (or send it any message), then ', h('button', { className: 'small', type: 'button', textContent: 'Find my chat', onclick: () => tgConnect(true) })] : 'Then press Start in your bot, so HeartCode knows where to send.')))
2192
+ $('tg-token').value = typed
2193
+ if (focused) $('tg-token').focus()
2194
+ } else {
2195
+ put($('tg-setup'),
2196
+ h('div', { className: 'tg-conn' }, h('span', { className: 'tag ok', textContent: 'connected' }), h('span', {}, 'Sending to ', h('b', { textContent: t.chatName }), ' through ', h('a', { href: `https://t.me/${t.bot}`, target: '_blank', rel: 'noopener', textContent: `@${t.bot}` })), h('span', { className: 'mono muted', textContent: t.hint })),
2197
+ h('label', { className: 'opt' }, h('div', { className: 't' }, h('b', { textContent: 'Send notifications' }), h('span', { textContent: 'Off: nothing is sent, the setup stays.' })),
2198
+ sw({ checked: t.on, 'aria-label': 'Send notifications', onchange: (e) => act('/api/telegram/set', { on: e.target.checked }, `Telegram notifications: ${e.target.checked ? 'on' : 'off'}`) })),
2199
+ h('div', { className: 'actions' },
2200
+ h('button', { type: 'button', textContent: 'Send a test', onclick: () => act('/api/telegram/test', {}, 'Test sent: check Telegram') }),
2201
+ h('button', { className: 'ghost', type: 'button', textContent: 'Disconnect', onclick: () => confirm('Stop sending notifications to Telegram and forget the bot token?') && act('/api/telegram/remove', {}, 'Telegram disconnected') })))
2202
+ }
2203
+ put($('tg-events'), Object.entries(t.names ?? {}).map(([k, label]) => h('label', { className: 'opt' + (t.connected ? '' : ' tg-off') },
2204
+ h('div', { className: 't' }, h('b', { textContent: label }), h('span', { textContent: TG_EVENT_INFO[k] ?? '' })),
2205
+ sw({ checked: t.events?.[k] !== false, disabled: !t.connected, 'aria-label': label, onchange: (e) => act('/api/telegram/set', { event: k, value: e.target.checked }, `${label}: ${e.target.checked ? 'on' : 'off'}`) }))))
2206
+ }
2207
+ const TG_EVENT_INFO = {
2208
+ done: 'The task, how long it took, and the answer.',
2209
+ failed: 'The task and the error.',
2210
+ waiting: 'The question or permission it stopped at, so you can come back and answer.',
2211
+ }
2212
+ async function tgConnect(again = false) {
2213
+ const token = again === true ? '' : $('tg-token')?.value.trim()
2214
+ const r = await act('/api/telegram/connect', { token })
2215
+ if (!r) return
2216
+ toast(r.found ? `Connected: sending to ${r.found}` : r.telegram?.bot ? `Token works. Now press Start in @${r.telegram.bot}, then Find my chat` : 'Saved')
2217
+ }
1953
2218
 
1954
2219
  // --- Logging: the two switches, how much of each request; the requests logged (live) ---
1955
2220
  const logSwitch = (s, k, title, about) => h('label', { className: 'opt' },
@@ -2116,9 +2381,11 @@ $('c-add').onclick = async () => {
2116
2381
  $('c-open').onclick = () => ($('c-form').showModal(), $('c-name').focus())
2117
2382
  $('c-cancel').onclick = () => $('c-form').close()
2118
2383
  function drawMcp(s) {
2119
- put($('c-list'), h('h2', { textContent: 'Servers' }), h('p', { className: 'sub', textContent: 'Built in, and yours. Switch one off to keep it without using it.' }),
2384
+ const authTag = (a) => (a === 'in' ? h('span', { className: 'tag ok', textContent: 'signed in' }) : h('span', { className: 'tag need', textContent: 'sign-in needed' }))
2385
+ put($('c-list'), h('h2', { textContent: 'Servers' }), h('p', { className: 'sub', textContent: 'Built in, and yours. Remote ones (a URL) may need signing in; local ones don\'t. Switch one off to keep it without using it.' }),
2120
2386
  s.mcp.length ? s.mcp.map((m) => h('div', { className: 'opt' },
2121
- h('div', { className: 't' }, h('b', {}, m.name, ' ', h('span', { className: 'tag', textContent: m.from })), m.description ? h('span', { textContent: m.description }) : null, h('div', { className: 'mono muted', style: 'word-break:break-all;margin-top:3px', textContent: m.what })),
2387
+ h('div', { className: 't' }, h('b', {}, m.name, ' ', h('span', { className: 'tag', textContent: m.from }), m.remote ? authTag(m.auth) : null), m.description ? h('span', { textContent: m.description }) : null, h('div', { className: 'mono muted', style: 'word-break:break-all;margin-top:3px', textContent: m.what })),
2388
+ m.remote ? h('button', { className: 'small', textContent: m.auth === 'in' ? 'Sign in again' : 'Sign in', onclick: () => act('/api/mcp/login', { name: m.name }, `signed in to ${m.name}`) }) : null,
2122
2389
  m.from === 'yours' ? h('button', { className: 'small danger', textContent: 'Remove', onclick: () => confirm(`Remove the MCP server ${m.name}?`) && act('/api/mcp/remove', { name: m.name }, `removed ${m.name}`) }) : null,
2123
2390
  sw({ checked: m.on, 'aria-label': `${m.name} on`, onchange: (e) => act('/api/mcp/toggle', { name: m.name, on: e.target.checked }, `${m.name}: ${e.target.checked ? 'on' : 'off'}`) }))) : h('div', { className: 'empty', textContent: 'No MCP servers.' }))
2124
2391
  const f = s.files.find((x) => x.name === 'mcp.json')
@@ -2128,7 +2395,7 @@ function drawMcp(s) {
2128
2395
  }
2129
2396
 
2130
2397
  // --- skills: a form (name, who uses it, what it's for, the prompt); SKILL.md is made from it ---
2131
- const USES = [['both', 'You and the model', 'type /name, or the model uses it when it fits'], ['me', 'Only you', 'only when you type /name'], ['model', 'Only the model', "when it fits; you don't type it"]]
2398
+ const USES = [['both', 'You and the model', 'type /skill:name, or the model uses it when it fits'], ['me', 'Only you', 'only when you type /skill:name'], ['model', 'Only the model', "when it fits; you don't type it"]]
2132
2399
  function parseSkill(text) {
2133
2400
  const m = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(text)
2134
2401
  const out = { description: '', use: 'both', extra: [], body: (m ? m[2] : text).replace(/^\s*\n/, '') }
@@ -2169,30 +2436,84 @@ function skillForm(id, start, { isNew, readOnly }) {
2169
2436
  const uses = h('div', { className: 'choices' }, USES.map(([v, t, sub]) => h('label', { className: 'choice' + (d.use === v ? ' on' : '') },
2170
2437
  h('input', { type: 'radio', name: `use-${id}`, checked: d.use === v, disabled: readOnly, onchange: () => ((d.use = v), touch(), uses.querySelectorAll('.choice').forEach((c) => c.classList.toggle('on', c.querySelector('input').checked))) }),
2171
2438
  h('b', { textContent: t }), h('span', { textContent: sub }))))
2172
- const body = grow(h('textarea', { className: 'editor', spellcheck: false, readOnly, value: d.body, placeholder: 'What the model should do. $ARGUMENTS is what you type after /name: "/review the login page" gives "the login page".', oninput: (e) => ((d.body = e.target.value), touch()) }), 220)
2439
+ const body = grow(h('textarea', { className: 'editor', spellcheck: false, readOnly, value: d.body, placeholder: 'What the model should do. $ARGUMENTS is what you type after /skill:name: "/skill:review the login page" gives "the login page".', oninput: (e) => ((d.body = e.target.value), touch()) }), 220)
2173
2440
  return { d, el: [
2174
2441
  h('div', { className: 'row' },
2175
- isNew ? h('div', { className: 'grow' }, h('label', { className: 'f', textContent: "Name: you'll type /name" }), field('name', { placeholder: 'review' })) : null,
2442
+ isNew ? h('div', { className: 'grow' }, h('label', { className: 'f', textContent: "Name: you'll type /skill:name" }), field('name', { placeholder: 'review' })) : null,
2176
2443
  h('div', { className: 'grow', style: 'flex:3' }, h('label', { className: 'f', textContent: 'What it does (the model reads this to know when to use it)' }), field('description', { placeholder: 'Reviews the changes for bugs and unclear code' }))),
2177
2444
  h('label', { className: 'f', textContent: 'Who uses it' }), uses,
2178
2445
  h('label', { className: 'f', textContent: 'The prompt' }), body,
2179
2446
  ] }
2180
2447
  }
2448
+ // Import from other coding CLIs (/import): list what was found, grouped with checkboxes, then run the picks.
2449
+ async function openImport() {
2450
+ let r
2451
+ try {
2452
+ r = await api('/api/imports', {})
2453
+ } catch (e) {
2454
+ return toast(e.message, true)
2455
+ }
2456
+ const items = r.items || []
2457
+ if (!items.length) return toast('Nothing found in Claude Code, Cursor, Gemini CLI or Codex on this machine')
2458
+ const byGroup = {}
2459
+ for (const it of items) (byGroup[it.group] ??= []).push(it)
2460
+ put($('imp-list'), ...Object.entries(byGroup).map(([g, its]) =>
2461
+ h('div', { className: 'imp-group' },
2462
+ h('div', { className: 'imp-gh' }, h('label', {}, h('input', { type: 'checkbox', onchange: (e) => its.forEach((it) => ($('imp-cb-' + it.id).checked = e.target.checked)) }), ' ', g + ` (${its.length})`)),
2463
+ ...its.map((it) => h('label', { className: 'imp-row' }, h('input', { type: 'checkbox', id: 'imp-cb-' + it.id, value: it.id }), h('span', { className: 'imp-label', textContent: it.label }), h('span', { className: 'imp-desc', textContent: it.desc || '' }))))))
2464
+ $('imp-cancel').onclick = () => $('imp').close()
2465
+ $('imp-go').onclick = async () => {
2466
+ const ids = [...$('imp-list').querySelectorAll('input[type=checkbox][id^="imp-cb-"]:checked')].map((c) => Number(c.value))
2467
+ if (!ids.length) return toast('Nothing ticked', true)
2468
+ job('import', { where: ['page'], what: 'Importing', detail: `${ids.length} item${ids.length === 1 ? '' : 's'}` })
2469
+ try {
2470
+ const res = await api('/api/imports/run', { ids })
2471
+ $('imp').close()
2472
+ const ok = (res.results || []).filter((x) => x.ok).length
2473
+ toast(`Imported ${ok} of ${ids.length}`)
2474
+ render(res)
2475
+ } catch (e) {
2476
+ toast(e.message, true)
2477
+ } finally {
2478
+ job('import')
2479
+ }
2480
+ }
2481
+ $('imp').showModal()
2482
+ }
2483
+
2181
2484
  function drawSkills(s) {
2182
2485
  const mine = s.skills.filter((k) => k.mine)
2183
2486
  const theirs = s.skills.filter((k) => !k.mine)
2184
- const item = (k) => ({ id: k.name, title: '/' + k.name, sub: k.description, k })
2487
+ const item = (k) => ({ id: k.name, title: '/skill:' + k.name, sub: k.description, k })
2488
+ const install = async () => {
2489
+ const url = $('k-url').value.trim()
2490
+ if (!url) return toast('Enter a GitHub repo or a SKILL.md URL', true)
2491
+ job('kinstall', { where: ['page'], what: 'Installing the skill', detail: url })
2492
+ try {
2493
+ const r = await api('/api/skill/install', { url })
2494
+ $('k-url').value = ''
2495
+ toast(r.message || 'installed')
2496
+ render(r)
2497
+ } catch (e) {
2498
+ toast(e.message, true)
2499
+ } finally {
2500
+ job('kinstall')
2501
+ }
2502
+ }
2503
+ $('k-install').onclick = install
2504
+ $('k-url').onkeydown = (e) => e.key === 'Enter' && install()
2505
+ $('k-import').onclick = openImport
2185
2506
  masterDetail('skills', $('k-items'), $('k-detail'), [{ title: mine.length && theirs.length ? 'Yours' : '', items: mine.map(item) }, { title: 'From projects', items: theirs.map(item) }], (x) => {
2186
- if (!x) return h('div', { className: 'card' }, h('h2', { textContent: 'No skills yet' }), h('p', { className: 'sub', textContent: 'A skill is a prompt you use again and again, like "review this" or "write the release notes". Make one with + New skill, or bring them from Claude Code and others with /import in HeartCode.' }))
2507
+ if (!x) return h('div', { className: 'card' }, h('h2', { textContent: 'No skills yet' }), h('p', { className: 'sub', textContent: 'A skill is a prompt you use again and again, like "review this" or "write the release notes". Make one with + New skill, install one from GitHub above, or bring them from Claude Code and others with /import in HeartCode.' }))
2187
2508
  const k = x.k
2188
2509
  const f = skillForm(k.name, parseSkill(k.text), { readOnly: !k.mine })
2189
2510
  return h('div', { className: 'card' },
2190
- h('div', { className: 'row', style: 'justify-content:space-between;align-items:center' }, h('h2', { style: 'margin:0', className: 'mono', textContent: '/' + k.name }), k.mine ? null : h('span', { className: 'tag', textContent: 'from a project: read only' })),
2511
+ h('div', { className: 'row', style: 'justify-content:space-between;align-items:center' }, h('h2', { style: 'margin:0', className: 'mono', textContent: '/skill:' + k.name }), k.mine ? null : h('span', { className: 'tag', textContent: 'from a project: read only' })),
2191
2512
  f.el,
2192
2513
  k.mine ? h('div', { className: 'actions' },
2193
- h('button', { className: 'primary', textContent: 'Save', onclick: () => saveItem('skills', k.name, '/api/skill', { name: k.name, was: k.name, text: skillText(f.d) }, `saved /${k.name}`) }),
2514
+ h('button', { className: 'primary', textContent: 'Save', onclick: () => saveItem('skills', k.name, '/api/skill', { name: k.name, was: k.name, text: skillText(f.d) }, `saved /skill:${k.name}`) }),
2194
2515
  h('span', { className: 'spacer' }),
2195
- h('button', { className: 'danger', textContent: 'Delete', onclick: () => confirm(`Delete the skill /${k.name}?`) && saveItem('skills', k.name, '/api/skill/delete', { name: k.name }, `deleted /${k.name}`) })) : null)
2516
+ h('button', { className: 'danger', textContent: 'Delete', onclick: () => confirm(`Delete the skill /skill:${k.name}?`) && saveItem('skills', k.name, '/api/skill/delete', { name: k.name }, `deleted /skill:${k.name}`) })) : null)
2196
2517
  })
2197
2518
  $('n-skills').textContent = s.skills.length || ''
2198
2519
  }
@@ -2214,6 +2535,115 @@ function drawFiles(s) {
2214
2535
  })
2215
2536
  }
2216
2537
 
2538
+ // ---- Status bar: visual drag-and-drop editor ----
2539
+ let SB_ITEMS = [] // [{ id, label, sample }] from the server
2540
+ let sbOn = true // the bar shown at all
2541
+ let sbLines = [] // [{ left:[id…], right:[id…] }]
2542
+ let sbDrag = null // the chip being dragged: { id, from: 'palette' | { line, side, idx } }
2543
+ let sbSaveTimer = null
2544
+ const SB_DEFAULT = () => [
2545
+ { left: ['provider', 'model'], right: ['mode', 'thinking', 'images'] },
2546
+ { left: ['ctx', 'tps', 'autocompact'], right: ['permissions', 'worktree', 'cost'] },
2547
+ ]
2548
+ const sbLabel = (id) => (SB_ITEMS.find((i) => i.id === id) || {}).label || id
2549
+ const sbSample = (id) => (SB_ITEMS.find((i) => i.id === id) || {}).sample || id
2550
+ const sbUsed = () => new Set(sbLines.flatMap((l) => [...l.left, ...l.right]))
2551
+
2552
+ function drawStatusBar(s) {
2553
+ if (s.choices?.statusItems) SB_ITEMS = s.choices.statusItems
2554
+ const sb = s.statusBar
2555
+ if (sb === false) { sbOn = false; sbLines = SB_DEFAULT() }
2556
+ else if (Array.isArray(sb)) { sbOn = true; sbLines = sb.map((row) => (Array.isArray(row) ? { left: [...row], right: [] } : { left: [...(row.left || [])], right: [...(row.right || [])] })) }
2557
+ else { sbOn = true; sbLines = SB_DEFAULT() }
2558
+ if (!sbLines.length) sbLines = [{ left: [], right: [] }]
2559
+ put($('sb-switch'), sw({ checked: sbOn, onchange: (e) => { sbOn = e.target.checked; sbRenderAll(); sbSave() } }))
2560
+ $('sb-reset').onclick = () => { sbOn = true; sbLines = SB_DEFAULT(); sbRenderAll(); sbSave() }
2561
+ $('sb-addline').onclick = () => { sbLines.push({ left: [], right: [] }); sbRenderAll(); sbSave() }
2562
+ sbRenderAll()
2563
+ }
2564
+
2565
+ function sbRenderAll() {
2566
+ $('sb-editor').classList.toggle('sb-off', !sbOn)
2567
+ sbRenderLines()
2568
+ sbRenderPalette()
2569
+ sbRenderPreview()
2570
+ }
2571
+
2572
+ function sbChip(id, from) {
2573
+ const chip = h('span', {
2574
+ className: 'sb-chip', draggable: true,
2575
+ ondragstart: (e) => { sbDrag = { id, from }; chip.classList.add('sb-dragging'); e.dataTransfer.effectAllowed = 'move'; e.dataTransfer.setData('text/plain', id) },
2576
+ ondragend: () => { chip.classList.remove('sb-dragging'); sbDrag = null },
2577
+ }, h('span', { textContent: sbLabel(id) }))
2578
+ if (from !== 'palette') chip.append(h('button', { className: 'sb-x', title: 'Remove', textContent: '×', onclick: () => { sbLines[from.line][from.side].splice(from.idx, 1); sbRenderAll(); sbSave() } }))
2579
+ return chip
2580
+ }
2581
+
2582
+ function sbDropIndex(zone, e) { // where in the zone the drop lands, by the cursor's x
2583
+ const chips = [...zone.querySelectorAll('.sb-chip')]
2584
+ for (let i = 0; i < chips.length; i++) { const r = chips[i].getBoundingClientRect(); if (e.clientX < r.left + r.width / 2) return i }
2585
+ return chips.length
2586
+ }
2587
+
2588
+ function sbZone(lineIdx, side) {
2589
+ const items = sbLines[lineIdx][side]
2590
+ const zone = h('div', { className: 'sb-zone' }, h('span', { className: 'sb-ztag', textContent: side === 'left' ? 'Left' : 'Right' }),
2591
+ ...(items.length ? items.map((id, i) => sbChip(id, { line: lineIdx, side, idx: i })) : [h('span', { className: 'sb-drop', textContent: 'drop here' })]))
2592
+ zone.addEventListener('dragover', (e) => { e.preventDefault(); zone.classList.add('sb-over') })
2593
+ zone.addEventListener('dragleave', () => zone.classList.remove('sb-over'))
2594
+ zone.addEventListener('drop', (e) => {
2595
+ e.preventDefault(); zone.classList.remove('sb-over')
2596
+ if (!sbDrag) return
2597
+ let at = sbDropIndex(zone, e)
2598
+ const dest = sbLines[lineIdx][side]
2599
+ if (sbDrag.from !== 'palette') {
2600
+ const src = sbLines[sbDrag.from.line][sbDrag.from.side]
2601
+ src.splice(sbDrag.from.idx, 1) // take it out of where it was
2602
+ if (src === dest && sbDrag.from.idx < at) at-- // same zone, removed before the insert point
2603
+ if (!dest.includes(sbDrag.id)) dest.splice(at, 0, sbDrag.id)
2604
+ } else if (!sbUsed().has(sbDrag.id)) dest.splice(at, 0, sbDrag.id) // from the palette, if not already placed
2605
+ sbDrag = null
2606
+ sbRenderAll(); sbSave()
2607
+ })
2608
+ return zone
2609
+ }
2610
+
2611
+ function sbRenderLines() {
2612
+ put($('sb-lines'), ...sbLines.map((_, i) => h('div', { className: 'sb-line' },
2613
+ h('span', { className: 'sb-no', textContent: String(i + 1) }),
2614
+ sbZone(i, 'left'), sbZone(i, 'right'),
2615
+ h('button', { className: 'sb-del', title: 'Remove this line', textContent: '🗑', onclick: () => { sbLines.splice(i, 1); if (!sbLines.length) sbLines = [{ left: [], right: [] }]; sbRenderAll(); sbSave() } }))))
2616
+ }
2617
+
2618
+ function sbRenderPalette() {
2619
+ const used = sbUsed()
2620
+ const pal = $('sb-palette')
2621
+ put(pal, ...SB_ITEMS.map((it) => { const chip = sbChip(it.id, 'palette'); if (used.has(it.id)) chip.classList.add('sb-used'); return chip }))
2622
+ pal.ondragover = (e) => { if (sbDrag && sbDrag.from !== 'palette') e.preventDefault() } // drop a placed chip here to remove it
2623
+ pal.ondrop = (e) => { if (sbDrag && sbDrag.from !== 'palette') { e.preventDefault(); sbLines[sbDrag.from.line][sbDrag.from.side].splice(sbDrag.from.idx, 1); sbDrag = null; sbRenderAll(); sbSave() } }
2624
+ }
2625
+
2626
+ function sbRenderPreview() {
2627
+ const box = $('sb-preview')
2628
+ if (!sbOn) return put(box, h('span', { className: 'sb-empty', textContent: '(the status bar is off)' }))
2629
+ const lines = sbLines.filter((l) => l.left.length || l.right.length)
2630
+ if (!lines.length) return put(box, h('span', { className: 'sb-empty', textContent: '(no items — the bar will be empty)' }))
2631
+ const sepJoin = (ids) => ids.flatMap((id, i) => [i ? h('span', { className: 'sb-sep', textContent: ' │ ' }) : null, document.createTextNode(sbSample(id))].filter(Boolean))
2632
+ put(box, ...lines.map((l) => (l.right.length
2633
+ ? h('div', { className: 'sb-row' }, h('span', { className: 'sb-grow' }, ...sepJoin(l.left)), h('span', {}, ...sepJoin(l.right)))
2634
+ : h('div', { className: 'sb-row' }, ...sepJoin(l.left)))))
2635
+ }
2636
+
2637
+ function sbPayload() {
2638
+ if (!sbOn) return false
2639
+ const lines = sbLines.map((l) => ({ left: l.left, right: l.right })).filter((l) => l.left.length || l.right.length)
2640
+ return lines.length ? lines : false
2641
+ }
2642
+ function sbSave() {
2643
+ clearTimeout(sbSaveTimer)
2644
+ sbSaveTimer = setTimeout(() => api('/api/statusbar', { statusBar: sbPayload() }).catch((e) => toast(e.message, true)), 350)
2645
+ }
2646
+
2217
2647
  function render(s) {
2218
2648
  if (s.prefs) {
2219
2649
  // the page's choices, as kept (also changed on another page: shown here too)
@@ -2234,6 +2664,8 @@ function render(s) {
2234
2664
  drawMine(s)
2235
2665
  drawUsing(s)
2236
2666
  drawGeneral(s)
2667
+ drawStatusBar(s)
2668
+ drawNotify(s)
2237
2669
  drawLogging(s)
2238
2670
  if (REQS) drawReqs()
2239
2671
  drawPrompts(s)