@runeditrun/rer 0.2.51 → 0.2.53

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/cli/bounded.mjs CHANGED
@@ -12,7 +12,7 @@ import {RerError} from './errors.mjs';
12
12
  // enter this boundary.
13
13
  export async function boundedCommand(project,options,argv,out){
14
14
  if(!['install','setup','build','verify','deploy','export','import'].includes(options.verb))return null;
15
- const {commandPolicy,queuedCommand,queueLabel}=await shared('queue.mjs');
15
+ const {commandPolicy,queuedCommand,queueLabel,maxWaitSeconds}=await shared('queue.mjs');
16
16
  const policy=await commandPolicy();
17
17
  const childArgs=[...argv];const cwdIndex=childArgs.indexOf('--cwd');if(cwdIndex>=0&&(childArgs.indexOf('--')<0||cwdIndex<childArgs.indexOf('--')))childArgs[cwdIndex+1]=project.root;
18
18
  const directory=await mkdtemp(join(tmpdir(),'rer-bounded-'));
@@ -65,6 +65,10 @@ export async function boundedCommand(project,options,argv,out){
65
65
  if(termination){
66
66
  out.error(new RerError('cancelled',`Stopped by ${termination} after owned children were stopped.`,exitCode));
67
67
  out.result(false,exitCode);
68
+ }else if(result.timedOut){
69
+ const {busyMessage}=await shared('busy.mjs');
70
+ out.error(new RerError('safety_refusal',busyMessage({...result,reason:store.redact(String(result.reason))},{verb:options.verb,maxWait:maxWaitSeconds}),exitCode));
71
+ out.result(false,exitCode);
68
72
  }else if(finalEvent&&finalEvent.exitCode===exitCode){
69
73
  if(errorEvent){
70
74
  let deployment={};
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.53
4
+
5
+ - **Dropdowns share one themed chevron rule.** Base's operator app and installer draw a 12 px chevron 14 px from the right border with 40 px end padding. Exported seeds can copy `selectStyle` from `src/base/select-style.ts`; its gradient strokes follow the theme color and work under the seed's content security policy. Focus, disabled, right-to-left and forced-color states are included (#247).
6
+ - **Queue wait timeouts explain the refusal.** Bounded build, deploy, install, setup, verify, export and import commands that reach the job queue's max wait say why they did not start and name the retry command, in terminal text and JSON, while keeping exit 75 (#253).
7
+
8
+ ## 0.2.52
9
+
10
+ - **Shared job queues use one slot limit.** Every client sharing a queue directory admits against the same limit, so an older shell requesting three slots no longer holds up a five-slot queue. A live `config.json` slot limit is authoritative; otherwise the largest live client request sets the limit. Clients requesting a different limit see the queue's effective limit and configuration path. FIFO ordering, load admission and available-memory admission stay in place (#244).
11
+
3
12
  ## 0.2.51
4
13
 
5
14
  - **The Run page keeps commands clear of Copy.** Command blocks wrap beside the button while there is room and below it at narrower widths. The dev sign-in hand-off page now shows the seed’s own logo, or its product name when it declares no logo (#236).
@@ -36,7 +36,7 @@ threshold when one is set, and available memory is strictly above the floor. Def
36
36
 
37
37
  | Setting in config.json | Default | Environment override |
38
38
  | --- | --- | --- |
39
- | slots | max(1, min(3, floor(CPUs / 4), floor(RAM / 8 GiB))) | RER_JOBS_SLOTS |
39
+ | slots | max(1, min(3, floor(CPUs / 4), floor(RAM / 8 GiB))) | RER_JOBS_SLOTS (request; shared policy below) |
40
40
  | loadThreshold | none: a fleet sets one in its own environment | RER_JOBS_LOAD_THRESHOLD |
41
41
  | minFreeMemoryBytes | 2 GiB | RER_JOBS_MIN_FREE_MEMORY_BYTES |
42
42
  | pollMs | 3000 | RER_JOBS_POLL_MS |
@@ -44,9 +44,20 @@ threshold when one is set, and available memory is strictly above the floor. Def
44
44
  | killGraceMs | 1000 | RER_JOBS_KILL_GRACE_MS |
45
45
 
46
46
  Put numeric settings in `$RER_JOBS_DIR/config.json` (or `~/.rer/jobs/config.json`).
47
- Environment overrides take precedence. All clients should use the same policy;
48
- central config avoids differing limits between sessions. Resource settings are
49
- read when a client is created. `status` prints its effective policy, current load,
47
+ For slots, `config.json` is authoritative and is read under the queue lock on
48
+ every operation, including admission: its `slots` overrides environment and
49
+ library requests from every client. Without a configured `slots`, the shared
50
+ limit is the largest slot request among live queue clients (environment, library
51
+ override, or hardware default). The limit and live membership are recorded in
52
+ `state.json` under the same lock as admission. Closing or reclaiming a dead client
53
+ removes its request; lowering the limit never interrupts running jobs. A client
54
+ whose request differs prints one line per differing effective limit, naming
55
+ the queue's limit and `config.json` as the way to change it. Thus an older shell
56
+ requesting 3 cannot block a head waiter when another live client requests 5.
57
+ Restart clients using older queue code before sharing this policy.
58
+
59
+ Environment overrides still take precedence for the other settings. Resource settings are
60
+ read when a client is created. `status` prints the shared slot limit, current load,
50
61
  available and raw free memory, running labels/repositories/elapsed times, ordered
51
62
  waiting jobs, and the head's admission reason. Available memory is what the OS
52
63
  can reclaim: on macOS the free, inactive, speculative and purgeable pages from
@@ -35,7 +35,7 @@ export function ordered(jobs) {
35
35
 
36
36
  // Each reason says what is running, what the limit is and how to change it.
37
37
  export function admissionDetails(running, config, sample) {
38
- if (running >= config.slots) return { code: 'slots', reason: `all job slots are in use (${running} of ${config.slots}; change with RER_JOBS_SLOTS)` };
38
+ if (running >= config.slots) return { code: 'slots', reason: `all job slots are in use (${running} of ${config.slots}; change slots in ${config.directory}/config.json)` };
39
39
  if (!Number.isFinite(sample.load) || !Number.isFinite(sample.availableMemoryBytes))
40
40
  return { code: 'resources_unavailable', reason: 'this computer\'s load or available memory could not be read' };
41
41
  if (sample.load > config.loadThreshold) return { code: 'load',
@@ -8,17 +8,29 @@ import { transaction } from './storage.mjs';
8
8
  import { sampleResources } from './resources.mjs';
9
9
  import { execute, signalExit } from './command.mjs';
10
10
  import { stopGroup } from './processes.mjs';
11
+ import { sharedSlots } from './slots.mjs';
11
12
 
12
13
  const WAIT_REPORT_INTERVAL_MS = 15_000;
13
14
 
14
15
  export async function createQueue(options = {}) {
15
16
  const config = await configuration(options), lifetime = await identity();
16
17
  const sampler = options.sampler ?? sampleResources;
17
- let active = 0, closed = false;
18
- const mutate = action => {
18
+ const member = { owner: lifetime.info, slots: config.slots, directory: config.directory };
19
+ let active = 0, closed = false, lastSlotNotice;
20
+ const mutate = async action => {
19
21
  if (closed) throw Error('Job queue is closed');
20
- return transaction(config.directory, lifetime.info, action);
22
+ const result = await transaction(config.directory, lifetime.info, async state => {
23
+ config.slots = await sharedSlots(state, member);
24
+ return action(state);
25
+ });
26
+ if (config.slots !== member.slots && config.slots !== lastSlotNotice) {
27
+ console.error(`Job queue uses ${config.slots} slots (this client requested ${member.slots}); set "slots" in ${config.directory}/config.json to change the shared limit.`);
28
+ lastSlotNotice = config.slots;
29
+ }
30
+ return result;
21
31
  };
32
+ try { await mutate(() => {}); }
33
+ catch (error) { await lifetime.close(); throw error; }
22
34
  async function reclaim(state) {
23
35
  for (const key of ['queued', 'running']) {
24
36
  const kept = [];
@@ -38,7 +50,7 @@ export async function createQueue(options = {}) {
38
50
  const resources = await sampler();
39
51
  const describe = ({ command, membership, owner: { token, socket, ...owner }, ...job }) => ({ ...job, owner,
40
52
  elapsedSeconds: Math.floor((Date.now() - (job.startedAt ?? job.enqueuedAt)) / 1000) });
41
- return { running: state.running.map(describe), queued: ordered(state.queued).map(describe), resources, config,
53
+ return { running: state.running.map(describe), queued: ordered(state.queued).map(describe), resources, config: { ...config },
42
54
  admissionReason: state.queued.length ? admissionDetails(state.running.length, config, resources)?.reason ?? 'ready' : 'queue empty' };
43
55
  });
44
56
  }
@@ -128,6 +140,9 @@ export async function createQueue(options = {}) {
128
140
  }
129
141
  return { config, run, status, drain, async close() {
130
142
  if (active) throw Error('Cannot close a queue with active jobs');
131
- closed = true; await lifetime.close();
143
+ if (closed) return;
144
+ closed = true;
145
+ try { await transaction(config.directory, lifetime.info, state => sharedSlots(state, member, false)); }
146
+ finally { await lifetime.close(); }
132
147
  } };
133
148
  }
@@ -0,0 +1,19 @@
1
+ import { join } from 'node:path';
2
+ import { alive } from './identity.mjs';
3
+ import { readJson } from './storage.mjs';
4
+
5
+ // Called only under the queue's transaction lock. Config is authoritative;
6
+ // without it every client uses the largest request from the same live members.
7
+ export async function sharedSlots(state, member, register = true) {
8
+ const members = [];
9
+ for (const item of state.slotMembers ?? []) {
10
+ if (item.owner.token !== member.owner.token && await alive(item.owner)) members.push(item);
11
+ }
12
+ if (register) members.push(member);
13
+ const disk = await readJson(join(member.directory, 'config.json'), {});
14
+ if (disk.slots !== undefined && (!Number.isInteger(disk.slots) || disk.slots < 1))
15
+ throw Error('Invalid job queue slots in config.json');
16
+ state.slotMembers = members;
17
+ state.slots = disk.slots ?? Math.max(1, ...members.map(item => item.slots));
18
+ return state.slots;
19
+ }
@@ -114,6 +114,54 @@ Declare the theme in two places that name the same file:
114
114
  Without a theme every page is unchanged. `default-seed/public/rer-theme.css`
115
115
  and the foundation template's `public/rer-theme.css` are worked examples.
116
116
 
117
+ ### Select chevron
118
+
119
+ Every dropdown on Base's own screens draws its chevron 14px in from the right
120
+ border and keeps 40px of end padding so text never runs under it. One rule
121
+ does this, and a seed's own pages adopt it too:
122
+
123
+ ```css
124
+ select:not([multiple],[size]:not([size="1"])){
125
+ --rer-select-ink:var(--rer-muted,light-dark(#475569,#a8b3c4));
126
+ appearance:none;
127
+ background-image:
128
+ linear-gradient(to top right,transparent calc(50% - 1.1px),var(--rer-select-ink) calc(50% - .55px),var(--rer-select-ink) calc(50% + .55px),transparent calc(50% + 1.1px)),
129
+ linear-gradient(to top left,transparent calc(50% - 1.1px),var(--rer-select-ink) calc(50% - .55px),var(--rer-select-ink) calc(50% + .55px),transparent calc(50% + 1.1px));
130
+ background-repeat:no-repeat;
131
+ background-position:right 20px center,right 14px center;
132
+ background-size:6px 6px;
133
+ padding-inline-end:40px;
134
+ }
135
+ ```
136
+
137
+ The two gradient strokes form one 12px chevron whose right edge is 14px from
138
+ the border. The full rule also carries the `:focus-visible`, `:disabled`,
139
+ right-to-left and `forced-colors` variants. Multi-selects and `size` lists keep
140
+ their native look.
141
+
142
+ - **Adopt it by copying.** Copy the whole rule from
143
+ `foundation/runtime/select-style.ts` (exported as `selectStyle`, which both
144
+ exporters place at `src/base/select-style.ts`). A seed whose pages use
145
+ `pageStyle` already has it. A seed with its own stylesheet pastes the CSS
146
+ into it, or imports `selectStyle` into a `<style>` tag. The installer's copy
147
+ is in `ui/style.css`. A seed rule that sets `padding-right` on selects
148
+ with higher specificity than the rule's `select:not(...)` (a `#id` selector,
149
+ say) overrides the 40px end padding: keep it at 36px or more.
150
+ - **Recolour it with the theme.** The chevron reads `--rer-muted`, so a seed
151
+ that declares its theme tokens needs nothing else: the installer, `/app` and
152
+ every page using the rule draw it in that colour. A seed that wants another
153
+ colour sets `--rer-select-ink` on `:root` (or one container); focus switches
154
+ it to `--rer-text` and a disabled select dims it. For a dark scheme, declare
155
+ `color-scheme: light dark` and dark values for `--rer-muted` and
156
+ `--rer-text`; the neutral fallbacks use `light-dark()` and follow it. The
157
+ chevron is drawn with gradients so it can read a variable; an SVG data URI
158
+ cannot.
159
+ - **Keep the rule's geometry.** The browser checks (the installer's
160
+ `ui/browser-check.mjs` and the default seed's private-response browser test)
161
+ assert, at 1440 and 390, that every visible single select has no native
162
+ appearance, at least 36px of right padding and its chevron 10-16px from the
163
+ right edge.
164
+
117
165
  ## Setup behavior and custody
118
166
 
119
167
  Setup validates answers before effects, then uses the declared lifecycle to
@@ -3,7 +3,7 @@ import { busyFailure } from './failures.mjs';
3
3
  // A queued step the job queue never admitted is a busy machine, not a failed
4
4
  // command: say what held it, the limit and the next step, in the same plain form
5
5
  // as the server load guard (cli/server-resources.mjs).
6
- const commandNames = new Set(['dev', 'setup', 'preview', 'build', 'deploy', 'verify']);
6
+ const commandNames = new Set(['install', 'setup', 'dev', 'preview', 'build', 'verify', 'deploy', 'export', 'import']);
7
7
 
8
8
  function waited(seconds) {
9
9
  return seconds >= 60 ? `${Math.round(seconds / 60)} minutes` : `${Math.round(seconds)} seconds`;
@@ -4,7 +4,8 @@ import { createHash } from 'node:crypto';
4
4
  import { readFile, realpath } from 'node:fs/promises';
5
5
  const portable = basename(dirname(fileURLToPath(import.meta.url))) === 'base-onboarding';
6
6
  const queueURL = new URL(portable ? '../base-cli/modules/job-queue/' : '../modules/job-queue/', import.meta.url);
7
- export const maxWaitSeconds = 1200;
7
+ // Keep the operational default while allowing callers to bound admission sooner.
8
+ export const maxWaitSeconds = Number(process.env.RER_JOBS_MAX_WAIT_SECONDS ?? 1200);
8
9
  export const heavyVerbs = new Set(['install', 'setup', 'build', 'verify', 'dev', 'preview', 'deploy', 'release', 'export', 'import', 'installer']);
9
10
  export const verificationBoundary = verb => verb === 'release' || verb === 'verify' || verb?.startsWith('verify:');
10
11
  // The seed's display name (seed.json `name`, else its folder name) for terminal lines,
@@ -4,7 +4,9 @@
4
4
 
5
5
  .agent-activity.known-group{backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);border:0;border-radius:13px;background:linear-gradient(110deg,rgba(38,60,116,.5),rgba(132,118,143,.5));overflow:hidden;margin-bottom:16px}.known-group-header{display:flex;align-items:center;gap:16px;padding:16px 15px 7px}.known-group-title{font-size:16px;margin:0;font-weight:700;line-height:1.3}.category-icon{width:36px;height:36px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;border-radius:11px;background:linear-gradient(135deg,#aa98ff,#e5d1ff);color:#412199;box-shadow:inset 0 0 8px #ffffff44}.category-icon svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.workspace .category-icon{background:linear-gradient(135deg,#a2dbff,#4fa9f5);color:#0070df}.hosting .category-icon,.email .category-icon{background:linear-gradient(135deg,#0ed4b6,#31f2cf);color:#005761}.known-group-body{padding:6px 16px 13px 23px}.known-group .known-row:last-child{padding-bottom:0}#known-summary .known-label{font-size:11px}.known-row{min-width:0}.known-editor{min-width:0}.group-symbols{position:absolute;width:0;height:0;overflow:hidden}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:700px){.known-group-header{gap:12px}.known-group-body{padding-left:15px}.known-group-title{font-size:15px}}
6
6
 
7
- #fields>.field[data-field]{border:0;border-radius:0;background:transparent;padding:0}#fields{gap:24px}.select-wrap{position:relative}.select-wrap:after{content:"";position:absolute;right:18px;top:50%;width:7px;height:7px;border-right:1.5px solid #64788e;border-bottom:1.5px solid #64788e;transform:translateY(-70%) rotate(45deg);pointer-events:none}.select-wrap select{appearance:none;-webkit-appearance:none;padding-right:44px}
7
+ #fields>.field[data-field]{border:0;border-radius:0;background:transparent;padding:0}#fields{gap:24px}.select-wrap{position:relative}
8
+ /* The shared select rule: foundation/runtime/select-style.ts, documented under "Select chevron" in README.md. */
9
+ select:not([multiple],[size]:not([size="1"])){--rer-select-ink:var(--rer-muted,light-dark(#475569,#a8b3c4));appearance:none;-webkit-appearance:none;background-image:linear-gradient(to top right,transparent calc(50% - 1.1px),var(--rer-select-ink) calc(50% - .55px),var(--rer-select-ink) calc(50% + .55px),transparent calc(50% + 1.1px)),linear-gradient(to top left,transparent calc(50% - 1.1px),var(--rer-select-ink) calc(50% - .55px),var(--rer-select-ink) calc(50% + .55px),transparent calc(50% + 1.1px));background-repeat:no-repeat;background-position:right 20px center,right 14px center;background-size:6px 6px;padding-inline-end:40px;text-overflow:ellipsis}select:not([multiple],[size]:not([size="1"])):dir(rtl){background-position:left 14px center,left 20px center}select:not([multiple],[size]:not([size="1"])):focus-visible{--rer-select-ink:var(--rer-text,light-dark(#172033,#f1f5f9))}select:not([multiple],[size]:not([size="1"])):disabled{--rer-select-ink:color-mix(in srgb,var(--rer-muted,light-dark(#475569,#a8b3c4)) 55%,transparent);color:var(--rer-muted,light-dark(#475569,#a8b3c4));cursor:not-allowed}@media(forced-colors:active){select:not([multiple],[size]:not([size="1"])){--rer-select-ink:ButtonText}}
8
10
 
9
11
  .known-value{display:flex;align-items:center;gap:7px;min-width:0}.known-value-text{min-width:0;overflow-wrap:anywhere}.value-icon,.colour-swatch{width:18px;height:18px;flex-shrink:0}.colour-swatch{width:16px;height:16px}.value-icon{fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.colour-swatch{border-radius:4px;box-shadow:inset 0 0 0 1px #ffffff70}
10
12
 
@@ -12,7 +12,6 @@
12
12
  .rer-themed .input{border-color:var(--rer-border);background:var(--rer-surface);color:var(--rer-text);border-radius:calc(var(--rer-radius,20px) / 2)}
13
13
  .rer-themed .input:focus-visible,.rer-themed button:focus-visible,.rer-themed a:focus-visible,.rer-themed summary:focus-visible,.rer-themed .target-choice:has(input:focus-visible){outline-color:var(--rer-focus)}
14
14
  .rer-themed .help,.rer-themed .status,.rer-themed .step-progress,.rer-themed .advanced summary,.rer-themed .target-choice .help,.rer-themed .failure-log-path,.rer-themed .agent-activity-history,.rer-themed .known-editor .help{color:var(--rer-muted)}
15
- .rer-themed .select-wrap:after{border-color:var(--rer-muted)}
16
15
  .rer-themed .edit,.rer-themed .field .edit,.rer-themed .panel .edit,.rer-themed .help-link,.rer-themed #known-summary .known-group .edit,.rer-themed .editor-actions button{color:var(--rer-link,var(--rer-text))}
17
16
  .rer-themed .primary,.rer-themed .secondary,.rer-themed .agent-connect{font-family:inherit;border-radius:var(--rer-radius,25px)}
18
17
  .rer-themed .primary{background:var(--rer-accent,var(--installer-accent,#7542d3));color:var(--rer-accent-text,var(--installer-accent-text,#fff));box-shadow:none}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.51",
3
+ "version": "0.2.53",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",