@runeditrun/rer 0.2.117 → 0.2.118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -531,12 +531,6 @@ different origin or Business: disconnect first or use a separate
531
531
  `RER_BUSINESS_STATE_DIR`. It reports this computer's plain name, working folder,
532
532
  agent and OS (including WSL) for the owner to recognise.
533
533
 
534
- For older Business pages, `rer business connect --code ABCD-1234 --origin URL`
535
- keeps the browser-created code and six-digit confirmation-number flow unchanged
536
- in 0.2.98. It cannot be combined with `--business` or `--timeout`. Removal is
537
- planned for a later release after the production rollback target uses device pairing.
538
- The install.sh form still passes either connect command through unchanged.
539
-
540
534
  The owner chooses three things on the computer's row in the browser: "Add rules
541
535
  so Claude Code never reads your secret files" (Claude Code user Read deny
542
536
  rules), "Keep this computer awake while it works" (recorded; nothing keeps the computer awake now that rer runs no exports) and "Install the background service" (a launchd or systemd user
package/cli/README.md CHANGED
@@ -292,6 +292,17 @@ anything is built or uploaded. The seed owns what an installation does with mail
292
292
  off, and turning mail on later is a `rer deploy --set-secret` of the provider
293
293
  inputs the seed documents.
294
294
 
295
+ The adapter must apply that selection to the runtime as well as pass preflight.
296
+ For example, the foundation declares optional `MAIL_PROVIDER` and `MAIL_FROM`
297
+ environment-to-binding mappings in `deploy.json`, and makes `MAIL_API_KEY`
298
+ optional there; production preflight still requires all enabled-provider inputs.
299
+ Its mail facade returns no sender for `none`, so email requests report
300
+ `mail_unavailable` rather than claiming delivery. Independently authored adapters
301
+ must implement their own matching contract. Declarative operations loops can
302
+ offer `none` for optional mail; required delivery loops continue to fail while off.
303
+
304
+ — Codex, 2026-11-15T03:31:15Z
305
+
295
306
  The production preflight also reads the product's `artifact.specInputs` in
296
307
  `rer-packaging.json`, `packaging.json` or `scripts/delivery/base/packaging.json`,
297
308
  and `management/integration/deployment-spec.json`. Public inputs come from
@@ -8,7 +8,8 @@ import { describe } from './errors.mjs';
8
8
  import { identifier, originUrl } from './api.mjs';
9
9
  import { appAddress, appSignInHelp } from '../app-address.mjs';
10
10
 
11
- const usage = `Set up your business: rer business connect
11
+ const usage = `Set up your business: rer business connect --business ID
12
+ The Business Connect page names the ID.
12
13
  Business keeps your business name, logo and brand colour together for the apps
13
14
  that support shared Business settings. Choose what to share in your browser.
14
15
 
@@ -19,7 +20,6 @@ Advanced commands (Usage: rer business VERB)
19
20
  scan [DIR...] [--json] Names-only local discovery
20
21
  connect --business ID [--origin URL] [--timeout SECONDS]
21
22
  Print a code and link for the owner to approve in a signed-in browser
22
- Older Business pages: connect --code CODE [--origin URL]
23
23
  Connect carries the Business name into local apps
24
24
  run [--once] Work this computer's tasks: the folder scan the owner allows. Says what
25
25
  it is doing and what it waits for; applies the owner's choices at each
@@ -72,13 +72,12 @@ the code's 10 minutes), then keeps the credential in OS credential storage.
72
72
  --origin URL Business platform address (default: ${appAddress}).
73
73
  --timeout SECONDS Wait at most this long, then exit 75 with the pairing kept;
74
74
  run the same command again to keep waiting (same code).
75
- --code CODE Older Business pages: redeem a code made in the browser.
76
75
  Exits 0 connected, 1 ended (refused, expired or failed), 2 usage, 75 still waiting.
77
76
  `,
78
77
  token: `Usage: rer business token
79
78
  Print an MCP Authorization header object for this computer's paired Business.
80
79
  Send this headersHelper output directly to the MCP client; it contains a credential.
81
- Requires an existing pairing: rer business connect.
80
+ Requires an existing pairing: rer business connect --business ID (the Connect page names the ID).
82
81
  `,
83
82
  };
84
83
 
@@ -93,11 +92,9 @@ export async function businessCommand(argv) {
93
92
  const options = {};
94
93
  for (let index = 0; index < args.length; index += 2) {
95
94
  const name = args[index];
96
- if (!['--code', '--origin', '--business', '--timeout'].includes(name) || !args[index + 1] || args[index + 1].startsWith('--') || Object.hasOwn(options, name.slice(2))) return invalid();
95
+ if (!['--origin', '--business', '--timeout'].includes(name) || !args[index + 1] || args[index + 1].startsWith('--') || Object.hasOwn(options, name.slice(2))) return invalid();
97
96
  options[name.slice(2)] = args[index + 1];
98
97
  }
99
- if (options.code !== undefined && !/^[A-Za-z0-9]{4}-?[A-Za-z0-9]{4}$/.test(options.code)) return invalid();
100
- if (options.code !== undefined && (options.business !== undefined || options.timeout !== undefined)) return invalid();
101
98
  if (options.timeout !== undefined) {
102
99
  if (!/^\d{1,3}$/.test(options.timeout) || Number(options.timeout) > 900) return invalid();
103
100
  options.timeout = Number(options.timeout);
@@ -106,7 +103,7 @@ export async function businessCommand(argv) {
106
103
  if (options.business !== undefined) identifier(options.business);
107
104
  if (options.origin !== undefined && options.business !== undefined) originUrl(options.origin);
108
105
  } catch { return invalid(); }
109
- if (options.origin !== undefined && options.code === undefined && options.business === undefined) originUrl(options.origin);
106
+ if (options.origin !== undefined && options.business === undefined) originUrl(options.origin);
110
107
  await connect(options);
111
108
  } else if (verb === 'done' && args.length === 3) await done(...args);
112
109
  else if (verb === 'answer' && [3, 4].includes(args.length)) await answer(...args);
@@ -17,113 +17,15 @@ const approvalWindow = 600_000;
17
17
  export const capabilities = ['discover.local'];
18
18
 
19
19
  const clock = time => new Date(time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
20
- const nothingSent = 'Nothing was sent, so the pairing code still works.';
21
-
22
- /** Pair (or resume a saved pairing) and wait in the foreground until the owner
23
- * approves or refuses in the browser, or the code expires. Exit 0 means the
24
- * computer is active: its credential is stored and the server has seen it.
25
- */
20
+ /** Pair (or resume a saved device pairing) and wait for the owner to approve. */
26
21
  export async function connect(options = {}) {
27
22
  if (options.business !== undefined) return connectDevice(options);
28
23
  const pending = await loadPending();
29
- // Approval can outlive the original code deadline. A legacy command must
30
- // not discard a device pairing that is still within its collection window.
31
- if (pending?.flow === 'device' && options.code !== undefined && Date.parse(pending.keep_until) > Date.now()) throw Error('Business is already waiting for a device pairing. Resume that command, or run business disconnect before using another code.');
32
- if (pending?.flow === 'device' && options.code === undefined) return connectDevice(options);
33
- return connectLegacy(options);
34
- }
35
-
36
- // Removal of the browser-created --code flow is planned for a later release,
37
- // once the production rollback target uses device pairing.
38
- async function connectLegacy({ code, origin } = {}) {
24
+ if (pending?.flow === 'device') return connectDevice(options);
39
25
  const stored = await loadState();
40
- let pending = await loadPending();
41
- origin = originUrl(origin ?? stored?.origin ?? pending?.origin);
42
- if (stored) {
43
- if (stored.revoked) throw Error(`This computer was ${revokedText(stored)}\nThen connect with a new code from ${stored.origin}/business.`);
44
- if (stored.origin !== origin) throw Error(`This computer is already connected to Business at ${stored.origin}. Run ${rerCommand()} business disconnect before connecting it elsewhere.`);
45
- const credential = await createCredentialStore().get(deviceCredentialHandle(stored));
46
- if (!credential) throw Error(`This computer's Business credential is missing from OS credential storage. Run ${rerCommand()} business disconnect, then connect again with a new code from ${origin}/business.`);
47
- await connected(new Api(origin, credential), stored, { reconnecting: true });
48
- return;
49
- }
50
- if (pending && Date.parse(pending.expires_at) <= Date.now()) { await clearPending(); pending = null; }
51
- if (pending && (pending.origin !== origin || code && pending.code !== code)) throw Error(`Business is already waiting for approval of another code${pending.origin === origin ? '' : ` at ${pending.origin}`}. Run ${rerCommand()} business connect to resume it, or ${rerCommand()} business disconnect to drop it before using another code.`);
52
- if (!pending && !code) throw Error(`Set up your business: open ${origin}/business and take the prompt from the Business Connect page. It names the Business to join with --business.`);
53
- // Refuse before redeeming the one-use code or collecting an approval when this
54
- // session cannot keep the pairing or store the device credential.
55
- await checkStateWritable();
56
- const store = createCredentialStore();
57
- try { await store.check(); }
58
- catch (error) {
59
- const outside = error.sandboxRefused ? ` Approve this command outside the sandbox: ${rerCommand()} business connect${code ? ` --code ${code}` : ''} --origin ${origin}. Every other business command runs inside the sandbox.` : '';
60
- throw Error(`${error.message}${outside} ${pending ? 'The saved pairing was kept; run connect again once this is fixed.' : nothingSent}`);
61
- }
62
-
63
- // Ctrl-C or a stopped tool call never strands a pairing: the redeemed pairing
64
- // is saved before waiting, and a collected credential is stored before exit.
65
- const stop = new AbortController();
66
- const stopWith = signal => () => stop.abort(signal);
67
- const onInterrupt = stopWith('SIGINT'), onTerminate = stopWith('SIGTERM');
68
- process.on('SIGINT', onInterrupt); process.on('SIGTERM', onTerminate);
69
- try {
70
- const api = new Api(origin);
71
- if (!pending) {
72
- // The computer's plain name and the folder connect runs in help the owner
73
- // recognise this computer and prefill the scan folder; each is left out when empty.
74
- const name = deviceName(), folder = workingFolder();
75
- const response = await api.post('/api/business/executors/pair', {
76
- code, ...(name ? { device_name: name } : {}), ...(folder ? { working_folder: folder } : {}),
77
- os: process.platform === 'darwin' ? 'macos' : 'linux', agent_kind: agentKind(), capabilities,
78
- }).catch(error => { throw error.status === 401 ? Error(`Business did not accept code ${code}: it has expired or was already used${error.reason ? ` (the server said: ${error.reason})` : ''}. Create a new code in ${origin}/business.`) : error; });
79
- const expires = Math.min(Date.now() + 600_000, Date.parse(response?.expires_at));
80
- if (response?.status !== 'pending_approval' || !/^\d{6}$/.test(response.confirmation_number) || typeof response.pairing_token !== 'string' || !response.pairing_token || !Number.isFinite(expires) || expires <= Date.now()) throw Error('Business server returned an invalid pairing response.');
81
- pending = { origin, code, pairing_token: response.pairing_token, confirmation_number: response.confirmation_number, code_expires_at: new Date(expires).toISOString(), expires_at: new Date(expires + approvalWindow).toISOString() };
82
- await savePending(pending);
83
- }
84
- const resume = `${rerCommand()} business connect --origin ${origin}`;
85
- const until = pending.code_expires_at ? ` until ${clock(pending.code_expires_at)}, when the code expires` : ' until the code expires';
86
- process.stdout.write(`Confirmation number: ${pending.confirmation_number}\nCompare this number in the browser that created the code, then approve there.\nWaiting for approval in ${origin}/business${until}. Keep this command running.\nIf it stops, run ${resume} to resume this pairing.\n`);
87
- while (Date.now() < Date.parse(pending.expires_at)) {
88
- if (stop.signal.aborted) break;
89
- let result;
90
- try { result = await api.post('/api/business/executors/pair', { pairing_token: pending.pairing_token }, { signal: stop.signal }); }
91
- catch (error) {
92
- if (stop.signal.aborted) break;
93
- if ([401, 403, 410].includes(error.status)) {
94
- await clearPending();
95
- throw Error(`Business pairing ended without approval: the owner refused it, or the code expired${error.reason ? ` (the server said: ${error.reason})` : ''}. Create a new code in ${origin}/business and run connect with it.`);
96
- }
97
- throw error;
98
- }
99
- if (result?.status === 'paired') {
100
- if (typeof result.device_credential !== 'string') throw Error('Business server returned an invalid device credential.');
101
- const folder = workingFolder();
102
- const state = { version: 1, credentialVersion: 2, origin, businessId: identifier(result.business_id), executorId: identifier(result.executor_id), vendorHandles: [], awakeConsent: false, ...(folder ? { workingFolder: folder } : {}) };
103
- const handle = credentialHandle(origin, state.businessId);
104
- // No authenticated request (including activation) before both durable writes.
105
- await store.set(handle, result.device_credential);
106
- try { await saveState(state); } catch (error) { await store.delete(handle); throw error; }
107
- await clearPending();
108
- process.stdout.write('Approved. Device credential stored in OS credential storage.\n');
109
- await connected(new Api(origin, result.device_credential), state);
110
- return;
111
- }
112
- if (['denied', 'refused', 'expired'].includes(result?.status)) {
113
- await clearPending();
114
- throw Error(`Business pairing was ${result.status === 'expired' ? 'not approved before the code expired' : 'refused in the browser'}. Create a new code in ${origin}/business and run connect with it.`);
115
- }
116
- if (result?.status !== 'authorization_pending') throw Error('Business server returned an invalid pairing status.');
117
- try { await pause(Math.max(1, Math.min(5, Number(result.interval) || 5)) * 1000, stop.signal); } catch { break; }
118
- }
119
- if (stop.signal.aborted) {
120
- throw new Stopped(`Stopped waiting for approval. The pairing is saved: run ${resume} to resume it${pending.code_expires_at ? ` before ${clock(pending.code_expires_at)}` : ''}.`, stop.signal.reason === 'SIGTERM' ? 143 : 130);
121
- }
122
- await clearPending();
123
- throw Error(`Business pairing code expired before it was approved. Create a new code in ${origin}/business and run connect with it.`);
124
- } finally {
125
- process.off('SIGINT', onInterrupt); process.off('SIGTERM', onTerminate);
126
- }
26
+ if (stored) return connectDevice({ ...options, business: stored.businessId });
27
+ const origin = originUrl(options.origin ?? pending?.origin);
28
+ throw Error(`Set up your business: open ${origin}/business and take the prompt from the Business Connect page. It names the ID for ${rerCommand()} business connect --business ID.`);
127
29
  }
128
30
 
129
31
  const shortCode = /^[2-9A-HJKMNP-Z]{4}-[2-9A-HJKMNP-Z]{4}$/;
@@ -153,7 +55,7 @@ async function connectDevice({ business, origin, timeout } = {}) {
153
55
  process.on('SIGINT', interrupt); process.on('SIGTERM', terminate);
154
56
  let pending, resume, timer, unlock;
155
57
  try {
156
- await checkStateWritable({ codeExists: false });
58
+ await checkStateWritable();
157
59
  unlock = await lockPairing(stop.signal);
158
60
  const stored = await loadState();
159
61
  pending = await loadPending();
@@ -13,10 +13,10 @@ import { supportsTaskKind } from './supervisor.mjs';
13
13
 
14
14
  export async function paired() {
15
15
  const state = await loadState();
16
- if (!state?.origin || !state.businessId || !state.executorId) throw Error(`This computer is not paired. Run ${rerCommand()} business connect --code CODE.`);
16
+ if (!state?.origin || !state.businessId || !state.executorId) throw Error(`This computer is not paired. Run ${rerCommand()} business connect --business ID; the Business Connect page names the ID.`);
17
17
  if (state.revoked) throw Error(`This computer was ${revokedText(state)}`);
18
18
  const credential = await createCredentialStore().get(deviceCredentialHandle(state));
19
- if (!credential) throw Error(`This computer's Business credential is missing from OS credential storage. Run ${rerCommand()} business disconnect, then connect again with a new code from ${state.origin}/business.`);
19
+ if (!credential) throw Error(`This computer's Business credential is missing from OS credential storage. Run ${rerCommand()} business disconnect, then run ${rerCommand()} business connect --business ID; the Connect page at ${state.origin}/business names the ID.`);
20
20
  return { state, credential };
21
21
  }
22
22
 
@@ -57,12 +57,12 @@ async function saveJson(name, value) {
57
57
  } finally { await unlink(temporary).catch(error => { if (error.code !== 'ENOENT') throw error; }); }
58
58
  }
59
59
 
60
- /** Before a one-use code is spent or an approval collected, prove the state
60
+ /** Before a pairing starts or an approval is collected, prove the state
61
61
  * folder takes the same private create, write and replace the pairing needs.
62
62
  * Folders made only for the check are removed again, so a refused connect
63
63
  * leaves nothing behind.
64
64
  */
65
- export async function checkStateWritable({ codeExists = true } = {}) {
65
+ export async function checkStateWritable() {
66
66
  const directory = stateDirectory(), probe = join(directory, `${randomUUID()}.tmp`), created = [];
67
67
  for (let path = directory; path !== dirname(path); path = dirname(path)) {
68
68
  try { await lstat(path); break; } catch (error) { if (error.code !== 'ENOENT') break; created.push(path); }
@@ -78,7 +78,7 @@ export async function checkStateWritable({ codeExists = true } = {}) {
78
78
  const fix = chosenStateDirectory()
79
79
  ? 'Allow writes to that folder in this session, or set RER_BUSINESS_STATE_DIR to a folder this session can write'
80
80
  : 'Allow writes to that folder, or set RER_BUSINESS_STATE_DIR to a folder this session can write (in Codex, one inside the working folder, such as RER_BUSINESS_STATE_DIR="$PWD/.rer-business")';
81
- throw Error(`Business cannot save its state in ${directory}: ${localCause(error) ?? error.message}. ${codeExists ? 'Nothing was sent, so the pairing code still works.' : 'Nothing was sent.'} ${fix}, then run connect again.`);
81
+ throw Error(`Business cannot save its state in ${directory}: ${localCause(error) ?? error.message}. Nothing was sent. ${fix}, then run connect again.`);
82
82
  } finally {
83
83
  for (const path of created) await rmdir(path).catch(() => {});
84
84
  }
package/cli/contract.mjs CHANGED
@@ -12,8 +12,8 @@ const definitions = {
12
12
  verify: [[], 'Run the complete internal verification target.'],
13
13
  reset: [['--yes'], 'Confirmed removal of the declared local inventory only.'],
14
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', '--reopen-installation-key'], 'Owner-account deployment and health; dry run builds and validates the local deployment plan, printing target names, bindings and migration names. No Cloudflare credentials or requests are needed and nothing changes remotely. Valid fixture senders on .test, .example, .invalid, .localhost and example.com, example.net or example.org (including subdomains) are accepted only in a dry run; real deploys refuse placeholder senders. Dry run never prompts for or requires a missing owner name, saves no name and bypasses custom deploy hooks and their owner-email preflight. Target secrets, permissions and remote readiness are checked only by a real deploy. 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. For a real deploy, the managed adapter checks its hosted owner email before rer resolves the owner name, so its placeholder-email refusal comes first. 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. --reopen-installation-key KID temporarily binds a retired installation key from private custody, reseals restored dependency keys under the current key, verifies them and removes the previous binding. --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
- export: [['--target', '--output', '--origin', '--session-file'], 'For owner move-in, run rer dev and open /app/import: export people there, then upload through the destination door. Developer-only installation backup: 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
- import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--acknowledge-unverified-schema-objects', '--output'], 'For owner move-in, run rer dev and open /app/import: upload, review and apply through the door. Developer-only installation recovery: 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. A v2 archive without schemaObjects requires --acknowledge-unverified-schema-objects, an empty destination and compatible destination migration history; its receipt records schemaUnverified. A fresh export from current rer is preferred; current archives need no acknowledgment.'],
15
+ export: [['--target', '--output', '--origin', '--session-file'], 'For owner move-in, run rer dev and open the app\'s signed-in Move in page (/app/import in the Base reference; the project\'s own docs name its path): export people there, then upload through the destination door. Developer-only installation backup: 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
+ import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--acknowledge-unverified-schema-objects', '--output'], 'For owner move-in, run rer dev and open the app\'s signed-in Move in page (/app/import in the Base reference; the project\'s own docs name its path): upload, review and apply through the door. Developer-only installation recovery: 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. A v2 archive without schemaObjects requires --acknowledge-unverified-schema-objects, an empty destination and compatible destination migration history; its receipt records schemaUnverified. A fresh export from current rer is preferred; current archives need no acknowledgment.'],
17
17
  doctor: [[], 'Read-only installed tool, configuration and state diagnostics.', 'never'],
18
18
  describe: [[], 'Read-only description of actual command capabilities.'],
19
19
  check: [['--profile'], 'Read-only structural command contract and operations validation.'],
package/cli/inspect.mjs CHANGED
@@ -253,9 +253,14 @@ export async function doctor(project, store, signal) {
253
253
  const firstParty = project.profile === 'first-party';
254
254
  const workflowInputs = firstParty ? diagnostic.missingEnvironment.filter(name => buildWorkflowInput.test(name)) : [];
255
255
  const deploymentInputs = firstParty ? diagnostic.missingEnvironment.filter(name => !buildWorkflowInput.test(name) && !inputs.includes(name) && !(typeof values[name] === 'string' && values[name].trim())) : [];
256
+ // A required loop that waits only on inputs a deployment supplies (a hosted mail provider's key, say) is ready for
257
+ // local use: the local app suppresses that delivery. Its inputs are named with the other deploy inputs.
258
+ const deployOnlyLoop = loop => firstParty && loop.status === 'missing-inputs' && (loop.missingEnvironment ?? []).every(name => !inputs.includes(name));
259
+ const loopDeploymentInputs = (diagnostic.loops ?? []).filter(deployOnlyLoop).flatMap(loop => loop.missingEnvironment ?? []);
256
260
  if (firstParty) {
257
261
  diagnostic.missingEnvironment = diagnostic.missingEnvironment.filter(name => inputs.includes(name));
258
- diagnostic.ok = diagnostic.commands.every(command => command.available) && !diagnostic.missingEnvironment.length && diagnostic.configuration === 'valid' && (diagnostic.loops ?? []).every(loop => ['ready', 'optional-disabled'].includes(loop.status));
262
+ diagnostic.ok = diagnostic.commands.every(command => command.available) && !diagnostic.missingEnvironment.length && diagnostic.configuration === 'valid' && (diagnostic.loops ?? []).every(loop => ['ready', 'optional-disabled'].includes(loop.status) || deployOnlyLoop(loop));
263
+ diagnostic.loops = (diagnostic.loops ?? []).map(loop => deployOnlyLoop(loop) ? { ...loop, deploymentOnly: true } : loop);
259
264
  }
260
265
  const setupNeeded = firstParty ? !(await localState(project)).prepared : false;
261
266
  const warnings = project.profile === 'first-party' ? await cacheWarnings(project.root) : [];
@@ -263,7 +268,7 @@ export async function doctor(project, store, signal) {
263
268
  node: { actual: process.versions.node, expected: expectedNode },
264
269
  pnpm: project.profile === 'first-party' ? { actual: pnpm, expected: expectedPnpm ?? null, ...(pnpmIssues.length ? { issue: [...new Set(pnpmIssues)].join('\n') } : {}) } : undefined,
265
270
  ai: { issues: aiIssues },
266
- missingInputs: [...new Set([...diagnostic.missingEnvironment, ...inputs])], deploymentInputs, workflowInputs, setupNeeded: setupNeeded || (!firstParty && diagnostic.missingEnvironment.length > 0),
271
+ missingInputs: [...new Set([...diagnostic.missingEnvironment, ...inputs])], deploymentInputs: [...new Set([...deploymentInputs, ...loopDeploymentInputs])], workflowInputs, setupNeeded: setupNeeded || (!firstParty && diagnostic.missingEnvironment.length > 0),
267
272
  sources: project.descriptor.environmentSources ?? {}, state: { path: project.adapter?.state, safe: stateValid, ...(stateIssue ? { issue: stateIssue } : {}) }, scope: 'local-inputs-only' };
268
273
  }
269
274
 
@@ -282,7 +287,7 @@ export function doctorSummary(result) {
282
287
  const unavailable = result.operations.commands.filter(command => !command.available);
283
288
  if (unavailable.length) lines.push('Unavailable command inputs:', ...unavailable.map(command => ` ${command.name}: restore its declared input files.`));
284
289
  if (result.operations.configuration === 'invalid') lines.push('Local configuration is invalid. Check the declared configuration module; private validator details are suppressed.');
285
- for (const loop of result.operations.loops ?? []) if (!['ready', 'optional-disabled'].includes(loop.status)) lines.push(`Loop ${loop.id}: ${loop.status}${loop.missingEnvironment?.length ? `; missing ${loop.missingEnvironment.join(', ')}` : ''}.`);
290
+ for (const loop of result.operations.loops ?? []) if (!['ready', 'optional-disabled'].includes(loop.status) && !loop.deploymentOnly) lines.push(`Loop ${loop.id}: ${loop.status}${loop.missingEnvironment?.length ? `; missing ${loop.missingEnvironment.join(', ')}` : ''}.`);
286
291
  if (!result.state.safe) lines.push(`Local state: ${result.state.issue}`);
287
292
  if (result.browser?.issue) lines.push(`Browser dependencies: ${result.browser.issue}`);
288
293
  else if (result.browser?.note) lines.push(result.browser.note);
package/cli/parse.mjs CHANGED
@@ -111,7 +111,7 @@ export function parse(argv, cwd = process.cwd(), { independent = false, deferTai
111
111
  export function help(verb) {
112
112
  if (!verb) return `Usage: rer VERB [FLAGS]\nCommands: ${Object.keys({...verbs, ...authoringVerbs}).join(', ')}, signin, size, release, listing, rehearse\nRun rer VERB --help for flags.\n${appSignInHelp}\n`;
113
113
  const known = verbs[verb] ?? authoringVerbs[verb] ?? (verb === 'signin' ? signinVerb : verb === 'size' ? sizeVerb : undefined);
114
- const door = ['export', 'import'].includes(verb) ? 'To move records, start the app and open its signed-in owner import door:\n\n rer dev\n\nOpen /app/import, then export or upload and review supported records there.\n\nTo back up or restore this installation:\n' : '';
114
+ const door = ['export', 'import'].includes(verb) ? 'To move records, start the app and open its signed-in owner import door:\n\n rer dev\n\nOpen its Move in page (/app/import in the Base reference; the project\'s own docs name its path), then export or upload and review supported records there.\n\nTo back up or restore this installation:\n' : '';
115
115
  return `${door}Usage: rer ${verb}${verb === 'refresh-base' ? ' --ref FULL_COMMIT' : ''} [FLAGS]\nFlags: ${(known?.flags ?? commonFlags).join(', ')}\n${known?.effects ?? 'Execute the declared OPERATIONS v2 argv with explicit arguments after --.'}\n`;
116
116
  }
117
117
 
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.118
4
+
5
+ ### Local diagnostics and Move in guidance
6
+
7
+ - After a clean `rer dev`, `rer doctor` treats required loops waiting only on deployment inputs as ready for local use and lists those inputs as optional locally and needed for deployment. It still checks local configuration, commands and required local inputs.
8
+ - Import and export help directs owners to the app's signed-in Move in page; `/app/import` is the Base reference path, and each project's own documentation names its path.
9
+
10
+ ### Business device pairing only
11
+
12
+ - Removed `rer business connect --code` and its browser-created pairing flow, help and recovery guidance. Pair with `rer business connect --business ID`; the Business Connect page names the ID. Saved device pairings can still resume.
13
+
14
+ ### Explicit outbound mail off
15
+
16
+ - Foundations accept an explicit `MAIL_PROVIDER=none` through declared environment-to-Worker bindings. Provider and sender bindings, and the mail key at the binding layer, are optional; mail off needs no sender or key and binds neither `MAIL_FROM` nor `MAIL_API_KEY`. An absent provider does not select off, and enabled providers still require their real sender and credentials. Conflicting mail-off credentials are refused.
17
+ - `rer deploy --dry-run` validates this choice, says outbound email is off and names `rer signin` for owner entry. Email sign-in links and invitations remain unavailable. A declared optional operations mail loop reports `optional-disabled`; a required delivery loop still fails when mail is off.
18
+
19
+ ### Recorded app target for owner sign-in
20
+
21
+ - `rer signin` selects the app Worker from the held ownership record, preserving its recorded account, project, environment and origin instead of recomputing the default Worker name. The selected identity must match the caller and live deployment. Wrong account, project or environment, missing or replaced Worker or receipt, and substitution of a public-page Worker refuse without issuing an owner grant.
22
+
23
+ These changes become available to seeds after adopting the released package or refreshed source. This preparation establishes no seed adoption, provider delivery, deployment or production result. The actual diff adds no migrations and changes neither modules/import-kit nor modules/portability.
24
+
3
25
  ## 0.2.117
4
26
 
5
27
  ### Size queue isolation and timeout attribution
package/global/README.md CHANGED
@@ -531,12 +531,6 @@ different origin or Business: disconnect first or use a separate
531
531
  `RER_BUSINESS_STATE_DIR`. It reports this computer's plain name, working folder,
532
532
  agent and OS (including WSL) for the owner to recognise.
533
533
 
534
- For older Business pages, `rer business connect --code ABCD-1234 --origin URL`
535
- keeps the browser-created code and six-digit confirmation-number flow unchanged
536
- in 0.2.98. It cannot be combined with `--business` or `--timeout`. Removal is
537
- planned for a later release after the production rollback target uses device pairing.
538
- The install.sh form still passes either connect command through unchanged.
539
-
540
534
  The owner chooses three things on the computer's row in the browser: "Add rules
541
535
  so Claude Code never reads your secret files" (Claude Code user Read deny
542
536
  rules), "Keep this computer awake while it works" (recorded; nothing keeps the computer awake now that rer runs no exports) and "Install the background service" (a launchd or systemd user
@@ -9,7 +9,7 @@ import { assert, hexId } from './validation.mjs';
9
9
  import { regularBytes } from './artifact.mjs';
10
10
  import { packageBuild } from './prepare.mjs';
11
11
  import { cloudflare } from './provider.mjs';
12
- import { ownerTarget, ownerWorkerName, ownerPlan, ownerDeploy, ownerHealth, settleOwnerState, sameDeployment, localOnlyBinding, withStateLock, readOwnerState, writeOwnerState, workerSettings, withScopeHints } from './owner.mjs';
12
+ import { ownerTarget, recordedOwnerTarget, ownerWorkerName, ownerPlan, ownerDeploy, ownerHealth, settleOwnerState, sameDeployment, localOnlyBinding, withStateLock, readOwnerState, writeOwnerState, workerSettings, withScopeHints } from './owner.mjs';
13
13
  import { activeWorker, secretBindings } from './worker.mjs';
14
14
  import { ownerSecret } from './owner-secret.mjs';
15
15
  import { ownerRemove } from './owner-remove.mjs';
@@ -97,11 +97,14 @@ export async function main(argv = process.argv.slice(2), env = process.env, {fet
97
97
  };
98
98
  // Transport must see the same outer signal when deciding whether to retry.
99
99
  const api = deploymentDiagnostics(cloudflare({accountId:env.CLOUDFLARE_ACCOUNT_ID,token:env.CLOUDFLARE_API_TOKEN,fetch:guardedRequest,requestSignal,budgetMigrations:command === 'deploy',...(command === 'remove' ? {maxRequests:Infinity,removal:true} : {})}),{onCreated});
100
+ const statePath = values.state ? resolve(root,values.state) : join(root,'.rer','deploy',`${values.environment}.json`);
101
+ // Signin uses only the selected app record; never discover a sibling page Worker.
100
102
  // Removal needs the recorded account/name identity, not a workers.dev route.
101
- const target = command === 'remove'
103
+ const target = command === 'signin'
104
+ ? await recordedOwnerTarget(api,{project:declaration.project,environment:values.environment,statePath})
105
+ : command === 'remove'
102
106
  ? {accountId:api.accountId,project:declaration.project,environment:values.environment,worker:ownerWorkerName(declaration.project,values.environment)}
103
107
  : await ownerTarget(api,{project:declaration.project,environment:values.environment});
104
- const statePath = values.state ? resolve(root,values.state) : join(root,'.rer','deploy',`${target.environment}.json`);
105
108
  if (command === 'remove') return {ok:true,...await ownerRemove({api,target,statePath}).catch(error => { throw api.annotateFailure(error,'remove'); })};
106
109
  if (command === 'rekey') return ownerRekey({api,target,statePath,declaration,env,notice});
107
110
  if (command === 'secret') {
@@ -100,15 +100,33 @@ async function listedAfterCreate(api, kind, item, {windowMs = LIST_WINDOW_MS, cl
100
100
  }
101
101
  }
102
102
  /** Reads the account's workers.dev subdomain; no other provider request. */
103
- export async function ownerTarget(provider, {project, environment}) {
103
+ async function workerOrigin(provider, worker) {
104
104
  const api = withScopeHints(provider);
105
- const worker = ownerWorkerName(project, environment);
106
105
  let result;
107
106
  try { result = await api.request('/workers/subdomain'); }
108
107
  catch (error) { if (error.status === 404) throw new Error('workers-subdomain-missing'); throw error; }
109
108
  assert(typeof result?.subdomain === 'string' && result.subdomain, 'workers-subdomain-missing');
110
109
  assert(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(result.subdomain),'invalid-account-subdomain');
111
- return {accountId:api.accountId,project,environment,worker,origin:`https://${worker}.${result.subdomain}.workers.dev`};
110
+ return `https://${worker}.${result.subdomain}.workers.dev`;
111
+ }
112
+ export async function ownerTarget(api, {project, environment}) {
113
+ const worker = ownerWorkerName(project, environment);
114
+ return {accountId:api.accountId,project,environment,worker,origin:await workerOrigin(api,worker)};
115
+ }
116
+
117
+ /** Signin follows the selected app record, including native uploaders' custom names.
118
+ * The caller still supplies the account, project and environment to validate it.
119
+ * Later state reads and the live provider check must corroborate this identity. */
120
+ export async function recordedOwnerTarget(api, {project, environment, statePath}) {
121
+ ownerWorkerName(project, environment); // Validate the caller's project and environment as usual.
122
+ let recorded;
123
+ try { recorded = JSON.parse(await regularBytes(statePath, 4 * 1024 * 1024)); }
124
+ catch (error) { throw new Error(error.code === 'ENOENT' ? 'missing-owner-receipt' : 'invalid-owner-state'); }
125
+ assert(resourceName(recorded?.worker), 'invalid-owner-state');
126
+ const target = {accountId:api.accountId,project,environment,worker:recorded.worker};
127
+ const state = await readOwnerState(statePath,target);
128
+ assert(state.receipt, 'missing-owner-receipt');
129
+ return {...target,origin:state.receipt.origin ?? await workerOrigin(api,target.worker)};
112
130
  }
113
131
 
114
132
  function entries(declaration, key) {
@@ -194,7 +194,7 @@ exclusive. For example:
194
194
  ```
195
195
 
196
196
  Every environment name must match `[A-Z][A-Z0-9_]*`. A nonempty `providers` map
197
- supports `sendgrid`, `resend`, `cloudflare` and `development` only. Every provider
197
+ supports `sendgrid`, `resend`, `cloudflare`, `development` and explicit `none`. Every provider
198
198
  entry declares `requiredEnvironment` (an empty array is allowed). Hosted entries
199
199
  also require `apiKeyEnvironment`; Cloudflare additionally requires
200
200
  `accountIdEnvironment`, checked as 32 hex characters. Those account declarations
@@ -204,6 +204,19 @@ configuration module remains responsible for its native sender and credential
204
204
  validation. A required mail loop still fails when foundation-only configuration
205
205
  is valid but mail has not been configured.
206
206
 
207
+ An optional mail loop may declare `"none": { "requiredEnvironment": [] }` in
208
+ its `binding.providers`. Only an explicit selector value of `none` turns that
209
+ loop off; its report says `optional-disabled` with `mailOff: true`, and the CLI
210
+ explains that no delivery is available and a declared provider must be configured
211
+ to enable it. A required loop selected to `none` still fails (`disabled-required`).
212
+ The off entry cannot declare credentials, sender requirements or development
213
+ settings, and cannot be a `whenUnset` default. The application's configuration
214
+ validator must honor the same deliberate off state. This inspection does not
215
+ send mail or verify a deployment; rer's deploy preflight independently checks
216
+ the mail-free sign-in declaration and rejects conflicting sending credentials.
217
+
218
+ — Codex, 2026-11-15T03:31:15Z
219
+
207
220
  Optional `whenUnset` declares a hosted provider and its inputs with the same
208
221
  shape. It applies only if the selector is absent (`undefined`), never for blank,
209
222
  unknown or non-string selectors. It cannot select development. Without
@@ -126,6 +126,8 @@ async function checkSummary(result, descriptor, root) {
126
126
  if (declaredInputs.size) lines.push(`Check the values you set for these declared input names: ${[...declaredInputs].sort().join(', ')}.`);
127
127
  }
128
128
  const blockedLoops = (result.loops ?? []).filter(loop => !['ready', 'optional-disabled'].includes(loop.status));
129
+ const mailOff = (result.loops ?? []).filter(loop => loop.mailOff);
130
+ if (mailOff.length) lines.push(`Outbound mail is off for ${mailOff.map(loop => loop.id).join(', ')}. No delivery is available; select and configure a declared mail provider to enable it.`);
129
131
  if (blockedLoops.length) lines.push(`Loops needing attention: ${blockedLoops.map(loop => `${loop.id} (${loop.status})`).join(', ')}.`);
130
132
  if (result.ok) lines.push('Remote deployment, provider access, and product acceptance remain unchecked.');
131
133
  else {
@@ -18,6 +18,11 @@ function fields(value, allowed) {
18
18
  }
19
19
 
20
20
  function mailInputs(provider, declaration, fallback = false) {
21
+ if (provider === 'none' && !fallback) {
22
+ fields(declaration, ['requiredEnvironment']);
23
+ if (!Array.isArray(declaration.requiredEnvironment) || declaration.requiredEnvironment.length) throw new Error('Mail off cannot require delivery inputs.');
24
+ return { provider, names: [] };
25
+ }
21
26
  fields(declaration, ['apiKeyEnvironment', 'requiredEnvironment', 'accountIdEnvironment', 'development', ...(fallback ? ['provider'] : [])]);
22
27
  if (![...hostedProviders, ...(fallback ? [] : ['development'])].includes(provider)
23
28
  || !Array.isArray(declaration.requiredEnvironment) || declaration.requiredEnvironment.some(name => !environmentName(name))) throw new Error('Invalid mail binding declaration.');
@@ -145,7 +150,9 @@ export function inspectRequiredLoops(descriptor, env) {
145
150
  const { providerEnvironment, providers, whenUnset } = loop.binding;
146
151
  const provider = env[providerEnvironment];
147
152
  const selected = provider === undefined ? whenUnset : typeof provider === 'string' && has(providers, provider) ? providers[provider] : undefined;
148
- result = selected ? inspectMailInputs(selected, env) : { status: 'invalid-mail-provider', missingEnvironment: [providerEnvironment] };
153
+ result = selected?.provider === 'none'
154
+ ? { status: loop.required ? 'disabled-required' : 'optional-disabled', missingEnvironment: [], mailOff: true }
155
+ : selected ? inspectMailInputs(selected, env) : { status: 'invalid-mail-provider', missingEnvironment: [providerEnvironment] };
149
156
  } else {
150
157
  result = inspectMailInputs(loop.selected, env);
151
158
  // Preserve the fixed-provider contract's truthy-selector mismatch behavior.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.117",
3
+ "version": "0.2.118",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",