@runeditrun/rer 0.2.100 → 0.2.102
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 +30 -102
- package/cli/README.md +16 -89
- package/cli/app-address.mjs +2 -0
- package/cli/business/api.mjs +2 -1
- package/cli/business/choices.mjs +1 -1
- package/cli/business/command.mjs +36 -30
- package/cli/business/connect.mjs +1 -1
- package/cli/business/lease.mjs +0 -9
- package/cli/business/local-commands.mjs +1 -27
- package/cli/business/outbound.mjs +2 -14
- package/cli/business/questions.mjs +85 -48
- package/cli/business/service.mjs +1 -24
- package/cli/business/setup-command.mjs +33 -26
- package/cli/business/state.mjs +1 -1
- package/cli/business/supervisor.mjs +26 -91
- package/cli/companion/command.mjs +2 -0
- package/cli/demo-native.mjs +1 -1
- package/cli/parse.mjs +2 -1
- package/global/CHANGELOG.md +32 -0
- package/global/README.md +30 -102
- package/global/main.mjs +2 -0
- package/modules/container/adapters/d1-limits.mjs +2 -10
- package/modules/d1-transport/limits.d.mts +10 -0
- package/modules/d1-transport/limits.mjs +10 -0
- package/modules/demo-host/native/prepare.mjs +2 -1
- package/modules/deploy-kit/d1-import.mjs +11 -1
- package/modules/deploy-kit/migrations.mjs +14 -1
- package/modules/import-kit/schema/importers.schema.json +104 -2
- package/modules/import-kit/src/d1/README.md +14 -0
- package/modules/import-kit/src/d1/apply-reads.ts +74 -0
- package/modules/import-kit/src/d1/apply.ts +32 -9
- package/modules/import-kit/src/d1/history.ts +2 -2
- package/modules/import-kit/src/d1/redaction-step.ts +17 -7
- package/modules/import-kit/src/d1/types.ts +11 -0
- package/modules/import-kit/src/door/ADOPTING.md +0 -37
- package/modules/import-kit/src/door/README.md +0 -66
- package/modules/import-kit/src/door/admission.ts +3 -13
- package/modules/import-kit/src/door/authority.ts +0 -1
- package/modules/import-kit/src/door/failures.ts +1 -1
- package/modules/import-kit/src/door/grants.ts +5 -19
- package/modules/import-kit/src/door/handler.ts +1 -12
- package/modules/import-kit/src/door/index.ts +0 -6
- package/modules/import-kit/src/door/planning.ts +19 -44
- package/modules/import-kit/src/door/protocol.ts +2 -4
- package/modules/import-kit/src/door/schema.ts +0 -2
- package/modules/import-kit/src/door/store.ts +2 -2
- package/modules/import-kit/src/door/types.ts +1 -24
- package/modules/import-kit/src/provenance/credentials.ts +14 -5
- package/modules/import-kit/src/status/evidence.ts +3 -1
- package/modules/import-kit/src/status/index.ts +17 -2
- package/modules/import-kit/src/status/schema.ts +8 -0
- package/modules/import-kit/src/status/types.ts +25 -4
- package/package.json +1 -1
- package/cli/business/archive-task.mjs +0 -32
- package/cli/business/bounded-waves.d.mts +0 -23
- package/cli/business/bounded-waves.mjs +0 -57
- package/cli/business/catchup-task.mjs +0 -49
- package/cli/business/export-inputs.mjs +0 -79
- package/cli/business/export-task.mjs +0 -24
- package/cli/business/legacy-package.mjs +0 -117
- package/cli/business/package-transfer.mjs +0 -127
- package/cli/business/setup-demo.mjs +0 -95
- package/cli/business/vendor-door.mjs +0 -303
- package/cli/business/vendors/README.md +0 -215
- package/cli/business/vendors/calendly.mjs +0 -80
- package/cli/business/vendors/common.mjs +0 -280
- package/cli/business/vendors/credential-names.mjs +0 -124
- package/cli/business/vendors/index.mjs +0 -96
- package/cli/business/vendors/pagerduty.mjs +0 -61
- package/cli/business/vendors/sentry.mjs +0 -85
- package/cli/business/vendors/sorry.mjs +0 -106
- package/cli/business/vendors/uptimerobot.mjs +0 -21
- package/cli/business/vendors/zendesk-attachments.mjs +0 -57
- package/cli/business/vendors/zendesk-encode.mjs +0 -133
- package/cli/business/vendors/zendesk-guide.mjs +0 -34
- package/cli/business/vendors/zendesk-package.mjs +0 -28
- package/cli/business/vendors/zendesk-pages.mjs +0 -61
- package/cli/business/vendors/zendesk-people.mjs +0 -7
- package/cli/business/vendors/zendesk-store.mjs +0 -154
- package/cli/business/vendors/zendesk-tickets.mjs +0 -21
- package/cli/business/vendors/zendesk-token.mjs +0 -31
- package/cli/business/vendors/zendesk-transport.mjs +0 -48
- package/cli/business/vendors/zendesk.mjs +0 -61
- package/modules/import-kit/src/door/package.ts +0 -121
- package/modules/import-kit/src/door/waves/README.md +0 -158
- package/modules/import-kit/src/door/waves/digests.ts +0 -38
- package/modules/import-kit/src/door/waves/inventory.ts +0 -84
- package/modules/import-kit/src/door/waves/journal.ts +0 -19
- package/modules/import-kit/src/door/waves/lifecycle.ts +0 -242
- package/modules/import-kit/src/door/waves/preparation.ts +0 -190
- package/modules/import-kit/src/door/waves/schema.ts +0 -73
- package/modules/import-kit/src/door/waves/store.ts +0 -112
- package/modules/import-kit/src/door/waves/types.ts +0 -76
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
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
`
|
|
439
|
-
|
|
440
|
-
|
|
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. `--
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
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" (
|
|
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.
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
@@ -582,31 +582,24 @@ expire within 15 minutes and are never saved. Restarting retires them.
|
|
|
582
582
|
rer business setup --origin https://app.runeditrun.com --session-file /private/path/owner.session --confirm-demo
|
|
583
583
|
```
|
|
584
584
|
|
|
585
|
-
This
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
`
|
|
589
|
-
|
|
590
|
-
|
|
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.
|
|
591
594
|
|
|
592
595
|
Hosting defaults to `managed`; `--hosting assisted` and `--hosting self_host`
|
|
593
|
-
are also supported. There is no `hosted` alias. `--
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
receipt includes each seed's state and a top-level `complete` flag. Exit 0
|
|
601
|
-
requires `complete: true`: every required seed must be provisioned, token-issued,
|
|
602
|
-
policy-confirmed, settings-delivered and have its door proofs recorded.
|
|
603
|
-
Missing adoptions remain `not yet on the agent door` and exit nonzero.
|
|
604
|
-
|
|
605
|
-
The route order, policy, synthetic company profile and receipt are mirrored from
|
|
606
|
-
the RER platform at commit `0261033177e8e05284c037369ee9c3a85922a8aa`,
|
|
607
|
-
`scripts/business/demo.mjs` and `demo/company.json`. The platform owns the seed
|
|
608
|
-
catalogue, fixture data and door proofs. This command does not pair the computer
|
|
609
|
-
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.
|
|
610
603
|
|
|
611
604
|
## Sync agent contract clauses
|
|
612
605
|
|
|
@@ -622,69 +615,3 @@ new clauses start missing, and seed-owned AGENT and SURFACE clauses stay intact.
|
|
|
622
615
|
Run the edition's source-lock command last. See
|
|
623
616
|
[Contract clauses](../modules/agent-door/ADOPTING.md#contract-clauses) for source
|
|
624
617
|
delivery and generation details.
|
|
625
|
-
|
|
626
|
-
## Zendesk offline snapshots
|
|
627
|
-
|
|
628
|
-
The owner creates one confidential OAuth client in Zendesk Admin Center, owned
|
|
629
|
-
by an admin (incremental exports require admin access), whose allowed scopes are
|
|
630
|
-
read-only. Allow `tickets:read users:read organizations:read hc:read
|
|
631
|
-
ticket_attachments:read`, or the account's read-only `read` scope. Do not allow
|
|
632
|
-
write scopes. In the same sitting, on the paired computer, run:
|
|
633
|
-
|
|
634
|
-
```sh
|
|
635
|
-
rer business vendor-key add zendesk
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
At the hidden prompt enter one line of JSON with `client_id` and
|
|
639
|
-
`client_secret`. Never put it in an argument, environment variable, chat or
|
|
640
|
-
Business. macOS Keychain or Linux Secret Service keeps it as
|
|
641
|
-
`vendor:zendesk:read`; no file fallback exists. Each run mints a 1,800-second
|
|
642
|
-
client-credentials token and checks its current scopes before requesting data.
|
|
643
|
-
Only this OAuth mint uses POST. Every data request is GET. The CLI never changes
|
|
644
|
-
Zendesk. A 401/403 pauses for the existing key-replacement step; rerunning resumes
|
|
645
|
-
acknowledged pages with a new short-lived token.
|
|
646
|
-
|
|
647
|
-
Business supplies `{account:{subdomain},mode,highWater}` to the leased task.
|
|
648
|
-
`mode` defaults to `snapshot`. `sweep` requires the retained snapshot's numeric
|
|
649
|
-
`highWater`, reads incremental tickets after it, refreshes their comments and
|
|
650
|
-
attachments, and delivers a complete snapshot including retained older records.
|
|
651
|
-
`census` reads only incremental tickets from zero, counts unique ids and tickets
|
|
652
|
-
newer than `highWater`, and saves `rer-zendesk-census/1` locally. It never uploads
|
|
653
|
-
a partial snapshot. Business census task outputs remain a separate adoption:
|
|
654
|
-
the CLI reports `CENSUS_OUTPUTS_UNSUPPORTED` and pauses after the local result.
|
|
655
|
-
|
|
656
|
-
Raw pages, provenance, deduplicated SHA-256 blobs, a constant-size checkpoint,
|
|
657
|
-
transfer metadata and the census live in a private `zendesk-<business/account
|
|
658
|
-
hash>` directory under the Business state directory. The snapshot survives task
|
|
659
|
-
handover, upload refusal and process death until retire; a new computer starts
|
|
660
|
-
from zero. Do not edit its objects: every referenced hash and size is verified
|
|
661
|
-
on resume before any network request. Keep this private customer data on an
|
|
662
|
-
encrypted disk with the same custody as an authorized Zendesk export.
|
|
663
|
-
|
|
664
|
-
A `retire` input deletes the Zendesk key and all retained Zendesk stores, records
|
|
665
|
-
local revocation, and refuses later exports. It never calls a provider revoke or
|
|
666
|
-
write endpoint; outstanding short-lived tokens expire. Business's retire task
|
|
667
|
-
acknowledgement is a separate adoption (`RETIRE_OUTPUTS_UNSUPPORTED`).
|
|
668
|
-
`rer business vendor-key remove zendesk` performs the same local revocation;
|
|
669
|
-
`disconnect` also removes the retained snapshots. Do not retire before the mail
|
|
670
|
-
rollback window and Zendesk retire decision.
|
|
671
|
-
|
|
672
|
-
The destination receives wrapped HH `happytohelp-zendesk-offline-v1` NDJSON.
|
|
673
|
-
Archived tickets are included, deleted tickets remain census tombstones, private
|
|
674
|
-
comments remain private, and source reply-routing and restriction fields stay.
|
|
675
|
-
Credential-shaped content is deterministically removed from the delivered copy
|
|
676
|
-
and listed by record kind, id and JSON pointer in the local census. Raw data
|
|
677
|
-
stays private locally. URLs lose access query/fragment/userinfo; attachment
|
|
678
|
-
access URL fields are removed from the delivered copy. Unavailable attachments
|
|
679
|
-
are counted with fixed reasons; no binding is invented.
|
|
680
|
-
|
|
681
|
-
A whole snapshot fitting 2 MiB, 5,000 records, 128 KiB per ticket, and at most
|
|
682
|
-
20 inline attachments of 48 KiB per ticket goes as one v1 bundle. Anything larger
|
|
683
|
-
uses the shared logical package sender with path bindings, deduplicated blobs,
|
|
684
|
-
census, tombstones and Guide sidecars. The manifest probes the destination
|
|
685
|
-
before segments are sent. A destination without the package-aware reader answers
|
|
686
|
-
`SEED_PACKAGE_UNSUPPORTED`: the complete local snapshot stays and no segments
|
|
687
|
-
are uploaded. Never narrow the snapshot to fit. Translations, categories, sections,
|
|
688
|
-
segments, article media and tombstones are retained as package sidecars and
|
|
689
|
-
counted pending HH adoption. This is a synthetic-edge implementation, not proof
|
|
690
|
-
of real-account parity, client-scope availability or a completed migration.
|
package/cli/business/api.mjs
CHANGED
|
@@ -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 =
|
|
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);
|
package/cli/business/choices.mjs
CHANGED
|
@@ -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
|
|
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
|
|
package/cli/business/command.mjs
CHANGED
|
@@ -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 {
|
|
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,48 +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
|
-
|
|
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
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
33
|
-
|
|
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
|
-
|
|
38
|
-
types it in their own terminal, never in chat or a command
|
|
39
|
-
Zendesk: single-line {"client_id":"…","client_secret":"…"}; remove
|
|
40
|
-
revokes local export and deletes its retained snapshot
|
|
41
|
-
legacy-package add|remove|status DIR
|
|
42
|
-
Register a verified HappyToHelp legacy package (no key)
|
|
33
|
+
done ID --note TEXT Finish a Move in step once the owner has the data in the seed
|
|
43
34
|
token MCP headersHelper output; send directly to the MCP client
|
|
44
35
|
status [--json] Pairing, service, current task and checkpoint
|
|
45
36
|
disconnect Revoke this computer, then remove local credentials and additions;
|
|
46
37
|
inside an agent sandbox it names the one command that finishes
|
|
47
|
-
Vendors: sentry, uptimerobot, pagerduty, calendly, zendesk (with a read-only key); sorry (its public page,
|
|
48
|
-
no key); happytohelp-legacy (a local package, no key). Owner approvals stay in the browser.
|
|
49
38
|
State lives in $RER_BUSINESS_STATE_DIR when set, otherwise in ~/.rer/business.
|
|
50
39
|
In an agent sandbox that writes only inside its working folder, use RER_BUSINESS_STATE_DIR="$PWD/.rer-business".
|
|
40
|
+
${appSignInHelp}
|
|
51
41
|
`;
|
|
52
42
|
|
|
53
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
|
+
`,
|
|
54
61
|
run: `Usage: rer business run [--once]
|
|
55
|
-
Work this computer's tasks and check in every
|
|
56
|
-
|
|
57
|
-
|
|
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.
|
|
58
65
|
Exits 0 completed, idle or waiting for the owner; 1 failed; 2 usage.
|
|
59
66
|
`,
|
|
60
67
|
connect: `Usage: rer business connect --business ID [--origin URL] [--timeout SECONDS]
|
|
@@ -62,7 +69,7 @@ Pair this computer with a Business. Prints a code and a link: the owner opens th
|
|
|
62
69
|
link in a signed-in browser, checks the code and approves. Waits for that (up to
|
|
63
70
|
the code's 10 minutes), then keeps the credential in OS credential storage.
|
|
64
71
|
--business ID The Business to join; the Connect prompt names it.
|
|
65
|
-
--origin URL Business platform address (default:
|
|
72
|
+
--origin URL Business platform address (default: ${appAddress}).
|
|
66
73
|
--timeout SECONDS Wait at most this long, then exit 75 with the pairing kept;
|
|
67
74
|
run the same command again to keep waiting (same code).
|
|
68
75
|
--code CODE Older Business pages: redeem a code made in the browser.
|
|
@@ -76,8 +83,8 @@ Requires an existing pairing: rer business connect.
|
|
|
76
83
|
};
|
|
77
84
|
|
|
78
85
|
export async function businessCommand(argv) {
|
|
79
|
-
if (argv[0] === 'setup') return setupCommand(argv.slice(1));
|
|
80
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));
|
|
81
88
|
if (!argv.length || argv[0] !== 'scan' && argv.some(arg => ['--help', '-h'].includes(arg))) { process.stdout.write(usage); return 0; }
|
|
82
89
|
if (argv[0] === 'scan') return scanCommand(argv);
|
|
83
90
|
try {
|
|
@@ -101,8 +108,7 @@ export async function businessCommand(argv) {
|
|
|
101
108
|
} catch { return invalid(); }
|
|
102
109
|
if (options.origin !== undefined && options.code === undefined && options.business === undefined) originUrl(options.origin);
|
|
103
110
|
await connect(options);
|
|
104
|
-
} else if (verb === '
|
|
105
|
-
else if (verb === 'legacy-package' && args.length === 2 && ['add', 'remove', 'status'].includes(args[0])) await legacyPackage(...args);
|
|
111
|
+
} else if (verb === 'done' && args.length === 3) await done(...args);
|
|
106
112
|
else if (verb === 'answer' && [3, 4].includes(args.length)) await answer(...args);
|
|
107
113
|
else if (verb === 'run' && (!args.length || args.length === 1 && args[0] === '--once')) await run({ once: args[0] === '--once' });
|
|
108
114
|
else if (verb === 'status' && args.length === 1 && args[0] === '--json') await status({ json: true });
|
package/cli/business/connect.mjs
CHANGED
|
@@ -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'
|
|
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.';
|
package/cli/business/lease.mjs
CHANGED
|
@@ -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,18 +1,14 @@
|
|
|
1
|
-
export { legacyPackage } from './legacy-package.mjs';
|
|
2
1
|
import { writeFile, unlink } from 'node:fs/promises';
|
|
3
2
|
import { join } from 'node:path';
|
|
4
3
|
import { loadState, loadPending, saveState, stateDirectory, removeStateDirectory, removeWorkFiles, deviceCredentialHandle, liveSupervisor } from './state.mjs';
|
|
5
|
-
import { createCredentialStore
|
|
4
|
+
import { createCredentialStore } from './keychain.mjs';
|
|
6
5
|
import { removeService, serviceStatus } from './service.mjs';
|
|
7
6
|
import { removePermissions, permissionsAdded } from './permissions.mjs';
|
|
8
7
|
import { Api, pause } from './api.mjs';
|
|
9
8
|
import { loadProgress } from './progress.mjs';
|
|
10
9
|
import { removeCarries } from './carry.mjs';
|
|
11
|
-
import { KEYED_VENDORS } from './vendors/index.mjs';
|
|
12
|
-
import { vendorHandle } from './vendor-door.mjs';
|
|
13
10
|
import { rerCommand, businessCommand } from './invocation.mjs';
|
|
14
11
|
import { describe } from './errors.mjs';
|
|
15
|
-
import { clientCredential, removeZendeskStores } from './vendors/zendesk.mjs';
|
|
16
12
|
import { supportsTaskKind } from './supervisor.mjs';
|
|
17
13
|
|
|
18
14
|
export async function paired() {
|
|
@@ -46,7 +42,6 @@ export async function forgetLocally(state, { stopRun = true } = {}) {
|
|
|
46
42
|
for (const handle of store ? state.vendorHandles ?? [] : []) if (await attempt('vendorKeys', () => store.delete(handle))) vendorKeys.push(handle);
|
|
47
43
|
const refused = store ? await attempt('credential', () => store.delete(deviceCredentialHandle(state))) : undefined;
|
|
48
44
|
await removeCarries();
|
|
49
|
-
await removeZendeskStores(directory);
|
|
50
45
|
if (!leftovers.length) { await removeStateDirectory(); return []; }
|
|
51
46
|
const unique = [...new Set(leftovers)];
|
|
52
47
|
const cause = refused && (refused.sandboxRefused ? `macOS Keychain refused to remove it inside this agent sandbox (security exited with status ${refused.osStatus ?? 'unknown'}).` : describe(refused));
|
|
@@ -68,31 +63,10 @@ export async function revokedByServer(state) {
|
|
|
68
63
|
if (await permissionsAdded()) leftovers.push('permissions');
|
|
69
64
|
const saved = { ...state, revoked: { at: new Date().toISOString(), leftovers, ...(cause ? { cause } : {}) } };
|
|
70
65
|
await saveState(saved);
|
|
71
|
-
await removeZendeskStores(stateDirectory());
|
|
72
66
|
await removeWorkFiles(['state.json', 'permissions.json', 'service.json', 'run.lock', 'carried.json']);
|
|
73
67
|
return saved;
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
export async function vendorKey(action, vendor) {
|
|
77
|
-
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.`);
|
|
78
|
-
const { state } = await paired(), store = createCredentialStore(), handle = vendorHandle(vendor);
|
|
79
|
-
if (action === 'add') {
|
|
80
|
-
let secret = await readSecret();
|
|
81
|
-
try { if (vendor === 'zendesk') clientCredential(secret); await store.set(handle, secret); } finally { secret = undefined; }
|
|
82
|
-
state.vendorHandles = [...new Set([...(state.vendorHandles ?? []), handle])];
|
|
83
|
-
} else {
|
|
84
|
-
if (vendor === 'zendesk') await stopSupervisor(stateDirectory());
|
|
85
|
-
await store.delete(handle);
|
|
86
|
-
if (vendor === 'zendesk') {
|
|
87
|
-
await removeZendeskStores(stateDirectory());
|
|
88
|
-
state.vendorRevocations = { ...state.vendorRevocations, zendesk: true };
|
|
89
|
-
}
|
|
90
|
-
state.vendorHandles = (state.vendorHandles ?? []).filter(item => item !== handle);
|
|
91
|
-
}
|
|
92
|
-
await saveState(state);
|
|
93
|
-
process.stdout.write(`${vendor}:read ${action === 'add' ? 'stored in OS keychain' : 'removed'}.\n`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
70
|
async function stopSupervisor(directory) {
|
|
97
71
|
const lock = join(directory, 'run.lock');
|
|
98
72
|
if (!await liveSupervisor(lock)) return;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { sensitive,
|
|
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
|
-
//
|
|
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.
|