@runeditrun/rer 0.2.89 → 0.2.90
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/cli/export.mjs +1 -0
- package/edition-authoring/base-copies.mjs +2 -2
- package/edition-authoring/module-closure.mjs +24 -1
- package/edition-authoring/module-packages.mjs +76 -0
- package/edition-authoring/workflow-copies.mjs +3 -1
- package/edition-authoring/workflow-scripts.mjs +4 -2
- package/global/CHANGELOG.md +8 -0
- package/modules/agent-door/conformance/journey.mjs +9 -3
- package/package.json +1 -1
package/cli/export.mjs
CHANGED
|
@@ -11,6 +11,7 @@ export const sourceRoots = ['default-seed/public/rer-theme.css', 'default-seed/p
|
|
|
11
11
|
sourceRoots.push('modules/agent-door/capabilities.mjs', 'modules/agent-door/capabilities.d.mts', 'modules/agent-door/conformance', 'modules/agent-door/CLAUSES.md');
|
|
12
12
|
sourceRoots.push('edition-authoring/archive-source.mjs');
|
|
13
13
|
sourceRoots.push('edition-authoring/copy-namespaces.mjs');
|
|
14
|
+
sourceRoots.push('edition-authoring/module-packages.mjs');
|
|
14
15
|
sourceRoots.push('foundation/runtime/contract-prose.mjs', 'foundation/runtime/contract-prose-patterns.mjs');
|
|
15
16
|
export async function inventory(base, roots = sourceRoots) {
|
|
16
17
|
const files = [];
|
|
@@ -534,7 +534,7 @@ export function refreshCopies(root, {positional: [revision], record: recordPath,
|
|
|
534
534
|
notices = templates.notices;
|
|
535
535
|
completeWorkflowHelpers(root, plans, {tree: next, read, revision});
|
|
536
536
|
const relocations = new Map();
|
|
537
|
-
const withheld = completeModuleCopies(root, plans, {tree: next, read, revision, base: origin.repository, baseArchive, recordPath, ownerSources, relocations,
|
|
537
|
+
const {withheld, packageDependencies} = completeModuleCopies(root, plans, {tree: next, read, revision, base: origin.repository, baseArchive, recordPath, ownerSources, relocations,
|
|
538
538
|
deliveries: migrations.flatMap(step => step.deliver.map(source => ({source, origin: step.origin, importers: step.copies})))});
|
|
539
539
|
// Closure may add individually recorded siblings when the seed originally
|
|
540
540
|
// selected runtime files one at a time instead of copying the directory.
|
|
@@ -602,7 +602,7 @@ export function refreshCopies(root, {positional: [revision], record: recordPath,
|
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
fs.writeFileSync(filename, json(record));
|
|
605
|
-
return {refreshed: revision, record: recordPath, copies: changes, retired: plans.filter(plan => plan.retired).map(plan => plan.copy.path), adapted, relocated: [...relocations.keys()], withheld, editionMigrations: migrations.map(({id, guide, edit, copies}) => ({id, guide, edit, copies})), ...templates, next: 'Run verify-base, then the edition tests, and commit the copied files with the record.'};
|
|
605
|
+
return {refreshed: revision, record: recordPath, copies: changes, retired: plans.filter(plan => plan.retired).map(plan => plan.copy.path), adapted, relocated: [...relocations.keys()], withheld, packageDependencies, editionMigrations: migrations.map(({id, guide, edit, copies}) => ({id, guide, edit, copies})), ...templates, next: 'Run verify-base, then the edition tests, and commit the copied files with the record.'};
|
|
606
606
|
} catch (error) {
|
|
607
607
|
if (!writing && !/no files were refreshed/i.test(error.message)) error.message += ' No files were refreshed.';
|
|
608
608
|
if (!writing && notices.length) error.message += '\n' + notices.join('\n');
|
|
@@ -6,6 +6,7 @@ import {dependencies, resolve, external, bindings, lexicalExports} from './runti
|
|
|
6
6
|
import {relocateDependencies} from './module-edges.mjs';
|
|
7
7
|
import {sharedNamespaces} from './copy-namespaces.mjs';
|
|
8
8
|
import {acknowledgementCommand} from './base-acknowledgements.mjs';
|
|
9
|
+
import {checkModulePackages} from './module-packages.mjs';
|
|
9
10
|
const code = name => /\.(?:[cm]?[jt]s|[jt]sx)$/.test(name) && !testSource(name);
|
|
10
11
|
const inside = (name, prefix) => prefix === '.' ? !name.startsWith('../') && !path.posix.isAbsolute(name) : name === prefix || name.startsWith(prefix + '/');
|
|
11
12
|
const mapped = (source, copy) => copy.path + source.slice(copy.originPath.length);
|
|
@@ -42,6 +43,8 @@ export function completeModuleCopies(root, plans, {tree, read, revision, base, b
|
|
|
42
43
|
for (const target of Object.keys(plan.copy.adapted ?? {})) enqueue(plan, plan.copy.originPath + target.slice(plan.copy.path.length), null, true);
|
|
43
44
|
}
|
|
44
45
|
const directoryAdditions = new Set([...planned].filter(([target, {plan}]) => !Object.hasOwn(plan.copy.files, target) && !tree.has(plan.copy.originPath)).map(([target]) => target));
|
|
46
|
+
const packageRoots = new Set([...planned.keys()].filter(target => !directoryAdditions.has(target)));
|
|
47
|
+
for (const {target, adapted} of queue) if (adapted) packageRoots.add(target);
|
|
45
48
|
function namespace(copy) {
|
|
46
49
|
const file = Object.hasOwn(copy.files, copy.path) || tree.has(copy.originPath);
|
|
47
50
|
if (file && path.posix.basename(copy.path) !== path.posix.basename(copy.originPath)) return {};
|
|
@@ -99,6 +102,7 @@ export function completeModuleCopies(root, plans, {tree, read, revision, base, b
|
|
|
99
102
|
for (const target of new Set(targets)) {
|
|
100
103
|
if (!witness(target, source)) refuse(target, 'migration delivery has no witnessed destination', '${EDITOR:-vi} base-copies.json');
|
|
101
104
|
include(source, target);
|
|
105
|
+
packageRoots.add(target); // Explicitly consented migration delivery.
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
// Template files can refer to another recorded copy whose Base origin is
|
|
@@ -269,5 +273,24 @@ export function completeModuleCopies(root, plans, {tree, read, revision, base, b
|
|
|
269
273
|
}
|
|
270
274
|
if (!adapted && edges.some(edge => edge.relocation)) relocations.set(target, Buffer.from(relocateDependencies(bytes, edges)));
|
|
271
275
|
}
|
|
272
|
-
|
|
276
|
+
const modules = new Map();
|
|
277
|
+
for (const [target, {source, entry}] of planned) if (/\.(?:[cm]?[jt]s|[jt]sx)$/.test(source)) {
|
|
278
|
+
const bytes = blob(entry);
|
|
279
|
+
modules.set(target, {source, bytes, dependencies: requests(bytes, source, target).map(request => edge(source, target, request).destination).filter(Boolean)});
|
|
280
|
+
}
|
|
281
|
+
for (const {source, target, adapted} of queue) if (adapted) {
|
|
282
|
+
const bytes = local(target);
|
|
283
|
+
// Adaptations are roots of the retained graph; their own package choices
|
|
284
|
+
// stay seed-owned, while new delivered dependencies must be declared.
|
|
285
|
+
modules.set(target, {source, bytes: '', dependencies: requests(bytes, source, target).map(request => edge(source, target, request).destination).filter(Boolean)});
|
|
286
|
+
}
|
|
287
|
+
const packages = checkModulePackages(root, modules, packageRoots, tree);
|
|
288
|
+
for (const [target, item] of packages.withheld) {
|
|
289
|
+
const {plan, source} = planned.get(target);
|
|
290
|
+
plan.sources = plan.sources.filter(([name]) => name !== source);
|
|
291
|
+
planned.delete(target); relocations.delete(target); withheld.push(item);
|
|
292
|
+
}
|
|
293
|
+
// Closure-created singletons with no retained files need no empty record.
|
|
294
|
+
for (let i = plans.length - 1; i >= 0; i--) if (!plans[i].sources.length && !Object.keys(plans[i].copy.files).length) plans.splice(i, 1);
|
|
295
|
+
return {withheld, packageDependencies: packages.packageDependencies};
|
|
273
296
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Package installation belongs to the edition. Optional source additions may
|
|
2
|
+
// not impose a new package, and retained source must refuse before any writes.
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import {isBuiltin} from 'node:module';
|
|
6
|
+
import {dependencies, resolve} from './runtime-dependencies.mjs';
|
|
7
|
+
|
|
8
|
+
const sections = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
|
|
9
|
+
const version = (manifest, name) => sections.map(section => manifest[section]?.[name]).find(value => typeof value === 'string');
|
|
10
|
+
function packageName(specifier) {
|
|
11
|
+
if (specifier.startsWith('.') || specifier.startsWith('/') || specifier.startsWith('#') ||
|
|
12
|
+
/^[a-z][a-z\d+.-]*:/i.test(specifier) || isBuiltin(specifier)) return;
|
|
13
|
+
const parts = specifier.split('/');
|
|
14
|
+
return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function checkModulePackages(root, modules, roots, tree) {
|
|
18
|
+
const filename = path.join(root, 'package.json');
|
|
19
|
+
const manifest = fs.existsSync(filename) ? JSON.parse(fs.readFileSync(filename, 'utf8')) : {};
|
|
20
|
+
const manifests = new Map(), packages = new Map(), missing = new Map();
|
|
21
|
+
function baseVersion(source, name) {
|
|
22
|
+
let directory = path.posix.dirname(source);
|
|
23
|
+
while (true) {
|
|
24
|
+
const file = path.posix.join(directory, 'package.json');
|
|
25
|
+
if (tree.has(file)) {
|
|
26
|
+
if (!manifests.has(file)) manifests.set(file, JSON.parse(tree.read(file)));
|
|
27
|
+
const declared = version(manifests.get(file), name);
|
|
28
|
+
if (declared) return declared;
|
|
29
|
+
}
|
|
30
|
+
if (directory === '.') break;
|
|
31
|
+
directory = path.posix.dirname(directory);
|
|
32
|
+
}
|
|
33
|
+
// Shared foundation runtime lives outside the maintained app's package.
|
|
34
|
+
const reference = 'default-seed/package.json';
|
|
35
|
+
if (!tree.has(reference)) return;
|
|
36
|
+
if (!manifests.has(reference)) manifests.set(reference, JSON.parse(tree.read(reference)));
|
|
37
|
+
return version(manifests.get(reference), name);
|
|
38
|
+
}
|
|
39
|
+
for (const [target, module] of modules) for (const request of dependencies(module.bytes, module.source)) {
|
|
40
|
+
const name = packageName(request.specifier);
|
|
41
|
+
if (!name) continue;
|
|
42
|
+
const scope = {};
|
|
43
|
+
resolve(tree, module.source, request.specifier, {...request, package: scope});
|
|
44
|
+
if (scope.managed && !scope.external) continue; // A local package self-reference.
|
|
45
|
+
const declared = version(manifest, name), pinned = baseVersion(module.source, name);
|
|
46
|
+
const key = JSON.stringify([name, declared, pinned]);
|
|
47
|
+
if (!packages.has(key)) packages.set(key, {package: name, version: declared ?? null, baseVersion: pinned ?? null,
|
|
48
|
+
conflict: Boolean(declared && pinned && declared !== pinned), files: []});
|
|
49
|
+
packages.get(key).files.push(target);
|
|
50
|
+
if (!declared) missing.set(target, {package: name, baseVersion: pinned ?? null});
|
|
51
|
+
}
|
|
52
|
+
const required = new Set();
|
|
53
|
+
function retain(target) {
|
|
54
|
+
if (required.has(target) || !modules.has(target)) return;
|
|
55
|
+
required.add(target);
|
|
56
|
+
for (const dependency of modules.get(target).dependencies) retain(dependency);
|
|
57
|
+
}
|
|
58
|
+
roots.forEach(retain);
|
|
59
|
+
for (const [target, item] of missing) if (required.has(target)) {
|
|
60
|
+
throw Error(`Cannot refresh module ${target}: package ${item.package} is not declared in the seed's package.json${item.baseVersion ? ` (Base uses ${item.baseVersion})` : ''}. This module is required by retained source. Review its adoption, declare and install the dependency with the seed's package manager, then repeat refresh-base; no files were refreshed.`);
|
|
61
|
+
}
|
|
62
|
+
// Withhold the whole connected optional addition, including its importers
|
|
63
|
+
// and exclusive siblings, rather than leaving half of a feature behind.
|
|
64
|
+
const neighbours = new Map([...modules.keys()].map(target => [target, new Set()]));
|
|
65
|
+
for (const [target, module] of modules) for (const dependency of module.dependencies) if (modules.has(dependency)) {
|
|
66
|
+
neighbours.get(target).add(dependency); neighbours.get(dependency).add(target);
|
|
67
|
+
}
|
|
68
|
+
const withheld = new Map();
|
|
69
|
+
function hold(target, reason) {
|
|
70
|
+
if (required.has(target) || withheld.has(target)) return;
|
|
71
|
+
withheld.set(target, {...reason, path: target, originPath: modules.get(target).source, reason: 'undeclared-package'});
|
|
72
|
+
for (const neighbour of neighbours.get(target)) hold(neighbour, reason);
|
|
73
|
+
}
|
|
74
|
+
for (const [target, reason] of missing) hold(target, reason);
|
|
75
|
+
return {withheld, packageDependencies: [...packages.values()].map(item => ({...item, files: [...new Set(item.files)].sort()}))};
|
|
76
|
+
}
|
|
@@ -63,13 +63,15 @@ export function adoptWorkflowTemplates(root, plans, {tree, read, revision, files
|
|
|
63
63
|
|
|
64
64
|
function invocations(text) {
|
|
65
65
|
const {scripts, uses} = workflowScripts(text);
|
|
66
|
-
const paths = scripts.flatMap(literalPaths).flatMap(name => {
|
|
66
|
+
const paths = scripts.flatMap(script => literalPaths(script, {helpersOnly: true})).flatMap(name => {
|
|
67
67
|
try { return [safe(name)]; }
|
|
68
68
|
catch (error) {
|
|
69
69
|
if (name.startsWith('scripts/') || name.startsWith('.github/workflows/')) throw error;
|
|
70
70
|
return []; // A URL or command option is not a relative helper path.
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
// A workflow's archive/cache/build inputs do not select application source.
|
|
74
|
+
// Tooling namespaces and explicitly selected ./ helpers retain acquisition.
|
|
73
75
|
return [...new Set([...uses.map(name => safe(name.slice(2))), ...paths])];
|
|
74
76
|
}
|
|
75
77
|
|
|
@@ -93,7 +93,7 @@ export function shellWords(script) {
|
|
|
93
93
|
return words;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
export function literalPaths(script) {
|
|
96
|
+
export function literalPaths(script, {helpersOnly = false} = {}) {
|
|
97
97
|
const names = new Set();
|
|
98
98
|
function scan(text, ancestors = new Set(), words = shellWords(text)) {
|
|
99
99
|
if (ancestors.has(text)) return;
|
|
@@ -101,7 +101,9 @@ export function literalPaths(script) {
|
|
|
101
101
|
for (const {value, dynamic} of words) {
|
|
102
102
|
if (dynamic) continue;
|
|
103
103
|
const relative = value.replace(/^\.\//, '');
|
|
104
|
-
if ((value.startsWith('./') || relative.startsWith('scripts/') || !/\s/.test(value) && (relative.includes('/') || /\.[a-z0-9]+$/i.test(relative))) && !relative.startsWith('/'))
|
|
104
|
+
if ((value.startsWith('./') || relative.startsWith('scripts/') || !/\s/.test(value) && (relative.includes('/') || /\.[a-z0-9]+$/i.test(relative))) && !relative.startsWith('/')) {
|
|
105
|
+
if (!helpersOnly || value.startsWith('./') || relative.startsWith('scripts/') || relative.startsWith('.github/workflows/')) names.add(relative);
|
|
106
|
+
}
|
|
105
107
|
// A complete quoted path is one word; only script-like quoted content is
|
|
106
108
|
// recursively tokenized, never a path whose filename contains whitespace.
|
|
107
109
|
else if (/\s/.test(value)) {
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.90
|
|
4
|
+
|
|
5
|
+
- Withhold optional copied Base modules and workflow helpers whose required packages the edition has not declared. Refresh preserves supported dependency closure and explains the package declaration needed to opt in.
|
|
6
|
+
- Retain approved mutation outcomes and original effect facts through restore, schedule, grant, role and consumed-draft retries while rechecking current native authority, scope, pause, policy and proof. Changed arguments still conflict; read-only replay retains current native visibility.
|
|
7
|
+
- Keep signing command ordering safe when an identical concurrent command consumes its intent before the next read. Conformance accepts older receipts without a `decision` field while checking their original decision identity.
|
|
8
|
+
- Known limitation (A1, deferred): an approved native DELETE retried with its original key can return `not_found` when its classifier re-reads the deleted target. Authority-preserving replay for deleted targets follows; see `ADOPTING.md`.
|
|
9
|
+
- Make agent owner pages readable with names, action facts in sentences, local times and 44px touch targets, retaining approval, review and native authorization boundaries.
|
|
10
|
+
|
|
3
11
|
## 0.2.89
|
|
4
12
|
|
|
5
13
|
- Publication email hygiene recognizes parsed dependency package contact metadata and registry deprecation notices in pnpm, npm and Yarn lockfiles. Comments, custom keys, repository author fields, source files and secret checks retain their findings; no address allowlist is needed. This scanner source update can be adopted independently of a launcher package release.
|
|
@@ -67,12 +67,18 @@ export async function runJourney(c, phase, { held = false, injections = false, r
|
|
|
67
67
|
const after = await c.witness();
|
|
68
68
|
c.add(`BASE-AGENT-007.5.no-effect.${step.id}`, isDeepStrictEqual(before, after), `${step.tool} changed native state before approval.`);
|
|
69
69
|
if (!approval?.id) continue;
|
|
70
|
-
const approved = await c.decideApproval(answer);
|
|
70
|
+
const heldDecision = answer.decision, approved = await c.decideApproval(answer);
|
|
71
71
|
await checkTarget(c, step, outputs, answer, phase, true);
|
|
72
72
|
c.add(`BASE-AGENT-008.5.approver.${step.id}`, approved.ok, `Signed-in sponsor approval returned HTTP ${approved.status}.`);
|
|
73
73
|
answer = await c.stepTool(step, args, { ...proof, requestState: answer.result.requestState });
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
const receipt = answer.result?._meta?.['com.runeditrun/receipt'];
|
|
75
|
+
// Older receipts carry only the original id; their current decision's
|
|
76
|
+
// computed facts may change after the effect.
|
|
77
|
+
const hasDecision = receipt && Object.hasOwn(receipt, 'decision');
|
|
78
|
+
const approvedDecision = hasDecision ? receipt.decision : answer.decision;
|
|
79
|
+
const originalEvidence = hasDecision ? isDeepStrictEqual(approvedDecision, heldDecision) : receipt?.decision_id === heldDecision.id;
|
|
80
|
+
checkClasses(c, step, { decision: approvedDecision }, `${phase}.approved`);
|
|
81
|
+
c.add(`BASE-AGENT-007.5.receipt.${step.id}`, !answer.result?.isError && answer.result?.resultType !== 'input_required' && receipt && approvedDecision?.disposition === 'approval' && originalEvidence && answer.decision?.revision === c.revision && answer.decision?.disposition === 'approval' && isDeepStrictEqual(answer.decision.classes, approvedDecision.classes), 'The approved retry must retain its exact original approval evidence and pass current policy admission.');
|
|
76
82
|
}
|
|
77
83
|
c.add(`BASE-AGENT-013.4.${phase}.${step.id}`, answer.status === 200 && answer.result && !answer.result.isError && answer.result.resultType !== 'input_required', `${step.tool} did not complete (${errorCode(answer) ?? answer.status}).`);
|
|
78
84
|
if (answer.result?.isError || answer.result?.structuredContent === undefined) continue;
|