@popcorn245/cornfield 0.55.0 → 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/core/contrast.js +12 -1
- package/core/schema.js +6 -0
- package/core/strings.js +0 -1
- package/explorer/css/page.css +0 -8
- package/explorer/css/work.css +3 -26
- package/explorer/deep-link.js +11 -24
- package/explorer/engine/map-style.js +4 -1
- package/explorer/forge-panel-model.js +2 -36
- package/explorer/forge-panel.js +3 -8
- package/explorer/index.html +1 -10
- package/explorer/instance-state.js +0 -6
- package/explorer/instance.js +9 -5
- package/explorer/page.js +5 -4
- package/explorer/pieces/node-panel.js +9 -5
- package/explorer/pieces/work-agent.js +3 -2
- package/explorer/pieces/work-common.js +14 -15
- package/explorer/pieces/work-confirm.js +11 -10
- package/explorer/pieces/work-data.js +24 -31
- package/explorer/pieces/work-deploys.js +42 -41
- package/explorer/pieces/work-issues.js +32 -29
- package/explorer/pieces/work-list.js +406 -0
- package/explorer/pieces/work-markup.js +9 -14
- package/explorer/pieces/work-notes.js +0 -1
- package/explorer/pieces/work-paint.js +57 -62
- package/explorer/pieces/work-prs.js +25 -66
- package/explorer/pieces/work-runs.js +47 -57
- package/explorer/pieces/work-specs.js +19 -2
- package/explorer/pieces/work-threads.js +28 -48
- package/explorer/pieces/work.js +28 -40
- package/explorer/proposal-model.js +5 -5
- package/explorer/runs-view.js +10 -18
- package/explorer/scene.js +1 -3
- package/explorer/tokens.css +4 -0
- package/explorer/waiting-view.js +3 -3
- package/explorer/work-model.js +79 -38
- package/explorer/work-view.css +3 -4
- package/explorer/work-view.js +77 -49
- package/package.json +1 -1
- package/explorer/pieces/work-events.js +0 -285
package/core/contrast.js
CHANGED
|
@@ -24,7 +24,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
24
24
|
import { MAX_MIX_DEPTH, readColor, over, toHex, luminance, ratio, splitTop } from './color.js';
|
|
25
25
|
import { MAX_THEME_BYTES, cssProblems, withoutComments } from './theme.js';
|
|
26
26
|
import { MIN_SHAPE_DELTA_E, NODE_SHAPES, NODE_THEMES } from './schema.js';
|
|
27
|
-
import { WORK_KINDS, WORK_THEMES } from './schema.js';
|
|
27
|
+
import { WORK_KINDS, WORK_THEMES, WORK_EDGES, WORK_EDGE_THEMES } from './schema.js';
|
|
28
28
|
import { deltaE2000 } from './delta-e.js';
|
|
29
29
|
import { LAYER_KEY_RE, MAX_KEY, mapFillNames, parseKindToken } from './layers.js';
|
|
30
30
|
import { DIFF_MARK_COLORS, DIFF_LABEL_ALPHA, GREY_ALPHA, GREY_LABEL_ALPHA, GREY_MIN_RATIO, markOpacity } from '../explorer/diff-marks.js';
|
|
@@ -573,6 +573,17 @@ function mapFindings(props, theme, mode, grounds, extra = []) {
|
|
|
573
573
|
const weakest = onGround.ratio <= onFill ? { r: onGround.ratio, on: '--corn-ground', value: onGround.bgValue } : { r: onFill, on: name, value: toHex(over(fill, ground)) };
|
|
574
574
|
out.push({ ...base, fg: '--corn-map-stroke', bg: weakest.on, min: MAP_FILL_MIN, kind: 'ui', use: `the outline that carries ${use}, which is ${fmt(f.ratio)} on its own`, fgValue: onGround.fgValue, bgValue: weakest.value, ratio: weakest.r });
|
|
575
575
|
}
|
|
576
|
+
// The lines of the Work view (spec 0012 D3): each is drawn at full strength where it joins the selection, and read at 3:1 against the ground, as a map's line is
|
|
577
|
+
for (const edge of WORK_EDGES) {
|
|
578
|
+
const name = `--corn-work-edge-${edge}`;
|
|
579
|
+
const t = mapToken(props, name);
|
|
580
|
+
const use = `the ${edge === 'work' ? 'line between two pieces of work' : edge === 'code' ? 'line from a piece of work to the code it touches' : 'dashed line to the code a proposal adds'} in the Work view, where it joins the selection`;
|
|
581
|
+
if (t.problem) { out.push({ ...base, fg: name, bg: GROUND, min: MIN_UI, kind: 'ui', use, problem: t.problem }); continue; }
|
|
582
|
+
const own = !t.color;
|
|
583
|
+
const line = own ? readColor(mode === 'light' ? lightColor(WORK_EDGE_THEMES[edge]) : WORK_EDGE_THEMES[edge]) : t.color;
|
|
584
|
+
const f = worstOnGrounds(line, grounds);
|
|
585
|
+
out.push({ ...base, fg: own ? `${name}, auto: the line's own colour` : name, bg: GROUND, min: MIN_UI, kind: 'ui', use, fgValue: f.fgValue, bgValue: f.bgValue, ratio: f.ratio, ...(f.image ? { groundImage: true } : {}) });
|
|
586
|
+
}
|
|
576
587
|
// The ink of a glyph and of a finer kind's letters (spec 0008 D8), when the theme sets one: against every fill it can sit on (`auto` picks white or dark per fill, which a test holds)
|
|
577
588
|
const glyph = mapToken(props, '--corn-map-glyph');
|
|
578
589
|
if (glyph.problem) out.push({ ...base, fg: '--corn-map-glyph', bg: GROUND, min: MAP_FILL_MIN, kind: 'ui', use: 'the ink of a node\'s glyph', problem: glyph.problem });
|
package/core/schema.js
CHANGED
|
@@ -63,6 +63,12 @@ export const WORK_THEMES = Object.freeze({
|
|
|
63
63
|
pull: Object.freeze({ color: '#60a5fa', shape: 'rounded-square', letters: 'PR', r: 20 }),
|
|
64
64
|
deploy: Object.freeze({ color: '#4ade80', shape: 'square', letters: 'D', r: 20 }),
|
|
65
65
|
});
|
|
66
|
+
/**
|
|
67
|
+
* The three colours of the Work view's lines (spec 0012 D3): a link from one piece of work to another, a link to the code it touches, and what a proposal adds (dashed).
|
|
68
|
+
* A theme sets each with `--corn-work-edge-<name>` (explorer/tokens.css, docs/theming.md); these are what `auto` draws, written for the dark ground (the light one deepens them as it does every line).
|
|
69
|
+
*/
|
|
70
|
+
export const WORK_EDGES = Object.freeze(['work', 'code', 'adds']);
|
|
71
|
+
export const WORK_EDGE_THEMES = Object.freeze({ work: '#818cf8', code: '#cbd5e1', adds: '#2dd4bf' });
|
|
66
72
|
/** The node type a kind of work has in the Work view (`work-pull`): never in topology.json */
|
|
67
73
|
export const workType = (kind) => `work-${kind}`;
|
|
68
74
|
|
package/core/strings.js
CHANGED
package/explorer/css/page.css
CHANGED
|
@@ -47,14 +47,6 @@ body {
|
|
|
47
47
|
/* The panel's width is the stage's `--hx-forge-w`, so what makes room for it reads the same number (the Runs view's compare widens it, below) */
|
|
48
48
|
.hx-stage { --hx-forge-w: min(400px, calc(100% - 24px)); }
|
|
49
49
|
}
|
|
50
|
-
@media (min-width: 1100px) {
|
|
51
|
-
.hx-stage:has(.hx-forge .hx-run-compare) { --hx-forge-w: min(780px, calc(100% - 24px)); }
|
|
52
|
-
}
|
|
53
|
-
@media (min-width: 1100px) and (max-width: 1599px) {
|
|
54
|
-
/* With the node panel open as well, a 780px compare only fits beside it from 1600px: below that the panel keeps its width and the
|
|
55
|
-
profiles stack, so neither panel nor the proposal bar between them is covered */
|
|
56
|
-
.hx-stage:has(.hx-forge .hx-run-compare):has(.drawer-open) { --hx-forge-w: min(400px, calc(100% - 24px)); }
|
|
57
|
-
}
|
|
58
50
|
/* The scenario player is one bar under the map (spec 0006 D6). From 768px it sits at the foot of the map area, to the right of the review column;
|
|
59
51
|
the stage tells it how wide the column is */
|
|
60
52
|
@media (min-width: 768px) {
|
package/explorer/css/work.css
CHANGED
|
@@ -6,18 +6,9 @@
|
|
|
6
6
|
* No rule here asks what the document says (`:root`, `html`, `body`, `[data-theme]`), sizes from the window (`vw`, `vh`) or is `position: fixed` unless it says why;
|
|
7
7
|
* a width rule is a container query on `corn-box` (page.css), a height rule on `corn-page`. base.css loads first.
|
|
8
8
|
*/
|
|
9
|
-
/*
|
|
10
|
-
.hx-work { display: inline-flex; align-items: center; gap: var(--corn-space-2); height: var(--hx-control-h); padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 600; white-space: nowrap; }
|
|
11
|
-
.hx-work:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
12
|
-
.hx-work[aria-expanded="true"] { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); }
|
|
13
|
-
.hx-forge-lit { padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-warn); background: var(--corn-ground); color: var(--corn-warn); font-size: var(--corn-text-2xs); }
|
|
14
|
-
@container corn-box (max-width: 767px) {
|
|
15
|
-
.hx-work { height: var(--hx-control-h); min-width: var(--hx-control-h); justify-content: center; padding: 0 var(--corn-space-3); }
|
|
16
|
-
.hx-forge-lit { display: none; }
|
|
17
|
-
}
|
|
18
|
-
/* ---- the issues and PRs panel (forge-panel.js, CF-07) -------------------------------------------
|
|
9
|
+
/* ---- the Work list (pieces/work-list.js; spec 0012 D6; first CF-07's issues and PRs panel) -------------------------------------------
|
|
19
10
|
A slide-over from the left from 768px (the node panel is the one from the right), a bottom sheet in #sheet-dock below.
|
|
20
|
-
Closed, it is inert
|
|
11
|
+
Closed, it is inert, and off screen or not displayed. Only the tokens above are used, so it follows the theme. */
|
|
21
12
|
.hx-forge { --hx-forge-status-w: 56px; }
|
|
22
13
|
.hx-forge { display: flex; flex-direction: column; z-index: 40; border-color: var(--corn-line); pointer-events: none; touch-action: pan-y; transition: transform 0.2s ease-out; }
|
|
23
14
|
.hx-forge * { touch-action: pan-y; }
|
|
@@ -93,7 +84,6 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
93
84
|
.hx-forge-check { display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--corn-space-1) / 2) var(--corn-space-2); }
|
|
94
85
|
.hx-forge-check .hx-link { display: inline-flex; align-items: center; min-height: 24px; }
|
|
95
86
|
.hx-forge-lights { flex-basis: 100%; font-size: var(--corn-text-xs); line-height: 1.5; }
|
|
96
|
-
.hx-forge-key { display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--corn-space-1) / 2) var(--corn-space-1); font-size: var(--corn-text-xs); }
|
|
97
87
|
.hx-forge-file { display: flex; flex-wrap: wrap; align-items: baseline; gap: calc(var(--corn-space-1) / 2) var(--corn-space-2); padding: var(--corn-space-1) 0; border-top: var(--corn-border) solid var(--corn-line-soft); overflow-wrap: anywhere; }
|
|
98
88
|
.hx-forge-fstatus { flex: none; min-width: var(--hx-forge-status-w); color: var(--corn-text-3); font-size: var(--corn-text-xs); }
|
|
99
89
|
.hx-forge-del { color: var(--corn-bad); }
|
|
@@ -137,7 +127,6 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
137
127
|
/* A selection replaces the list, with a back control named by the list; Land it is the one primary action */
|
|
138
128
|
.hx-forge-back { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--corn-space-2); min-height: 28px; margin-left: calc(var(--corn-space-2) * -1); padding: 0 var(--corn-space-3) 0 var(--corn-space-2); border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-2); font-size: var(--corn-text-xs); }
|
|
139
129
|
.hx-forge-back:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
140
|
-
.hx-forge-dmeta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-1) var(--corn-space-3); }
|
|
141
130
|
.hx-forge-cta { display: flex; flex-wrap: wrap; gap: var(--corn-space-3); }
|
|
142
131
|
.hx-forge-cta .hx-btn { min-height: 32px; justify-content: center; }
|
|
143
132
|
.hx-forge-cta .hx-btn[disabled] { background: var(--corn-surface-3); border-color: var(--corn-line); color: var(--corn-text-3); box-shadow: none; cursor: default; }
|
|
@@ -176,20 +165,11 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
176
165
|
.hx-run-timeline li { color: var(--corn-text-2); }
|
|
177
166
|
.hx-run-timeline time { color: var(--corn-text-2); margin-right: var(--corn-space-2); }
|
|
178
167
|
.hx-run-note { display: block; color: var(--corn-text-2); white-space: pre-wrap; }
|
|
179
|
-
.hx-run-compare { border: var(--corn-border) solid var(--corn-line); border-left: calc(var(--corn-border-strong) * 2) solid var(--corn-added-text); border-radius: var(--corn-radius); padding: var(--corn-space-3); display: flex; flex-direction: column; gap: var(--corn-space-2); }
|
|
180
|
-
.hx-run-compare-title { margin: 0; font-size: var(--corn-text-sm); font-weight: 700; color: var(--corn-text); }
|
|
181
|
-
.hx-run-columns { display: grid; grid-template-columns: 1fr; gap: var(--corn-space-3); margin: 0; padding: 0; list-style: none; }
|
|
182
|
-
@container corn-box (min-width: 1100px) {
|
|
183
|
-
.hx-run-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
184
|
-
}
|
|
185
|
-
@container corn-box (min-width: 1100px) and (max-width: 1599px) {
|
|
186
|
-
.hx-stage:has(.drawer-open) .hx-run-columns { grid-template-columns: 1fr; }
|
|
187
|
-
}
|
|
188
168
|
/* A scroll container never cuts a focus ring: a row that is tabbed to stops short of the edge by the ring's width and offset */
|
|
189
169
|
.hx-forge-body { scroll-padding-block: calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1)); }
|
|
190
170
|
/* The Work tabs scroll sideways: a tab brought into view stops short of the edge by the strip's own padding */
|
|
191
171
|
.hx-forge-tabs { scroll-padding-inline: var(--corn-space-4); }
|
|
192
|
-
.hx-forge-count, .hx-
|
|
172
|
+
.hx-forge-count, .hx-run-limits dd { font-family: var(--corn-font-num); font-variant-numeric: tabular-nums; }
|
|
193
173
|
@media (prefers-reduced-motion: reduce) {
|
|
194
174
|
.hx-forge { transition: none; animation: none; }
|
|
195
175
|
}
|
|
@@ -256,7 +236,6 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
256
236
|
right padding, by a margin that gives the room back (content-box, so the padding is added to the count's 2ch and the margin takes exactly that away
|
|
257
237
|
again), and keeps the tab's gap from its word on the left */
|
|
258
238
|
.hx-forge-tab .hx-forge-count.hx-forge-count--waiting, .hx-forge-tab[aria-pressed="true"] .hx-forge-count.hx-forge-count--waiting { box-sizing: content-box; padding: 0 var(--corn-space-1); margin: 0 calc(var(--corn-space-1) * -2) 0 0; text-align: center; background: var(--corn-run-waiting); color: var(--corn-run-waiting-ink); }
|
|
259
|
-
.hx-work .hx-waiting-badge { margin-right: calc(var(--corn-space-2) * -1); }
|
|
260
239
|
/* A group of the Specs list: its header says who must act and how many; Drafts past ten rows fold behind it */
|
|
261
240
|
.hx-spec-group > .hx-forge-list { margin: 0; padding: 0; }
|
|
262
241
|
.hx-spec-group > .hx-forge-list[hidden] { display: none; }
|
|
@@ -278,8 +257,6 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
278
257
|
.hx-forge-gtoggle { min-height: 44px; }
|
|
279
258
|
.hx-forge-unread .hx-btn { min-height: 44px; }
|
|
280
259
|
}
|
|
281
|
-
.hx-runner-dot { display: inline-block; width: 8px; height: 8px; margin-left: var(--corn-space-1); border-radius: 50%; background: var(--corn-warn); vertical-align: middle; }
|
|
282
|
-
.hx-runner-dot[hidden] { display: none; }
|
|
283
260
|
.hx-forge-detail-title, .hx-forge-notes-title { font-size: var(--corn-text-lg); font-weight: 700; line-height: 1.25; letter-spacing: normal; }
|
|
284
261
|
/* The head of a panel: its title row. The Work panel and the node panel start at one edge (the padding is --corn-panel-pad) and the head is at least this tall */
|
|
285
262
|
.hx-forge-head { min-height: var(--corn-panel-head-height); }
|
package/explorer/deep-link.js
CHANGED
|
@@ -1,44 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module explorer/deep-link
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The link from chat that starts an agent on a proposal (issue #103, docs/agents.md "Deep links"):
|
|
5
5
|
*
|
|
6
|
-
* ?run=<runId> the Runs tab, that run lit and in view
|
|
7
|
-
* ?issue=<n> the Issues tab, that issue's Start an agent button focused
|
|
8
6
|
* ?proposal=<slug>&start=1 the proposal opened (proposal.js) and the Start dialog on it
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* (`?run=`, `?issue=`, `?pr=`, `?thread=` and `?spec=` are the Work view's: work-view.js `followWorkAddress`, spec 0012 D8.)
|
|
9
|
+
* On a phone the proposal bar it opens is expanded. A name that is not there is a line in the bar and said through the live
|
|
10
|
+
* region, never a blank. A link that is followed has its `start` taken out of the address at once, so a reload does not open
|
|
11
|
+
* it again; `?proposal=` stays, as it always has (it follows the open proposal).
|
|
13
12
|
* Without a live sign-in the server asks for it first and returns here with the same query (server/auth.js).
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
import { announce } from './keyboard.js';
|
|
17
16
|
import { isPhone, expandSheet } from './sheets.js';
|
|
18
17
|
import { parseProposalQuery } from './proposal-model.js';
|
|
19
|
-
import {
|
|
18
|
+
import { openProposalStart } from './forge-panel.js';
|
|
20
19
|
|
|
21
|
-
const RUN_ID = /^run-[0-9A-Za-z]{26}$/;
|
|
22
|
-
const ISSUE = /^[1-9][0-9]{0,8}$/;
|
|
23
20
|
/** The parameters a followed link gives up */
|
|
24
|
-
const SPENT = ['
|
|
21
|
+
const SPENT = ['start'];
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
|
-
* What a query asks for, or null
|
|
28
|
-
* cannot be a name is `{ kind, bad: words }`.
|
|
24
|
+
* What a query asks for, or null: `?proposal=<slug>&start=1`. A value that cannot be a name is `{ kind, bad: words }`.
|
|
29
25
|
* @param {string} search
|
|
30
|
-
* @returns {{ kind: '
|
|
26
|
+
* @returns {{ kind: 'proposal', slug: string } | { kind: string, bad: string } | null}
|
|
31
27
|
*/
|
|
32
28
|
export function parseDeepLink(search) {
|
|
33
29
|
const params = new URLSearchParams(search || '');
|
|
34
|
-
if (params.has('run')) {
|
|
35
|
-
const id = params.get('run');
|
|
36
|
-
return RUN_ID.test(id) ? { kind: 'run', id } : { kind: 'run', bad: `${id ? `"${id.slice(0, 40)}"` : 'That'} is not a run id.` };
|
|
37
|
-
}
|
|
38
|
-
if (params.has('issue')) {
|
|
39
|
-
const n = params.get('issue');
|
|
40
|
-
return ISSUE.test(n) ? { kind: 'issue', n: Number(n) } : { kind: 'issue', bad: `${n ? `"${n.slice(0, 40)}"` : 'That'} is not an issue number.` };
|
|
41
|
-
}
|
|
42
30
|
if (params.get('start') === '1' && params.has('proposal')) {
|
|
43
31
|
const asked = parseProposalQuery(search);
|
|
44
32
|
return asked ? { kind: 'proposal', slug: asked.slug } : { kind: 'proposal', bad: 'That is not a proposal name.' };
|
|
@@ -62,7 +50,7 @@ export function cleanAddress() {
|
|
|
62
50
|
const unavailable = (words) => { announce(words); return false; };
|
|
63
51
|
|
|
64
52
|
/**
|
|
65
|
-
* Follows the link in the address, once. Call it after the
|
|
53
|
+
* Follows the link in the address, once. Call it after the Work piece and the proposals are set up.
|
|
66
54
|
* @param {{ search?: string, proposalOpened?: boolean, forgeOn?: boolean }} [opts]
|
|
67
55
|
* `proposalOpened`: what `initProposals()` answered; `forgeOn`: whether `initForgePanel()` found a forge in the config
|
|
68
56
|
* @returns {Promise<boolean>} whether the link was followed to what it names
|
|
@@ -82,6 +70,5 @@ export async function followDeepLink({ search = typeof location === 'undefined'
|
|
|
82
70
|
if (isPhone()) expandSheet('proposal');
|
|
83
71
|
return openProposalStart(link.slug);
|
|
84
72
|
}
|
|
85
|
-
|
|
86
|
-
return link.kind === 'run' ? openRunLink(link.id) : openIssueLink(link.n);
|
|
73
|
+
return false;
|
|
87
74
|
}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
import { NODE_THEMES } from '../../core/schema.js';
|
|
39
|
-
import { WORK_KINDS } from '../../core/schema.js';
|
|
39
|
+
import { WORK_KINDS, WORK_EDGES } from '../../core/schema.js';
|
|
40
40
|
import { parseColor } from '../theme-model.js';
|
|
41
41
|
import { cssColor, rgbaText } from '../css-color.js';
|
|
42
42
|
export { cssColor };
|
|
@@ -88,6 +88,8 @@ export const ICON_URL_PREFIX = '/cornfield/theme/assets/';
|
|
|
88
88
|
export const nodeToken = (kind) => `--corn-map-node-${kind}`;
|
|
89
89
|
/** The fill token of a kind of work in the Work view (spec 0012 D2) */
|
|
90
90
|
export const workToken = (kind) => `--corn-work-${kind}`;
|
|
91
|
+
/** The colour token of a line of the Work view (`work`, `code`, `adds`) */
|
|
92
|
+
export const workEdgeToken = (name) => `--corn-work-edge-${name}`;
|
|
91
93
|
export const groupToken = (group) => `--corn-map-group-${group}`;
|
|
92
94
|
/** The fill token of a finer kind: `--corn-map-kind-service-timer`, or null for a kind that cannot be a part of a name (core/layers.js) */
|
|
93
95
|
export const kindToken = (type, kind) => mapKindToken(type, kind);
|
|
@@ -99,6 +101,7 @@ export const MAP_COLOR_TOKENS = Object.freeze([
|
|
|
99
101
|
...MAP_KINDS.map(nodeToken),
|
|
100
102
|
...MAP_GROUPS.map(groupToken),
|
|
101
103
|
...WORK_KINDS.map(workToken),
|
|
104
|
+
...WORK_EDGES.map(workEdgeToken),
|
|
102
105
|
STROKE_TOKEN,
|
|
103
106
|
LABEL_TOKEN,
|
|
104
107
|
LABEL_HALO_TOKEN,
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* nodesForFile the node(s) whose `file` holds a path: the deepest `file` that is the path or a folder of it
|
|
13
13
|
* testFilesOf the test files a check's name names
|
|
14
14
|
* litFor for one pull request: which nodes its files are, and which a failing check's tests are
|
|
15
|
-
* paintForge lights those in a built scene (scene.js calls it): the rest fades back
|
|
16
15
|
* nodesForRestarts, litForDeploy for one deploy (PIPE-03): the nodes the config says it restarted (a stack brings its containers),
|
|
17
16
|
* and the refs that are on no node; the deploys list's filters and words (matchesDeploy, deployWords, deployMeta)
|
|
18
17
|
* errorWords a failed request, in words
|
|
@@ -43,11 +42,6 @@ export const STATES = Object.freeze({
|
|
|
43
42
|
});
|
|
44
43
|
/** How many a list asks for (the server's own default; its most is 300) */
|
|
45
44
|
export const LIST_LIMIT = 100;
|
|
46
|
-
/** How bright what the selected pull request does not touch is, once some nodes are lit */
|
|
47
|
-
export const FORGE_DIM_ALPHA = 0.2;
|
|
48
|
-
/** A node a failing check's test is: red (the light theme deepens it like any node colour) */
|
|
49
|
-
export const FORGE_FAIL_COLOR = '#f87171';
|
|
50
|
-
|
|
51
45
|
export const defaultFilters = (kind = 'pulls') => ({ state: kind === 'deploys' ? 'all' : 'open', label: '', author: '', text: '' });
|
|
52
46
|
|
|
53
47
|
/** What the server is asked for: a merged pull request is a closed one, filtered after */
|
|
@@ -354,34 +348,6 @@ export function ideaWords(forgeName, res) {
|
|
|
354
348
|
// The picture
|
|
355
349
|
// ---------------------------------------------------------------------------
|
|
356
350
|
|
|
357
|
-
/**
|
|
358
|
-
* Lights a pull request's (or a deploy's) nodes in a built scene: the nodes its files are get the amber glow of a search match, the
|
|
359
|
-
* tests of a failing check turn red as well, and everything else fades back (nodes and the lines between them), so
|
|
360
|
-
* the lit ones stand out whatever the selection or a proposal did before. Changes alpha, glow, halo, colour and label
|
|
361
|
-
* only. Nothing lit (a pull request whose files are on no node) leaves the scene as it is.
|
|
362
|
-
* @param {import('./scene.js').Scene} scene
|
|
363
|
-
* @param {{ changed: Set<string>, failing: Set<string> } | null} lit
|
|
364
|
-
*/
|
|
365
|
-
export function paintForge(scene, lit) {
|
|
366
|
-
if (!lit || (!lit.changed.size && !lit.failing.size)) return;
|
|
367
|
-
const on = (id) => lit.changed.has(id) || lit.failing.has(id);
|
|
368
|
-
for (const n of scene.nodes) {
|
|
369
|
-
if (on(n.id)) {
|
|
370
|
-
n.alpha = 1;
|
|
371
|
-
n.labelAlpha = 1;
|
|
372
|
-
n.glow = Math.max(n.glow, 14);
|
|
373
|
-
n.labelKeep = true;
|
|
374
|
-
if (n.halo !== 'selected') n.halo = 'match';
|
|
375
|
-
if (lit.failing.has(n.id)) n.color = FORGE_FAIL_COLOR;
|
|
376
|
-
} else {
|
|
377
|
-
n.alpha = Math.min(n.alpha, FORGE_DIM_ALPHA);
|
|
378
|
-
n.labelAlpha = n.alpha;
|
|
379
|
-
n.glow = 0;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
for (const e of scene.edges) if (!on(e.from) && !on(e.to)) e.alpha = Math.min(e.alpha, FORGE_DIM_ALPHA / 2);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
351
|
// ---------------------------------------------------------------------------
|
|
386
352
|
// Actions: land a green pull request, re-run a failed check (the server decides again, see server/forge-actions.js)
|
|
387
353
|
// ---------------------------------------------------------------------------
|
|
@@ -423,7 +389,7 @@ export function mergeBlock(detail) {
|
|
|
423
389
|
export function approvalWarning(detail) {
|
|
424
390
|
if (!detail || detail.pull.state !== 'open') return '';
|
|
425
391
|
const open = (detail.specs || []).filter((s) => !s.approved).map((s) => s.slug);
|
|
426
|
-
return open.length ? `Its proposal${open.length > 1 ? 's' : ''} ${open.join(', ')} ${open.length > 1 ? 'are' : 'is'} not approved yet. Next: approve ${open.length > 1 ? 'them' : 'it'} first (
|
|
392
|
+
return open.length ? `Its proposal${open.length > 1 ? 's' : ''} ${open.join(', ')} ${open.length > 1 ? 'are' : 'is'} not approved yet. Next: approve ${open.length > 1 ? 'them' : 'it'} first (Review in the node panel, then Approve), then land this.` : '';
|
|
427
393
|
}
|
|
428
394
|
|
|
429
395
|
/**
|
|
@@ -515,7 +481,7 @@ export function errorWords(status, body, { offline = false, what = '' } = {}) {
|
|
|
515
481
|
/** What a list says when it has nothing in it: what would appear here and how to make one (the `kind` is the tab) */
|
|
516
482
|
export function emptyWords(kind, forgeName = 'the forge') {
|
|
517
483
|
return {
|
|
518
|
-
specs: 'No proposals yet. A proposal is a change to the map written down before it is built. Start one from an issue (
|
|
484
|
+
specs: 'No proposals yet. A proposal is a change to the map written down before it is built. Start one from an issue (select it, then Start a spec in the node panel), or push one as a file to the proposals folder.',
|
|
519
485
|
pulls: `No open pull requests. Agents open one when a run makes code, and you can open one on ${forgeName}.`,
|
|
520
486
|
issues: `No open issues. Open one on ${forgeName}, or write a New idea in Threads.`,
|
|
521
487
|
threads: 'No threads. A thread is an idea or a spec conversation; start one with New idea below.',
|
package/explorer/forge-panel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module explorer/forge-panel
|
|
3
3
|
*
|
|
4
|
-
* A bridge (spec 0011 D2 and D3, step 6): the Work
|
|
4
|
+
* A bridge (spec 0011 D2 and D3, step 6): the Work list and the actions of a piece of work are the Work piece on the instance (pieces/work.js, with a part per tab in pieces/work-*.js) and its
|
|
5
5
|
* pure half is forge-panel-model.js. This file keeps the old names for the page (page.js, deep-link.js, panels.js) and for the tests that drive the
|
|
6
6
|
* panel through cornfield's own page, bound to the page's instance and to the piece the page mounts at the places in index.html. It goes when
|
|
7
7
|
* those callers are on the instance (the `corn-work` shell for a host, and a page shell that mounts the piece itself).
|
|
@@ -45,12 +45,7 @@ export const openForge = (opts) => { const p = piece(); if (p) p.openForge(opts)
|
|
|
45
45
|
export const closeForge = (opts) => { const p = piece(); if (p) p.closeForge(opts); };
|
|
46
46
|
export const toggleForge = () => { const p = piece(); if (p) p.toggleForge(); };
|
|
47
47
|
export const refreshForge = (opts) => { const p = piece(); return p ? p.refreshForge(opts) : Promise.resolve(); };
|
|
48
|
-
export const clearPull = () => { const p = piece(); if (p) p.clearPull(); };
|
|
49
|
-
export const clearDeploy = () => { const p = piece(); if (p) p.clearDeploy(); };
|
|
50
|
-
export const clearThread = () => { const p = piece(); if (p) p.clearThread(); };
|
|
51
|
-
export const selectDeploy = (id) => { const p = piece(); if (p) p.selectDeploy(id); };
|
|
52
|
-
export const openRunLink = (id) => { const p = piece(); return p && p.isOn() ? p.openRunLink(id) : Promise.resolve(false); };
|
|
53
|
-
export const openIssueLink = (n) => { const p = piece(); return p && p.isOn() ? p.openIssueLink(n) : Promise.resolve(false); };
|
|
54
48
|
export const openProposalStart = (slug, opener) => { const p = piece(); return p && p.isOn() ? p.openProposalStart(slug, opener) : Promise.resolve(false); };
|
|
55
|
-
|
|
49
|
+
/** A piece of work by what a row of the list names (the Work view's way to show one the graph does not draw) */
|
|
50
|
+
export const showWorkRef = (kind, key) => { const p = piece(); return p && p.isOn() ? p.showRef(kind, key) : Promise.resolve(false); };
|
|
56
51
|
export const canStartAgent = () => { const p = piece(); return !!p && p.canStartAgent(); };
|
package/explorer/index.html
CHANGED
|
@@ -131,15 +131,6 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
<!--corn-piece:search/field-->
|
|
133
133
|
|
|
134
|
-
<!-- The Work toggle (explorer/pieces/work.js): opens the Work panel; shown only when the config names a forge. It is a piece: page.js mounts it here, and until then this stand-in keeps its place (the piece's markup without ids) -->
|
|
135
|
-
<!--corn-placeholder:work/button-->
|
|
136
|
-
<button type="button" class="hx-work" data-action="toggle-forge" aria-expanded="false" aria-label="Work panel" data-corn-string-aria-label="workPanel" title="Issues, pull requests and deploys: a pull request lights the nodes it changes, a deploy the nodes it restarted" hidden data-corn="forge-button" part="forge-button">
|
|
137
|
-
<span data-corn-string="workPanel">Work panel</span>
|
|
138
|
-
<span class="hx-forge-lit" data-corn="count" part="count" hidden></span>
|
|
139
|
-
<span class="hx-runner-dot" aria-hidden="true" title="No runner online" hidden></span>
|
|
140
|
-
</button>
|
|
141
|
-
<!--corn-piece:work/button-->
|
|
142
|
-
|
|
143
134
|
<!-- The one account menu (explorer/account-menu.js): who, Theme, Freeform layout, Review tokens, Proposals, the links, Sign out, and what powers it -->
|
|
144
135
|
<div class="hx-menu-wrap hx-account">
|
|
145
136
|
<button type="button" id="account-btn" class="hx-account-btn" aria-expanded="false" aria-controls="account-menu" aria-label="Account menu" data-corn="account-button">
|
|
@@ -200,7 +191,7 @@
|
|
|
200
191
|
<!-- The review column (explorer/pieces/changes.js, spec 0006): what the proposal changes, and the personas and the scenarios that apply to them. Docked left of the map from 768px, the expanded proposal sheet's body on a phone. The decision (explorer/pieces/decision.js, spec 0007) is its foot: the column keeps its place -->
|
|
201
192
|
<!--corn-piece:changes/column-->
|
|
202
193
|
|
|
203
|
-
<!-- The Work
|
|
194
|
+
<!-- The Work list (explorer/pieces/work-list.js, part of the Work piece): Specs, PRs, Issues, Threads, Runs and Deploys, in the order of the loop. A slide-over from the left on desktop, a bottom sheet on a phone; hidden and inert until the Work view's List toggle opens it. A row selects its node; the detail is the node panel's. The Work piece mounts it here -->
|
|
204
195
|
<p id="offline-banner" class="hx-offline" data-corn="notice" hidden></p>
|
|
205
196
|
<!--corn-piece:work/panel-->
|
|
206
197
|
|
|
@@ -144,12 +144,6 @@ export function createState() {
|
|
|
144
144
|
*/
|
|
145
145
|
scenario: null,
|
|
146
146
|
|
|
147
|
-
/**
|
|
148
|
-
* What the selected pull request lights (forge-panel.js, forge-panel-model.js `litFor`): `{ changed, failing }`, sets of
|
|
149
|
-
* node ids (the nodes its files are; the nodes of the tests a failing check names), or null with none selected.
|
|
150
|
-
*/
|
|
151
|
-
forgeLit: null,
|
|
152
|
-
|
|
153
147
|
/**
|
|
154
148
|
* The runs on the map (explorer/runs-map.js): `{ flight: Map<nodeId, runId[]>, collide: Map<nodeId, runId[]>, runs }` for the open runs'
|
|
155
149
|
* nodes, or null when there are none. The map's marks over the nodes are drawn from it.
|
package/explorer/instance.js
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* scene (none) touchScene(): what the picture is built from changed (`onSceneTouch`)
|
|
40
40
|
* layers (none) a layer went on or off, or the layers were set (engine/layers.js): live.js starts or stops the live layer, a search moves its matches
|
|
41
41
|
* search { query, current } the search's query or its current match changed (pieces/search.js)
|
|
42
|
-
* node:painted { node } the node panel was filled for this node (pieces/node-panel.js)
|
|
42
|
+
* node:painted { node } the node panel was filled for this node (pieces/node-panel.js); the Work piece draws a piece of work's actions into it, or lets go of what it held
|
|
43
43
|
* proposal { change: 'opened' | 'view' | 'closed', slug, source, pinSource, view, proposal } the open proposal changed (engine/proposal.js; the page writes the address from it)
|
|
44
44
|
* proposal:draw { open } the bar and the review column draw again; proposal:bar { open }: they have, so what sits on the bar draws again
|
|
45
45
|
* proposal:mark { applied, effective, proposal } before the map is laid out (the what-if editor marks its edits)
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
* and tells `host` to ask again when the root is free
|
|
60
60
|
* attach:released (none) the piece that had the instance's root (`attach`) gave it back
|
|
61
61
|
* work:waiting { total } what waits on the maintainer changed (specs to decide plus runs that need an answer; pieces/work.js): the page puts the number before its title
|
|
62
|
-
* work:available { on } the Work
|
|
62
|
+
* work:available { on } the Work piece started (a forge in the config and somebody signed in), or ended: the Work view's List toggle shows, and the account menu's Proposals entry is only for a cornfield without it
|
|
63
63
|
* runs:map { active } runs are on the map, or none is (pieces/work.js, runs-map.js): the Layers menu shows its legend while there are
|
|
64
64
|
* thread:open { number } a thread listed in the node panel was chosen; thread:start { node }: "Start a thread about this" (pieces/node-panel.js; the Work panel opens the thread, or its New idea form)
|
|
65
65
|
* announce text what a screen reader is told (engine/keyboard.js `announce`; the piece that owns a live region writes it: `announce:write`)
|
|
@@ -99,9 +99,13 @@
|
|
|
99
99
|
* player:seat bar -> true the dock's owner (engine/sheets.js) seats the scenario player's bar as a sheet above the node panel's
|
|
100
100
|
* threads:index nodeId -> { threads: thread[] | null, forge: string, start: true } | undefined the Work panel's list of the threads that mention a node, for the node panel's "Threads"; `threads` is null until the list was read; no answer: no Threads section
|
|
101
101
|
* threads:ensure (none) (emit) the node panel was filled: the Work panel reads the threads list once; threads:changed: it was read, or the map changed, so the node panel draws "Threads" again
|
|
102
|
-
* work:
|
|
103
|
-
* work:
|
|
104
|
-
* work:
|
|
102
|
+
* work:list { open } the Work list opened or closed (pieces/work-list.js)
|
|
103
|
+
* work:pick { kind, key } -> true (ask, answered by the Work view: explorer/work-view.js) select the node of that piece of work (`pull`, `issue`, `thread`, `run`, `deploy`, `proposal`, and its number, id or slug) on the map; no answer: the Work piece shows it in the node panel alone, as it shows work older than the graph's 14 days
|
|
104
|
+
* work:panel node -> { replace, badge, title, html } | undefined (ask, answered by the Work view) what the node panel shows for a piece of work or, in the Work view, a node of code; the html holds `forge-detail`, where the Work piece draws the actions
|
|
105
|
+
* node:back (none) -> (() => boolean) | undefined (ask, answered by the Work list) the node panel is about to close: what gives the focus back to the row of the open list that chose what it shows (true when it did); else the map has it
|
|
106
|
+
* work:on (none) -> boolean whether the Work piece has started (a piece mounted after it asks rather than waits for `work:available`)
|
|
107
|
+
* work:answer { run } (emit) "Answer" on the proposal bar's line: the run is shown in the node panel, its reply field focused
|
|
108
|
+
* work:open-specs (none) -> true the Work list opened on Specs for a bad link's way on; map:set { nodes, edges } -> true the page (or the review, or a scope's map: pieces/map.js) laid the map out from these
|
|
105
109
|
* changes:opened-line title -> string, changes:played-line -> string what the review column says of an opening, and how many scenarios were played
|
|
106
110
|
* whatif:edits -> edits[], whatif:form -> { name } | null, whatif:describe -> string[] what the decision asks of the what-if editor
|
|
107
111
|
*
|
package/explorer/page.js
CHANGED
|
@@ -19,14 +19,15 @@
|
|
|
19
19
|
* page-address.js ?proposal=, ?source= and ?proposalView= in the address bar
|
|
20
20
|
* whatif.js what-if edits on an open proposal (add, remove, draw, steps, undo); whatif-model.js its pure half
|
|
21
21
|
* review-model.js, decision-model.js the words and the choices of the decision (pure)
|
|
22
|
-
* deep-link.js ?
|
|
22
|
+
* deep-link.js ?proposal=…&start=1 lands on a proposal's Start dialog (?run=, ?issue= and the other work addresses are work-view.js's)
|
|
23
23
|
* scenario.js the player's pure core
|
|
24
24
|
* bench.js /?bench=1 stopwatch and /?fixture=5k (the generated topology, from the server)
|
|
25
25
|
* keyboard.js the map by keyboard and the screen reader's announcer; keyboard-model.js its pure half
|
|
26
26
|
* live.js the live layer: the chip, polling, laying a live source's answer over the map; live-model.js its pure half
|
|
27
27
|
* review-tokens.js review tokens for the review API, when somebody is signed in: make one (shown once), list, revoke; review-tokens-model.js its pure half
|
|
28
|
-
* pieces/work.js the Work
|
|
29
|
-
* forge-panel.js is the page's way in to it (initForgePanel
|
|
28
|
+
* pieces/work.js the Work piece (with a part per tab in pieces/work-*.js; the Work list is pieces/work-list.js), when the config names a forge: the lists a row of which selects its node,
|
|
29
|
+
* and a piece of work's actions in the node panel; forge-panel-model.js its pure half; forge-panel.js is the page's way in to it (initForgePanel)
|
|
30
|
+
* work-view.js the Work view: the map of work, its List toggle, and the addresses (?view=work, ?pr=, ?issue=, ?run=, ?thread=, ?spec=); work-model.js its pure half
|
|
30
31
|
* theme.js light or dark: the system setting and the header toggle; theme-model.js the colours (theme-boot.js before the first paint)
|
|
31
32
|
*/
|
|
32
33
|
|
|
@@ -211,7 +212,7 @@ export function startPage() {
|
|
|
211
212
|
initWorkView({ offered: !!config.forge }); // the Work view (work-view.js): offered when the config names a forge
|
|
212
213
|
mergePagePieceOptions('changes', { checker }); // scenarios ask the source's checker, when there is one (pieces/changes.js)
|
|
213
214
|
if (new URLSearchParams(window.location.search).get("view") === "dataflow") setView("dataflow");
|
|
214
|
-
// /?
|
|
215
|
+
// /?view=work, /?pr=, /?issue=, /?run=, /?thread=, /?spec= land on the Work view (work-view.js); /?proposal=…&start=1 on a proposal's Start dialog (deep-link.js)
|
|
215
216
|
(asksForWork(window.location.search) ? followWorkAddress() : followDeepLink({ proposalOpened, forgeOn })).catch((err) => console.error('Following the link failed', err));
|
|
216
217
|
// /?scenario-demo=1 plays a small scenario over real nodes, to look at the player
|
|
217
218
|
maybeStartDemo();
|
|
@@ -110,7 +110,7 @@ export const markup = () => ({
|
|
|
110
110
|
+ '<a data-corn="open-link" id="drawer-file-btn" data-corn-kind="primary" class="hx-open" href="#" target="_blank" rel="noreferrer" hidden>Open file ↗</a>'
|
|
111
111
|
+ '<a data-corn="open-link" id="drawer-open-btn" data-corn-kind="primary" class="hx-open" href="#" target="_blank" rel="noreferrer" hidden>Open route ↗</a>'
|
|
112
112
|
+ '<button data-corn-kind="secondary" type="button" id="drawer-run-btn" class="hx-btn hx-foot-btn" data-action="start-run" data-corn-string="startRun" hidden>Start a run</button>'
|
|
113
|
-
+ '<button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet hx-foot-btn" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>'
|
|
113
|
+
+ '<button data-corn-kind="quiet" type="button" id="drawer-copy-btn" class="hx-btn hx-btn--quiet hx-foot-btn" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>'
|
|
114
114
|
+ '<p id="copy-spec-result" class="hx-forge-result" data-corn="result" hidden></p>'
|
|
115
115
|
+ '</div>'
|
|
116
116
|
+ '</aside>',
|
|
@@ -437,7 +437,8 @@ export function mount(root, inst, options = {}) {
|
|
|
437
437
|
fileBtn.textContent = `${t(inst, 'openFile')} ↗`;
|
|
438
438
|
own('drawer-run-btn').hidden = !(state.proposalSlug && inst.ask('forge:can-start'));
|
|
439
439
|
// The Work view (spec 0012 D5): a piece of work is shown by the page's own answer (work-view.js); a node of code in it keeps its own sections, with the work touching it first
|
|
440
|
-
const work =
|
|
440
|
+
const work = inst.ask('work:panel', node);
|
|
441
|
+
own('drawer-copy-btn').hidden = !!(work && work.replace); // a piece of work is no spec to copy: its JSON is the forge's, not the map's
|
|
441
442
|
if (work && work.replace) {
|
|
442
443
|
title.textContent = work.title;
|
|
443
444
|
title.classList.remove('hx-mono');
|
|
@@ -537,10 +538,12 @@ export function mount(root, inst, options = {}) {
|
|
|
537
538
|
scope.listen(drawer, 'click', (e) => {
|
|
538
539
|
const target = e.target.closest && e.target.closest('[data-action]');
|
|
539
540
|
if (!target) return;
|
|
541
|
+
const shut = target.dataset.action === 'close-drawer';
|
|
542
|
+
const back = shut && inst.ask('node:back'); // the Work list's row that chose the node, asked before the panel lets go
|
|
540
543
|
const action = ACTIONS[target.dataset.action];
|
|
541
544
|
if (action) action(target);
|
|
542
|
-
// The panel's ✕: the focus would be left on a hidden button, so it goes back to the map
|
|
543
|
-
if (
|
|
545
|
+
// The panel's ✕: the focus would be left on a hidden button, so it goes back to that row, else to the map
|
|
546
|
+
if (shut) scope.timeout(() => { if (!(back && back()) && state.canvas) state.canvas.focus(); }, 0);
|
|
544
547
|
});
|
|
545
548
|
// A thread listed in the panel opens in the Work panel, and "Start a thread about this" opens its New idea form (the Work panel hears both)
|
|
546
549
|
scope.listen(drawer, 'click', (e) => {
|
|
@@ -563,8 +566,9 @@ export function mount(root, inst, options = {}) {
|
|
|
563
566
|
if (e.key !== 'Escape' || e.defaultPrevented) return;
|
|
564
567
|
if (e.target.closest && e.target.closest('select, input, textarea')) return; // a field's own Escape first
|
|
565
568
|
e.preventDefault();
|
|
569
|
+
const back = inst.ask('node:back');
|
|
566
570
|
clearSelection(inst, { source: 'keyboard' });
|
|
567
|
-
if (state.canvas) state.canvas.focus();
|
|
571
|
+
if (!(back && back()) && state.canvas) state.canvas.focus();
|
|
568
572
|
announce(inst, 'Panel closed');
|
|
569
573
|
});
|
|
570
574
|
|
|
@@ -32,7 +32,7 @@ export function install(ctx) {
|
|
|
32
32
|
const type = ref.slice(0, at);
|
|
33
33
|
const value = ref.slice(at + 1);
|
|
34
34
|
const refs = again ? retryRefs(again) : type === 'proposal' ? { proposal: value } : { issue: Number(value) };
|
|
35
|
-
ui.agent = { opener, refs, posting: false, retryOf: again ? again.runId : null };
|
|
35
|
+
ui.agent = { opener, refs, posting: false, retryOf: again ? again.runId : null, ref: ui.ref }; // `ref`: the piece of work in the node panel, the one its note is shown with
|
|
36
36
|
// The profiles the config lists come with the runs: asked for if the Agents tab has not been opened yet
|
|
37
37
|
if (!ui.runs) { await fn.loadRuns(false); if (ui.kind === 'work') fn.paint(); }
|
|
38
38
|
if (!ui.agent) return;
|
|
@@ -162,8 +162,9 @@ export function install(ctx) {
|
|
|
162
162
|
ui.agent.posting = false;
|
|
163
163
|
const text = startWords(res.status, res.body);
|
|
164
164
|
if (res.ok) {
|
|
165
|
+
const { ref } = ui.agent;
|
|
165
166
|
closeAgent();
|
|
166
|
-
ui.runNote = { text, ok: true };
|
|
167
|
+
ui.runNote = { text, ok: true, ref };
|
|
167
168
|
announce(text);
|
|
168
169
|
await fn.loadRuns(false);
|
|
169
170
|
fn.paint();
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
import { escapeHtml as escHtml } from '../../core/text.js';
|
|
9
9
|
import { defaultFilters } from '../forge-panel-model.js';
|
|
10
|
-
import { withParts } from '../engine/piece.js';
|
|
11
10
|
|
|
12
11
|
export const FORGE_NAMES = { github: 'GitHub', forgejo: 'Forgejo' };
|
|
13
12
|
export const SEARCH_ANNOUNCE_MS = 500;
|
|
@@ -24,8 +23,6 @@ export const plural = (n, word, more = `${word}s`) => `${n} ${n === 1 ? word : m
|
|
|
24
23
|
/** A link only if it is the forge's web address: a forge's JSON is data, not trusted markup */
|
|
25
24
|
export const safeUrl = (u) => (typeof u === 'string' && /^https?:\/\//i.test(u) ? u : null);
|
|
26
25
|
export const option = (value, label, on) => `<option value="${escHtml(value)}"${on ? ' selected' : ''}>${escHtml(label)}</option>`;
|
|
27
|
-
/** The back control of a detail: an arrow and the name of the list it returns to ("All pull requests") */
|
|
28
|
-
export const backHtml = (action, words) => withParts(`<button data-corn="back" type="button" class="hx-forge-back" data-action="${action}"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="M10 3L5 8l5 5"/></svg><span class="hx-forge-back-text">${escHtml(words)}</span></button>`);
|
|
29
26
|
/** The thread a successful answer holds, or null (a failure, or an answer without one) */
|
|
30
27
|
export const threadOf = (res) => (res && res.ok && res.body && res.body.thread && typeof res.body.thread === 'object' && Array.isArray(res.body.thread.messages) ? res.body.thread : null);
|
|
31
28
|
|
|
@@ -49,27 +46,29 @@ export function freshUi() {
|
|
|
49
46
|
filtersOpen: false, // the Filter chip's box
|
|
50
47
|
filters: defaultFilters(),
|
|
51
48
|
lists: {}, // `${kind}|${server state}` -> { items, at, rate, stale }
|
|
52
|
-
work: null, // { grouped, problem, at, rate, stale } of the
|
|
49
|
+
work: null, // { grouped, problem, at, rate, stale } of the Runs tab
|
|
53
50
|
specQuery: '', // the Specs tab's search (spec 0010 D5)
|
|
54
51
|
draftsOpen: null, // the Drafts group opened (true) or folded (false) by hand; null: as the model has it (folded past 10 rows)
|
|
55
52
|
workFilters: { agentsOnly: false, finished: false },
|
|
56
53
|
loading: false,
|
|
57
54
|
error: '',
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
node: '', // the id of the piece of work the node panel shows (`pull:27`), or '' while it shows none
|
|
56
|
+
ref: '', // …and its row's name in the lists (`pull:27`, `proposal:<slug>`, `run:<id>`): a row that names it is pressed
|
|
57
|
+
item: null, // …and what the graph, or the lists, say of it (work-model.js `workNode`'s `item`)
|
|
58
|
+
selected: null, // the pull request's number in the node panel
|
|
59
|
+
detail: null, // { pull, files, checks, at, rate, stale } of the pull request in the node panel
|
|
61
60
|
landing: null, // what waits to land on its approval for the selected pull request ({ slug, by, since }), or null
|
|
62
61
|
detailError: '',
|
|
63
|
-
lit: null, // litFor(detail, nodes)
|
|
64
|
-
thread: null, // the
|
|
65
|
-
threadDetail: null, // { thread, at, rate, stale } of the
|
|
62
|
+
lit: null, // litFor(detail, nodes): its files on the map's nodes
|
|
63
|
+
thread: null, // the number of the thread in the node panel
|
|
64
|
+
threadDetail: null, // { thread, at, rate, stale } of the one in the node panel: its messages, as written
|
|
66
65
|
threadError: '',
|
|
67
|
-
litThread: null, // litForThread(thread, nodes)
|
|
66
|
+
litThread: null, // litForThread(thread, nodes): the nodes its text names
|
|
68
67
|
idea: freshIdea(), // the New idea form
|
|
69
|
-
deploy: null, // the
|
|
68
|
+
deploy: null, // the id of the deploy in the node panel; the deploy itself is `deployItem`
|
|
70
69
|
deployItem: null,
|
|
71
|
-
litDeploy: null, // litForDeploy(deployItem, nodes)
|
|
72
|
-
nodesSeen: null, // the `state.nodes`
|
|
70
|
+
litDeploy: null, // litForDeploy(deployItem, nodes): the nodes it restarted
|
|
71
|
+
nodesSeen: null, // the `state.nodes` those were worked out for
|
|
73
72
|
busy: '', // the action in flight ('merge', or 'rerun:<check id>'), so a second click does nothing
|
|
74
73
|
note: null, // { text, ok }: what the last action came to, for the selected pull request
|
|
75
74
|
confirm: null, // { opener: selector, kind: 'merge' | 'spec' | 'build', plan?, n?, slug? } while the confirm dialog is open
|
|
@@ -77,7 +76,7 @@ export function freshUi() {
|
|
|
77
76
|
notes: freshNotes(), // the Release notes view
|
|
78
77
|
runs: null, // { data, error } of the Agents tab's runs: what /api/agent-runs answered
|
|
79
78
|
runNote: null, // { text, ok }: what the last Stop came to
|
|
80
|
-
|
|
79
|
+
runShown: null, // the run in the node panel, by id
|
|
81
80
|
runnerSaid: null, // the runner state last shown ('online', 'offline', 'none'; null off the pull transport), so a change is said once
|
|
82
81
|
runTimelines: new Set(), // the runs whose timeline is open
|
|
83
82
|
runReplies: new Map(), // the reply typed so far for each waiting run, so a repaint (the runs are looked at again) keeps it
|