@runeditrun/rer 0.2.52 → 0.2.54
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/README.md +10 -0
- package/cli/bounded.mjs +5 -1
- package/cli/contract.mjs +1 -1
- package/cli/deploy-command.mjs +4 -2
- package/cli/deploy-owner-input.mjs +35 -0
- package/cli/deploy-owner.mjs +3 -3
- package/cli/deploy.mjs +5 -3
- package/cli/parse.mjs +2 -1
- package/global/CHANGELOG.md +10 -0
- package/global/launch/dev.mjs +10 -2
- package/onboarding/README.md +48 -0
- package/onboarding/busy.mjs +1 -1
- package/onboarding/queue.mjs +2 -1
- package/onboarding/ui/style.css +3 -1
- package/onboarding/ui/theme.css +0 -1
- package/package.json +1 -1
package/cli/README.md
CHANGED
|
@@ -336,6 +336,16 @@ declaration refuses completion. A kit or custom-hook deploy, except `--dry-run`,
|
|
|
336
336
|
first refuses uncommitted tracked source, naming the files, before any build or
|
|
337
337
|
upload.
|
|
338
338
|
|
|
339
|
+
For a hosted owner claim, deploy reuses the name saved by `rer setup` in the
|
|
340
|
+
checkout's `.seed/installer/setup-answers.json`, under the adapter's
|
|
341
|
+
`input.names.name` field (default `displayName`). If no name is known,
|
|
342
|
+
interactive deploy asks once and saves it there. For unattended deployment,
|
|
343
|
+
`rer deploy --non-interactive --owner-name 'Maya Chen'` supplies the name;
|
|
344
|
+
without a saved or supplied name, it refuses before upload. Names use the same
|
|
345
|
+
validation as `setup --owner-name`: nonblank, at most 200 characters and no
|
|
346
|
+
Unicode Cc or Cf control characters. Nameless installers retain their existing
|
|
347
|
+
deployment behavior.
|
|
348
|
+
|
|
339
349
|
`--env-file` values are available in the command's preflight, custom hook and
|
|
340
350
|
child build environment and are redacted; the caller environment is restored
|
|
341
351
|
on success and failure. `--remove`, `--set-secret` and `--unset-secret` always go
|
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={};
|
package/cli/contract.mjs
CHANGED
|
@@ -11,7 +11,7 @@ const definitions = {
|
|
|
11
11
|
build: [['--site'], 'Production build with private local settings excluded and restored. --site instead writes the static run site (homepage, /run, docs) to its declared folder and prints that folder.'],
|
|
12
12
|
verify: [[], 'Run the complete internal verification target.'],
|
|
13
13
|
reset: [['--yes'], 'Confirmed removal of the declared local inventory only.'],
|
|
14
|
-
deploy: [['--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret'], 'Owner-account deployment and health; dry run performs local validation/build only. Builds and deploy hooks run with the checkout\'s local settings files moved aside, and a build output holding one (.dev.vars, .env) is refused. Declared secrets come from the environment or --env-file (an owned 0600 KEY=VALUE file); a new Worker gets the local setup owner and fresh generated secrets when they are not given. rer keeps the secrets it generates in .rer/deploy/ENVIRONMENT.secrets.env (0600) and reuses them on every redeploy; it refuses to generate a replacement for one a live Worker holds, and --rotate-secret NAME[,NAME] replaces them on purpose. After a healthy deploy rer claims the setup owner on the hosted app with the one-time setup token, then removes the token. --set-secret NAME[,NAME] (each value from the environment or --env-file; repeat the flag or join names with commas) and --unset-secret NAME[,NAME] change those secrets of the deployed Worker without a build, all of them in one new Worker version or none, and record that version; a missing value refuses before any change. --remove --yes deletes what this environment\'s deploy record says rer created (Worker, D1, R2, KV, queues), reads back that each is gone, and touches nothing else. --site deploys the run site instead: an assets-only Worker on its custom domain with www redirected; with --dry-run it builds the site and prints the plan with no provider request. --demo deploys the hosted demo instead (deploy-demo.json): a front Worker on demo.<domain> giving each visitor their own signed-in, throwaway native Worker isolate of this seed with real public reads/checks and simulated external writes; --dry-run writes it to .rer/demo-host with no provider request; --demo --remove --yes deletes that demo (its Worker, demo.<domain> Custom Domain, each only while the record its deploy left proves it the demo\'s), reads back that each is gone, and is a no-op once it is.'],
|
|
14
|
+
deploy: [['--owner-name', '--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret'], 'Owner-account deployment and health; dry run performs local validation/build only. Builds and deploy hooks run with the checkout\'s local settings files moved aside, and a build output holding one (.dev.vars, .env) is refused. Declared secrets come from the environment or --env-file (an owned 0600 KEY=VALUE file); a new Worker gets the local setup owner and fresh generated secrets when they are not given. rer keeps the secrets it generates in .rer/deploy/ENVIRONMENT.secrets.env (0600) and reuses them on every redeploy; it refuses to generate a replacement for one a live Worker holds, and --rotate-secret NAME[,NAME] replaces them on purpose. After a healthy deploy rer claims the setup owner on the hosted app with the saved setup owner name and the one-time setup token, then removes the token. If the installer declares an owner-name field and no name is saved, deploy asks once and saves it; --non-interactive requires --owner-name NAME before any upload. --set-secret NAME[,NAME] (each value from the environment or --env-file; repeat the flag or join names with commas) and --unset-secret NAME[,NAME] change those secrets of the deployed Worker without a build, all of them in one new Worker version or none, and record that version; a missing value refuses before any change. --remove --yes deletes what this environment\'s deploy record says rer created (Worker, D1, R2, KV, queues), reads back that each is gone, and touches nothing else. --site deploys the run site instead: an assets-only Worker on its custom domain with www redirected; with --dry-run it builds the site and prints the plan with no provider request. --demo deploys the hosted demo instead (deploy-demo.json): a front Worker on demo.<domain> giving each visitor their own signed-in, throwaway native Worker isolate of this seed with real public reads/checks and simulated external writes; --dry-run writes it to .rer/demo-host with no provider request; --demo --remove --yes deletes that demo (its Worker, demo.<domain> Custom Domain, each only while the record its deploy left proves it the demo\'s), reads back that each is gone, and is a no-op once it is.'],
|
|
15
15
|
export: [['--target', '--output', '--origin', '--session-file'], 'Complete supported archive of the local copy on this computer, with integrity and exclusions, written to --output. The hosted install cannot be exported yet: --origin or --target remote refuses (exit 2) before any effect and names the command that saves the hosted database.'],
|
|
16
16
|
import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--output'], 'Confirmed atomic restore into an empty destination; --journal LATER_ARCHIVE also fences rows that installation erased since. Backup-only local v1 recovery requires --legacy-v1 --acknowledge-unverified-metadata and a new --output v2 archive; --journal requires normal v2 import.'],
|
|
17
17
|
doctor: [[], 'Read-only installed tool, configuration and state diagnostics.'],
|
package/cli/deploy-command.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { invalid, refuse, RerError } from './errors.mjs';
|
|
|
6
6
|
import { ownerDeploy } from './deploy.mjs';
|
|
7
7
|
import { deployEnvironment, deployAgain } from './deploy-inputs.mjs';
|
|
8
8
|
import { claimHostedOwner } from './deploy-owner.mjs';
|
|
9
|
+
import { deployOwnerInput } from './deploy-owner-input.mjs';
|
|
9
10
|
import { checkHostedSetup, hostedSetupFailure } from './deploy-setup.mjs';
|
|
10
11
|
import { mutationReadinessFailure } from './deploy-readiness.mjs';
|
|
11
12
|
import { observeOwner, ownerExchangeFailure } from './deploy-observation.mjs';
|
|
@@ -94,6 +95,7 @@ export async function deployCommand(context) {
|
|
|
94
95
|
const production = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys });
|
|
95
96
|
await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed: context.setupSeed, adapter, declarationPath: path, options });
|
|
96
97
|
const sourceSha = options.dryRun ? undefined : committedSource(root, options);
|
|
98
|
+
const ownerInput = await deployOwnerInput(context);
|
|
97
99
|
const { env, supplied, generated, reused, rotated } = await deployEnvironment({ root, options, declaration, setupManifest, settings, localOnlyKeys });
|
|
98
100
|
const { createRedaction } = await shared('redaction.mjs');
|
|
99
101
|
const redaction = createRedaction();
|
|
@@ -125,7 +127,7 @@ export async function deployCommand(context) {
|
|
|
125
127
|
Object.assign(process.env, env);
|
|
126
128
|
// The hook builds and uploads by itself: it never sees the checkout's local settings.
|
|
127
129
|
deployed = await withoutLocalSettings(root, { settings: [...(Array.isArray(adapter.settings) ? adapter.settings : []), adapter.hooks?.secrets?.file], operationToken: context.operationToken },
|
|
128
|
-
() => adapter.deploy({ ...context, linkDependencies: async (origin, token) => link(token, origin) }));
|
|
130
|
+
() => adapter.deploy({ ...context, input: ownerInput.input, linkDependencies: async (origin, token) => link(token, origin) }));
|
|
129
131
|
} finally {
|
|
130
132
|
for (const key of Object.keys(process.env)) if (!Object.hasOwn(saved, key)) delete process.env[key];
|
|
131
133
|
Object.assign(process.env, saved);
|
|
@@ -150,7 +152,7 @@ export async function deployCommand(context) {
|
|
|
150
152
|
if (typeof deployed.setupToken === 'string' && deployed.setupToken) addSecret(deployed.setupToken);
|
|
151
153
|
const sentSecrets = (uploaded?.sentSecrets ?? []).filter(binding => uploaded.propagation.matchesToken(binding, env[declaration.secrets.find(item => item.binding === binding)?.environment]));
|
|
152
154
|
const kit = state ? { secret: (extra, values) => command('secret', extra, values), recordClaim: outcome => command('record-owner', ['--outcome', outcome]) } : { token: deployed.setupToken || undefined };
|
|
153
|
-
claimed = await claimHostedOwner({ hook: adapter.hooks?.owner, setupManifest, declaration, deployed: { ...state, sentSecrets, propagation:deployed.propagation ?? uploaded?.propagation, origin, owner: claimed, observedOwner: () => claims.at(-1)?.outcome }, env, supplied, ...kit, addSecret, beforeClaim: token => link(token, origin), store, signal: context.signal });
|
|
155
|
+
claimed = await claimHostedOwner({ hook: adapter.hooks?.owner, setupManifest, declaration, deployed: { ...state, sentSecrets, propagation:deployed.propagation ?? uploaded?.propagation, origin, owner: claimed, observedOwner: () => claims.at(-1)?.outcome }, env, ...ownerInput, supplied, ...kit, addSecret, beforeClaim: token => link(token, origin), store, signal: context.signal });
|
|
154
156
|
if (!linked) await linkDependencies?.(origin);
|
|
155
157
|
step = 'verify hosted setup';
|
|
156
158
|
await checkHostedSetup({ origin, claimed: claimed ?? state?.ownerClaim?.outcome ?? claims.at(-1)?.outcome, signal: context.signal });
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline/promises';
|
|
2
|
+
import { invalid, missing } from './errors.mjs';
|
|
3
|
+
import { validOwnerName } from './parse.mjs';
|
|
4
|
+
import { savedSetupAnswers, rememberSetupAnswers } from './setup-answers.mjs';
|
|
5
|
+
import { shared } from './shared.mjs';
|
|
6
|
+
|
|
7
|
+
// Resolve the installer identity before building or uploading. Names are safe
|
|
8
|
+
// installer answers, not runtime secrets, and use the same custody as setup.
|
|
9
|
+
export async function deployOwnerInput({ root, adapter, setupSeed, options, signal }) {
|
|
10
|
+
const key = adapter.input?.names?.name ?? 'displayName';
|
|
11
|
+
if (!setupSeed?.model.fields[key]) {
|
|
12
|
+
if (options.ownerName !== undefined) throw invalid('This installer does not declare an owner-name field; --owner-name is unsupported.');
|
|
13
|
+
return { input: {} };
|
|
14
|
+
}
|
|
15
|
+
const project = { root, adapter, setupSeed };
|
|
16
|
+
const input = await savedSetupAnswers(project, setupSeed.model) ?? {};
|
|
17
|
+
let displayName = options.ownerName ?? input[key];
|
|
18
|
+
if (displayName === undefined && adapter.hooks?.secrets) {
|
|
19
|
+
const { readSettings } = await shared('adapter-settings.mjs');
|
|
20
|
+
displayName = (await readSettings(root, adapter.hooks.secrets)).values[key];
|
|
21
|
+
}
|
|
22
|
+
const advice = 'Deploy needs your owner name; run rer deploy --owner-name "Your name" (or rer setup --owner-name "Your name"). Nothing was uploaded.';
|
|
23
|
+
if (!displayName?.trim()) {
|
|
24
|
+
if (options.dryRun) return { input };
|
|
25
|
+
if (options.nonInteractive || options.json || !process.stdin.isTTY) throw missing(advice);
|
|
26
|
+
const prompt = createInterface({ input: process.stdin, output: process.stderr });
|
|
27
|
+
const closed = new Promise((_, reject) => prompt.once('close', () => reject(missing(advice))));
|
|
28
|
+
try { displayName = await Promise.race([prompt.question('Your name (hosted owner): ', { signal }), closed]); }
|
|
29
|
+
finally { prompt.close(); }
|
|
30
|
+
}
|
|
31
|
+
if (!validOwnerName(displayName)) throw invalid('Provide a valid owner name.');
|
|
32
|
+
input[key] = displayName;
|
|
33
|
+
if (!options.dryRun) await rememberSetupAnswers(project, input);
|
|
34
|
+
return { input, displayName };
|
|
35
|
+
}
|
package/cli/deploy-owner.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
13
13
|
// deploy hook's own: rer claims with the `token` it returned, else the one rer
|
|
14
14
|
// gave it, and leaves that token with the hook.
|
|
15
15
|
// `beforeClaim(token)` runs while the token is live (dependency approvals need it).
|
|
16
|
-
export async function claimHostedOwner({ hook, setupManifest, declaration, deployed, env, supplied = [], secret, token: hookToken, addSecret, beforeClaim, recordClaim, inspect, store, signal, fetch = globalThis.fetch }) {
|
|
16
|
+
export async function claimHostedOwner({ hook, setupManifest, declaration, deployed, env, input = {}, displayName, supplied = [], secret, token: hookToken, addSecret, beforeClaim, recordClaim, inspect, store, signal, fetch = globalThis.fetch }) {
|
|
17
17
|
const claim = setupManifest?.steps?.find(step => step.type === 'owner-claim');
|
|
18
18
|
if (!hook || !['object', 'function'].includes(typeof hook) || Array.isArray(hook) || !deployed.origin) {
|
|
19
19
|
if (declaration.secrets?.some(item => item.binding === (claim?.tokenField ?? 'SETUP_TOKEN'))) throw ownerFailure('the owner bootstrap hook is unavailable');
|
|
@@ -52,7 +52,7 @@ export async function claimHostedOwner({ hook, setupManifest, declaration, deplo
|
|
|
52
52
|
return retire(linked.ownerOutcome);
|
|
53
53
|
}
|
|
54
54
|
if (typeof hook === 'function') {
|
|
55
|
-
const context = { origin: deployed.origin, vars: { ...env, [tokenKey]: token }, input
|
|
55
|
+
const context = { origin: deployed.origin, vars: { ...env, [tokenKey]: token }, input, store, signal, ownerClaim: claim, fail: () => ownerFailure('the seed owner hook failed') };
|
|
56
56
|
let observed, exchanges = [];
|
|
57
57
|
try {
|
|
58
58
|
if (deployed.observedOwner) await hook(context);
|
|
@@ -69,7 +69,7 @@ export async function claimHostedOwner({ hook, setupManifest, declaration, deplo
|
|
|
69
69
|
if (!['claimed', 'kept'].includes(outcome)) throw ownerFailure('the seed owner hook did not confirm its bootstrap exchange');
|
|
70
70
|
return retire(outcome);
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
displayName = (typeof hook.displayName === 'function' ? hook.displayName(input) : undefined) || displayName || 'Owner';
|
|
73
73
|
let response, code = 'no code';
|
|
74
74
|
try {
|
|
75
75
|
response = await ownerClaimRequest(fetch, new URL(hook.path ?? '/auth/bootstrap', deployed.origin), { method: 'POST',
|
package/cli/deploy.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { packageBuild } from '../modules/deploy-kit/prepare.mjs';
|
|
|
10
10
|
import { refuseLocalModels } from '../modules/deploy-kit/local-only.mjs';
|
|
11
11
|
import { deployEnvironment, deployAgain } from './deploy-inputs.mjs';
|
|
12
12
|
import { claimHostedOwner } from './deploy-owner.mjs';
|
|
13
|
+
import { deployOwnerInput } from './deploy-owner-input.mjs';
|
|
13
14
|
import { checkHostedSetup, hostedSetupFailure } from './deploy-setup.mjs';
|
|
14
15
|
import { mutationReadinessFailure } from './deploy-readiness.mjs';
|
|
15
16
|
import { committedSource } from './deploy-source.mjs';
|
|
@@ -21,7 +22,7 @@ import { withoutLocalSettings, refuseLocalEnvOutput } from './local-env.mjs';
|
|
|
21
22
|
|
|
22
23
|
export function ownerDeploy(declarationPath, lifecycle) {
|
|
23
24
|
// rer verify serves the build with this declaration's vars and secrets.
|
|
24
|
-
return Object.assign(async ({ root, options, store, signal, operationToken, localOnlyKeys = [], checkBuild = async () => {}, setupManifest, setupSeed, linkDependencies }) => {
|
|
25
|
+
return Object.assign(async ({ root, options, store, signal, operationToken, localOnlyKeys = [], checkBuild = async () => {}, setupManifest, setupSeed, linkDependencies, adapter = lifecycle }) => {
|
|
25
26
|
try { await refuseLocalModels(root); } catch { throw refuse('Deploy refuses the local-only key file .rer/local/models.json. Remove live-dev credentials before deployment.'); }
|
|
26
27
|
const path = await contained(root, declarationPath);
|
|
27
28
|
let declaration; try { declaration = JSON.parse(await readFile(path, 'utf8')); } catch { throw invalid('Malformed owner-account deploy declaration.'); }
|
|
@@ -37,11 +38,12 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
37
38
|
const recordedState = change.length ? await deploymentRecord(root, options) : undefined;
|
|
38
39
|
// A dry run reads the settings file too, so a refused key fails here and not only on the real deploy.
|
|
39
40
|
if (options.dryRun && options.envFile) await deployEnvironment({ root, options, declaration, localOnlyKeys });
|
|
40
|
-
let production;
|
|
41
|
+
let production, ownerInput;
|
|
41
42
|
if (!change.length) {
|
|
42
43
|
production = await deployEnvironment({ root, options, declaration, setupManifest, settings: lifecycle.settings, localOnlyKeys });
|
|
43
44
|
await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed, adapter: lifecycle, declarationPath, options });
|
|
44
45
|
if (!options.dryRun) committedSource(root, options);
|
|
46
|
+
ownerInput = await deployOwnerInput({ root, adapter, setupSeed, options, signal });
|
|
45
47
|
await withoutLocalSettings(root, { settings: lifecycle.settings, operationToken }, () => lifecycle.run(root, {}, store, () => {}, signal, { verb: 'build', operationToken }));
|
|
46
48
|
await checkBuild();
|
|
47
49
|
await refuseLocalEnvOutput(root);
|
|
@@ -112,7 +114,7 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
112
114
|
step = 'claim owner';
|
|
113
115
|
const { liveSecrets, retiredSecrets, ownerClaim } = await owner('inspect', [], env, {propagation:deployed.propagation});
|
|
114
116
|
const linked = token => linkDependencies?.(deployed.origin, token);
|
|
115
|
-
const claimed = await claimHostedOwner({ hook: lifecycle.hooks?.owner, setupManifest, declaration, deployed: { ...deployed, propagation:deployed.propagation, liveSecrets, retiredSecrets, ownerClaim }, env, supplied, addSecret: value => { redaction.addSecrets([value]); store.addSecrets?.([value]); },
|
|
117
|
+
const claimed = await claimHostedOwner({ hook: lifecycle.hooks?.owner, setupManifest, declaration, deployed: { ...deployed, propagation:deployed.propagation, liveSecrets, retiredSecrets, ownerClaim }, env, ...ownerInput, supplied, addSecret: value => { redaction.addSecrets([value]); store.addSecrets?.([value]); },
|
|
116
118
|
secret: (extra, values) => owner('secret', extra, values), beforeClaim: linked, recordClaim: outcome => owner('record-owner', ['--outcome', outcome]), inspect: () => owner('inspect', [], env, {propagation:deployed.propagation}), store, signal });
|
|
117
119
|
// A seed that claims its owner its own way links with the token it was given.
|
|
118
120
|
if (claimed === undefined) await linked(env[declared(claim?.tokenField ?? 'SETUP_TOKEN')?.environment]);
|
package/cli/parse.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { isLoopbackHost } from '../modules/operator-auth/loopback.mjs';
|
|
|
5
5
|
import { normalizeEmail } from '../modules/operator-auth/policy.mjs';
|
|
6
6
|
const booleans = new Set(['--help', '--json', '--non-interactive', '--yes', '--dry-run', '--stop', '--detach', '--foreground', '--no-queue', '--login', '--legacy-v1', '--acknowledge-unverified-metadata', '--door', '--direct', '--site', '--remove', '--demo']);
|
|
7
7
|
export const mailbox = value => typeof value === 'string' && value.length <= 254 && /^[a-zA-Z0-9.!+_%\-]+@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)+$/.test(value);
|
|
8
|
+
export const validOwnerName = value => typeof value === 'string' && Boolean(value.trim()) && value.length <= 200 && !/[\p{Cc}\p{Cf}]/u.test(value);
|
|
8
9
|
// A loopback host: the shared predicate (including `*.localhost` door names),
|
|
9
10
|
// plus `::1` as --host and a bracket-stripped hostname spell it.
|
|
10
11
|
export const loopback = host => host === '::1' || isLoopbackHost(host);
|
|
@@ -81,7 +82,7 @@ export function parse(argv, cwd = process.cwd(), { independent = false, deferTai
|
|
|
81
82
|
if(options.platform !== undefined && !['workers','container'].includes(options.platform))throw invalid('Platform must be workers or container.');
|
|
82
83
|
if (options.host !== undefined && !(verb === 'deploy' && options.platform === 'container') && !listenHost(options.host)) throw refuse('Host must be exactly 127.0.0.1, localhost or ::1.');
|
|
83
84
|
if (options.ownerEmail !== undefined) { if (!mailbox(options.ownerEmail)) throw invalid('Provide a valid plain owner mailbox.'); options.ownerEmail = options.ownerEmail.toLowerCase(); }
|
|
84
|
-
if (options.ownerName !== undefined && (options.ownerName
|
|
85
|
+
if (options.ownerName !== undefined && !validOwnerName(options.ownerName)) throw invalid('Provide a valid owner name.');
|
|
85
86
|
if (options.target !== undefined && !['local', 'remote'].includes(options.target)) throw invalid('Target must be local or remote.');
|
|
86
87
|
if (options.profile !== undefined && options.profile !== 'first-party') throw invalid('The supported explicit profile is first-party.');
|
|
87
88
|
if (options.environment !== undefined && !/^[a-z][a-z0-9-]{0,39}$/.test(options.environment)) throw invalid('Provide a valid deployment environment name.');
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.54
|
|
4
|
+
|
|
5
|
+
- **Dev launch handoffs keep the requested lifetime.** An explicit `rer dev --foreground` or `--detach` survives preparation that installs a checkout’s pinned rer and hands off to its launcher. The default terminal behavior stays the same (#258).
|
|
6
|
+
- **Hosted installs keep the setup owner name.** Deploy carries the name saved by setup into hosted owner bootstrap. When a declared name is missing, interactive deploy asks once and saves it; unattended deploy requires `--owner-name` before uploading. Installers without a name field keep their existing behavior (#257).
|
|
7
|
+
|
|
8
|
+
## 0.2.53
|
|
9
|
+
|
|
10
|
+
- **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).
|
|
11
|
+
- **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).
|
|
12
|
+
|
|
3
13
|
## 0.2.52
|
|
4
14
|
|
|
5
15
|
- **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).
|
package/global/launch/dev.mjs
CHANGED
|
@@ -35,7 +35,7 @@ export async function launchDev(target) {
|
|
|
35
35
|
}
|
|
36
36
|
// An invocation the pinned dispatcher refuses goes straight to it, so the
|
|
37
37
|
// refusal is its own, with nothing prepared first.
|
|
38
|
-
if (!await accepted(target.root, devArgs)) return
|
|
38
|
+
if (!await accepted(target.root, devArgs)) return delegateDev(target);
|
|
39
39
|
const checkout = await realpath(target.root), directory = await launchDirectory(checkout);
|
|
40
40
|
if (devArgs.includes('--stop')) {
|
|
41
41
|
try { return await stopLaunch(target, devArgs, { checkout, directory }); }
|
|
@@ -47,6 +47,14 @@ export async function launchDev(target) {
|
|
|
47
47
|
return detach ? detached(target, devArgs, directory, out, doorStart) : foreground(target, devArgs, directory, out, doorStart);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// Preparation can install a pin whose entry is another global launcher. Keep
|
|
51
|
+
// the caller's lifetime flags across that handoff. The internal front-door
|
|
52
|
+
// marker reaches other launchers, but never the public dispatcher.
|
|
53
|
+
function delegateDev(target) {
|
|
54
|
+
const { launcher } = dispatcher(target.root);
|
|
55
|
+
return delegate(target, launcher ? target.args : target.args.filter(arg => arg !== '--door-start'));
|
|
56
|
+
}
|
|
57
|
+
|
|
50
58
|
async function doorCapable(root) {
|
|
51
59
|
try { return Boolean((await describeCheckout(root, dispatcher(root).entry, process.env)).door); } catch { return true; }
|
|
52
60
|
}
|
|
@@ -72,7 +80,7 @@ async function foreground(target, devArgs, directory, out, doorStart) {
|
|
|
72
80
|
catch (failure) { if (!(failure instanceof LaunchFailure)) throw failure; out.failure(failure); return failure.exitCode; }
|
|
73
81
|
finally { clearInterval(heartbeat); log.end(); }
|
|
74
82
|
Object.assign(process.env, prepared.added);
|
|
75
|
-
return
|
|
83
|
+
return delegateDev(target);
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
async function detached(target, devArgs, directory, out, doorStart) {
|
package/onboarding/README.md
CHANGED
|
@@ -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
|
package/onboarding/busy.mjs
CHANGED
|
@@ -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(['
|
|
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`;
|
package/onboarding/queue.mjs
CHANGED
|
@@ -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
|
-
|
|
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,
|
package/onboarding/ui/style.css
CHANGED
|
@@ -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}
|
|
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
|
|
package/onboarding/ui/theme.css
CHANGED
|
@@ -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}
|