@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/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/cli/README.md CHANGED
@@ -70,8 +70,13 @@ its port over their private parent channel. The CLI confirms that the runtime
70
70
  owns that socket, then updates the traffic proxy and scheduled-trigger target.
71
71
  Custom runtime targets retain the assigned internal port contract: bind it
72
72
  strictly. A healthy application on a different owned port causes an immediate
73
- port-mismatch refusal. Application health has a hard 60-second limit, including
74
- setup; an individual probe gets at most five seconds by default. Concurrent
73
+ port-mismatch refusal. A start target can declare a finite positive `timeoutMs`
74
+ for listener announcement and health together; targets without it retain the
75
+ 60-second default. The shared development target used by setup and dev declares
76
+ fifteen minutes for real Vite startup. A missing listener announcement reports
77
+ elapsed and allowed time and points to the runtime startup log; auxiliary
78
+ process sockets cannot satisfy readiness. An individual probe gets at most five
79
+ seconds by default. Concurrent
75
80
  starts waiting on an existing server have one five-minute elapsed deadline,
76
81
  including control requests and polling. Loopback HTTP requests use an elapsed
77
82
  deadline, so a response that keeps sending bytes cannot extend readiness.
@@ -272,6 +277,21 @@ secrets after the provider verifies the owned deployment. Local setup and demo
272
277
  do not require production mail credentials. Preview serves production output
273
278
  and prints its ready address without a captured-mail sign-in flow.
274
279
 
280
+ A deployment can instead turn outbound email off on purpose. `MAIL_PROVIDER=none`
281
+ in the environment or the `--env-file` is accepted only when the seed's adapter
282
+ declares a sign-in that works without mail: the `commandAdapter` option
283
+ `mailOffSignIn`, one line naming the command a person runs from the checkout. Both
284
+ `rer deploy` and `rer deploy --dry-run` then pass the production sign-in check
285
+ without any mail input, bind nothing that can send, and report that outbound email
286
+ is off together with that command. `none` is never inferred: a missing
287
+ `MAIL_PROVIDER`, `later` or `direct` keeps today's refusal, a seed without the
288
+ declaration keeps today's refusal for `none` too, and `none` together with a
289
+ mail credential (`MAIL_API_KEY`, `SENDGRID_API_KEY`, `RESEND_API_KEY`,
290
+ `MAIL_PROVIDER_API_KEY`, `MAIL_ACCOUNT_ID` or `MAIL_RELAY_URL`) refuses before
291
+ anything is built or uploaded. The seed owns what an installation does with mail
292
+ off, and turning mail on later is a `rer deploy --set-secret` of the provider
293
+ inputs the seed documents.
294
+
275
295
  The production preflight also reads the product's `artifact.specInputs` in
276
296
  `rer-packaging.json`, `packaging.json` or `scripts/delivery/base/packaging.json`,
277
297
  and `management/integration/deployment-spec.json`. Public inputs come from
@@ -562,31 +582,24 @@ expire within 15 minutes and are never saved. Restarting retires them.
562
582
  rer business setup --origin https://app.runeditrun.com --session-file /private/path/owner.session --confirm-demo
563
583
  ```
564
584
 
565
- This provisions the synthetic Juniper Harbor Software demo through the platform's
566
- Business routes using the signed-in person's session. The session file must be
567
- an owned regular file with mode `0600`, containing only `rer_session=VALUE` or
568
- `__Host-rer_session=VALUE`. Symbolic links are refused. The session is read in
569
- process, sent only as the platform Cookie header, and never printed or placed
570
- in argv, local Business state or a receipt. `--confirm-demo` is required.
585
+ This creates the Business for the synthetic Juniper Harbor Software company in
586
+ `cli/business/setup-company.json` and saves its profile, through the platform's
587
+ owner routes (`GET` and `POST /api/business`, then `GET` and `PUT
588
+ /api/business/ID/profile`) using the signed-in person's session. It provisions
589
+ no seeds. The session file must be an owned regular file with mode `0600`,
590
+ containing only `rer_session=VALUE` or `__Host-rer_session=VALUE`. Symbolic links
591
+ are refused. The session is read in process, sent only as the platform Cookie
592
+ header, and never printed or placed in argv, local Business state or a receipt.
593
+ `--confirm-demo` is required.
571
594
 
572
595
  Hosting defaults to `managed`; `--hosting assisted` and `--hosting self_host`
573
- are also supported. There is no `hosted` alias. `--wait-seconds 0..240` bounds
574
- provisioning polling (default: 240). Both normal output and `--json` print the
575
- platform script's JSON receipt, including each seed's actual state and only
576
- credential identifiers. Errors print a named `{code}` to stderr and exit 1.
577
-
578
- Run the same command to resume. Completed seeds keep their token, consent and
579
- policy identifiers and report equal receipts (`already provisioned`). The
580
- receipt includes each seed's state and a top-level `complete` flag. Exit 0
581
- requires `complete: true`: every required seed must be provisioned, token-issued,
582
- policy-confirmed, settings-delivered and have its door proofs recorded.
583
- Missing adoptions remain `not yet on the agent door` and exit nonzero.
584
-
585
- The route order, policy, synthetic company profile and receipt are mirrored from
586
- the RER platform at commit `0261033177e8e05284c037369ee9c3a85922a8aa`,
587
- `scripts/business/demo.mjs` and `demo/company.json`. The platform owns the seed
588
- catalogue, fixture data and door proofs. This command does not pair the computer
589
- or use its stored device credential.
596
+ are also supported. There is no `hosted` alias. Both normal output and `--json`
597
+ print the receipt: `business_id`, `name`, `default_hosting`, `created` and
598
+ `profile` (`saved` or `unchanged`). Run it again to reuse the same Business: a
599
+ repeat whose profile matches changes nothing, and a Business of that name with
600
+ other hosting is refused (`existing_demo_hosting_differs`). Errors print a named
601
+ `{code}` to stderr and exit 1. This command does not pair the computer or use
602
+ its stored device credential.
590
603
 
591
604
  ## Sync agent contract clauses
592
605
 
@@ -0,0 +1,2 @@
1
+ export const appAddress = 'https://app.runeditrun.com';
2
+ export const appSignInHelp = `Invited? Sign in at ${appAddress}`;
@@ -1,7 +1,8 @@
1
1
  import { setTimeout as delay } from 'node:timers/promises';
2
2
  import { redact } from './errors.mjs';
3
+ import { appAddress } from '../app-address.mjs';
3
4
 
4
- export function originUrl(value = 'https://app.runeditrun.com') {
5
+ export function originUrl(value = appAddress) {
5
6
  let url;
6
7
  try { url = new URL(value); } catch { throw Error('Business origin must be an HTTPS origin.'); }
7
8
  const local = ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
@@ -22,7 +22,7 @@ const effects = {
22
22
  };
23
23
  const said = {
24
24
  installPermissions: { true: 'allowed; the rules are in Claude Code settings', false: 'not allowed; no rules added' },
25
- awakeConsent: { true: 'allowed while an export runs', false: 'not allowed' },
25
+ awakeConsent: { true: 'allowed', false: 'not allowed' },
26
26
  installService: { true: 'allowed; the service is installed and works tasks after this chat ends', false: 'not allowed; no service installed' },
27
27
  };
28
28
 
@@ -1,11 +1,12 @@
1
1
  import { setupCommand } from './setup-command.mjs';
2
2
  import { scanCommand } from './scan-command.mjs';
3
3
  import { connect } from './connect.mjs';
4
- import { vendorKey, disconnect, status } from './local-commands.mjs';
5
- import { next, answer, token } from './questions.mjs';
4
+ import { disconnect, status } from './local-commands.mjs';
5
+ import { next, answer, done, token } from './questions.mjs';
6
6
  import { run } from './supervisor.mjs';
7
7
  import { describe } from './errors.mjs';
8
8
  import { identifier, originUrl } from './api.mjs';
9
+ import { appAddress, appSignInHelp } from '../app-address.mjs';
9
10
 
10
11
  const usage = `Set up your business: rer business connect
11
12
  Business keeps your business name, logo and brand colour together for the apps
@@ -13,44 +14,54 @@ that support shared Business settings. Choose what to share in your browser.
13
14
 
14
15
  Advanced commands (Usage: rer business VERB)
15
16
  setup --origin URL --session-file FILE --confirm-demo
16
- Provision the synthetic Run your business demo
17
- --hosting managed|assisted|self_host (default: managed)
18
- --wait-seconds 0..240 (default: 240); --json
17
+ Create the synthetic demo company's Business and its profile
18
+ --hosting managed|assisted|self_host (default: managed); --json
19
19
  scan [DIR...] [--json] Names-only local discovery
20
20
  connect --business ID [--origin URL] [--timeout SECONDS]
21
21
  Print a code and link for the owner to approve in a signed-in browser
22
22
  Older Business pages: connect --code CODE [--origin URL]
23
23
  Connect carries the Business name into local apps
24
- run [--once] Work this computer's tasks: the folder scan the owner allows, then
25
- vendor exports into each app's import door (a preview the owner
26
- approves), catch-ups (applied within the owner's standing approval,
27
- else reviewed by the owner) and the final archive the app keeps and
28
- test-restores; the vendor key stays in OS credential storage. Says
29
- what it is doing and waiting for; applies the owner's choices at
30
- each check-in
24
+ run [--once] Work this computer's tasks: the folder scan the owner allows. Says what
25
+ it is doing and what it waits for; applies the owner's choices at each
26
+ check-in
31
27
  next Apply the owner's choices, then return one templated question, the
32
- agent's next step, an owner step with its browser link (freeze,
33
- rollback card, cancellation; never agent work), or nothing yet
34
- within 60 seconds
28
+ agent's next step (a Move in step names the seed's Move in page, what the
29
+ seed takes and how to export), an owner step with its browser link, or
30
+ nothing yet within 60 seconds
35
31
  answer ID VENDOR USAGE [CONFIDENCE]
36
32
  Catalog vendor or none; uses, sells, both, product-dependency
37
- vendor-key add|remove VENDOR Keep a read-only vendor key in OS credential storage; the owner
38
- types it in their own terminal, never in chat or a command
33
+ done ID --note TEXT Finish a Move in step once the owner has the data in the seed
39
34
  token MCP headersHelper output; send directly to the MCP client
40
35
  status [--json] Pairing, service, current task and checkpoint
41
36
  disconnect Revoke this computer, then remove local credentials and additions;
42
37
  inside an agent sandbox it names the one command that finishes
43
- Vendors: sentry, uptimerobot, pagerduty, calendly (with a read-only key); sorry (its public page,
44
- no key). Owner approvals stay in the browser.
45
38
  State lives in $RER_BUSINESS_STATE_DIR when set, otherwise in ~/.rer/business.
46
39
  In an agent sandbox that writes only inside its working folder, use RER_BUSINESS_STATE_DIR="$PWD/.rer-business".
40
+ ${appSignInHelp}
47
41
  `;
48
42
 
49
43
  const verbHelp = {
44
+ setup: `Usage: rer business setup --origin URL --session-file FILE --confirm-demo [--hosting managed|assisted|self_host] [--json]
45
+ Create the Business for the synthetic demo company in setup-company.json and save
46
+ its profile, through the platform's owner routes. A repeat reuses that Business and
47
+ changes nothing when its profile already matches. It provisions no seeds.
48
+
49
+ --origin URL Platform address to create the Business on.
50
+ --session-file FILE The signed-in session file Business setup reads: an owned,
51
+ regular 0600 file containing rer_session=VALUE or
52
+ __Host-rer_session=VALUE. Symlinks are refused.
53
+ The session is sent only as the platform Cookie header.
54
+ --confirm-demo Required confirmation to create the synthetic demo company.
55
+ --hosting MODE managed (default), assisted or self_host.
56
+ --json Print the JSON receipt (also the default).
57
+ --help, -h Show this help without reading the session file.
58
+ Exits 0 when the Business exists with that profile; 1 with a named {code} on stderr.
59
+ ${appSignInHelp}
60
+ `,
50
61
  run: `Usage: rer business run [--once]
51
- Work this computer's tasks and check in every 25 seconds until stopped.
52
- When Business needs the owner's catch-up approval or export details,
53
- print the owner step and keep waiting between check-ins. --once returns then.
62
+ Work this computer's tasks (the folder scan the owner allows) and check in every
63
+ 25 seconds until stopped. Steps for this computer's agent, such as a seed's Move in,
64
+ are shown by rer business next. --once returns after one check-in.
54
65
  Exits 0 completed, idle or waiting for the owner; 1 failed; 2 usage.
55
66
  `,
56
67
  connect: `Usage: rer business connect --business ID [--origin URL] [--timeout SECONDS]
@@ -58,7 +69,7 @@ Pair this computer with a Business. Prints a code and a link: the owner opens th
58
69
  link in a signed-in browser, checks the code and approves. Waits for that (up to
59
70
  the code's 10 minutes), then keeps the credential in OS credential storage.
60
71
  --business ID The Business to join; the Connect prompt names it.
61
- --origin URL Business platform address (default: https://app.runeditrun.com).
72
+ --origin URL Business platform address (default: ${appAddress}).
62
73
  --timeout SECONDS Wait at most this long, then exit 75 with the pairing kept;
63
74
  run the same command again to keep waiting (same code).
64
75
  --code CODE Older Business pages: redeem a code made in the browser.
@@ -72,8 +83,8 @@ Requires an existing pairing: rer business connect.
72
83
  };
73
84
 
74
85
  export async function businessCommand(argv) {
75
- if (argv[0] === 'setup') return setupCommand(argv.slice(1));
76
86
  if (Object.hasOwn(verbHelp, argv[0]) && argv.some(arg => ['--help', '-h'].includes(arg))) { process.stdout.write(verbHelp[argv[0]]); return 0; }
87
+ if (argv[0] === 'setup') return setupCommand(argv.slice(1));
77
88
  if (!argv.length || argv[0] !== 'scan' && argv.some(arg => ['--help', '-h'].includes(arg))) { process.stdout.write(usage); return 0; }
78
89
  if (argv[0] === 'scan') return scanCommand(argv);
79
90
  try {
@@ -97,7 +108,7 @@ export async function businessCommand(argv) {
97
108
  } catch { return invalid(); }
98
109
  if (options.origin !== undefined && options.code === undefined && options.business === undefined) originUrl(options.origin);
99
110
  await connect(options);
100
- } else if (verb === 'vendor-key' && args.length === 2) await vendorKey(...args);
111
+ } else if (verb === 'done' && args.length === 3) await done(...args);
101
112
  else if (verb === 'answer' && [3, 4].includes(args.length)) await answer(...args);
102
113
  else if (verb === 'run' && (!args.length || args.length === 1 && args[0] === '--once')) await run({ once: args[0] === '--once' });
103
114
  else if (verb === 'status' && args.length === 1 && args[0] === '--json') await status({ json: true });
@@ -14,7 +14,7 @@ import { revokedText } from './local-commands.mjs';
14
14
  // then and let the server decide whether it was approved in time.
15
15
  const approvalWindow = 600_000;
16
16
 
17
- export const capabilities = ['discover.local', 'export.vendor:sentry', 'export.vendor:uptimerobot', 'export.vendor:pagerduty', 'export.vendor:calendly'];
17
+ export const capabilities = ['discover.local'];
18
18
 
19
19
  const clock = time => new Date(time).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
20
20
  const nothingSent = 'Nothing was sent, so the pairing code still works.';
@@ -35,15 +35,6 @@ export class Lease {
35
35
  { token, ...(releasing ? { timeout: 5_000 } : { signal: this.signal }) });
36
36
  }
37
37
  send(destination, body) { return this.serial(() => this.post(destination, body)); }
38
- /** One door grant for one door request of this lease's vendor task (`extra`
39
- * is `{review: true}` for a catch-up plan the owner reviews). It is not a task
40
- * event, so the platform takes no client event id: a retry simply asks again. */
41
- importGrant(action, extra = {}) {
42
- return this.serial(async () => {
43
- this.signal.throwIfAborted();
44
- return this.api.post(taskPath(this.claim.task.id, 'import-grants'), { fence: this.claim.fence, grant_id: this.claim.grant.id, action, ...extra }, { token: await this.token(), signal: this.signal });
45
- });
46
- }
47
38
  heartbeat() {
48
39
  return this.serial(async () => {
49
40
  const result = await this.post(taskPath(this.claim.task.id, 'heartbeat'), { checkpoint: this.checkpoint, cursor: this.cursor });
@@ -1,14 +1,12 @@
1
1
  import { writeFile, unlink } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { loadState, loadPending, saveState, stateDirectory, removeStateDirectory, removeWorkFiles, deviceCredentialHandle, liveSupervisor } from './state.mjs';
4
- import { createCredentialStore, readSecret } from './keychain.mjs';
4
+ import { createCredentialStore } from './keychain.mjs';
5
5
  import { removeService, serviceStatus } from './service.mjs';
6
6
  import { removePermissions, permissionsAdded } from './permissions.mjs';
7
7
  import { Api, pause } from './api.mjs';
8
8
  import { loadProgress } from './progress.mjs';
9
9
  import { removeCarries } from './carry.mjs';
10
- import { KEYED_VENDORS } from './vendors/index.mjs';
11
- import { vendorHandle } from './vendor-door.mjs';
12
10
  import { rerCommand, businessCommand } from './invocation.mjs';
13
11
  import { describe } from './errors.mjs';
14
12
  import { supportsTaskKind } from './supervisor.mjs';
@@ -69,21 +67,6 @@ export async function revokedByServer(state) {
69
67
  return saved;
70
68
  }
71
69
 
72
- export async function vendorKey(action, vendor) {
73
- if (!['add', 'remove'].includes(action) || !KEYED_VENDORS.includes(vendor)) throw Error(`Choose add or remove and a shipped vendor that reads with a key: ${KEYED_VENDORS.join(', ')}. Sorry needs no key.`);
74
- const { state } = await paired(), store = createCredentialStore(), handle = vendorHandle(vendor);
75
- if (action === 'add') {
76
- let secret = await readSecret();
77
- try { await store.set(handle, secret); } finally { secret = undefined; }
78
- state.vendorHandles = [...new Set([...(state.vendorHandles ?? []), handle])];
79
- } else {
80
- await store.delete(handle);
81
- state.vendorHandles = (state.vendorHandles ?? []).filter(item => item !== handle);
82
- }
83
- await saveState(state);
84
- process.stdout.write(`${vendor}:read ${action === 'add' ? 'stored in OS keychain' : 'removed'}.\n`);
85
- }
86
-
87
70
  async function stopSupervisor(directory) {
88
71
  const lock = join(directory, 'run.lock');
89
72
  if (!await liveSupervisor(lock)) return;
@@ -1,10 +1,9 @@
1
- import { sensitive, credentialShaped, blockedSignal } from './detector.mjs';
1
+ import { sensitive, blockedSignal } from './detector.mjs';
2
2
 
3
3
  export function assertOutbound(value, knownSecrets = []) {
4
4
  function visit(item) {
5
5
  if (typeof item === 'string') {
6
- // Vendor records can contain ordinary line breaks. Inspect their text without
7
- // changing the bytes that will be uploaded. All credential/entropy rules apply.
6
+ // Inspect text with line breaks as ordinary spaces; all credential/entropy rules apply.
8
7
  if (sensitive(item.replace(/[\r\n\t]/g, ' ')) || knownSecrets.some(secret => secret && item.includes(secret))) {
9
8
  throw Error('Business outbound detector refused secret-shaped content.');
10
9
  }
@@ -14,17 +13,6 @@ export function assertOutbound(value, knownSecrets = []) {
14
13
  visit(value);
15
14
  }
16
15
 
17
- /** A vendor export item bound for the owner's own app. Chunks may be fragments
18
- * of a JSON document, so the complete UTF-8 text is inspected before any network
19
- * write: the owner's key and every known credential shape are refused. The
20
- * entropy heuristic for names-only signals does not apply here: vendor records
21
- * are made of opaque ids, hashes and API links (Sentry's 32-hex event ids,
22
- * PagerDuty's `self` URLs), and they go only to the owner's own app. */
23
- export function assertChunk(bytes, knownSecrets) {
24
- const text = Buffer.from(bytes).toString('utf8');
25
- if (credentialShaped(text.replace(/[\r\n\t]/g, ' ')) || knownSecrets.some(secret => secret && text.includes(secret))) throw Error('Business outbound detector refused secret-shaped content.');
26
- }
27
-
28
16
  // Names-only signals share the scanner's field-aware path policy. A locator
29
17
  // joins ordinary directory names; credential shapes still apply across its
30
18
  // entire spelling, and entropy is checked within each path segment.