fwdloop 0.38.0 → 0.40.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/README.md +6 -9
- package/bin/fwdloop +21 -19
- package/package.json +1 -1
- package/src/ask.js +70 -148
- package/src/audit-fold.js +6 -5
- package/src/auditchecks.js +6 -4
- package/src/authoring.js +32 -60
- package/src/blockasks.js +2 -1
- package/src/blockassemble.js +15 -3
- package/src/blockdraft.js +2 -2
- package/src/blockpick.js +42 -16
- package/src/books.js +237 -12
- package/src/checkblock.js +24 -44
- package/src/checklistsign.js +25 -3
- package/src/checklook.js +3 -1
- package/src/checkpick.js +6 -77
- package/src/cited-source.js +4 -4
- package/src/citedcheck.js +6 -11
- package/src/citedwords.js +9 -8
- package/src/closers.js +9 -6
- package/src/declaration.js +14 -49
- package/src/diary.js +23 -1
- package/src/draft-steps.js +11 -1
- package/src/drafter.js +18 -12
- package/src/draftfiles.js +127 -0
- package/src/draftspend.js +165 -17
- package/src/flow.js +42 -87
- package/src/flowmodel.js +1 -1
- package/src/index.js +3 -2
- package/src/inside.js +106 -0
- package/src/jsonl-append.js +33 -1
- package/src/learn.js +1 -1
- package/src/learnstore.js +20 -22
- package/src/line-checks.js +1 -1
- package/src/liveness.js +3 -0
- package/src/mcp-use.js +8 -9
- package/src/memo.js +13 -16
- package/src/model-step.js +2 -2
- package/src/page-words.js +8 -0
- package/src/pageask.js +8 -3
- package/src/pagebits.js +8 -1
- package/src/pagedropwords.js +1 -1
- package/src/pagerules.js +6 -3
- package/src/panel/author.js +99 -75
- package/src/panel/authorcard.js +21 -8
- package/src/panel/authorflows.js +3 -3
- package/src/panel/authorresume.js +3 -3
- package/src/panel/authorstart.js +15 -16
- package/src/panel/authortrigger.js +43 -70
- package/src/panel/data.js +186 -188
- package/src/panel/index.html +139 -115
- package/src/panel/jobgrid.js +3 -7
- package/src/panel/result.js +7 -10
- package/src/panel/resume.js +4 -3
- package/src/panel/scheduler.js +9 -9
- package/src/panel/server.js +8 -4
- package/src/panel/spawn.js +22 -11
- package/src/panel/tickets.js +2 -2
- package/src/pickrecord.js +51 -31
- package/src/placerule.js +3 -4
- package/src/plain-checks.js +1 -1
- package/src/planrebuild.js +19 -19
- package/src/primitives.js +1 -1
- package/src/provider.js +1 -1
- package/src/reasons.js +25 -0
- package/src/runfile.js +26 -2
- package/src/runner.js +57 -105
- package/src/runvalues.js +47 -24
- package/src/schedule-choices.js +41 -0
- package/src/schedule-shape.js +39 -0
- package/src/schedule.js +9 -8
- package/src/setup.js +20 -36
- package/src/shaperows.js +2 -2
- package/src/sheetblock.js +2 -2
- package/src/sheetbuild.js +5 -5
- package/src/sheetrun.js +4 -5
- package/src/summary-words.js +2 -1
- package/src/thinking.js +5 -2
- package/src/ticketrows.js +7 -28
- package/src/trigger-clock.js +9 -23
- package/src/trigger-files.js +30 -22
- package/src/trigger-tickets.js +15 -14
- package/src/try-checks.js +2 -1
- package/src/types.js +2 -0
- package/types/ask.d.ts +25 -20
- package/types/authoring.d.ts +7 -42
- package/types/blockpick.d.ts +1 -1
- package/types/books.d.ts +380 -4
- package/types/checkblock.d.ts +1 -23
- package/types/checklist.d.ts +3 -3
- package/types/checklistsign.d.ts +7 -0
- package/types/checkpick.d.ts +0 -21
- package/types/citedwords.d.ts +7 -4
- package/types/closers.d.ts +1 -0
- package/types/declaration.d.ts +4 -14
- package/types/diary.d.ts +14 -1
- package/types/draft-steps.d.ts +7 -0
- package/types/drafter.d.ts +1 -1
- package/types/draftfiles.d.ts +89 -0
- package/types/draftspend.d.ts +74 -0
- package/types/flow.d.ts +32 -54
- package/types/index.d.ts +3 -3
- package/types/inside.d.ts +71 -0
- package/types/jsonl-append.d.ts +20 -0
- package/types/learnstore.d.ts +0 -2
- package/types/liveness.d.ts +1 -0
- package/types/page-words.d.ts +6 -0
- package/types/pageask.d.ts +2 -0
- package/types/pagebits.d.ts +3 -0
- package/types/pagerules.d.ts +1 -0
- package/types/panel/author.d.ts +7 -3
- package/types/panel/authorcard.d.ts +0 -6
- package/types/panel/authorflows.d.ts +4 -4
- package/types/panel/authortrigger.d.ts +16 -2
- package/types/panel/data.d.ts +50 -16
- package/types/panel/spawn.d.ts +18 -2
- package/types/pickrecord.d.ts +29 -0
- package/types/reasons.d.ts +23 -0
- package/types/runfile.d.ts +14 -0
- package/types/runner.d.ts +6 -38
- package/types/runvalues.d.ts +17 -2
- package/types/schedule-choices.d.ts +9 -0
- package/types/schedule-shape.d.ts +15 -0
- package/types/sheetbuild.d.ts +1 -1
- package/types/thinking.d.ts +1 -0
- package/types/ticketrows.d.ts +0 -9
- package/types/trigger-clock.d.ts +3 -2
- package/types/trigger-files.d.ts +15 -4
- package/types/types.d.ts +8 -0
package/src/panel/index.html
CHANGED
|
@@ -392,6 +392,8 @@
|
|
|
392
392
|
.map-chip.s-stopped{border-color:var(--red);} .map-chip.s-stopped .chip-state{color:var(--red);}
|
|
393
393
|
.map-chip.s-waiting{border-color:var(--amber);} .map-chip.s-waiting .chip-state{color:#b8860b;}
|
|
394
394
|
.map-chip.s-user-stopped{border-color:var(--grey-dot);} .map-chip.s-user-stopped .chip-state{color:var(--grey-dot);}
|
|
395
|
+
.map-chip.s-capped{border-color:var(--grey-dot);} .map-chip.s-capped .chip-state{color:var(--grey-dot);}
|
|
396
|
+
.map-chip.s-noted{border-color:var(--grey-dot);} .map-chip.s-noted .chip-state{color:var(--grey-dot);}
|
|
395
397
|
.map-chip .chip-retry{font-size:10px;color:var(--text-faint);}
|
|
396
398
|
.map-chip.retry{border-style:dashed;} /* borrowed-from: bareloop src/panel/index.html@9edb3e1 */
|
|
397
399
|
|
|
@@ -744,11 +746,10 @@
|
|
|
744
746
|
.audit-raw{color:var(--text-faint);font-size:11px;word-break:break-word;white-space:pre-wrap;margin-top:2px;}
|
|
745
747
|
.chat-steps .step-raw{margin-top:2px;color:var(--text-faint);}
|
|
746
748
|
.chat-steps .step-raw summary{cursor:pointer;}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}
|
|
749
|
+
/* borrowed-from: bareloop src/panel/index.html@v0.63.0 (7bc2719b): the step time and the "Drafting so far" line; the animated dots are gone */
|
|
750
|
+
.chat-steps .step-time{color:var(--text-faint);}
|
|
751
|
+
.chat-steps .step-so-far{padding:3px 0 0;color:var(--text-faint);}
|
|
752
|
+
.drafted-line{color:var(--text-faint);font-size:12px;margin-top:6px;}
|
|
752
753
|
|
|
753
754
|
.chat-thread{display:flex;flex-direction:column;gap:10px;margin-bottom:10px;}
|
|
754
755
|
.chat-thread:empty{display:none;}
|
|
@@ -1278,18 +1279,21 @@
|
|
|
1278
1279
|
<label for="jf-mcp">MCP</label>
|
|
1279
1280
|
<select id="jf-mcp" data-testid="jf-mcp" aria-label="MCP"></select>
|
|
1280
1281
|
<div class="hint"><a class="link" id="jf-mcp-manage" data-testid="jf-mcp-manage" href="#">manage in Settings > MCP</a></div>
|
|
1281
|
-
<div class="jf-err" id="jf-err-mcp" data-testid="jf-err-mcp"></div>
|
|
1282
1282
|
</div>
|
|
1283
1283
|
<div class="field" id="jf-sched-field" data-testid="jf-sched-field">
|
|
1284
1284
|
<label for="jf-sched">Schedule</label>
|
|
1285
|
-
<select id="jf-sched" data-testid="jf-sched" aria-label="Schedule">
|
|
1286
|
-
<option value="hand">By hand</option>
|
|
1287
|
-
<option value="new-ticket">When a new ticket arrives</option>
|
|
1288
|
-
<option value="daily">Every day at HH:MM</option>
|
|
1289
|
-
</select>
|
|
1285
|
+
<select id="jf-sched" data-testid="jf-sched" aria-label="Schedule"></select>
|
|
1290
1286
|
<div class="when-sub" id="jf-sched-clock" hidden>
|
|
1287
|
+
<select id="jf-sched-day" data-testid="jf-sched-day" aria-label="Day of the week">
|
|
1288
|
+
<option value="mon">Monday</option><option value="tue">Tuesday</option><option value="wed">Wednesday</option><option value="thu">Thursday</option>
|
|
1289
|
+
<option value="fri">Friday</option><option value="sat">Saturday</option><option value="sun">Sunday</option>
|
|
1290
|
+
</select>
|
|
1291
1291
|
<input id="jf-sched-time" type="time" value="09:00" data-testid="jf-sched-time" aria-label="Time, HH:MM">
|
|
1292
1292
|
</div>
|
|
1293
|
+
<div class="when-sub" id="jf-sched-filebox" hidden>
|
|
1294
|
+
<select id="jf-sched-role" data-testid="jf-sched-role" aria-label="Which of the job's inputs"></select>
|
|
1295
|
+
<input id="jf-sched-path" type="text" autocomplete="off" spellcheck="false" data-testid="jf-sched-path" aria-label="File or folder">
|
|
1296
|
+
</div>
|
|
1293
1297
|
<div class="hint" id="jf-sched-hint" data-testid="jf-sched-hint" hidden>off until the first green run, then turns on</div>
|
|
1294
1298
|
<div class="hint" id="jf-sched-ticket-hint" data-testid="jf-sched-ticket-hint" hidden>the first run reads the newest ticket at the time it starts; older tickets never run</div>
|
|
1295
1299
|
<div class="jf-err" id="jf-err-schedule" data-testid="jf-err-schedule"></div>
|
|
@@ -1374,15 +1378,7 @@
|
|
|
1374
1378
|
</div>
|
|
1375
1379
|
<div class="field" id="jf-when-field" data-testid="jf-when-field">
|
|
1376
1380
|
<label for="jf-when">When</label>
|
|
1377
|
-
<select id="jf-when" data-testid="jf-when" aria-label="When this job runs">
|
|
1378
|
-
<option value="hand">By hand</option>
|
|
1379
|
-
<option value="daily">Every day at HH:MM</option>
|
|
1380
|
-
<option value="weekdays">Weekdays at HH:MM</option>
|
|
1381
|
-
<option value="weekly">Every <day> at HH:MM</option>
|
|
1382
|
-
<option value="file-updated">When <file> is updated</option>
|
|
1383
|
-
<option value="new-file">When a new file arrives in <folder></option>
|
|
1384
|
-
<option value="new-ticket">When a new ticket arrives in <input name></option>
|
|
1385
|
-
</select>
|
|
1381
|
+
<select id="jf-when" data-testid="jf-when" aria-label="When this job runs"></select>
|
|
1386
1382
|
<div class="when-sub" id="jf-when-clock" hidden>
|
|
1387
1383
|
<select id="jf-when-day" data-testid="jf-when-day" aria-label="Day of the week">
|
|
1388
1384
|
<option value="mon">Monday</option><option value="tue">Tuesday</option><option value="wed">Wednesday</option><option value="thu">Thursday</option>
|
|
@@ -1679,6 +1675,27 @@
|
|
|
1679
1675
|
|
|
1680
1676
|
var PORT = "__FWDLOOP_PANEL_PORT__";
|
|
1681
1677
|
var PLAN_CHECK_RULES = __FWDLOOP_PLAN_CHECK_RULES__;
|
|
1678
|
+
// M20 am5 item 1: the one list of schedule choices per flow type (src/schedule-choices.js); the New job card's Schedule and the Run card's When both fill from it
|
|
1679
|
+
var SCHEDULE_CHOICES = __FWDLOOP_SCHEDULE_CHOICES__;
|
|
1680
|
+
// M20 am8a item 1: the origin tag words, the decisions that need a reason and the draft phases (a revise or redraft running; red or stopped) come from their owners (src/page-words.js); the page asks this list, never spells them
|
|
1681
|
+
var PAGE_WORDS = __FWDLOOP_PAGE_WORDS__;
|
|
1682
|
+
function inWords(list, word){ return list.indexOf(word) >= 0; }
|
|
1683
|
+
// M20 am6: "is this a clock kind" is answered by the server (isClockKind in src/trigger-clock.js), carried on every choice as `clock`
|
|
1684
|
+
function isClockKind(kind){
|
|
1685
|
+
return Object.keys(SCHEDULE_CHOICES).some(function(t){ return SCHEDULE_CHOICES[t].some(function(c){ return c.kind === kind && c.clock; }); });
|
|
1686
|
+
}
|
|
1687
|
+
// M20 am7: "is this a file kind" is answered by the server (isFileKind in src/trigger-files.js), carried on every choice as `file`
|
|
1688
|
+
function isFileKind(kind){
|
|
1689
|
+
return Object.keys(SCHEDULE_CHOICES).some(function(t){ return SCHEDULE_CHOICES[t].some(function(c){ return c.kind === kind && c.file; }); });
|
|
1690
|
+
}
|
|
1691
|
+
// M20 am8: "is this a flow type" is answered by the server (isFlowType in src/declaration.js): the page takes the flow types from the keys of the schedule choices it gets (a test pins the keys to FLOW_TYPES)
|
|
1692
|
+
function flowTypeOr(type){ return typeof type === "string" && Object.prototype.hasOwnProperty.call(SCHEDULE_CHOICES, type) ? type : "plain"; }
|
|
1693
|
+
function fillScheduleOptions(sel, flowType, newCard){
|
|
1694
|
+
var list = SCHEDULE_CHOICES[flowTypeOr(flowType)], keep = sel.value;
|
|
1695
|
+
sel.innerHTML = "";
|
|
1696
|
+
list.forEach(function(c){ var o = document.createElement("option"); o.value = c.kind; o.textContent = newCard ? c.newCardLabel : c.label; sel.appendChild(o); });
|
|
1697
|
+
if(keep && list.some(function(c){ return c.kind === keep; })) sel.value = keep;
|
|
1698
|
+
}
|
|
1682
1699
|
// No token, no cookie (M4e amendment 4 item 8): the panel is local and trusted; the server checks Host and, on a POST, Origin.
|
|
1683
1700
|
document.getElementById("host-line").textContent = "127.0.0.1:" + PORT;
|
|
1684
1701
|
|
|
@@ -1912,10 +1929,12 @@
|
|
|
1912
1929
|
// M4c-fix amendment 2 (g): a step's own sign + word come from the SAME one table the run rows use (the server's
|
|
1913
1930
|
// SIGN_WORDS, sent on the run detail as `signWords`); the page keeps no table of its own. Not started: no sign.
|
|
1914
1931
|
var signWords = {};
|
|
1915
|
-
var STEP_SIGN = { done: "[\u2713]", stopped: "[\u2717]", waiting: "[\u00b7]", "user-stopped": "[\u25a0]" };
|
|
1916
|
-
function stateWord(state){
|
|
1932
|
+
var STEP_SIGN = { done: "[\u2713]", stopped: "[\u2717]", waiting: "[\u00b7]", "user-stopped": "[\u25a0]", capped: "[\u25a0]" };
|
|
1933
|
+
function stateWord(state, text){
|
|
1917
1934
|
if(state === "pending") return "not started";
|
|
1935
|
+
if(state === "noted") return text || state; // M20 am9a: no sign; the server's word for the last row (the owner's)
|
|
1918
1936
|
var g = STEP_SIGN[state];
|
|
1937
|
+
if(state === "capped") return g + " " + state; // the state value IS the server's word for a cap-halt step (the table's)
|
|
1919
1938
|
return g && signWords[g] ? g + " " + signWords[g] : state;
|
|
1920
1939
|
}
|
|
1921
1940
|
// fwdloop's close-class vocabulary (M4a scope item 4): `green` -> "cited"
|
|
@@ -1957,47 +1976,8 @@
|
|
|
1957
1976
|
bits.push("cache-read " + (typeof spendSummary.cacheReadTokens === "number" ? spendSummary.cacheReadTokens : "unknown"));
|
|
1958
1977
|
return bits.join(" · ");
|
|
1959
1978
|
}
|
|
1960
|
-
//
|
|
1961
|
-
// (src/
|
|
1962
|
-
// `ask-expired`, `red`, `crash`-like stops) — and the scope forbids
|
|
1963
|
-
// rendering the raw words green/red/softgreen anywhere (coordinator's
|
|
1964
|
-
// browser-walk fix #2). `verdictWord`/`verdictGlyph` are the ONE place
|
|
1965
|
-
// that turns a verdict (plus the step's own close class, for telling a
|
|
1966
|
-
// human's redo apart from a mechanical red) into plain words and a
|
|
1967
|
-
// pass/fail glyph — used by the step cards, the map's inline attempt
|
|
1968
|
-
// text, and the flat Audit table alike, so they can never say something
|
|
1969
|
-
// different for the same row.
|
|
1970
|
-
// - `paused`/`refused`/an ask timeout/expiry are NOT failures (fix #3) —
|
|
1971
|
-
// no ✗, a plain word instead.
|
|
1972
|
-
// - a `red` verdict on a `hitl`-classed step is the human's own redo
|
|
1973
|
-
// (src/runner.js's redo path), not a mechanical stop — "redo by
|
|
1974
|
-
// you: <reason>", never "verdict red" / a fail glyph (fix #3).
|
|
1975
|
-
function verdictWord(verdict, closeClass, gap){
|
|
1976
|
-
if(closeClass === "hitl" && verdict === "red") return "redo by you" + (gap ? ": " + gap : "");
|
|
1977
|
-
if(verdict === "paused") return "paused for you";
|
|
1978
|
-
if(verdict === "refused") return "refused — no reason given";
|
|
1979
|
-
if(verdict === "ask-timeout" || verdict === "ask-expired") return "expired waiting for you";
|
|
1980
|
-
if(verdict === "ask-reopened") return "reopened by you";
|
|
1981
|
-
if(verdict === "lock-removed") return "old lock removed by you";
|
|
1982
|
-
if(verdict === "stop-asked") return "stop asked by you";
|
|
1983
|
-
if(verdict === "stopped") return "stopped by you";
|
|
1984
|
-
if(verdict === "stop-not-honoured") return "stop not honoured";
|
|
1985
|
-
if(verdict === "green") return "passed";
|
|
1986
|
-
if(verdict === "hitl") return "human check";
|
|
1987
|
-
if(verdict === "not-done") return "not done";
|
|
1988
|
-
if(typeof verdict !== "string") return "unknown";
|
|
1989
|
-
return "failed"; // red (non-hitl), crash-like, cap-halt, pricing/provider-red, unparseable, ...
|
|
1990
|
-
}
|
|
1991
|
-
function verdictPassed(verdict){ return verdict === "green" || verdict === "hitl"; }
|
|
1992
|
-
// `null` — no glyph at all — for a verdict that is neither a pass nor a
|
|
1993
|
-
// fail (paused/refused/expired/a human redo); a bare attempt glyph
|
|
1994
|
-
// would misread a pause as a failure (fix #3).
|
|
1995
|
-
function verdictGlyph(verdict, closeClass){
|
|
1996
|
-
if(closeClass === "hitl" && verdict === "red") return null;
|
|
1997
|
-
if(verdict === "paused" || verdict === "refused" || verdict === "ask-timeout" || verdict === "ask-expired" || verdict === "ask-reopened" || verdict === "lock-removed") return null;
|
|
1998
|
-
if(verdict === "stop-asked" || verdict === "stopped" || verdict === "stop-not-honoured") return null; // amendment 7 item 8: a Stop is neither a pass nor a failure
|
|
1999
|
-
return verdictPassed(verdict) ? "✓" : "✗";
|
|
2000
|
-
}
|
|
1979
|
+
// M20 am9: the page derives no word or sign from a verdict. The server hands every Audit row its `sign` (null = none) and `word`, and every try its mark,
|
|
1980
|
+
// from the one table (src/books.js ENDINGS, `auditSignWord`): the step cards, the map's attempt text and the flat Audit table all draw those fields.
|
|
2001
1981
|
// The run-row glyph strings src/panel/data.js's computeGlyph emits are
|
|
2002
1982
|
// already bracketed ("[✓]", "[✗]", "[·]", "[▶]", "[?]") — this only ever picks a
|
|
2003
1983
|
// CSS color class off them, never re-derives the glyph itself.
|
|
@@ -2074,7 +2054,7 @@
|
|
|
2074
2054
|
toolsTotal: s.toolsTotal || null, toolsWhy: s.toolsWhy || null, ungranted: s.ungranted || [],
|
|
2075
2055
|
stoppedReason: s.stoppedReason || null,
|
|
2076
2056
|
who: s.who || null, newLine: typeof s.newLine === "string" ? s.newLine : "\u2014", lastAnswerAt: s.lastAnswerAt || null,
|
|
2077
|
-
state: s.groupState || "pending", // the server's one decider (deriveStepGroupState); no group = no row yet = not started
|
|
2057
|
+
stateText: s.groupText || null, state: s.groupState || "pending", // the server's one decider (deriveStepGroupState); no group = no row yet = not started
|
|
2078
2058
|
};
|
|
2079
2059
|
});
|
|
2080
2060
|
}
|
|
@@ -2087,7 +2067,7 @@
|
|
|
2087
2067
|
var tries = boxRetryTry(s);
|
|
2088
2068
|
var cls = "map-chip s-" + String(s.state).replace(/[^a-z-]/g, "") + (tries ? " retry" : "");
|
|
2089
2069
|
var name = escapeXml(stepTitleText(idx, s));
|
|
2090
|
-
var state = escapeXml(s.noRecord ? "no draft record" : stateWord(s.state));
|
|
2070
|
+
var state = escapeXml(s.noRecord ? "no draft record" : stateWord(s.state, s.stateText));
|
|
2091
2071
|
// hamr review #4: each box is a clickable button tagged with the step's own `emits` id — the click listener that
|
|
2092
2072
|
// jumps to the Audit tab's matching group is wired AFTER insertion (wireMapClicks), never inline here.
|
|
2093
2073
|
var chip = '<button type="button" class="' + cls + ' map-step" data-emits="' + escapeXml(s.emits) + '"' + (tries ? ' data-retry="' + tries + '"' : '') +
|
|
@@ -3122,12 +3102,13 @@
|
|
|
3122
3102
|
var box = document.getElementById("ended-block");
|
|
3123
3103
|
var note = document.getElementById("catchup-note");
|
|
3124
3104
|
var sc = sm.schedule || null;
|
|
3125
|
-
|
|
3105
|
+
var nowText = typeof sm.now === "string" && sm.now ? sm.now : null;
|
|
3106
|
+
if(sm.ended || sc || nowText){
|
|
3126
3107
|
var tone = glyphClass(detail.glyph); // M9 am14: the colour of that run's card in the runs list, one decider (its dot)
|
|
3127
3108
|
if(sc && sc.red === true) tone = "red";
|
|
3128
3109
|
box.hidden = false;
|
|
3129
3110
|
box.className = "ended-block" + (tone ? " " + tone : "");
|
|
3130
|
-
box.innerHTML = (sm.ended ? summaryRow("ENDED", sm.ended.reason, "ended-reason") + nextRow(sm.ended) : "") +
|
|
3111
|
+
box.innerHTML = (nowText ? summaryRow("NOW", nowText, "now-row") : "") + (sm.ended ? summaryRow("ENDED", sm.ended.reason, "ended-reason") + nextRow(sm.ended) : "") +
|
|
3131
3112
|
(sc ? summaryRow("SCHEDULE", sc.line1, "sched-line1", sc.red === true) + (sc.line2 ? summaryRow("", sc.line2, "sched-line2", sc.red === true, sc.grey === true) : "") : "");
|
|
3132
3113
|
} else { box.hidden = true; box.innerHTML = ""; }
|
|
3133
3114
|
note.hidden = !sm.catchUp;
|
|
@@ -3349,7 +3330,7 @@
|
|
|
3349
3330
|
var stateBadge = document.createElement("span");
|
|
3350
3331
|
stateBadge.className = "badge " + auditStateClass(box.state) + (STEP_SIGN[box.state] ? " sign-badge" : "");
|
|
3351
3332
|
stateBadge.setAttribute("data-testid", "step-card-state-" + idx);
|
|
3352
|
-
stateBadge.textContent = stateWord(box.state);
|
|
3333
|
+
stateBadge.textContent = stateWord(box.state, box.stateText);
|
|
3353
3334
|
head.appendChild(stateBadge);
|
|
3354
3335
|
var closeBadge = document.createElement("span");
|
|
3355
3336
|
closeBadge.className = "badge cyan";
|
|
@@ -3500,9 +3481,9 @@
|
|
|
3500
3481
|
function auditThinkingHtml(r){ return typeof r.thinkingPhrase === "string" && r.thinkingPhrase.length > 0 ? " \u00b7 " + escapeXml(r.thinkingPhrase) : ""; }
|
|
3501
3482
|
function buildAuditRowEl(r, includeStep){
|
|
3502
3483
|
var tr = document.createElement("tr");
|
|
3503
|
-
var glyph =
|
|
3504
|
-
var word =
|
|
3505
|
-
var isRejectRow = r.class === "hitl" && r.verdict === "red";
|
|
3484
|
+
var glyph = r.sign;
|
|
3485
|
+
var word = r.word;
|
|
3486
|
+
var isRejectRow = r.class === "hitl" && r.verdict === "red" && r.action === "human"; // the person's redo (the server's `action`); a model's red keeps its gap
|
|
3506
3487
|
var badgeClass = glyph === "✓" ? "green" : (glyph === "✗" ? "red" : "amber");
|
|
3507
3488
|
var action = typeof r.action === "string" && r.action.length > 0 ? r.action : r.verdict; // server always sets `action` (deriveAuditAction); this fallback is belt-and-braces only
|
|
3508
3489
|
// Amendment M4a-3: append this row's own tool tally to the Action cell,
|
|
@@ -3605,7 +3586,7 @@
|
|
|
3605
3586
|
var passed = ds.ended === "done";
|
|
3606
3587
|
return {status: passed ? stateWord("done") : "not signed", state: passed ? "done" : "pending", signed: true, name: "drafting", dot: AUDIT_DOT, draftFigs: draftFigures(ds).concat([draftHumanWord(ds)]), passed: passed};
|
|
3607
3588
|
}
|
|
3608
|
-
var parts = {status: stateWord(g.state), state: g.state, signed: true, dot: AUDIT_DOT, name: g.step, cost: g.cost || "cost unknown"};
|
|
3589
|
+
var parts = {status: stateWord(g.state, g.stateText), state: g.state, signed: true, dot: AUDIT_DOT, name: g.step, cost: g.cost || "cost unknown"};
|
|
3609
3590
|
if(!g.run) parts.tries = {n: g.tryCount, marks: g.tryMarks}; // the run's own group has no tries
|
|
3610
3591
|
return parts;
|
|
3611
3592
|
}
|
|
@@ -3655,7 +3636,7 @@
|
|
|
3655
3636
|
var p = auditGroupHeaderParts(g);
|
|
3656
3637
|
if(p.status !== null){
|
|
3657
3638
|
var stateSpan = document.createElement("span");
|
|
3658
|
-
stateSpan.className = "badge " + auditStateClass(p.state) + " sign-badge";
|
|
3639
|
+
stateSpan.className = "badge " + auditStateClass(p.state) + (p.state === "noted" ? "" : " sign-badge");
|
|
3659
3640
|
stateSpan.setAttribute("data-testid", "audit-group-state");
|
|
3660
3641
|
var signEnd = p.status.indexOf(" ");
|
|
3661
3642
|
if(p.state === "done" && p.status.charAt(0) === "[" && signEnd > 0){
|
|
@@ -4189,12 +4170,13 @@
|
|
|
4189
4170
|
// M16 item 5 (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`).
|
|
4190
4171
|
// borrowed-from: bareloop src/panel/index.html@v0.56.0 (3383cce) :3845-3885 (auditCheckRowHtml, auditChecksSignClass, auditChecksEl), drawn in fwdloop's own fold (the learnings fold's header and body shape), appended inside #audit-groups
|
|
4191
4172
|
// the tag of a row by its kind (M16 item 5, one spelling: src/checkwords.js TAG): `~` rows [you], `!` rows [agent], `$` rows [default]; the plan card and the Audit both draw it
|
|
4192
|
-
function tagWordOf(by){ return by === "
|
|
4173
|
+
function tagWordOf(by){ return typeof by === "string" && Object.prototype.hasOwnProperty.call(PAGE_WORDS.tags, by) ? PAGE_WORDS.tags[by] : ""; }
|
|
4193
4174
|
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) byTagOf (the sign before the tag, section 3.7: `~ [you]`, `! [agent]`, `$ [default]`)
|
|
4194
4175
|
function byTagOf(by, form){ return (tagWordOf(by) === "" ? "" : ' <span class="by" data-testid="plan-by" data-by="' + by + '">' + (by === "you" ? "~ " : by === "agent" ? "! " : "$ ") + tagWordOf(by) + '</span>') + (form === "shape" ? ' <span class="by" data-testid="plan-form" data-form="shape">[shape]</span>' : ""); }
|
|
4195
4176
|
// borrowed-from: bareloop src/panel/index.html@v0.61.0 (fc56e1f3) ckTagHtml, ckRowHtml, ckGroupHtml (the signed check-list look): a row is `[tag] kind words ... right`, the tag first in a fixed column,
|
|
4196
4177
|
// the kind word second (`truth`, `shape`, `file`), the Drop / Add or the result at the right; a long reason sits behind "why", a failed row's red reason indented under it.
|
|
4197
|
-
|
|
4178
|
+
// M20 am8b: the text inside the tag span is tagWordOf(by), the page's one answer to "what is the tag word of this row" (v0.61.0 built the brackets here itself)
|
|
4179
|
+
function ckTagHtml(by){ return '<span class="by tagcol" data-testid="plan-by"' + (by ? ' data-by="' + escapeXml(by) + '"' : "") + ">" + tagWordOf(by) + "</span>"; }
|
|
4198
4180
|
function ckRowHtml(o){
|
|
4199
4181
|
var why = o.why ? ' <details class="ck-why" data-testid="ck-why"><summary>\u25B8 why</summary><div class="hint">' + escapeXml(o.why) + "</div></details>" : "";
|
|
4200
4182
|
return '<div class="ck-row" data-testid="' + (o.testid || "plan-check") + '"' + (o.attrs || "") + (o.title ? ' title="' + escapeXml(o.title) + '"' : "") + ">" + ckTagHtml(o.by) + '<span class="kind" data-testid="ck-kind">' + (o.kind ? escapeXml(o.kind) : "") + '</span><span class="ck-t">' + escapeXml(o.text) + why + "</span>" + (o.right ? '<span class="ck-right">' + o.right + "</span>" : "") + (o.under || "") + "</div>";
|
|
@@ -5276,7 +5258,7 @@
|
|
|
5276
5258
|
// The server's own refusal name (`refused`) is matched first; a library refusal is matched by what it says.
|
|
5277
5259
|
function networkText(){ return "Could not reach the panel, so nothing is confirmed. Check it is still running; the header above shows what the books say."; }
|
|
5278
5260
|
// A redo or rerun needs a reason. The page only saves the round trip: the library still judges every answer.
|
|
5279
|
-
function reasonMissing(decision, value){ return (
|
|
5261
|
+
function reasonMissing(decision, value){ return inWords(PAGE_WORDS.reasonDecisions, decision) && String(value).trim() === ""; }
|
|
5280
5262
|
function blankReasonText(decision){ return "Please write a reason for the " + (decision === "rerun" ? "rerun" : "redo") + "."; }
|
|
5281
5263
|
function refusalText(r, decision){
|
|
5282
5264
|
var byName = {
|
|
@@ -5937,7 +5919,7 @@
|
|
|
5937
5919
|
if(st.phase === "drafting"){
|
|
5938
5920
|
return {text: "Draft", action: "none", disabled: true};
|
|
5939
5921
|
}
|
|
5940
|
-
if((
|
|
5922
|
+
if(inWords(PAGE_WORDS.notGreen, st.phase) && st.revisable){
|
|
5941
5923
|
// amendment 14 items 3-4: a red revise keeps the edits; Draft is another revise, Start over (no revises left) a fresh draft
|
|
5942
5924
|
return (st.left || 0) > 0 ? {text: "Draft", action: "revise", disabled: blocked} : {text: "Start over", action: "draft", startOver: true, disabled: blocked};
|
|
5943
5925
|
}
|
|
@@ -5947,7 +5929,7 @@
|
|
|
5947
5929
|
if(st.phase === "stopped"){
|
|
5948
5930
|
return {text: "Draft again", action: "draft", disabled: blocked};
|
|
5949
5931
|
}
|
|
5950
|
-
if(
|
|
5932
|
+
if(inWords(PAGE_WORDS.reviseRunning, st.phase)){
|
|
5951
5933
|
return {text: "Sign & run", action: "none", disabled: true};
|
|
5952
5934
|
}
|
|
5953
5935
|
if(st.phase === "questions-open"){
|
|
@@ -6020,7 +6002,8 @@
|
|
|
6020
6002
|
function draftLines(fallback){
|
|
6021
6003
|
if(!state || !Array.isArray(state.stepList) || state.stepList.length === 0) return fallback();
|
|
6022
6004
|
state.stepList.forEach(function(st){
|
|
6023
|
-
var row = {id: st.id, label: st.label, status: st.status === "failed" ? "failed" : (st.status === "waiting" ? "waiting" : "done"), details: st.details || []};
|
|
6005
|
+
var row = {id: st.id, label: st.label, status: st.status === "failed" ? "failed" : (st.status === "waiting" ? "waiting" : (st.status === "running" ? "running" : "done")), details: st.details || []};
|
|
6006
|
+
if(typeof st.time === "string" && st.time) row.time = st.time;
|
|
6024
6007
|
if(st.note === true) row.note = true;
|
|
6025
6008
|
out.push(row);
|
|
6026
6009
|
});
|
|
@@ -6029,7 +6012,8 @@
|
|
|
6029
6012
|
var capPart = cap !== "" ? ", run cap $" + cap : "";
|
|
6030
6013
|
if(state){
|
|
6031
6014
|
if(state.phase === "drafting"){
|
|
6032
|
-
|
|
6015
|
+
// M20 am1 item 5: the steps the drafter has started (its step lines), else the one line it always had
|
|
6016
|
+
draftLines(function(){ out.push({id: "drafting", label: "drafting with " + who + capPart, status: "running", details: []}); });
|
|
6033
6017
|
} else if(Array.isArray(state.revises)){
|
|
6034
6018
|
// amendment 14: a draft whose first plan was green. One line per revise with its result; a red one shows its reds (its sentence is on the card error line).
|
|
6035
6019
|
draftLines(function(){ out.push({id: "drafted", label: "drafted with " + who, status: "done", details: []}); });
|
|
@@ -6038,10 +6022,12 @@
|
|
|
6038
6022
|
// an answer redraft (amendment 24 item 4) is not a revise and is not counted as one; the server names each one (`rv.name`) and, from the plan's own log,
|
|
6039
6023
|
// writes its line (`rv.lines`, src/draft-steps.js `reviseStepList`): one line, facts joined by " · ", a red one with one plain reason and a Fix line (am15)
|
|
6040
6024
|
var label = rv.name || (rv.kind === "answers" ? "drafted again with your answers" : "revise " + (reviseNo += 1));
|
|
6041
|
-
if(rv.phase === "running") out.push({id: "revise-" + rv.n, label: label, status: "running", details: []});
|
|
6025
|
+
if(rv.phase === "running" && !(Array.isArray(rv.lines) && rv.lines.length)) out.push({id: "revise-" + rv.n, label: label, status: "running", details: []});
|
|
6042
6026
|
else if(Array.isArray(rv.lines) && rv.lines.length){
|
|
6027
|
+
// M20 am1 item 5: a running revise lists its own started steps (its step lines), like the first draft
|
|
6043
6028
|
rv.lines.forEach(function(l){
|
|
6044
|
-
var row = {id: "revise-" + rv.n + "-" + l.id, label: l.label, status: l.status === "failed" ? "failed" : "done", details: []};
|
|
6029
|
+
var row = {id: "revise-" + rv.n + "-" + l.id, label: l.label, status: l.status === "failed" ? "failed" : (l.status === "running" ? "running" : "done"), details: []};
|
|
6030
|
+
if(typeof l.time === "string" && l.time) row.time = l.time;
|
|
6045
6031
|
if(l.note === true) row.note = true;
|
|
6046
6032
|
out.push(row);
|
|
6047
6033
|
});
|
|
@@ -6256,18 +6242,45 @@
|
|
|
6256
6242
|
}
|
|
6257
6243
|
// M13 p5 (signed item 7, the mock's Schedule row): "When a new ticket arrives" only for Tickets; the time box and the two hints follow the pick
|
|
6258
6244
|
function paintSchedule(){
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6245
|
+
// M20 am5 item 1: the choices are the Run card's, from the one list (fillScheduleOptions); the file boxes name an Inputs line that is a file (a web page is never offered)
|
|
6246
|
+
fillScheduleOptions(schedEl, flowTypeEl.value, true);
|
|
6247
|
+
var roles = schedFileRoles();
|
|
6248
|
+
Array.prototype.forEach.call(schedEl.options, function(o){ if(isFileKind(o.value)) o.hidden = o.disabled = roles.length === 0; });
|
|
6249
|
+
if(schedEl.selectedOptions.length && schedEl.selectedOptions[0].disabled) schedEl.value = "hand";
|
|
6250
|
+
var kind = schedEl.value;
|
|
6251
|
+
var roleSel = byId("jf-sched-role"), keep = roleSel.value;
|
|
6252
|
+
roleSel.innerHTML = "";
|
|
6253
|
+
roles.forEach(function(r){ var o = document.createElement("option"); o.value = r; o.textContent = r; roleSel.appendChild(o); });
|
|
6254
|
+
if(roles.indexOf(keep) >= 0) roleSel.value = keep;
|
|
6255
|
+
byId("jf-sched-clock").hidden = !isClockKind(kind);
|
|
6256
|
+
byId("jf-sched-day").hidden = kind !== "weekly";
|
|
6257
|
+
byId("jf-sched-filebox").hidden = !isFileKind(kind);
|
|
6258
|
+
byId("jf-sched-path").placeholder = kind === "new-file" ? "/full/path/to/folder" : "/full/path/to/file";
|
|
6259
|
+
byId("jf-sched-hint").hidden = kind === "hand";
|
|
6260
|
+
byId("jf-sched-ticket-hint").hidden = kind !== "new-ticket";
|
|
6261
|
+
}
|
|
6262
|
+
// the Inputs lines (`name: path`) that name a file: the roles the file choices can watch
|
|
6263
|
+
function schedFileRoles(){
|
|
6264
|
+
var out = [];
|
|
6265
|
+
inputsBox.value.split("\n").forEach(function(line){
|
|
6266
|
+
var m = /^\s*([^:\s]+)\s*:\s*(.*)$/.exec(line);
|
|
6267
|
+
if(m && m[2].trim() !== "" && !/^https?:\/\//i.test(m[2].trim()) && out.indexOf(m[1]) === -1) out.push(m[1]);
|
|
6268
|
+
});
|
|
6269
|
+
return out;
|
|
6265
6270
|
}
|
|
6266
6271
|
function scheduleOfCard(){
|
|
6267
|
-
|
|
6268
|
-
if(
|
|
6272
|
+
var kind = schedEl.value;
|
|
6273
|
+
if(kind === "hand") return null;
|
|
6274
|
+
if(kind === "new-ticket") return {kind: "new-ticket"};
|
|
6275
|
+
if(isFileKind(kind)){
|
|
6276
|
+
var q = {kind: kind, role: byId("jf-sched-role").value};
|
|
6277
|
+
q[kind === "new-file" ? "folder" : "path"] = byId("jf-sched-path").value.trim();
|
|
6278
|
+
return q;
|
|
6279
|
+
}
|
|
6269
6280
|
var t = /^(\d{2}):(\d{2})$/.exec(schedTimeEl.value || "");
|
|
6270
|
-
|
|
6281
|
+
var o = {kind: kind, hour: t ? Number(t[1]) : NaN, minute: t ? Number(t[2]) : NaN};
|
|
6282
|
+
if(kind === "weekly") o.day = byId("jf-sched-day").value;
|
|
6283
|
+
return o;
|
|
6271
6284
|
}
|
|
6272
6285
|
function paintFlowType(){
|
|
6273
6286
|
var generic = flowTypeEl.value === "mcp", tickets = flowTypeEl.value === "tickets";
|
|
@@ -6283,11 +6296,16 @@
|
|
|
6283
6296
|
byId("jf-run-req-inputs").hidden = runInputsEl.children.length === 0;
|
|
6284
6297
|
}
|
|
6285
6298
|
function setFlow(type, server, sched){
|
|
6286
|
-
flowTypeEl.value = (type
|
|
6299
|
+
flowTypeEl.value = flowTypeOr(type);
|
|
6287
6300
|
paintMcpOptions(server || "");
|
|
6288
|
-
schedEl.value
|
|
6289
|
-
|
|
6301
|
+
fillScheduleOptions(schedEl, flowTypeEl.value, true);
|
|
6302
|
+
schedEl.value = sched && schedEl.querySelector('option[value="' + sched.kind + '"]') ? sched.kind : "hand";
|
|
6303
|
+
if(sched && Number.isInteger(sched.hour) && Number.isInteger(sched.minute)) schedTimeEl.value = ("0" + sched.hour).slice(-2) + ":" + ("0" + sched.minute).slice(-2);
|
|
6304
|
+
if(sched && sched.day) byId("jf-sched-day").value = sched.day;
|
|
6305
|
+
if(sched && sched.path !== undefined) byId("jf-sched-path").value = sched.path;
|
|
6306
|
+
if(sched && sched.folder !== undefined) byId("jf-sched-path").value = sched.folder;
|
|
6290
6307
|
paintFlowType();
|
|
6308
|
+
if(sched && sched.role) byId("jf-sched-role").value = sched.role;
|
|
6291
6309
|
}
|
|
6292
6310
|
function loadMcpServers(){
|
|
6293
6311
|
return getJSON("/api/settings/mcp").then(function(d){
|
|
@@ -6296,10 +6314,12 @@
|
|
|
6296
6314
|
mcpServers = names; paintMcpOptions();
|
|
6297
6315
|
}, function(){ /* the list stays as it was; a pick the server cannot start is refused with its cause */ });
|
|
6298
6316
|
}
|
|
6299
|
-
flowTypeEl.addEventListener("change", function(){ paintFlowType(); byId("jf-err-flowType").textContent = "";
|
|
6300
|
-
mcpEl.addEventListener("change", function(){ byId("jf-err-mcp").textContent = ""; });
|
|
6317
|
+
flowTypeEl.addEventListener("change", function(){ paintFlowType(); byId("jf-err-flowType").textContent = ""; refreshStartEnabled(); });
|
|
6301
6318
|
schedEl.addEventListener("change", function(){ paintSchedule(); byId("jf-err-schedule").textContent = ""; });
|
|
6302
6319
|
schedTimeEl.addEventListener("input", function(){ byId("jf-err-schedule").textContent = ""; });
|
|
6320
|
+
["jf-sched-day", "jf-sched-role"].forEach(function(id){ byId(id).addEventListener("change", function(){ byId("jf-err-schedule").textContent = ""; }); });
|
|
6321
|
+
byId("jf-sched-path").addEventListener("input", function(){ byId("jf-err-schedule").textContent = ""; });
|
|
6322
|
+
inputsBox.addEventListener("input", paintSchedule); // the file choices follow the Inputs lines
|
|
6303
6323
|
runFlowTypeEl.addEventListener("change", function(){ runMcpFieldEl.hidden = runFlowTypeEl.value === "plain"; });
|
|
6304
6324
|
byId("jf-run-mcp-manage").addEventListener("click", function(ev){ ev.preventDefault(); document.getElementById("settings-open").click(); document.getElementById("stab-mcp").click(); });
|
|
6305
6325
|
byId("jf-mcp-manage").addEventListener("click", function(ev){ ev.preventDefault(); document.getElementById("settings-open").click(); document.getElementById("stab-mcp").click(); });
|
|
@@ -6477,7 +6497,7 @@
|
|
|
6477
6497
|
var on = cardLocked();
|
|
6478
6498
|
whenSyncButton();
|
|
6479
6499
|
card.querySelectorAll("input[type=text], textarea").forEach(function(el){ el.readOnly = on || el.hasAttribute("data-page"); el.classList.toggle("locked", on); }); // M10: a web-page row is always read-only
|
|
6480
|
-
flowTypeEl.disabled = on; mcpEl.disabled = on; schedEl.disabled = on; schedTimeEl.disabled = on;
|
|
6500
|
+
flowTypeEl.disabled = on; mcpEl.disabled = on; schedEl.disabled = on; schedTimeEl.disabled = on; byId("jf-sched-day").disabled = on; byId("jf-sched-role").disabled = on; byId("jf-sched-path").disabled = on;
|
|
6481
6501
|
flowTypeEl.classList.toggle("locked", on); mcpEl.classList.toggle("locked", on); schedEl.classList.toggle("locked", on); schedTimeEl.classList.toggle("locked", on);
|
|
6482
6502
|
runFlowTypeEl.disabled = on; runMcpEl.disabled = on;
|
|
6483
6503
|
runFlowSel.disabled = on;
|
|
@@ -6602,7 +6622,7 @@
|
|
|
6602
6622
|
jobBoxEl.hidden = !jobOpen; byId("jf-run-jobwrap").hidden = !jobOpen; byId("jf-run-job").hidden = jobOpen;
|
|
6603
6623
|
jobBoxEl.value = jobOpen ? f.edit.card.job : "";
|
|
6604
6624
|
fitCardBoxes();
|
|
6605
|
-
runFlowTypeEl.value =
|
|
6625
|
+
runFlowTypeEl.value = flowTypeOr(f ? f.flowType : undefined);
|
|
6606
6626
|
paintMcpInto(runMcpEl, f && f.mcp ? f.mcp : "");
|
|
6607
6627
|
runMcpFieldEl.hidden = runFlowTypeEl.value === "plain";
|
|
6608
6628
|
byId("jf-err-run-job").textContent = (f && f.edit && f.edit.ok === false) ? f.edit.say : "";
|
|
@@ -6637,6 +6657,7 @@
|
|
|
6637
6657
|
var whenConfirmText = ""; // the words the button shows after click 1 ("every day at 13:15", "cancel schedule"); read only while whenHash is set
|
|
6638
6658
|
var whenLocked = false; // ~1.5 s after a successful sign the main button is disabled, so a fast extra click cannot start a run
|
|
6639
6659
|
var whenReady = false; // the lock sync can run before this block has
|
|
6660
|
+
fillScheduleOptions(document.getElementById("jf-when"), "plain", false); // the list before a flow is picked; paintWhen fills it again for the picked flow's type
|
|
6640
6661
|
function whenCanon(t){
|
|
6641
6662
|
if(t !== null && t.kind === "new-ticket") t = {kind: t.kind, role: t.role}; // M12: the list, server and tool are filled by the server from the signed job
|
|
6642
6663
|
return t === null ? "null" : JSON.stringify(Object.keys(t).sort().map(function(k){ return [k, t[k]]; }));
|
|
@@ -6644,7 +6665,7 @@
|
|
|
6644
6665
|
function whenTriggerFromBoxes(){
|
|
6645
6666
|
var kind = byId("jf-when").value;
|
|
6646
6667
|
if(kind === "hand") return null;
|
|
6647
|
-
if(kind
|
|
6668
|
+
if(isClockKind(kind)){
|
|
6648
6669
|
var m = /^(\d{2}):(\d{2})$/.exec(byId("jf-when-time").value);
|
|
6649
6670
|
var o = m ? {kind: kind, hour: Number(m[1]), minute: Number(m[2])} : {kind: kind}; // an empty time goes to the server, which says so
|
|
6650
6671
|
if(kind === "weekly") o.day = byId("jf-when-day").value;
|
|
@@ -6657,9 +6678,9 @@
|
|
|
6657
6678
|
}
|
|
6658
6679
|
function whenShowSubs(){
|
|
6659
6680
|
var kind = byId("jf-when").value;
|
|
6660
|
-
byId("jf-when-clock").hidden = !(kind
|
|
6681
|
+
byId("jf-when-clock").hidden = !isClockKind(kind);
|
|
6661
6682
|
byId("jf-when-day").hidden = kind !== "weekly";
|
|
6662
|
-
byId("jf-when-filebox").hidden = !(kind
|
|
6683
|
+
byId("jf-when-filebox").hidden = !(isFileKind(kind) || kind === "new-ticket");
|
|
6663
6684
|
byId("jf-when-path").hidden = kind === "new-ticket";
|
|
6664
6685
|
byId("jf-when-path").placeholder = kind === "new-file" ? "/full/path/to/folder" : "/full/path/to/file";
|
|
6665
6686
|
}
|
|
@@ -6694,10 +6715,10 @@
|
|
|
6694
6715
|
var roleSel = byId("jf-when-role");
|
|
6695
6716
|
var fileRoles = whenFileRoles(f), ticketRoles = whenTicketRoles(f);
|
|
6696
6717
|
// M13 p4 (signed item 5): MCP offers By hand and Every day at... only; Tickets adds "When a new ticket arrives" to today's options; plain keeps today's
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
var tk = byId("jf-when").querySelector('option[value="new-ticket"]'); tk.hidden = tk.disabled =
|
|
6718
|
+
// M20 am5 item 1: the choices a flow type offers are the one list (SCHEDULE_CHOICES), the same the New job card's Schedule fills from; what the job has (a file input, a ticket list) decides which of them show
|
|
6719
|
+
fillScheduleOptions(byId("jf-when"), f ? f.flowType : "plain", false);
|
|
6720
|
+
Array.prototype.forEach.call(byId("jf-when").options, function(o){ if(isFileKind(o.value)) o.hidden = o.disabled = fileRoles.length === 0; });
|
|
6721
|
+
var tk = byId("jf-when").querySelector('option[value="new-ticket"]'); if(tk) tk.hidden = tk.disabled = ticketRoles.length === 0; // M12: only a Tickets job with a ticket-list input offers it
|
|
6701
6722
|
var t = c ? c.trigger : null;
|
|
6702
6723
|
sel.querySelector('option[value="hand"]').textContent = t ? "Cancel schedule" : "By hand"; // M9 am5: on a scheduled job, By hand reads Cancel schedule
|
|
6703
6724
|
sel.value = t ? t.kind : "hand";
|
|
@@ -6912,22 +6933,24 @@
|
|
|
6912
6933
|
var key = e.target && e.target.getAttribute ? e.target.getAttribute("data-fold") : null;
|
|
6913
6934
|
if(key) progressOpen[key] = e.target.open === true;
|
|
6914
6935
|
}, true);
|
|
6915
|
-
function renderProgress(steps){
|
|
6936
|
+
function renderProgress(steps, soFar){
|
|
6916
6937
|
progressRow.hidden = steps.length === 0;
|
|
6917
6938
|
var html = steps.map(function(st){
|
|
6918
6939
|
var cls = st.status === "waiting" ? "wait" : (st.status === "running" ? "run" : (st.status === "failed" ? "bad" : "ok"));
|
|
6919
|
-
var sign = st.note ? "" : (cls === "ok" ? "✓" : (cls === "bad" ? "✗" : ""));
|
|
6940
|
+
var sign = st.note ? "" : (cls === "ok" ? "✓" : (cls === "bad" ? "✗" : (cls === "run" ? "▶" : "")));
|
|
6941
|
+
// M20 am1 item 5: "took M:SS" / "M:SS so far", the server's words (src/draftspend.js withDraftTimes)
|
|
6942
|
+
var time = typeof st.time === "string" && st.time ? '<span class="step-time" data-testid="step-time">' + escapeXml(st.time) + '</span>' : "";
|
|
6920
6943
|
// M4d am15: a line with no ✓/✗ (the Fix line under a red plan check)
|
|
6921
6944
|
if(st.note) cls += " note";
|
|
6922
6945
|
return '<li class="step ' + cls + '" data-step="' + escapeXml(st.id) + '"><div class="step-line"><span class="step-label">' + escapeXml(st.label) + '</span>' +
|
|
6923
|
-
'<span class="step-sign">' + sign + '</span
|
|
6946
|
+
'<span class="step-sign">' + sign + '</span>' + time + '</div>' +
|
|
6924
6947
|
(st.details || []).map(function(d, k){
|
|
6925
6948
|
var raw = st.raw || [];
|
|
6926
6949
|
var key = st.id + ":" + k;
|
|
6927
6950
|
var fold = typeof raw[k] === "string" && raw[k] !== "" ? '<details class="step-raw" data-fold="' + escapeXml(key) + '"' + (progressOpen[key] ? " open" : "") + '><summary>details</summary>' + escapeXml(raw[k]) + '</details>' : "";
|
|
6928
6951
|
return '<div class="step-detail">' + escapeXml("> " + d) + fold + '</div>';
|
|
6929
6952
|
}).join("") + '</li>';
|
|
6930
|
-
}).join("");
|
|
6953
|
+
}).join("") + (steps.length && typeof soFar === "string" && soFar ? '<li class="step-so-far" data-testid="drafting-so-far">' + escapeXml(soFar) + '</li>' : "");
|
|
6931
6954
|
if(html === progressHtml) return false;
|
|
6932
6955
|
progressHtml = html;
|
|
6933
6956
|
progressRow.innerHTML = html;
|
|
@@ -6944,11 +6967,12 @@
|
|
|
6944
6967
|
}
|
|
6945
6968
|
function renderThread(state){
|
|
6946
6969
|
// a revise being drafted leaves the plan on show until the new one replaces it (the view carries no plan meanwhile)
|
|
6947
|
-
if(state && (
|
|
6970
|
+
if(state && inWords(PAGE_WORDS.reviseRunning, state.phase)) return;
|
|
6948
6971
|
var html = "";
|
|
6949
6972
|
if(state && state.phase === "green" && state.readout){
|
|
6950
6973
|
html = '<div class="msg bot" data-testid="chat-plan"><div class="who">fwdloop</div>' + readoutHtml(state) +
|
|
6951
|
-
'\n\nPlan hash: ' + escapeXml(state.hash || "") +
|
|
6974
|
+
'\n\nPlan hash: ' + escapeXml(state.hash || "") +
|
|
6975
|
+
(typeof state.draftedLine === "string" && state.draftedLine ? '\n<span class="drafted-line" data-testid="drafted-line">' + escapeXml(state.draftedLine) + '</span>' : "") + '</div>';
|
|
6952
6976
|
}
|
|
6953
6977
|
if(html !== threadKey){ threadKey = html; thread.innerHTML = html; }
|
|
6954
6978
|
}
|
|
@@ -6997,7 +7021,7 @@
|
|
|
6997
7021
|
}
|
|
6998
7022
|
// Your answers / Checked / Not checked; a plan being drafted again leaves them on show (like the plan), anything else without a green plan clears them
|
|
6999
7023
|
function renderExtras(state){
|
|
7000
|
-
if(state && (
|
|
7024
|
+
if(state && inWords(PAGE_WORDS.reviseRunning, state.phase)) return;
|
|
7001
7025
|
var v = extrasFor(state);
|
|
7002
7026
|
var html = v ? v.blocks.map(function(b){
|
|
7003
7027
|
var inner = b.action ? '<div class="who">fwdloop</div>' + actionRowHtml(b.action)
|
|
@@ -7056,7 +7080,7 @@
|
|
|
7056
7080
|
var jt = state && state.card && state.card.job;
|
|
7057
7081
|
var box = document.getElementById("jf-job");
|
|
7058
7082
|
// F259: a red or stopped draft has left the boxes to the person (the card is open to fix and draft again); the poll never writes them back
|
|
7059
|
-
if(!sessionLive || reviseOpen ||
|
|
7083
|
+
if(!sessionLive || reviseOpen || inWords(PAGE_WORDS.notGreen, state.phase) || typeof jt !== "string" || jt === box.value) return;
|
|
7060
7084
|
setVal("jf-job", jt); fitCardBoxes();
|
|
7061
7085
|
}
|
|
7062
7086
|
// M19 am14b: the ONE writer of a draft refusal's lines. The box error is painted once per refusal (so a poll never brings back a line the person cleared by pressing Draft).
|
|
@@ -7089,8 +7113,8 @@
|
|
|
7089
7113
|
// its words under the button. No grey copy: the grey card line carries every other sentence (a red plan from the AI keeps its own).
|
|
7090
7114
|
var refusal = (state.phase === "stopped" && state.refusal && typeof state.refusal === "object") ? state.refusal : null;
|
|
7091
7115
|
paintRefusal(state, refusal);
|
|
7092
|
-
errEl.textContent = (!refusal && (
|
|
7093
|
-
var progressChanged = renderProgress(stepsFor(state, {model: drafterModel, starting: startId !== null, signClicked: signClickedOnce}));
|
|
7116
|
+
errEl.textContent = (!refusal && inWords(PAGE_WORDS.notGreen, state.phase) && state.say) ? state.say : "";
|
|
7117
|
+
var progressChanged = renderProgress(stepsFor(state, {model: drafterModel, starting: startId !== null, signClicked: signClickedOnce}), state && state.draftSoFar);
|
|
7094
7118
|
sessionLive = CLIENT_TERMINAL_PHASES.indexOf(state.phase) === -1;
|
|
7095
7119
|
refreshStartEnabled();
|
|
7096
7120
|
syncJobBoxFromSession(state);
|
package/src/panel/jobgrid.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { GROUP_OF, TICKET_GROUPS } from './tickets.js';
|
|
9
9
|
import { EVERY_STEP } from '../try-checks.js';
|
|
10
10
|
import { compareNatural } from '../natural.js';
|
|
11
|
+
import { newestChecksOf } from '../diary.js';
|
|
11
12
|
|
|
12
13
|
/** the buckets, in the mock's order (the same four as the M12 ticket list: one list of words) */
|
|
13
14
|
export const GRID_BUCKETS = TICKET_GROUPS;
|
|
@@ -45,13 +46,8 @@ export function sumMoney(moneys) {
|
|
|
45
46
|
* @param {any[]} diary @returns {Array<{step: string, checks: Array<{n: number, text: string, ok: boolean, result: string|null, source: string|null}>}>}
|
|
46
47
|
*/
|
|
47
48
|
function newestTries(diary) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
if (!r || typeof r.step !== 'string' || !Number.isInteger(r.try) || !Array.isArray(r.checks)) continue;
|
|
51
|
-
const prev = by.get(r.step);
|
|
52
|
-
if (!prev || r.try >= prev.try) by.set(r.step, r);
|
|
53
|
-
}
|
|
54
|
-
return [...by.values()].map((r) => ({
|
|
49
|
+
const steps = [...new Set((diary ?? []).filter((r) => r && typeof r.step === 'string' && Number.isInteger(r.try) && Array.isArray(r.checks)).map((r) => r.step))];
|
|
50
|
+
return steps.map((step) => /** @type {any} */ (newestChecksOf(diary, step))).map((r) => ({
|
|
55
51
|
step: r.step,
|
|
56
52
|
checks: r.checks.filter((c) => c && typeof c.text === 'string' && typeof c.ok === 'boolean')
|
|
57
53
|
.map((c) => ({ n: c.n, text: c.text, ok: c.ok, result: typeof c.result === 'string' ? c.result : null, source: typeof c.source === 'string' ? c.source : null })),
|