@runeditrun/rer 0.2.109 → 0.2.111
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 +24 -0
- package/cli/agent-door.mjs +12 -45
- package/cli/agent-history-database.mjs +13 -6
- package/cli/bounded.mjs +3 -3
- package/cli/contract.mjs +5 -1
- package/cli/deploy-command.mjs +5 -2
- package/cli/deploy-inputs.mjs +1 -1
- package/cli/deploy-needs.mjs +12 -1
- package/cli/hosted-output.mjs +30 -10
- package/cli/hosted-owner.mjs +85 -0
- package/cli/inspect.mjs +23 -12
- package/cli/lifecycle.mjs +6 -2
- package/cli/main.mjs +13 -0
- package/cli/parse.mjs +4 -4
- package/cli/pnpm-chatter.mjs +25 -0
- package/cli/size/build-facts.mjs +58 -0
- package/cli/size/build-paths.mjs +3 -0
- package/cli/size/check.mjs +16 -0
- package/cli/size/clauses.mjs +21 -0
- package/cli/size/clock.mjs +21 -0
- package/cli/size/command.mjs +64 -0
- package/cli/size/declaration.mjs +87 -0
- package/cli/size/dml-parts.mjs +108 -0
- package/cli/size/examples/happytohelp.json +68 -0
- package/cli/size/expression-depth.mjs +45 -0
- package/cli/size/expression.mjs +33 -0
- package/cli/size/fixture.mjs +139 -0
- package/cli/size/flows.mjs +81 -0
- package/cli/size/from-items.mjs +124 -0
- package/cli/size/grow.mjs +83 -0
- package/cli/size/install.mjs +136 -0
- package/cli/size/json-duplicates.mjs +45 -0
- package/cli/size/limits.mjs +9 -0
- package/cli/size/measure.mjs +9 -0
- package/cli/size/meter.mjs +167 -0
- package/cli/size/personas.mjs +138 -0
- package/cli/size/report.mjs +23 -0
- package/cli/size/schema-objects.mjs +80 -0
- package/cli/size/schema.mjs +56 -0
- package/cli/size/statements.mjs +53 -0
- package/cli/size/validate-flows.mjs +109 -0
- package/cli/size/validate-kit.mjs +44 -0
- package/cli/size/validate-shape.mjs +75 -0
- package/cli/size/verdict.mjs +131 -0
- package/cli/size/verify-step.mjs +35 -0
- package/global/CHANGELOG.md +51 -0
- package/global/README.md +24 -0
- package/global/cli/path-link.mjs +1 -1
- package/global/launch/dev.mjs +2 -2
- package/global/main.mjs +1 -1
- package/modules/agent-door/conformance/audit.mjs +3 -0
- package/modules/d1-transport/limits.mjs +5 -1
- package/modules/deploy-kit/sql-tokens.mjs +5 -4
- package/modules/operator-auth/README.md +1 -1
- package/modules/operator-auth/accounts/admin.mjs +9 -3
- package/modules/operator-auth/accounts/one-click.mjs +8 -1
- package/modules/operator-auth/dev/index.mjs +7 -1
- package/modules/operator-auth/dev/invited.mjs +11 -0
- package/modules/operator-auth/dev-gate.mjs +4 -3
- package/modules/operator-auth/identity/email-link/index.mjs +2 -0
- package/modules/operator-auth/index.d.mts +2 -1
- package/modules/operator-auth/routes.mjs +4 -0
- package/modules/release/README.md +8 -0
- package/modules/release/archive-guard.mjs +22 -0
- package/modules/release/archive-members.mjs +49 -0
- package/modules/release/export.mjs +7 -1
- package/package.json +2 -1
|
@@ -41,7 +41,7 @@ export const EXCHANGE_SCRIPT = "(()=>{const exchange=()=>{const h=new URLSearchP
|
|
|
41
41
|
// the product and shown beside the wordmark text; a seed that declares no logo shows
|
|
42
42
|
// its product name as text alone.
|
|
43
43
|
const PAGE_STYLE = 'body{margin:0;font:16px/1.5 var(--rer-font-body,system-ui,sans-serif);color:var(--rer-text,#17212e);background:var(--rer-page,#f5f7fa)}main{max-width:36rem;margin:0 auto;padding:32px 16px}'
|
|
44
|
-
+ '.brand{display:flex;align-items:center;gap:12px;margin:0 0 28px;font:600 24px/1.2 var(--rer-font-heading,var(--rer-font-body,inherit));color:var(--rer-text,#17212e)}.brand img{display:block;flex:none;width:40px;height:40px;object-fit:contain}h1{font:600 20px/1.3 var(--rer-font-heading,var(--rer-font-body,inherit));margin:0 0 12px}p{color:var(--rer-muted,#475569);margin:0}';
|
|
44
|
+
+ '.brand{display:flex;align-items:center;gap:12px;margin:0 0 28px;font:600 24px/1.2 var(--rer-font-heading,var(--rer-font-body,inherit));color:var(--rer-text,#17212e)}.brand img{display:block;flex:none;width:40px;height:40px;object-fit:contain}h1{font:600 20px/1.3 var(--rer-font-heading,var(--rer-font-body,inherit));margin:0 0 12px}p{color:var(--rer-muted,#475569);margin:0}p+p{margin-top:12px}code{font:inherit;font-weight:600;color:var(--rer-text,#17212e)}';
|
|
45
45
|
// Reads --rer-logo from the linked theme (a script after a stylesheet waits for it) and
|
|
46
46
|
// shows that same-origin file as an <img> named by the product; the text beside it is
|
|
47
47
|
// then hidden from screen readers so the name is announced once.
|
|
@@ -94,7 +94,8 @@ export function devGate({ key, origin, local }) {
|
|
|
94
94
|
admitsSession: admitted,
|
|
95
95
|
setCookie,
|
|
96
96
|
// GET serves the exchange page with the seed's productName, mark and theme; POST trades the key for the cookie.
|
|
97
|
-
|
|
97
|
+
// `invited` says whether the app has a person beyond the owner and its personas for `rer dev --as <email>` to take.
|
|
98
|
+
async exchange(request, branding, { invited = false } = {}) {
|
|
98
99
|
if (new URL(request.url).pathname !== DEV_KEY_PATH) return null;
|
|
99
100
|
if (request.method === 'GET' || request.method === 'HEAD') {
|
|
100
101
|
const { script, logo, style } = await exchangeHashes();
|
|
@@ -103,7 +104,7 @@ export function devGate({ key, origin, local }) {
|
|
|
103
104
|
const theme = brand?.theme;
|
|
104
105
|
const mark = brand?.mark ? `<img src="${escapeHtml(brand.mark)}" alt="${escapeHtml(brand.productName)}" width="40" height="40" decoding="async">` : '';
|
|
105
106
|
const themeLogo = theme && !brand.mark;
|
|
106
|
-
const body = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex, nofollow"><title>
|
|
107
|
+
const body = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex, nofollow"><title>Open the local app</title>${iconHead}${theme ? `<link rel="stylesheet" href="${escapeHtml(theme)}">` : ''}<style>${PAGE_STYLE}</style></head><body><main>${brand ? `<p class="brand">${mark}<span>${escapeHtml(brand.productName)}</span></p>` : ''}<h1>This app runs on your own computer</h1><p>It opens only from that computer. Use the link printed in the terminal where <code>rer dev</code> is running, or run <code>rer dev --as owner</code> from the project folder.</p>${invited ? '<p>To sign in as someone who was invited, run <code>rer dev --as</code> followed by their email address.</p>' : ''}</main>${themeLogo ? `<script>${LOGO_SCRIPT}</script>` : ''}<script>${EXCHANGE_SCRIPT}</script></body></html>`;
|
|
107
108
|
return new Response(request.method === 'HEAD' ? null : body, { headers: { ...privateHeaders, 'content-type': 'text/html; charset=utf-8',
|
|
108
109
|
'content-security-policy': `default-src 'none'; img-src 'self'; script-src ${script}${themeLogo ? ` ${logo}` : ''}; style-src ${theme ? "'self' " : ''}${style}${theme ? "; font-src 'self'" : ''}; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'` } });
|
|
109
110
|
}
|
|
@@ -54,6 +54,8 @@ export function createEmailLinkLifecycle({ config: input, clock = Date.now, mail
|
|
|
54
54
|
// Even ambiguous delivery cannot leave a valid, unreported auth link.
|
|
55
55
|
await revoke(); deny('mail_unavailable', 503);
|
|
56
56
|
}
|
|
57
|
+
// 'accepted' reached a mail provider; 'development' was suppressed on purpose (local or demo).
|
|
58
|
+
return result.status;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
async function requireFreshProof(actor) {
|
|
@@ -214,7 +214,8 @@ export interface OperatorAuth<R extends string = Role> {
|
|
|
214
214
|
confirmLink(request: Request, input: { token: string }): Promise<CompletedSession<R> | StepUpConfirmed>;
|
|
215
215
|
getSession(request: Request): Promise<Session<R> | null>;
|
|
216
216
|
signOut(request: Request): Promise<{ cookie: string }>;
|
|
217
|
-
|
|
217
|
+
/** `delivery: 'none'` means no message left this runtime (a development mail provider); `signInUrl` is then the key-gated local owner's way to open the invitation. */
|
|
218
|
+
invite(request: Request, input: { email: string; displayName: string; role?: Role; returnTo?: string }): Promise<{ status: 'accepted'; delivery?: 'none'; signInUrl?: string }>;
|
|
218
219
|
listOperators(request: Request): Promise<Operator<R>[]>;
|
|
219
220
|
/** Cancel a pending invitation using operators:deactivate policy; accepted invitations conflict. */
|
|
220
221
|
cancelInvitation(request: Request, operatorId: string): Promise<Operator<R>>;
|
|
@@ -9,6 +9,7 @@ import { securityHeaders, requireLoopback } from './http.mjs';
|
|
|
9
9
|
import { safeReturnTo } from './policy.mjs';
|
|
10
10
|
import { readInput, readParameters } from './input.mjs';
|
|
11
11
|
import { OWNER_SIGNIN_PATH } from './owner-signin-grant.mjs';
|
|
12
|
+
const ONE_CLICK_REFUSED = 'This sign-in link did not open here. Open the link from the app itself, or run rer dev --as followed by the email address from the project folder.';
|
|
12
13
|
function json(value, status = 200) { return Response.json(value, { status, headers: securityHeaders() }); }
|
|
13
14
|
function seeOther(location, cookie) { return new Response(null, { status: 303, headers: { ...securityHeaders(), ...(cookie ? { 'Set-Cookie': cookie } : {}), Location: location } }); }
|
|
14
15
|
// A native HTML form (the sign-in page before any script) gets a page back; an
|
|
@@ -143,6 +144,9 @@ export function createAuthHandler(auth) {
|
|
|
143
144
|
return settingsRefusalPage(request, auth.presentation, code, status);
|
|
144
145
|
}
|
|
145
146
|
if (form) return seeOther(notice(auth, error instanceof AuthError ? error.code : 'auth_unavailable'));
|
|
147
|
+
// A browser that follows a refused local one-click link gets words, with the same status and headers as the JSON.
|
|
148
|
+
if (path === '/auth/one-click' && auth.oneClick?.local && error instanceof AuthError && error.code === 'not_found' && representation(request) === 'html')
|
|
149
|
+
return new Response(ONE_CLICK_REFUSED, { status: error.status, headers: { ...securityHeaders(), 'Content-Type': 'text/plain; charset=utf-8' } });
|
|
146
150
|
if (error instanceof AuthError) return json({ error: error.code }, error.status);
|
|
147
151
|
// Do not put SQL, email addresses, setup tokens or provider exceptions on the wire.
|
|
148
152
|
return json({ error: 'auth_unavailable' }, 503);
|
|
@@ -136,6 +136,14 @@ With `--tag`, passing gates produce `public-source.tar`, containing the checked
|
|
|
136
136
|
exact ordinary files without Git history, and a hash-pinned site bundle:
|
|
137
137
|
`site/<id>/<version>/release.json`, published documents, listing assets and
|
|
138
138
|
`site/registry.json`.
|
|
139
|
+
The archive is built with the host `tar` from the files written out of the checked blobs, so
|
|
140
|
+
its bytes are not reproducible from the source alone (modes and times come from the producing
|
|
141
|
+
host); `publicExport.sha256` in the receipt, not a rebuild, is what the signed statement
|
|
142
|
+
checks the archive against. macOS `tar` would add a `._<name>` AppleDouble member for every file and
|
|
143
|
+
directory carrying an extended attribute: the producer runs it with `COPYFILE_DISABLE=1` and,
|
|
144
|
+
on macOS only, `--no-xattrs`, then reads the member names from the archive bytes and stops the
|
|
145
|
+
release before a digest is recorded if any `._*` member is not a tracked path (a tracked file
|
|
146
|
+
named `._x` is archived like any other).
|
|
139
147
|
Export attributes cannot silently omit or substitute bytes. The site metadata
|
|
140
148
|
comes from committed seed and contract data; no screenshots, install guarantees
|
|
141
149
|
or verified maturity claims are invented. Copy the reviewed bundle into the site
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { archiveMembers } from './archive-members.mjs';
|
|
2
|
+
|
|
3
|
+
const normal = path => path.replace(/^(\.\/)+/, '').replace(/\/+$/, '');
|
|
4
|
+
|
|
5
|
+
// macOS tar writes a `._<name>` AppleDouble member beside every file and
|
|
6
|
+
// directory that has extended attributes. The export is the tracked tree and
|
|
7
|
+
// nothing else: such a member is refused unless a tracked path is that name.
|
|
8
|
+
export function assertTrackedMembers(members, trackedPaths) {
|
|
9
|
+
const tracked = new Set();
|
|
10
|
+
for (const path of trackedPaths) {
|
|
11
|
+
const parts = path.split('/');
|
|
12
|
+
for (let length = 1; length <= parts.length; length++) tracked.add(parts.slice(0, length).join('/'));
|
|
13
|
+
}
|
|
14
|
+
const stray = members.map(member => normal(member.path)).filter(path => path && path.split('/').pop().startsWith('._') && !tracked.has(path));
|
|
15
|
+
if (stray.length)
|
|
16
|
+
throw Error(`Public export archive holds ${stray.length} AppleDouble entr${stray.length === 1 ? 'y' : 'ies'} that are not tracked paths (first: ${stray[0]}). `
|
|
17
|
+
+ 'macOS tar adds them from extended attributes; the release was stopped before any digest was recorded.');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function assertArchiveTracked(archive, trackedPaths) {
|
|
21
|
+
assertTrackedMembers(archiveMembers(archive), trackedPaths);
|
|
22
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
// Reads member paths straight from the tar bytes. A system `tar -t` on macOS
|
|
4
|
+
// merges AppleDouble members while listing, so it cannot be trusted to show
|
|
5
|
+
// what a Linux reader will extract.
|
|
6
|
+
const text = bytes => bytes.toString('utf8');
|
|
7
|
+
const field = (block, from, to) => text(block.subarray(from, to)).replace(/\0.*$/s, '');
|
|
8
|
+
|
|
9
|
+
function octal(bytes) {
|
|
10
|
+
if (bytes[0] & 0x80) {
|
|
11
|
+
let value = 0n;
|
|
12
|
+
for (const byte of bytes.subarray(1)) value = (value << 8n) | BigInt(byte);
|
|
13
|
+
return Number(value);
|
|
14
|
+
}
|
|
15
|
+
return parseInt(text(bytes).replace(/\0.*$/s, '').trim() || '0', 8);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function paxPath(data) {
|
|
19
|
+
let at = 0;
|
|
20
|
+
while (at < data.length) {
|
|
21
|
+
const space = data.indexOf(0x20, at);
|
|
22
|
+
const length = Number.parseInt(text(data.subarray(at, space)), 10);
|
|
23
|
+
if (!(length > 0)) break;
|
|
24
|
+
const record = text(data.subarray(space + 1, at + length - 1));
|
|
25
|
+
if (record.startsWith('path=')) return record.slice(5);
|
|
26
|
+
at += length;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function archiveMembers(file) {
|
|
32
|
+
const bytes = readFileSync(file), members = [];
|
|
33
|
+
let at = 0, next = null;
|
|
34
|
+
while (at + 512 <= bytes.length) {
|
|
35
|
+
const block = bytes.subarray(at, at + 512);
|
|
36
|
+
if (block.every(byte => byte === 0)) break;
|
|
37
|
+
const type = String.fromCharCode(block[156] || 0x30);
|
|
38
|
+
const size = octal(block.subarray(124, 136));
|
|
39
|
+
const data = bytes.subarray(at + 512, at + 512 + size);
|
|
40
|
+
at += 512 + Math.ceil(size / 512) * 512;
|
|
41
|
+
if (type === 'x') { next = paxPath(data) ?? next; continue; }
|
|
42
|
+
if (type === 'L') { next = text(data).replace(/\0.*$/s, ''); continue; }
|
|
43
|
+
if (type === 'g') continue;
|
|
44
|
+
const prefix = field(block, 345, 500);
|
|
45
|
+
members.push({ path: next ?? (prefix ? `${prefix}/` : '') + field(block, 0, 100), type });
|
|
46
|
+
next = null;
|
|
47
|
+
}
|
|
48
|
+
return members;
|
|
49
|
+
}
|
|
@@ -3,6 +3,7 @@ import { resolve, dirname } from 'node:path';
|
|
|
3
3
|
import { execFileSync } from 'node:child_process';
|
|
4
4
|
import { git } from './source.mjs';
|
|
5
5
|
import { sha256 } from './catalogue.mjs';
|
|
6
|
+
import { assertArchiveTracked } from './archive-guard.mjs';
|
|
6
7
|
|
|
7
8
|
// Read the checked Git blobs directly. export-ignore/export-subst attributes
|
|
8
9
|
// cannot silently remove or change bytes after publication inspection.
|
|
@@ -46,6 +47,11 @@ export function cleanHistory(source, temporary, tagged = false) {
|
|
|
46
47
|
export function publicExport(source, temporary, output) {
|
|
47
48
|
const tree = sourceTree(source, resolve(temporary, 'public-source'));
|
|
48
49
|
const archive = resolve(output, 'public-source.tar');
|
|
49
|
-
|
|
50
|
+
// macOS tar turns extended attributes into `._*` members and pax headers.
|
|
51
|
+
// COPYFILE_DISABLE is ignored elsewhere; the flag is added only on macOS so
|
|
52
|
+
// other hosts run the exact command they always did.
|
|
53
|
+
const flags = process.platform === 'darwin' ? ['--no-xattrs'] : [];
|
|
54
|
+
execFileSync('tar', ['-cf', archive, ...flags, '-C', tree, '.'], { stdio: ['ignore', 'pipe', 'pipe'], env: { ...process.env, COPYFILE_DISABLE: '1' } });
|
|
55
|
+
assertArchiveTracked(archive, source.entries.keys());
|
|
50
56
|
return { path: 'public-source.tar', sha256: sha256(readFileSync(archive)), format: 'tar', revision: source.commit };
|
|
51
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runeditrun/rer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.111",
|
|
4
4
|
"description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"./jsonc": "./cli/jsonc.mjs",
|
|
25
25
|
"./parse": "./cli/parse.mjs",
|
|
26
26
|
"./scheduled": "./cli/scheduled.mjs",
|
|
27
|
+
"./size-fixture": "./cli/size/fixture.mjs",
|
|
27
28
|
"./dev-identity": "./cli/dev-identity.mjs",
|
|
28
29
|
"./local-installer": "./onboarding/adapter.mjs",
|
|
29
30
|
"./state": "./onboarding/state.mjs",
|