@runeditrun/rer 0.2.62 → 0.2.64
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 +48 -27
- package/cli/README.md +26 -2
- package/cli/business/api.mjs +40 -6
- package/cli/business/command.mjs +8 -6
- package/cli/business/connect.mjs +80 -44
- package/cli/business/device.mjs +20 -0
- package/cli/business/errors.mjs +26 -0
- package/cli/business/keychain.mjs +48 -17
- package/cli/business/local-commands.mjs +5 -7
- package/cli/business/opt-ins.mjs +13 -4
- package/cli/business/permissions.mjs +3 -1
- package/cli/business/policy.mjs +1 -1
- package/cli/business/scan-command.mjs +6 -3
- package/cli/business/service.mjs +6 -3
- package/cli/business/state.mjs +67 -10
- package/cli/business/vendors/README.md +13 -0
- package/cli/contract.mjs +2 -2
- package/cli/parse.mjs +2 -1
- package/global/CHANGELOG.md +11 -0
- package/global/README.md +48 -27
- package/modules/container/README.md +15 -1
- package/modules/dependencies/README.md +16 -1
- package/modules/erasure/README.md +15 -1
- package/modules/portability/README.md +17 -0
- package/onboarding/README.md +17 -2
- package/onboarding/schema/SETUP.schema.json +8 -0
- package/onboarding/schema/setup-validation.mjs +15 -1
- package/onboarding/setup-manifest.mjs +4 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readFile, writeFile, unlink,
|
|
2
|
-
import {
|
|
3
|
-
import { loadState, loadPending, saveState, stateDirectory, credentialHandle } from './state.mjs';
|
|
1
|
+
import { readFile, writeFile, unlink, lstat } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { loadState, loadPending, saveState, stateDirectory, removeStateDirectory, credentialHandle } from './state.mjs';
|
|
4
4
|
import { createCredentialStore, readSecret } from './keychain.mjs';
|
|
5
5
|
import { removeService, serviceStatus } from './service.mjs';
|
|
6
6
|
import { removePermissions } from './permissions.mjs';
|
|
@@ -13,7 +13,7 @@ export async function paired() {
|
|
|
13
13
|
const state = await loadState();
|
|
14
14
|
if (!state?.origin || !state.businessId || !state.executorId) throw Error(`This computer is not paired. Run ${rerCommand()} business connect --code CODE.`);
|
|
15
15
|
const credential = await createCredentialStore().get(credentialHandle(state.origin));
|
|
16
|
-
if (!credential) throw Error('Business
|
|
16
|
+
if (!credential) throw Error(`This computer's Business credential is missing from OS credential storage. Run ${rerCommand()} business disconnect, then connect again with a new code from ${state.origin}/business.`);
|
|
17
17
|
return { state, credential };
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -78,9 +78,7 @@ export async function disconnect() {
|
|
|
78
78
|
for (const handle of state.vendorHandles ?? []) await store.delete(handle);
|
|
79
79
|
if (state.origin) await store.delete(credentialHandle(state.origin));
|
|
80
80
|
}
|
|
81
|
-
await
|
|
82
|
-
// Remove only an empty parent; other rer commands may own it.
|
|
83
|
-
await rmdir(dirname(directory)).catch(error => { if (!['ENOENT', 'ENOTEMPTY', 'EEXIST'].includes(error.code)) throw error; });
|
|
81
|
+
await removeStateDirectory();
|
|
84
82
|
process.stdout.write(revocation === 'revoked'
|
|
85
83
|
? 'Business disconnected. Device revoked; local service, credentials and added permissions removed.\n'
|
|
86
84
|
: `Business disconnected on this computer: local service, credentials and added permissions removed. Nothing was revoked: no device credential was stored here${page ? `. If this computer still shows in ${page}, revoke it there` : ''}.\n`);
|
package/cli/business/opt-ins.mjs
CHANGED
|
@@ -3,22 +3,31 @@ import { installPermissions } from './permissions.mjs';
|
|
|
3
3
|
import { saveState } from './state.mjs';
|
|
4
4
|
import { rerCommand } from './invocation.mjs';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// The server's field names stay internal; people see the browser's sentences.
|
|
7
|
+
export const optIns = {
|
|
8
|
+
installPermissions: 'Add rules so Claude Code never reads your secret files',
|
|
9
|
+
awakeConsent: 'Keep this computer awake while it works',
|
|
10
|
+
installService: 'Install the background service',
|
|
11
|
+
};
|
|
12
|
+
const optInNames = Object.keys(optIns);
|
|
7
13
|
|
|
8
14
|
export async function applyOptIns(api, state) {
|
|
9
15
|
let self;
|
|
10
16
|
// A server without this route answers a device credential with 403 (or 404):
|
|
11
|
-
// nothing is decided yet.
|
|
17
|
+
// nothing is decided yet. This first authenticated request activates the computer.
|
|
12
18
|
try { self = await api.get('/api/business/executors/self'); }
|
|
13
19
|
catch (error) { if (![403, 404].includes(error.status)) throw error; }
|
|
14
20
|
const decisions = Object.fromEntries(optInNames.map(name => [name, self?.optIns?.[name] === true ? true : self?.optIns?.[name] === false ? false : null]));
|
|
15
21
|
if (decisions.installPermissions === true) await installPermissions({ consent: true });
|
|
16
22
|
state.awakeConsent = decisions.awakeConsent === true;
|
|
17
23
|
await saveState(state);
|
|
24
|
+
process.stdout.write(`This computer is connected to Business at ${state.origin}.\n`);
|
|
18
25
|
if (decisions.installService === true) {
|
|
19
26
|
await installService({ consent: true });
|
|
20
|
-
process.stdout.write('
|
|
27
|
+
process.stdout.write('The background service is installed and works tasks after this chat ends.\n');
|
|
21
28
|
} else process.stdout.write(`Run ${rerCommand()} business run to work tasks.\n`);
|
|
22
29
|
const undecided = optInNames.filter(name => decisions[name] === null);
|
|
23
|
-
if (undecided.length)
|
|
30
|
+
if (undecided.length) {
|
|
31
|
+
process.stdout.write(`The owner has not chosen yet:\n${undecided.map(name => ` - ${optIns[name]}\n`).join('')}Ask them to choose on this computer's row in ${state.origin}/business/${encodeURIComponent(state.businessId)}/settings, then run ${rerCommand()} business connect again to apply the choices.\n`);
|
|
32
|
+
}
|
|
24
33
|
}
|
|
@@ -2,6 +2,7 @@ import { mkdir, readFile, writeFile, unlink, rename, lstat, open, rmdir } from '
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join, dirname, isAbsolute } from 'node:path';
|
|
4
4
|
import { createHash, randomUUID } from 'node:crypto';
|
|
5
|
+
import { stateDirectory } from './state.mjs';
|
|
5
6
|
|
|
6
7
|
export const BUSINESS_DENY_RULES = Object.freeze([
|
|
7
8
|
'Read(**/secrets/**)', 'Read(**/.ssh/**)', 'Read(**/.aws/**)', 'Read(**/.gnupg/**)',
|
|
@@ -16,7 +17,8 @@ export const BUSINESS_DENY_RULES = Object.freeze([
|
|
|
16
17
|
|
|
17
18
|
const hash = text => text === null ? null : createHash('sha256').update(text).digest('hex');
|
|
18
19
|
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
19
|
-
function paths(
|
|
20
|
+
function paths(input = {}) {
|
|
21
|
+
const home = input.home ?? homedir(), stateDir = input.stateDir ?? (input.home === undefined ? stateDirectory() : join(home, '.rer', 'business'));
|
|
20
22
|
if (!isAbsolute(home) || !isAbsolute(stateDir)) throw new Error('Business permission paths must be absolute.');
|
|
21
23
|
return { settings: join(home, '.claude', 'settings.json'), receipt: join(stateDir, 'permissions.json'), stateDir };
|
|
22
24
|
}
|
package/cli/business/policy.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { basename } from 'node:path';
|
|
2
2
|
|
|
3
|
-
const outputs = new Set(['node_modules', 'vendor', '.git', 'dist', 'build', 'target', 'coverage', '.next', '.nuxt', '.output', '.cache', '.venv', 'venv', '__pycache__', '.terraform', '.pulumi', '.wrangler', '.rer', '.seed', 'playwright-report', 'test-results']);
|
|
3
|
+
const outputs = new Set(['node_modules', 'vendor', '.git', 'dist', 'build', 'target', 'coverage', '.next', '.nuxt', '.output', '.cache', '.venv', 'venv', '__pycache__', '.terraform', '.pulumi', '.wrangler', '.rer', '.rer-business', '.seed', 'playwright-report', 'test-results']);
|
|
4
4
|
const tools = new Set(['.claude', '.codex', '.cursor', '.worktrees', '.idea', '.vscode', '.vscode-insiders', '.windsurf', '.continue', '.zed', '.aider', '.gemini', '.opencode']);
|
|
5
5
|
|
|
6
6
|
export const toolDirectory = path => path.split('/').some(part => tools.has(part.toLowerCase()));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { scan } from './scan.mjs';
|
|
2
|
+
import { localCause } from './errors.mjs';
|
|
2
3
|
|
|
3
4
|
const usage = 'Usage: rer business scan [DIR...] [--json]\nNames-only local discovery; returns rer-business-signals/1 JSON. No network calls.\n';
|
|
4
5
|
|
|
@@ -19,9 +20,11 @@ export async function scanCommand(argv) {
|
|
|
19
20
|
const result = await scan(directories.length ? directories : [process.cwd()]);
|
|
20
21
|
process.stdout.write(JSON.stringify(result) + '\n');
|
|
21
22
|
return 0;
|
|
22
|
-
} catch {
|
|
23
|
-
// Node/format errors can contain input paths, keys or source excerpts
|
|
24
|
-
|
|
23
|
+
} catch (error) {
|
|
24
|
+
// Node/format errors can contain input paths, keys or source excerpts, so
|
|
25
|
+
// only the system cause is named.
|
|
26
|
+
const cause = localCause(error);
|
|
27
|
+
process.stderr.write(`Business scan could not read a local input${cause ? ` (${cause})` : ', or one was not in a format it reads'}. No scan document was emitted.\n`);
|
|
25
28
|
return 1;
|
|
26
29
|
}
|
|
27
30
|
}
|
package/cli/business/service.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { homedir } from 'node:os';
|
|
|
4
4
|
import { dirname, join, isAbsolute } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { createHash, randomUUID } from 'node:crypto';
|
|
7
|
+
import { stateDirectory } from './state.mjs';
|
|
7
8
|
|
|
8
9
|
const label = 'com.runeditrun.business', unit = 'rer-business.service';
|
|
9
10
|
const digest = text => createHash('sha256').update(text).digest('hex');
|
|
@@ -16,7 +17,7 @@ function execute(binary, args) {
|
|
|
16
17
|
function options(input = {}) {
|
|
17
18
|
const home = input.home ?? homedir(), platform = input.platform ?? process.platform;
|
|
18
19
|
if (!isAbsolute(home) || !['darwin', 'linux'].includes(platform)) throw new Error('Business background services require macOS or Linux and an absolute home directory.');
|
|
19
|
-
const stateDir = input.stateDir ?? join(home, '.rer', 'business');
|
|
20
|
+
const stateDir = input.stateDir ?? (input.home === undefined ? stateDirectory() : join(home, '.rer', 'business'));
|
|
20
21
|
if (!isAbsolute(stateDir)) throw new Error('Business service state directory must be absolute.');
|
|
21
22
|
return { ...input, home, platform, stateDir, run: input.run ?? execute };
|
|
22
23
|
}
|
|
@@ -64,9 +65,11 @@ export async function installService(input = {}) {
|
|
|
64
65
|
if (!isAbsolute(node) || !isAbsolute(entrypoint) || !(await stat(node)).isFile() || !(await stat(entrypoint)).isFile()) throw new Error('Business requires an absolute Node executable and rer entrypoint.');
|
|
65
66
|
const log = join(o.stateDir, 'service.log'), errorLog = join(o.stateDir, 'service-error.log');
|
|
66
67
|
const environmentPath = `${dirname(node)}:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`;
|
|
68
|
+
// A state folder chosen with RER_BUSINESS_STATE_DIR goes with the service.
|
|
69
|
+
const environment = [['HOME', o.home], ['PATH', environmentPath], ...(o.stateDir !== join(o.home, '.rer', 'business') ? [['RER_BUSINESS_STATE_DIR', o.stateDir]] : [])];
|
|
67
70
|
const text = o.platform === 'darwin'
|
|
68
|
-
? `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict>\n<key>Label</key><string>${label}</string>\n<key>ProgramArguments</key><array>${[node, entrypoint, 'business', 'run'].map(arg => `<string>${xml(arg)}</string>`).join('')}</array>\n<key>EnvironmentVariables</key><dict
|
|
69
|
-
: `[Unit]\nDescription=Run Edit Run Business executor\nAfter=network-online.target\n\n[Service]\nType=simple\nExecStart=${[node, entrypoint, 'business', 'run'].map(value => unitValue(value).replaceAll('$', () => '$$')).join(' ')}\nWorkingDirectory=${unitValue(o.home)}\nEnvironment=${
|
|
71
|
+
? `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0"><dict>\n<key>Label</key><string>${label}</string>\n<key>ProgramArguments</key><array>${[node, entrypoint, 'business', 'run'].map(arg => `<string>${xml(arg)}</string>`).join('')}</array>\n<key>EnvironmentVariables</key><dict>${environment.map(([key, value]) => `<key>${key}</key><string>${xml(value)}</string>`).join('')}</dict>\n<key>WorkingDirectory</key><string>${xml(o.home)}</string>\n<key>RunAtLoad</key><true/><key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>\n<key>ThrottleInterval</key><integer>30</integer><key>Umask</key><integer>63</integer>\n<key>StandardOutPath</key><string>${xml(log)}</string><key>StandardErrorPath</key><string>${xml(errorLog)}</string>\n</dict></plist>\n`
|
|
72
|
+
: `[Unit]\nDescription=Run Edit Run Business executor\nAfter=network-online.target\n\n[Service]\nType=simple\nExecStart=${[node, entrypoint, 'business', 'run'].map(value => unitValue(value).replaceAll('$', () => '$$')).join(' ')}\nWorkingDirectory=${unitValue(o.home)}\nEnvironment=${environment.map(([key, value]) => unitValue(`${key}=${value}`)).join(' ')}\nRestart=on-failure\nRestartSec=30\nUMask=0077\n\n[Install]\nWantedBy=default.target\n`;
|
|
70
73
|
const existing = await readOptional(path), oldReceipt = await readOptional(receiptPath);
|
|
71
74
|
if (existing !== null && (!oldReceipt || JSON.parse(oldReceipt).hash !== digest(existing))) throw new Error('A background service already exists at the Business service path; it was not overwritten.');
|
|
72
75
|
if (oldReceipt && existing !== null && existing !== text) throw new Error('Remove the existing Business service before changing its installation paths.');
|
package/cli/business/state.mjs
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile, rename, chmod, open, unlink } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
1
|
+
import { mkdir, readFile, readdir, writeFile, rename, chmod, open, unlink, rm, rmdir, lstat } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { createHash, randomUUID } from 'node:crypto';
|
|
5
|
+
import { localCause } from './errors.mjs';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
// RER_BUSINESS_STATE_DIR names the folder itself, for agent sandboxes that may write only
|
|
8
|
+
// inside their working folder. Without it the state lives in ~/.rer/business.
|
|
9
|
+
// RER_STATE_DIR belongs to rer demo and is never read here.
|
|
10
|
+
export const chosenStateDirectory = () => Boolean(process.env.RER_BUSINESS_STATE_DIR);
|
|
11
|
+
export function stateDirectory() {
|
|
12
|
+
const chosen = process.env.RER_BUSINESS_STATE_DIR;
|
|
13
|
+
if (!chosen) return join(homedir(), '.rer', 'business');
|
|
14
|
+
if (chosen.includes('\0')) throw Error('RER_BUSINESS_STATE_DIR must name a folder.');
|
|
15
|
+
return resolve(chosen);
|
|
16
|
+
}
|
|
7
17
|
export const credentialHandle = origin => `device:${createHash('sha256').update(origin).digest('hex')}`;
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
async function loadJson(name) {
|
|
20
|
+
const path = join(stateDirectory(), name);
|
|
21
|
+
let text;
|
|
22
|
+
try { text = await readFile(path, 'utf8'); }
|
|
23
|
+
// Under a path that is not a folder (ENOTDIR) nothing can have been saved yet.
|
|
24
|
+
catch (error) { if (['ENOENT', 'ENOTDIR'].includes(error.code)) return null; throw error; }
|
|
25
|
+
try { return JSON.parse(text); }
|
|
26
|
+
catch { throw Error(`Business could not read ${path}: it is not valid JSON. Remove it, or run rer business disconnect, then connect again.`); }
|
|
12
27
|
}
|
|
13
28
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
catch (error) { if (error.code === 'ENOENT') return null; throw error; }
|
|
17
|
-
}
|
|
29
|
+
export const loadState = () => loadJson('state.json');
|
|
30
|
+
export const loadPending = () => loadJson('pairing.json');
|
|
18
31
|
export const savePending = pending => saveJson('pairing.json', pending);
|
|
19
32
|
export async function clearPending() {
|
|
20
33
|
await unlink(join(stateDirectory(), 'pairing.json')).catch(error => { if (error.code !== 'ENOENT') throw error; });
|
|
@@ -39,6 +52,50 @@ async function saveJson(name, value) {
|
|
|
39
52
|
} finally { await unlink(temporary).catch(error => { if (error.code !== 'ENOENT') throw error; }); }
|
|
40
53
|
}
|
|
41
54
|
|
|
55
|
+
/** Before a one-use code is spent or an approval collected, prove the state
|
|
56
|
+
* folder takes the same private create, write and replace the pairing needs.
|
|
57
|
+
* Folders made only for the check are removed again, so a refused connect
|
|
58
|
+
* leaves nothing behind.
|
|
59
|
+
*/
|
|
60
|
+
export async function checkStateWritable() {
|
|
61
|
+
const directory = stateDirectory(), probe = join(directory, `${randomUUID()}.tmp`), created = [];
|
|
62
|
+
for (let path = directory; path !== dirname(path); path = dirname(path)) {
|
|
63
|
+
try { await lstat(path); break; } catch (error) { if (error.code !== 'ENOENT') break; created.push(path); }
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
67
|
+
await chmod(directory, 0o700);
|
|
68
|
+
await writeFile(probe, '{}\n', { mode: 0o600, flag: 'wx' });
|
|
69
|
+
await rename(probe, probe + '.check');
|
|
70
|
+
await unlink(probe + '.check');
|
|
71
|
+
} catch (error) {
|
|
72
|
+
await unlink(probe).catch(() => {});
|
|
73
|
+
const fix = chosenStateDirectory()
|
|
74
|
+
? 'Allow writes to that folder in this session, or set RER_BUSINESS_STATE_DIR to a folder this session can write'
|
|
75
|
+
: 'Allow writes to that folder, or set RER_BUSINESS_STATE_DIR to a folder this session can write (in Codex, one inside the working folder, such as RER_BUSINESS_STATE_DIR="$PWD/.rer-business")';
|
|
76
|
+
throw Error(`Business cannot save its state in ${directory}: ${localCause(error) ?? error.message}. Nothing was sent, so the pairing code still works. ${fix}, then run connect again.`);
|
|
77
|
+
} finally {
|
|
78
|
+
for (const path of created) await rmdir(path).catch(() => {});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Files this CLI writes in its state folder. A folder named by RER_BUSINESS_STATE_DIR
|
|
83
|
+
// may hold other things, so only these are removed from it.
|
|
84
|
+
const owned = /^(?:(?:state|pairing|progress|permissions|service)\.json|run\.lock|disconnect|service(?:-error)?\.log|discovery-[A-Za-z0-9_.:-]+\.(?:json|tmp)|.*[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.tmp(?:\.check)?)$/;
|
|
85
|
+
export async function removeStateDirectory() {
|
|
86
|
+
const directory = stateDirectory();
|
|
87
|
+
if (!chosenStateDirectory()) {
|
|
88
|
+
await rm(directory, { recursive: true, force: true });
|
|
89
|
+
// Remove only an empty parent; other rer commands may own it.
|
|
90
|
+
await rmdir(dirname(directory)).catch(error => { if (!['ENOENT', 'ENOTEMPTY', 'EEXIST'].includes(error.code)) throw error; });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
let entries;
|
|
94
|
+
try { entries = await readdir(directory); } catch (error) { if (error.code === 'ENOENT') return; throw error; }
|
|
95
|
+
for (const name of entries) if (owned.test(name)) await rm(join(directory, name), { force: true });
|
|
96
|
+
await rmdir(directory).catch(error => { if (!['ENOENT', 'ENOTEMPTY', 'EEXIST'].includes(error.code)) throw error; });
|
|
97
|
+
}
|
|
98
|
+
|
|
42
99
|
export async function lockSupervisor() {
|
|
43
100
|
const directory = stateDirectory();
|
|
44
101
|
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Shipped vendor exports
|
|
2
2
|
|
|
3
|
+
To bring existing data into a seed, sign in as the owner and use its import
|
|
4
|
+
screen. First step: open this path on the destination app:
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
/app/import
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Upload a supported source export, review the plan and its differences, then
|
|
11
|
+
approve that exact plan to apply it. Reconcile the result against native data;
|
|
12
|
+
use Undo from the same history when needed. Base's reference accepts people JSON
|
|
13
|
+
here, not installation `.rer` archives. Editions adopt this same door
|
|
14
|
+
with their own supported readers and native adapters.
|
|
15
|
+
|
|
3
16
|
`exportVendor(vendor, {key, inputs, checkpoint, signal})` is an async generator.
|
|
4
17
|
It yields `{name, bytes: Buffer, checkpoint}`. Keys remain in memory and are
|
|
5
18
|
attached only to GET requests on the adapter's fixed HTTPS origin. Redirects,
|
package/cli/contract.mjs
CHANGED
|
@@ -12,8 +12,8 @@ const definitions = {
|
|
|
12
12
|
verify: [[], 'Run the complete internal verification target.'],
|
|
13
13
|
reset: [['--yes'], 'Confirmed removal of the declared local inventory only.'],
|
|
14
14
|
deploy: [['--owner-name', '--environment', '--dry-run', '--site', '--demo', '--host', '--env-file', '--image', '--bind-address', '--http-port', '--https-port', '--remove', '--yes', '--set-secret', '--unset-secret', '--rotate-secret'], 'Owner-account deployment and health; dry run validates/builds locally and reads target secret bindings with Cloudflare credentials, without provider writes. Missing required secrets fail as in deploy; missing credentials or unreadable target secrets also fail. Builds and deploy hooks run with the checkout\'s local settings files moved aside, and a build output holding one (.dev.vars, .env) is refused. Declared secrets come from the environment or --env-file (an owned 0600 KEY=VALUE file); a new Worker gets the local setup owner and fresh generated secrets when they are not given. rer keeps the secrets it generates in .rer/deploy/ENVIRONMENT.secrets.env (0600) and reuses them on every redeploy; it refuses to generate a replacement for one a live Worker holds, and --rotate-secret NAME[,NAME] replaces them on purpose. After a healthy deploy rer claims the setup owner on the hosted app with the saved setup owner name and the one-time setup token, then removes the token. If the installer declares an owner-name field and no name is saved, deploy asks once and saves it; --non-interactive requires --owner-name NAME before any upload. --set-secret NAME[,NAME] (each value from the environment or --env-file; repeat the flag or join names with commas) and --unset-secret NAME[,NAME] change those secrets of the deployed Worker without a build, all of them in one new Worker version or none, and record that version; a missing value refuses before any change. --remove --yes deletes what this environment\'s deploy record says rer created (Worker, D1, R2, KV, queues), reads back that each is gone, and touches nothing else. --site deploys the run site instead: an assets-only Worker on its custom domain with www redirected; with --dry-run it builds the site and prints the plan with no provider request. --demo deploys the hosted demo instead (deploy-demo.json): a front Worker on demo.<domain> giving each visitor their own signed-in, throwaway native Worker isolate of this seed with real public reads/checks and simulated external writes; --dry-run writes it to .rer/demo-host with no provider request; --demo --remove --yes deletes that demo (its Worker, demo.<domain> Custom Domain, each only while the record its deploy left proves it the demo\'s), reads back that each is gone, and is a no-op once it is.'],
|
|
15
|
-
export: [['--target', '--output', '--origin', '--session-file'], '
|
|
16
|
-
import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--output'], '
|
|
15
|
+
export: [['--target', '--output', '--origin', '--session-file'], 'For owner move-in, run rer dev and open /app/import: export people there, then upload through the destination door. Developer-only installation backup: complete supported archive of the local copy on this computer, with integrity and exclusions, written to --output. The hosted install cannot be exported yet: --origin or --target remote refuses (exit 2) before any effect and names the command that saves the hosted database.'],
|
|
16
|
+
import: [['--target', '--input', '--journal', '--origin', '--session-file', '--yes', '--legacy-v1', '--acknowledge-unverified-metadata', '--output'], 'For owner move-in, run rer dev and open /app/import: upload, review and apply through the door. Developer-only installation recovery: confirmed atomic restore into an empty destination; --journal LATER_ARCHIVE also fences rows that installation erased since. Backup-only local v1 recovery requires --legacy-v1 --acknowledge-unverified-metadata and a new --output v2 archive; --journal requires normal v2 import.'],
|
|
17
17
|
doctor: [[], 'Read-only installed tool, configuration and state diagnostics.'],
|
|
18
18
|
describe: [[], 'Read-only description of actual command capabilities.'],
|
|
19
19
|
check: [['--profile'], 'Read-only structural command contract and operations validation.'],
|
package/cli/parse.mjs
CHANGED
|
@@ -106,7 +106,8 @@ export function parse(argv, cwd = process.cwd(), { independent = false, deferTai
|
|
|
106
106
|
export function help(verb) {
|
|
107
107
|
if (!verb) return `Usage: rer VERB [FLAGS]\nCommands: ${Object.keys(verbs).join(', ')}, signin, release\nRun rer VERB --help for flags.\n`;
|
|
108
108
|
const known = verbs[verb] ?? (verb === 'signin' ? signinVerb : undefined);
|
|
109
|
-
|
|
109
|
+
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' : '';
|
|
110
|
+
return `${door}Usage: rer ${verb} [FLAGS]\nFlags: ${(known?.flags ?? commonFlags).join(', ')}\n${known?.effects ?? 'Execute the declared OPERATIONS v2 argv with explicit arguments after --.'}\n`;
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
function distance(a,b){let row=Array.from({length:b.length+1},(_,i)=>i);for(let i=1;i<=a.length;i++){const next=[i];for(let j=1;j<=b.length;j++)next[j]=Math.min(next[j-1]+1,row[j]+1,row[j-1]+(a[i-1]===b[j-1]?0:1));row=next;}return row[b.length];}
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.64
|
|
4
|
+
|
|
5
|
+
- **Records start at one import door (#296).** The default seed uses upload, review, apply, reconcile and undo; the legacy importer is removed. Records export/import docs, templates and CLI help start at the door. Installation archives remain a separate backup/restore path. Adopting seeds follow [ADOPTING.md](../modules/import-kit/src/door/ADOPTING.md).
|
|
6
|
+
- **Documented shared-door limits remain.** Erasing a completed head blocks later plans in that lineage. Retired email-labelled jobs return `409 plan_custody_mismatch` on status/undo.
|
|
7
|
+
- **Readable contract progress (#301).** The shared /contract stat block and clause table wrap without overlap from 360 to 2560 pixels.
|
|
8
|
+
|
|
9
|
+
## 0.2.63
|
|
10
|
+
|
|
11
|
+
- **Business connect waits for approval and keeps durable state (#277).** Pairing resumes after interruption, sends a readable device name and working folder, and accepts an explicit `RER_BUSINESS_STATE_DIR` when the usual state folder is unwritable. A refused macOS Keychain write stops before redeeming the code and explains how to approve the command outside the sandbox. Browser choices remain authoritative.
|
|
12
|
+
- **Setup fields and groups can declare their audience (#297).** Public fields accept `audience: "owner" | "developer"`, inherit group audience, and default to owner. Invalid audiences and an owner field inside a developer group are refused. Local installer and terminal setup keep their existing active-field visibility; managed consumers can use the metadata.
|
|
13
|
+
|
|
3
14
|
## 0.2.62
|
|
4
15
|
|
|
5
16
|
- **Themed demo gates keep waiting visibly disabled (#292).** Waiting, working and other non-actionable buttons use muted outlines from the seed’s theme tokens. Turnstile explicitly follows the card’s painted light/dark scheme, including declared dark media tokens.
|
package/global/README.md
CHANGED
|
@@ -371,36 +371,57 @@ formats and syntax may yield no signals.
|
|
|
371
371
|
## Business device commands
|
|
372
372
|
|
|
373
373
|
`rer business connect --code ABCD-1234 [--origin https://app.runeditrun.com]`
|
|
374
|
-
redeems a browser-created code
|
|
375
|
-
approval in the browser that created it
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
374
|
+
redeems a browser-created code, prints a six-digit confirmation number for
|
|
375
|
+
approval in the browser that created it, and waits in the foreground until the
|
|
376
|
+
owner approves or refuses there or the code expires (ten minutes). It exits 0
|
|
377
|
+
only once the computer is active: the credential is stored and the server has
|
|
378
|
+
seen the computer. A refusal or expiry exits 1 with the server's reason.
|
|
379
|
+
Interrupting it (Ctrl-C, or an agent's tool timeout) keeps the redeemed pairing:
|
|
380
|
+
run `rer business connect` again to resume the same pairing and number; a new
|
|
381
|
+
server pairing is never started until the old one is refused, expired or
|
|
382
|
+
disconnected. The waiting line names the command that works from the agent's
|
|
383
|
+
own shell: `rer` when it is on PATH, the launcher install.sh wrote, or
|
|
384
|
+
`npx -y @runeditrun/rer` after an npx run. Pending tokens are kept until the
|
|
385
|
+
code's expiry plus the ten minutes the server allows after an approval, so an
|
|
386
|
+
approval near the code's end can still be collected.
|
|
387
|
+
|
|
388
|
+
State lives in `$RER_BUSINESS_STATE_DIR` when it is set, and in `~/.rer/business`
|
|
389
|
+
otherwise. `RER_STATE_DIR` is `rer demo`'s variable and Business never reads it.
|
|
390
|
+
Connect also sends the computer's plain name (its host name's first word group,
|
|
391
|
+
without the login name, at most 64 characters) and the folder it runs in, so the
|
|
392
|
+
browser can show which computer this is and prefill the scan folder.
|
|
393
|
+
Before redeeming the code (or collecting an approval), connect proves
|
|
394
|
+
it can write that folder and that OS credential storage accepts a write; if
|
|
395
|
+
either fails it stops, names the folder or the cause, and the code still works.
|
|
396
|
+
Device credentials stay in macOS Keychain or Linux Secret Service; there is no
|
|
397
|
+
plaintext credential store. Linux needs `secret-tool` and an unlocked desktop
|
|
398
|
+
Secret Service session. Every failure names its cause: the server's reason, the
|
|
399
|
+
local system cause, or what to change.
|
|
400
|
+
|
|
401
|
+
The owner chooses three things on the computer's row in the browser: "Add rules
|
|
402
|
+
so Claude Code never reads your secret files" (Claude Code user Read deny
|
|
403
|
+
rules), "Keep this computer awake while it works" (export-scoped macOS wake
|
|
404
|
+
prevention) and "Install the background service" (a launchd or systemd user
|
|
405
|
+
service). Connect reads them as `optIns` from device-authenticated
|
|
406
|
+
`GET /api/business/executors/self`, with keys `installPermissions`,
|
|
407
|
+
`awakeConsent` and `installService`; the CLI prints only the sentences. Only
|
|
408
|
+
`true` enables an option. Undecided (`null`) options are listed with a browser
|
|
409
|
+
link; an older server without this route (it answers 403 or 404) leaves all
|
|
410
|
+
options undecided. Run connect again after the owner decides. The first
|
|
411
|
+
device-authenticated request happens after both the credential and local
|
|
412
|
+
pairing state are stored, so a storage failure cannot activate the computer.
|
|
413
|
+
A service installed with `RER_BUSINESS_STATE_DIR` set keeps that folder. Background
|
|
414
|
+
services use absolute Node and CLI paths. No model process is started.
|
|
398
415
|
|
|
399
416
|
An agent can run `npx -y @runeditrun/rer business connect --code ABCD-1234 --origin URL`
|
|
400
417
|
directly, without a global installation. In Codex's workspace-write sandbox,
|
|
401
|
-
allow network access
|
|
402
|
-
|
|
403
|
-
|
|
418
|
+
allow network access, set `RER_BUSINESS_STATE_DIR="$PWD/.rer-business"` so state stays
|
|
419
|
+
inside the working folder, and put npm's cache there too with
|
|
420
|
+
`npm_config_cache="$PWD/.rer/npm"`. macOS refuses Keychain writes from inside
|
|
421
|
+
that sandbox, so connect stops before redeeming and asks for this one command to
|
|
422
|
+
run outside the sandbox (in Codex, approve running that command outside the
|
|
423
|
+
sandbox when it asks); later commands
|
|
424
|
+
only read the credential and run inside the sandbox. Do not install a
|
|
404
425
|
background service or change user settings unless the owner enables those
|
|
405
426
|
options and the sandbox permits their locations.
|
|
406
427
|
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Portable container hosting
|
|
2
2
|
|
|
3
|
+
To bring existing data into a seed, sign in as the owner and use its import
|
|
4
|
+
screen. First step: open this path on the destination app:
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
/app/import
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Upload a supported source export, review the plan and its differences, then
|
|
11
|
+
approve that exact plan to apply it. Reconcile the result against native data;
|
|
12
|
+
use Undo from the same history when needed. Base's reference accepts people JSON
|
|
13
|
+
here, not installation `.rer` archives. Editions adopt this same door
|
|
14
|
+
with their own supported readers and native adapters.
|
|
15
|
+
|
|
3
16
|
An image contains the seed's real Vite server/client build, migrations and the
|
|
4
17
|
shared host. Workers remains the default. Opt in with `platforms` in `deploy.json`:
|
|
5
18
|
|
|
@@ -98,7 +111,8 @@ supervises the process; an unexpected runner exit stops the host so Compose can
|
|
|
98
111
|
restart the complete unit. The runner owns its transport's public-address
|
|
99
112
|
validation and TLS behavior.
|
|
100
113
|
|
|
101
|
-
|
|
114
|
+
To back up and restore this installation in a local container, use the same
|
|
115
|
+
Base archive service and exclusion
|
|
102
116
|
policy as Workers. Stop the serving process first: one-shot transfers acquire
|
|
103
117
|
the same volume lock. `rer archive diff BEFORE AFTER` verifies both entire
|
|
104
118
|
archives, then reports added/removed/changed row keys, objects and payloads.
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Application dependency links
|
|
2
2
|
|
|
3
|
+
To bring existing data into a seed, sign in as the owner and use its import
|
|
4
|
+
screen. First step: open this path on the destination app:
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
/app/import
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Upload a supported source export, review the plan and its differences, then
|
|
11
|
+
approve that exact plan to apply it. Reconcile the result against native data;
|
|
12
|
+
use Undo from the same history when needed. Base's reference accepts people JSON
|
|
13
|
+
here, not installation `.rer` archives. Editions adopt this same door
|
|
14
|
+
with their own supported readers and native adapters.
|
|
15
|
+
|
|
3
16
|
This module implements the application side of the pull-link protocol. Auth's
|
|
4
17
|
provider implementation (auth-7) is separate. `createDependencies` mounts the
|
|
5
18
|
well-known routes and owner controls; `AuthConfig.dependencies: true` resolves
|
|
@@ -180,7 +193,9 @@ refused. Credential consumers must record/check the fence; the provided
|
|
|
180
193
|
with no recorded fence. Editor grants require the actual current install owner;
|
|
181
194
|
OIDC sessions must also match that owner's current issuer/subject account binding.
|
|
182
195
|
|
|
183
|
-
|
|
196
|
+
To back up and restore this installation, apply the following identity policy
|
|
197
|
+
to its archives. This is separate from bringing records in through the door.
|
|
198
|
+
Archives omit server link keys, approvals, code state, provider sessions and OIDC
|
|
184
199
|
transients, preserve durable people/bindings/grant use/sector, set sign-in off and
|
|
185
200
|
mark links as needing re-link. Import checks these conditions and requires an
|
|
186
201
|
explicit fresh provider approval. Local `rer import` returns `needsRelink: true`
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Subject erasure
|
|
2
2
|
|
|
3
|
+
To bring existing data into a seed, sign in as the owner and use its import
|
|
4
|
+
screen. First step: open this path on the destination app:
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
/app/import
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Upload a supported source export, review the plan and its differences, then
|
|
11
|
+
approve that exact plan to apply it. Reconcile the result against native data;
|
|
12
|
+
use Undo from the same history when needed. Base's reference accepts people JSON
|
|
13
|
+
here, not installation `.rer` archives. Editions adopt this same door
|
|
14
|
+
with their own supported readers and native adapters.
|
|
15
|
+
|
|
3
16
|
This dependency-free source module erases one subject (a person, contact,
|
|
4
17
|
requester, booking and so on) and everything a seed declares as depending on
|
|
5
18
|
it, for BASE-DATA-003. Audit records survive with an anonymised reference
|
|
@@ -163,7 +176,8 @@ the seed retires them in its own migration.
|
|
|
163
176
|
only the subject), so an older archive that contains any of those rows is
|
|
164
177
|
refused on restore. The fence's own limit stays: an old archive offered to a
|
|
165
178
|
brand-new store that has no journal cannot be recognised. Supply the owner's
|
|
166
|
-
later journal there (
|
|
179
|
+
later journal there (restore this installation with
|
|
180
|
+
`rer import --journal LATER_ARCHIVE`, separate from the reviewed import door).
|
|
167
181
|
- **import-kit.** `nativeStatements(entity, subject)` returns the whole D1 phase
|
|
168
182
|
as `{sql, params}` statements for `eraseD1ImportTarget(kind, id,
|
|
169
183
|
nativeStatements, context)`. Kit custody, the product cascade and the fence
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Portable installation data
|
|
2
2
|
|
|
3
|
+
To bring existing data into a seed, sign in as the owner and use its import
|
|
4
|
+
screen. First step: open this path on the destination app:
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
/app/import
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Upload a supported source export, review the plan and its differences, then
|
|
11
|
+
approve that exact plan to apply it. Reconcile the result against native data;
|
|
12
|
+
use Undo from the same history when needed. Base's reference accepts people JSON
|
|
13
|
+
here, not installation `.rer` archives. Editions adopt this same door
|
|
14
|
+
with their own supported readers and native adapters.
|
|
15
|
+
|
|
16
|
+
Use this module to back up and restore this installation, separately from
|
|
17
|
+
bringing records in through the reviewed import door. Its restore has no door
|
|
18
|
+
plan or Undo, and the door does not accept its `.rer` archives.
|
|
19
|
+
|
|
3
20
|
This dependency-free source module exports and restores one installation's D1
|
|
4
21
|
tables, R2 objects and optional named byte payloads. It is generalised from the
|
|
5
22
|
Penny and Orbit seeds, with atomic graph restoration from Lamp. Products retain
|
package/onboarding/README.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Shared local setup lifecycle
|
|
2
2
|
|
|
3
|
+
To bring existing data into a seed, sign in as the owner and use its import
|
|
4
|
+
screen. First step: open this path on the destination app:
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
/app/import
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Upload a supported source export, review the plan and its differences, then
|
|
11
|
+
approve that exact plan to apply it. Reconcile the result against native data;
|
|
12
|
+
use Undo from the same history when needed. Base's reference accepts people JSON
|
|
13
|
+
here, not installation `.rer` archives. Editions adopt this same door
|
|
14
|
+
with their own supported readers and native adapters.
|
|
15
|
+
|
|
3
16
|
First-party seeds expose public operations through the RER dispatcher. From a
|
|
4
17
|
runnable seed checkout, the supported local sequence begins with
|
|
5
18
|
`rer install`, `rer setup` and
|
|
@@ -195,11 +208,13 @@ exports and deployment receipts.
|
|
|
195
208
|
|
|
196
209
|
## Data, deployment and verification
|
|
197
210
|
|
|
198
|
-
|
|
211
|
+
To back up and restore this installation, use the local archive runner. This
|
|
212
|
+
is separate from bringing records in through the reviewed import door. Each
|
|
213
|
+
first-party adapter declares which resources that archive export/restore supports.
|
|
199
214
|
Every first-party seed verifies a complete local export/import/export round
|
|
200
215
|
trip across those resources. Archives are private and integrity-checked;
|
|
201
216
|
owner/auth, historical development mail, private settings and transient runtime state remain
|
|
202
|
-
excluded.
|
|
217
|
+
excluded. Archive restore validates and restores atomically into an empty destination.
|
|
203
218
|
Remote transfer is supported only when every required resource has a complete
|
|
204
219
|
adapter implementation; unsupported targets fail visibly.
|
|
205
220
|
|
|
@@ -104,6 +104,10 @@
|
|
|
104
104
|
"help": {
|
|
105
105
|
"type": "string"
|
|
106
106
|
},
|
|
107
|
+
"audience": {
|
|
108
|
+
"enum": ["owner", "developer"],
|
|
109
|
+
"description": "Audience inherited by this group's public fields: owner when absent, or developer. An explicit owner field inside a developer group is invalid. This metadata does not change local installer or rer setup visibility."
|
|
110
|
+
},
|
|
107
111
|
"presentations": {
|
|
108
112
|
"type": "array",
|
|
109
113
|
"items": {
|
|
@@ -141,6 +145,10 @@
|
|
|
141
145
|
"secret"
|
|
142
146
|
]
|
|
143
147
|
},
|
|
148
|
+
"audience": {
|
|
149
|
+
"enum": ["owner", "developer"],
|
|
150
|
+
"description": "Public fields only: owner or developer. When absent, inherit the group's audience, or owner without a group audience. An explicit owner value inside a developer group is invalid. This metadata does not change local installer or rer setup visibility; secret visibility uses ownerVisible and input."
|
|
151
|
+
},
|
|
144
152
|
"required": {
|
|
145
153
|
"type": "boolean"
|
|
146
154
|
},
|