@runeditrun/rer 0.2.99 → 0.2.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +30 -102
  2. package/cli/README.md +38 -25
  3. package/cli/app-address.mjs +2 -0
  4. package/cli/business/api.mjs +2 -1
  5. package/cli/business/choices.mjs +1 -1
  6. package/cli/business/command.mjs +36 -25
  7. package/cli/business/connect.mjs +1 -1
  8. package/cli/business/lease.mjs +0 -9
  9. package/cli/business/local-commands.mjs +1 -18
  10. package/cli/business/outbound.mjs +2 -14
  11. package/cli/business/questions.mjs +85 -48
  12. package/cli/business/service.mjs +1 -24
  13. package/cli/business/setup-command.mjs +33 -26
  14. package/cli/business/state.mjs +2 -2
  15. package/cli/business/supervisor.mjs +26 -91
  16. package/cli/companion/command.mjs +2 -0
  17. package/cli/demo-native.mjs +1 -1
  18. package/cli/deploy-command.mjs +5 -4
  19. package/cli/deploy-inputs.mjs +1 -1
  20. package/cli/deploy.mjs +6 -4
  21. package/cli/parse.mjs +2 -1
  22. package/cli/production-auth.mjs +16 -3
  23. package/cli/production-mail.mjs +18 -1
  24. package/cli/site.mjs +1 -1
  25. package/global/CHANGELOG.md +45 -0
  26. package/global/README.md +30 -102
  27. package/global/main.mjs +2 -0
  28. package/modules/container/adapters/d1-limits.mjs +2 -10
  29. package/modules/d1-transport/limits.d.mts +10 -0
  30. package/modules/d1-transport/limits.mjs +10 -0
  31. package/modules/demo-host/native/prepare.mjs +2 -1
  32. package/modules/deploy-kit/README.md +10 -0
  33. package/modules/deploy-kit/provider.mjs +18 -2
  34. package/modules/import-kit/schema/importers.schema.json +104 -2
  35. package/modules/import-kit/src/d1/README.md +13 -0
  36. package/modules/import-kit/src/d1/apply-reads.ts +48 -0
  37. package/modules/import-kit/src/d1/apply.ts +21 -8
  38. package/modules/import-kit/src/d1/history.ts +2 -2
  39. package/modules/import-kit/src/d1/jobs.ts +3 -1
  40. package/modules/import-kit/src/d1/retirement-scope.ts +2 -2
  41. package/modules/import-kit/src/d1/retirement-tally.ts +1 -0
  42. package/modules/import-kit/src/d1/retirement.ts +15 -5
  43. package/modules/import-kit/src/d1/types.ts +14 -0
  44. package/modules/import-kit/src/d1/wave-boundary.ts +33 -0
  45. package/modules/import-kit/src/d1/wave-retirement.ts +47 -0
  46. package/modules/import-kit/src/provenance/credentials.ts +14 -5
  47. package/modules/import-kit/src/status/evidence.ts +3 -1
  48. package/modules/import-kit/src/status/index.ts +17 -2
  49. package/modules/import-kit/src/status/schema.ts +8 -0
  50. package/modules/import-kit/src/status/types.ts +25 -4
  51. package/onboarding/adapter.mjs +7 -1
  52. package/onboarding/operator-installer.mjs +3 -1
  53. package/package.json +1 -1
  54. package/scripts/publish-check/README.md +20 -0
  55. package/scripts/publish-check/diagnostics.mjs +73 -0
  56. package/scripts/publish-check/slots.py +37 -7
  57. package/scripts/publish-check.mjs +64 -37
  58. package/cli/business/archive-task.mjs +0 -32
  59. package/cli/business/catchup-task.mjs +0 -42
  60. package/cli/business/export-inputs.mjs +0 -69
  61. package/cli/business/export-task.mjs +0 -17
  62. package/cli/business/setup-demo.mjs +0 -95
  63. package/cli/business/vendor-door.mjs +0 -231
  64. package/cli/business/vendors/README.md +0 -176
  65. package/cli/business/vendors/calendly.mjs +0 -80
  66. package/cli/business/vendors/common.mjs +0 -199
  67. package/cli/business/vendors/credential-names.mjs +0 -124
  68. package/cli/business/vendors/index.mjs +0 -86
  69. package/cli/business/vendors/pagerduty.mjs +0 -61
  70. package/cli/business/vendors/sentry.mjs +0 -85
  71. package/cli/business/vendors/sorry.mjs +0 -106
  72. package/cli/business/vendors/uptimerobot.mjs +0 -21
package/cli/deploy.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { requireProductionAuth } from './production-auth.mjs';
1
+ import { requireProductionAuth, mailOffNotice } from './production-auth.mjs';
2
+ import { mailOffSignInCommand } from './production-mail.mjs';
2
3
  import { readFile } from 'node:fs/promises';
3
4
  import { deployDiagnostic, migrationFailure, providerFailure, assetFailure } from '../modules/deploy-kit/diagnostics.mjs';
4
5
  import { shared } from './shared.mjs';
@@ -41,10 +42,10 @@ export function ownerDeploy(declarationPath, lifecycle) {
41
42
  const recordedState = change.length ? await deploymentRecord(root, options) : undefined;
42
43
  // A dry run reads the settings file too, so a refused key fails here and not only on the real deploy.
43
44
  if (options.dryRun && options.envFile) await deployEnvironment({ root, options, declaration, localOnlyKeys });
44
- let production, ownerInput, signIn;
45
+ let production, ownerInput, signIn, mailOff;
45
46
  if (!change.length) {
46
47
  production = await deployEnvironment({ root, options, declaration, setupManifest, settings: lifecycle.settings, localOnlyKeys });
47
- ({signIn} = await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed, adapter: lifecycle, declarationPath, options }) ?? {});
48
+ ({signIn, mailOff} = await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed, adapter: lifecycle, declarationPath, options, mailOffSignIn: mailOffSignInCommand(adapter) ?? mailOffSignInCommand(lifecycle) }) ?? {});
48
49
  if (!options.dryRun) committedSource(root, options);
49
50
  ownerInput = await deployOwnerInput({ root, adapter, setupSeed, options, signal });
50
51
  await withoutLocalSettings(root, { settings: lifecycle.settings, operationToken }, () => lifecycle.run(root, {}, store, () => {}, signal, { verb: 'build', operationToken }));
@@ -132,7 +133,8 @@ export function ownerDeploy(declarationPath, lifecycle) {
132
133
  // The app claims the OWNER_EMAIL the Worker holds: the local one only when this run uploaded it.
133
134
  const email = declared(claim?.emailField);
134
135
  const named = !email ? '' : deployed.sentSecrets.includes(email.binding) && env[email.environment] ? ` (${env[email.environment]})` : ` (the ${email.binding} already set on the Worker)`;
135
- if (claimed) store.report(`${claimed === 'claimed' ? 'Claimed the hosted owner' : 'The hosted owner was already claimed and was kept'}${named}; the one-time setup token was removed. Sign in by email at ${deployed.origin}.`);
136
+ if (claimed) store.report(`${claimed === 'claimed' ? 'Claimed the hosted owner' : 'The hosted owner was already claimed and was kept'}${named}; the one-time setup token was removed. ${mailOff ? mailOffNotice(mailOff, environment) : `Sign in by email at ${deployed.origin}.`}`);
137
+ else if (mailOff) store.report(mailOffNotice(mailOff, environment));
136
138
  return { deployed: true, origin: deployed.origin, ...(claimed ? { owner: claimed } : {}), dependenciesLinked: true };
137
139
  } catch (error) {
138
140
  if (error instanceof RerError) throw error;
package/cli/parse.mjs CHANGED
@@ -3,6 +3,7 @@ import { authoringVerbs, commonFlags, serverDefaults, signinVerb, verbs } from '
3
3
  import { invalid, refuse } from './errors.mjs';
4
4
  import { isLoopbackHost } from '../modules/operator-auth/loopback.mjs';
5
5
  import { normalizeEmail } from '../modules/operator-auth/policy.mjs';
6
+ import { appSignInHelp } from './app-address.mjs';
6
7
  const booleans = new Set(['--help', '--json', '--non-interactive', '--yes', '--dry-run', '--stop', '--detach', '--foreground', '--no-queue', '--login', '--legacy-v1', '--acknowledge-unverified-metadata', '--acknowledge-unverified-schema-objects', '--door', '--direct', '--site', '--remove', '--demo', '--offline', '--from-api']);
7
8
  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
9
  export const validOwnerName = value => typeof value === 'string' && Boolean(value.trim()) && value.length <= 200 && !/[\p{Cc}\p{Cf}]/u.test(value);
@@ -108,7 +109,7 @@ export function parse(argv, cwd = process.cwd(), { independent = false, deferTai
108
109
  }
109
110
 
110
111
  export function help(verb) {
111
- if (!verb) return `Usage: rer VERB [FLAGS]\nCommands: ${Object.keys({...verbs, ...authoringVerbs}).join(', ')}, signin, release, listing\nRun rer VERB --help for flags.\n`;
112
+ if (!verb) return `Usage: rer VERB [FLAGS]\nCommands: ${Object.keys({...verbs, ...authoringVerbs}).join(', ')}, signin, release, listing\nRun rer VERB --help for flags.\n${appSignInHelp}\n`;
112
113
  const known = verbs[verb] ?? authoringVerbs[verb] ?? (verb === 'signin' ? signinVerb : undefined);
113
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
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`;
@@ -2,16 +2,29 @@ import { refuse } from './errors.mjs';
2
2
  import { main as owner } from '../modules/deploy-kit/owner-cli.mjs';
3
3
  import { hookState } from './deploy-hook-record.mjs';
4
4
  import { savedSetupAnswers } from './setup-answers.mjs';
5
- import { productionMail } from './production-mail.mjs';
5
+ import { productionMail, mailOffSignInCommand } from './production-mail.mjs';
6
+
7
+ // What a deploy says when outbound email is deliberately off: the state and the way in.
8
+ export function mailOffNotice({ signIn }, environment = 'production') {
9
+ return `Outbound email is off (MAIL_PROVIDER=none): no mail credential is bound and this installation sends nothing. Sign in without mail with \`${signIn}\` for the ${environment} environment, from this checkout with the Cloudflare credentials that deployed it. Turn mail on later with rer deploy --environment ${environment} --set-secret and the provider inputs.`;
10
+ }
6
11
 
7
12
  // Validate the shared email/identity contract using the bindings that will reach
8
13
  // the runtime. Independently authored authentication remains the adapter's job.
9
- export async function requireProductionAuth({ root, declaration, env, setupManifest, setupSeed, adapter, declarationPath, options = {} }) {
14
+ // `mailOffSignIn` names the seed's mail-less sign-in command when the caller holds it apart
15
+ // from `adapter` (the owner deploy runs on the lifecycle, the seed declares on its command adapter).
16
+ export async function requireProductionAuth({ root, declaration, env, setupManifest, setupSeed, adapter, declarationPath, options = {}, mailOffSignIn: declaredSignIn = mailOffSignInCommand(adapter) }) {
10
17
  const dependencies = setupManifest?.dependencies?.filter(item => item.interface === 'oidc-provider@1') ?? [];
11
18
  const bindings = { ...declaration.vars };
12
19
  for (const secret of declaration.secrets ?? []) if (env[secret.environment]?.trim()) bindings[secret.binding] = env[secret.environment];
13
- const mail = await productionMail(root, declaration, env, declarationPath, adapter);
20
+ const mail = await productionMail(root, declaration, env, declarationPath, adapter, declaredSignIn);
14
21
  if (!setupManifest?.steps?.some(step => step.type === 'owner-claim') && !dependencies.length && !mail.declared) return;
22
+ // MAIL_PROVIDER=none is accepted only for a seed that declares how its owner signs in without mail.
23
+ const mailOffSignIn = mail.off ? declaredSignIn : undefined;
24
+ if (mailOffSignIn) {
25
+ if (mail.offConflicts.length) throw refuse(`MAIL_PROVIDER=none turns outbound email off, and ${mail.offConflicts.join(', ')} would bind a way to send. Remove ${mail.offConflicts.length > 1 ? 'them' : 'it'} or choose a mail provider. Nothing was built or uploaded.`);
26
+ return { mailOff: { signIn: mailOffSignIn } };
27
+ }
15
28
  if (mail.senderIssue && options.verb === 'deploy' && !(options.dryRun && mail.fixtureSender)) throw refuse(`${mail.senderIssue} Nothing was built or uploaded.`);
16
29
  if (mail.configured()) return;
17
30
  if (mail.canInspect && !options.dryRun && declarationPath) {
@@ -8,6 +8,8 @@ import { validateMailSenders } from '../modules/delivery-producer/mail.mjs';
8
8
  import { sourceMailSenders } from './deploy-variables.mjs';
9
9
 
10
10
  const providers = ['resend', 'sendgrid', 'cloudflare', 'rer'];
11
+ // Bindings that can send mail. MAIL_PROVIDER=none contradicts every one of them.
12
+ const sendingBindings = ['MAIL_API_KEY', 'SENDGRID_API_KEY', 'RESEND_API_KEY', 'MAIL_PROVIDER_API_KEY', 'MAIL_ACCOUNT_ID', 'MAIL_RELAY_URL'];
11
13
  const nativeCredential = { sendgrid: 'SENDGRID_API_KEY', resend: 'RESEND_API_KEY' };
12
14
  const present = value => typeof value === 'string' && Boolean(value.trim());
13
15
  // The sender forms the mail runtime sends from: a bare address or "Display Name <address>".
@@ -27,10 +29,17 @@ const placeholderSender = value => {
27
29
  || /^(?:fake|placeholder|change-?me|replace-?me|your-?email|your-?name|you)(?:[+._-]|$)/.test(local);
28
30
  };
29
31
 
32
+ // A seed that signs its owner in without mail declares the command on its adapter
33
+ // (`mailOffSignIn`: one line naming a command the person runs from the checkout).
34
+ export function mailOffSignInCommand(adapter) {
35
+ const command = adapter?.mailOffSignIn;
36
+ return typeof command === 'string' && command.trim() && command.length <= 300 && !/[\u0000-\u001f\u007f]/.test(command) ? command.trim() : undefined;
37
+ }
38
+
30
39
  // Packaging can declare inputs that a product's deploy adapter adds to the
31
40
  // root declaration later. Read that source contract, never arbitrary ambient
32
41
  // keys or the adapter's executable source, before any build or provider write.
33
- export async function productionMail(root, declaration, env, declarationPath = 'deploy.json', adapter) {
42
+ export async function productionMail(root, declaration, env, declarationPath = 'deploy.json', adapter, mailOffSignIn = mailOffSignInCommand(adapter)) {
34
43
  const bindings = { ...declaration.vars }, secrets = new Set(), publicInputs = new Set(), declaredProviders = new Set();
35
44
  const senders = [{ source: `${declarationPath} vars.MAIL_FROM`, value: declaration.vars?.MAIL_FROM }];
36
45
  senders.push(...await sourceMailSenders(root, adapter));
@@ -76,6 +85,12 @@ export async function productionMail(root, declaration, env, declarationPath = '
76
85
  bindings[name] = env[name];
77
86
  if (name === 'MAIL_FROM') senderFix = environmentFix(name);
78
87
  }
88
+ // Outbound email is off only when the deployment says so in words: a seed that
89
+ // declares a mail-less sign-in command and a MAIL_PROVIDER setting, with an
90
+ // explicit `none` for it. A missing or deferred value ('later', 'direct') never
91
+ // turns mail off.
92
+ if (mailOffSignIn && present(env.MAIL_PROVIDER) && env.MAIL_PROVIDER.trim() === 'none' && 'MAIL_PROVIDER' in bindings) bindings.MAIL_PROVIDER = 'none';
93
+ const off = bindings.MAIL_PROVIDER === 'none';
79
94
  try { validateMailSenders(senders); }
80
95
  catch (error) { throw refuse(`${error.message} Nothing was built or uploaded.`); }
81
96
  let senderIssue;
@@ -112,6 +127,8 @@ export async function productionMail(root, declaration, env, declarationPath = '
112
127
  };
113
128
  });
114
129
  return {
130
+ off,
131
+ offConflicts: off ? sendingBindings.filter(key => present(bindings[key])) : [],
115
132
  declared: 'MAIL_PROVIDER' in bindings || publicInputs.has('MAIL_PROVIDER') || secrets.has('MAIL_API_KEY') || selected.length > 0,
116
133
  senderIssue,
117
134
  fixtureSender: fixtureSender(bindings.MAIL_FROM),
package/cli/site.mjs CHANGED
@@ -149,7 +149,7 @@ export async function siteCommand(project, options, store, signal, out) {
149
149
  const { siteDeploy, siteReadbackSummary } = await import('../modules/deploy-kit/site.mjs');
150
150
  const environment = options.environment ?? 'production';
151
151
  try {
152
- const api = cloudflare({ accountId: process.env.CLOUDFLARE_ACCOUNT_ID, token: process.env.CLOUDFLARE_API_TOKEN });
152
+ const api = cloudflare({ accountId: process.env.CLOUDFLARE_ACCOUNT_ID, token: process.env.CLOUDFLARE_API_TOKEN, settleLists: true, requestSignal: () => signal });
153
153
  // The receipt is for the person; ownership is read from the provider, so a fresh checkout deploys too.
154
154
  const result = await siteDeploy({ api, plan, files, receiptPath: join(project.root, '.rer', 'deploy', `site-${environment}.json`) });
155
155
  return { dryRun: false, deployed: true, origin: result.origin, site: summary };
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.2.101
6
+
7
+ ### Person erasure keeps other people's agent-door records
8
+
9
+ - Data-safety fix: erasing a person could also remove agent-door records that belong to other people. The agent-door erasure matcher in the default seed and the Penny artifact map matched a person's identifiers and personal text literals as bare substrings (Penny's map for every subject, the default seed for text literals), so a short identifier, or one that occurs inside a longer identifier, a path segment or another person's text, selected unrelated calls, approvals, reviews, audit rows and events. The matcher now searches only decoded string values (never JSON keys or numbers) and requires a token boundary on both sides of every hit, including a later hit after an embedded one. Short identifiers keep version and URI tokens such as `1.0` whole; identifiers of eight or more characters, and email addresses, can also be separated at path segments. The selected decision set is resolved once per audit row. A seed or edition receives the fix only by taking this source: do not use People erase on live data with an earlier release.
10
+
11
+ ### Import apply reads in sets
12
+
13
+ - `D1TargetAdapter` gains optional `readMany(database, destination, keys)` and, for private-transport adapters, `stagingReadMany`. Each returns what the same number of single reads would, in key order, including duplicate keys and missing rows; reads only the selected keys; and keeps the adapter's native decoding and exact before-read guards. An adapter without them keeps individual reads, any bulk-read error discards the snapshot and uses that path, and an inherited bulk method must preserve an overridden single read or throw. The default seed's people target implements `readMany`.
14
+ - Each apply transaction reads its entries' source ownership, native rows and predecessor provenance as three set reads, chunked to the D1 variable limit, instead of reading per entry. On the 14,770-entry replay, apply round trips fall from 61,695 to 19,764 and entry reads from 44,310 to 2,379. One documented difference at the budget boundary: saved read budget can advance a budget-limited call's checkpoint, or surface a later entry's refusal one call earlier, with the same error code and text; such a refusal publishes none of the gathered entries and leaves the job at its last consistent durable checkpoint (`modules/import-kit/src/d1/README.md`). The D1 query limits now live in `modules/d1-transport/limits.mjs`, and the native demo bundle carries that module.
15
+ - The import credential check no longer stops a whole import on free text that merely starts like a URL (for example `http:// see below`). A string that does not parse yields no user name and still goes through the raw query-key scans; strings that parse are checked exactly as before.
16
+
17
+ ### Business is light
18
+
19
+ - Business is light: `rer business` keeps pairing, token, scan, setup, run, next, answer, status and disconnect, and no longer exports from old tools. `vendor-key` and `legacy-package` are gone with the Sentry, PagerDuty, Sorry, UptimeRobot, Calendly and Zendesk exporters and the export, catch-up and archive tasks: each seed imports in its own Move in page. `rer business next` names a seed's Move in page, what it takes and how to export, `rer business done ID --note TEXT` finishes the step, and `run` reports a step kind it does not know instead of failing. A read-only key stored by an earlier rer is still removed by `disconnect`.
20
+ - This removes what 0.2.100 added to the import door and Business: the logical package transport (`rer-door-package/1`, the `package` source option and segment assembly), the opt-in bounded-wave protocol with its grant actions and schema, the local legacy package registration and transfer, and the Zendesk exporter. This release carries no migration for the bounded-wave schema an adopter may have taken from 0.2.100.
21
+ - `importers.json` has a version 2: each row declares the seed's Move in path (`moveIn`), what it takes (`accepts`: file, key, address) and how to export (`export`), with `status` and `evidence` optional, and the file may name the seed's own import format. Version 1 files stay valid. `rer business next` prints that format link, including a GitHub link pinned to a commit.
22
+ - `rer business setup --confirm-demo` now only creates (or reuses) the synthetic demo company's Business and saves its profile; it provisions no seeds and calls no demo routes, and `--wait-seconds` is gone. Its receipt is `{business_id, name, default_hosting, created, profile}`.
23
+ - The computer-awake choice is still recorded, and the CLI now says plainly that nothing keeps the computer awake because rer runs no exports.
24
+
25
+ ### Sign-in address in help
26
+
27
+ - Top-level, companion pairing and Business setup, next and done help now name the app sign-in address for invited people, https://app.runeditrun.com, which is also the default Business origin.
28
+
29
+ ## 0.2.100
30
+
31
+ ### Deploy with outbound email explicitly off
32
+
33
+ - `rer deploy` and `rer deploy --dry-run` accept explicit `MAIL_PROVIDER=none` only when the seed's adapter declares `mailOffSignIn`, naming its sign-in command without mail. They bind no mail credential and name the hosted sign-in command and environment. Missing mail configuration is still refused; `none` with a sending credential, account or relay binding is refused before build or upload. The seed owns its behavior with mail off; turning mail on later uses the documented provider inputs and `rer deploy --set-secret`.
34
+
35
+ ### Import transport and opt-in bounded waves
36
+
37
+ - The import door supports a logical package whose files travel in bounded, verified segments. Completed-file hashes, declared aggregate counts and existing source/native quotas are checked before planning; refused packages withdraw their segment custody. Segment transport does not approve an import or raise a quota.
38
+ - Opt-in complete-parent imports can prepare, seal and approve ordered bounded waves, preserving parent lineage, complete membership and native before-images. Unchanged catch-up dispositions and completed reversal retries remain stable; concurrent parent preparation fences reversal. Adopters supply their source/native integrations and a new numbered migration for the additive bounded-wave schema. The reference includes the schema; no edition adoption, live migration, import or cutover is claimed.
39
+ - Business can register a verified local legacy package and transfer its exact files to the granted import door. The accepted Zendesk exporter captures paginated people, tickets, comments, attachments and Guide content into the documented package, with bounded read-only transport, credential removal and resumable checkpoints. These are the inherited accepted package, bounded-wave and Zendesk changes; this release adds no further Business command changes.
40
+
41
+ ### Startup, approval replay and deployment recovery
42
+
43
+ - Setup and dev let the managed Vite listener use its finite startup budget instead of stopping at 60 seconds. Custom start targets retain their declared deadlines; a missing listener announcement reports elapsed and allowed time with startup-log guidance.
44
+ - Legacy MCP tool calls held for approval return their generated `requestState` alongside `approval_required`, so retrying an approved read resumes the original operation without asking for a second approval.
45
+ - `rer deploy --site` retries a changing or partial Cloudflare list from page one up to three times, waiting 20 seconds between failed reads. It discards incomplete snapshots, never replays deploy writes, preserves other refusals and stops waiting on cancellation.
46
+ - Publication scans retain value-free worker, report, version-stamping and cleanup failure diagnostics. Cleanup and version-stamping failures still refuse publication; diagnostic handling does not turn a failed scan into a pass.
47
+
3
48
  ## 0.2.99
4
49
 
5
50
  ### Agents wait for the owner instead of failing
package/global/README.md CHANGED
@@ -432,31 +432,24 @@ formats and syntax may yield no signals.
432
432
  rer business setup --origin https://app.runeditrun.com --session-file /private/path/owner.session --confirm-demo
433
433
  ```
434
434
 
435
- This provisions the synthetic Juniper Harbor Software demo through the platform's
436
- Business routes using the signed-in person's session. The session file must be
437
- an owned regular file with mode `0600`, containing only `rer_session=VALUE` or
438
- `__Host-rer_session=VALUE`. Symbolic links are refused. The session is read in
439
- process, sent only as the platform Cookie header, and never printed or placed
440
- in argv, local Business state or a receipt. `--confirm-demo` is required.
435
+ This creates the Business for the synthetic Juniper Harbor Software company in
436
+ `cli/business/setup-company.json` and saves its profile, through the platform's
437
+ owner routes (`GET` and `POST /api/business`, then `GET` and `PUT
438
+ /api/business/ID/profile`) using the signed-in person's session. It provisions
439
+ no seeds. The session file must be an owned regular file with mode `0600`,
440
+ containing only `rer_session=VALUE` or `__Host-rer_session=VALUE`. Symbolic links
441
+ are refused. The session is read in process, sent only as the platform Cookie
442
+ header, and never printed or placed in argv, local Business state or a receipt.
443
+ `--confirm-demo` is required.
441
444
 
442
445
  Hosting defaults to `managed`; `--hosting assisted` and `--hosting self_host`
443
- are also supported. There is no `hosted` alias. `--wait-seconds 0..240` bounds
444
- provisioning polling (default: 240). Both normal output and `--json` print the
445
- platform script's JSON receipt, including each seed's actual state and only
446
- credential identifiers. Errors print a named `{code}` to stderr and exit 1.
447
-
448
- Run the same command to resume. Completed seeds keep their token, consent and
449
- policy identifiers and report equal receipts (`already provisioned`). The
450
- receipt includes each seed's state and a top-level `complete` flag. Exit 0
451
- requires `complete: true`: every required seed must be provisioned, token-issued,
452
- policy-confirmed, settings-delivered and have its door proofs recorded.
453
- Missing adoptions remain `not yet on the agent door` and exit nonzero.
454
-
455
- The route order, policy, synthetic company profile and receipt are mirrored from
456
- the RER platform at commit `0261033177e8e05284c037369ee9c3a85922a8aa`,
457
- `scripts/business/demo.mjs` and `demo/company.json`. The platform owns the seed
458
- catalogue, fixture data and door proofs. This command does not pair the computer
459
- or use its stored device credential.
446
+ are also supported. There is no `hosted` alias. Both normal output and `--json`
447
+ print the receipt: `business_id`, `name`, `default_hosting`, `created` and
448
+ `profile` (`saved` or `unchanged`). Run it again to reuse the same Business: a
449
+ repeat whose profile matches changes nothing, and a Business of that name with
450
+ other hosting is refused (`existing_demo_hosting_differs`). Errors print a named
451
+ `{code}` to stderr and exit 1. This command does not pair the computer or use
452
+ its stored device credential.
460
453
 
461
454
  ## Business device commands
462
455
 
@@ -506,8 +499,7 @@ The install.sh form still passes either connect command through unchanged.
506
499
 
507
500
  The owner chooses three things on the computer's row in the browser: "Add rules
508
501
  so Claude Code never reads your secret files" (Claude Code user Read deny
509
- rules), "Keep this computer awake while it works" (export-scoped macOS wake
510
- prevention) and "Install the background service" (a launchd or systemd user
502
+ 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
511
503
  service). Connect, run and next read them as `optIns` from device-authenticated
512
504
  `GET /api/business/executors/self`, with keys `installPermissions`,
513
505
  `awakeConsent` and `installService`; the CLI prints only the sentences. Only
@@ -540,29 +532,18 @@ refuses to remove the Keychain item (`security` exits 161 and leaves it), so
540
532
  local credential is still stored" and names the one command that removes it when
541
533
  run outside the sandbox; until then `status` says revoked, never paired.
542
534
 
543
- `rer business vendor-key add sentry` requires hidden credential entry in a
544
- terminal, stores it in the OS keychain and prints only `sentry:read`.
545
- `remove` deletes it. The same commands support `uptimerobot`, `pagerduty` and
546
- `calendly`. Sorry's export reads its public status page and needs no key. Never
547
- put a key in command arguments, chat or a URL.
548
-
549
535
  `rer business next` returns, within 60 seconds, one locally templated
550
536
  classification, owner link or agent step, or says what `run` would start, and
551
- says `Nothing yet` only when no agent step waits. Once an app is claimed and its
552
- import door is on, its `export.vendor` task is the agent's step, and so are a
553
- move's `catchup.vendor` (bringing over what changed in the old tool) and
554
- `switchoff.archive` (the final archive before switch-off): next names the step,
555
- the owner-typed `rer business vendor-key add <vendor>` (or says the key is
556
- already stored, or that the vendor needs none) and `rer business run`. Run reads
557
- the adapter's non-secret inputs from the leased task's `export_inputs` (Sentry's
558
- organization and window, PagerDuty's window and `schedules: 'all'` (every rota
559
- moves), Sorry's page host); a task that does not carry them yet is handed
560
- back as paused until Business has them. A move's owner steps (`freeze.vendor`,
561
- a `rollback.*` card, `switchoff.cancel`) are named as the owner's, with the
562
- move's page (`/business/:id/moves/:toolId` when the summary names its
563
- `tool_id`, else the switch-over board `/business/:id`), never as agent work. It
564
- never reflects server instructions or raw evidence. Owner items cannot be
565
- answered from this CLI.
537
+ says `Nothing yet` only when no agent step waits. A seed's **Move in** step is
538
+ the agent's step: `next` names the seed's Move in page, what the seed takes (a
539
+ file export, a read-only key or the old tool's public address), how to export
540
+ from the old tool and, for a tool the seed has no importer for, the seed's own
541
+ import format, all from the seed's `importers.json` row. The seed's Move in page
542
+ does the import (a dry run with counts, the import and undo) and rer imports
543
+ nothing itself; `rer business done ID --note "what moved"` finishes the step once
544
+ the data is in the seed. A step kind this rer does not know is reported by its
545
+ kind and never claimed or failed. It never reflects server instructions or raw
546
+ evidence. Owner items cannot be answered from this CLI.
566
547
  `rer business answer ID VENDOR uses|sells|both|product-dependency [CONFIDENCE]`
567
548
  submits a task-scoped classification through MCP. Choose a vendor ID from the
568
549
  question's displayed answer schema, or `none`; the suggested vendor can be
@@ -574,12 +555,12 @@ a headers helper. That output is a short-lived credential: connect it directly
574
555
  to the MCP client and do not paste it into an agent transcript.
575
556
 
576
557
  `rer business status` shows local pairing, service state and progress without
577
- printing checkpoints or vendor data. Device credentials are stored separately
558
+ printing checkpoints. Device credentials are stored separately
578
559
  for each Business on an origin; disconnect also finds an older per-origin
579
560
  credential through its original pairing record and revokes it once.
580
561
  `rer business disconnect` revokes this
581
562
  device through device-authenticated `DELETE /api/business/executors/self` before
582
- removing its service, device and vendor credentials, state and introduced Claude
563
+ removing its service, device credential, any read-only key an earlier rer stored, state and introduced Claude
583
564
  rules, preserving preexisting settings and unrelated edits. It says "Device
584
565
  revoked" only after the server confirms (`{"revoked":true}`, or 401 for a device
585
566
  already revoked). If this session may not remove the credential, a key, the
@@ -614,60 +595,7 @@ It removes `run.lock` on every exit, including Ctrl-C,
614
595
  SIGTERM and a closed terminal (SIGHUP); a lock whose process is gone, or that
615
596
  has not been refreshed for two minutes, is cleared on the next start.
616
597
 
617
- `rer business run` also performs claimed `export.vendor` tasks into the app's
618
- import door. The claim's grant names the door (`/api/rer/import/uploads` on the
619
- app's HTTPS origin) and `import_grants`; every door request asks
620
- `POST /api/business/tasks/:taskId/import-grants` for its own short-lived
621
- RER-signed grant (`uploads` or `plan`; apply is the server's alone after the
622
- owner's wave approval), and the first grant's namespace names the vendor. The
623
- read-only vendor key is read from OS credential storage, never from arguments,
624
- the environment or a file. The shipped adapter runs into a private 0600
625
- `export-<id>.bundle` file in the state folder, each item checked by the outbound
626
- detector; the bundle is sent in 64 KiB chunks, then planned, which leaves a
627
- zero-write preview in the door. Run then completes the task with outputs
628
- `{upload_id, plan_id, bundle_sha256}` (identifiers only); Business reads that
629
- plan from the door with its own grants and completes the task only if it is the
630
- plan of exactly that bundle. Run prints only counts and removes the bundle on
631
- every exit. Without the key, run
632
- releases the task as `paused` after an `owner_required` event and names the
633
- owner's command; a running supervisor picks the export up once the key is
634
- stored. A door that is not ready releases it as `paused` after a
635
- `connected_runner_required` event, naming the reason. UptimeRobot needs no
636
- other input. Sentry, PagerDuty and Sorry use the leased task's `export_inputs`;
637
- when those inputs are missing they release as `paused` after a
638
- `configuration_required` event. Calendly's folder of files has no single-bundle
639
- door format yet and releases with the same event. While an agent step waits (an export, or a
640
- question for `next`, or the lease an earlier run on this computer still holds),
641
- run says what it waits for instead of `Nothing yet`; otherwise it names a move's
642
- owner step with its link before `Nothing yet`.
643
-
644
- `rer business run` performs claimed `catchup.vendor` and `switchoff.archive`
645
- tasks the same way: the claim's grant names the door, the key comes from OS
646
- credential storage, and the shipped adapter's bundle goes up in 64 KiB chunks,
647
- each with its own grant, from a private 0600 file removed on every exit.
648
-
649
- - A catch-up then plans the upload with `{uploadId, catchup: true}`. Business
650
- mints its plan grant under the owner's standing catch-up approval when one
651
- covers the tool, and says so with `catchup: "bounded"` on the grant. If the
652
- door refuses that with `catchup_requires_proposal:<reason>` (gone, conflicting
653
- or rejected records, or a change of 5% or more), run asks
654
- `import-grants` for `{action: "plan", review: true}` and plans the same upload
655
- again for the owner's review. Run completes with
656
- `{upload_id, plan_id, bundle_sha256}`; Business applies a bounded plan under
657
- the standing approval and any other only after the owner approves it.
658
- - An archive calls the door's `archive` action with `{uploadId, tool, takenAt}`
659
- (the tool is the vendor's namespace), then `restore-check` with the
660
- `archiveId`, and requires both answers to carry the bundle's SHA-256 and size,
661
- the key `business-archive/<tool>/<takenAt>` and the same counts. Run completes
662
- with `{archive_id, bundle_sha256}`; Business runs its own `restore-check`
663
- before the task is done. Archive grants are `uploads`, `archive` and
664
- `restore-check`; catch-up grants are `uploads`, `plan` and `status`.
665
-
666
- Run prints only counts and the archive key. When an owner summary is supplied,
667
- the CLI displays its browser link and refuses to answer it.
668
-
669
- The five deterministic adapter implementations and their native output formats
670
- are described in [the adapter guide](https://github.com/runeditrun/base/blob/main/cli/business/vendors/README.md).
598
+ Run prints only counts. When an owner summary is supplied, the CLI displays its browser link and refuses to answer it.
671
599
 
672
600
  ## Local engineering companion
673
601
 
package/global/main.mjs CHANGED
@@ -6,6 +6,7 @@ import { localDefaults } from './launch/local-defaults.mjs';
6
6
  import { handleBrokenPipes } from './output.mjs';
7
7
  import { repositoryCommands, repositoryHelp } from './cli/repository-contract.mjs';
8
8
  import { repoArguments } from './cli/repository.mjs';
9
+ import { appSignInHelp } from '../cli/app-address.mjs';
9
10
 
10
11
  const help = `Usage: rer VERB [FLAGS]
11
12
 
@@ -48,6 +49,7 @@ else its vendored scripts/rer.mjs.
48
49
  of a checkout that pins the rer package use it).
49
50
 
50
51
  Checkout verbs: ${Object.keys(checkoutVerbs).join(', ')}, listing. Run rer VERB --help in a checkout for its flags.
52
+ ${appSignInHelp}
51
53
  `;
52
54
 
53
55
  export async function main(argv) {
@@ -1,13 +1,5 @@
1
- /** Cloudflare D1 per-query limits, supplied from the platform limits page
2
- * (updated 24 Oct 2026). Expression depth 100 is OBSERVED-NOT-DOCUMENTED:
3
- * native D1 rejected a concatenation tree of depth 101 on 27 Oct 2026.
4
- * Node 22.20.0 ignores DatabaseSync limits options: preflight is mandatory.
5
- * Queries per Worker invocation (Paid 1000, Free 50, batch counts once) and
6
- * the 30 second query deadline are NOT-ENFORCEABLE-LOCALLY here: a database
7
- * connection has neither the invocation boundary nor the provider scheduler.
8
- */
9
- export const d1NativeLimits = Object.freeze({ length: 2_000_000, sqlLength: 100_000,
10
- column: 100, variableNumber: 100, functionArg: 32, likePatternLength: 50, exprDepth: 100 });
1
+ import { d1NativeLimits } from '../../d1-transport/limits.mjs';
2
+ export { d1NativeLimits } from '../../d1-transport/limits.mjs';
11
3
 
12
4
  /** ENFORCED-BY-PREFLIGHT. Self-contained so workerd can run the same code.
13
5
  * Depth is an estimate, not a complete SQLite parser. Parentheses, function
@@ -0,0 +1,10 @@
1
+ /** Shared native D1 ceilings used by SQL adapters and selected-key readers. */
2
+ export const d1NativeLimits: Readonly<{
3
+ length: number;
4
+ sqlLength: number;
5
+ column: number;
6
+ variableNumber: number;
7
+ functionArg: number;
8
+ likePatternLength: number;
9
+ exprDepth: number;
10
+ }>;
@@ -0,0 +1,10 @@
1
+ /** Cloudflare D1 per-query limits, supplied from the platform limits page
2
+ * (updated 24 Oct 2026). Expression depth 100 is OBSERVED-NOT-DOCUMENTED:
3
+ * native D1 rejected a concatenation tree of depth 101 on 27 Oct 2026.
4
+ * Node 22.20.0 ignores DatabaseSync limits options: preflight is mandatory.
5
+ * Queries per Worker invocation (Paid 1000, Free 50, batch counts once) and
6
+ * the 30 second query deadline are NOT-ENFORCEABLE-LOCALLY here: a database
7
+ * connection has neither the invocation boundary nor the provider scheduler.
8
+ */
9
+ export const d1NativeLimits = Object.freeze({ length: 2_000_000, sqlLength: 100_000,
10
+ column: 100, variableNumber: 100, functionArg: 32, likePatternLength: 50, exprDepth: 100 });
@@ -32,7 +32,8 @@ export async function prepareNative(folder) {
32
32
  modules['_rer/isolate.js'] = { js: (await readFile(new URL('./isolate.mjs', import.meta.url), 'utf8')).replace('__RER_APP_ENTRY__', entry)
33
33
  + objectExports(bindings) };
34
34
  for (const file of ISOLATE_FILES) modules[`_rer/${file}.js`] = { js: (await readFile(new URL(`./${file}.mjs`, import.meta.url), 'utf8')).replace('../../container/adapters/d1-limits.mjs', './d1-limits.js') };
35
- modules['_rer/d1-limits.js'] = { js: await readFile(new URL('../../container/adapters/d1-limits.mjs', import.meta.url), 'utf8') };
35
+ modules['_rer/d1-native-limits.js'] = { js: await readFile(new URL('../../d1-transport/limits.mjs', import.meta.url), 'utf8') };
36
+ modules['_rer/d1-limits.js'] = { js: (await readFile(new URL('../../container/adapters/d1-limits.mjs', import.meta.url), 'utf8')).replaceAll('../../d1-transport/limits.mjs', './d1-native-limits.js') };
36
37
  const assets = await collectFiles(join(app, 'dist/client'));
37
38
  await cp(join(app, 'dist/client'), join(folder, 'assets'), { recursive: true });
38
39
  const theme = await prepareTheme(folder, assets);
@@ -207,6 +207,16 @@ No zone ruleset is read or written. Every request now invokes the Worker: one pa
207
207
 
208
208
  A read-only preflight reads the zone (it must be in this account, else `site-zone-missing`), the Worker and the zone's Custom Domains, and refuses before any write: `resource-name-collision` for a Worker of the name whose live version the kit did not upload, or for a hostname attached to another service (or to a Worker that is not the kit's); `owned-resource-replaced` for a kit Worker whose latest deployment is not the kit's upload (a dashboard rollback or a split deployment). It then uploads the assets and the site Worker, checks that the new version is live, turns workers.dev off, attaches each missing hostname, and reads the Worker and both domains back. Both post-upload Worker checks share a 90-second upload window: missing visibility or the exact preflight version waits with backoff until the upload response's version serves alone as newest with its expected fingerprint. A foreign version, changed fingerprint or split deployment refuses immediately. A timeout names the last serving/newest versions and fingerprint. A repeat attaches nothing new. `.rer/deploy/site-<environment>.json` receives a receipt for the person; it is never read. Provider propagation cases are tested against the fake Cloudflare API in `tests/site-provider.mjs`, where every zone ruleset path answers 403.
209
209
 
210
+ Site deploy retries only `provider-partial-list` and `provider-pagination-changed`
211
+ from read-only list collection: three total attempts, with 20 seconds between
212
+ failed reads. Each attempt discards the incomplete snapshot and restarts at page
213
+ one, retaining the original filters; pages from different attempts are never
214
+ combined. This covers zone, Custom Domain and Worker version/deployment lists,
215
+ including post-upload readback. It never retries the whole deploy or replays a
216
+ write. Other refusals stop immediately; persistent inconsistency keeps the final
217
+ original refusal and its GET diagnostic. Cancellation stops the wait and prevents
218
+ the next read. Owner-mode and teardown settling defaults are unchanged.
219
+
210
220
  A seed can opt into docs search through its command adapter's `site.runtime`:
211
221
 
212
222
  ```ts
@@ -1,3 +1,4 @@
1
+ import timers from 'node:timers/promises';
1
2
  import { providerPages, providerListShape } from './pagination.mjs';
2
3
  import { deleteR2Object } from './r2-object-transport.mjs';
3
4
  import { isR2ObjectDelete } from './r2-objects.mjs';
@@ -40,7 +41,7 @@ const redactValues = (text, values) => values.filter(Boolean).flatMap(value=>[va
40
41
  return at >= 0 && secret.startsWith(value.slice(at)) ? value.slice(0,at)+'[REDACTED]' : value;
41
42
  },text);
42
43
  /** Only this fixed origin and the explicitly selected account ever receive the token. */
43
- export function cloudflare({ accountId, token, fetch: request = globalThis.fetch, objectDelete = deleteR2Object, timeoutMs = 30000, maxRequests = 500, removal = false, budgetMigrations = false, requestSignal = () => undefined }) {
44
+ export function cloudflare({ accountId, token, fetch: request = globalThis.fetch, objectDelete = deleteR2Object, timeoutMs = 30000, maxRequests = 500, removal = false, budgetMigrations = false, requestSignal = () => undefined, settleLists = false }) {
44
45
  assert(hexId(accountId), 'invalid-cloudflare-account-id');
45
46
  assert(typeof token === 'string' && token.trim() && !/[\r\n]/.test(token), 'invalid-cloudflare-api-token');
46
47
  // Capture an outer deadline once per operation, before transport retries.
@@ -137,7 +138,7 @@ export function cloudflare({ accountId, token, fetch: request = globalThis.fetch
137
138
  throw error;
138
139
  }
139
140
  }
140
- async function collect(path, options) {
141
+ async function collectOnce(path, options) {
141
142
  let result, rows = [];
142
143
  for await (const page of providerPages(envelope, path, options)) {
143
144
  result ??= page.data.result;
@@ -146,6 +147,21 @@ export function cloudflare({ accountId, token, fetch: request = globalThis.fetch
146
147
  }
147
148
  return options?.field ? {...result,[options.field]:rows} : rows;
148
149
  }
150
+ // Site deploy opts in here: both request/zoneRequest and list must discard
151
+ // every page of an inconsistent snapshot. Only this read is replayed; owner
152
+ // and teardown callers retain their existing settling policies and defaults.
153
+ async function collect(path, options) {
154
+ if (!settleLists) return collectOnce(path, options);
155
+ const signal = deadlineSignal(options?.signal);
156
+ for (let attempt = 1; ; attempt++) {
157
+ signal?.throwIfAborted();
158
+ try { return await collectOnce(path, options); }
159
+ catch (error) {
160
+ if (attempt === 3 || !['provider-partial-list','provider-pagination-changed'].includes(error.message)) throw error;
161
+ await timers.setTimeout(20000, undefined, {signal});
162
+ }
163
+ }
164
+ }
149
165
  async function list(path, options = {}) {
150
166
  const shape = {...providerListShape(path),...options};
151
167
  const result = await collect(path,shape);