@popcorn245/cornfield 0.54.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.
Files changed (45) hide show
  1. package/core/contrast.js +28 -0
  2. package/core/schema.js +24 -0
  3. package/explorer/css/page.css +0 -8
  4. package/explorer/css/work.css +3 -26
  5. package/explorer/deep-link.js +11 -24
  6. package/explorer/engine/layers.js +5 -2
  7. package/explorer/engine/map-style.js +8 -1
  8. package/explorer/engine/render.js +2 -1
  9. package/explorer/forge-panel-model.js +2 -36
  10. package/explorer/forge-panel.js +3 -7
  11. package/explorer/index.html +5 -11
  12. package/explorer/instance-state.js +0 -6
  13. package/explorer/instance.js +9 -5
  14. package/explorer/layer-model.js +1 -0
  15. package/explorer/page.js +8 -5
  16. package/explorer/pieces/layers.js +1 -1
  17. package/explorer/pieces/node-panel.js +26 -4
  18. package/explorer/pieces/search.js +9 -3
  19. package/explorer/pieces/work-agent.js +3 -2
  20. package/explorer/pieces/work-common.js +14 -15
  21. package/explorer/pieces/work-confirm.js +11 -10
  22. package/explorer/pieces/work-data.js +24 -31
  23. package/explorer/pieces/work-deploys.js +42 -41
  24. package/explorer/pieces/work-issues.js +32 -29
  25. package/explorer/pieces/work-list.js +406 -0
  26. package/explorer/pieces/work-markup.js +9 -15
  27. package/explorer/pieces/work-notes.js +0 -1
  28. package/explorer/pieces/work-paint.js +57 -67
  29. package/explorer/pieces/work-prs.js +25 -66
  30. package/explorer/pieces/work-runs.js +47 -57
  31. package/explorer/pieces/work-specs.js +19 -2
  32. package/explorer/pieces/work-threads.js +29 -49
  33. package/explorer/pieces/work.js +28 -28
  34. package/explorer/proposal-model.js +5 -5
  35. package/explorer/runs-view.js +10 -18
  36. package/explorer/scene.js +17 -10
  37. package/explorer/search-match.js +3 -2
  38. package/explorer/tokens.css +11 -0
  39. package/explorer/view.js +8 -1
  40. package/explorer/waiting-view.js +3 -3
  41. package/explorer/work-model.js +722 -0
  42. package/explorer/work-view.css +50 -0
  43. package/explorer/work-view.js +570 -0
  44. package/package.json +1 -1
  45. package/explorer/pieces/work-events.js +0 -285
package/core/contrast.js CHANGED
@@ -24,6 +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, WORK_EDGES, WORK_EDGE_THEMES } from './schema.js';
27
28
  import { deltaE2000 } from './delta-e.js';
28
29
  import { LAYER_KEY_RE, MAX_KEY, mapFillNames, parseKindToken } from './layers.js';
29
30
  import { DIFF_MARK_COLORS, DIFF_LABEL_ALPHA, GREY_ALPHA, GREY_LABEL_ALPHA, GREY_MIN_RATIO, markOpacity } from '../explorer/diff-marks.js';
@@ -556,6 +557,33 @@ function mapFindings(props, theme, mode, grounds, extra = []) {
556
557
  out.push({ ...base, fg: '--corn-map-stroke', bg: weakest.on, min: MAP_FILL_MIN, kind: 'ui', use: `the outline that carries the fill of ${anOf(label)} ${label} node, which is ${fmt(f.ratio)} on its own`, fgValue: onGround.fgValue, bgValue: weakest.value, ratio: weakest.r });
557
558
  }
558
559
  }
560
+ // The fill of each kind of work in the Work view (spec 0012 D2): the kind's token, else its own colour (deepened for the light ground), against the ground
561
+ for (const kind of WORK_KINDS) {
562
+ const name = `--corn-work-${kind}`;
563
+ const t = mapToken(props, name);
564
+ const use = `the fill of ${anOf(kind)} ${kind} node in the Work view`;
565
+ if (t.problem) { out.push({ ...base, fg: name, bg: GROUND, min: MAP_FILL_MIN, kind: 'ui', use, problem: t.problem }); continue; }
566
+ const own = !t.color;
567
+ const fill = own ? readColor(mode === 'light' ? lightColor(WORK_THEMES[kind].color) : WORK_THEMES[kind].color) : t.color;
568
+ const f = worstOnGrounds(fill, grounds);
569
+ const finding = { ...base, fg: own ? `${name}, auto: the node's own colour` : name, bg: GROUND, min: MAP_FILL_MIN, kind: 'ui', use, fgValue: f.fgValue, bgValue: f.bgValue, ratio: f.ratio, ...(f.image ? { groundImage: true } : {}) };
570
+ if (f.ratio >= MAP_FILL_MIN || !strokeOn) { out.push(f.ratio >= MAP_FILL_MIN ? finding : { ...finding, use: `${use}; set --corn-map-stroke, an outline at ${MAP_FILL_MIN}:1 on the fill and on the ground, or a deeper fill` }); continue; }
571
+ const onGround = worstOnGrounds(stroke.color, grounds);
572
+ const onFill = ratio(luminance(over(stroke.color, over(fill, ground))), luminance(over(fill, ground)));
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
+ 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
+ }
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
+ }
559
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)
560
588
  const glyph = mapToken(props, '--corn-map-glyph');
561
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
@@ -48,6 +48,30 @@ export const NODE_SHAPES = Object.freeze({
48
48
  stack: 'square', machine: 'square', container: 'square', device: 'square', floor: 'square', room: 'square',
49
49
  persona: 'diamond',
50
50
  });
51
+ /**
52
+ * The six kinds of work the Work view draws as nodes (spec 0012 D2): their default colour (written for the dark ground, deepened for the light one as the
53
+ * map's are), the silhouette (the same five the map has, core/schema.js NODE_SHAPES; an issue is a circle with a mark, its letters), the letters in the node's core,
54
+ * and its radius. A theme sets the colour with `--corn-work-<kind>` (explorer/tokens.css, docs/theming.md); the silhouette says what the node is, so it is not a token.
55
+ * The list is its own export so the map's bundle carries the six names and not the table.
56
+ */
57
+ export const WORK_KINDS = Object.freeze(['thread', 'issue', 'proposal', 'run', 'pull', 'deploy']);
58
+ export const WORK_THEMES = Object.freeze({
59
+ thread: Object.freeze({ color: '#a78bfa', shape: 'circle', letters: 'T', r: 20 }),
60
+ issue: Object.freeze({ color: '#fbbf24', shape: 'circle', letters: '!', r: 20 }),
61
+ proposal: Object.freeze({ color: '#2dd4bf', shape: 'diamond', letters: 'S', r: 20 }),
62
+ run: Object.freeze({ color: '#818cf8', shape: 'hexagon', letters: 'R', r: 20 }),
63
+ pull: Object.freeze({ color: '#60a5fa', shape: 'rounded-square', letters: 'PR', r: 20 }),
64
+ deploy: Object.freeze({ color: '#4ade80', shape: 'square', letters: 'D', r: 20 }),
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' });
72
+ /** The node type a kind of work has in the Work view (`work-pull`): never in topology.json */
73
+ export const workType = (kind) => `work-${kind}`;
74
+
51
75
  /** The silhouettes, in the order the renderers number them (0 is the circle) */
52
76
  export const SHAPES = Object.freeze(['circle', 'rounded-square', 'hexagon', 'square', 'diamond']);
53
77
  /** The silhouette of a node type: `circle` for one the table does not know (a type is project data, so it only selects from the table) */
@@ -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) {
@@ -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
- /* The Work toggle: opens the Work panel (forge-panel.js says in the tag which pull request is lit) */
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 (forge-panel.js), and off screen or not displayed. Only the tokens above are used, so it follows the theme. */
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-forge-lit, .hx-run-limits dd { font-family: var(--corn-font-num); font-variant-numeric: tabular-nums; }
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); }
@@ -1,44 +1,32 @@
1
1
  /**
2
2
  * @module explorer/deep-link
3
3
  *
4
- * Links from chat that land in the right place (issue #103, docs/agents.md "Deep links"):
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
- * On a phone the sheet it opens is expanded. A name that is not there is a line in the panel and said through the live
11
- * region, never a blank. A link that is followed is taken out of the address (`run`, `issue`, `start`) at once, so a
12
- * reload does not open it again; `?proposal=` stays, as it always has (it follows the open proposal).
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 { openRunLink, openIssueLink, openProposalStart } from './forge-panel.js';
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 = ['run', 'issue', 'start'];
21
+ const SPENT = ['start'];
25
22
 
26
23
  /**
27
- * What a query asks for, or null. One link asks for one thing: a run before an issue before a proposal. A value that
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: 'run', id: string } | { kind: 'issue', n: number } | { kind: 'proposal', slug: string } | { kind: string, bad: string } | null}
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 forge panel and the proposals are set up.
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
- if (!forgeOn) return unavailable('Runs and issues need a forge in the config.');
86
- return link.kind === 'run' ? openRunLink(link.id) : openIssueLink(link.n);
73
+ return false;
87
74
  }
@@ -75,6 +75,7 @@ const typeOfRow = (inst, l) => { const types = typesOf(l); return (types.length
75
75
  */
76
76
  export function layerRows(inst) {
77
77
  const { state } = inst;
78
+ if (state.workRows) return { layers: state.workRows, overlays: [] }; // the Work view: the six kinds of work and the code they touch (work-model.js)
78
79
  const dotted = (l) => { const type = typeOfRow(inst, l); return { ...l, color: rowColor(inst, { type, group: l.key }, NODE_THEMES[type] ? NODE_THEMES[type].color : l.color) }; };
79
80
  const held = new Set();
80
81
  const left = new Set(); // starting layers a project layer took nodes from
@@ -191,7 +192,9 @@ function changed(inst) {
191
192
  export function setLayer(inst, key, on, { viewer = false, scenario = false } = {}) {
192
193
  const { state } = inst;
193
194
  const review = state.review && state.proposal ? state.review : null;
194
- if (review) {
195
+ if (state.workLayers) {
196
+ state.workLayers[key] = on; // the Work view's own: never kept in the browser, and the map's are not touched
197
+ } else if (review) {
195
198
  (scenario ? review.step : review.manual)[key] = on;
196
199
  review.rev++;
197
200
  } else {
@@ -218,7 +221,7 @@ export function toggleAllLayers(inst, on, { viewer = false } = {}) {
218
221
  const { layers } = layerRows(inst);
219
222
  const keys = new Set([...LAYER_DEFS.filter((l) => !l.overlay).map((l) => l.key), ...state.projectLayers.map((l) => l.key), ...layers.map((l) => l.key)]);
220
223
  const review = state.review && state.proposal ? state.review : null;
221
- if (review) { keys.forEach((k) => { review.manual[k] = on; }); review.rev++; } else {
224
+ if (state.workLayers) { state.workRows.forEach((r) => { state.workLayers[r.key] = on; }); } else if (review) { keys.forEach((k) => { review.manual[k] = on; }); review.rev++; } else {
222
225
  keys.forEach((k) => { state.activeLayers[k] = on; if (viewer) keep(inst, k, on); });
223
226
  if (viewer) writeChanges(inst);
224
227
  }
@@ -36,6 +36,7 @@
36
36
  */
37
37
 
38
38
  import { NODE_THEMES } from '../../core/schema.js';
39
+ import { WORK_KINDS, WORK_EDGES } from '../../core/schema.js';
39
40
  import { parseColor } from '../theme-model.js';
40
41
  import { cssColor, rgbaText } from '../css-color.js';
41
42
  export { cssColor };
@@ -85,6 +86,10 @@ export const ICON_RATIO = 1.2;
85
86
  export const ICON_URL_PREFIX = '/cornfield/theme/assets/';
86
87
 
87
88
  export const nodeToken = (kind) => `--corn-map-node-${kind}`;
89
+ /** The fill token of a kind of work in the Work view (spec 0012 D2) */
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}`;
88
93
  export const groupToken = (group) => `--corn-map-group-${group}`;
89
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) */
90
95
  export const kindToken = (type, kind) => mapKindToken(type, kind);
@@ -95,6 +100,8 @@ export const stateToken = (name) => `--corn-map-${name}`;
95
100
  export const MAP_COLOR_TOKENS = Object.freeze([
96
101
  ...MAP_KINDS.map(nodeToken),
97
102
  ...MAP_GROUPS.map(groupToken),
103
+ ...WORK_KINDS.map(workToken),
104
+ ...WORK_EDGES.map(workEdgeToken),
98
105
  STROKE_TOKEN,
99
106
  LABEL_TOKEN,
100
107
  LABEL_HALO_TOKEN,
@@ -481,7 +488,7 @@ function compute(scene, style) {
481
488
  const painted = scene.painted || { nodes: new Set(), edges: new Set() };
482
489
  const nodes = scene.nodes.map((n) => {
483
490
  // Which fill wins, most specific first (spec 0009 D6): the finer kind, the project layer, the type, the starting layer
484
- const fill = !painted.nodes.has(n.id) && fillOf(values, n);
491
+ const fill = !painted.nodes.has(n.id) && (n.work ? values[workToken(n.work)] : fillOf(values, n));
485
492
  const icon = style.icons ? iconKeysFor(n.type, n.kind, n.layer).find((k) => style.icons.get(k)) || null : null; // the same order: kind, layer, type
486
493
  const glows = style.glow != null && style.glow !== 1 && n.glow > 0;
487
494
  const grey = !!n.greyed && !painted.nodes.has(n.id); // a review greys what the change does not involve; a colour a painter gave means something and stays
@@ -173,6 +173,7 @@ export function createMap(inst, opts = {}) {
173
173
  });
174
174
  if (state.view === 'dataflow' && state.flow) minY = Math.min(minY, state.flow.top - 10); // and the tier titles above
175
175
  if (state.view === 'house' && state.house && state.house.fit && !only) ({ minX, maxX, minY, maxY } = state.house.fit); // the House view fits its plan and bands (house-model.js)
176
+ if (state.view === 'work' && state.work && state.work.fit && !only) ({ minX, maxX, minY, maxY } = state.work.fit); // the Work view fits its lanes, and the room its names and toggles need (work-model.js)
176
177
 
177
178
  const availWidth = Math.max(160, width - padding * 2);
178
179
  const availHeight = Math.max(160, mapHeight - padding * 2);
@@ -217,7 +218,7 @@ export function createMap(inst, opts = {}) {
217
218
  render();
218
219
  }
219
220
 
220
- const fitPadding = () => (state.width < 640 ? 24 : 48);
221
+ const fitPadding = () => (state.view === 'work' ? (state.width < 640 ? 44 : 96) : state.width < 640 ? 24 : 48); // the Work view leaves room for the names under the nodes at the edge, in a fit and in a selection's framing
221
222
 
222
223
  const screenToWorld = (sx, sy) => ({ x: (sx - state.camera.x) / state.camera.zoom, y: (sy - state.camera.y) / state.camera.zoom });
223
224
 
@@ -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 (Specs, open the proposal, Approve), then land this.` : '';
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 (Issues, then Start a spec), or push one as a file to the proposals folder.',
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.',
@@ -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 panel is a piece on the instance (pieces/work.js, with a part per tab in pieces/work-*.js) and its
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,11 +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); };
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); };
55
51
  export const canStartAgent = () => { const p = piece(); return !!p && p.canStartAgent(); };
@@ -26,6 +26,8 @@
26
26
  <link rel="stylesheet" href="/explorer/css/work.css" />
27
27
  <link rel="stylesheet" href="/explorer/css/page.css" />
28
28
  <link rel="stylesheet" href="/explorer/house.css" />
29
+ <link rel="stylesheet" href="/explorer/work-view.css" />
30
+ <link rel="stylesheet" href="/explorer/pieces/status.css" />
29
31
  <!-- The config's brand (server/server.js puts it here): the favicon, the web app manifest and the tab colour -->
30
32
  <!--@brand-->
31
33
  <!-- The config's theme (server/server.js puts it here, so it comes after cornfield's own CSS): font stylesheets, the repo's theme.css, a named theme -->
@@ -54,6 +56,8 @@
54
56
  <button type="button" id="preset-dataflow-btn" class="hx-view-btn" data-action="preset-dataflow" aria-pressed="false" data-corn-string="dataFlow" title="Show only how data moves: browser, app servers, API, tables, services, outside systems" data-corn="preset-dataflow">Flow</button>
55
57
  <!-- The House preset (explorer/house.js, spec 0029): the floor plan with its devices, machines and people, the software around it -->
56
58
  <button type="button" id="preset-house-btn" class="hx-view-btn" data-action="preset-house" aria-pressed="false" data-corn-string="house" title="Show the house: each floor's rooms with their devices and machines, the people beside it, the software around it" data-corn="preset-house">House</button>
59
+ <!-- The Work view (explorer/work-view.js, spec 0012): the map of issues, pull requests, proposals, runs, threads and deploys; its badge is what waits on you -->
60
+ <button type="button" id="preset-work-btn" class="hx-view-btn" data-action="preset-work" aria-pressed="false" data-corn="preset-work" hidden title="Work: issues, pull requests, proposals, agent runs, threads and deploys, and the code they touch"><span data-corn-string="issuesAndPrs">Work</span><span class="hx-waiting-badge hx-view-badge" data-corn="waiting-badge" aria-hidden="true" hidden></span></button>
57
61
  <button type="button" id="fit-btn" class="hx-view-fit" data-corn="fit-button" data-action="fit" title="Fit to the screen" aria-label="Fit to the screen" data-corn-kind="icon">
58
62
  <svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M2 6V2h4M10 2h4v4M14 10v4h-4M6 14H2v-4" /></svg>
59
63
  </button>
@@ -127,16 +131,6 @@
127
131
  </div>
128
132
  <!--corn-piece:search/field-->
129
133
 
130
- <!-- 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) -->
131
- <!--corn-placeholder:work/button-->
132
- <button type="button" class="hx-work" data-action="toggle-forge" aria-expanded="false" aria-label="Work" data-corn-string-aria-label="issuesAndPrs" 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">
133
- <span data-corn-string="issuesAndPrs">Work</span>
134
- <span class="hx-forge-lit" data-corn="count" part="count" hidden></span>
135
- <span class="hx-runner-dot" aria-hidden="true" title="No runner online" hidden></span>
136
- <span class="hx-waiting-badge" data-corn="waiting-badge" part="waiting-badge" aria-hidden="true" hidden></span>
137
- </button>
138
- <!--corn-piece:work/button-->
139
-
140
134
  <!-- The one account menu (explorer/account-menu.js): who, Theme, Freeform layout, Review tokens, Proposals, the links, Sign out, and what powers it -->
141
135
  <div class="hx-menu-wrap hx-account">
142
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">
@@ -197,7 +191,7 @@
197
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 -->
198
192
  <!--corn-piece:changes/column-->
199
193
 
200
- <!-- The Work panel (explorer/pieces/work.js): 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 config names a forge. It is a piece: page.js mounts it here -->
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 -->
201
195
  <p id="offline-banner" class="hx-offline" data-corn="notice" hidden></p>
202
196
  <!--corn-piece:work/panel-->
203
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.
@@ -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 panel started (a forge in the config and somebody signed in), or ended: the account menu's Proposals entry is only for a cornfield without it
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:on (none) -> boolean whether the Work panel has started (a piece mounted after it asks rather than waits for `work:available`)
103
- * work:answer { run } (emit) "Answer" on the proposal bar's line: the Work panel opens on Runs at that run, its reply field focused
104
- * work:open-specs (none) -> true the Work panel's Specs tab opened 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
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
  *
@@ -124,6 +124,7 @@ const layersMemo = new WeakMap();
124
124
  * state for what is drawn goes through this, so the review's hiding is decided in one place.
125
125
  */
126
126
  export function layersOf(state) {
127
+ if (state.workLayers) return state.workLayers; // the Work view has its own layers, and leaves the map's as they were (work-model.js)
127
128
  const review = state.review;
128
129
  if (!review || !state.proposal) return state.activeLayers;
129
130
  const hit = layersMemo.get(review);
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 ?run=, ?issue= and ?proposal=…&start=1 land on a run, an issue and a Start dialog
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 panel (a piece, with a part per tab in pieces/work-*.js), when the config names a forge: a PR lights the nodes it changes; forge-panel-model.js its pure half;
29
- * forge-panel.js is the page's way in to it (initForgePanel, the deep links)
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
 
@@ -50,6 +51,7 @@ import { initMockups } from './mockups.js';
50
51
  import { benchMeta, measureParams, readoutLines, resultLine, runBench, showReadout } from './bench.js';
51
52
  import { initLive } from './live.js';
52
53
  import { initHouse } from './house.js';
54
+ import { initWorkView, followWorkAddress, asksForWork } from './work-view.js';
53
55
  import { houseOffered } from './house-model.js';
54
56
  import { initKeyboard } from './keyboard.js';
55
57
  import { initForgePanel } from './forge-panel.js';
@@ -207,10 +209,11 @@ export function startPage() {
207
209
  initLive({ source: liveSource, onSelectionGone: closeDrawer });
208
210
  // The House view (house.js): a source's floor renderer draws the plan under the map (plain room boxes without one); /?view=house opens it
209
211
  initHouse({ floor: floorRenderer, offered: houseOffered(houseSource, state.nodes) }); // no house source and no house in the map: no House button
212
+ initWorkView({ offered: !!config.forge }); // the Work view (work-view.js): offered when the config names a forge
210
213
  mergePagePieceOptions('changes', { checker }); // scenarios ask the source's checker, when there is one (pieces/changes.js)
211
214
  if (new URLSearchParams(window.location.search).get("view") === "dataflow") setView("dataflow");
212
- // /?run=, /?issue= and /?proposal=…&start=1 land on a run, an issue's Start button and a proposal's Start dialog (deep-link.js)
213
- followDeepLink({ proposalOpened, forgeOn }).catch((err) => console.error('Following the link failed', err));
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)
216
+ (asksForWork(window.location.search) ? followWorkAddress() : followDeepLink({ proposalOpened, forgeOn })).catch((err) => console.error('Following the link failed', err));
214
217
  // /?scenario-demo=1 plays a small scenario over real nodes, to look at the player
215
218
  maybeStartDemo();
216
219
  // /?bench=1 runs the stopwatch (bench.js) once the map is up
@@ -223,7 +223,7 @@ export function mount(root, inst, options = {}) {
223
223
  ${hid ? `<span class="hx-toggle-text">${name}${hid}</span>` : name}${layer.live ? '<span class="hx-live-tag" data-corn="live-tag">live</span>' : ''}
224
224
  </span>
225
225
  <span class="hx-toggle-meta">${shown}
226
- <span class="hx-count" data-corn="count">${(UNIT[layer.key] || String)(counts[layer.key] || 0)}</span>
226
+ <span class="hx-count" data-corn="count">${layer.countText || (UNIT[layer.key] || String)(counts[layer.key] || 0)}</span>
227
227
  <span class="hx-tick">${on ? '✓' : '—'}</span>
228
228
  </span>
229
229
  </button>${kindsHtml(layer, kinds.get(layer.key), surface)}`;