bareloop 0.54.1 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +122 -0
- package/bareloop.context.md +67 -6
- package/package.json +3 -3
- package/src/authorflow.js +217 -238
- package/src/authoring.js +22 -6
- package/src/authorjob.js +138 -30
- package/src/authorreadout.js +15 -4
- package/src/authorrun.js +13 -4
- package/src/authorscout.js +9 -6
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/cardschedule.js +42 -0
- package/src/checkblock.js +772 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +294 -0
- package/src/checksuggest.js +28 -0
- package/src/checkwords.js +27 -0
- package/src/cli.js +1 -1
- package/src/config.js +24 -1
- package/src/declaredclose.js +30 -1
- package/src/destpoint.js +151 -0
- package/src/draftspend.js +85 -0
- package/src/facts.js +8 -1
- package/src/factwords.js +14 -1
- package/src/fitcheck.js +5 -3
- package/src/job.js +81 -1
- package/src/jobblock.js +9 -0
- package/src/labelscan.js +11 -0
- package/src/launcher.js +3 -2
- package/src/mcpchecks.js +52 -0
- package/src/mcppick.js +36 -0
- package/src/mcpsources.js +77 -0
- package/src/mcpuse.js +97 -0
- package/src/natural.js +23 -0
- package/src/pagemap.js +20 -5
- package/src/panel/authorroutes.js +105 -18
- package/src/panel/authorsession.js +293 -44
- package/src/panel/index.html +873 -41
- package/src/panel/jobgrid.js +117 -0
- package/src/panel/jobplan.js +103 -35
- package/src/panel/scheduler.js +80 -13
- package/src/panel/schedules.js +189 -28
- package/src/panel/schedulestart.js +44 -13
- package/src/panel/server.js +471 -39
- package/src/panel/settingsroutes.js +133 -3
- package/src/panel/status.js +19 -1
- package/src/panel/tickets.js +44 -0
- package/src/pickrecord.js +163 -0
- package/src/placerule.js +355 -0
- package/src/plan.js +31 -2
- package/src/planrun.js +71 -15
- package/src/prcheckout.js +259 -0
- package/src/promptregisters.js +11 -0
- package/src/questionbox.js +112 -0
- package/src/readshim.js +3 -2
- package/src/revises.js +56 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +265 -132
- package/src/run.js +19 -2
- package/src/runexport.js +2 -0
- package/src/runlist.js +3 -2
- package/src/schedulewords.js +46 -4
- package/src/source.js +81 -7
- package/src/stepmcp.js +86 -0
- package/src/ticket.js +113 -0
- package/src/ticketfilter.js +76 -0
- package/src/ticketlabels.js +79 -0
- package/src/ticketmcp.js +111 -0
- package/src/ticketnext.js +35 -0
- package/src/ticketrepo.js +98 -0
- package/src/ticketschedule.js +32 -0
- package/src/ticketshape.js +45 -0
- package/src/tools.js +9 -0
- package/src/trigger.js +14 -2
- package/src/triggerclock.js +7 -3
- package/src/triggerfiles.js +19 -11
- package/src/triggertickets.js +244 -0
- package/src/userrun.js +191 -10
- package/src/validate.js +3 -1
- package/src/worktree.js +43 -1
- package/types/authorflow.d.ts +86 -93
- package/types/authorjob.d.ts +35 -4
- package/types/authorreadout.d.ts +4 -3
- package/types/authorscout.d.ts +4 -2
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +37 -0
- package/types/cardschedule.d.ts +24 -0
- package/types/checkblock.d.ts +361 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +160 -0
- package/types/checksuggest.d.ts +30 -0
- package/types/checkwords.d.ts +14 -0
- package/types/config.d.ts +7 -0
- package/types/declaredclose.d.ts +4 -0
- package/types/destpoint.d.ts +89 -0
- package/types/draftspend.d.ts +37 -0
- package/types/factwords.d.ts +7 -0
- package/types/fitcheck.d.ts +7 -1
- package/types/job.d.ts +13 -0
- package/types/jobblock.d.ts +9 -0
- package/types/labelscan.d.ts +7 -0
- package/types/launcher.d.ts +2 -2
- package/types/mcpchecks.d.ts +8 -0
- package/types/mcppick.d.ts +33 -0
- package/types/mcpsources.d.ts +51 -0
- package/types/mcpuse.d.ts +15 -0
- package/types/natural.d.ts +2 -0
- package/types/pagemap.d.ts +6 -1
- package/types/panel/authorroutes.d.ts +11 -2
- package/types/panel/authorsession.d.ts +69 -3
- package/types/panel/jobgrid.d.ts +405 -0
- package/types/panel/jobplan.d.ts +55 -11
- package/types/panel/scheduler.d.ts +7 -2
- package/types/panel/schedules.d.ts +124 -4
- package/types/panel/schedulestart.d.ts +21 -3
- package/types/panel/server.d.ts +432 -10
- package/types/panel/settingsroutes.d.ts +4 -2
- package/types/panel/status.d.ts +16 -2
- package/types/panel/tickets.d.ts +61 -0
- package/types/pickrecord.d.ts +100 -0
- package/types/placerule.d.ts +194 -0
- package/types/plan.d.ts +1 -0
- package/types/prcheckout.d.ts +151 -0
- package/types/questionbox.d.ts +87 -0
- package/types/readshim.d.ts +4 -3
- package/types/revises.d.ts +23 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +100 -48
- package/types/run.d.ts +27 -1
- package/types/runlist.d.ts +6 -3
- package/types/schedulewords.d.ts +29 -2
- package/types/source.d.ts +40 -4
- package/types/stepmcp.d.ts +40 -0
- package/types/ticket.d.ts +114 -0
- package/types/ticketfilter.d.ts +34 -0
- package/types/ticketlabels.d.ts +44 -0
- package/types/ticketmcp.d.ts +84 -0
- package/types/ticketnext.d.ts +33 -0
- package/types/ticketrepo.d.ts +118 -0
- package/types/ticketschedule.d.ts +21 -0
- package/types/ticketshape.d.ts +37 -0
- package/types/tools.d.ts +1 -0
- package/types/trigger.d.ts +9 -1
- package/types/triggerclock.d.ts +6 -2
- package/types/triggerfiles.d.ts +13 -5
- package/types/triggertickets.d.ts +110 -0
- package/types/userrun.d.ts +50 -0
- package/types/validate.d.ts +1 -0
- package/types/worktree.d.ts +19 -0
package/src/panel/index.html
CHANGED
|
@@ -152,6 +152,8 @@
|
|
|
152
152
|
.dot.red::before{content:"[✗]";color:var(--red);}
|
|
153
153
|
/* stopped (hamr 2026-10-07): the person pressed Stop — its own sign, grey (RULED 2026-10-15) */
|
|
154
154
|
.dot.stopped::before{content:"[■]";color:var(--grey-dot);}
|
|
155
|
+
/* R5 (piece 2): a ticket the job's signed filter did not let through ends skipped at run start: [–], grey, rests (fwd's sign) */
|
|
156
|
+
.dot.skipped::before{content:"[–]";color:var(--grey-dot);}
|
|
155
157
|
/* Panel build P3 addition (2026-09-27, "yes, go"): the part cards below the
|
|
156
158
|
step map (`partResultGlyph`/`attemptGlyph`) and the chat job card render
|
|
157
159
|
their result glyph as PLAIN inline text inside a larger string (never
|
|
@@ -357,6 +359,7 @@
|
|
|
357
359
|
.ended-text .sched-line2{display:block;}
|
|
358
360
|
.run-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:12px;}
|
|
359
361
|
.run-actions[hidden]{display:none;}
|
|
362
|
+
#run-content.actions-only > :not(.run-actions){display:none;}
|
|
360
363
|
.run-actions .stopping{color:var(--amber);font-size:13px;overflow-wrap:anywhere;}
|
|
361
364
|
.resume-err{color:var(--red);white-space:pre-wrap;overflow-wrap:anywhere;}
|
|
362
365
|
/* P5-R: a resumed run is ONE card; its legs are told apart by a divider line, a dotted map connector, a small tag */
|
|
@@ -483,6 +486,45 @@
|
|
|
483
486
|
#result-body details>summary{cursor:pointer;color:var(--text-dim);min-height:28px;}
|
|
484
487
|
.rs-link{background:none;border:none;padding:0;min-height:44px;color:var(--accent);text-decoration:underline;font:inherit;cursor:pointer;}
|
|
485
488
|
.rs-warn{color:var(--amber);overflow-wrap:anywhere;}
|
|
489
|
+
/* R7b item 4: the generic Result tab. A diff wraps inside its own box (no page scroll); a check row is a question and its word and number. */
|
|
490
|
+
.rs-diff{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.45 ui-monospace,"Courier New",monospace;}
|
|
491
|
+
.ro-value>.rs-diff{max-height:28em;overflow:auto;}
|
|
492
|
+
.rs-add{color:var(--green);} .rs-del{color:var(--red);} .rs-ctx{color:var(--text-dim);}
|
|
493
|
+
.rs-check{display:grid;grid-template-columns:minmax(0,1fr) minmax(8em,auto) 7em;gap:6px 12px;align-items:baseline;padding:3px 0;border-bottom:1px dotted var(--border);}
|
|
494
|
+
.rs-q{overflow-wrap:anywhere;} .rs-num{overflow-wrap:anywhere;} .rs-sign{white-space:nowrap;}
|
|
495
|
+
/* phone width: the number drops under the question, the sign stays in the right column */
|
|
496
|
+
@media (max-width:600px){ .rs-check{grid-template-columns:minmax(0,1fr) auto;} .rs-num{grid-column:1;grid-row:2;} .rs-sign{grid-column:2;grid-row:1;} .rs-num:empty{display:none;} }
|
|
497
|
+
/* R8 (piece 10): a ticket job's Result grid. borrowed-from: fwdloop src/panel/index.html@v0.29.0 tg- rules (the signed mockup .claude/scratch/mcp-tickets/r7b/result-tab-tickets.html). The table, cells and
|
|
498
|
+
step-sub are the Audit grid's own; these are the bucket fold rows, the stats line, the run column and the "Run it anyway" box. A long line wraps; the table scrolls inside its own box, never the page. */
|
|
499
|
+
#result-body .tg-stats{font-size:13px;margin:0 0 8px;overflow-wrap:anywhere;}
|
|
500
|
+
table.grid.tg td.r,table.grid.tg th.r{position:sticky;left:0;background:var(--panel2);z-index:1;min-width:84px;white-space:nowrap;text-align:left;}
|
|
501
|
+
table.grid.tg td.c{min-width:84px;}
|
|
502
|
+
table.grid.tg th{color:var(--accent);font-weight:700;}
|
|
503
|
+
.tg-rowname{display:flex;align-items:center;max-width:min(300px,60vw);}
|
|
504
|
+
table.grid.tg button.tg-name{flex:0 1 auto;min-width:0;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;border:0;background:none;padding:0;min-height:32px;font:inherit;font-size:12px;font-weight:700;color:var(--accent);cursor:pointer;}
|
|
505
|
+
table.grid.tg button.tg-name:hover{text-decoration:underline;}
|
|
506
|
+
table.grid.tg button.tg-name:focus-visible,table.grid.tg button.tg-arrow:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
|
|
507
|
+
table.grid.tg button.tg-arrow{flex:0 0 auto;width:auto;color:var(--accent);font-weight:700;}
|
|
508
|
+
.tg-unsure{flex:0 0 auto;margin-left:6px;}
|
|
509
|
+
table.grid.tg button.q-fold{border:0;background:none;color:var(--text);font:inherit;font-size:12px;text-align:left;padding:0;min-height:32px;cursor:pointer;}
|
|
510
|
+
table.grid.tg button.q-fold::before{content:"\25B8 ";color:var(--text-faint);white-space:pre;}
|
|
511
|
+
table.grid.tg button.q-fold[aria-expanded="true"]::before{content:"\25BE ";}
|
|
512
|
+
.tg-val{font-size:11px;color:var(--text-faint);margin-left:4px;}
|
|
513
|
+
tr.tg-grp td{background:var(--panel);border-bottom:1px solid var(--border-strong);padding:0 8px;}
|
|
514
|
+
.tg-fold{display:block;width:100%;text-align:left;background:none;border:0;color:var(--text);font:inherit;font-size:13px;font-weight:700;min-height:34px;cursor:pointer;}
|
|
515
|
+
.tg-fold:hover{color:var(--accent);}
|
|
516
|
+
.tg-fold:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
|
|
517
|
+
.tg-foldin{position:sticky;left:8px;}
|
|
518
|
+
.tg-skipwhy{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
|
|
519
|
+
table.grid.tg tr.step-sub td{white-space:normal;overflow-wrap:anywhere;text-align:left;}
|
|
520
|
+
.tg-line{padding:2px 0;font-size:12px;overflow-wrap:anywhere;}
|
|
521
|
+
.tg-line pre.rs-diff{max-height:18em;overflow:auto;}
|
|
522
|
+
.tk-rl{color:var(--accent);text-decoration:underline;cursor:pointer;background:none;border:0;padding:0;font:inherit;}
|
|
523
|
+
.tk-rl:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
|
|
524
|
+
.tk-anyway{margin-top:6px;}
|
|
525
|
+
.tk-anyway button{display:block;width:100%;box-sizing:border-box;}
|
|
526
|
+
.tk-anyway textarea{width:100%;min-height:52px;margin:4px 0;background:var(--bg);color:var(--text);border:1px solid var(--text-dim);font:inherit;font-size:16px;padding:6px;box-sizing:border-box;}
|
|
527
|
+
.tk-msg{font-size:12px;overflow-wrap:anywhere;}
|
|
486
528
|
#result-door-card .stopping{color:var(--amber);font-size:13px;overflow-wrap:anywhere;}
|
|
487
529
|
/* PRD v1.106 Part 5 C: the Audit step fold (tries, their numbered checks, the Round table). Every line wraps; nothing forces a page-wide scroll. */
|
|
488
530
|
.actor-mark{color:var(--text-faint);font-size:12px;margin-left:6px;white-space:nowrap;}
|
|
@@ -606,6 +648,17 @@
|
|
|
606
648
|
.msg.system{color:var(--text-faint);border-left:3px dotted var(--text-faint);font-size:12px;}
|
|
607
649
|
.msg .who{font-size:11px;color:var(--text-faint);margin-bottom:3px;text-transform:none;font-weight:400;}
|
|
608
650
|
.chat-input-row{margin-top:10px;border-top:1px dotted var(--border-strong);padding-top:10px;}
|
|
651
|
+
/* hamr 2026-11-12 (as fwdloop M10 am29): a question the drafting raised gets its own box; it takes the chat input's place while it is open */
|
|
652
|
+
.chat-question{border:1px solid var(--border);border-left:3px solid var(--amber);background:var(--panel2);padding:8px 10px;margin-top:10px;max-width:100%;box-sizing:border-box;}
|
|
653
|
+
.chat-question .q-head{font-size:11px;color:var(--text-faint);}
|
|
654
|
+
.chat-question .q-line{font-size:12px;color:var(--text-faint);margin-top:4px;overflow-wrap:anywhere;}
|
|
655
|
+
.chat-question .q-text{font-size:13px;margin-top:4px;overflow-wrap:anywhere;white-space:pre-wrap;}
|
|
656
|
+
.chat-question textarea{display:block;width:100%;max-width:100%;box-sizing:border-box;margin-top:8px;min-height:3.4em;font:inherit;padding:6px 8px;border:1px solid var(--border-strong);border-radius:0;background:var(--bg);color:var(--text);resize:vertical;}
|
|
657
|
+
.chat-question .q-choices{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;}
|
|
658
|
+
.chat-question .q-choices .btn{flex:1 1 auto;min-width:0;white-space:normal;overflow-wrap:anywhere;height:auto;min-height:44px;}
|
|
659
|
+
.chat-question .q-or{display:block;font-size:12px;color:var(--text-faint);margin-top:8px;text-transform:none;letter-spacing:normal;font-weight:normal;}
|
|
660
|
+
.chat-question .q-or + textarea{margin-top:4px;}
|
|
661
|
+
.chat-question .q-err{color:var(--red);}
|
|
609
662
|
.chat-input-row input{width:100%;box-sizing:border-box;}
|
|
610
663
|
/* the ask box wraps long text (textarea, hamr 2026-10-05): grows a few rows (fitBox), then scrolls inside; Enter sends, Shift+Enter is a newline */
|
|
611
664
|
textarea[data-testid="chat-msg"]{width:100%;box-sizing:border-box;font:inherit;color:var(--text);resize:vertical;overflow-y:auto;max-height:200px;}
|
|
@@ -634,8 +687,14 @@
|
|
|
634
687
|
.jp .num{display:inline-block;text-indent:0;width:22px;text-align:right;color:var(--text-faint);margin-right:8px;}
|
|
635
688
|
.jp .sub{color:var(--text-dim);padding-left:30px;}
|
|
636
689
|
.jp .fold{padding-left:30px;color:var(--text);}
|
|
690
|
+
/* who added a check: the drafter's [agent] or the person's own [you picked] (fwdloop's `[added]` marker, in the dim of a ~ row) */
|
|
691
|
+
.jp .by,.draft-checks-row .by,.job-card .by{color:var(--text-dim);white-space:nowrap;}
|
|
692
|
+
/* the confirm card's Drop / Add: wraps with its row, a comfortable touch target, no horizontal scroll at phone width */
|
|
693
|
+
.jp .jp-btn{margin:2px 0 2px 8px;padding:4px 12px;min-height:32px;font-size:inherit;}
|
|
694
|
+
.jp .fold{overflow-wrap:anywhere;}
|
|
695
|
+
.jp-sug .lbl{display:block;margin-top:6px;font-weight:700;}
|
|
637
696
|
.jp details.fold{padding-left:0;margin:6px 0;}
|
|
638
|
-
.jp details>summary{cursor:pointer;list-style:none;}
|
|
697
|
+
.jp details>summary{cursor:pointer;list-style:none;font-weight:700;}
|
|
639
698
|
.jp details>summary::-webkit-details-marker{display:none;}
|
|
640
699
|
.jp details>summary::before{content:"\203A";color:var(--plan);font-weight:700;margin-right:6px;}
|
|
641
700
|
.jp details[open]>summary::before{content:"\2304";}
|
|
@@ -734,6 +793,40 @@
|
|
|
734
793
|
.pv-typed{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin-top:4px;}
|
|
735
794
|
.pv-typed input{flex:1 1 160px;min-width:0;max-width:260px;min-height:28px;box-sizing:border-box;}
|
|
736
795
|
.pv-typed .hint{flex:1 1 100%;margin:0;}
|
|
796
|
+
/* Settings > MCP (piece 7), borrowed-from: fwdloop src/panel/index.html@d71846c; reuses .pv-key/.pv-krow/.pv-mrow with other columns */
|
|
797
|
+
.mc-sect{font-size:12px;color:var(--text-dim);font-weight:700;margin:16px 0 6px;text-transform:uppercase;letter-spacing:.06em;}
|
|
798
|
+
.mc-sect:first-child{margin-top:0;}
|
|
799
|
+
.mc-grp{border-top:1px solid var(--border-strong);}
|
|
800
|
+
.mc-grp:first-of-type{border-top:none;}
|
|
801
|
+
.mc-prow{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;padding:4px 8px;min-height:40px;background:var(--panel2);overflow-wrap:anywhere;}
|
|
802
|
+
.mc-prow .mc-grow{flex:1 1 100px;min-width:0;}
|
|
803
|
+
.mc-prow .btn{margin-left:auto;}
|
|
804
|
+
.mc-prow.faint{color:var(--text-faint);}
|
|
805
|
+
.mc-grp[data-open="0"] .mc-kids{display:none;}
|
|
806
|
+
.pv-head.mc-k,.pv-krow.mc-k{--pv-cols:minmax(0,1.6fr) minmax(0,1.5fr) minmax(0,.8fr) 150px;}
|
|
807
|
+
.mc-grp .pv-key:first-child{border-top:1px solid var(--border-strong);}
|
|
808
|
+
.mc-k .pv-name{padding-left:26px;}
|
|
809
|
+
.mc-grp .pv-more{padding-left:60px;}
|
|
810
|
+
.mc-grp .mc-use{padding-left:60px;}
|
|
811
|
+
.mc-use{padding:0 8px 6px 34px;margin:0;}
|
|
812
|
+
.mc-use .bad{color:var(--red);}
|
|
813
|
+
.pv-mrow.mc-t,.pv-mhead.mc-t{--pv-cols:minmax(0,1.6fr) minmax(0,1.5fr) minmax(0,.8fr) 150px;}
|
|
814
|
+
.pv-mrow.mc-t{display:grid;padding:0 8px;}
|
|
815
|
+
.mc-t .pv-m-name{padding-left:52px;}
|
|
816
|
+
.mc-t .n{text-align:left;font-variant-numeric:tabular-nums;}
|
|
817
|
+
.pv-key.faint{color:var(--text-faint);}
|
|
818
|
+
@media (max-width:1279px){
|
|
819
|
+
.pv-mhead.mc-t{display:grid;}
|
|
820
|
+
.pv-mrow.mc-t{display:grid;padding:0 8px;}
|
|
821
|
+
.mc-use{padding-left:8px;}
|
|
822
|
+
.mc-kids{margin-left:14px;border-left:2px solid var(--border-strong);}
|
|
823
|
+
.mc-k .pv-name{padding-left:0;}
|
|
824
|
+
.mc-grp .pv-more,.mc-grp .mc-use{padding-left:8px;}
|
|
825
|
+
.pv-mrow.mc-t,.pv-mhead.mc-t{--pv-cols:minmax(0,2fr) minmax(0,1fr) minmax(0,.6fr);}
|
|
826
|
+
.mc-t .n{text-align:right;}
|
|
827
|
+
.mc-t .pv-m-name{padding-left:0;}
|
|
828
|
+
.pv-refcell:empty{display:none;}
|
|
829
|
+
}
|
|
737
830
|
.hint.bad{color:var(--red);}
|
|
738
831
|
/* a refused Start (a $0 refusal, e.g. an Inputs line) is read like the red failure line of the progress list, not like a faint hint */
|
|
739
832
|
.card-refusal:not(:empty){font-size:13px;margin-top:8px;line-height:1.4;}
|
|
@@ -861,6 +954,35 @@
|
|
|
861
954
|
<div class="nbox-in"><textarea class="jf-wrap" id="jf-inputs" rows="2" data-testid="jf-inputs" spellcheck="false"></textarea><div class="nbox-mir" id="jf-inputs-mir" aria-hidden="true"></div></div>
|
|
862
955
|
</div>
|
|
863
956
|
</div>
|
|
957
|
+
<!-- ITEM33-BUILD piece 8 (fwd M13 p4): Flow type and the MCP pick. Signed WITH the job by code; the MCP list is Settings > MCP's (the page only reads it). -->
|
|
958
|
+
<div class="field" id="jf-flowtype-field" data-testid="jf-flowtype-field">
|
|
959
|
+
<label for="jf-flowtype">Flow type</label>
|
|
960
|
+
<select id="jf-flowtype" data-testid="jf-flowtype" aria-label="Flow type">
|
|
961
|
+
<option value="plain">plain</option>
|
|
962
|
+
<option value="mcp">MCP</option>
|
|
963
|
+
<option value="tickets">Tickets MCP</option>
|
|
964
|
+
</select>
|
|
965
|
+
</div>
|
|
966
|
+
<div class="field" id="jf-mcp-field" data-testid="jf-mcp-field" hidden>
|
|
967
|
+
<label for="jf-mcp">MCP</label>
|
|
968
|
+
<select id="jf-mcp" data-testid="jf-mcp" aria-label="MCP"></select>
|
|
969
|
+
<div class="hint"><a class="link" id="jf-mcp-manage" data-testid="jf-mcp-manage" href="#">manage in Settings > MCP</a></div>
|
|
970
|
+
</div>
|
|
971
|
+
<!-- ITEM33-BUILD piece 9 (R7, fwd M13 p5): the Schedule is signed WITH the job; it is OFF until the job's first green run. The words are src/schedulewords.js SCHEDULE_WORDS.card, filled in by the server like the port. -->
|
|
972
|
+
<div class="field" id="jf-sched-field" data-testid="jf-sched-field">
|
|
973
|
+
<label for="jf-sched">__BARELOOP_SCHED_LABEL__</label>
|
|
974
|
+
<select id="jf-sched" data-testid="jf-sched" aria-label="Schedule">
|
|
975
|
+
<option value="hand">__BARELOOP_SCHED_OPT_HAND__</option>
|
|
976
|
+
<option value="new-ticket">__BARELOOP_SCHED_OPT_TICKET__</option>
|
|
977
|
+
<option value="daily">__BARELOOP_SCHED_OPT_DAILY__</option>
|
|
978
|
+
</select>
|
|
979
|
+
<div class="when-sub" id="jf-sched-clock" hidden>
|
|
980
|
+
<input id="jf-sched-time" type="time" value="09:00" data-testid="jf-sched-time" aria-label="Time, HH:MM">
|
|
981
|
+
</div>
|
|
982
|
+
<div class="hint" id="jf-sched-hint" data-testid="jf-sched-hint" hidden>__BARELOOP_SCHED_HINT__</div>
|
|
983
|
+
<div class="hint" id="jf-sched-hint-rubric" data-testid="jf-sched-hint-rubric" hidden>__BARELOOP_SCHED_HINT_RUBRIC__</div>
|
|
984
|
+
<div class="hint" id="jf-sched-ticket-hint" data-testid="jf-sched-ticket-hint" hidden>__BARELOOP_SCHED_HINT_TICKET__</div>
|
|
985
|
+
</div>
|
|
864
986
|
<div class="field">
|
|
865
987
|
<label for="jf-dest">Destination <span class="req">required</span></label>
|
|
866
988
|
<textarea class="jf-wrap" id="jf-dest" rows="1" placeholder="the write fence — where in the repo this run may change files"></textarea>
|
|
@@ -877,6 +999,9 @@
|
|
|
877
999
|
</select>
|
|
878
1000
|
<input id="jf-when-time" type="time" value="09:00" data-testid="jf-when-time" aria-label="Time, HH:MM">
|
|
879
1001
|
</div>
|
|
1002
|
+
<div class="when-sub" id="jf-when-ticketbox" hidden>
|
|
1003
|
+
<select id="jf-when-input" data-testid="jf-when-input" aria-label="The ticket list to watch"></select>
|
|
1004
|
+
</div>
|
|
880
1005
|
<div class="when-sub" id="jf-when-filebox" hidden>
|
|
881
1006
|
<input id="jf-when-path" type="text" autocomplete="off" spellcheck="false" data-testid="jf-when-path" aria-label="File or folder">
|
|
882
1007
|
</div>
|
|
@@ -917,6 +1042,21 @@
|
|
|
917
1042
|
before a person reads it. -->
|
|
918
1043
|
<div class="hint" id="chat-action-error" data-testid="chat-action-error"></div>
|
|
919
1044
|
|
|
1045
|
+
<!-- hamr 2026-11-12 (as fwdloop M10 am29): a question the drafting raised, one at a time. No Skip. Static markup: the poll only rewrites the texts when the question changes, never the typed answer -->
|
|
1046
|
+
<div class="chat-question" id="chat-question" data-testid="chat-question" hidden>
|
|
1047
|
+
<div class="q-head" id="chat-q-head" data-testid="chat-q-head"></div>
|
|
1048
|
+
<div class="q-line" id="chat-q-line" data-testid="chat-q-line"></div>
|
|
1049
|
+
<div class="q-text" id="chat-q-text" data-testid="chat-q-text"></div>
|
|
1050
|
+
<div class="q-choices" id="chat-q-choices" data-testid="chat-q-choices" hidden>
|
|
1051
|
+
<button class="btn small" type="button" id="chat-q-c1" hidden></button>
|
|
1052
|
+
<button class="btn small" type="button" id="chat-q-c2" hidden></button>
|
|
1053
|
+
</div>
|
|
1054
|
+
<label class="q-or" id="chat-q-or" data-testid="chat-q-or" for="chat-q-answer">Type your answer:</label>
|
|
1055
|
+
<textarea id="chat-q-answer" data-testid="chat-q-answer" rows="2" autocomplete="off" spellcheck="false" aria-label="Your answer" placeholder="Your answer, on one line"></textarea>
|
|
1056
|
+
<div class="hint q-err" id="chat-q-error" data-testid="chat-q-error" role="alert"></div>
|
|
1057
|
+
<button class="btn primary wide" type="button" id="chat-q-send" data-testid="chat-q-send">Send</button>
|
|
1058
|
+
</div>
|
|
1059
|
+
|
|
920
1060
|
<div class="chat-input-row">
|
|
921
1061
|
<label for="chat-msg" style="display:none">Message</label>
|
|
922
1062
|
<textarea id="chat-msg" rows="2" placeholder="Answer here when the draft asks you a question…" data-testid="chat-msg"></textarea>
|
|
@@ -925,6 +1065,8 @@
|
|
|
925
1065
|
<div class="hint" id="chat-main-hint" data-testid="chat-main-hint"></div>
|
|
926
1066
|
<!-- hamr 2026-10-09: Revise = reopen the boxes, filled as drafted, and draft again. Shown only while a plan waits for the OK. -->
|
|
927
1067
|
<button class="btn wide" type="button" id="chat-reopen-btn" data-testid="chat-reopen" hidden>Revise</button>
|
|
1068
|
+
<!-- fwd M4e am14 item 3: "N revises left"; after the second revise this same button reads Start over (a fresh draft, its own 2 revises) -->
|
|
1069
|
+
<span id="chat-left-count" data-testid="revises-left" class="hint" hidden></span>
|
|
928
1070
|
<div class="hint">Only your click signs. The chat can't.</div>
|
|
929
1071
|
</section>
|
|
930
1072
|
|
|
@@ -1042,6 +1184,7 @@
|
|
|
1042
1184
|
<div class="field" id="details-description-field"><label>Description</label><div class="ro-value" id="details-description">—</div></div>
|
|
1043
1185
|
<div class="field"><label>The job</label><div class="ro-value" id="details-plan" data-testid="details-plan">—</div></div>
|
|
1044
1186
|
<div class="field"><label>Inputs</label><div class="ro-value" id="details-inputs" data-testid="details-inputs">—</div></div>
|
|
1187
|
+
<div class="field" id="details-mcp-field" data-testid="details-mcp-field" hidden><label>MCP</label><div class="ro-value" id="details-mcp" data-testid="details-mcp"></div></div>
|
|
1045
1188
|
<div class="field"><label>Destination</label><div class="ro-value" id="details-dest">—</div></div>
|
|
1046
1189
|
<div class="field"><label>Tools</label><div class="ro-value" id="details-tools">—</div></div>
|
|
1047
1190
|
<div class="field-row">
|
|
@@ -1073,6 +1216,7 @@
|
|
|
1073
1216
|
|
|
1074
1217
|
<div class="tabrow" role="tablist" aria-label="Settings views">
|
|
1075
1218
|
<button role="tab" id="tab-providers" aria-controls="panel-providers" aria-selected="true" data-testid="settings-tab-providers">Providers</button>
|
|
1219
|
+
<button role="tab" id="tab-mcp" aria-controls="panel-mcp" aria-selected="false" data-testid="settings-tab-mcp">MCP</button>
|
|
1076
1220
|
<button role="tab" id="tab-money" aria-controls="panel-money" aria-selected="false" data-testid="settings-tab-money">Money & limits</button>
|
|
1077
1221
|
</div>
|
|
1078
1222
|
|
|
@@ -1099,6 +1243,22 @@
|
|
|
1099
1243
|
<div class="hint" id="pv-note" data-testid="pv-note" style="margin-top:6px;">⟳ refresh models (free) · old max_tokens: tick if the server wants the old field name</div>
|
|
1100
1244
|
</section>
|
|
1101
1245
|
|
|
1246
|
+
<!-- MCP TAB (piece 7; borrowed-from fwdloop src/panel/index.html@d71846c: one list "Path and MCP", a path is a header and its MCPs sit under it) -->
|
|
1247
|
+
<section id="panel-mcp" class="tabpanel" role="tabpanel" aria-labelledby="tab-mcp" hidden>
|
|
1248
|
+
<div class="mc-sect">Path and MCP</div>
|
|
1249
|
+
<div class="table-wrap" data-testid="mcp-table-wrap">
|
|
1250
|
+
<div id="mcp-paths" data-testid="mcp-paths"></div>
|
|
1251
|
+
<div class="pv-more" style="padding-left:10px;border-top:1px solid var(--border-strong)">
|
|
1252
|
+
<button class="btn small" type="button" id="mcp-add-open" data-testid="mcp-add-open">+ add a path</button>
|
|
1253
|
+
<div class="pv-typed" id="mcp-add-box" hidden></div>
|
|
1254
|
+
</div>
|
|
1255
|
+
</div>
|
|
1256
|
+
<div class="hint" id="mcp-problem" data-testid="mcp-problem"></div>
|
|
1257
|
+
<div class="hint" style="margin-top:6px;">Read only. bareloop never edits these files and never shows keys. A project folder's .mcp.json is never read.</div>
|
|
1258
|
+
<div class="hint">check tools starts the server once, only when pressed.</div>
|
|
1259
|
+
<div class="hint">— = no hint; shown, not blocked. Hints are info only.</div>
|
|
1260
|
+
</section>
|
|
1261
|
+
|
|
1102
1262
|
<!-- MONEY & LIMITS TAB -->
|
|
1103
1263
|
<section id="panel-money" class="tabpanel" role="tabpanel" aria-labelledby="tab-money" hidden>
|
|
1104
1264
|
<div class="money-strip" data-testid="money-strip">
|
|
@@ -1458,6 +1618,7 @@
|
|
|
1458
1618
|
if(g === "✓") return "green";
|
|
1459
1619
|
if(g === "✗") return "red";
|
|
1460
1620
|
if(g === "■") return "stopped";
|
|
1621
|
+
if(g === "–") return "skipped";
|
|
1461
1622
|
if(g === "▶") return "amber";
|
|
1462
1623
|
if(g === "?") return "magenta";
|
|
1463
1624
|
return "grey";
|
|
@@ -2675,7 +2836,8 @@
|
|
|
2675
2836
|
html += '<button class="btn primary" type="button" data-testid="btn-accept-run">Accept</button>';
|
|
2676
2837
|
}
|
|
2677
2838
|
// Reuse workflow: ONE door on every ending (v1.101), a died run included - the Chat card opens with every box open
|
|
2678
|
-
|
|
2839
|
+
// a run refused before it started / skipped has no `ended`; the server marks it `reuseOffered`
|
|
2840
|
+
if(!live && ((!!detail.ended && (detail.ended.actions || []).some(function(a){ return a.id === "reuse"; })) || detail.reuseOffered === true)){
|
|
2679
2841
|
html += '<button class="btn" type="button" data-testid="btn-reuse">Reuse workflow</button>';
|
|
2680
2842
|
}
|
|
2681
2843
|
// T Part 7: the schedule button is LAST, right after Reuse workflow. The SERVER decides (detail.schedule): `scheduled` shows
|
|
@@ -2752,6 +2914,7 @@
|
|
|
2752
2914
|
}
|
|
2753
2915
|
|
|
2754
2916
|
function renderRun(detail){
|
|
2917
|
+
document.getElementById("run-content").classList.remove("actions-only");
|
|
2755
2918
|
if(detail.fileMissing){
|
|
2756
2919
|
syncResultTab({});
|
|
2757
2920
|
setRunHeader("\u00B7", runName(detail.job, detail.runNo, detail.runid), "file missing");
|
|
@@ -2764,16 +2927,19 @@
|
|
|
2764
2927
|
return;
|
|
2765
2928
|
}
|
|
2766
2929
|
|
|
2767
|
-
if(detail.refused){
|
|
2768
|
-
// refused before it started (e.g. the page could not be fetched): the server's plain words, status word from the table
|
|
2930
|
+
if(detail.refused || detail.skipped){
|
|
2931
|
+
// refused before it started (e.g. the page could not be fetched) or skipped by the job's ticket filter (R5): the server's plain words, status word from the table
|
|
2769
2932
|
syncResultTab({});
|
|
2770
2933
|
setRunHeader(detail.glyph, runName(detail.job, detail.runNo, detail.runid), statusWordHtml(detail.status, "") + " \u00B7 " + escapeXml("started " + fmtLocalDateTime(detail.at)));
|
|
2771
2934
|
document.getElementById("run-empty").hidden = false;
|
|
2772
2935
|
document.getElementById("run-empty").textContent = detail.endedLine || "";
|
|
2773
|
-
|
|
2936
|
+
// the Run tab shows the words above and ONLY the action row (Reuse workflow) below: the rest of run-content has nothing to show
|
|
2937
|
+
document.getElementById("run-content").hidden = false;
|
|
2938
|
+
document.getElementById("run-content").classList.add("actions-only");
|
|
2774
2939
|
document.getElementById("audit-select-empty").hidden = false;
|
|
2775
2940
|
document.getElementById("audit-select-empty").textContent = detail.endedLine || "";
|
|
2776
2941
|
document.getElementById("audit-body").hidden = true;
|
|
2942
|
+
renderRunActions(detail); // the SAME owner: the server's detail says which buttons (Reuse workflow on every ending)
|
|
2777
2943
|
return;
|
|
2778
2944
|
}
|
|
2779
2945
|
|
|
@@ -3475,7 +3641,7 @@
|
|
|
3475
3641
|
// line 2 of a part's card / Audit body: the drafting step names, or a worker part's tool breakdown
|
|
3476
3642
|
function partLine2Text(part){
|
|
3477
3643
|
if(part && part.kind === "door") return part.doorView ? "last answer: " + part.doorView.last : "";
|
|
3478
|
-
if(part && part.kind === "drafting") return (part.draftSteps || []).map(function(x){ return x.label; }).join(" · ");
|
|
3644
|
+
if(part && part.kind === "drafting") return (part.draftLabel ? part.draftLabel + " \u00B7 " : "") + (part.draftSteps || []).map(function(x){ return x.label; }).join(" · ");
|
|
3479
3645
|
return toolBreakdownLine(part.byTool);
|
|
3480
3646
|
}
|
|
3481
3647
|
function draftingCallCost(c){
|
|
@@ -3487,6 +3653,13 @@
|
|
|
3487
3653
|
// call's own label (confirm#2, revise-1…); the last row is the total, equal to the header's money
|
|
3488
3654
|
function draftingTableHtml(part){
|
|
3489
3655
|
var rows = "";
|
|
3656
|
+
// fwd am14 item 6: a revise or a Start over says so, first, in the server's own words (`revise 1`, `revise 2`, `start over`); a first draft has no such row
|
|
3657
|
+
if(part.draftLabel) rows += '<tr class="draft-kind-row" data-testid="drafting-kind"><td colspan="5"><b>' + escapeXml(part.draftLabel) + "</b></td></tr>";
|
|
3658
|
+
// the checks themselves are the Audit's own "Checks" section now (`auditChecks`, one list with each row's result), not a second list here
|
|
3659
|
+
// F-b: a suggested check code could not build is told here in one plain sentence, never on the card
|
|
3660
|
+
(part.draftNotBuilt || []).forEach(function(c){
|
|
3661
|
+
rows += '<tr class="draft-checks-row" data-testid="drafting-notbuilt"><td colspan="5" style="overflow-wrap:anywhere">line ' + escapeXml(String(c.line)) + " \u00B7 " + escapeXml(c.text) + "</td></tr>";
|
|
3662
|
+
});
|
|
3490
3663
|
(part.draftSteps || []).forEach(function(st){
|
|
3491
3664
|
var wall = st.wallMs === null || st.wallMs === undefined ? "–" : duration(st.wallMs);
|
|
3492
3665
|
var calls = Array.isArray(st.calls) ? st.calls : [];
|
|
@@ -3670,6 +3843,51 @@
|
|
|
3670
3843
|
}
|
|
3671
3844
|
});
|
|
3672
3845
|
}
|
|
3846
|
+
// one row of the Audit's check list: its words, its tag, its result in the one state sign+word markup (a row with no recorded verdict says so, never "passed")
|
|
3847
|
+
function auditCheckRowHtml(r){
|
|
3848
|
+
var res = r.result === "held" ? ["green", r.word || "held"] : r.result === "record-missing" ? ["grey", r.word || "the gate's record for this run is missing"] : r.result === "passed" ? ["green", "passed"] : r.result === "failed" ? ["red", "failed"] : r.result === "not-checked" ? ["grey", "not checked"] : ["grey", "no result recorded"];
|
|
3849
|
+
return '<div class="audit-check-row" data-testid="audit-check-row" data-result="' + escapeXml(r.result) + '" style="overflow-wrap:anywhere">' + escapeXml(r.text) + byTagOf(r.by) + " " + stateDotHTML(res[0], res[1], "audit-check-state") + "</div>";
|
|
3850
|
+
}
|
|
3851
|
+
// the Checks fold's one state sign (code-owned, one place): any row failed = [✗]; else any row with no recorded result / no gate record = [·]; else [✓] ("held" is passed, "not checked" rows never move it)
|
|
3852
|
+
function auditChecksSignClass(rows){
|
|
3853
|
+
if(rows.some(function(r){ return r.result === "failed"; })) return glyphClass("\u2717");
|
|
3854
|
+
if(rows.some(function(r){ return r.result === "none" || r.result === "record-missing"; })) return glyphClass("\u00B7");
|
|
3855
|
+
return glyphClass("\u2713");
|
|
3856
|
+
}
|
|
3857
|
+
function auditChecksEl(ac){
|
|
3858
|
+
var wrap = document.createElement("div");
|
|
3859
|
+
wrap.className = "audit-part";
|
|
3860
|
+
wrap.setAttribute("data-testid", "audit-checks-group");
|
|
3861
|
+
var all = (ac.checks || []).concat(ac.always || []);
|
|
3862
|
+
var nPass = all.filter(function(r){ return r.result === "passed" || r.result === "held"; }).length;
|
|
3863
|
+
var nFail = all.filter(function(r){ return r.result === "failed"; }).length;
|
|
3864
|
+
var head = "Checks · " + nPass + " passed" + (nFail ? " · " + nFail + " failed" : "") + ((ac.notChecked || []).length ? " · " + ac.notChecked.length + " not checked" : "");
|
|
3865
|
+
var btn = document.createElement("button");
|
|
3866
|
+
btn.type = "button";
|
|
3867
|
+
btn.className = "btn audit-part-toggle";
|
|
3868
|
+
btn.setAttribute("aria-expanded", "false");
|
|
3869
|
+
btn.setAttribute("data-testid", "audit-checks-toggle");
|
|
3870
|
+
var headHtml = function(open){ return auditCaret(open) + stateDotHTML(auditChecksSignClass(all), "", "audit-checks-state") + head; };
|
|
3871
|
+
btn.innerHTML = headHtml(false);
|
|
3872
|
+
var body = document.createElement("div");
|
|
3873
|
+
body.className = "audit-part-body";
|
|
3874
|
+
body.hidden = true;
|
|
3875
|
+
body.setAttribute("data-testid", "audit-checks-body");
|
|
3876
|
+
var sec = function(title, rows, tid){
|
|
3877
|
+
if(!rows || !rows.length) return "";
|
|
3878
|
+
return '<div data-testid="' + tid + '" style="margin:6px 0"><div><b>' + escapeXml(title) + "</b></div>" + rows.map(auditCheckRowHtml).join("") + "</div>";
|
|
3879
|
+
};
|
|
3880
|
+
body.innerHTML = '<div class="jp">' + sec("Checks", ac.checks, "audit-checks-checks") + sec("Not checked", ac.notChecked, "audit-checks-notchecked") + sec("Always checked", ac.always, "audit-checks-always") + "</div>";
|
|
3881
|
+
btn.addEventListener("click", function(){
|
|
3882
|
+
var open = btn.getAttribute("aria-expanded") === "true";
|
|
3883
|
+
btn.setAttribute("aria-expanded", open ? "false" : "true");
|
|
3884
|
+
body.hidden = open;
|
|
3885
|
+
btn.innerHTML = headHtml(!open);
|
|
3886
|
+
});
|
|
3887
|
+
wrap.appendChild(btn);
|
|
3888
|
+
wrap.appendChild(body);
|
|
3889
|
+
return wrap;
|
|
3890
|
+
}
|
|
3673
3891
|
function renderAuditGroups(detail){
|
|
3674
3892
|
var container = document.getElementById("audit-groups");
|
|
3675
3893
|
container.innerHTML = "";
|
|
@@ -3728,6 +3946,11 @@
|
|
|
3728
3946
|
needsEl.textContent = detail.needsAudit;
|
|
3729
3947
|
container.appendChild(needsEl);
|
|
3730
3948
|
}
|
|
3949
|
+
// hamr ruling A (2026-11-13): the card's own sections (Checks, Not checked, Always checked), each row with its tag and, after the run, its recorded result (server: `auditChecks`)
|
|
3950
|
+
var ac = detail.auditChecks;
|
|
3951
|
+
if(ac && ((ac.checks || []).length || (ac.notChecked || []).length || (ac.always || []).length)){
|
|
3952
|
+
container.appendChild(auditChecksEl(ac));
|
|
3953
|
+
}
|
|
3731
3954
|
// P5-R: a resumed run is ONE run — its legs are told apart by a divider line (code-owned text from the server)
|
|
3732
3955
|
var dividers = Array.isArray(detail.legDividers) ? detail.legDividers : [];
|
|
3733
3956
|
boxes.forEach(function(box, idx){
|
|
@@ -3929,32 +4152,46 @@
|
|
|
3929
4152
|
// ---- the ONE job plan drawing (P7): used by the chat's plan bubble AND the Job tab. `plan` is the server's model
|
|
3930
4153
|
// (src/panel/jobplan.js): numbered lines with their rule, the checks under the line each serves (folded), the AI's own
|
|
3931
4154
|
// "Not checked", the always-on guards. Only the marker is blue (--plan). Returns HTML (every text is escaped).
|
|
3932
|
-
|
|
3933
|
-
|
|
4155
|
+
// the tag of a row by its kind (F-c, code-owned): `~` rows [you], `!` rows [agent], `$` rows [default]; one spelling for the confirm card, the signed card, the Job tab and the Result tab
|
|
4156
|
+
function byTagOf(by){ return by === "you" ? ' <span class="by" data-testid="plan-by" data-by="you">[you]</span>' : by === "agent" ? ' <span class="by" data-testid="plan-by" data-by="agent">[agent]</span>' : by === "default" ? ' <span class="by" data-testid="plan-by" data-by="default">[default]</span>' : ""; }
|
|
4157
|
+
function renderJobPlan(plan, ctl){
|
|
4158
|
+
// the legend promises \u203A checks, so it shows only when the plan has one to show (the goal-only confirm card has none yet)
|
|
4159
|
+
var hasCheck = (plan.loose || []).length > 0 || (plan.lines || []).some(function(l){ return (l.checks || []).length || (l.picked || []).length || (l.always || []).length; });
|
|
4160
|
+
var h = '<div class="jp" data-testid="job-plan">' + (plan.older ? '<div class="older" data-testid="plan-older">older job \u2014 numbered lines were not saved</div>' : "") + (hasCheck ? '<div class="jp-legend">Done when every <b>\u203A</b> check passes</div>' : "") +
|
|
3934
4161
|
(plan.goal && !plan.older ? '<div class="jp-sum" data-testid="plan-goal"><span class="lbl">AI\'s summary</span>' + escapeXml(plan.goal) + "</div>" : "");
|
|
4162
|
+
var byTag = byTagOf;
|
|
4163
|
+
// `ctl` (the confirm card only): draws a Drop button after an [agent] check that has a row key; a [you] or [default] row has none
|
|
3935
4164
|
var checkLine = function(c){
|
|
3936
|
-
return '<div class="fold" data-testid="plan-check"><span class="mk">\u203A</span> check \u00B7 ' + escapeXml(c.name) + (c.cls ? " \u00B7 " + escapeXml(c.cls) : "") + "</div>";
|
|
4165
|
+
return '<div class="fold" data-testid="plan-check"><span class="mk">\u203A</span> check \u00B7 ' + escapeXml(c.name) + (c.cls ? " \u00B7 " + escapeXml(c.cls) : "") + byTag(c.by) + (ctl && c.by === "agent" && c.key ? ctl("drop", c.key) : "") + "</div>";
|
|
3937
4166
|
};
|
|
3938
4167
|
(plan.lines || []).forEach(function(l){
|
|
3939
4168
|
h += '<div class="jl" data-testid="plan-line"><span class="num">' + escapeXml(String(l.n)) + "</span>" + escapeXml(l.text);
|
|
3940
4169
|
// one `~` row per rule (fwdloop's shape); an older plan that carries only the joined `rule` still shows it
|
|
3941
4170
|
(l.rules && l.rules.length ? l.rules : (l.rule ? [l.rule] : [])).forEach(function(r){ h += '<div class="sub">~ ' + escapeXml(r) + "</div>"; });
|
|
4171
|
+
(l.picked || []).forEach(function(p){ h += '<div class="fold" data-testid="plan-picked"><span class="mk">\u203A</span> check \u00B7 ' + escapeXml(p) + byTag("you") + "</div>"; });
|
|
3942
4172
|
(l.checks || []).forEach(function(c){ h += checkLine(c); });
|
|
3943
|
-
(l.always || []).forEach(function(g){ h += '<div class="fold" data-testid="plan-always"><span class="mk">\u203A</span> check \u00B7 always-on: ' + escapeXml(g) + "</div>"; });
|
|
3944
|
-
(l.refused || []).forEach(function(r){ h += '<div class="fold" data-testid="plan-refused"><span class="mk">\u203A</span> not checked \u00B7 ' + escapeXml(r) + "</div>"; });
|
|
4173
|
+
(l.always || []).forEach(function(g){ h += '<div class="fold" data-testid="plan-always"><span class="mk">\u203A</span> check \u00B7 always-on: ' + escapeXml(g) + byTag("default") + "</div>"; });
|
|
4174
|
+
(l.refused || []).forEach(function(r){ h += '<div class="fold" data-testid="plan-refused"><span class="mk">\u203A</span> not checked \u00B7 ' + escapeXml(r) + byTag((plan.notCheckedBy || {})[r]) + "</div>"; });
|
|
3945
4175
|
h += "</div>";
|
|
3946
4176
|
});
|
|
3947
4177
|
if((plan.loose || []).length){
|
|
3948
4178
|
h += '<div class="jl"><span class="num"></span>other checks' + plan.loose.map(checkLine).join("") + "</div>";
|
|
3949
4179
|
}
|
|
3950
|
-
|
|
4180
|
+
// N-1: checks the agent suggests that are NOT in the job. Code has already proved each builds; none is checked unless the person adds it
|
|
4181
|
+
if((plan.suggested || []).length){
|
|
4182
|
+
h += '<div class="jl jp-sug" data-testid="plan-suggested"><span class="num"></span><span class="lbl">Suggested \u00B7 not in your job, not checked unless you add it</span>' + plan.suggested.map(function(x){
|
|
4183
|
+
return '<div class="fold" data-testid="plan-suggest-row"><span class="mk">\u203A</span> line ' + escapeXml(String(x.line)) + " \u00B7 " + escapeXml(x.text) + byTag("agent") + (x.dropped ? " (you dropped it)" : "") + (ctl ? ctl("add", x.key) : "") + "</div>";
|
|
4184
|
+
}).join("") + "</div>";
|
|
4185
|
+
}
|
|
4186
|
+
var fold = function(title, items, testid, by){
|
|
3951
4187
|
if(!items || !items.length) return "";
|
|
3952
4188
|
return '<details class="fold" data-testid="' + testid + '"><summary>' + escapeXml(title) + " \u00B7 " + items.length + "</summary><ul>" +
|
|
3953
|
-
items.map(function(x){ return "<li>" + escapeXml(x) + "</li>"; }).join("") + "</ul></details>";
|
|
4189
|
+
items.map(function(x){ return "<li>" + escapeXml(x) + byTag(by ? by : (plan.notCheckedBy || {})[x]) + "</li>"; }).join("") + "</ul></details>";
|
|
3954
4190
|
};
|
|
3955
|
-
h += fold("Not checked
|
|
4191
|
+
h += fold("Not checked", plan.notChecked, "plan-notchecked");
|
|
3956
4192
|
h += fold("How the page was read", plan.readNotes, "plan-readnotes");
|
|
3957
|
-
h += fold("Always checked", plan.alwaysOn, "plan-alwayson");
|
|
4193
|
+
h += fold("Always checked", plan.alwaysOn, "plan-alwayson", "default");
|
|
4194
|
+
if(plan.ticketFilter) h += '<div class="fold" data-testid="plan-ticketfilter"><span class="mk">\u203A</span> ticket filter \u00B7 ' + escapeXml(plan.ticketFilter) + "</div>";
|
|
3958
4195
|
return h + "</div>";
|
|
3959
4196
|
}
|
|
3960
4197
|
|
|
@@ -3989,6 +4226,17 @@
|
|
|
3989
4226
|
? ins.map(function(i){ return '<div><span class="num-in">' + escapeXml(String(i.n)) + "</span> " + escapeXml(i.label + ": " + i.value) + "</div>"; }).join("")
|
|
3990
4227
|
: "not recorded";
|
|
3991
4228
|
document.getElementById("details-signed").textContent = job.signed || "not recorded";
|
|
4229
|
+
// piece 8 (fwd am4): a job with an MCP shows its signed flow type, server and tools (and a ticket filter / watched fields when it has them); a plain job shows no MCP row
|
|
4230
|
+
var mcpField = document.getElementById("details-mcp-field"), mcpBox = document.getElementById("details-mcp");
|
|
4231
|
+
mcpBox.innerHTML = "";
|
|
4232
|
+
var mcpJob = job.mcp && typeof job.mcp === "object" ? job.mcp : null;
|
|
4233
|
+
mcpField.hidden = mcpJob === null;
|
|
4234
|
+
if(mcpJob !== null){
|
|
4235
|
+
var rows = ["flow type \u00b7 " + mcpJob.flowType, "MCP \u00b7 " + mcpJob.server].concat((mcpJob.tools || []).map(function(t){ return "tools \u00b7 " + t; }));
|
|
4236
|
+
if(mcpJob.ticketFilter) rows.push("ticket filter \u00b7 " + (mcpJob.ticketFilterWords || JSON.stringify(mcpJob.ticketFilter)));
|
|
4237
|
+
if(Array.isArray(mcpJob.ticketWatch)) rows.push("watched field \u00b7 " + mcpJob.ticketWatch.join(", "));
|
|
4238
|
+
rows.forEach(function(r){ var d = document.createElement("div"); d.textContent = r; mcpBox.appendChild(d); });
|
|
4239
|
+
}
|
|
3992
4240
|
document.getElementById("details-dest").textContent = job.destination;
|
|
3993
4241
|
document.getElementById("details-tools").textContent = job.tools;
|
|
3994
4242
|
document.getElementById("details-cap-money").textContent = panelMoney(job.budgetUsd);
|
|
@@ -3998,7 +4246,7 @@
|
|
|
3998
4246
|
paintOfferedRow();
|
|
3999
4247
|
}
|
|
4000
4248
|
|
|
4001
|
-
// ---- Result tab (PRD v1.107 Part 6, rubric jobs
|
|
4249
|
+
// ---- Result tab (PRD v1.107 Part 6, rubric jobs; every other ended job wears the generic tab below, R7b item 4; signed visual design/result-tab-mock.html variant F) ----
|
|
4002
4250
|
// The server decides everything: `detail.hasResult` shows the tab, `/result` carries the signed lines, the facts' own sentences
|
|
4003
4251
|
// (src/facts.js factSentence), the rows of the delivered file (sha256-checked against the run's own record) and `passed` (read from the
|
|
4004
4252
|
// run's own check-run). The page only draws; it never decides a check and never searches a quote for a word.
|
|
@@ -4006,7 +4254,8 @@
|
|
|
4006
4254
|
var resultData = null;
|
|
4007
4255
|
function resultTabShown(){ return document.getElementById("tab-result").getAttribute("aria-selected") === "true"; }
|
|
4008
4256
|
function clearResult(){
|
|
4009
|
-
resultDetail = null; resultData = null;
|
|
4257
|
+
resultDetail = null; resultData = null; resultGrid = null; gridRowData = {};
|
|
4258
|
+
gridUi = { open: {}, rows: {}, anyway: null, msg: "", ownFor: null, focusAnyway: false };
|
|
4010
4259
|
document.getElementById("result-body").hidden = true;
|
|
4011
4260
|
document.getElementById("result-body").innerHTML = "";
|
|
4012
4261
|
document.getElementById("result-empty").hidden = false;
|
|
@@ -4028,9 +4277,13 @@
|
|
|
4028
4277
|
if(!show) clearResult();
|
|
4029
4278
|
}
|
|
4030
4279
|
function loadResult(runid){
|
|
4031
|
-
|
|
4280
|
+
// R8: the job's ticket grid rides along; a job that is not a Tickets job answers 404, which is simply "no grid"
|
|
4281
|
+
var gridP = getJSON("/api/runs/" + encodeURIComponent(runid) + "/grid").catch(function(){ return null; });
|
|
4282
|
+
return Promise.all([getJSON("/api/runs/" + encodeURIComponent(runid) + "/result"), gridP]).then(function(both){
|
|
4032
4283
|
if(runid !== currentRunid || !resultDetail || resultDetail.runid !== runid) return;
|
|
4033
|
-
resultData =
|
|
4284
|
+
resultData = both[0];
|
|
4285
|
+
resultGrid = both[1] && Array.isArray(both[1].groups) ? both[1] : null;
|
|
4286
|
+
if(resultGrid) gridOpenOwn(resultGrid, runid);
|
|
4034
4287
|
renderResult();
|
|
4035
4288
|
}).catch(function(){ /* the tab keeps what it last drew */ });
|
|
4036
4289
|
}
|
|
@@ -4101,10 +4354,10 @@
|
|
|
4101
4354
|
return h;
|
|
4102
4355
|
}
|
|
4103
4356
|
// a list, one row per item (the Job tab lists the same items one per row)
|
|
4104
|
-
function resultNotChecked(label, items, testid){
|
|
4357
|
+
function resultNotChecked(label, items, testid, by){
|
|
4105
4358
|
if(!items || !items.length) return "";
|
|
4106
4359
|
return resultField(label, '<div class="ro-value" data-testid="' + testid + '"><ul style="margin:0;padding-left:18px">' +
|
|
4107
|
-
items.map(function(t){ return '<li>' + escapeXml(t) + '</li>'; }).join("") + '</ul></div>');
|
|
4360
|
+
items.map(function(t){ return '<li>' + escapeXml(t) + (by && typeof byTagOf === "function" ? byTagOf(by[t]) : "") + '</li>'; }).join("") + '</ul></div>');
|
|
4108
4361
|
}
|
|
4109
4362
|
// the web page a result was read from: a link (http/https only, new tab) and the server's words that the page may have moved on
|
|
4110
4363
|
function resultPageLink(url, note, testid){
|
|
@@ -4117,7 +4370,75 @@
|
|
|
4117
4370
|
return '<div class="job-card" data-testid="result-line"><h4>Line ' + escapeXml(String(line.n)) + '</h4>' + resultLineBox(line) +
|
|
4118
4371
|
(own ? resultPageLink(line.page, note, "result-page-line") : "") +
|
|
4119
4372
|
(line.kind === "facts" ? resultFactsLine(line) : resultTextLine(line)) +
|
|
4120
|
-
resultNotChecked("Not checked", line.notChecked, "result-line-notchecked") + '</div>';
|
|
4373
|
+
resultNotChecked("Not checked", line.notChecked, "result-line-notchecked", line.notCheckedBy) + '</div>';
|
|
4374
|
+
}
|
|
4375
|
+
// ---- the generic Result tab (R7b item 4): every ended non-rubric run. The server sends the facts and the words (`kind: "generic"`); the page only draws.
|
|
4376
|
+
// The check words and numbers are the Run/Audit tabs' own owners (stageQuestionText, stageNumberText); the state word is the status table's (the server sends it).
|
|
4377
|
+
// a unified diff, one span per line: + added, - removed, anything else (headers, hunks, context) dim. Every piece is escaped.
|
|
4378
|
+
function resultDiffHtml(diff){
|
|
4379
|
+
return String(diff).split("\n").map(function(l){
|
|
4380
|
+
var cls = (l.charAt(0) === "+" && l.indexOf("+++") !== 0) ? "rs-add" : ((l.charAt(0) === "-" && l.indexOf("---") !== 0) ? "rs-del" : "rs-ctx");
|
|
4381
|
+
return '<span class="' + cls + '">' + escapeXml(l) + '</span>';
|
|
4382
|
+
}).join("\n");
|
|
4383
|
+
}
|
|
4384
|
+
function resultTicketCard(t){
|
|
4385
|
+
if(!t) return "";
|
|
4386
|
+
var link = typeof t.url === "string" && /^https?:\/\//i.test(t.url)
|
|
4387
|
+
? '<div class="hint"><a data-testid="result-ticket-link" href="' + escapeXml(t.url) + '" target="_blank" rel="noopener noreferrer">' + escapeXml(t.url) + '</a></div>' : "";
|
|
4388
|
+
return '<div class="job-card" data-testid="result-ticket"><h4>The ticket</h4><div class="field"><div class="ro-value" data-testid="result-ticket-title" style="color:var(--text)">#' + escapeXml(String(t.number)) +
|
|
4389
|
+
' · ' + escapeXml(t.title || "") + '</div>' + link + '</div></div>';
|
|
4390
|
+
}
|
|
4391
|
+
function resultJobCard(job){
|
|
4392
|
+
return '<div class="job-card" data-testid="result-job"><h4>The job</h4>' +
|
|
4393
|
+
resultField("What it was asked", '<div class="ro-value" data-testid="result-asked" style="white-space:pre-wrap">' + escapeXml(job.asked) + '</div>') +
|
|
4394
|
+
(Array.isArray(job.scope) && job.scope.length ? resultField("Where it may change files", '<div class="ro-value" data-testid="result-scope">' + escapeXml(job.scope.join(", ")) + '</div>') : "") + '</div>';
|
|
4395
|
+
}
|
|
4396
|
+
function resultChangedCard(c){
|
|
4397
|
+
if(!c) return '<div class="job-card" data-testid="result-changed"><h4>What changed</h4><div class="hint" data-testid="result-changed-none">no edit was recorded for this run</div></div>';
|
|
4398
|
+
var last = c.last.files.map(function(f){ return resultDiffHtml(f.diff); }).join("\n") + (c.last.note ? '\n<span class="rs-ctx">' + escapeXml(c.last.note) + '</span>' : "");
|
|
4399
|
+
var all = c.all.map(function(e){
|
|
4400
|
+
return '<div class="hint">edit ' + e.n + (e.step ? ' · ' + escapeXml(e.step) : "") + '</div>' + e.files.map(function(f){
|
|
4401
|
+
return '<pre class="rs-diff">' + resultDiffHtml(f.diff) + (f.cutNote ? '\n<span class="rs-ctx">' + escapeXml(f.cutNote) + '</span>' : "") + '</pre>';
|
|
4402
|
+
}).join("");
|
|
4403
|
+
}).join("");
|
|
4404
|
+
return '<div class="job-card" data-testid="result-changed"><h4>What changed</h4>' +
|
|
4405
|
+
resultField(c.head, '<div class="ro-value"><pre class="rs-diff" data-testid="result-diff">' + last + '</pre></div>') +
|
|
4406
|
+
'<details data-testid="result-all-edits"><summary>' + escapeXml(c.foldWords) + '</summary><div class="ro-value">' + all + '</div></details>' +
|
|
4407
|
+
(c.scopeLine ? '<div class="hint" data-testid="result-scopeline">' + escapeXml(c.scopeLine) + '</div>' : "") + '</div>';
|
|
4408
|
+
}
|
|
4409
|
+
// a check the STEPS ran (the close never did) says how many times its step tried; a close stage has no `tries`
|
|
4410
|
+
function stageTriedText(s){ return !s.passed && typeof s.tries === "number" && s.tries > 1 ? " (tried " + s.tries + " times)" : ""; }
|
|
4411
|
+
function resultChecksCard(k){
|
|
4412
|
+
if(!k) return '<div class="job-card" data-testid="result-checks"><h4>The checks</h4><div class="hint" data-testid="result-checks-none">the close did not run any check for this run</div></div>';
|
|
4413
|
+
var rows = k.stages.map(function(s){
|
|
4414
|
+
var num = stageNumberText(s);
|
|
4415
|
+
return '<div class="rs-check" data-testid="result-check"><span class="rs-q">' + escapeXml(stageQuestionText(s)) + '</span><span class="rs-num hint" data-testid="result-check-num">' +
|
|
4416
|
+
(num ? escapeXml(num) : "") + escapeXml(stageTriedText(s)) + '</span><span class="rs-sign">' + stateDotHTML(s.passed ? "green" : "red", s.status.word, "result-check-state") + '</span></div>';
|
|
4417
|
+
}).join("");
|
|
4418
|
+
var notes = k.notes.length ? '<details data-testid="result-close-notes"><summary>the close\'s own notes</summary><div class="ro-value" style="white-space:pre-wrap">' +
|
|
4419
|
+
k.notes.map(function(n){ return escapeXml(n.text); }).join("\n") + '</div></details>' : "";
|
|
4420
|
+
return '<div class="job-card" data-testid="result-checks"><h4>The checks</h4>' +
|
|
4421
|
+
resultField(k.head, '<div class="ro-value" data-testid="result-check-list">' + rows + '</div>') + notes + '</div>';
|
|
4422
|
+
}
|
|
4423
|
+
function resultWorkCard(w){
|
|
4424
|
+
if(!w) return "";
|
|
4425
|
+
return '<div class="job-card" data-testid="result-work"><h4>The work</h4>' +
|
|
4426
|
+
resultField("Branch", '<div class="ro-value" data-testid="result-branch">' + escapeXml(w.branch) + ' <span class="hint">· final commit ' + escapeXml(w.finalCommit) + (w.madeFrom ? ' · made from ' + escapeXml(w.madeFrom) : "") + '</span></div>') +
|
|
4427
|
+
resultField("In", '<div class="ro-value" data-testid="result-repo">' + escapeXml(w.repo) + '</div>') +
|
|
4428
|
+
resultField("Keep the work", '<div class="ro-value" data-testid="result-merge">' + escapeXml(w.merge) + '</div>') +
|
|
4429
|
+
resultField("Throw it away", '<div class="ro-value" data-testid="result-drop">' + escapeXml(w.drop) + '</div>') +
|
|
4430
|
+
'<div class="hint" data-testid="result-work-note">' + escapeXml(w.note) + '</div></div>';
|
|
4431
|
+
}
|
|
4432
|
+
function resultRunCard(run){
|
|
4433
|
+
return '<div class="job-card" data-testid="result-run"><h4>The run</h4><div class="field-row">' +
|
|
4434
|
+
resultField("Spent", '<div class="ro-value" data-testid="result-spent">' + escapeXml(run.spent) + (run.spentNote ? ' <span class="hint">(' + escapeXml(run.spentNote) + ')</span>' : "") + '</div>') +
|
|
4435
|
+
resultField("Time", '<div class="ro-value" data-testid="result-time">' + escapeXml(run.time) + '</div>') +
|
|
4436
|
+
(run.steps ? resultField("Steps", '<div class="ro-value" data-testid="result-steps">' + escapeXml(run.steps) + '</div>') : "") + '</div></div>';
|
|
4437
|
+
}
|
|
4438
|
+
// the whole generic tab, top to bottom; the Your call card is the rubric tab's own resultDoorHtml, only while the run waits at the door
|
|
4439
|
+
function resultGenericHtml(data, detail){
|
|
4440
|
+
return resultTicketCard(data.ticket) + resultJobCard(data.job) + resultChangedCard(data.changed) + resultChecksCard(data.checks) + resultWorkCard(data.work) + resultRunCard(data.run) +
|
|
4441
|
+
(detail.accept === true && !detail.live ? resultDoorHtml(data.door) : "");
|
|
4121
4442
|
}
|
|
4122
4443
|
function resultDoorHtml(door){
|
|
4123
4444
|
return '<div class="job-card" id="result-door-card" data-testid="result-door"><h4>Your call</h4><div class="field"><div class="ro-value"><b class="st-word">' + escapeXml(door.head) + '</b> \u2014 ' + escapeXml(door.ask) + '</div></div>' +
|
|
@@ -4161,6 +4482,165 @@
|
|
|
4161
4482
|
}).catch(function(x){ pause.disabled = false; say("resume-err", "could not reach the panel: " + x.message, "result-door-err"); });
|
|
4162
4483
|
});
|
|
4163
4484
|
}
|
|
4485
|
+
// ---- R8 (piece 10): a TICKET job's Result tab is ONE grid instead of the five generic boxes. borrowed-from: fwdloop src/panel/index.html@v0.29.0 (the grid markup and its wiring), drawn as the signed
|
|
4486
|
+
// mockup (.claude/scratch/mcp-tickets/r7b/result-tab-tickets.html). The server decides every bucket, mark, name, money word and reason (`GET /api/runs/:runid/grid`, src/panel/jobgrid.js); a row opens
|
|
4487
|
+
// through the generic payload of THAT run (`GET /api/runs/:runid/result`, the one owner), so no diff or check is read twice. Pure functions take the state they draw (`ui`, `rowData`, `cur`).
|
|
4488
|
+
var resultGrid = null;
|
|
4489
|
+
var gridUi = { open: {}, rows: {}, anyway: null, msg: "", ownFor: null, focusAnyway: false };
|
|
4490
|
+
var gridRowData = {};
|
|
4491
|
+
function tgMark(c){ return gridGlyph(c === "g" ? "✓" : (c === "r" ? "✗" : (c === "q" ? "?" : "·"))); }
|
|
4492
|
+
// no data = the panel's grey dash (the Audit grid's `cell none`), never a "?" or "unknown"
|
|
4493
|
+
function tgCell(cell){ if(cell.mark === "n" && !cell.text) return '<td class="c"><span class="cell none">\u2014</span></td>'; return '<td class="c">' + tgMark(cell.mark) + (cell.text ? '<span class="tg-val">' + escapeXml(cell.text) + '</span>' : "") + '</td>'; }
|
|
4494
|
+
// the row's own data: the open run's payload is already loaded; any other row's is fetched when it opens
|
|
4495
|
+
function tgRowData(runId){ return resultData && resultData.runid === runId ? resultData : (gridRowData[runId] || null); }
|
|
4496
|
+
// checks line of an opened row: the generic payload's stages, in the Run/Audit tabs' own question words and numbers
|
|
4497
|
+
function tgChecksLine(k){
|
|
4498
|
+
if(!k) return "checks: the close did not run any check for this run";
|
|
4499
|
+
var bits = k.stages.map(function(s){
|
|
4500
|
+
var num = stageNumberText(s);
|
|
4501
|
+
return s.passed ? escapeXml(stageQuestionText(s)) : gridGlyph("✗") + " " + escapeXml(stageQuestionText(s)) + (num ? " — " + escapeXml(num) : "") + escapeXml(stageTriedText(s));
|
|
4502
|
+
});
|
|
4503
|
+
return "checks: " + k.passed + " of " + k.total + " " + (k.allPassed ? gridGlyph("✓") : "") + (bits.length ? " · " : "") + bits.join(" · ");
|
|
4504
|
+
}
|
|
4505
|
+
// what an opened row says, top to bottom: the ticket, why it ended, what changed (+ the last diff), the checks, the work, the door (only for the run the person opened), the run id
|
|
4506
|
+
function tgOpenHtml(r, rd, canAct){
|
|
4507
|
+
var label = r.title ? r.name + " " + r.title : (r.ref || r.name);
|
|
4508
|
+
var link = typeof r.url === "string" && /^https?:\/\//i.test(r.url) ? ' · <a data-testid="grid-ticket-link" class="link" href="' + escapeXml(r.url) + '" target="_blank" rel="noopener noreferrer">' + escapeXml(r.url) + '</a>' : "";
|
|
4509
|
+
var h = '<div class="tg-line" data-testid="grid-ticket"><b>' + escapeXml(label) + '</b>' + link + '</div>';
|
|
4510
|
+
var why = rd && typeof rd.endedWords === "string" && rd.endedWords !== "" ? rd.endedWords : r.reason;
|
|
4511
|
+
if(r.bucket === "stop" || (r.bucket === "wait" && r.status.key === "running")) h += '<div class="tg-line" data-testid="grid-why">' + escapeXml(r.status.word) + (why ? ": " + escapeXml(why) : "") + '</div>';
|
|
4512
|
+
if(r.unsure) h += '<div class="tg-line hint" data-testid="grid-unsure-line">' + escapeXml(r.unsureSay || "") + '</div>';
|
|
4513
|
+
if(!rd) h += '<div class="tg-line hint" data-testid="grid-loading">loading this run…</div>';
|
|
4514
|
+
else if(rd.none) h += "";
|
|
4515
|
+
else if(rd.kind !== "generic") h += '<div class="tg-line hint" data-testid="grid-own-result">this run’s own result is on its page: open it with the run id below.</div>';
|
|
4516
|
+
else {
|
|
4517
|
+
var c = rd.changed;
|
|
4518
|
+
if(c){
|
|
4519
|
+
var shown = c.paths.length > 4 ? c.paths.slice(0, 4).join(", ") + " and " + (c.paths.length - 4) + " more" : c.paths.join(", ");
|
|
4520
|
+
h += '<div class="tg-line" data-testid="grid-changed">changed: ' + escapeXml(shown) + " (+" + c.plus + " −" + c.minus + ")</div>" +
|
|
4521
|
+
'<div class="tg-line"><pre class="rs-diff" data-testid="grid-diff">' + c.last.files.map(function(f){ return resultDiffHtml(f.diff); }).join("\n") + (c.last.note ? '\n<span class="rs-ctx">' + escapeXml(c.last.note) + '</span>' : "") + '</pre></div>';
|
|
4522
|
+
} else h += '<div class="tg-line" data-testid="grid-changed">no edit was recorded for this run</div>';
|
|
4523
|
+
h += '<div class="tg-line" data-testid="grid-checks">' + tgChecksLine(rd.checks) + '</div>';
|
|
4524
|
+
if(rd.work) h += '<div class="tg-line" data-testid="grid-work">work: branch ' + escapeXml(rd.work.branch) + ' · <code>' + escapeXml(rd.work.merge) + '</code> · <code>' + escapeXml(rd.work.drop) + '</code></div>';
|
|
4525
|
+
if(canAct) h += resultDoorHtml(rd.door);
|
|
4526
|
+
}
|
|
4527
|
+
if(r.needs === "Accept" && !canAct) h += '<div class="tg-line hint" data-testid="grid-door-elsewhere">this run waits for your answer: open it with the run id below.</div>';
|
|
4528
|
+
return h + '<div class="tg-line"><button class="tk-rl" type="button" data-testid="ticket-run" data-run="' + escapeXml(r.runId) + '">' + escapeXml(r.runId) + '</button></div>';
|
|
4529
|
+
}
|
|
4530
|
+
function tgRowHTML(r, ui, cur){
|
|
4531
|
+
var skip = r.bucket === "skip";
|
|
4532
|
+
var open = skip || !!ui.rows[r.runId];
|
|
4533
|
+
var label = r.title ? r.name + " · " + r.title : r.name;
|
|
4534
|
+
var nameBtn = '<button class="tg-name" type="button" data-testid="grid-name" data-run="' + escapeXml(r.runId) + '" title="' + escapeXml(label) + '">' + escapeXml(label) + '</button>';
|
|
4535
|
+
var h = '<tr data-testid="grid-row" data-run="' + escapeXml(r.runId) + '"><td class="r"><div class="tg-rowname">' + (skip ? "" :
|
|
4536
|
+
'<button class="q-fold tg-arrow" type="button" data-testid="grid-open" data-run="' + escapeXml(r.runId) + '" aria-label="show ' + escapeXml(r.ref || r.name) + '" aria-expanded="' + open + '"></button>') + nameBtn +
|
|
4537
|
+
(r.unsure ? '<span class="badge grey tg-unsure" data-testid="grid-unsure" title="' + escapeXml(r.unsureSay || "") + '">unsure</span>' : "") + '</div></td>' +
|
|
4538
|
+
tgCell(r.steps) + tgCell(r.checks) + tgCell(r.cost) + tgCell(r.time) + '</tr>';
|
|
4539
|
+
if(skip){
|
|
4540
|
+
var mine = ui.anyway && ui.anyway.number === r.number;
|
|
4541
|
+
h += '<tr class="step-sub"><td colspan="5"><div class="tg-skipwhy"><span class="badge grey">' + escapeXml(r.status.word) + '</span><span data-testid="ticket-reason">' + escapeXml(r.reason || "") + '</span>' +
|
|
4542
|
+
(r.anyway && !mine ? '<button class="btn small" type="button" data-testid="ticket-anyway-open" data-number="' + r.number + '">Run it anyway</button>' : "") + '</div>';
|
|
4543
|
+
if(r.anyway && mine){
|
|
4544
|
+
h += '<div class="tk-anyway" data-testid="ticket-anyway-box"><textarea data-testid="ticket-anyway-text" aria-label="reason (needed to run it anyway)" placeholder="reason (needed to run it anyway)">' + escapeXml(ui.anyway.text) + '</textarea>' +
|
|
4545
|
+
'<button class="btn small" type="button" data-testid="ticket-anyway-go"' + (ui.anyway.text.trim() === "" ? " disabled" : "") + '>Run it anyway</button></div>';
|
|
4546
|
+
}
|
|
4547
|
+
h += '</td></tr>';
|
|
4548
|
+
} else if(open){
|
|
4549
|
+
h += '<tr class="step-sub"><td colspan="5">' + tgOpenHtml(r, tgRowData(r.runId), !!(cur && cur.runid === r.runId && cur.accept === true && !cur.live)) + '</td></tr>';
|
|
4550
|
+
}
|
|
4551
|
+
return h;
|
|
4552
|
+
}
|
|
4553
|
+
function tgStatsHTML(g){
|
|
4554
|
+
var c = g.stats.counts;
|
|
4555
|
+
return '<p class="tg-stats" data-testid="grid-stats">' + g.groups.map(function(b){ return '<b>' + c[b.key] + '</b> ' + escapeXml(b.label.toLowerCase()); }).join(" · ") + ' · spent <b>' + escapeXml(g.stats.spent) + '</b></p>';
|
|
4556
|
+
}
|
|
4557
|
+
function tgTableHTML(g, ui, cur){
|
|
4558
|
+
var h = '<div class="grid-wrap"><table class="grid tg" data-testid="grid-table"><thead><tr><th class="r">run</th><th class="t">steps<span class="hint">done</span></th><th class="t">checks<span class="hint">the close’s</span></th><th class="t">cost</th><th class="t">time</th></tr></thead><tbody>';
|
|
4559
|
+
g.groups.forEach(function(b){
|
|
4560
|
+
var open = ui.open[b.key] === undefined ? b.open : ui.open[b.key];
|
|
4561
|
+
h += '<tr class="tg-grp"><td colspan="5"><button class="tg-fold" type="button" data-testid="grid-fold-' + b.key + '" data-group="' + b.key + '" aria-expanded="' + open + '"><span class="tg-foldin">' + (open ? "▾" : "▸") + " " + escapeXml(b.label) + " (" + b.rows.length + ")</span></button></td></tr>";
|
|
4562
|
+
if(open) h += b.rows.map(function(r){ return tgRowHTML(r, ui, cur); }).join("");
|
|
4563
|
+
});
|
|
4564
|
+
return h + '</tbody></table></div>';
|
|
4565
|
+
}
|
|
4566
|
+
function gridCardHTML(g, ui, cur){
|
|
4567
|
+
return '<div class="audit-group" data-testid="result-grid"><h4><span class="badge grey">tickets</span></h4>' + tgStatsHTML(g) +
|
|
4568
|
+
(g.scheduleLine ? '<div class="hint" style="margin-bottom:6px" data-testid="grid-schedule">' + escapeXml(g.scheduleLine) + '</div>' : "") +
|
|
4569
|
+
'<div id="grid-host" data-testid="grid-host">' + tgTableHTML(g, ui, cur) + '</div><div class="tk-msg" id="ticket-msg" data-testid="ticket-msg">' + escapeXml(ui.msg) + '</div>' +
|
|
4570
|
+
'<div class="hint">newest first inside each bucket</div></div>';
|
|
4571
|
+
}
|
|
4572
|
+
// the grid opens with the row of the run the person came from, in its bucket, once per run
|
|
4573
|
+
function gridOpenOwn(g, runid){
|
|
4574
|
+
if(gridUi.ownFor === runid) return;
|
|
4575
|
+
gridUi.ownFor = runid;
|
|
4576
|
+
g.groups.forEach(function(b){ b.rows.forEach(function(r){ if(r.runId === runid){ gridUi.rows[runid] = true; gridUi.open[b.key] = true; } }); });
|
|
4577
|
+
}
|
|
4578
|
+
function gridRepaint(){
|
|
4579
|
+
var body = document.getElementById("result-body");
|
|
4580
|
+
var keepText = body.querySelector("#result-rerun-text");
|
|
4581
|
+
var typed = keepText ? keepText.value : "";
|
|
4582
|
+
var rerunOpen = !!body.querySelector("#result-rerun-box:not([hidden])");
|
|
4583
|
+
paintResultBody(body, gridCardHTML(resultGrid, gridUi, resultDetail), resultDetail, typed, rerunOpen);
|
|
4584
|
+
var ta = body.querySelector("[data-testid=ticket-anyway-text]");
|
|
4585
|
+
if(ta && gridUi.focusAnyway){ ta.focus(); ta.setSelectionRange(ta.value.length, ta.value.length); }
|
|
4586
|
+
}
|
|
4587
|
+
function gridClick(ev){
|
|
4588
|
+
var g = resultGrid;
|
|
4589
|
+
if(!g) return;
|
|
4590
|
+
var t = ev.target.closest ? ev.target.closest("button") : null;
|
|
4591
|
+
var host = document.getElementById("grid-host");
|
|
4592
|
+
if(!t || !host || !host.contains(t)) return;
|
|
4593
|
+
var tid = t.getAttribute("data-testid") || "";
|
|
4594
|
+
if(t.hasAttribute("data-group")){
|
|
4595
|
+
var k = t.getAttribute("data-group");
|
|
4596
|
+
var cur = g.groups.filter(function(x){ return x.key === k; })[0];
|
|
4597
|
+
gridUi.open[k] = !(gridUi.open[k] === undefined ? cur.open : gridUi.open[k]);
|
|
4598
|
+
gridRepaint();
|
|
4599
|
+
} else if(tid === "grid-open"){
|
|
4600
|
+
var id = t.getAttribute("data-run");
|
|
4601
|
+
gridUi.rows[id] = !gridUi.rows[id];
|
|
4602
|
+
gridRepaint();
|
|
4603
|
+
if(gridUi.rows[id] && !tgRowData(id)){
|
|
4604
|
+
getJSON("/api/runs/" + encodeURIComponent(id) + "/result").then(function(d){ gridRowData[id] = d; }).catch(function(){ gridRowData[id] = { runid: id, none: true, kind: "none" }; }).then(function(){ if(resultGrid === g) gridRepaint(); });
|
|
4605
|
+
}
|
|
4606
|
+
} else if(tid === "grid-name" || tid === "ticket-run"){
|
|
4607
|
+
selectRun(t.getAttribute("data-run")); document.getElementById("tab-run").click();
|
|
4608
|
+
} else if(tid === "ticket-anyway-open"){
|
|
4609
|
+
var n = Number(t.getAttribute("data-number"));
|
|
4610
|
+
gridUi.anyway = (gridUi.anyway && gridUi.anyway.number === n) ? null : { number: n, text: "" };
|
|
4611
|
+
gridUi.msg = ""; gridUi.focusAnyway = true; gridRepaint();
|
|
4612
|
+
} else if(tid === "ticket-anyway-go"){
|
|
4613
|
+
var a = gridUi.anyway;
|
|
4614
|
+
var msg = document.getElementById("ticket-msg");
|
|
4615
|
+
if(!a || a.text.trim() === ""){ gridUi.msg = "Please write a reason to run it anyway."; msg.textContent = gridUi.msg; return; }
|
|
4616
|
+
t.disabled = true;
|
|
4617
|
+
var anchor = g.runid;
|
|
4618
|
+
authorPost("/api/author/ticket-anyway", { job: g.job, ticket: a.number, reason: a.text.trim() }).then(function(r){
|
|
4619
|
+
var ok = r.status >= 200 && r.status < 300 && r.body && r.body.ok === true;
|
|
4620
|
+
gridUi.msg = (r.body && (r.body.say || r.body.error)) || (ok ? "Queued." : "Not queued. Nothing started.");
|
|
4621
|
+
if(ok){ gridUi.anyway = null; refreshRunsList(true); setTimeout(function(){ if(currentRunid === anchor) loadResult(anchor); }, 1500); }
|
|
4622
|
+
gridRepaint();
|
|
4623
|
+
}).catch(function(){ gridUi.msg = "Could not reach the panel. Nothing started."; document.getElementById("ticket-msg").textContent = gridUi.msg; t.disabled = false; });
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
function gridWire(body){
|
|
4627
|
+
if(body.getAttribute("data-grid-wired") === "1") return;
|
|
4628
|
+
body.setAttribute("data-grid-wired", "1");
|
|
4629
|
+
body.addEventListener("click", gridClick);
|
|
4630
|
+
body.addEventListener("input", function(ev){
|
|
4631
|
+
var ta = ev.target;
|
|
4632
|
+
if(!resultGrid || !ta || !ta.getAttribute || ta.getAttribute("data-testid") !== "ticket-anyway-text" || !gridUi.anyway) return;
|
|
4633
|
+
gridUi.anyway.text = ta.value;
|
|
4634
|
+
var go = body.querySelector("[data-testid=ticket-anyway-go]");
|
|
4635
|
+
if(go) go.disabled = ta.value.trim() === "";
|
|
4636
|
+
});
|
|
4637
|
+
body.addEventListener("keydown", function(ev){
|
|
4638
|
+
if(ev.key !== "Escape" || !resultGrid || !ev.target.getAttribute || ev.target.getAttribute("data-testid") !== "ticket-anyway-text") return;
|
|
4639
|
+
gridUi.anyway = null; gridUi.focusAnyway = false; gridUi.msg = ""; gridRepaint();
|
|
4640
|
+
});
|
|
4641
|
+
body.addEventListener("focusin", function(ev){ if(ev.target.getAttribute && ev.target.getAttribute("data-testid") === "ticket-anyway-text") gridUi.focusAnyway = true; });
|
|
4642
|
+
body.addEventListener("focusout", function(ev){ if(ev.target.getAttribute && ev.target.getAttribute("data-testid") === "ticket-anyway-text") gridUi.focusAnyway = false; });
|
|
4643
|
+
}
|
|
4164
4644
|
function renderResult(){
|
|
4165
4645
|
var detail = resultDetail, data = resultData;
|
|
4166
4646
|
var body = document.getElementById("result-body");
|
|
@@ -4171,6 +4651,9 @@
|
|
|
4171
4651
|
var keepText = body.querySelector("#result-rerun-text");
|
|
4172
4652
|
var typed = keepText ? keepText.value : "";
|
|
4173
4653
|
var rerunOpen = !!body.querySelector("#result-rerun-box:not([hidden])");
|
|
4654
|
+
// R8: a TICKET job shows its one grid instead (the generic boxes and the rubric tab stay for every other job)
|
|
4655
|
+
if(resultGrid && resultGrid.runid === detail.runid){ gridWire(body); paintResultBody(body, gridCardHTML(resultGrid, gridUi, detail), detail, typed, rerunOpen); return; }
|
|
4656
|
+
if(data.kind === "generic"){ paintResultBody(body, resultGenericHtml(data, detail), detail, typed, rerunOpen); return; }
|
|
4174
4657
|
var counters = document.getElementById("run-counters").textContent.split(" \u00b7 ");
|
|
4175
4658
|
var h = '<div class="job-card" data-testid="result-head"><h4>Result</h4>' +
|
|
4176
4659
|
resultField("Status", '<div class="ro-value">' + stateDotHTML(glyphClass(detail.glyph), detail.status && detail.status.word ? detail.status.word : "", "result-status") +
|
|
@@ -4184,7 +4667,7 @@
|
|
|
4184
4667
|
h += '<div class="rs-warn" data-testid="result-gap">The check said: ' + escapeXml(data.gap.line) + (data.gap.moreText ? ' ' + escapeXml(data.gap.moreText) : "") + '</div>';
|
|
4185
4668
|
}
|
|
4186
4669
|
if((data.notChecked || []).length){
|
|
4187
|
-
h += '<div class="job-card"><h4>Not checked</h4>' + resultNotChecked("Not checked
|
|
4670
|
+
h += '<div class="job-card"><h4>Not checked</h4>' + resultNotChecked("Not checked", data.notChecked, "result-notchecked", data.notCheckedBy) + '</div>';
|
|
4188
4671
|
}
|
|
4189
4672
|
if((data.readNotes || []).length){
|
|
4190
4673
|
h += '<div class="job-card"><h4>How the page was read</h4>' + resultNotChecked("How the page was read \u00b7 " + data.readNotes.length, data.readNotes, "result-readnotes") + '</div>';
|
|
@@ -4197,6 +4680,10 @@
|
|
|
4197
4680
|
: '<div class="run-actions" style="margin:6px 0 0;"><a class="btn" style="text-decoration:none;" data-testid="result-download" download href="/api/runs/' + encodeURIComponent(data.runid) + '/download?i=' + d.i + '">Download ' + escapeXml(d.name) + '</a></div>'));
|
|
4198
4681
|
}).join("") + '</div>';
|
|
4199
4682
|
}
|
|
4683
|
+
paintResultBody(body, h, detail, typed, rerunOpen);
|
|
4684
|
+
}
|
|
4685
|
+
// the one tail of both Result tabs: draw, then put back what the person was typing and wire the door
|
|
4686
|
+
function paintResultBody(body, h, detail, typed, rerunOpen){
|
|
4200
4687
|
body.innerHTML = h;
|
|
4201
4688
|
var ta = body.querySelector("#result-rerun-text");
|
|
4202
4689
|
if(ta){
|
|
@@ -4486,6 +4973,7 @@
|
|
|
4486
4973
|
settingsView.hidden = false;
|
|
4487
4974
|
loadProviders(true);
|
|
4488
4975
|
loadMoney();
|
|
4976
|
+
loadMcp();
|
|
4489
4977
|
});
|
|
4490
4978
|
document.getElementById("settings-back").addEventListener("click", function(){
|
|
4491
4979
|
settingsView.hidden = true;
|
|
@@ -4813,7 +5301,137 @@
|
|
|
4813
5301
|
}
|
|
4814
5302
|
|
|
4815
5303
|
document.getElementById("tab-providers").addEventListener("click", function(){ loadProviders(); });
|
|
4816
|
-
|
|
5304
|
+
|
|
5305
|
+
// ---- Settings > MCP (piece 7; borrowed-from fwdloop src/panel/index.html@d71846c). One list "Path and MCP": a path is a header, its MCPs sit under it.
|
|
5306
|
+
// The page only READS: GET /api/settings/mcp (names, flags, counts; never a command or a key) and, on a press, POST .../mcp-check for that one MCP.
|
|
5307
|
+
var mcpRoot = document.getElementById("mcp-paths");
|
|
5308
|
+
var mcpData = null;
|
|
5309
|
+
var mcpPathFold = {}; // path -> false when folded (paths start open)
|
|
5310
|
+
var mcpSrvOpen = {}; // path + tab + name -> true when open (MCPs start folded)
|
|
5311
|
+
var mcpMoreOpen = {};
|
|
5312
|
+
var mcpBusy = {};
|
|
5313
|
+
var mcpFail = {}; // path + tab + name -> the sentence of a press that was refused
|
|
5314
|
+
var MCP_TOOLS_SHOWN = 5;
|
|
5315
|
+
function loadMcp(){
|
|
5316
|
+
return authorGet("/api/settings/mcp").then(function(d){
|
|
5317
|
+
if(!d || !d.ok){ setNote(document.getElementById("mcp-problem"), true, "Could not read your MCP list. Reload the page."); return; }
|
|
5318
|
+
mcpData = d; setNote(document.getElementById("mcp-problem"), true, d.problem || ""); paintMcp();
|
|
5319
|
+
}, function(){ setNote(document.getElementById("mcp-problem"), true, networkText()); });
|
|
5320
|
+
}
|
|
5321
|
+
function mcpClock(iso){
|
|
5322
|
+
var d = new Date(iso);
|
|
5323
|
+
if(isNaN(d.getTime())) return "";
|
|
5324
|
+
var two = function(n){ return ("0" + n).slice(-2); };
|
|
5325
|
+
var hm = two(d.getHours()) + ":" + two(d.getMinutes());
|
|
5326
|
+
var now = new Date();
|
|
5327
|
+
if(d.getFullYear() === now.getFullYear() && d.getMonth() === now.getMonth() && d.getDate() === now.getDate()) return { today: true, text: hm };
|
|
5328
|
+
return { today: false, text: d.getFullYear() + "-" + two(d.getMonth() + 1) + "-" + two(d.getDate()) + " " + hm };
|
|
5329
|
+
}
|
|
5330
|
+
function mcpUseLine(u){
|
|
5331
|
+
if(!u || (u.calls === 0 && u.denied === 0)) return "never used";
|
|
5332
|
+
var t = "used " + u.calls + (u.calls === 1 ? " time" : " times") + (u.calls > 0 ? " in " + u.runs + (u.runs === 1 ? " run" : " runs") : "");
|
|
5333
|
+
var c = u.last ? mcpClock(u.last) : "";
|
|
5334
|
+
if(c) t += " · last used " + (c.today ? "today " : "") + c.text;
|
|
5335
|
+
return '<span>' + escapeXml(t) + ' · <span class="' + (u.denied > 0 ? "bad" : "") + '">' + u.denied + ' denied</span></span>';
|
|
5336
|
+
}
|
|
5337
|
+
function mcpSrvHtml(s, pi, si, place){
|
|
5338
|
+
var key = place.path + "\t" + s.name;
|
|
5339
|
+
var open = mcpSrvOpen[key] === true;
|
|
5340
|
+
var ok = s.check && s.check.ok === true;
|
|
5341
|
+
var idle = s.remote || s.shadowedBy !== null;
|
|
5342
|
+
var tools = s.remote ? '<span class="hint">remote server, not supported yet</span>' : s.shadowedBy !== null ? '<span class="hint">same name as above, not used</span>' : idle ? "—" : ok ? s.check.tools.length + (s.check.tools.length === 1 ? " tool" : " tools") : s.check ? "—" : "never checked";
|
|
5343
|
+
var at = s.check ? mcpClock(s.check.at) : "";
|
|
5344
|
+
var checked = idle ? "—" : s.check ? "checked " + (at ? at.text : "") : "never checked";
|
|
5345
|
+
var busy = mcpBusy[key] === true;
|
|
5346
|
+
var btn = idle ? "" : (busy ? '<button class="btn small pv-refbtn" type="button" disabled>checking…</button>' : '<button class="btn small pv-refbtn' + (s.check ? "" : " primary") + '" type="button" data-chk="' + pi + "-" + si + '" data-testid="mcp-check">check tools</button>');
|
|
5347
|
+
var use = idle ? "" : mcpUseLine(s.use);
|
|
5348
|
+
var list = "";
|
|
5349
|
+
if(ok){
|
|
5350
|
+
var more = mcpMoreOpen[key] === true;
|
|
5351
|
+
var shown = more ? s.check.tools : s.check.tools.slice(0, MCP_TOOLS_SHOWN);
|
|
5352
|
+
list = '<div class="pv-mhead mc-t" aria-hidden="true"><span>TOOL</span><span>HINT</span><span class="n">USED</span></div>' +
|
|
5353
|
+
shown.map(function(t){
|
|
5354
|
+
var n = (s.use && s.use.tools && Object.prototype.hasOwnProperty.call(s.use.tools, t.name)) ? s.use.tools[t.name] : 0;
|
|
5355
|
+
return '<div class="pv-mrow mc-t" tabindex="-1" data-testid="mcp-tool"><span class="pv-m-name"><code>' + escapeXml(t.name) + '</code></span><span>' + escapeXml(t.hint || "—") + '</span><span class="n">' + n + '</span></div>';
|
|
5356
|
+
}).join("") +
|
|
5357
|
+
(s.check.tools.length > shown.length ? '<div class="pv-more"><button class="pv-add" type="button" data-more="' + pi + "-" + si + '">+' + (s.check.tools.length - shown.length) + ' more</button></div>' : "");
|
|
5358
|
+
} else if(s.check) list = '<div class="pv-more"><span class="hint bad">' + escapeXml(s.check.error || "") + '</span></div>';
|
|
5359
|
+
else if(!idle) list = '<div class="pv-more"><span class="hint">Press check tools to list its tools.</span></div>';
|
|
5360
|
+
if(mcpFail[key]) list += '<div class="pv-more"><span class="hint bad">' + escapeXml(mcpFail[key]) + '</span></div>';
|
|
5361
|
+
return '<div class="pv-key' + (s.shadowedBy !== null ? " faint" : "") + '" data-open="' + (open ? 1 : 0) + '" data-testid="mcp-row">' +
|
|
5362
|
+
'<div class="pv-krow mc-k">' +
|
|
5363
|
+
'<div class="pv-cell pv-name nolbl"><button class="pv-fold" type="button" data-fold="' + pi + "-" + si + '" aria-expanded="' + open + '">' + (open ? "▾" : "▸") + '</button><code>' + escapeXml(s.name) + '</code></div>' +
|
|
5364
|
+
'<div class="pv-cell"><span class="pv-lbl">Tools</span><span>' + tools + (busy ? ' <span class="mc-spin">…</span>' : "") + '</span></div>' +
|
|
5365
|
+
'<div class="pv-cell"><span class="pv-lbl">Checked</span><span>' + escapeXml(checked) + '</span></div>' +
|
|
5366
|
+
'<div class="pv-cell pv-refcell nolbl">' + btn + '</div>' +
|
|
5367
|
+
'</div>' +
|
|
5368
|
+
(use ? '<div class="hint mc-use">' + use + '</div>' : "") +
|
|
5369
|
+
'<div class="pv-models">' + list + '</div>' +
|
|
5370
|
+
'</div>';
|
|
5371
|
+
}
|
|
5372
|
+
function paintMcp(){
|
|
5373
|
+
if(!mcpData) return;
|
|
5374
|
+
var h = '<div class="pv-head mc-k" aria-hidden="true"><span>PATH / MCP</span><span>TOOLS</span><span>CHECKED</span><span></span></div>';
|
|
5375
|
+
mcpData.places.forEach(function(g, pi){
|
|
5376
|
+
var found = g.status === "found", n = g.servers.length, open = mcpPathFold[g.path] !== false;
|
|
5377
|
+
var note = found ? " — " + (g.added ? "(added) — " : "") + n + " server" + (n === 1 ? "" : "s") : " — " + (g.added ? "(added) — " : "") + (g.status === "not-json" ? "can't be read" : "not found");
|
|
5378
|
+
h += '<div class="mc-grp" data-open="' + (open ? 1 : 0) + '" data-testid="mcp-path"><div class="mc-prow' + (found ? "" : " faint") + '">' +
|
|
5379
|
+
(found ? '<button class="pv-fold" type="button" data-pfold="' + pi + '" aria-expanded="' + open + '">' + (open ? "▾" : "▸") + '</button><span class="pv-ok">✓</span>' : '<span class="pv-fold" style="display:inline-block"> </span><span>–</span>') +
|
|
5380
|
+
'<span class="mc-grow"><code>' + escapeXml(g.path) + '</code>' + escapeXml(note) + '</span>' +
|
|
5381
|
+
(g.added ? '<button class="btn small" type="button" data-rm="' + pi + '" data-testid="mcp-remove">remove</button>' : "") + '</div>' +
|
|
5382
|
+
(found ? '<div class="mc-kids">' + g.servers.map(function(s, si){ return mcpSrvHtml(s, pi, si, g); }).join("") + '</div>' : "") + '</div>';
|
|
5383
|
+
});
|
|
5384
|
+
mcpRoot.innerHTML = h;
|
|
5385
|
+
}
|
|
5386
|
+
function mcpAt(id){ var a = id.split("-"); var g = mcpData.places[+a[0]]; return { place: g, srv: g.servers[+a[1]] }; }
|
|
5387
|
+
mcpRoot.addEventListener("click", function(e){
|
|
5388
|
+
if(!mcpData) return;
|
|
5389
|
+
var pf = e.target.closest("[data-pfold]");
|
|
5390
|
+
if(pf){ var g = mcpData.places[+pf.getAttribute("data-pfold")]; mcpPathFold[g.path] = mcpPathFold[g.path] === false; paintMcp(); return; }
|
|
5391
|
+
var r = e.target.closest("[data-rm]");
|
|
5392
|
+
if(r){
|
|
5393
|
+
var path = mcpData.places[+r.getAttribute("data-rm")].path;
|
|
5394
|
+
authorPost("/api/settings/mcp-path-remove", { path: path }).then(function(res){
|
|
5395
|
+
if(res.body && res.body.ok) loadMcp(); else setNote(document.getElementById("mcp-problem"), true, settingsRefusal(res));
|
|
5396
|
+
}, function(){ setNote(document.getElementById("mcp-problem"), true, networkText()); });
|
|
5397
|
+
return;
|
|
5398
|
+
}
|
|
5399
|
+
var f = e.target.closest("[data-fold]");
|
|
5400
|
+
if(f){ var x = mcpAt(f.getAttribute("data-fold")); var k = x.place.path + "\t" + x.srv.name; mcpSrvOpen[k] = mcpSrvOpen[k] !== true; paintMcp(); return; }
|
|
5401
|
+
var m = e.target.closest("[data-more]");
|
|
5402
|
+
if(m){ var y = mcpAt(m.getAttribute("data-more")); mcpMoreOpen[y.place.path + "\t" + y.srv.name] = true; paintMcp(); return; }
|
|
5403
|
+
var c = e.target.closest("[data-chk]");
|
|
5404
|
+
if(c){
|
|
5405
|
+
var z = mcpAt(c.getAttribute("data-chk")); var key = z.place.path + "\t" + z.srv.name;
|
|
5406
|
+
mcpBusy[key] = true; delete mcpFail[key]; paintMcp();
|
|
5407
|
+
authorPost("/api/settings/mcp-check", { server: z.srv.name }).then(function(res){
|
|
5408
|
+
mcpBusy[key] = false;
|
|
5409
|
+
if(res.body && res.body.ok) mcpSrvOpen[key] = true; else mcpFail[key] = settingsRefusal(res);
|
|
5410
|
+
loadMcp();
|
|
5411
|
+
}, function(){ mcpBusy[key] = false; mcpFail[key] = networkText(); paintMcp(); });
|
|
5412
|
+
}
|
|
5413
|
+
});
|
|
5414
|
+
// the typed-path box is built on the first press of "+ add a path" (like the Providers tab's typed-model box)
|
|
5415
|
+
document.getElementById("mcp-add-open").addEventListener("click", function(){
|
|
5416
|
+
var b = document.getElementById("mcp-add-box");
|
|
5417
|
+
if(!b.firstChild){
|
|
5418
|
+
b.innerHTML = '<input type="text" id="mcp-add-in" data-testid="mcp-add-in" autocomplete="off" spellcheck="false" aria-label="path" placeholder="type a path to an MCP config file"> <button class="btn small" type="button" id="mcp-add-go" data-testid="mcp-add-go">Add</button><div class="hint pv-msg" id="mcp-add-msg" data-testid="mcp-add-msg"></div>';
|
|
5419
|
+
document.getElementById("mcp-add-go").addEventListener("click", mcpAddPath);
|
|
5420
|
+
}
|
|
5421
|
+
b.hidden = !b.hidden; if(!b.hidden) document.getElementById("mcp-add-in").focus();
|
|
5422
|
+
});
|
|
5423
|
+
function mcpAddPath(){
|
|
5424
|
+
var inp = document.getElementById("mcp-add-in"), msg = document.getElementById("mcp-add-msg");
|
|
5425
|
+
var v = inp.value.trim();
|
|
5426
|
+
var say = function(bad, text){ setNote(msg, bad, text); msg.className += " pv-msg"; };
|
|
5427
|
+
if(!v){ say(true, "Type a path first."); return; }
|
|
5428
|
+
authorPost("/api/settings/mcp-path", { path: v }).then(function(res){
|
|
5429
|
+
if(res.body && res.body.ok){ inp.value = ""; say(false, "added"); loadMcp(); }
|
|
5430
|
+
else say(true, settingsRefusal(res));
|
|
5431
|
+
}, function(){ say(true, networkText()); });
|
|
5432
|
+
}
|
|
5433
|
+
document.getElementById("tab-mcp").addEventListener("click", function(){ loadMcp(); });
|
|
5434
|
+
wireTabs([document.getElementById("tab-providers"), document.getElementById("tab-mcp"), document.getElementById("tab-money")]);
|
|
4817
5435
|
// Auto-save on a human edit (change = blur or Enter): POST carries the per-start token; the chat has no route here
|
|
4818
5436
|
limitInput.addEventListener("change", function(){
|
|
4819
5437
|
var text = limitInput.value.trim();
|
|
@@ -4840,6 +5458,22 @@
|
|
|
4840
5458
|
var mainBtn = document.getElementById("chat-main-btn");
|
|
4841
5459
|
var mainHint = document.getElementById("chat-main-hint");
|
|
4842
5460
|
var reopenBtn = document.getElementById("chat-reopen-btn");
|
|
5461
|
+
var qBox = document.getElementById("chat-question");
|
|
5462
|
+
var qHead = document.getElementById("chat-q-head");
|
|
5463
|
+
var qLine = document.getElementById("chat-q-line");
|
|
5464
|
+
var qText = document.getElementById("chat-q-text");
|
|
5465
|
+
var qChoices = document.getElementById("chat-q-choices");
|
|
5466
|
+
var qC1 = document.getElementById("chat-q-c1");
|
|
5467
|
+
var qC2 = document.getElementById("chat-q-c2");
|
|
5468
|
+
var qOr = document.getElementById("chat-q-or");
|
|
5469
|
+
var qAnswer = document.getElementById("chat-q-answer");
|
|
5470
|
+
var qError = document.getElementById("chat-q-error");
|
|
5471
|
+
var qSend = document.getElementById("chat-q-send");
|
|
5472
|
+
var qKey = null, qBusy = false, qSendChoice = "rule";
|
|
5473
|
+
var revisesLeftEl = document.getElementById("chat-left-count");
|
|
5474
|
+
// R10 (fwd am17/am20): the id of the draft the next Start drafting follows; the server hands its check picks on (words-keyed), so a pick already made is not asked again
|
|
5475
|
+
var carryFromId = null;
|
|
5476
|
+
var carryKindVal = null;
|
|
4843
5477
|
var mainAction = "none";
|
|
4844
5478
|
var knownRunIdsAtSign = null; // the run ids listed when Sign & run was pressed (M3: afterSignRefresh waits for a new one)
|
|
4845
5479
|
var lastState = null;
|
|
@@ -4849,6 +5483,15 @@
|
|
|
4849
5483
|
var moneyCapInput = document.getElementById("jf-cap-money");
|
|
4850
5484
|
var modelSelect = document.getElementById("jf-model");
|
|
4851
5485
|
var thinkingBox = document.getElementById("jf-thinking");
|
|
5486
|
+
// piece 8 (fwd M13 p4): the card's Flow type, the MCP pick and (the by-hand Ticket box is gone: fwd v0.28.0). Declared up here: syncCardLock reads them from the first refresh on.
|
|
5487
|
+
var flowTypeEl = document.getElementById("jf-flowtype");
|
|
5488
|
+
var mcpEl = document.getElementById("jf-mcp");
|
|
5489
|
+
var mcpFieldEl = document.getElementById("jf-mcp-field");
|
|
5490
|
+
// piece 9 (R7): the Schedule row, signed with the job; off until the first green run (a rubric job: until that run is accepted)
|
|
5491
|
+
var cardSchedEl = document.getElementById("jf-sched");
|
|
5492
|
+
var cardSchedTimeEl = document.getElementById("jf-sched-time");
|
|
5493
|
+
var cardSchedFieldEl = document.getElementById("jf-sched-field");
|
|
5494
|
+
var mcpServers = []; // the MCPs Settings > MCP lists as usable (not remote, not shadowed); the page only READS the list
|
|
4852
5495
|
var thinkingNote = document.getElementById("jf-thinking-note");
|
|
4853
5496
|
var lineThinking = {}; // option value -> the server's {support, canChange, say} for that Model line
|
|
4854
5497
|
var modelStatusEl = document.getElementById("jf-model-status");
|
|
@@ -4915,14 +5558,75 @@
|
|
|
4915
5558
|
// the Check type radios stay clickable on a reuse card (Deterministic / Rubric = leave reuse); a live session or a resume freezes them
|
|
4916
5559
|
document.querySelectorAll('input[name="jf-verdict"]').forEach(function(r){ r.disabled = live || resuming; });
|
|
4917
5560
|
document.getElementById("job-card").classList.toggle("reuse", reuseOn);
|
|
5561
|
+
// Flow type and MCP are JOB boxes (a change drafts a new workflow): locked like the job text on a schedule card, a live session or a resume.
|
|
5562
|
+
var flowLocked = reuseOn || live || resuming;
|
|
5563
|
+
flowTypeEl.disabled = flowLocked; mcpEl.disabled = flowLocked;
|
|
5564
|
+
[flowTypeEl, mcpEl].forEach(function(el){ el.classList.toggle("locked", flowLocked); });
|
|
5565
|
+
// the Schedule is chosen before the start and signed with the job: frozen while a session is live
|
|
5566
|
+
cardSchedEl.disabled = live; cardSchedTimeEl.disabled = live;
|
|
5567
|
+
cardSchedEl.classList.toggle("locked", live); cardSchedTimeEl.classList.toggle("locked", live);
|
|
5568
|
+
paintFlowType();
|
|
4918
5569
|
syncThinking();
|
|
4919
5570
|
}
|
|
4920
5571
|
function setReuseLocked(on){ reuseOn = on; syncCardLock(); }
|
|
5572
|
+
// ---- Flow type / MCP (piece 8). The MCP menu is Settings > MCP's usable servers; a reused job's server that is no longer listed stays pickable by name
|
|
5573
|
+
// (the start refuses it with its cause).
|
|
5574
|
+
function paintMcpOptions(want){
|
|
5575
|
+
var names = mcpServers.slice();
|
|
5576
|
+
if(want && names.indexOf(want) === -1) names.push(want);
|
|
5577
|
+
mcpEl.innerHTML = "";
|
|
5578
|
+
names.forEach(function(n){ var o = document.createElement("option"); o.value = n; o.textContent = n; mcpEl.appendChild(o); });
|
|
5579
|
+
if(want) mcpEl.value = want;
|
|
5580
|
+
}
|
|
5581
|
+
function paintFlowType(){
|
|
5582
|
+
var f = flowTypeEl.value;
|
|
5583
|
+
mcpFieldEl.hidden = f === "plain";
|
|
5584
|
+
paintCardSchedule();
|
|
5585
|
+
}
|
|
5586
|
+
// The Schedule row (fwd's three words and two hints): "When a new ticket arrives" only for a Tickets job; the time box and the hints follow the pick. A rubric job's hint says Accepted.
|
|
5587
|
+
// Hidden on a resume (no run starts there) and on the two-click schedule card (its own When field).
|
|
5588
|
+
function paintCardSchedule(){
|
|
5589
|
+
var tk = cardSchedEl.querySelector('option[value="new-ticket"]');
|
|
5590
|
+
tk.hidden = tk.disabled = flowTypeEl.value !== "tickets";
|
|
5591
|
+
if(cardSchedEl.value === "new-ticket" && tk.disabled) cardSchedEl.value = "hand";
|
|
5592
|
+
cardSchedFieldEl.hidden = resumeRun !== null || sched !== null;
|
|
5593
|
+
var rubric = (verdictValue() === "reuse" ? reuseCheckType : verdictValue()) === "rubric";
|
|
5594
|
+
document.getElementById("jf-sched-clock").hidden = cardSchedEl.value !== "daily";
|
|
5595
|
+
document.getElementById("jf-sched-hint").hidden = cardSchedEl.value === "hand" || rubric;
|
|
5596
|
+
document.getElementById("jf-sched-hint-rubric").hidden = cardSchedEl.value === "hand" || !rubric;
|
|
5597
|
+
document.getElementById("jf-sched-ticket-hint").hidden = cardSchedEl.value !== "new-ticket";
|
|
5598
|
+
}
|
|
5599
|
+
// the typed Schedule the card sends: null (by hand) sends nothing, so the signed job carries no trigger and hashes as before
|
|
5600
|
+
function scheduleOfCard(){
|
|
5601
|
+
if(cardSchedEl.value === "new-ticket") return {kind: "new-ticket"};
|
|
5602
|
+
if(cardSchedEl.value !== "daily") return null;
|
|
5603
|
+
var t = /^(\d{2}):(\d{2})$/.exec(cardSchedTimeEl.value || "");
|
|
5604
|
+
return {kind: "daily", hour: t ? Number(t[1]) : NaN, minute: t ? Number(t[2]) : NaN};
|
|
5605
|
+
}
|
|
5606
|
+
function setCardSchedule(sc){
|
|
5607
|
+
cardSchedEl.value = sc && sc.kind === "daily" ? "daily" : (sc && sc.kind === "new-ticket" ? "new-ticket" : "hand");
|
|
5608
|
+
if(sc && sc.kind === "daily" && Number.isInteger(sc.hour) && Number.isInteger(sc.minute)) cardSchedTimeEl.value = ("0" + sc.hour).slice(-2) + ":" + ("0" + sc.minute).slice(-2);
|
|
5609
|
+
paintCardSchedule();
|
|
5610
|
+
}
|
|
5611
|
+
function setFlow(type, server){
|
|
5612
|
+
flowTypeEl.value = (type === "mcp" || type === "tickets") ? type : "plain";
|
|
5613
|
+
paintMcpOptions(server || "");
|
|
5614
|
+
paintFlowType();
|
|
5615
|
+
}
|
|
5616
|
+
function loadMcpServers(){
|
|
5617
|
+
return authorGet("/api/settings/mcp").then(function(d){
|
|
5618
|
+
var names = [];
|
|
5619
|
+
((d && d.places) || []).forEach(function(p){ (p.servers || []).forEach(function(sv){ if(!sv.remote && !sv.shadowedBy && names.indexOf(sv.name) === -1) names.push(sv.name); }); });
|
|
5620
|
+
mcpServers = names; paintMcpOptions(mcpEl.value);
|
|
5621
|
+
}, function(){ /* the list stays as it was; a pick the server cannot start is refused with its cause */ });
|
|
5622
|
+
}
|
|
4921
5623
|
function clearStartFrom(keepBoxes){
|
|
4922
5624
|
// Clear after a reuse starts a genuinely new job: the reused values do not linger in the boxes — except when a Check type
|
|
4923
5625
|
// radio click leaves reuse (keepBoxes): a radio never blanks what the person has on the card
|
|
4924
5626
|
if(startFrom && !keepBoxes){
|
|
4925
5627
|
CARD_BOX_IDS.forEach(function(id){ document.getElementById(id).value = ""; });
|
|
5628
|
+
setFlow("plain", "");
|
|
5629
|
+
setCardSchedule(null);
|
|
4926
5630
|
NUMBERED_IDS.forEach(gutterSync);
|
|
4927
5631
|
document.querySelectorAll('input[name="jf-verdict"]').forEach(function(r){ r.checked = (r.value === "deterministic"); });
|
|
4928
5632
|
}
|
|
@@ -4957,6 +5661,8 @@
|
|
|
4957
5661
|
}
|
|
4958
5662
|
function clearCardBoxes(){
|
|
4959
5663
|
CARD_BOX_IDS.forEach(function(id){ document.getElementById(id).value = ""; });
|
|
5664
|
+
setFlow("plain", "");
|
|
5665
|
+
setCardSchedule(null);
|
|
4960
5666
|
NUMBERED_IDS.forEach(gutterSync);
|
|
4961
5667
|
document.getElementById("jf-cap-note").textContent = "";
|
|
4962
5668
|
}
|
|
@@ -5046,6 +5752,7 @@
|
|
|
5046
5752
|
card.hidden = false;
|
|
5047
5753
|
originLine.hidden = true;
|
|
5048
5754
|
exitResumeMode();
|
|
5755
|
+
renderQuestionBox(null);
|
|
5049
5756
|
thread.innerHTML = ""; lastMsgSig = null;
|
|
5050
5757
|
errEl.textContent = "";
|
|
5051
5758
|
actionErrEl.textContent = "";
|
|
@@ -5074,6 +5781,8 @@
|
|
|
5074
5781
|
// back to a fresh empty card: every box, check type deterministic, the default (first) Model, origin/estimate/notes
|
|
5075
5782
|
// hidden, progress list and thread cleared, reuse lock lifted
|
|
5076
5783
|
function resetCard(){
|
|
5784
|
+
carryFromId = null;
|
|
5785
|
+
carryKindVal = null;
|
|
5077
5786
|
clearCardBoxes();
|
|
5078
5787
|
setVerdict("deterministic");
|
|
5079
5788
|
modelSelect.selectedIndex = 0;
|
|
@@ -5109,10 +5818,15 @@
|
|
|
5109
5818
|
jobText: document.getElementById("jf-job").value.trim(),
|
|
5110
5819
|
inputs: document.getElementById("jf-inputs").value.trim(),
|
|
5111
5820
|
destination: document.getElementById("jf-dest").value.trim(),
|
|
5821
|
+
...(carryFromId ? {carryFrom: carryFromId, carryKind: carryKindVal === "startover" ? "startover" : "revise"} : {}),
|
|
5112
5822
|
// the "Thinking on" tick: sent as a boolean; the server judges it per line and signs it only when ticked
|
|
5113
5823
|
thinking: thinkingBox.checked === true,
|
|
5114
5824
|
capUsd: moneyCap,
|
|
5115
5825
|
maxWallMs: timeCapMin === "" ? undefined : Math.round(Number(timeCapMin) * 60000),
|
|
5826
|
+
// piece 8: a plain job sends neither key (the signed job carries neither); a by-hand Tickets run takes the newest ticket not run yet (no box, fwd v0.28.0)
|
|
5827
|
+
...(flowTypeEl.value !== "plain" ? {flowType: flowTypeEl.value, mcp: mcpEl.value} : {}),
|
|
5828
|
+
// piece 9: by hand sends no key (the signed job carries no trigger); a pick is signed with the job and starts OFF
|
|
5829
|
+
...(scheduleOfCard() !== null ? {schedule: scheduleOfCard()} : {}),
|
|
5116
5830
|
};
|
|
5117
5831
|
}
|
|
5118
5832
|
|
|
@@ -5353,11 +6067,16 @@
|
|
|
5353
6067
|
}
|
|
5354
6068
|
// the thread is redrawn only when its messages changed: a 2 s poll tick must not close a fold the person just opened
|
|
5355
6069
|
var lastMsgSig = null;
|
|
6070
|
+
// the confirm card's Drop / Add button (N-2): a typed row edit, instant and $0; the click is handled once on the thread
|
|
6071
|
+
function planControlHTML(op, key){
|
|
6072
|
+
return ' <button type="button" class="btn jp-btn" data-testid="plan-' + op + '" data-rowop="' + op + '" data-rowkey="' + escapeXml(key) + '">' + (op === "add" ? "Add" : "Drop") + "</button>";
|
|
6073
|
+
}
|
|
5356
6074
|
function renderMessages(state){
|
|
5357
6075
|
var sig = JSON.stringify(state.messages);
|
|
5358
6076
|
if(sig === lastMsgSig) return;
|
|
5359
6077
|
lastMsgSig = sig;
|
|
5360
|
-
|
|
6078
|
+
// a question still open is drawn in its own box, not here
|
|
6079
|
+
thread.innerHTML = state.messages.filter(function(m){ return m.askOpen !== true; }).map(function(m){
|
|
5361
6080
|
var cls = m.role === "you" ? "you" : (m.role === "system" ? "system" : "bot");
|
|
5362
6081
|
var who = chatWhoLabel(m.role);
|
|
5363
6082
|
var whoHtml = who ? ('<div class="who">' + escapeXml(who) + '</div>') : "";
|
|
@@ -5366,7 +6085,7 @@
|
|
|
5366
6085
|
var qs = (m.plan.questions || []).length
|
|
5367
6086
|
? '<div class="jp-qs" data-testid="plan-questions"><span class="lbl">AI\'s open questions</span><ul>' +
|
|
5368
6087
|
m.plan.questions.map(function(q){ return "<li>" + escapeXml(q) + "</li>"; }).join("") + "</ul><b>Revise if you need to.</b></div>" : "";
|
|
5369
|
-
return '<div class="msg ' + cls + '" data-testid="plan-bubble">' + whoHtml + renderJobPlan(m.plan) + qs + '<div class="jp-goal">' + escapeXml(m.text) + "</div></div>";
|
|
6088
|
+
return '<div class="msg ' + cls + '" data-testid="plan-bubble">' + whoHtml + renderJobPlan(m.plan, m.plan.editable === true ? planControlHTML : null) + qs + '<div class="jp-goal">' + escapeXml(m.text) + "</div></div>";
|
|
5370
6089
|
}
|
|
5371
6090
|
return '<div class="msg ' + cls + '">' + whoHtml + escapeXml(m.text) + '</div>';
|
|
5372
6091
|
}).join("");
|
|
@@ -5457,12 +6176,20 @@
|
|
|
5457
6176
|
function reviseShownFor(st){
|
|
5458
6177
|
return !!st.session && !!st.pendingAsk && st.pendingAsk.kind === "menu";
|
|
5459
6178
|
}
|
|
6179
|
+
// fwd M4e am14 item 3 (pure): 2 revises per draft, shown as "2 revises left" / "1 revise left"; with none left the same button reads Start over. The SERVER counts (revisesLeft); an
|
|
6180
|
+
// absent number (a state from before the count) reads as 2.
|
|
6181
|
+
function reviseButtonFor(left){
|
|
6182
|
+
var n = typeof left === "number" ? Math.max(0, Math.floor(left)) : 2;
|
|
6183
|
+
if(n <= 0) return {text: "Start over", kind: "startover", left: ""};
|
|
6184
|
+
return {text: "Revise", kind: "revise", left: n + (n === 1 ? " revise left" : " revises left")};
|
|
6185
|
+
}
|
|
5460
6186
|
function renderMain(){
|
|
5461
6187
|
var st = {session: sessionLive, startOk: startOk, signClicked: signClickedOnce, whenLocked: whenLocked};
|
|
5462
6188
|
if(sched){ st.when = {changed: whenChanged(), refused: !!sched.refusal, cancel: byId("jf-when").value === "hand", confirm: whenConfirm, busy: whenBusy, words: sched.words}; }
|
|
5463
6189
|
if(sessionLive && lastState){
|
|
5464
6190
|
st.phase = lastState.phase; st.pendingAsk = lastState.pendingAsk;
|
|
5465
6191
|
st.specHash = lastState.specHash;
|
|
6192
|
+
st.revisesLeft = lastState.revisesLeft;
|
|
5466
6193
|
}
|
|
5467
6194
|
// hamr 2026-10-05: the ask box is open only while something asks for a reply; otherwise dimmed and emptied
|
|
5468
6195
|
var open = askBoxOpenFor(st);
|
|
@@ -5473,7 +6200,11 @@
|
|
|
5473
6200
|
mainBtn.disabled = b.disabled;
|
|
5474
6201
|
mainAction = b.action;
|
|
5475
6202
|
mainHint.textContent = b.hint;
|
|
6203
|
+
var rv = reviseButtonFor(st.revisesLeft);
|
|
5476
6204
|
reopenBtn.hidden = !reviseShownFor(st);
|
|
6205
|
+
reopenBtn.textContent = rv.text;
|
|
6206
|
+
revisesLeftEl.textContent = rv.left;
|
|
6207
|
+
revisesLeftEl.hidden = !reviseShownFor(st) || rv.left === "";
|
|
5477
6208
|
fitBox(msgInput);
|
|
5478
6209
|
fitCardBoxes();
|
|
5479
6210
|
}
|
|
@@ -5544,12 +6275,48 @@
|
|
|
5544
6275
|
}
|
|
5545
6276
|
});
|
|
5546
6277
|
|
|
6278
|
+
// R7b (3): "yes" to the folder question changes the SESSION's Destination; the box is locked while a session is live, so the page re-fills it from the session's own card
|
|
6279
|
+
function syncDestinationFromSession(state){
|
|
6280
|
+
var d = state && state.card && state.card.destination;
|
|
6281
|
+
if(typeof d !== "string") return;
|
|
6282
|
+
var box = document.getElementById("jf-dest");
|
|
6283
|
+
if(box && box.value !== d){ box.value = d; fitCardBoxes(); }
|
|
6284
|
+
}
|
|
6285
|
+
// hamr 2026-11-12 (as fwdloop M10 am29): the question box. It shows while the session has a question with a `box` (the server's words, src/questionbox.js) and takes the chat input's
|
|
6286
|
+
// place; the texts are rewritten only when the question changes, so a poll tick never wipes what the person is typing. A state with no box (an ask of another kind) keeps the chat input.
|
|
6287
|
+
function renderQuestionBox(state){
|
|
6288
|
+
var ask = state && state.pendingAsk;
|
|
6289
|
+
var b = ask && ask.box ? ask.box : null;
|
|
6290
|
+
qBox.hidden = b === null;
|
|
6291
|
+
document.querySelector(".chat-input-row").hidden = b !== null;
|
|
6292
|
+
mainBtn.hidden = b !== null; mainHint.hidden = b !== null;
|
|
6293
|
+
if(b === null){ qKey = null; return; }
|
|
6294
|
+
var key = String(sessionId) + ":" + String(ask.index) + ":" + String(ask.source) + ":" + b.text;
|
|
6295
|
+
if(key !== qKey){
|
|
6296
|
+
qKey = key;
|
|
6297
|
+
qSendChoice = b.sendChoice || "rule";
|
|
6298
|
+
qHead.textContent = b.head; qLine.textContent = b.line; qText.textContent = b.text;
|
|
6299
|
+
qHead.hidden = b.head === ""; qLine.hidden = b.line === "";
|
|
6300
|
+
var cs = b.choices || [];
|
|
6301
|
+
[qC1, qC2].forEach(function(btn, i){
|
|
6302
|
+
var c = cs[i];
|
|
6303
|
+
btn.hidden = !c;
|
|
6304
|
+
if(c){ btn.textContent = c.label; btn.setAttribute("data-choice", c.choice); btn.setAttribute("data-testid", "chat-q-" + c.choice); }
|
|
6305
|
+
});
|
|
6306
|
+
qChoices.hidden = cs.length === 0;
|
|
6307
|
+
qOr.hidden = b.orLabel === null; qAnswer.hidden = b.orLabel === null; qSend.hidden = b.orLabel === null;
|
|
6308
|
+
if(b.orLabel !== null) qOr.textContent = b.orLabel;
|
|
6309
|
+
qAnswer.value = ""; qError.textContent = "";
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
5547
6312
|
function renderActions(state){
|
|
5548
6313
|
lastState = state;
|
|
6314
|
+
syncDestinationFromSession(state);
|
|
5549
6315
|
// a session's stop is shown ONCE, in the progress line (renderProgress); #chat-card-error carries only a
|
|
5550
6316
|
// refused START (its own handler writes it) — echoing state.error here made the same refusal appear twice
|
|
5551
6317
|
errEl.textContent = "";
|
|
5552
6318
|
var progressChanged = renderProgress(state);
|
|
6319
|
+
renderQuestionBox(state);
|
|
5553
6320
|
// build item 4 — re-enable Start only once the session has settled
|
|
5554
6321
|
// into a terminal phase (a fresh Start becomes possible again).
|
|
5555
6322
|
sessionLive = CLIENT_TERMINAL_PHASES.indexOf(state.phase) === -1;
|
|
@@ -5608,6 +6375,8 @@
|
|
|
5608
6375
|
refreshStartEnabled();
|
|
5609
6376
|
return;
|
|
5610
6377
|
}
|
|
6378
|
+
// a draft that follows another stays in that line: a red one redrafted from the card is the next revise, not a fresh start (the server counts by this link)
|
|
6379
|
+
if(carryFromId) carryFromId = r.body.sessionId;
|
|
5611
6380
|
sessionId = r.body.sessionId;
|
|
5612
6381
|
// a same-job session has no confirm turn: it goes straight to `prepared`, and THIS click (Sign & run) is the
|
|
5613
6382
|
// signature — the page signs the hash the server prepared as soon as it is ready (the server re-checks it)
|
|
@@ -5668,6 +6437,7 @@
|
|
|
5668
6437
|
setVal("jf-name", c.jobName); setVal("jf-job", c.jobText); setVal("jf-inputs", c.inputs);
|
|
5669
6438
|
setVal("jf-dest", c.destination); setVal("jf-cap-money", c.capUsd);
|
|
5670
6439
|
setVal("jf-cap-time", typeof c.maxWallMs === "number" ? Math.round(c.maxWallMs / 60000) : "");
|
|
6440
|
+
setFlow(c.flowType, c.mcp); setCardSchedule(c.schedule);
|
|
5671
6441
|
setThinkingTick(c.thinking === true);
|
|
5672
6442
|
fitCardBoxes();
|
|
5673
6443
|
}
|
|
@@ -5711,7 +6481,9 @@
|
|
|
5711
6481
|
if(reuseOrigin === null) return false;
|
|
5712
6482
|
var cur = currentCard(), o = reuseOrigin.card;
|
|
5713
6483
|
var t = function(v){ return typeof v === "string" ? v.replace(/\s+/g, "") : ""; };
|
|
5714
|
-
|
|
6484
|
+
// Flow type and MCP are job boxes too (piece 8): a plain card has neither key, so absent reads as plain with no MCP, the same as the server
|
|
6485
|
+
return t(cur.jobText) !== t(o.jobText) || cur.checkType !== (o.checkType === "rubric" ? "rubric" : "deterministic") || (cur.thinking === true) !== (o.thinking === true)
|
|
6486
|
+
|| (cur.flowType || "plain") !== (o.flowType || "plain") || (cur.mcp || "") !== (o.mcp || "");
|
|
5715
6487
|
}
|
|
5716
6488
|
// the reuse path (signed plan verbatim, no drafting, $0): a card made by Reuse workflow from a GREEN run with no job box changed
|
|
5717
6489
|
function reusePathNow(){
|
|
@@ -5728,6 +6500,11 @@
|
|
|
5728
6500
|
function reuseBoxesEdited(){ syncReuseName(); renderMain(); }
|
|
5729
6501
|
document.getElementById("jf-job").addEventListener("input", reuseBoxesEdited);
|
|
5730
6502
|
thinkingBox.addEventListener("change", reuseBoxesEdited);
|
|
6503
|
+
flowTypeEl.addEventListener("change", function(){ paintFlowType(); reuseBoxesEdited(); refreshStartEnabled(); });
|
|
6504
|
+
cardSchedEl.addEventListener("change", function(){ paintCardSchedule(); renderMain(); });
|
|
6505
|
+
mcpEl.addEventListener("change", reuseBoxesEdited);
|
|
6506
|
+
document.getElementById("jf-mcp-manage").addEventListener("click", function(ev){ ev.preventDefault(); document.getElementById("btn-settings").click(); document.getElementById("tab-mcp").click(); });
|
|
6507
|
+
loadMcpServers();
|
|
5731
6508
|
document.getElementById("jf-name").addEventListener("input", function(){
|
|
5732
6509
|
if(reuseOrigin === null || reuseOn) return;
|
|
5733
6510
|
if(jobBoxesChangedNow()) nameTouched = true; else syncReuseName();
|
|
@@ -5846,6 +6623,41 @@
|
|
|
5846
6623
|
}).catch(function(){ chatActionFailed("network error — could not reach the panel server, nothing was sent"); });
|
|
5847
6624
|
}
|
|
5848
6625
|
|
|
6626
|
+
// the box's own Send and choice buttons: a choice button posts its choice and nothing else; the box's Send posts the box's words (as a new rule where the question has choices)
|
|
6627
|
+
function doQuestion(choice){
|
|
6628
|
+
if(qBusy || !sessionId || !lastState || !lastState.pendingAsk || !lastState.pendingAsk.box) return;
|
|
6629
|
+
qBusy = true; qSend.disabled = true; qC1.disabled = true; qC2.disabled = true; qError.textContent = "";
|
|
6630
|
+
var id = sessionId;
|
|
6631
|
+
// a choice button posts its choice and nothing else; the box's Send posts the box's words with the choice the box carries (a new rule), never read as agree or drop it
|
|
6632
|
+
var body = choice === qSendChoice ? {text: qAnswer.value, choice: choice} : {choice: choice};
|
|
6633
|
+
authorPost("/api/author/" + id + "/send", body).then(function(r){
|
|
6634
|
+
qBusy = false; qSend.disabled = false; qC1.disabled = false; qC2.disabled = false;
|
|
6635
|
+
if(id !== sessionId) return;
|
|
6636
|
+
var o = chatPostOutcome(r);
|
|
6637
|
+
if(!o.ok){ qError.textContent = o.error; return; }
|
|
6638
|
+
qAnswer.value = "";
|
|
6639
|
+
poll();
|
|
6640
|
+
}).catch(function(){ qBusy = false; qSend.disabled = false; qC1.disabled = false; qC2.disabled = false; qError.textContent = "network error \u2014 could not reach the panel server, your answer was NOT sent"; });
|
|
6641
|
+
}
|
|
6642
|
+
qSend.addEventListener("click", function(){ doQuestion(qSendChoice); });
|
|
6643
|
+
qC1.addEventListener("click", function(){ doQuestion(qC1.getAttribute("data-choice")); });
|
|
6644
|
+
qC2.addEventListener("click", function(){ doQuestion(qC2.getAttribute("data-choice")); });
|
|
6645
|
+
qAnswer.addEventListener("keydown", function(e){ if(e.key === "Enter" && !e.shiftKey){ e.preventDefault(); doQuestion(qSendChoice); } });
|
|
6646
|
+
|
|
6647
|
+
// Drop / Add on the confirm card: one delegated click; the server edits the row through the check block (no model call) and the card is drawn again from the rows
|
|
6648
|
+
thread.addEventListener("click", function(ev){
|
|
6649
|
+
var b = ev.target && ev.target.closest ? ev.target.closest("[data-rowop]") : null;
|
|
6650
|
+
if(!b || !sessionId) return;
|
|
6651
|
+
b.disabled = true;
|
|
6652
|
+
var id = sessionId;
|
|
6653
|
+
authorPost("/api/author/" + id + "/row-edit", {op: b.getAttribute("data-rowop"), key: b.getAttribute("data-rowkey")}).then(function(r){
|
|
6654
|
+
if(id !== sessionId) return;
|
|
6655
|
+
var o = chatPostOutcome(r);
|
|
6656
|
+
if(o.ok) chatActionOk(); else { b.disabled = false; chatActionFailed(o.error); }
|
|
6657
|
+
poll();
|
|
6658
|
+
}).catch(function(){ b.disabled = false; chatActionFailed("network error \u2014 could not reach the panel server, nothing was changed"); });
|
|
6659
|
+
});
|
|
6660
|
+
|
|
5849
6661
|
function doSend(){
|
|
5850
6662
|
if(!sessionId) return;
|
|
5851
6663
|
var text = msgInput.value;
|
|
@@ -5867,18 +6679,28 @@
|
|
|
5867
6679
|
// hamr 2026-10-09 (as fwdloop's Revise): the draft is ended and the New job card opens with the SAME values in every
|
|
5868
6680
|
// box, all editable; Start drafting then drafts fresh from whatever the boxes now say. No typed change request goes
|
|
5869
6681
|
// to the model. The ended draft is an Abandon: money already spent stays booked.
|
|
5870
|
-
|
|
6682
|
+
// Revise and Start over both end this draft and open the boxes as the draft left them: the job box now holds the `~` lines the answers added (the server's card), and the
|
|
6683
|
+
// check picks of this draft ride along to the next one. Neither drafts at once (fwd am14: the fields are open, the person edits and drafts). A Revise is one of the draft's 2
|
|
6684
|
+
// (the server counts it and refuses the third, before this draft is ended); Start over gives the next draft 2 new ones.
|
|
6685
|
+
function doReopen(kind){
|
|
5871
6686
|
if(!sessionId) return;
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
6687
|
+
var from = sessionId;
|
|
6688
|
+
authorGet("/api/author/" + from).then(function(j){
|
|
6689
|
+
var jt = j && j.state && j.state.card && typeof j.state.card.jobText === "string" ? j.state.card.jobText : "";
|
|
6690
|
+
return authorPost("/api/author/" + from + "/abandon", {kind: kind}).then(function(r){
|
|
6691
|
+
var o = chatPostOutcome(r);
|
|
6692
|
+
if(!o.ok){ chatActionFailed(o.error); return; }
|
|
6693
|
+
openNewCard();
|
|
6694
|
+
carryFromId = from;
|
|
6695
|
+
carryKindVal = kind === "startover" ? "startover" : "revise";
|
|
6696
|
+
if(jt){ setVal("jf-job", jt); fitCardBoxes(); }
|
|
6697
|
+
chatActionOk();
|
|
6698
|
+
lastMsgSig = null;
|
|
6699
|
+
thread.innerHTML = '<div class="msg system">' + escapeXml("The boxes are open as you drafted them. Edit what you want, then Start drafting. The first draft's cost stays counted.") + "</div>";
|
|
6700
|
+
});
|
|
5879
6701
|
}).catch(function(){ chatActionFailed("network error — could not reach the panel server, not revised"); });
|
|
5880
6702
|
}
|
|
5881
|
-
reopenBtn.addEventListener("click", doReopen);
|
|
6703
|
+
reopenBtn.addEventListener("click", function(){ doReopen(reviseButtonFor(lastState && lastState.revisesLeft).kind); });
|
|
5882
6704
|
|
|
5883
6705
|
function doSign(){
|
|
5884
6706
|
if(!sessionId) return;
|
|
@@ -5910,7 +6732,7 @@
|
|
|
5910
6732
|
// The Reuse card plus the When field, copied from fwdloop's Run card (index.html:998-1019, 4690-4772). The page works out nothing: the
|
|
5911
6733
|
// server's words, refusals and hashes. Click 1 (schedule-prepare) is $0 and signs nothing; click 2 (schedule) signs; NOTHING runs.
|
|
5912
6734
|
function byId(id){ return document.getElementById(id); }
|
|
5913
|
-
var WHEN_KINDS = ["hand", "daily", "weekdays", "weekly", "file-updated", "new-file"];
|
|
6735
|
+
var WHEN_KINDS = ["hand", "daily", "weekdays", "weekly", "file-updated", "new-file", "new-ticket"];
|
|
5914
6736
|
function whenTriggerFromBoxes(){
|
|
5915
6737
|
var kind = byId("jf-when").value;
|
|
5916
6738
|
if(kind === "hand") return null;
|
|
@@ -5920,6 +6742,7 @@
|
|
|
5920
6742
|
if(kind === "weekly") o.day = byId("jf-when-day").value;
|
|
5921
6743
|
return o;
|
|
5922
6744
|
}
|
|
6745
|
+
if(kind === "new-ticket") return {kind: kind, input: byId("jf-when-input").value}; // MCP + tickets piece 3: the person picks the input; the server fills the rest from the signed job
|
|
5923
6746
|
var q = {kind: kind};
|
|
5924
6747
|
q[kind === "new-file" ? "folder" : "path"] = byId("jf-when-path").value.trim();
|
|
5925
6748
|
return q;
|
|
@@ -5927,7 +6750,7 @@
|
|
|
5927
6750
|
// one comparable spelling of a trigger (or By hand), so "changed" is a plain string compare
|
|
5928
6751
|
function whenCanon(t){
|
|
5929
6752
|
if(!t) return "hand";
|
|
5930
|
-
return [t.kind, t.hour === undefined ? "" : t.hour, t.minute === undefined ? "" : t.minute, t.day || "", t.path || t.folder || ""].join("|");
|
|
6753
|
+
return [t.kind, t.hour === undefined ? "" : t.hour, t.minute === undefined ? "" : t.minute, t.day || "", t.path || t.folder || t.input || ""].join("|");
|
|
5931
6754
|
}
|
|
5932
6755
|
// Is the card changed from what was signed? The ONE reader. A schedule card (Schedule run, Cancel / modify schedule) never starts a run: the main
|
|
5933
6756
|
// button is Sign schedule while this is true and disabled while it is not. On a scheduled job any When, Inputs, Destination or cap edit counts
|
|
@@ -5945,6 +6768,7 @@
|
|
|
5945
6768
|
byId("jf-when-clock").hidden = !(kind === "daily" || kind === "weekdays" || kind === "weekly");
|
|
5946
6769
|
byId("jf-when-day").hidden = kind !== "weekly";
|
|
5947
6770
|
byId("jf-when-filebox").hidden = !(kind === "file-updated" || kind === "new-file");
|
|
6771
|
+
byId("jf-when-ticketbox").hidden = kind !== "new-ticket";
|
|
5948
6772
|
byId("jf-when-path").placeholder = kind === "new-file" ? "/full/path/to/folder" : "/full/path/to/file";
|
|
5949
6773
|
}
|
|
5950
6774
|
function paintWhen(){
|
|
@@ -5956,7 +6780,9 @@
|
|
|
5956
6780
|
byId("jf-when-label").textContent = w.whenLabel || "";
|
|
5957
6781
|
var sel = byId("jf-when");
|
|
5958
6782
|
sel.innerHTML = "";
|
|
6783
|
+
var ticketInputs = sched.ticketInputs || [];
|
|
5959
6784
|
WHEN_KINDS.forEach(function(k){
|
|
6785
|
+
if(k === "new-ticket" && ticketInputs.length === 0 && !(sched.cur && sched.cur.kind === "new-ticket")) return; // only a Tickets MCP job with list_issues signed offers it
|
|
5960
6786
|
var op = document.createElement("option");
|
|
5961
6787
|
op.value = k;
|
|
5962
6788
|
// on a scheduled job the first option reads Cancel schedule instead of By hand
|
|
@@ -5968,9 +6794,15 @@
|
|
|
5968
6794
|
if(t && t.hour !== undefined){ byId("jf-when-time").value = ("0" + t.hour).slice(-2) + ":" + ("0" + t.minute).slice(-2); }
|
|
5969
6795
|
if(t && t.day) byId("jf-when-day").value = t.day;
|
|
5970
6796
|
byId("jf-when-path").value = t ? (t.path || t.folder || "") : "";
|
|
6797
|
+
var inSel = byId("jf-when-input");
|
|
6798
|
+
inSel.innerHTML = "";
|
|
6799
|
+
(ticketInputs.length ? ticketInputs : (t && t.input ? [t.input] : [])).forEach(function(label){
|
|
6800
|
+
var o = document.createElement("option"); o.value = label; o.textContent = label; inSel.appendChild(o);
|
|
6801
|
+
});
|
|
6802
|
+
if(t && t.input) inSel.value = t.input;
|
|
5971
6803
|
// refused = the select and every sub-box are DISABLED and the reason stands where "Now:" would be
|
|
5972
6804
|
var refused = !!sched.refusal;
|
|
5973
|
-
sel.disabled = byId("jf-when-day").disabled = byId("jf-when-time").disabled = byId("jf-when-path").disabled = refused;
|
|
6805
|
+
sel.disabled = byId("jf-when-day").disabled = byId("jf-when-time").disabled = byId("jf-when-path").disabled = byId("jf-when-input").disabled = refused;
|
|
5974
6806
|
byId("jf-when-now").textContent = refused ? sched.refusal : (sched.now ? (w.nowPrefix || "") + sched.now : "");
|
|
5975
6807
|
byId("jf-err-when").textContent = "";
|
|
5976
6808
|
whenShowSubs();
|
|
@@ -5986,7 +6818,7 @@
|
|
|
5986
6818
|
whenShowSubs();
|
|
5987
6819
|
renderMain();
|
|
5988
6820
|
}
|
|
5989
|
-
["jf-when", "jf-when-day", "jf-when-time"].forEach(function(id){ byId(id).addEventListener("change", whenEdited); });
|
|
6821
|
+
["jf-when", "jf-when-day", "jf-when-time", "jf-when-input"].forEach(function(id){ byId(id).addEventListener("change", whenEdited); });
|
|
5990
6822
|
byId("jf-when-path").addEventListener("input", whenEdited);
|
|
5991
6823
|
// the hash binds the WHOLE card (inputs, destination, caps), so a change to any of them drops it too (and repaints the button: on a scheduled job a box edit is Sign schedule)
|
|
5992
6824
|
["jf-inputs", "jf-dest", "jf-cap-money", "jf-cap-time"].forEach(function(id){ byId(id).addEventListener("input", function(){ if(!sched) return; if(whenHash !== null) whenEdited(); else renderMain(); }); });
|
|
@@ -6035,7 +6867,7 @@
|
|
|
6035
6867
|
if(sessionLive || resumeRun !== null){ errEl.textContent = "Finish or clear what is on the card first, then try again."; return; }
|
|
6036
6868
|
applyReuse({runid: d.runid, prefill: d.prefill, lock: true});
|
|
6037
6869
|
var sc = (d.prefill || {}).scheduleCard || {};
|
|
6038
|
-
sched = {job: d.job, runid: d.runid, words: sc.words || {}, cur: sc.trigger || null, scheduled: sc.scheduled === true, refusal: sc.refusal || null, now: sc.now || null,
|
|
6870
|
+
sched = {job: d.job, runid: d.runid, words: sc.words || {}, ticketInputs: sc.ticketInputs || [], cur: sc.trigger || null, scheduled: sc.scheduled === true, refusal: sc.refusal || null, now: sc.now || null,
|
|
6039
6871
|
base: {inputs: byId("jf-inputs").value.trim(), dest: byId("jf-dest").value.trim(), capUsd: byId("jf-cap-money").value.trim(), capTime: byId("jf-cap-time").value.trim()}};
|
|
6040
6872
|
whenHash = null; whenConfirm = null; whenBusy = false;
|
|
6041
6873
|
paintWhen();
|