heartcode 0.1.44 → 0.1.54
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/CHANGELOG.md +243 -0
- package/README.md +147 -126
- package/SKILL.md +16 -18
- package/bin/heartcode.js +65 -62
- package/package.json +2 -2
- package/prompts/README.md +1 -1
- package/prompts/agent.md +249 -352
- package/prompts/compact.md +24 -45
- package/prompts/guided.md +43 -67
- package/prompts/tests.md +15 -0
- package/src/acp.js +1 -1
- package/src/agent.js +91 -81
- package/src/check.js +411 -0
- package/src/client.js +21 -37
- package/src/config.js +10 -1
- package/src/guided.js +13 -12
- package/src/headless.js +28 -2
- package/src/log.js +1 -1
- package/src/mcp.js +30 -21
- package/src/prompts.js +1 -0
- package/src/reset.js +1 -1
- package/src/sessions.js +56 -17
- package/src/settings.html +296 -154
- package/src/settings.js +108 -43
- package/src/skills.js +42 -7
- package/src/tabs.js +1 -1
- package/src/tools.js +40 -29
- package/src/ui.js +126 -30
package/src/settings.html
CHANGED
|
@@ -138,6 +138,34 @@
|
|
|
138
138
|
.md .it .d { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
139
139
|
.md .detail { min-width: 0; }
|
|
140
140
|
.md.solo { grid-template-columns: minmax(0, 1fr); } /* nothing to list: the panel gets the width */
|
|
141
|
+
/* Skills: install in one line; the panel's title with its tags, where it lives, and a folder skill's files */
|
|
142
|
+
.k-install { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px 12px 10px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
|
|
143
|
+
.k-install-l { font-size: 13px; font-weight: 600; white-space: nowrap; }
|
|
144
|
+
.k-install input { flex: 1; min-width: 0; height: 34px; }
|
|
145
|
+
.md.fill .detail > .k-card > :not(textarea.editor) { flex-shrink: 0; } /* only the prompt gives or takes room */
|
|
146
|
+
.k-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
147
|
+
.k-head h2 { margin: 0 6px 0 0; font-size: 16px; }
|
|
148
|
+
.k-path { margin: 4px 0 6px; font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
149
|
+
textarea.k-about { width: 100%; resize: vertical; font: inherit; font-size: 13.5px; line-height: 1.5; }
|
|
150
|
+
#k-form .row { align-items: flex-start; } /* name and description side by side, labels in line */
|
|
151
|
+
.k-use-about { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
|
|
152
|
+
.md .it .t .tag { flex: none; white-space: nowrap; }
|
|
153
|
+
.k-files { margin-top: 12px; font-size: 13px; color: var(--muted); }
|
|
154
|
+
.k-files summary { cursor: pointer; }
|
|
155
|
+
.k-files ul { margin: 8px 0 0; padding: 8px 12px; list-style: none; columns: 2 220px; column-gap: 24px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); font-size: 12px; }
|
|
156
|
+
.k-files li { break-inside: avoid; padding: 1px 0; }
|
|
157
|
+
/* System prompt: a bar (the kinds, search, yours only), the list, and a panel in labelled parts */
|
|
158
|
+
.r-bar { flex-wrap: wrap; padding: 8px 10px; }
|
|
159
|
+
.r-bar input[type=search] { flex: 1; min-width: 180px; height: 34px; }
|
|
160
|
+
.r-bar .seg { max-width: 100%; overflow-x: auto; }
|
|
161
|
+
.r-bar .seg label { white-space: nowrap; gap: 6px; }
|
|
162
|
+
.r-count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
|
|
163
|
+
.r-bar .seg .dot { margin: 0; }
|
|
164
|
+
.r-about { margin: 0; font-size: 13.5px; line-height: 1.55; max-width: 90ch; }
|
|
165
|
+
.r-vars { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
166
|
+
.r-var { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
|
|
167
|
+
.r-card .k-use-about { min-height: 1.5em; }
|
|
168
|
+
.r-card textarea.editor { min-height: 200px; }
|
|
141
169
|
.md.solo .list { display: none; }
|
|
142
170
|
.md.solo .detail > .card { height: auto !important; }
|
|
143
171
|
/* a long list (the prompts): list and editor fill the screen's height, like an editor app */
|
|
@@ -207,7 +235,7 @@
|
|
|
207
235
|
.cap-what { color: var(--muted); font-size: 12.5px; margin: 4px 0 0 26px; text-wrap: pretty; }
|
|
208
236
|
.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); }
|
|
209
237
|
.cap-need b { color: var(--muted); }
|
|
210
|
-
.tag.brand { background: var(--accent-soft); color: var(--accent); }
|
|
238
|
+
.tag.brand { background: var(--accent-soft); color: var(--accent); padding: 0 7px; display: inline-block; } /* not the logo's .brand (its phone padding) */
|
|
211
239
|
.tag.ok { background: var(--ok-soft); color: var(--ok); }
|
|
212
240
|
.tag.err { background: var(--err-soft); color: var(--err); }
|
|
213
241
|
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
|
|
@@ -278,13 +306,13 @@
|
|
|
278
306
|
.mtable li.off > :not(.grip, input, button) { opacity: .45; }
|
|
279
307
|
.prov-h .by-name input { width: 190px; height: 28px; padding: 0 9px; font-size: 12px; font-family: var(--mono); background: transparent; }
|
|
280
308
|
.prov-h .by-name button, .prov-h > button.small { height: 28px; }
|
|
309
|
+
dialog#gone { width: min(560px, 92vw); }
|
|
310
|
+
dialog#gone h2 { color: var(--err); font-family: inherit; font-size: 18px; }
|
|
311
|
+
dialog#gone::backdrop { background: rgba(0, 0, 0, .75); }
|
|
281
312
|
.hello-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
|
|
282
313
|
.hello-cols pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; line-height: 1.55; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: 55vh; overflow: auto; }
|
|
283
314
|
#hello-status.ok { color: var(--ok); }
|
|
284
315
|
#hello-status.bad { color: var(--err); }
|
|
285
|
-
dialog#gone { width: min(560px, 92vw); }
|
|
286
|
-
dialog#gone h2 { color: var(--err); font-family: inherit; font-size: 18px; }
|
|
287
|
-
dialog#gone::backdrop { background: rgba(0, 0, 0, .75); }
|
|
288
316
|
@media (max-width: 860px) { .hello-cols { grid-template-columns: 1fr; } }
|
|
289
317
|
#hellos-list { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
|
|
290
318
|
#hellos-list button { display: flex; justify-content: flex-start; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 10px 14px; font-size: 12.5px; font-weight: 400; }
|
|
@@ -385,7 +413,21 @@
|
|
|
385
413
|
.mt-top .chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); border-radius: 8px; padding: 1px 3px 1px 9px; margin: 2px 4px 2px 0; color: var(--text); font-size: 12.5px; }
|
|
386
414
|
.mt-top .chip button { border: 0; background: none; padding: 0 4px; font-size: 12px; color: var(--muted); }
|
|
387
415
|
.mt-scroll { overflow-x: auto; }
|
|
388
|
-
|
|
416
|
+
/* wider than its box: a fade on the side with more columns, and arrows kept in view at the bottom */
|
|
417
|
+
.mt-scrollbox { position: relative; }
|
|
418
|
+
.mt-scrollbox::before, .mt-scrollbox::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40px; pointer-events: none; z-index: 3; opacity: 0; transition: opacity .2s; }
|
|
419
|
+
.mt-scrollbox::before { left: 0; background: linear-gradient(to right, var(--panel), transparent); }
|
|
420
|
+
.mt-scrollbox::after { right: 0; background: linear-gradient(to left, var(--panel), transparent); }
|
|
421
|
+
.mt-scrollbox.more-left::before, .mt-scrollbox.more-right::after { opacity: 1; }
|
|
422
|
+
.mt-more { position: sticky; bottom: 16px; z-index: 4; height: 0; display: flex; justify-content: flex-end; padding-right: 172px; pointer-events: none; } /* left of the rows' Test · Request · Edit · ✕ */
|
|
423
|
+
.mt-more-pill { display: none; align-items: center; gap: 4px; height: 34px; padding: 0 4px; margin-top: -50px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); box-shadow: var(--shadow-pop); font-size: 12px; color: var(--muted); pointer-events: auto; }
|
|
424
|
+
.mt-scrollbox.more-left .mt-more-pill, .mt-scrollbox.more-right .mt-more-pill { display: flex; }
|
|
425
|
+
.mt-more-pill span { padding: 0 4px; white-space: nowrap; }
|
|
426
|
+
.mt-more-pill button { all: unset; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 18px; line-height: 1; color: var(--text); cursor: pointer; }
|
|
427
|
+
.mt-more-pill button:hover:not(:disabled) { background: var(--hover); }
|
|
428
|
+
.mt-more-pill button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
429
|
+
.mt-more-pill button:disabled { color: var(--faint); cursor: default; }
|
|
430
|
+
.mt, .mt-h.mt-hpick { min-width: 1310px; } /* the columns below, their gaps and padding: the header, the selection bar and the rows line up (the rows are drawn a screenful at a time, so this can't come from them) */
|
|
389
431
|
.mt-h input[type=checkbox], .mtable input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); cursor: pointer; }
|
|
390
432
|
.mtable li.picked { background: var(--brand-soft); }
|
|
391
433
|
.mt-rules { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 24px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
|
|
@@ -407,7 +449,7 @@
|
|
|
407
449
|
.pill .again:hover:not(:disabled) { color: var(--text); }
|
|
408
450
|
.pill.on { border-color: var(--accent); background: var(--accent-soft); }
|
|
409
451
|
.pill.on .again { border-left-color: color-mix(in srgb, var(--accent) 40%, transparent); }
|
|
410
|
-
.mt-h, .mtable li { display: grid; grid-template-columns: 14px 18px
|
|
452
|
+
.mt-h, .mtable li { display: grid; grid-template-columns: 14px 18px 40px minmax(200px, 1fr) 104px 62px 46px 66px 56px 76px 76px 76px 112px 86px 124px; /* the last: Test · Request · Edit · ✕, as wide as they are */ align-items: center; column-gap: 6px; padding: 8px 18px; }
|
|
411
453
|
.mt-h button.mid, .mtable .mid { text-align: center; }
|
|
412
454
|
.mt-h > :nth-child(14), .mtable .try { padding-left: 12px; } /* Works?: a little room after the right-aligned price */
|
|
413
455
|
.mtable li .acts { justify-content: flex-start; }
|
|
@@ -428,10 +470,6 @@
|
|
|
428
470
|
.mtable:not(.drag) .grip { visibility: hidden; }
|
|
429
471
|
.mtable .n { font-weight: 650; color: var(--faint); }
|
|
430
472
|
.mtable li:first-child .n { color: var(--accent); }
|
|
431
|
-
.mtable .rk { color: var(--muted); }
|
|
432
|
-
.mtable .rk b { color: var(--text); font-weight: 600; margin-right: 5px; }
|
|
433
|
-
.mtable .rk.top b { color: inherit; }
|
|
434
|
-
.mtable .rk.top { color: var(--ok); font-weight: 600; }
|
|
435
473
|
.mtable .m { font-family: var(--mono); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
436
474
|
.mtable .p { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
437
475
|
.mtable .yes { color: var(--ok); }
|
|
@@ -441,14 +479,18 @@
|
|
|
441
479
|
.mtable button { padding: 2px 8px; font-size: 11.5px; border-color: transparent; background: transparent; color: var(--muted); }
|
|
442
480
|
.mtable li:hover button, .mtable li.picked button { border-color: var(--line-strong); background: var(--panel); color: var(--text); }
|
|
443
481
|
.mtable li:hover button.danger { color: var(--err); }
|
|
482
|
+
@keyframes pulse { 50% { opacity: .45; } }
|
|
444
483
|
.mtable .try { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
445
484
|
.mtable .try .msg { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
446
485
|
.mtable .try.ok { color: var(--ok); }
|
|
447
486
|
.mtable .try.bad { color: var(--err); }
|
|
448
487
|
.mtable .try.going { color: var(--warn); }
|
|
449
488
|
.mtable .try.going .msg { animation: pulse 1.4s ease-in-out infinite; }
|
|
450
|
-
@keyframes pulse { 50% { opacity: .45; } }
|
|
451
489
|
@media (prefers-reduced-motion: reduce) { .mtable .try.going .msg { animation: none; } }
|
|
490
|
+
.mtable .rk { color: var(--muted); }
|
|
491
|
+
.mtable .rk b { color: var(--text); font-weight: 600; margin-right: 5px; }
|
|
492
|
+
.mtable .rk.top b { color: inherit; }
|
|
493
|
+
.mtable .rk.top { color: var(--ok); font-weight: 600; }
|
|
452
494
|
.mt-empty { padding: 28px 18px; color: var(--muted); }
|
|
453
495
|
.olist .grip { cursor: grab; color: var(--faint); padding: 0 2px; user-select: none; }
|
|
454
496
|
.olist .n { font-weight: 800; color: var(--brand); min-width: 24px; }
|
|
@@ -497,41 +539,43 @@
|
|
|
497
539
|
/* a sort being applied: its header spins, the table dims */
|
|
498
540
|
#mt.sorting { opacity: .55; transition: opacity .1s; pointer-events: none; }
|
|
499
541
|
button.sorting::after { content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 6px; vertical-align: -1px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; }
|
|
500
|
-
.sort-live { color: var(--warn); }
|
|
501
542
|
/* Your models: the header's buttons, the list's settings, the toolbar (sticky), the table */
|
|
502
543
|
.mt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
503
|
-
.mt-sets { display: flex; flex-
|
|
544
|
+
.mt-sets { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 12px 18px 4px; } /* with the filters below: one toolbar, 8px between its two lines */
|
|
545
|
+
.mt-mode-sets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
|
|
504
546
|
.mt-set { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
505
547
|
.mt-setl { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
|
|
506
548
|
.mt-setc { display: flex; align-items: center; gap: 8px; }
|
|
507
549
|
.mt-setc select { width: auto; min-width: 0; height: 34px; padding-top: 0; padding-bottom: 0; line-height: 32px; }
|
|
508
|
-
.mt-setc input[type=number] { width:
|
|
509
|
-
.mt-setc input.tries { width:
|
|
550
|
+
.mt-setc input[type=number] { width: 56px; height: 34px; }
|
|
551
|
+
.mt-setc input.tries { width: 56px; }
|
|
552
|
+
.mt-setc input[type=number] { appearance: textfield; -moz-appearance: textfield; text-align: center; } /* typed: no spinner taking the digits' room */
|
|
553
|
+
.mt-setc input[type=number]::-webkit-inner-spin-button, .mt-setc input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
|
|
510
554
|
.mt-setc .unit { color: var(--muted); font-size: 13px; }
|
|
511
555
|
.mt-sets + .mt-tools { border-radius: 0; }
|
|
512
|
-
.mt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px
|
|
556
|
+
.mt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 18px 12px; }
|
|
513
557
|
.mt-row .mt-filters, .mt-row .f-togs { display: contents; } /* filters, toggles and buttons flow as one line, wrapping only when it's full */
|
|
514
|
-
.mt-row .f-search { flex: 1 1
|
|
558
|
+
.mt-row .f-search { flex: 1 1 140px; min-width: 130px; }
|
|
515
559
|
.mt-line { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; font-size: 13px; color: var(--muted); }
|
|
516
560
|
.mt-line .count { white-space: nowrap; }
|
|
517
561
|
.mt-sets[inert], .mt-row[inert], .mt-hwrap[inert], .mt-actions[inert] { opacity: .5; transition: opacity .15s; }
|
|
518
|
-
.mt-row[inert] .sort-live { opacity: 1; }
|
|
519
562
|
.mt-line .count b { color: var(--text); }
|
|
520
563
|
.mt-hpick .mt-pickbar { grid-column: 3 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
|
|
521
564
|
.mt-hpick { background: var(--brand-soft); }
|
|
522
|
-
.mt-h.mt-hpick .mt-pickbar button { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--panel) !important; color: var(--text); font-size: 12.5px; font-weight: 500; }
|
|
523
|
-
.mt-h.mt-hpick .mt-pickbar button:hover { background: var(--hover) !important; }
|
|
524
|
-
.mt-h.mt-hpick .mt-pickbar button.danger { color: var(--err); }
|
|
525
|
-
.mt-h.mt-hpick .mt-pickbar button.ghost { border-color: transparent; background: transparent !important; color: var(--muted); }
|
|
565
|
+
.mt-h.mt-hpick .mt-pickbar > button, .mt-h.mt-hpick .mt-pickbar > .tmenu > button { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--panel) !important; color: var(--text); font-size: 12.5px; font-weight: 500; }
|
|
566
|
+
.mt-h.mt-hpick .mt-pickbar > button:hover, .mt-h.mt-hpick .mt-pickbar > .tmenu > button:hover { background: var(--hover) !important; }
|
|
567
|
+
.mt-h.mt-hpick .mt-pickbar > button.danger, .mt-h.mt-hpick .mt-pickbar > .tmenu > button.danger { color: var(--err); }
|
|
568
|
+
.mt-h.mt-hpick .mt-pickbar > button.ghost, .mt-h.mt-hpick .mt-pickbar > .tmenu > button.ghost { border-color: transparent; background: transparent !important; color: var(--muted); }
|
|
526
569
|
.mt-h.mt-hpick .mt-pickbar b { margin-right: 4px; }
|
|
527
570
|
.mt-tools { position: sticky; top: 0; z-index: 6; background: var(--panel); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
|
|
528
571
|
.mt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 18px 10px; }
|
|
529
572
|
.f-search { position: relative; flex: 1 1 0; min-width: 170px; display: block; } /* the room the others leave: one line */
|
|
530
573
|
.f-search .f-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-52%); color: var(--faint); font-size: 16px; pointer-events: none; }
|
|
531
574
|
.mt-filters .f-text { width: 100%; height: 34px; padding-left: 32px; }
|
|
532
|
-
.mt-filters select { height: 34px; width: auto; padding-top: 0; padding-bottom: 0; line-height: 32px; }
|
|
575
|
+
.mt-filters select { height: 34px; width: auto; max-width: 118px; text-overflow: ellipsis; padding-top: 0; padding-bottom: 0; line-height: 32px; }
|
|
533
576
|
.mt-filters select.on { border-color: var(--accent); background-color: color-mix(in srgb, var(--accent-soft) 50%, var(--input)); }
|
|
534
577
|
.f-togs { display: inline-flex; gap: 6px; flex-wrap: wrap; }
|
|
578
|
+
.mcp-flags { display: flex; margin-top: 8px; } .mcp-flags .f-tog { height: 30px; font-size: 12px; }
|
|
535
579
|
.mt-tools .mt-outcomes { border-bottom: 0; border-top: 1px solid var(--line); padding: 9px 18px; }
|
|
536
580
|
.mt-hwrap { overflow: hidden; border-top: 1px solid var(--line); }
|
|
537
581
|
.mt-hwrap .mt-h { border-bottom: 0; }
|
|
@@ -550,7 +594,10 @@
|
|
|
550
594
|
.mtable li .acts button.danger:hover:not(:disabled) { color: var(--err); }
|
|
551
595
|
.f-tog { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 13px; cursor: pointer; user-select: none; }
|
|
552
596
|
.f-tog:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--panel)); }
|
|
553
|
-
.f-tog input { margin: 0;
|
|
597
|
+
.f-tog input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; } /* the pill is the switch; the box stays for the keyboard */
|
|
598
|
+
.f-tog:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
599
|
+
.f-tog { position: relative; color: var(--muted); }
|
|
600
|
+
.f-tog:has(input:checked) { color: var(--text); }
|
|
554
601
|
.mt-filters .f-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
|
|
555
602
|
.mt-filters.on .f-count { color: var(--text); font-weight: 600; }
|
|
556
603
|
.test-wait { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
|
|
@@ -628,6 +675,7 @@
|
|
|
628
675
|
.split > .side { position: static; order: -1; }
|
|
629
676
|
.md { grid-template-columns: 280px minmax(0, 1fr); }
|
|
630
677
|
}
|
|
678
|
+
@media (max-width: 600px) { .mt-tools { position: static; } } /* a phone: too tall to stay in sight, it scrolls with the page (a narrow window keeps it in sight) */
|
|
631
679
|
@media (max-width: 860px) {
|
|
632
680
|
.app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; } /* the bar on top keeps its height; the page gets the rest */
|
|
633
681
|
aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px 8px; }
|
|
@@ -637,7 +685,6 @@
|
|
|
637
685
|
nav a.on::before { display: none; } /* a strip of tabs: the highlighted one is enough */
|
|
638
686
|
nav a .count, .using, .nav-group { display: none; }
|
|
639
687
|
.theme-btn { top: 10px; right: 12px; }
|
|
640
|
-
.mt-tools { position: static; } /* a phone: too tall to stay in sight, it scrolls with the page */
|
|
641
688
|
.mt-line { width: 100%; }
|
|
642
689
|
.mt-line button.primary { margin-left: auto; }
|
|
643
690
|
main { padding: 20px 16px 60px; }
|
|
@@ -649,7 +696,7 @@
|
|
|
649
696
|
.grid, .cols { grid-template-columns: 1fr; }
|
|
650
697
|
.md { grid-template-columns: 1fr; }
|
|
651
698
|
.md .list { position: static; max-height: 300px; }
|
|
652
|
-
.md.fill .list { height: auto !important; max-height: 300px; }
|
|
699
|
+
.md.fill .list, .md.fill:not(.tabs) .list { height: auto !important; max-height: 300px; }
|
|
653
700
|
.md.fill .detail > .card { height: auto; }
|
|
654
701
|
.md.fill .detail > .card > textarea.editor { min-height: 260px; }
|
|
655
702
|
.prov-head, .prov-body { padding-left: 14px; padding-right: 14px; }
|
|
@@ -953,9 +1000,14 @@
|
|
|
953
1000
|
|
|
954
1001
|
<!-- System prompt and the other prompts -->
|
|
955
1002
|
<section class="page" id="page-prompts">
|
|
956
|
-
<div class="head"><div><h1>System prompt</h1><p class="lead">What HeartCode tells the model
|
|
1003
|
+
<div class="head"><div><h1>System prompt</h1><p class="lead">What HeartCode tells the model: the system prompt, and the notes and replies it adds as it works. Saved changes are used from the next message.</p></div></div>
|
|
1004
|
+
<div class="k-install r-bar">
|
|
1005
|
+
<div class="seg" id="r-kinds" role="radiogroup" aria-label="Kind of prompt"></div>
|
|
1006
|
+
<input type="search" id="r-search" placeholder="Search all prompts" aria-label="Search all prompts">
|
|
1007
|
+
<label class="f-tog" title="Only the prompts you changed"><input type="checkbox" id="r-mine">Changed by you</label>
|
|
1008
|
+
</div>
|
|
957
1009
|
<div class="md">
|
|
958
|
-
<div class="list"><div class="
|
|
1010
|
+
<div class="list"><div class="items" id="r-items"></div></div>
|
|
959
1011
|
<div class="detail" id="r-detail"></div>
|
|
960
1012
|
</div>
|
|
961
1013
|
</section>
|
|
@@ -972,13 +1024,10 @@
|
|
|
972
1024
|
<!-- Skills -->
|
|
973
1025
|
<section class="page" id="page-skills">
|
|
974
1026
|
<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>
|
|
975
|
-
<div class="
|
|
976
|
-
<
|
|
977
|
-
<
|
|
978
|
-
<
|
|
979
|
-
<div class="grow"><input type="text" id="k-url" placeholder="owner/repo or https://github.com/owner/repo" spellcheck="false"></div>
|
|
980
|
-
<button class="primary" id="k-install">Install</button>
|
|
981
|
-
</div>
|
|
1027
|
+
<div class="k-install" id="k-install-card" title="A GitHub repo (owner/repo or its link) or a link to a SKILL.md. Same as /install_skill in HeartCode; installed for every project.">
|
|
1028
|
+
<span class="k-install-l">Install a skill</span>
|
|
1029
|
+
<input type="text" id="k-url" placeholder="owner/repo, a GitHub link, or a SKILL.md link" spellcheck="false" aria-label="GitHub repo or SKILL.md link">
|
|
1030
|
+
<button class="primary" id="k-install">Install</button>
|
|
982
1031
|
</div>
|
|
983
1032
|
<div class="md">
|
|
984
1033
|
<div class="list"><div class="items" id="k-items"></div></div>
|
|
@@ -1029,9 +1078,8 @@
|
|
|
1029
1078
|
</dialog>
|
|
1030
1079
|
<dialog id="c-form" aria-labelledby="c-title">
|
|
1031
1080
|
<h2 id="c-title">Add a server</h2>
|
|
1032
|
-
<p class="sub">The command that starts it on this machine, or the URL of a remote one (a sign-in page opens if it needs one).</p>
|
|
1081
|
+
<p class="sub">The command that starts it on this machine, or the URL of a remote one (a sign-in page opens if it needs one). Its name comes from the command; its flags can be ticked on and off in the list.</p>
|
|
1033
1082
|
<div class="row">
|
|
1034
|
-
<div style="width:200px"><label class="f" for="c-name">Name</label><input type="text" id="c-name" placeholder="github"></div>
|
|
1035
1083
|
<div><label class="f">Kind</label><div class="seg" id="c-kind">
|
|
1036
1084
|
<label class="on"><input type="radio" name="c-kind" value="command" checked>Command</label><label><input type="radio" name="c-kind" value="url">URL</label>
|
|
1037
1085
|
</div></div>
|
|
@@ -1186,7 +1234,7 @@ const TITLE_ICONS = [
|
|
|
1186
1234
|
// Icons put where they belong, as things are drawn (one pass: a button or title that has one is left alone)
|
|
1187
1235
|
function decorate(root = document.body) {
|
|
1188
1236
|
for (const b of root.querySelectorAll('button:not([data-ic])')) {
|
|
1189
|
-
if (b.closest('.acts, .mt-h:not(.mt-hpick), .chip, .pill, .seg, .subtabs, .theme-btn, .f-tog, .sw, nav, [data-no-ic]') || b.querySelector('.icon')) continue
|
|
1237
|
+
if (b.closest('.acts, .mt-h:not(.mt-hpick), .chip, .pill, .seg, .subtabs, .theme-btn, .f-tog, .sw, nav, .md .it, .r-var, [data-no-ic]') || b.querySelector('.icon')) continue
|
|
1190
1238
|
const text = b.textContent.trim()
|
|
1191
1239
|
const hit = BUTTON_ICONS.find(([re]) => re.test(text))
|
|
1192
1240
|
if (!hit || text.length < 3) continue
|
|
@@ -1301,7 +1349,6 @@ const DOING = {
|
|
|
1301
1349
|
'/api/provider/list': 'Saving the model list setting',
|
|
1302
1350
|
'/api/provider/on': 'Switching the provider',
|
|
1303
1351
|
'/api/order': 'Saving your models',
|
|
1304
|
-
'/api/orchestrators': 'Saving the orchestrators',
|
|
1305
1352
|
'/api/mcp/login': 'Signing in — your browser will open',
|
|
1306
1353
|
'/api/telegram/connect': 'Checking the token with Telegram',
|
|
1307
1354
|
'/api/telegram/test': 'Sending a test message',
|
|
@@ -1394,7 +1441,7 @@ for (const a of document.querySelectorAll('nav a[data-tabs]')) {
|
|
|
1394
1441
|
// editor is kept per item while you look at others, marked with a dot in the list.
|
|
1395
1442
|
const DRAFTS = { prompts: {}, skills: {}, files: {} }
|
|
1396
1443
|
const SEL = { prompts: 'agent/system', skills: null, files: null }
|
|
1397
|
-
function masterDetail(kind, itemsEl, detailEl, groups, draw) {
|
|
1444
|
+
function masterDetail(kind, itemsEl, detailEl, groups, draw, opts = {}) {
|
|
1398
1445
|
const all = groups.flatMap((g) => g.items)
|
|
1399
1446
|
if (!all.some((x) => x.id === SEL[kind])) SEL[kind] = all[0]?.id ?? null
|
|
1400
1447
|
// the list: built when its items change; otherwise each item is updated in place (the chosen
|
|
@@ -1413,10 +1460,10 @@ function masterDetail(kind, itemsEl, detailEl, groups, draw) {
|
|
|
1413
1460
|
const x = byId.get(b.dataset.id)
|
|
1414
1461
|
b.className = 'it' + (x.id === SEL[kind] ? ' on' : '')
|
|
1415
1462
|
put(b, inside(x))
|
|
1416
|
-
b.onclick = () => ((SEL[kind] = x.id), masterDetail(kind, itemsEl, detailEl, groups, draw))
|
|
1463
|
+
b.onclick = () => ((SEL[kind] = x.id), masterDetail(kind, itemsEl, detailEl, groups, draw, opts))
|
|
1417
1464
|
}
|
|
1418
1465
|
itemsEl.closest('.md').classList.toggle('solo', !all.length) // nothing to list: no list column
|
|
1419
|
-
itemsEl.closest('.md').classList.toggle('tabs', all.length > 0 && all.length <= 8) // a few: tabs on top
|
|
1466
|
+
itemsEl.closest('.md').classList.toggle('tabs', opts.tabs !== false && all.length > 0 && all.length <= 8) // a few: tabs on top (unless the page wants its list on the left)
|
|
1420
1467
|
put(detailEl, draw(all.find((x) => x.id === SEL[kind])))
|
|
1421
1468
|
itemsEl.closest('.md').classList.add('fill')
|
|
1422
1469
|
fillHeight()
|
|
@@ -1555,7 +1602,7 @@ $('p-save').onclick = async () => {
|
|
|
1555
1602
|
closeForm()
|
|
1556
1603
|
document.querySelector(`[data-provider="${added.name}"]`)?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
1557
1604
|
}
|
|
1558
|
-
|
|
1605
|
+
$('c-what').addEventListener('keydown', (e) => e.key === 'Enter' && $('c-add').click())
|
|
1559
1606
|
for (const id of ['p-name', 'p-url', 'p-key']) $(id).addEventListener('keydown', (e) => e.key === 'Enter' && $('p-save').click())
|
|
1560
1607
|
|
|
1561
1608
|
// model names in a natural order: "glm-5.2" before "glm-5.10", case doesn't matter
|
|
@@ -1643,7 +1690,7 @@ const MEANS = {
|
|
|
1643
1690
|
503: '503: the model or provider is unavailable now',
|
|
1644
1691
|
504: '504: the provider timed out',
|
|
1645
1692
|
empty: 'it answered, but with no text at all',
|
|
1646
|
-
'no answer': 'no answer within the test timeout (
|
|
1693
|
+
'no answer': 'no answer within the test timeout (Tests wait, above the list)',
|
|
1647
1694
|
failed: 'it failed without a status code (a lost connection, an unreadable reply…)',
|
|
1648
1695
|
}
|
|
1649
1696
|
// What a test came to, in a word: works, its status code (402, 429…), empty, no answer or failed;
|
|
@@ -1655,7 +1702,8 @@ function triedCell(t) {
|
|
|
1655
1702
|
const secs = (r?.ms != null ? ` · ${(r.ms / 1000).toFixed(1)}s` : '') + (r?.at ? ` · tested ${new Date(r.at).toLocaleString()}` : '')
|
|
1656
1703
|
const [cls, text, about] = !r ? ['', 'not tested', 'send it a short message to see that it really answers (your key, access to it, its name)']
|
|
1657
1704
|
: r.going ? ['going', 'testing…', 'sending it a short message']
|
|
1658
|
-
: r.ok ? ['ok', `✓ ${(r.ms / 1000).toFixed(1)}s`, `
|
|
1705
|
+
: r.ok && r.toolsOk === false ? ['ok', `✓ ${(r.ms / 1000).toFixed(1)}s · ✗ tools`, `it answers ("${r.reply}"), but it couldn't do a small job with a tool, so it's a poor choice for work: ${r.toolsWhy}${secs}`]
|
|
1706
|
+
: r.ok ? ['ok', `✓ ${(r.ms / 1000).toFixed(1)}s`, `works: it answered "${r.reply}"${r.toolsOk ? ', and did a small job with a tool' : ''}${secs}`]
|
|
1659
1707
|
: ['bad', `✗ ${outcome(r)}`, `doesn't work: ${r.error}${secs}`] // the reason on hover
|
|
1660
1708
|
return h('div', { className: 'try ' + cls }, h('span', { className: 'msg', textContent: text, title: about }))
|
|
1661
1709
|
}
|
|
@@ -1672,6 +1720,11 @@ let mineFrame = 0
|
|
|
1672
1720
|
// And never while the mouse button is down: a click's press and release then land on the same button.
|
|
1673
1721
|
let mineLast = 0
|
|
1674
1722
|
let pressed = false
|
|
1723
|
+
addEventListener('pointerdown', () => (pressed = true), true)
|
|
1724
|
+
for (const ev of ['pointerup', 'pointercancel']) addEventListener(ev, () => {
|
|
1725
|
+
pressed = false
|
|
1726
|
+
if (drawAfterPress) (drawAfterPress = false), setTimeout(mineSoon, 0) // after the click it finishes
|
|
1727
|
+
}, true)
|
|
1675
1728
|
let drawAfterPress = false
|
|
1676
1729
|
addEventListener('pointerdown', () => (pressed = true), true)
|
|
1677
1730
|
for (const ev of ['pointerup', 'pointercancel']) addEventListener(ev, () => {
|
|
@@ -1730,15 +1783,15 @@ function showRun(run) {
|
|
|
1730
1783
|
} else
|
|
1731
1784
|
job('test-all', {
|
|
1732
1785
|
where: ['table'],
|
|
1733
|
-
what: run.stopping ? 'Stopping the tests…' : `Testing ${run.
|
|
1786
|
+
what: run.stopping ? 'Stopping the tests…' : `Testing ${run.total} model${run.total === 1 ? '' : 's'}`,
|
|
1734
1787
|
done: run.done, total: run.total, stopping: run.stopping,
|
|
1735
|
-
detail: [h('span', { className: 'ok', textContent: `✓ ${run.good} work` }), ' · ', h('span', { className: 'bad', textContent: `✗ ${run.done - run.good} don't` })
|
|
1788
|
+
detail: [h('span', { className: 'ok', textContent: `✓ ${run.good} work` }), ' · ', h('span', { className: 'bad', textContent: `✗ ${run.done - run.good} don't` })],
|
|
1736
1789
|
stop: () => api('/api/tests/stop', {}).catch((e) => toast(e.message, true)),
|
|
1737
1790
|
})
|
|
1738
1791
|
mineSoon()
|
|
1739
1792
|
}
|
|
1740
1793
|
|
|
1741
|
-
// models.dev looked up again: one model (its Retry), or all of yours with their
|
|
1794
|
+
// models.dev looked up again: one model (its Retry), or all of yours with their rankings (Update model info)
|
|
1742
1795
|
const retry = (t) => h('button', { className: 'small', textContent: 'Retry', title: 'look it up in models.dev again', onclick: (e) => (e.stopPropagation(), lookUp(t)) })
|
|
1743
1796
|
async function lookUp(t) {
|
|
1744
1797
|
job('models.dev', { where: ['catalog', 'table'], what: t ? `Looking up ${t.model} in models.dev` : 'Updating your models: models.dev and LMArena', detail: t ? 'context, tool calls, thinking, images' : 'context, tool calls, thinking, images, price; scores' })
|
|
@@ -1746,7 +1799,7 @@ async function lookUp(t) {
|
|
|
1746
1799
|
const [r, scored] = await Promise.all([act('/api/models-dev', t ? { provider: t.provider, model: t.model } : {}), t ? null : act('/api/rankings', {})])
|
|
1747
1800
|
if (!t) (lookingUp = false), mineSoon()
|
|
1748
1801
|
job('models.dev')
|
|
1749
|
-
if (r) toast(t ? (r.found ? `${t.model}: found in models.dev` : `${t.model}: still not in models.dev`) : `models.dev: ${r.found} of ${r.of} found${scored ? ' ·
|
|
1802
|
+
if (r) toast(t ? (r.found ? `${t.model}: found in models.dev` : `${t.model}: still not in models.dev`) : `models.dev: ${r.found} of ${r.of} found${scored ? ' · rankings updated' : ''}`)
|
|
1750
1803
|
return r
|
|
1751
1804
|
}
|
|
1752
1805
|
|
|
@@ -1878,11 +1931,11 @@ function drawProviders(s) {
|
|
|
1878
1931
|
].map(([t, d, cls], i) => h('div', { className: 'step ' + cls }, h('span', { className: 'num', textContent: cls === 'done' ? '✓' : i + 1 }), h('div', {}, h('b', { textContent: t }), d))))
|
|
1879
1932
|
$('steps').hidden = order.length > 0 // the first start only
|
|
1880
1933
|
$('p-work').hidden = none
|
|
1881
|
-
// your list, at the top: how many, and the way to its page (order,
|
|
1934
|
+
// your list, at the top: how many, and the way to its page (the order, what to do when one fails)
|
|
1882
1935
|
const shown = shownOrder()
|
|
1883
1936
|
$('p-mine').hidden = !shown.length
|
|
1884
1937
|
$('p-mine').textContent = `Your models (${shown.length}) →`
|
|
1885
|
-
$('p-mine').title = shown.length ?
|
|
1938
|
+
$('p-mine').title = shown.length ? `HeartCode uses ${shown[0].provider} · ${shown[0].model}. Open the Your models page: the order, and what happens when one fails` : ''
|
|
1886
1939
|
fillHeight()
|
|
1887
1940
|
|
|
1888
1941
|
// every provider's models, A to Z; one click adds it (the first one becomes #1). Built
|
|
@@ -2041,6 +2094,7 @@ function canCell(d, mine) {
|
|
|
2041
2094
|
const text = [can, priceText(price)].filter(Boolean).join(' · ')
|
|
2042
2095
|
return text ? h('span', { className: 'can', textContent: text }) : null
|
|
2043
2096
|
}
|
|
2097
|
+
// every model added to a provider by name forgotten; the ones in your list leave it too
|
|
2044
2098
|
// Test on a model's row: "Hello" sent to it (by the server), and the request and the answer shown.
|
|
2045
2099
|
// r: an answer already had (from Test on the ticked ones): shown, not sent again.
|
|
2046
2100
|
let helloOf = null
|
|
@@ -2245,15 +2299,6 @@ function buildCatalog(s) {
|
|
|
2245
2299
|
}
|
|
2246
2300
|
// --- Your models page: the list as a table; sorted by several columns at once (each a tie-break
|
|
2247
2301
|
// for the ones before it), the sort kept in this browser ---
|
|
2248
|
-
// The orchestrators (Pick: "an orchestrator hands it out"): those picked that call tools; none: your first that does
|
|
2249
|
-
const leads = (s = S) => {
|
|
2250
|
-
const able = s.order.filter((t) => !isOff(t.provider) && can(t).tools)
|
|
2251
|
-
const picked = able.filter((t) => (s.orchestrators ?? []).some((o) => o.provider === t.provider && o.model === t.model))
|
|
2252
|
-
return picked.length ? picked : able.slice(0, 1)
|
|
2253
|
-
}
|
|
2254
|
-
const ORCH_ABOUT = 'Makes the selected models your orchestrators, in place of the ones you have now. Every message then goes to one of them first: it replies on its own when it can (a hello, a quick question), and hands real work to the other models it picks. They only orchestrate and do no work themselves. A model that can\'t call tools is skipped.'
|
|
2255
|
-
const isLead = (t) => leads().some((o) => o.provider === t.provider && o.model === t.model)
|
|
2256
|
-
const setLeads = (list, done) => act('/api/orchestrators', { list: list.map(({ provider, model }) => ({ provider, model })) }, done)
|
|
2257
2302
|
const can = (t) => ({ tools: t.tested ? t.tested.mode === 'tools' : t.known?.tools !== false, thinking: Boolean(t.tested ? t.tested.thinking : t.known?.thinking), images: Boolean(t.tested ? t.tested.vision : t.known?.images) })
|
|
2258
2303
|
// Every column sorts by the value it shows: up (↑) smallest first, down (↓) largest first. first: the
|
|
2259
2304
|
// direction of the first click (the useful one). get: the value; null when there's none (no price, no
|
|
@@ -2268,7 +2313,7 @@ const COLS = {
|
|
|
2268
2313
|
tools: { label: 'Tools', first: 'down', get: (t) => can(t).tools, words: ['without first', 'with first'] },
|
|
2269
2314
|
thinking: { label: 'Thinking', first: 'down', get: (t) => can(t).thinking, words: ['without first', 'with first'] },
|
|
2270
2315
|
images: { label: 'Images', first: 'down', get: (t) => can(t).images, words: ['without first', 'with first'] },
|
|
2271
|
-
// its place in
|
|
2316
|
+
// its place in LMArena's public ranking, by its share of the list: not ranked, last
|
|
2272
2317
|
...Object.fromEntries([['coding', 'Coding'], ['web', 'Web apps'], ['vision', 'Vision']].map(([k, label]) => [k, { label, first: 'up', get: (t) => (t.ranks?.[k] ? t.ranks[k].rank / t.ranks[k].of : null), words: ['best first', 'worst first'] }])),
|
|
2273
2318
|
input: { label: 'In $/M', first: 'up', get: (t) => t.price?.input ?? null, words: ['cheapest first', 'priciest first'] },
|
|
2274
2319
|
output: { label: 'Out $/M', first: 'up', get: (t) => t.price?.output ?? null, words: ['cheapest first', 'priciest first'] },
|
|
@@ -2376,7 +2421,7 @@ const setFilter = (change) => {
|
|
|
2376
2421
|
savePref('filters', FILTER)
|
|
2377
2422
|
drawMine(S)
|
|
2378
2423
|
}
|
|
2379
|
-
const CONTEXTS = [[0, '
|
|
2424
|
+
const CONTEXTS = [[0, 'Context'], [32_000, '32k+'], [128_000, '128k+'], [200_000, '200k+'], [1_000_000, '1M+']]
|
|
2380
2425
|
const clearView = () => {
|
|
2381
2426
|
SORT = []
|
|
2382
2427
|
savePref('sorts', SORT)
|
|
@@ -2392,7 +2437,7 @@ function filterBarOf(order, counts = {}) {
|
|
|
2392
2437
|
filterBar = h('div', { className: 'mt-filters' },
|
|
2393
2438
|
h('label', { className: 'f-search' },
|
|
2394
2439
|
h('span', { className: 'f-icon', 'aria-hidden': 'true', textContent: '⌕' }),
|
|
2395
|
-
h('input', { type: 'search', className: 'f-text', placeholder: 'Search
|
|
2440
|
+
h('input', { type: 'search', className: 'f-text', placeholder: 'Search', 'aria-label': 'Search models and providers', oninput: (e) => (clearTimeout(typing), (typing = setTimeout(() => ((FILTER = { ...FILTER, text: e.target.value.trim() }), savePref('filters', FILTER), drawMine(S)), 150))) })),
|
|
2396
2441
|
h('select', { className: 'f-provider', 'aria-label': 'Filter by provider', onchange: (e) => setFilter({ provider: e.target.value }) }),
|
|
2397
2442
|
h('select', { className: 'f-works', 'aria-label': 'Filter by test result', onchange: (e) => setFilter({ works: e.target.value }) }),
|
|
2398
2443
|
h('select', { className: 'f-context', 'aria-label': 'Filter by context window', onchange: (e) => setFilter({ context: Number(e.target.value) }) },
|
|
@@ -2412,9 +2457,9 @@ function filterBarOf(order, counts = {}) {
|
|
|
2412
2457
|
if (sel.dataset.sig !== sig && !focused(sel)) (sel.dataset.sig = sig), put(sel, opts.map(([v, l]) => h('option', { value: v, textContent: l })))
|
|
2413
2458
|
if (!focused(sel)) sel.value = String(value)
|
|
2414
2459
|
}
|
|
2415
|
-
fill(bar.querySelector('.f-provider'), [['', '
|
|
2460
|
+
fill(bar.querySelector('.f-provider'), [['', 'Provider'], ...providers.map((p) => [p, p])], FILTER.provider)
|
|
2416
2461
|
const c = (k) => (counts[k] ? ` (${counts[k].toLocaleString()})` : ' (0)')
|
|
2417
|
-
fill(bar.querySelector('.f-works'), [['', '
|
|
2462
|
+
fill(bar.querySelector('.f-works'), [['', 'Result'], ['works', `✓ Works${c('works')}`], ['fails', `✗ Doesn't work${c('fails')}`], ['untested', `Not tested${c('untested')}`], ...results.map((o) => [o, ` ✗ ${o}${c(o)}`])], FILTER.works)
|
|
2418
2463
|
if (!focused(bar.querySelector('.f-context'))) bar.querySelector('.f-context').value = String(FILTER.context)
|
|
2419
2464
|
const text = bar.querySelector('.f-text')
|
|
2420
2465
|
if (!focused(text) && text.value.trim() !== FILTER.text) text.value = FILTER.text
|
|
@@ -2432,9 +2477,7 @@ function drawMine(s) {
|
|
|
2432
2477
|
const order = shownOrder() // a provider switched off: its models aren't shown (nor tested, sorted, ranked)
|
|
2433
2478
|
$('n-mine').textContent = order.length || ''
|
|
2434
2479
|
const shown = filtering() ? order.filter((t) => passes(t)) : order
|
|
2435
|
-
|
|
2436
|
-
const first = new Set(S.settings.modelChoice === 'fit' ? leads().map(keyOf) : [])
|
|
2437
|
-
const view = ((v) => (first.size ? [...v.filter((t) => first.has(keyOf(t))), ...v.filter((t) => !first.has(keyOf(t)))] : v))(sorted(shown))
|
|
2480
|
+
const view = sorted(shown)
|
|
2438
2481
|
const filtered = shown.length !== order.length
|
|
2439
2482
|
for (const k of PICKED) if (placeOf(...k.split(/\/(.*)/s)) === undefined) PICKED.delete(k) // gone from the list
|
|
2440
2483
|
const n = (x) => x.toLocaleString()
|
|
@@ -2476,52 +2519,49 @@ function drawMine(s) {
|
|
|
2476
2519
|
const pickedList = order.filter((t) => PICKED.has(keyOf(t)))
|
|
2477
2520
|
|
|
2478
2521
|
// --- the page's header: how a model is picked (left), what's known about the models (right) ---
|
|
2479
|
-
$('mt-lead').textContent =
|
|
2480
|
-
? 'An orchestrator answers each message at once, or hands the work to the models it picks from the others. To choose them, select models and press Mark as orchestrators (a quick, cheap model is enough).'
|
|
2481
|
-
: 'HeartCode uses #1, and the next one when it fails. Filter, sort or drag, then Save order.'
|
|
2522
|
+
$('mt-lead').textContent = 'The models HeartCode uses, in your order: #1 answers, the next one when it fails.'
|
|
2482
2523
|
const busy = locked()
|
|
2483
2524
|
$('mt-actions').inert = busy
|
|
2484
2525
|
put($('mt-actions'),
|
|
2485
2526
|
((why) => h('span', { title: why ?? '' }, h('button', { className: 'small', textContent: 'Order providers', disabled: Boolean(why), title: why ? '' : 'drag your providers into order; the Provider column sorts by it', onclick: openRanking })))( // disabled: why, on a span (a disabled button shows no tooltip in every browser)
|
|
2486
2527
|
!order.some((t) => t.provider !== order[0]?.provider) ? 'All your models are from one provider: nothing to order' : null),
|
|
2487
|
-
h('button', { className: 'small', textContent: 'Update model info', disabled: !order.length, title: `what each model can do (context, tools, thinking, images, price) from models.dev, and its
|
|
2528
|
+
h('button', { className: 'small', textContent: 'Update model info', disabled: !order.length, title: `what each model can do (context, tools, thinking, images, price) from models.dev, and its places in LMArena's public rankings (coding, web apps, vision${S.rankings ? `; rankings from ${new Date(S.rankings.fetched).toLocaleDateString()}` : ''})`, onclick: () => lookUp() }))
|
|
2488
2529
|
|
|
2489
2530
|
// --- the list's settings: one line, a short label beside each control ---
|
|
2490
2531
|
const ro = s.rotation
|
|
2491
2532
|
const cell = (label, about, ...control) => h('label', { className: 'mt-set', title: about }, h('span', { className: 'mt-setl', textContent: label }), h('span', { className: 'mt-setc' }, ...control))
|
|
2492
|
-
|
|
2533
|
+
// a whole number setting (seconds), with its limits from the server (SPEED_LIMITS)
|
|
2534
|
+
const LIMITS = { replyStart: [5, 600], replyIdle: [10, 1800] }
|
|
2535
|
+
const num = (name, label, said) => h('input', { type: 'number', className: 'tries', 'aria-label': label, min: LIMITS[name][0], max: LIMITS[name][1], value: S.settings[name], onchange: (e) => {
|
|
2536
|
+
const v = Math.round(Number(e.target.value))
|
|
2537
|
+
const [lo, hi] = LIMITS[name]
|
|
2538
|
+
if (!(v >= lo && v <= hi)) return (e.target.value = S.settings[name]), toast(`a whole number, ${lo} to ${hi}`, true)
|
|
2539
|
+
act('/api/setting', { name, value: v }, said(v))
|
|
2540
|
+
} })
|
|
2541
|
+
const secsCell = (label, name, about, unit, said) => cell(label, about, num(name, label, said), h('span', { className: 'unit', textContent: unit }))
|
|
2493
2542
|
const settings = h('div', { className: 'mt-sets', inert: busy },
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
h('select', { disabled: fit, onchange: (e) => saveOrder(S.order, 'saved', { next: e.target.value }) },
|
|
2511
|
-
[['first', '#1'], ['stay', 'the last that worked']].map(([v, t]) => h('option', { value: v, textContent: t, selected: ro.next === v })))),
|
|
2512
|
-
cell('Tests wait', 'every model test: Test, Test all, Request',
|
|
2513
|
-
h('input', { type: 'number', min: 1, max: 600, step: 1, value: S.settings.testTimeout ?? 10, 'aria-label': 'Test timeout in seconds', onchange: (e) => {
|
|
2514
|
-
const v = Math.round(Number(e.target.value))
|
|
2515
|
-
if (!(v >= 1 && v <= 600)) return (e.target.value = S.settings.testTimeout ?? 10), toast('a whole number of seconds, 1 to 600', true)
|
|
2516
|
-
act('/api/setting', { name: 'testTimeout', value: v }, `tests wait ${v} second${v === 1 ? '' : 's'} for an answer`)
|
|
2517
|
-
} }), h('span', { className: 'unit', textContent: 'seconds' })))
|
|
2543
|
+
h('div', { className: 'mt-mode-sets' },
|
|
2544
|
+
cell('If one fails', ro.on === 'retries' ? 'a rate limit or outage: that model is tried again that many times first; any other error moves on at once' : "any error moves on at once, to the next model (another provider's first)",
|
|
2545
|
+
h('select', { onchange: (e) => saveOrder(S.order, 'saved', { on: e.target.value }) },
|
|
2546
|
+
[['failure', 'go to the next'], ['retries', 'retry it first']].map(([v, t]) => h('option', { value: v, textContent: t, selected: ro.on === v }))),
|
|
2547
|
+
ro.on === 'retries' ? h('input', { type: 'number', className: 'tries', 'aria-label': 'tries', title: 'tries of the same model first (rate limits, outages)', min: 1, max: 20, value: ro.retries, onchange: (e) => saveOrder(S.order, 'saved', { retries: Number(e.target.value) }) }) : null),
|
|
2548
|
+
secsCell('Give up after', 'replyStart', "a model that hasn't started answering (text, thinking or a tool call) in this many seconds counts as failed", 'sec', (v) => `a model that hasn't started answering in ${v}s counts as failed`),
|
|
2549
|
+
secsCell('Stalled after', 'replyIdle', 'a reply that stops sending anything for this many seconds is stalled: tried again, or the next model', 'sec', (v) => `a reply silent for ${v}s counts as stalled`),
|
|
2550
|
+
cell('Tests wait', 'how long a test waits for each answer',
|
|
2551
|
+
h('input', { type: 'number', className: 'tries', min: 1, max: 600, step: 1, value: S.settings.testTimeout ?? 10, 'aria-label': 'Test timeout in seconds', onchange: (e) => {
|
|
2552
|
+
const v = Math.round(Number(e.target.value))
|
|
2553
|
+
if (!(v >= 1 && v <= 600)) return (e.target.value = S.settings.testTimeout ?? 10), toast('a whole number of seconds, 1 to 600', true)
|
|
2554
|
+
act('/api/setting', { name: 'testTimeout', value: v }, `tests wait ${v} second${v === 1 ? '' : 's'} for an answer`)
|
|
2555
|
+
} }), h('span', { className: 'unit', textContent: 'sec' })),
|
|
2556
|
+
cell('New message to', 'the model a new message goes to first',
|
|
2557
|
+
h('select', { onchange: (e) => saveOrder(S.order, 'saved', { next: e.target.value }) },
|
|
2558
|
+
[['first', '#1'], ['stay', 'the last that worked']].map(([v, t]) => h('option', { value: v, textContent: t, selected: ro.next === v }))))))
|
|
2518
2559
|
|
|
2519
2560
|
// --- beside the filters: what's shown · what you do with it (the sorts show in the column heads) ---
|
|
2520
2561
|
const line = h('div', { className: 'mt-line' },
|
|
2521
2562
|
h('span', { className: 'count', title: SORT.length ? `sorted by ${SORT.map(({ key, dir }) => `${COLS[key].label} ${COLS[key].words[dir === 'up' ? 0 : 1]}`).join(', then ')}; ties keep your order` : '' }, filtered ? [h('b', { textContent: n(shown.length) }), ` of ${n(order.length)}`] : [h('b', { textContent: n(order.length) }), ` model${order.length === 1 ? '' : 's'}`]),
|
|
2522
|
-
busy ? h('span', { className: 'sort-live', textContent: `${testingAll ? 'testing' : 'updating'}: filters and changes wait until it's done (or Stop)` }) : null,
|
|
2523
2563
|
filtering() || SORT.length ? h('button', { className: 'small ghost', textContent: 'Clear', title: 'every filter and the sort off: your whole list, in your order', onclick: clearView }) : null,
|
|
2524
|
-
h('button', { className: 'small', textContent: filtered ? `Test ${n(shown.length)}` : 'Test all', disabled: testingAll || !shown.length, title: `send ${filtered ? 'the models shown' : 'each model'} a short message to see which really answer`, onclick: () => tryAll(filtered ? shown : order) }),
|
|
2564
|
+
h('button', { className: 'small', textContent: filtered ? `Test ${n(shown.length)}` : 'Test all', disabled: testingAll || !shown.length, title: `send ${filtered ? 'the models shown' : 'each model'} a short message to see which really answer, and how fast`, onclick: () => tryAll(filtered ? shown : order) }),
|
|
2525
2565
|
h('button', { className: 'small primary', textContent: filtered ? `Use only these ${n(view.length)}` : 'Save order', disabled: !view.length || order.length < 2, title: filtered ? `HeartCode uses only these ${n(view.length)}, in the order shown (the others stay under Providers)` : S.settings.modelChoice === 'fit' ? 'keep the order shown: the orchestrator sees the others in this order, and a failed model goes to the next' : 'HeartCode uses them in the order shown (#1 first)', onclick: saveList }))
|
|
2526
2566
|
|
|
2527
2567
|
// --- the table ---
|
|
@@ -2537,13 +2577,7 @@ function drawMine(s) {
|
|
|
2537
2577
|
? h('div', { className: 'mt-h mt-hpick' }, h('span'), selectAll,
|
|
2538
2578
|
h('div', { className: 'mt-pickbar' },
|
|
2539
2579
|
h('b', { textContent: `${n(PICKED.size)} selected` }),
|
|
2540
|
-
h('button', { className: 'small', textContent: 'Test', disabled: testingAll, onclick: () => tryAll(pickedList) }),
|
|
2541
|
-
S.settings.modelChoice === 'fit' ? h('span', { className: 'with-q' }, h('button', { className: 'small', textContent: PICKED.size === 1 ? 'Mark as orchestrator' : 'Mark as orchestrators', title: ORCH_ABOUT, onclick: () => {
|
|
2542
|
-
const list = pickedList.filter((t) => can(t).tools)
|
|
2543
|
-
if (!list.length) return toast("none of these can call tools, and an orchestrator hands work out with a tool call", true)
|
|
2544
|
-
PICKED.clear()
|
|
2545
|
-
setLeads(list, `${list.length} orchestrator${list.length === 1 ? '' : 's'}: ${list.map((t) => t.model).join(', ')}`)
|
|
2546
|
-
} }), h('span', { className: 'q', tabIndex: 0, textContent: '?', title: ORCH_ABOUT, 'aria-label': 'what Mark as orchestrator does' })) : null,
|
|
2580
|
+
h('button', { className: 'small', textContent: 'Test', disabled: testingAll, title: 'send each a short message to see that it really answers', onclick: () => tryAll(pickedList) }),
|
|
2547
2581
|
h('button', { className: 'small danger', textContent: 'Remove', onclick: removePicked }),
|
|
2548
2582
|
h('button', { className: 'small ghost', textContent: 'Invert', title: "select the ones shown that aren't selected, unselect the ones that are", onclick: () => (view.forEach((t) => (PICKED.has(keyOf(t)) ? PICKED.delete(keyOf(t)) : PICKED.add(keyOf(t)))), (lastPicked = null), drawMine(S)) }),
|
|
2549
2583
|
h('button', { className: 'small ghost', textContent: 'Select none', onclick: () => (PICKED.clear(), drawMine(S)) })))
|
|
@@ -2583,8 +2617,14 @@ function drawMine(s) {
|
|
|
2583
2617
|
view.length ? h('div', { className: 'mt-hwrap', inert: busy }, header) : null)
|
|
2584
2618
|
: null,
|
|
2585
2619
|
order.length
|
|
2586
|
-
? h('div', { className: 'mt-
|
|
2587
|
-
|
|
2620
|
+
? h('div', { className: 'mt-scrollbox' },
|
|
2621
|
+
h('div', { className: 'mt-scroll', onscroll: (e) => { const hw = e.target.closest('.card')?.querySelector('.mt-hwrap'); if (hw) hw.scrollLeft = e.target.scrollLeft; sideways(e.target) } }, h('div', { className: 'mt' },
|
|
2622
|
+
table ?? empty('No model matches these filters. ', h('button', { type: 'button', className: 'small', textContent: 'Clear all', onclick: clearView })))),
|
|
2623
|
+
// more columns than fit: a fade on that side, and arrows that stay in view at the bottom
|
|
2624
|
+
h('div', { className: 'mt-more' }, h('div', { className: 'mt-more-pill' },
|
|
2625
|
+
h('button', { type: 'button', className: 'mt-more-l', 'aria-label': 'scroll the table left', title: 'more columns to the left', onclick: (e) => slide(e.currentTarget, -1) }, '‹'),
|
|
2626
|
+
h('span', { textContent: 'More columns' }),
|
|
2627
|
+
h('button', { type: 'button', className: 'mt-more-r', 'aria-label': 'scroll the table right', title: 'more columns to the right (or Shift + scroll, or swipe)', onclick: (e) => slide(e.currentTarget, 1) }, '›'))))
|
|
2588
2628
|
: empty('No models in your list yet. ', h('a', { href: '#providers', textContent: 'Choose some under Providers' }), '.'))
|
|
2589
2629
|
if (typing && document.activeElement !== typing) {
|
|
2590
2630
|
typing.focus({ preventScroll: true })
|
|
@@ -2592,7 +2632,22 @@ function drawMine(s) {
|
|
|
2592
2632
|
}
|
|
2593
2633
|
tableV?.draw()
|
|
2594
2634
|
sortable(tableV, move)
|
|
2595
|
-
|
|
2635
|
+
sidewaysSeen.disconnect() // the table just drawn replaces the last one: only it is watched
|
|
2636
|
+
for (const sc of $('mt').querySelectorAll('.mt-scroll')) sidewaysSeen.observe(sc) // shown (the page was hidden), resized: checked again
|
|
2637
|
+
}
|
|
2638
|
+
// The table wider than its box: which sides have more to see (a fade there, and the arrows on)
|
|
2639
|
+
function sideways(sc) {
|
|
2640
|
+
const box = sc.closest('.mt-scrollbox')
|
|
2641
|
+
if (!box) return
|
|
2642
|
+
const left = sc.scrollLeft > 2
|
|
2643
|
+
const right = sc.scrollLeft + sc.clientWidth < sc.scrollWidth - 2
|
|
2644
|
+
box.classList.toggle('more-left', left)
|
|
2645
|
+
box.classList.toggle('more-right', right)
|
|
2646
|
+
box.querySelector('.mt-more-l').disabled = !left
|
|
2647
|
+
box.querySelector('.mt-more-r').disabled = !right
|
|
2648
|
+
}
|
|
2649
|
+
const slide = (btn, dir) => { const sc = btn.closest('.mt-scrollbox').querySelector('.mt-scroll'); sc.scrollBy({ left: dir * Math.max(240, sc.clientWidth * 0.6), behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' }) }
|
|
2650
|
+
const sidewaysSeen = new ResizeObserver((seen) => seen.forEach((e) => sideways(e.target)))
|
|
2596
2651
|
// the table's cells: yes or no; where what it can do comes from
|
|
2597
2652
|
const yes = (v) => h('span', { className: (v ? 'yes' : 'no') + ' mid', textContent: v ? '✓' : '–' })
|
|
2598
2653
|
// its score and place in LMArena's ranking of that skill (#1 is the best of all models there); the top tenth stands out
|
|
@@ -2617,20 +2672,17 @@ function tableRow(t, at, pick) {
|
|
|
2617
2672
|
const ctx = COLS.context.get(t)
|
|
2618
2673
|
const picked = PICKED.has(keyOf(t))
|
|
2619
2674
|
const x = t.tested
|
|
2675
|
+
const going = Boolean(TRIES[keyOf(t)]?.going)
|
|
2620
2676
|
// where what it can do comes from, when that's worth a look: not known to models.dev (a guess), or set by you
|
|
2621
2677
|
const tag = !x ? h('span', { className: 'tag', textContent: '…', title: 'looking it up in models.dev' })
|
|
2622
2678
|
: x.source === 'assumed' ? h('button', { type: 'button', className: 'tag warn', textContent: 'unknown', title: "models.dev doesn't know it: what it can do is a guess. Click to set it up", onclick: () => openSetup(t) })
|
|
2623
2679
|
: Object.keys(x.set ?? {}).length ? h('button', { type: 'button', className: 'tag', textContent: 'edited', title: 'what it can do: set by you (click to change)', onclick: () => openSetup(t) }) : null
|
|
2624
|
-
const lead = S.settings.modelChoice === 'fit' && isLead(t) && (S.orchestrators ?? []).length
|
|
2625
|
-
? h('button', { type: 'button', className: 'tag brand', textContent: 'orchestrator ✕', title: 'An orchestrator: every message goes to it first, and it replies or hands the work out. Click to unmark it (it goes back to being one of the models that do the work)', onclick: () => setLeads(leads().filter((o) => o !== t), `${t.model}: not an orchestrator now`) })
|
|
2626
|
-
: S.settings.modelChoice === 'fit' && isLead(t) ? h('span', { className: 'tag brand', textContent: 'orchestrator', title: 'None are marked, so your first model that calls tools orchestrates. To choose them, select models and press Mark as orchestrators' }) : null
|
|
2627
|
-
const going = Boolean(TRIES[keyOf(t)]?.going)
|
|
2628
2680
|
const busy = locked()
|
|
2629
2681
|
return h('li', { className: 'in' + (picked ? ' picked' : '') + (isOff(t.provider) ? ' off' : ''), 'data-key': `${t.provider}/${t.model}`, title: isOff(t.provider) ? `${t.provider} is switched off: HeartCode skips this model until it's on` : '' },
|
|
2630
2682
|
h('span', { className: 'grip', textContent: '⋮⋮', 'aria-hidden': 'true' }),
|
|
2631
2683
|
h('input', { type: 'checkbox', checked: picked, disabled: busy, 'aria-label': `select ${t.model}`, title: 'select (Shift: and every row up to the last one selected)', onclick: (e) => (e.preventDefault(), pick(e)) }),
|
|
2632
2684
|
h('span', { className: 'n', textContent: `#${at + 1}`, title: SORT.length || filtering() ? 'its place in your list' : '' }),
|
|
2633
|
-
h('span', { className: 'm' }, h('span', { className: 'name', textContent: t.model, title: t.model }),
|
|
2685
|
+
h('span', { className: 'm' }, h('span', { className: 'name', textContent: t.model, title: t.model }), tag),
|
|
2634
2686
|
h('span', { className: 'p', textContent: isOff(t.provider) ? `${t.provider} · off` : t.provider, title: t.provider }),
|
|
2635
2687
|
h('span', { className: 'num', textContent: ctx ? `${t.tested?.sure === false ? '~' : ''}${kTok(ctx)}` : '–', title: ctx ? `${ctx.toLocaleString()} tokens${t.tested?.sure === false ? ' (assumed: the server and models.dev don\'t say)' : ''}` : '' }),
|
|
2636
2688
|
yes(c.tools), yes(c.thinking), yes(c.images),
|
|
@@ -2663,15 +2715,13 @@ function markCatalog() {
|
|
|
2663
2715
|
function drawUsing(s) {
|
|
2664
2716
|
const o = s.order.filter((t) => !isOff(t.provider))
|
|
2665
2717
|
$('using').hidden = page() === 'providers' // there it's on the page itself
|
|
2666
|
-
|
|
2667
|
-
put($('using'), o.length && fit ? [h('span', { className: 'k', textContent: 'Orchestrated by' }), h('b', { textContent: leads(s).map((t) => t.model).join(', ') || o[0].model }), h('span', { className: 'k', textContent: `with your ${o.length.toLocaleString()} model${o.length > 1 ? 's' : ''}` })]
|
|
2668
|
-
: o.length ? [h('span', { className: 'k', textContent: 'HeartCode uses' }), h('b', { textContent: o[0].model }), h('span', { className: 'k', textContent: `${o[0].provider}${o.length > 1 ? ` · ${o.length - 1} fallback${o.length > 2 ? 's' : ''}` : ''}` })] : s.order.length ? [h('span', { className: 'k', textContent: 'The providers of all your models are switched off' }), h('a', { href: '#providers', textContent: 'Switch one on' })] : [h('span', { className: 'k', textContent: 'No model chosen yet' }), h('a', { href: '#providers', textContent: 'Choose one' })])
|
|
2718
|
+
put($('using'), o.length ? [h('span', { className: 'k', textContent: 'HeartCode uses' }), h('b', { textContent: o[0].model }), h('span', { className: 'k', textContent: `${o[0].provider}${o.length > 1 ? ` · ${o.length - 1} fallback${o.length > 2 ? 's' : ''}` : ''}` })] : s.order.length ? [h('span', { className: 'k', textContent: 'The providers of all your models are switched off' }), h('a', { href: '#providers', textContent: 'Switch one on' })] : [h('span', { className: 'k', textContent: 'No model chosen yet' }), h('a', { href: '#providers', textContent: 'Choose one' })])
|
|
2669
2719
|
}
|
|
2670
2720
|
|
|
2671
2721
|
// --- General ---
|
|
2672
2722
|
const PERM_INFO = { all: ['Everything', 'Edits files and runs commands without asking'], commands: ['Edits only', 'Edits files; asks before running commands'], ask: ['Ask first', 'Asks before every edit and command'] }
|
|
2673
2723
|
const THEME_INFO = { dark: ["Your terminal's background", ['#1f2328', '#d4d4d8', '#ff6b9d', '#7aa2f7']], light: ['White background', ['#fafbfc', '#24292f', '#d6336c', '#0969da']], midnight: ['Deep blue background', ['#1a1b26', '#c0caf5', '#ff7ab2', '#7aa2f7']], mono: ['No colors: bold and dim', ['#000000', '#bbbbbb', '#ffffff', '#777777']] }
|
|
2674
|
-
const TOGGLE_INFO = { autoCompact: 'Compact long conversations', director: 'Let the model set things up', format: 'Format files after edits', lsp: 'Language server checks', updateCheck: 'Check for updates' }
|
|
2724
|
+
const TOGGLE_INFO = { autoCompact: 'Compact long conversations', director: 'Let the model set things up', format: 'Format files after edits', lsp: 'Language server checks', updateCheck: 'Check for updates', mouse: 'HeartCode takes the mouse' }
|
|
2675
2725
|
function choices(id, list, cur, name) {
|
|
2676
2726
|
put($(id), list.map(([v, title, desc, colors]) => h('label', { className: 'choice' + (v === cur ? ' on' : '') },
|
|
2677
2727
|
h('input', { type: 'radio', name: id, checked: v === cur, onchange: () => act('/api/setting', { name, value: v }, `${title}: saved`) }),
|
|
@@ -2681,7 +2731,7 @@ function choices(id, list, cur, name) {
|
|
|
2681
2731
|
function drawGeneral(s) {
|
|
2682
2732
|
choices('g-perm', ['all', 'commands', 'ask'].map((p) => [p, ...PERM_INFO[p]]), s.settings.permissions, 'permissions')
|
|
2683
2733
|
choices('g-theme', s.choices.theme.map((t) => [t, t[0].toUpperCase() + t.slice(1), ...(THEME_INFO[t] ?? ['', null])]), s.settings.theme, 'theme')
|
|
2684
|
-
put($('g-effort'), s.choices.effort.map((e) => h('option', { value: e, textContent: { default:
|
|
2734
|
+
put($('g-effort'), s.choices.effort.map((e) => h('option', { value: e, textContent: { default: 'Low (the default): a little thinking, shown as it comes', low: 'Low: quick, less thinking', medium: 'Medium', high: 'High: thinks the longest' }[e] ?? e })))
|
|
2685
2735
|
$('g-effort').value = s.settings.effort
|
|
2686
2736
|
if (document.activeElement !== $('g-context')) $('g-context').value = s.settings.context ?? ''
|
|
2687
2737
|
put($('g-toggles'), Object.entries(s.choices.toggles).map(([k, d]) => h('label', { className: 'opt' },
|
|
@@ -3052,28 +3102,99 @@ async function openReq(r) {
|
|
|
3052
3102
|
}
|
|
3053
3103
|
|
|
3054
3104
|
// --- prompts: a list, and the chosen one to edit ---
|
|
3105
|
+
// A prompt's note, split: what it's for (the words before its first "{{name}}: …"), and what each
|
|
3106
|
+
// {{placeholder}} it uses holds ("{{a}}, {{b}}: …" and "{{a}} and {{b}} are …" name several).
|
|
3107
|
+
function promptParts(p) {
|
|
3108
|
+
const defs = [...p.note.matchAll(/((?:\{\{\w+\}\}(?:,\s*|\s+(?:and|or)\s+)?)+)(:|\s+(?=are\b))\s*/g)]
|
|
3109
|
+
const about = (defs.length ? p.note.slice(0, defs[0].index) : p.note).replace(/\s+/g, ' ').trim()
|
|
3110
|
+
const said = new Map()
|
|
3111
|
+
defs.forEach((m, i) => {
|
|
3112
|
+
const text = p.note.slice(m.index + m[0].length, defs[i + 1]?.index ?? p.note.length).replace(/\s+/g, ' ').replace(/[;,]\s*$/, '').trim()
|
|
3113
|
+
for (const [, v] of m[1].matchAll(/\{\{(\w+)\}\}/g)) said.set(v, text)
|
|
3114
|
+
})
|
|
3115
|
+
const used = [...new Set([...p.builtin.matchAll(/\{\{\s*(?:#if\s+)?(\w+)\s*\}\}/g)].map((m) => m[1]).filter((v) => v !== 'else'))]
|
|
3116
|
+
return { about, vars: [...new Set([...said.keys(), ...used])].map((v) => ({ v, text: said.get(v) ?? '' })) } // in the note's order
|
|
3117
|
+
}
|
|
3118
|
+
// the kinds of prompt, one shown at a time (a search looks through all of them)
|
|
3119
|
+
const PROMPT_KINDS = [
|
|
3120
|
+
['system', 'System', 'The system prompt: what every request starts with', (p) => Boolean(p.title)],
|
|
3121
|
+
['tools', 'Tools', 'What the model is told each tool does', (p) => p.id.startsWith('agent/tool-')],
|
|
3122
|
+
['agent', 'Notes & replies', 'What HeartCode adds or answers while the model works', (p) => !p.title && p.id.startsWith('agent/') && !p.id.startsWith('agent/tool-')],
|
|
3123
|
+
['guided', 'Guided mode', 'For models without tool calls: they write their actions as text', (p) => !p.title && p.id.startsWith('guided/')],
|
|
3124
|
+
['compact', 'Summaries', 'Compacting a long conversation into a summary', (p) => p.id.startsWith('compact/')],
|
|
3125
|
+
['tests', 'Tests', 'What Test asks your models', (p) => p.id.startsWith('tests/')],
|
|
3126
|
+
]
|
|
3127
|
+
// a prompt's name to read: "output-cut" → "Output cut", a tool's by the tool's own name ("tool-read_file" → "read_file")
|
|
3128
|
+
const promptName = (p) => {
|
|
3129
|
+
if (p.title) return p.id === 'agent/system' ? 'System prompt' : 'System prompt, guided mode'
|
|
3130
|
+
const name = p.id.split('/')[1]
|
|
3131
|
+
if (name.startsWith('tool-')) return name.slice(5)
|
|
3132
|
+
return (name[0].toUpperCase() + name.slice(1).replace(/-/g, ' ')).replace(/\bmcp\b|\bMcp\b/g, 'MCP')
|
|
3133
|
+
}
|
|
3055
3134
|
let promptQuery = ''
|
|
3056
|
-
|
|
3135
|
+
let promptKind = 'system'
|
|
3136
|
+
let promptMine = false
|
|
3137
|
+
$('r-search').oninput = (e) => ((promptQuery = e.target.value.toLowerCase().trim()), S && drawPrompts(S))
|
|
3138
|
+
$('r-mine').onchange = (e) => ((promptMine = e.target.checked), S && drawPrompts(S))
|
|
3057
3139
|
function drawPrompts(s) {
|
|
3058
|
-
const
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3061
|
-
|
|
3140
|
+
const kindOf = (p) => PROMPT_KINDS.find((k) => k[3](p))
|
|
3141
|
+
const match = (p) => (!promptMine || p.changed) && (promptQuery ? `${p.id} ${promptName(p)} ${p.note}`.toLowerCase().includes(promptQuery) : kindOf(p)?.[0] === promptKind)
|
|
3142
|
+
// the switch: each kind with how many there are (yours changed: a dot)
|
|
3143
|
+
put($('r-kinds'), PROMPT_KINDS.map(([v, t, about, is]) => {
|
|
3144
|
+
const all = s.prompts.filter(is)
|
|
3145
|
+
return h('label', { className: v === promptKind && !promptQuery ? 'on' : '', title: about },
|
|
3146
|
+
h('input', { type: 'radio', name: 'r-kind', checked: v === promptKind, onchange: () => ((promptKind = v), (promptQuery = $('r-search').value = ''), (SEL.prompts = null), drawPrompts(S)) }),
|
|
3147
|
+
t, h('span', { className: 'r-count', textContent: String(all.length) }), all.some((p) => p.changed) ? h('span', { className: 'dot', title: 'some changed by you' }) : null)
|
|
3148
|
+
}))
|
|
3149
|
+
const aboutOf = (p) => promptParts(p).about || (p.id.startsWith('agent/tool-') ? `What the model is told the ${promptName(p)} tool does` : '')
|
|
3150
|
+
const item = (p) => ({ id: p.id, title: promptName(p), sub: aboutOf(p), badge: p.changed ? h('span', { className: 'tag brand', textContent: 'yours' }) : null, p })
|
|
3151
|
+
const shown = s.prompts.filter(match)
|
|
3152
|
+
const groups = promptQuery ? PROMPT_KINDS.map(([, t, , is]) => ({ title: t, items: shown.filter(is).map(item) })) : [{ items: shown.map(item) }]
|
|
3062
3153
|
masterDetail('prompts', $('r-items'), $('r-detail'), groups, (x) => {
|
|
3063
|
-
if (!x) return h('div', { className: 'card
|
|
3154
|
+
if (!x) return h('div', { className: 'card' }, h('h2', { textContent: promptMine ? 'None changed yet' : 'No prompt matches' }), h('p', { className: 'sub', textContent: promptMine ? "You're using HeartCode's prompts as they come. Change one and save it: it shows here." : 'Try other words, or clear the search.' }))
|
|
3064
3155
|
const p = x.p
|
|
3156
|
+
const { vars } = promptParts(p)
|
|
3157
|
+
const about = aboutOf(p)
|
|
3158
|
+
const kind = kindOf(p)
|
|
3065
3159
|
const ta = editor('prompts', p.id, p.text)
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3160
|
+
const undo = h('button', { className: 'ghost', textContent: 'Undo my changes', onclick: () => (saved('prompts', p.id), drawPrompts(S)) })
|
|
3161
|
+
const unsaved = h('span', { className: 'tag need', textContent: 'not saved' })
|
|
3162
|
+
const dirty = () => {
|
|
3163
|
+
const changed = DRAFTS.prompts[p.id] !== undefined
|
|
3164
|
+
undo.hidden = unsaved.hidden = !changed
|
|
3165
|
+
const t = $('r-items').querySelector('.it.on .t') // the list's dot for unsaved changes, as you type
|
|
3166
|
+
if (t && changed !== Boolean(t.querySelector('.dot'))) changed ? t.prepend(h('span', { className: 'dot', title: 'not saved' })) : t.querySelector('.dot').remove()
|
|
3167
|
+
}
|
|
3168
|
+
ta.addEventListener('input', dirty)
|
|
3169
|
+
dirty()
|
|
3170
|
+
// the placeholders: pointed at, what HeartCode puts there; clicked, put in where the cursor is
|
|
3171
|
+
const HINT = 'HeartCode fills these in. Point at one to see what goes there; click it to put it in the prompt.'
|
|
3172
|
+
const hint = h('p', { className: 'k-use-about', textContent: HINT })
|
|
3173
|
+
const insert = (v) => {
|
|
3174
|
+
ta.focus()
|
|
3175
|
+
ta.setRangeText(`{{${v}}}`, ta.selectionStart, ta.selectionEnd, 'end')
|
|
3176
|
+
ta.dispatchEvent(new Event('input'))
|
|
3177
|
+
}
|
|
3178
|
+
const show = (v, text) => (hint.textContent = text ? `{{${v}}}: ${text}` : `{{${v}}}`)
|
|
3179
|
+
return h('div', { className: 'card k-card r-card' },
|
|
3180
|
+
h('div', { className: 'k-head' },
|
|
3181
|
+
h('h2', { textContent: promptName(p) }),
|
|
3182
|
+
h('span', { className: 'tag brand', textContent: kind?.[1] ?? '' }),
|
|
3183
|
+
h('span', { className: 'tag', textContent: p.changed ? 'yours' : "HeartCode's" }),
|
|
3184
|
+
unsaved),
|
|
3185
|
+
h('div', { className: 'k-path mono', textContent: p.changed ? `${p.id} · yours in ${s.home}/prompts/${p.id.split('/')[0]}.md` : p.id }),
|
|
3186
|
+
about ? [h('label', { className: 'f', textContent: 'What it is' }), h('p', { className: 'r-about', textContent: about })] : null,
|
|
3187
|
+
vars.length ? [h('label', { className: 'f', textContent: 'Placeholders' }),
|
|
3188
|
+
h('div', { className: 'r-vars', onmouseleave: () => (hint.textContent = HINT) }, vars.map(({ v, text }) => h('button', { className: 'r-var mono', textContent: `{{${v}}}`, 'aria-label': `Put {{${v}}} in the prompt${text ? `: ${text}` : ''}`, onmouseenter: () => show(v, text), onfocus: () => show(v, text), onclick: () => insert(v) }))),
|
|
3189
|
+
hint] : null,
|
|
3190
|
+
h('label', { className: 'f', textContent: 'The prompt' }),
|
|
3070
3191
|
ta,
|
|
3071
3192
|
h('div', { className: 'actions' },
|
|
3072
3193
|
h('button', { className: 'primary', textContent: 'Save', onclick: () => saveItem('prompts', p.id, '/api/prompt', { id: p.id, text: ta.value }, 'saved: used from the next message') }),
|
|
3073
|
-
|
|
3194
|
+
undo,
|
|
3074
3195
|
h('span', { className: 'spacer' }),
|
|
3075
3196
|
p.changed ? h('button', { textContent: "Reset to HeartCode's", onclick: () => confirm("Put HeartCode's prompt back? Yours is deleted.") && saveItem('prompts', p.id, '/api/prompt', { id: p.id, text: null }, "HeartCode's prompt again") }) : null))
|
|
3076
|
-
})
|
|
3197
|
+
}, { tabs: false })
|
|
3077
3198
|
}
|
|
3078
3199
|
|
|
3079
3200
|
// --- MCP ---
|
|
@@ -3084,17 +3205,28 @@ for (const r of document.querySelectorAll('input[name="c-kind"]')) r.onchange =
|
|
|
3084
3205
|
$('c-what').placeholder = mcpKind() === 'url' ? 'https://mcp.example.com/mcp' : 'npx -y @modelcontextprotocol/server-github'
|
|
3085
3206
|
}
|
|
3086
3207
|
$('c-add').onclick = async () => {
|
|
3087
|
-
const
|
|
3088
|
-
|
|
3208
|
+
const had = new Set(S.mcp.map((m) => m.name))
|
|
3209
|
+
const r = await act('/api/mcp/add', { [mcpKind()]: $('c-what').value })
|
|
3210
|
+
if (!r) return
|
|
3211
|
+
toast(`added ${r.mcp.find((m) => !had.has(m.name))?.name ?? 'the server'}: it starts from the next message`) // its name, made from the command
|
|
3212
|
+
$('c-what').value = ''
|
|
3213
|
+
$('c-form').close()
|
|
3089
3214
|
}
|
|
3090
|
-
$('c-open').onclick = () => ($('c-form').showModal(), $('c-
|
|
3215
|
+
$('c-open').onclick = () => ($('c-form').showModal(), $('c-what').focus())
|
|
3091
3216
|
$('c-cancel').onclick = () => $('c-form').close()
|
|
3217
|
+
// a local server's flags as pills to tick on and off, and a box to add one
|
|
3218
|
+
function mcpFlags(m) {
|
|
3219
|
+
const set = (flag, on) => act('/api/mcp/flag', { name: m.name, flag, on }, `${m.name}: ${flag} ${on ? 'on' : 'off'}`)
|
|
3220
|
+
const add = h('input', { type: 'text', className: 'mono', placeholder: '+ flag', 'aria-label': `add a flag to ${m.name}`, style: 'width:120px;height:30px', onkeydown: (e) => e.key === 'Enter' && e.target.value.trim() && set(e.target.value.trim(), true) })
|
|
3221
|
+
return h('div', { className: 'f-togs mcp-flags' },
|
|
3222
|
+
m.flags.map((f) => h('label', { className: 'f-tog mono', title: f.on ? `${f.flag} is on: untick to start it without` : `${f.flag} is off: tick to add it back` }, h('input', { type: 'checkbox', checked: f.on, onchange: (e) => set(f.flag, e.target.checked) }), f.flag)), add)
|
|
3223
|
+
}
|
|
3092
3224
|
function drawMcp(s) {
|
|
3093
3225
|
const authTag = (a) => (a === 'in' ? h('span', { className: 'tag ok', textContent: 'signed in' }) : h('span', { className: 'tag need', textContent: 'sign-in needed' }))
|
|
3094
|
-
put($('c-list'), h('h2', { textContent: 'Servers' }), h('p', { className: 'sub', textContent: '
|
|
3226
|
+
put($('c-list'), h('h2', { textContent: 'Servers' }), h('p', { className: 'sub', textContent: 'Remote ones (a URL) may need signing in; local ones don\'t. Tick a flag off to start it without that flag; switch a server off to keep it without using it.' }),
|
|
3095
3227
|
s.mcp.length ? s.mcp.map((m) => h('div', { className: 'opt mcp-row' },
|
|
3096
3228
|
tile(m.remote ? 'globe' : m.name.includes('chrome') || m.name.includes('browser') ? 'globe' : m.name.includes('computer') ? 'cpu' : 'plug', m.on ? 'teal' : 'gray'),
|
|
3097
|
-
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 })),
|
|
3229
|
+
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 }), m.from === 'yours' && !m.remote ? mcpFlags(m) : null),
|
|
3098
3230
|
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,
|
|
3099
3231
|
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,
|
|
3100
3232
|
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.' }))
|
|
@@ -3106,6 +3238,7 @@ function drawMcp(s) {
|
|
|
3106
3238
|
|
|
3107
3239
|
// --- skills: a form (name, who uses it, what it's for, the prompt); SKILL.md is made from it ---
|
|
3108
3240
|
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"], ['always', 'Always on', 'in every message: how to work, not a task']]
|
|
3241
|
+
const USE_TAG = { both: 'you + model', me: 'only you', model: 'model', always: 'always on' } // who uses it, in a word or two (the list and the panel)
|
|
3109
3242
|
function parseSkill(text) {
|
|
3110
3243
|
const m = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(text)
|
|
3111
3244
|
const out = { description: '', use: 'both', extra: [], body: (m ? m[2] : text).replace(/^\s*\n/, '') }
|
|
@@ -3143,14 +3276,17 @@ function skillForm(id, start, { isNew, readOnly }) {
|
|
|
3143
3276
|
const d = DRAFTS.skills[id] ?? { ...start, extra: [...start.extra] } // your unsaved changes, else as saved
|
|
3144
3277
|
const touch = () => (DRAFTS.skills[id] = d) // a change: kept (and dotted in the list) until it's saved
|
|
3145
3278
|
const field = (key, props) => h('input', { type: 'text', value: d[key], readOnly, oninput: (e) => ((d[key] = e.target.value), touch()), ...props })
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3148
|
-
|
|
3279
|
+
const about = grow(h('textarea', { className: 'k-about', rows: 2, readOnly, value: d.description, placeholder: 'Reviews the changes for bugs and unclear code', oninput: (e) => ((d.description = e.target.value), touch()) }), 44)
|
|
3280
|
+
// who uses it: one switch, with what the chosen one means under it
|
|
3281
|
+
const useAbout = h('p', { className: 'k-use-about', textContent: (USES.find(([v]) => v === d.use) ?? [])[2] ?? '' })
|
|
3282
|
+
const uses = h('div', {}, h('div', { className: 'seg', role: 'radiogroup', 'aria-label': 'Who uses it' }, USES.map(([v, t, sub]) => h('label', { className: d.use === v ? 'on' : '', title: sub },
|
|
3283
|
+
h('input', { type: 'radio', name: `use-${id}`, checked: d.use === v, disabled: readOnly, onchange: () => ((d.use = v), touch(), (useAbout.textContent = sub), uses.querySelectorAll('.seg label').forEach((c) => c.classList.toggle('on', c.querySelector('input').checked))) }),
|
|
3284
|
+
t))), useAbout)
|
|
3149
3285
|
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)
|
|
3150
3286
|
return { d, el: [
|
|
3151
3287
|
h('div', { className: 'row' },
|
|
3152
3288
|
isNew ? h('div', { className: 'grow' }, h('label', { className: 'f', textContent: "Name: you'll type /skill:name" }), field('name', { placeholder: 'review' })) : null,
|
|
3153
|
-
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)' }),
|
|
3289
|
+
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)' }), about)),
|
|
3154
3290
|
h('label', { className: 'f', textContent: 'Who uses it' }), uses,
|
|
3155
3291
|
h('label', { className: 'f', textContent: 'The prompt' }), body,
|
|
3156
3292
|
] }
|
|
@@ -3193,9 +3329,8 @@ async function openImport() {
|
|
|
3193
3329
|
|
|
3194
3330
|
function drawSkills(s) {
|
|
3195
3331
|
const mine = s.skills.filter((k) => k.mine)
|
|
3196
|
-
const theirs = s.skills.filter((k) => !k.mine
|
|
3197
|
-
const
|
|
3198
|
-
const item = (k) => ({ id: k.name, title: '/skill:' + k.name, sub: k.description, k })
|
|
3332
|
+
const theirs = s.skills.filter((k) => !k.mine)
|
|
3333
|
+
const item = (k) => ({ id: k.name, title: '/skill:' + k.name, sub: k.description, badge: h('span', { className: 'tag' + (k.use === 'always' ? ' brand' : ''), textContent: USE_TAG[k.use] ?? k.use }), k })
|
|
3199
3334
|
const install = async () => {
|
|
3200
3335
|
const url = $('k-url').value.trim()
|
|
3201
3336
|
if (!url) return toast('Enter a GitHub repo or a SKILL.md URL', true)
|
|
@@ -3216,20 +3351,28 @@ function drawSkills(s) {
|
|
|
3216
3351
|
if (e.key === 'Enter') install()
|
|
3217
3352
|
}
|
|
3218
3353
|
$('k-import').onclick = openImport
|
|
3219
|
-
masterDetail('skills', $('k-items'), $('k-detail'), [{ title: mine.length &&
|
|
3220
|
-
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
|
|
3354
|
+
masterDetail('skills', $('k-items'), $('k-detail'), [{ title: mine.length && theirs.length ? 'Yours' : '', items: mine.map(item) }, { title: 'From projects', items: theirs.map(item) }], (x) => {
|
|
3355
|
+
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 above, or bring them from Claude Code and others with Import from other tools.' }))
|
|
3221
3356
|
const k = x.k
|
|
3222
3357
|
const f = skillForm(k.name, parseSkill(k.text), { readOnly: !k.mine })
|
|
3223
|
-
|
|
3224
|
-
|
|
3358
|
+
const files = k.files ?? []
|
|
3359
|
+
return h('div', { className: 'card k-card' },
|
|
3360
|
+
h('div', { className: 'k-head' },
|
|
3361
|
+
h('h2', { className: 'mono', textContent: '/skill:' + k.name }),
|
|
3362
|
+
h('span', { className: 'tag brand', textContent: USE_TAG[k.use] ?? k.use, title: (USES.find(([v]) => v === k.use) ?? [])[2] ?? '' }),
|
|
3363
|
+
h('span', { className: 'tag', textContent: k.mine ? 'yours' : 'from a project: read only' }),
|
|
3364
|
+
files.length ? h('span', { className: 'tag', textContent: `${files.length} file${files.length === 1 ? '' : 's'}` }) : null),
|
|
3365
|
+
h('div', { className: 'k-path mono', textContent: k.path ?? '' }),
|
|
3225
3366
|
f.el,
|
|
3367
|
+
files.length ? h('details', { className: 'k-files' },
|
|
3368
|
+
h('summary', { textContent: `Its files (${files.length}): the model reads them when the skill tells it to` }),
|
|
3369
|
+
h('ul', {}, files.map((n) => h('li', { className: 'mono', textContent: n })))) : null,
|
|
3226
3370
|
k.mine ? h('div', { className: 'actions' },
|
|
3227
3371
|
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}`) }),
|
|
3228
3372
|
h('span', { className: 'spacer' }),
|
|
3229
|
-
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}`) }))
|
|
3230
|
-
:
|
|
3231
|
-
|
|
3232
|
-
})
|
|
3373
|
+
h('button', { className: 'danger', textContent: 'Delete', onclick: () => confirm(`Delete the skill /skill:${k.name}${files.length ? ` and its ${files.length} files` : ''}?`) && saveItem('skills', k.name, '/api/skill/delete', { name: k.name }, `deleted /skill:${k.name}`) }))
|
|
3374
|
+
: null)
|
|
3375
|
+
}, { tabs: false })
|
|
3233
3376
|
$('n-skills').textContent = s.skills.length || ''
|
|
3234
3377
|
}
|
|
3235
3378
|
|
|
@@ -3402,13 +3545,12 @@ if (!token) put($('page-providers'), h('h1', { textContent: 'Open the link Heart
|
|
|
3402
3545
|
else {
|
|
3403
3546
|
job('state', { where: ['page'], what: 'Loading your settings', detail: 'providers, models, logging, prompts, MCP servers, skills' })
|
|
3404
3547
|
api('/api/state').then(render, (e) => toast(e.message, true)).finally(() => job('state'))
|
|
3405
|
-
|
|
3406
3548
|
.then(() => api('/api/tests', {}))
|
|
3407
|
-
.then(({ results, run }) => (Object.assign(TRIES, results), showRun(run))
|
|
3549
|
+
.then(({ results, run }) => (Object.assign(TRIES, results), showRun(run)))
|
|
3408
3550
|
job('requests', { where: ['requests'], what: 'Loading the request log', detail: 'every request HeartCode logged' })
|
|
3409
3551
|
api('/api/requests').then(({ items }) => ((REQS = items), drawReqs()), () => ((REQS = []), drawReqs())).finally(() => job('requests'))
|
|
3410
3552
|
}
|
|
3411
|
-
//
|
|
3553
|
+
// What the server says as it happens (the settings changed, a request logged, a model looked up).
|
|
3412
3554
|
if (token) {
|
|
3413
3555
|
const events = new EventSource(`/api/events?t=${token}`)
|
|
3414
3556
|
events.addEventListener('error', checkGone) // the server went away (turned off), or the connection did for a moment
|